text:
package de.peeeq.wurstscript.intermediatelang.optimizer;

import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import de.peeeq.datastructures.TransitiveClosure;
import de.peeeq.wurstscript.jassIm.*;
import de.peeeq.wurstscript.translation.imtranslation.ImHelper;

import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Analyzes a program for side-effects
 */
public class SideEffectAnalyzer {

    private final ImProg prog;
    // f -> set of functions directly called by f
    private Multimap<ImFunction, ImFunction> callRelation;
    // f -> set of functions directly and transitively called by f
    private TransitiveClosure<ImFunction> callRelationTr;
    // f -> global variables directly used in f
    private Multimap<ImFunction, ImVar> usedGlobals;

    public SideEffectAnalyzer(ImProg prog) {
        this.prog = prog;
    }

    /**
     * checks if this expression might have side effects
     * (does not do a deep analysis, all function calls and statements are considered to have side effects)
     */
    public static boolean quickcheckHasSideeffects(ImExpr expr) {
        return expr.match(new ImExpr.Matcher<Boolean>() {
            @Override
            public Boolean case_ImFunctionCall(ImFunctionCall imFunctionCall) {
                return true;
            }

            @Override
            public Boolean case_ImTypeIdOfClass(ImTypeIdOfClass imTypeIdOfClass) {
                return false;
            }

            @Override
            public Boolean case_ImVarArrayAccess(ImVarArrayAccess e) {
                return e.getIndexes().stream().anyMatch(SideEffectAnalyzer::quickcheckHasSideeffects);
            }

            @Override
            public Boolean case_ImRealVal(ImRealVal imRealVal) {
                return false;
            }

            @Override
            public Boolean case_ImTupleSelection(ImTupleSelection e) {
                return quickcheckHasSideeffects(e.getTupleExpr());
            }

            @Override
            public Boolean case_ImInstanceof(ImInstanceof e) {
                return quickcheckHasSideeffects(e.getObj());
            }

            @Override
            public Boolean case_ImDealloc(ImDealloc imDealloc) {
                return true;
            }

            @Override
            public Boolean case_ImMemberAccess(ImMemberAccess e) {
                return quickcheckHasSideeffects(e.getReceiver());
            }

            @Override
            public Boolean case_ImBoolVal(ImBoolVal imBoolVal) {
                return false;
            }

            @Override
            public Boolean case_ImTupleExpr(ImTupleExpr e) {
                return e.getExprs().stream().anyMatch(SideEffectAnalyzer::quickcheckHasSideeffects);
            }

            @Override
            public Boolean case_ImNull(ImNull imNull) {
                return false;
            }

            @Override
            public Boolean case_ImGetStackTrace(ImGetStackTrace imGetStackTrace) {
                return true;
            }

            @Override
            public Boolean case_ImTypeVarDispatch(ImTypeVarDispatch imTypeVarDispatch) {
                return true;
            }

            @Override
            public Boolean case_ImOperatorCall(ImOperatorCall e) {
                return e.getArguments().stream().anyMatch(SideEffectAnalyzer::quickcheckHasSideeffects);
            }

            @Override
            public Boolean case_ImStringVal(ImStringVal imStringVal) {
                return false;
            }

            @Override
            public Boolean case_ImMethodCall(ImMethodCall imMethodCall) {
                return true;
            }

            @Override
            public Boolean case_ImAlloc(ImAlloc imAlloc) {
                return true;
            }

            @Override
            public Boolean case_ImCast(ImCast imCast) {
                return quickcheckHasSideeffects(imCast.getExpr());
            }

            @Override
            public Boolean case_ImCompiletimeExpr(ImCompiletimeExpr imCompiletimeExpr) {
                return true;
            }

            @Override
            public Boolean case_ImTypeIdOfObj(ImTypeIdOfObj e) {
                return quickcheckHasSideeffects(e.getObj());
            }

            @Override
            public Boolean case_ImVarAccess(ImVarAccess imVarAccess) {
                return false;
            }

            @Override
            public Boolean case_ImIntVal(ImIntVal imIntVal) {
                return false;
            }

            @Override
            public Boolean case_ImFuncRef(ImFuncRef imFuncRef) {
                return false;
            }

            @Override
            public Boolean case_ImStatementExpr(ImStatementExpr imStatementExpr) {
                return true;
            }
        });
    }

    /**
     * @return f -> set of functions directly called by f
     */
    public Multimap<ImFunction, ImFunction> getCallRelation() {
        if (callRelation != null) {
            return callRelation;
        }
        callRelation = LinkedListMultimap.create();
        for (ImFunction caller : ImHelper.calculateFunctionsOfProg(prog)) {
            callRelation.putAll(caller, directlyCalledFunctions(caller));
        }
        return callRelation;
    }

    /**
     * @return f -> set of functions directly and transitively called by f
     */
    public TransitiveClosure<ImFunction> getCallRelationTr() {
        if (callRelationTr != null) {
            return callRelationTr;
        }
        callRelationTr = new TransitiveClosure<>(getCallRelation());
        return callRelationTr;
    }

    /**
     * @return f -> global variables directly used in f
     */
    public Multimap<ImFunction, ImVar> getUsedGlobals() {
        if (usedGlobals != null) {
            return usedGlobals;
        }
        usedGlobals = LinkedHashMultimap.create();
        for (ImFunction function : ImHelper.calculateFunctionsOfProg(prog)) {
            for (ImVar v : directlyUsedVariables(function)) {
                if (v.isGlobal()) {
                    usedGlobals.put(function, v);
                }
            }
        }
        return usedGlobals;
    }

    /**
     * Functions directly or indirectly called in e
     */
    public Set<ImFunction> calledFunctions(Element e) {
        return calledFunctionsStream(e)
                .collect(Collectors.toSet());
    }

    /**
     * Functions directly or indirectly called in e
     */
    private Stream<ImFunction> calledFunctionsStream(Element e) {
        return directlyCalledFunctions(e).stream()
                .flatMap(f -> Stream.concat(Stream.of(f), getCallRelationTr().get(f)));
    }

    /**
     * Natives directly or indirectly called in e
     */
    public Set<ImFunction> calledNatives(Element e) {
        return calledFunctionsStream(e)
                .filter(ImFunction::isNative)
                .collect(Collectors.toSet());
    }

    /**
     * Variables directly or indirectly (via called functions) used in e
     * Does not consider variables used because of natives doing stuff (e.g. ForGroup callback)
     */
    public Set<ImVar> usedVariables(Element e) {
        Stream<ImVar> indirectGlobals = calledFunctionsStream(e)
                .flatMap(f -> getUsedGlobals().get(f).stream());
        return Stream.concat(indirectGlobals, directlyUsedVariables(e).stream())
                .collect(Collectors.toSet());
    }

    /**
     * Functions directly called in e
     */
    public Set<ImFunction> directlyCalledFunctions(Element e) {
        Set<ImFunction> calledFunctions = new LinkedHashSet<>();
        e.accept(new ImFunction.DefaultVisitor() {

            @Override
            public void visit(ImFunctionCall c) {
                super.visit(c);
                calledFunctions.add(c.getFunc());
            }

            @Override
            public void visit(ImMethodCall c) {
                super.visit(c);
                calledFunctions.add(c.getMethod().getImplementation());
            }
        });
        return calledFunctions;

    }

    /**
     * Variables directly used in e
     */
    public Set<ImVar> directlyUsedVariables(Element e) {
        Set<ImVar> imVars = new LinkedHashSet<>();
        e.accept(new ImStmt.DefaultVisitor() {

            @Override
            public void visit(ImVarAccess va) {
                super.visit(va);
                imVars.add(va.getVar());
            }

            @Override
            public void visit(ImVarArrayAccess va) {
                super.visit(va);
                imVars.add(va.getVar());
            }

            @Override
            public void visit(ImMemberAccess va) {
                super.visit(va);
                imVars.add(va.getVar());
            }

            @Override
            public void visit(ImSet va) {
                super.visit(va);
                ImLExpr assignable = va.getLeft();
                collectVars(imVars, assignable);

            }

            @Override
            public void visit(ImVarargLoop va) {
                super.visit(va);
                imVars.add(va.getLoopVar());
            }

        });
        return imVars;
    }

    private void collectVars(Collection<ImVar> imVars, ImLExpr assignable) {
        assignable.match(new ImLExpr.MatcherVoid() {
            @Override
            public void case_ImVarAccess(ImVarAccess v) {
                imVars.add(v.getVar());
            }

            @Override
            public void case_ImStatementExpr(ImStatementExpr imStatementExpr) {
                throw new RuntimeException("TODO"); // TODO
            }

            @Override
            public void case_ImTupleSelection(ImTupleSelection v) {
                collectVars(imVars, (ImLExpr) v.getTupleExpr());
            }

            @Override
            public void case_ImVarArrayAccess(ImVarArrayAccess v) {
                imVars.add(v.getVar());
            }

            @Override
            public void case_ImMemberAccess(ImMemberAccess v) {
                imVars.add(v.getVar());
            }

            @Override
            public void case_ImTupleExpr(ImTupleExpr te) {
                for (ImExpr e : te.getExprs()) {
                    ((ImLExpr) e).match(this);
                }
            }
        });
    }

    /**
     * Variables directly used in e
     */
    public Set<ImVar> directlyAccessedVariables(Element e) {
        Set<ImVar> imVars = new LinkedHashSet<>();
        e.accept(new ImStmt.DefaultVisitor() {

            @Override
            public void visit(ImVarAccess va) {
                super.visit(va);
                imVars.add(va.getVar());
            }

            @Override
            public void visit(ImVarArrayAccess va) {
                super.visit(va);
                imVars.add(va.getVar());
            }

            @Override
            public void visit(ImMemberAccess va) {
                super.visit(va);
                imVars.add(va.getVar());
            }

        });
        return imVars;
    }

    /**
     * Variables directly used in e
     */
    public Set<ImVar> directlySetVariables(Element e) {
        Set<ImVar> imVars = new LinkedHashSet<>();
        e.accept(new ImStmt.DefaultVisitor() {

            @Override
            public void visit(ImSet va) {
                super.visit(va);
                collectVars(imVars, va.getLeft());
            }

            @Override
            public void visit(ImVarargLoop va) {
                super.visit(va);
                imVars.add(va.getLoopVar());
            }

        });
        return imVars;
    }

    /**
     * Checks if two statements might affect each other.
     * When this returns true, it is certain that it does not matter whether stmt1 or stmt2 are called first
     * <p>
     * The only difference between executing stmt1; stmt2 vs stmt2; stmt1 would be if one of the statement
     * crashes and thus the second statement would not be executed.
     * But for optimizations, we assume the program already is correct and thus we can ignore crashes.
     */
    public boolean mightAffect(ImStmt stmt1, ImStmt stmt2) {
        if (!calledNatives(stmt1).isEmpty() || !calledNatives(stmt2).isEmpty()) {
            // there are natives that can affect other natives
            // be safe
            return true;
        }
        Set<ImVar> used1 = usedVariables(stmt1);
        Set<ImVar> used2 = usedVariables(stmt2);

        // check that there are no variables, that both use
        return used1.stream().anyMatch(used2::contains);
    }

    /**
     * Checks if the given statement cannot use the variable v
     */
    public boolean cannotUseVar(ImStmt s, ImVar v) {
        if (v.isGlobal()) {
            Set<ImVar> imVars = usedVariables(s);
            Set<ImFunction> imFunctions = calledNatives(s);
            return !imVars.contains(v) && imFunctions.isEmpty();
        } else {
            // local variables
            Set<ImVar> imVars = directlyUsedVariables(s);
            return !imVars.contains(v);
        }
    }

    /**
     * Checks if the given function calls any functions or modifies and variable
     */
    public boolean hasSideEffects(Element elem) {
        Set<ImFunction> natives = calledNatives(elem);
        Set<ImFunction> directFuncs = calledFunctions(elem);
        Set<ImVar> imVars = directlySetVariables(elem);
        return natives.size() + directFuncs.size() + imVars.size() > 0;
    }
}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace SpentBook.Web.Identity.Models.HomeViewModels
{
    public class ClientViewModel
    {
        public string Name { get; set; }

        [Display(Name = "Client ID")]
        public string ClientId { get; set; }

        [Display(Name = "Redirect URIs")]
        public IEnumerable<string> RedirectUris { get; set; }

        public IEnumerable<string> Scopes { get; set; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package http

import (
	"crypto/tls"
	"encoding/base64"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"net/url"
	"strings"
	"sync"
	"sync/atomic"
	"time"
)

// A Client is an HTTP client. Its zero value (DefaultClient) is a
// usable client that uses DefaultTransport.
//
// The Client's Transport typically has internal state (cached TCP
// connections), so Clients should be reused instead of created as
// needed. Clients are safe for concurrent use by multiple goroutines.
//
// A Client is higher-level than a RoundTripper (such as Transport)
// and additionally handles HTTP details such as cookies and
// redirects.
type Client struct {
	// Transport specifies the mechanism by which individual
	// HTTP requests are made.
	// If nil, DefaultTransport is used.
	Transport RoundTripper

	// CheckRedirect specifies the policy for handling redirects.
	// If CheckRedirect is not nil, the client calls it before
	// following an HTTP redirect. The arguments req and via are
	// the upcoming request and the requests made already, oldest
	// first. If CheckRedirect returns an error, the Client's Get
	// method returns both the previous Response and
	// CheckRedirect's error (wrapped in a url.Error) instead of
	// issuing the Request req.
	//
	// If CheckRedirect is nil, the Client uses its default policy,
	// which is to stop after 10 consecutive requests.
	CheckRedirect func(req *Request, via []*Request) error

	// Jar specifies the cookie jar.
	// If Jar is nil, cookies are not sent in requests and ignored
	// in responses.
	Jar CookieJar

	// Timeout specifies a time limit for requests made by this
	// Client. The timeout includes connection time, any
	// redirects, and reading the response body. The timer remains
	// running after Get, Head, Post, or Do return and will
	// interrupt reading of the Response.Body.
	//
	// A Timeout of zero means no timeout.
	//
	// The Client's Transport must support the CancelRequest
	// method or Client will return errors when attempting to make
	// a request with Get, Head, Post, or Do. Client's default
	// Transport (DefaultTransport) supports CancelRequest.
	Timeout time.Duration
}

// DefaultClient is the default Client and is used by Get, Head, and Post.
var DefaultClient = &Client{}

// RoundTripper is an interface representing the ability to execute a
// single HTTP transaction, obtaining the Response for a given Request.
//
// A RoundTripper must be safe for concurrent use by multiple
// goroutines.
type RoundTripper interface {
	// RoundTrip executes a single HTTP transaction, returning
	// the Response for the request req.  RoundTrip should not
	// attempt to interpret the response.  In particular,
	// RoundTrip must return err == nil if it obtained a response,
	// regardless of the response's HTTP status code.  A non-nil
	// err should be reserved for failure to obtain a response.
	// Similarly, RoundTrip should not attempt to handle
	// higher-level protocol details such as redirects,
	// authentication, or cookies.
	//
	// RoundTrip should not modify the request, except for
	// consuming and closing the Body, including on errors. The
	// request's URL and Header fields are guaranteed to be
	// initialized.
	RoundTrip(*Request) (*Response, error)
}

// Given a string of the form "host", "host:port", or "[ipv6::address]:port",
// return true if the string includes a port.
func hasPort(s string) bool { return strings.LastIndex(s, ":") > strings.LastIndex(s, "]") }

// refererForURL returns a referer without any authentication info or
// an empty string if lastReq scheme is https and newReq scheme is http.
func refererForURL(lastReq, newReq *url.URL) string {
	// https://tools.ietf.org/html/rfc7231#section-5.5.2
	//   "Clients SHOULD NOT include a Referer header field in a
	//    (non-secure) HTTP request if the referring page was
	//    transferred with a secure protocol."
	if lastReq.Scheme == "https" && newReq.Scheme == "http" {
		return ""
	}
	referer := lastReq.String()
	if lastReq.User != nil {
		// This is not very efficient, but is the best we can
		// do without:
		// - introducing a new method on URL
		// - creating a race condition
		// - copying the URL struct manually, which would cause
		//   maintenance problems down the line
		auth := lastReq.User.String() + "@"
		referer = strings.Replace(referer, auth, "", 1)
	}
	return referer
}

// Used in Send to implement io.ReadCloser by bundling together the
// bufio.Reader through which we read the response, and the underlying
// network connection.
type readClose struct {
	io.Reader
	io.Closer
}

func (c *Client) send(req *Request) (*Response, error) {
	if c.Jar != nil {
		for _, cookie := range c.Jar.Cookies(req.URL) {
			req.AddCookie(cookie)
		}
	}
	resp, err := send(req, c.transport())
	if err != nil {
		return nil, err
	}
	if c.Jar != nil {
		if rc := resp.Cookies(); len(rc) > 0 {
			c.Jar.SetCookies(req.URL, rc)
		}
	}
	return resp, err
}

// Do sends an HTTP request and returns an HTTP response, following
// policy (e.g. redirects, cookies, auth) as configured on the client.
//
// An error is returned if caused by client policy (such as
// CheckRedirect), or if there was an HTTP protocol error.
// A non-2xx response doesn't cause an error.
//
// When err is nil, resp always contains a non-nil resp.Body.
//
// Callers should close resp.Body when done reading from it. If
// resp.Body is not closed, the Client's underlying RoundTripper
// (typically Transport) may not be able to re-use a persistent TCP
// connection to the server for a subsequent "keep-alive" request.
//
// The request Body, if non-nil, will be closed by the underlying
// Transport, even on errors.
//
// Generally Get, Post, or PostForm will be used instead of Do.
func (c *Client) Do(req *Request) (resp *Response, err error) {
	if req.Method == "GET" || req.Method == "HEAD" {
		return c.doFollowingRedirects(req, shouldRedirectGet)
	}
	if req.Method == "POST" || req.Method == "PUT" {
		return c.doFollowingRedirects(req, shouldRedirectPost)
	}
	return c.send(req)
}

func (c *Client) transport() RoundTripper {
	if c.Transport != nil {
		return c.Transport
	}
	return DefaultTransport
}

// send issues an HTTP request.
// Caller should close resp.Body when done reading from it.
func send(req *Request, t RoundTripper) (resp *Response, err error) {
	if t == nil {
		req.closeBody()
		return nil, errors.New("http: no Client.Transport or DefaultTransport")
	}

	if req.URL == nil {
		req.closeBody()
		return nil, errors.New("http: nil Request.URL")
	}

	if req.RequestURI != "" {
		req.closeBody()
		return nil, errors.New("http: Request.RequestURI can't be set in client requests.")
	}

	// Most the callers of send (Get, Post, et al) don't need
	// Headers, leaving it uninitialized.  We guarantee to the
	// Transport that this has been initialized, though.
	if req.Header == nil {
		req.Header = make(Header)
	}

	if u := req.URL.User; u != nil && req.Header.Get("Authorization") == "" {
		username := u.Username()
		password, _ := u.Password()
		req.Header.Set("Authorization", "Basic "+basicAuth(username, password))
	}
	resp, err = t.RoundTrip(req)
	if err != nil {
		if resp != nil {
			log.Printf("RoundTripper returned a response & error; ignoring response")
		}
		if tlsErr, ok := err.(tls.RecordHeaderError); ok {
			// If we get a bad TLS record header, check to see if the
			// response looks like HTTP and give a more helpful error.
			// See golang.org/issue/11111.
			if string(tlsErr.RecordHeader[:]) == "HTTP/" {
				err = errors.New("http: server gave HTTP response to HTTPS client")
			}
		}
		return nil, err
	}
	return resp, nil
}

// See 2 (end of page 4) http://www.ietf.org/rfc/rfc2617.txt
// "To receive authorization, the client sends the userid and password,
// separated by a single colon (":") character, within a base64
// encoded string in the credentials."
// It is not meant to be urlencoded.
func basicAuth(username, password string) string {
	auth := username + ":" + password
	return base64.StdEncoding.EncodeToString([]byte(auth))
}

// True if the specified HTTP status code is one for which the Get utility should
// automatically redirect.
func shouldRedirectGet(statusCode int) bool {
	switch statusCode {
	case StatusMovedPermanently, StatusFound, StatusSeeOther, StatusTemporaryRedirect:
		return true
	}
	return false
}

// True if the specified HTTP status code is one for which the Post utility should
// automatically redirect.
func shouldRedirectPost(statusCode int) bool {
	switch statusCode {
	case StatusFound, StatusSeeOther:
		return true
	}
	return false
}

// Get issues a GET to the specified URL. If the response is one of
// the following redirect codes, Get follows the redirect, up to a
// maximum of 10 redirects:
//
//    301 (Moved Permanently)
//    302 (Found)
//    303 (See Other)
//    307 (Temporary Redirect)
//
// An error is returned if there were too many redirects or if there
// was an HTTP protocol error. A non-2xx response doesn't cause an
// error.
//
// When err is nil, resp always contains a non-nil resp.Body.
// Caller should close resp.Body when done reading from it.
//
// Get is a wrapper around DefaultClient.Get.
//
// To make a request with custom headers, use NewRequest and
// DefaultClient.Do.
func Get(url string) (resp *Response, err error) {
	return DefaultClient.Get(url)
}

// Get issues a GET to the specified URL. If the response is one of the
// following redirect codes, Get follows the redirect after calling the
// Client's CheckRedirect function:
//
//    301 (Moved Permanently)
//    302 (Found)
//    303 (See Other)
//    307 (Temporary Redirect)
//
// An error is returned if the Client's CheckRedirect function fails
// or if there was an HTTP protocol error. A non-2xx response doesn't
// cause an error.
//
// When err is nil, resp always contains a non-nil resp.Body.
// Caller should close resp.Body when done reading from it.
//
// To make a request with custom headers, use NewRequest and Client.Do.
func (c *Client) Get(url string) (resp *Response, err error) {
	req, err := NewRequest("GET", url, nil)
	if err != nil {
		return nil, err
	}
	return c.doFollowingRedirects(req, shouldRedirectGet)
}

func alwaysFalse() bool { return false }

func (c *Client) doFollowingRedirects(ireq *Request, shouldRedirect func(int) bool) (resp *Response, err error) {
	var base *url.URL
	redirectChecker := c.CheckRedirect
	if redirectChecker == nil {
		redirectChecker = defaultCheckRedirect
	}
	var via []*Request

	if ireq.URL == nil {
		ireq.closeBody()
		return nil, errors.New("http: nil Request.URL")
	}

	var reqmu sync.Mutex // guards req
	req := ireq

	var timer *time.Timer
	var atomicWasCanceled int32 // atomic bool (1 or 0)
	var wasCanceled = alwaysFalse
	if c.Timeout > 0 {
		wasCanceled = func() bool { return atomic.LoadInt32(&atomicWasCanceled) != 0 }
		type canceler interface {
			CancelRequest(*Request)
		}
		tr, ok := c.transport().(canceler)
		if !ok {
			return nil, fmt.Errorf("net/http: Client Transport of type %T doesn't support CancelRequest; Timeout not supported", c.transport())
		}
		timer = time.AfterFunc(c.Timeout, func() {
			atomic.StoreInt32(&atomicWasCanceled, 1)
			reqmu.Lock()
			defer reqmu.Unlock()
			tr.CancelRequest(req)
		})
	}

	urlStr := "" // next relative or absolute URL to fetch (after first request)
	redirectFailed := false
	for redirect := 0; ; redirect++ {
		if redirect != 0 {
			nreq := new(Request)
			nreq.Method = ireq.Method
			if ireq.Method == "POST" || ireq.Method == "PUT" {
				nreq.Method = "GET"
			}
			nreq.Header = make(Header)
			nreq.URL, err = base.Parse(urlStr)
			if err != nil {
				break
			}
			if len(via) > 0 {
				// Add the Referer header.
				lastReq := via[len(via)-1]
				if ref := refererForURL(lastReq.URL, nreq.URL); ref != "" {
					nreq.Header.Set("Referer", ref)
				}

				err = redirectChecker(nreq, via)
				if err != nil {
					redirectFailed = true
					break
				}
			}
			reqmu.Lock()
			req = nreq
			reqmu.Unlock()
		}

		urlStr = req.URL.String()
		if resp, err = c.send(req); err != nil {
			if wasCanceled() {
				err = &httpError{
					err:     err.Error() + " (Client.Timeout exceeded while awaiting headers)",
					timeout: true,
				}
			}
			break
		}

		if shouldRedirect(resp.StatusCode) {
			// Read the body if small so underlying TCP connection will be re-used.
			// No need to check for errors: if it fails, Transport won't reuse it anyway.
			const maxBodySlurpSize = 2 << 10
			if resp.ContentLength == -1 || resp.ContentLength <= maxBodySlurpSize {
				io.CopyN(ioutil.Discard, resp.Body, maxBodySlurpSize)
			}
			resp.Body.Close()
			if urlStr = resp.Header.Get("Location"); urlStr == "" {
				err = fmt.Errorf("%d response missing Location header", resp.StatusCode)
				break
			}
			base = req.URL
			via = append(via, req)
			continue
		}
		if timer != nil {
			resp.Body = &cancelTimerBody{
				t:              timer,
				rc:             resp.Body,
				reqWasCanceled: wasCanceled,
			}
		}
		return resp, nil
	}

	method := ireq.Method
	urlErr := &url.Error{
		Op:  method[0:1] + strings.ToLower(method[1:]),
		URL: urlStr,
		Err: err,
	}

	if redirectFailed {
		// Special case for Go 1 compatibility: return both the response
		// and an error if the CheckRedirect function failed.
		// See https://golang.org/issue/3795
		return resp, urlErr
	}

	if resp != nil {
		resp.Body.Close()
	}
	return nil, urlErr
}

func defaultCheckRedirect(req *Request, via []*Request) error {
	if len(via) >= 10 {
		return errors.New("stopped after 10 redirects")
	}
	return nil
}

// Post issues a POST to the specified URL.
//
// Caller should close resp.Body when done reading from it.
//
// If the provided body is an io.Closer, it is closed after the
// request.
//
// Post is a wrapper around DefaultClient.Post.
//
// To set custom headers, use NewRequest and DefaultClient.Do.
func Post(url string, bodyType string, body io.Reader) (resp *Response, err error) {
	return DefaultClient.Post(url, bodyType, body)
}

// Post issues a POST to the specified URL.
//
// Caller should close resp.Body when done reading from it.
//
// If the provided body is an io.Closer, it is closed after the
// request.
//
// To set custom headers, use NewRequest and Client.Do.
func (c *Client) Post(url string, bodyType string, body io.Reader) (resp *Response, err error) {
	req, err := NewRequest("POST", url, body)
	if err != nil {
		return nil, err
	}
	req.Header.Set("Content-Type", bodyType)
	return c.doFollowingRedirects(req, shouldRedirectPost)
}

// PostForm issues a POST to the specified URL, with data's keys and
// values URL-encoded as the request body.
//
// The Content-Type header is set to application/x-www-form-urlencoded.
// To set other headers, use NewRequest and DefaultClient.Do.
//
// When err is nil, resp always contains a non-nil resp.Body.
// Caller should close resp.Body when done reading from it.
//
// PostForm is a wrapper around DefaultClient.PostForm.
func PostForm(url string, data url.Values) (resp *Response, err error) {
	return DefaultClient.PostForm(url, data)
}

// PostForm issues a POST to the specified URL,
// with data's keys and values URL-encoded as the request body.
//
// The Content-Type header is set to application/x-www-form-urlencoded.
// To set other headers, use NewRequest and DefaultClient.Do.
//
// When err is nil, resp always contains a non-nil resp.Body.
// Caller should close resp.Body when done reading from it.
func (c *Client) PostForm(url string, data url.Values) (resp *Response, err error) {
	return c.Post(url, "application/x-www-form-urlencoded", strings.NewReader(data.Encode()))
}

// Head issues a HEAD to the specified URL.  If the response is one of
// the following redirect codes, Head follows the redirect, up to a
// maximum of 10 redirects:
//
//    301 (Moved Permanently)
//    302 (Found)
//    303 (See Other)
//    307 (Temporary Redirect)
//
// Head is a wrapper around DefaultClient.Head
func Head(url string) (resp *Response, err error) {
	return DefaultClient.Head(url)
}

// Head issues a HEAD to the specified URL.  If the response is one of the
// following redirect codes, Head follows the redirect after calling the
// Client's CheckRedirect function:
//
//    301 (Moved Permanently)
//    302 (Found)
//    303 (See Other)
//    307 (Temporary Redirect)
func (c *Client) Head(url string) (resp *Response, err error) {
	req, err := NewRequest("HEAD", url, nil)
	if err != nil {
		return nil, err
	}
	return c.doFollowingRedirects(req, shouldRedirectGet)
}

// cancelTimerBody is an io.ReadCloser that wraps rc with two features:
// 1) on Read EOF or Close, the timer t is Stopped,
// 2) On Read failure, if reqWasCanceled is true, the error is wrapped and
//    marked as net.Error that hit its timeout.
type cancelTimerBody struct {
	t              *time.Timer
	rc             io.ReadCloser
	reqWasCanceled func() bool
}

func (b *cancelTimerBody) Read(p []byte) (n int, err error) {
	n, err = b.rc.Read(p)
	if err == io.EOF {
		b.t.Stop()
	} else if err != nil && b.reqWasCanceled() {
		return n, &httpError{
			err:     err.Error() + " (Client.Timeout exceeded while reading body)",
			timeout: true,
		}
	}
	return
}

func (b *cancelTimerBody) Close() error {
	err := b.rc.Close()
	b.t.Stop()
	return err
}


text:
var dp = new DatepickerInput({
    value: new Date(),
    format: 'full',
    'class': 'form-control'
}, 'my-datepicker-input');

dp.on('show-calendar', function (ev) {
    console.info('Calendar is now shown');
});

dp.on('hide-calendar', function (ev) {
    console.info('Calendar is now hidden');
});

dp.watch('date', function (prop, oldVal, val) {
    console.info('Date is now ' + val);
});

dp.startup();


text:
from .resource import Resource

class VirtualNetworkGatewayConnectionListEntity(Resource):
    """A common class for general resource information.

    Variables are only populated by the server, and will be ignored when
    sending a request.

    :param id: Resource ID.
    :type id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :param location: Resource location.
    :type location: str
    :param tags: Resource tags.
    :type tags: dict[str, str]
    :param authorization_key: The authorizationKey.
    :type authorization_key: str
    :param virtual_network_gateway1: The reference to virtual network gateway
     resource.
    :type virtual_network_gateway1:
     ~azure.mgmt.network.v2017_10_01.models.VirtualNetworkConnectionGatewayReference
    :param virtual_network_gateway2: The reference to virtual network gateway
     resource.
    :type virtual_network_gateway2:
     ~azure.mgmt.network.v2017_10_01.models.VirtualNetworkConnectionGatewayReference
    :param local_network_gateway2: The reference to local network gateway
     resource.
    :type local_network_gateway2:
     ~azure.mgmt.network.v2017_10_01.models.VirtualNetworkConnectionGatewayReference
    :param connection_type: Gateway connection type. Possible values are:
     'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient. Possible values
     include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient'
    :type connection_type: str or
     ~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGatewayConnectionType
    :param routing_weight: The routing weight.
    :type routing_weight: int
    :param shared_key: The IPSec shared key.
    :type shared_key: str
    :ivar connection_status: Virtual network Gateway connection status.
     Possible values are 'Unknown', 'Connecting', 'Connected' and
     'NotConnected'. Possible values include: 'Unknown', 'Connecting',
     'Connected', 'NotConnected'
    :vartype connection_status: str or
     ~azure.mgmt.network.v2017_10_01.models.VirtualNetworkGatewayConnectionStatus
    :ivar tunnel_connection_status: Collection of all tunnels' connection
     health status.
    :vartype tunnel_connection_status:
     list[~azure.mgmt.network.v2017_10_01.models.TunnelConnectionHealth]
    :ivar egress_bytes_transferred: The egress bytes transferred in this
     connection.
    :vartype egress_bytes_transferred: long
    :ivar ingress_bytes_transferred: The ingress bytes transferred in this
     connection.
    :vartype ingress_bytes_transferred: long
    :param peer: The reference to peerings resource.
    :type peer: ~azure.mgmt.network.v2017_10_01.models.SubResource
    :param enable_bgp: EnableBgp flag
    :type enable_bgp: bool
    :param use_policy_based_traffic_selectors: Enable policy-based traffic
     selectors.
    :type use_policy_based_traffic_selectors: bool
    :param ipsec_policies: The IPSec Policies to be considered by this
     connection.
    :type ipsec_policies:
     list[~azure.mgmt.network.v2017_10_01.models.IpsecPolicy]
    :param resource_guid: The resource GUID property of the
     VirtualNetworkGatewayConnection resource.
    :type resource_guid: str
    :ivar provisioning_state: The provisioning state of the
     VirtualNetworkGatewayConnection resource. Possible values are: 'Updating',
     'Deleting', and 'Failed'.
    :vartype provisioning_state: str
    :param etag: Gets a unique read-only string that changes whenever the
     resource is updated.
    :type etag: str
    """

    _validation = {
        'name': {'readonly': True},
        'type': {'readonly': True},
        'virtual_network_gateway1': {'required': True},
        'connection_type': {'required': True},
        'connection_status': {'readonly': True},
        'tunnel_connection_status': {'readonly': True},
        'egress_bytes_transferred': {'readonly': True},
        'ingress_bytes_transferred': {'readonly': True},
        'provisioning_state': {'readonly': True},
    }

    _attribute_map = {
        'id': {'key': 'id', 'type': 'str'},
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'location': {'key': 'location', 'type': 'str'},
        'tags': {'key': 'tags', 'type': '{str}'},
        'authorization_key': {'key': 'properties.authorizationKey', 'type': 'str'},
        'virtual_network_gateway1': {'key': 'properties.virtualNetworkGateway1', 'type': 'VirtualNetworkConnectionGatewayReference'},
        'virtual_network_gateway2': {'key': 'properties.virtualNetworkGateway2', 'type': 'VirtualNetworkConnectionGatewayReference'},
        'local_network_gateway2': {'key': 'properties.localNetworkGateway2', 'type': 'VirtualNetworkConnectionGatewayReference'},
        'connection_type': {'key': 'properties.connectionType', 'type': 'str'},
        'routing_weight': {'key': 'properties.routingWeight', 'type': 'int'},
        'shared_key': {'key': 'properties.sharedKey', 'type': 'str'},
        'connection_status': {'key': 'properties.connectionStatus', 'type': 'str'},
        'tunnel_connection_status': {'key': 'properties.tunnelConnectionStatus', 'type': '[TunnelConnectionHealth]'},
        'egress_bytes_transferred': {'key': 'properties.egressBytesTransferred', 'type': 'long'},
        'ingress_bytes_transferred': {'key': 'properties.ingressBytesTransferred', 'type': 'long'},
        'peer': {'key': 'properties.peer', 'type': 'SubResource'},
        'enable_bgp': {'key': 'properties.enableBgp', 'type': 'bool'},
        'use_policy_based_traffic_selectors': {'key': 'properties.usePolicyBasedTrafficSelectors', 'type': 'bool'},
        'ipsec_policies': {'key': 'properties.ipsecPolicies', 'type': '[IpsecPolicy]'},
        'resource_guid': {'key': 'properties.resourceGuid', 'type': 'str'},
        'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
        'etag': {'key': 'etag', 'type': 'str'},
    }

    def __init__(self, virtual_network_gateway1, connection_type, id=None, location=None, tags=None, authorization_key=None, virtual_network_gateway2=None, local_network_gateway2=None, routing_weight=None, shared_key=None, peer=None, enable_bgp=None, use_policy_based_traffic_selectors=None, ipsec_policies=None, resource_guid=None, etag=None):
        super(VirtualNetworkGatewayConnectionListEntity, self).__init__(id=id, location=location, tags=tags)
        self.authorization_key = authorization_key
        self.virtual_network_gateway1 = virtual_network_gateway1
        self.virtual_network_gateway2 = virtual_network_gateway2
        self.local_network_gateway2 = local_network_gateway2
        self.connection_type = connection_type
        self.routing_weight = routing_weight
        self.shared_key = shared_key
        self.connection_status = None
        self.tunnel_connection_status = None
        self.egress_bytes_transferred = None
        self.ingress_bytes_transferred = None
        self.peer = peer
        self.enable_bgp = enable_bgp
        self.use_policy_based_traffic_selectors = use_policy_based_traffic_selectors
        self.ipsec_policies = ipsec_policies
        self.resource_guid = resource_guid
        self.provisioning_state = None
        self.etag = etag


text:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_Page_Account_Management : System.Web.UI.Page
{

    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //Load RESULT Drop Down List

            SqlDataAdapter da = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from Admins", con);
            SqlDataAdapter da2 = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from FrontDesks", con);
            SqlDataAdapter da3 = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from Members", con);
            DataTable dt = new DataTable();
            da.Fill(dt);
            da2.Fill(dt);
            da3.Fill(dt);
            ddl_result.DataSource = dt;
            ddl_result.DataTextField = "info";
            ddl_result.DataValueField = "ID";
            DataBind();
        }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {

    }

    protected void btn_show_Click(object sender, EventArgs e)
    {
        //Fill Up Information
        string searchid = ddl_result.SelectedValue;
        int role = 0;

        //Check Role
        con.Open();
        string query = "select count(*) from Admins where ID ='" + searchid + "'";
        SqlCommand cmd = new SqlCommand(query, con);
        int check = Convert.ToInt32(cmd.ExecuteScalar().ToString());
        if (check < 1)
        {
            string query2 = "select count(*) from FrontDesks where ID ='" + searchid + "'";
            SqlCommand cmd2 = new SqlCommand(query2, con);
            int check2 = Convert.ToInt32(cmd2.ExecuteScalar().ToString());
            if (check2 < 1)
            {
                string query3 = "select count(*) from Members where ID ='" + searchid + "'";
                SqlCommand cmd3 = new SqlCommand(query3, con);
                int check3 = Convert.ToInt32(cmd3.ExecuteScalar().ToString());
                if (check3 < 1)
                {
                    Response.Write("Error");
                }
                else
                {
                    role = 3; //member
                }
            }
            else
            {
                role = 2; //frontdesk
            }
        }
        else
        {
            role = 1; //admin
        }

        //FILL IN INFORMATION
        lbl_id.Text = searchid;
        if (role == 1)
        {
            SqlDataAdapter da = new SqlDataAdapter("select * from Admins where ID = '" + searchid + "'", con);
            DataSet ds = new DataSet();
            da.Fill(ds);
            lbl_name.Text = ds.Tables[0].Rows[0]["Name"].ToString();
            lbl_gender.Text = ds.Tables[0].Rows[0]["Gender"].ToString();
            lbl_nric.Text = ds.Tables[0].Rows[0]["NRIC"].ToString();
            lbl_email.Text = ds.Tables[0].Rows[0]["Email"].ToString();
            lbl_phone.Text = ds.Tables[0].Rows[0]["Phone_No"].ToString();
            lbl_address.Text = ds.Tables[0].Rows[0]["Address"].ToString();
            DataBind();
        }
        else if (role == 2)
        {
            SqlDataAdapter da = new SqlDataAdapter("select * from FrontDesks where ID = '" + searchid + "'", con);
            DataSet ds = new DataSet();
            da.Fill(ds);
            lbl_name.Text = ds.Tables[0].Rows[0]["Name"].ToString();
            lbl_gender.Text = ds.Tables[0].Rows[0]["Gender"].ToString();
            lbl_nric.Text = ds.Tables[0].Rows[0]["NRIC"].ToString();
            lbl_email.Text = ds.Tables[0].Rows[0]["Email"].ToString();
            lbl_phone.Text = ds.Tables[0].Rows[0]["Phone_No"].ToString();
            lbl_address.Text = ds.Tables[0].Rows[0]["Address"].ToString();
            DataBind();
        }
        else if (role == 3)
        {
            SqlDataAdapter da = new SqlDataAdapter("select * from Members where ID = '" + searchid + "'", con);
            DataSet ds = new DataSet();
            da.Fill(ds);
            lbl_name.Text = ds.Tables[0].Rows[0]["Name"].ToString();
            lbl_gender.Text = ds.Tables[0].Rows[0]["Gender"].ToString();
            lbl_nric.Text = ds.Tables[0].Rows[0]["NRIC"].ToString();
            lbl_email.Text = ds.Tables[0].Rows[0]["Email"].ToString();
            lbl_phone.Text = ds.Tables[0].Rows[0]["Phone_No"].ToString();
            lbl_address.Text = "-";
            DataBind();
        }

        con.Close();
    }

    protected void btn_delete_Click(object sender, EventArgs e)
    {
        if (lbl_id.Text != "[ID]")
        {
            int role = 0;
            con.Open();
            //check role
            string query = "select count(*) from Admins where ID ='" + lbl_id.Text + "'";
            SqlCommand cmd = new SqlCommand(query, con);
            int check = Convert.ToInt32(cmd.ExecuteScalar().ToString());
            if (check < 1)
            {
                string query2 = "select count(*) from FrontDesks where ID ='" + lbl_id.Text + "'";
                SqlCommand cmd2 = new SqlCommand(query2, con);
                int check2 = Convert.ToInt32(cmd2.ExecuteScalar().ToString());
                if (check2 < 1)
                {
                    string query3 = "select count(*) from Members where ID ='" + lbl_id.Text + "'";
                    SqlCommand cmd3 = new SqlCommand(query3, con);
                    int check3 = Convert.ToInt32(cmd3.ExecuteScalar().ToString());
                    if (check3 < 1)
                    {
                        Response.Write("Error");
                    }
                    else
                    {
                        role = 3; //member
                    }
                }
                else
                {
                    role = 2; //frontdesk
                }
            }
            else
            {
                role = 1; //admin
            }

            //DELETE COMMAND
            string query4 = null;
            if (role == 1)
            {
                query4 = "delete from Admins where ID = '" + lbl_id.Text + "'";
            }
            else if (role == 2)
            {
                query4 = "delete from FrontDesks where ID = '" + lbl_id.Text + "'";
            }
            else if (role == 3)
            {
                query4 = "delete from Members where ID = '" + lbl_id.Text + "'";
            }
            SqlCommand cmd4 = new SqlCommand(query4, con);
            cmd4.ExecuteNonQuery();
            con.Close();
            Response.Redirect(Request.RawUrl); //refresh page
        }
        else
        {
            //Do Nothing
        }
    }

    protected void btn_filter_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();

        if (ddl_role.SelectedIndex == 0)
        {
            if (ddl_choice.SelectedIndex == 0)
            {
                //all role, search by name
                SqlDataAdapter da = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from Admins where Name like '%" + tb_choice.Text + "%'", con);
                SqlDataAdapter da2 = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from FrontDesks where Name like '%" + tb_choice.Text + "%'", con);
                SqlDataAdapter da3 = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from Members where Name like '%" + tb_choice.Text + "%'", con);
                da.Fill(dt);
                da2.Fill(dt);
                da3.Fill(dt);

            }
            else if (ddl_choice.SelectedIndex == 1)
            {
                //all role, search by nric
                SqlDataAdapter da = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from Admins where NRIC like '%" + tb_choice.Text + "%'", con);
                SqlDataAdapter da2 = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from FrontDesks where NRIC like '%" + tb_choice.Text + "%'", con);
                SqlDataAdapter da3 = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from Members where NRIC like '%" + tb_choice.Text + "%'", con);
                da.Fill(dt);
                da2.Fill(dt);
                da3.Fill(dt);
            }
        }
        else if (ddl_role.SelectedIndex == 1)
        {
            if (tb_choice.Text == "")
            {
                //search all admin
                SqlDataAdapter da = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from Admins", con);
                da.Fill(dt);
            }
            else
            {
                if (ddl_choice.SelectedIndex == 0)
                {
                    //admin role, search by name
                    SqlDataAdapter da = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from Admins where Name like '%" + tb_choice.Text + "%'", con);
                    da.Fill(dt);
                }
                else if (ddl_choice.SelectedIndex == 1)
                {
                    //admin role, search by nric
                    SqlDataAdapter da = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from Admins where NRIC like '%" + tb_choice.Text + "%'", con);
                    da.Fill(dt);
                }
            }
        }
        else if (ddl_role.SelectedIndex == 2)
        {
            if (tb_choice.Text == "")
            {
                //search front desk role
                SqlDataAdapter da = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from FrontDesks", con);
                da.Fill(dt);
            }
            else
            {
                if (ddl_choice.SelectedIndex == 0)
                {
                    //frontdesk role, search by name
                    SqlDataAdapter da = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from FrontDesks where Name like '%" + tb_choice.Text + "%'", con);
                    da.Fill(dt);
                }
                else if (ddl_choice.SelectedIndex == 1)
                {
                    //frontdesk role, search by nric
                    SqlDataAdapter da = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from FrontDesks where NRIC like '%" + tb_choice.Text + "%'", con);
                    da.Fill(dt);
                }
            }
        }
        else if (ddl_role.SelectedIndex == 3)
        {
            if (tb_choice.Text == "")
            {
                //search all member
                SqlDataAdapter da = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from Members", con);
                da.Fill(dt);
            }
            else
            {
                if (ddl_choice.SelectedIndex == 0)
                {
                    //member role, search by name
                    SqlDataAdapter da = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from Members where Name like '%" + tb_choice.Text + "%'", con);
                    da.Fill(dt);
                }
                else if (ddl_choice.SelectedIndex == 1)
                {
                    //member role, search by nric
                    SqlDataAdapter da = new SqlDataAdapter("select ID, Name, NRIC, ISNULL(ID,'') + ' - ' + ISNULL(Name,'') + ' ' + ISNULL(NRIC,'') as info from Members where NRIC like '%" + tb_choice.Text + "%'", con);
                    da.Fill(dt);
                }
            }
        }

        ddl_result.DataSource = dt;
        ddl_result.DataTextField = "info";
        ddl_result.DataValueField = "ID";
        DataBind();
    }

}


text:
package dto.League;

import java.io.Serializable;

public class LeagueEntry implements Serializable {

	private static final long serialVersionUID = 3987113536371700279L;
	private String division, playerOrTeamId, playerOrTeamName;
	private boolean isFreshBlood, isHotStreak, isInactive, isVeteran;
	private int leaguePoints, wins, losses;
	private MiniSeries miniSeries;

	public String getPlayerOrTeamId() {
		return playerOrTeamId;
	}

	public boolean isHotStreak() {
		return isHotStreak;
	}

	public boolean isInactive() {
		return isInactive;
	}

	public int getLeaguePoints() {
		return leaguePoints;
	}

	public int getWins() {
		return wins;
	}

	public int getLosses() {
		return losses;
	}

	public MiniSeries getMiniSeries() {
		return miniSeries;
	}

	public boolean isFreshBlood() {
		return isFreshBlood;
	}

	public String getPlayerOrTeamName() {
		return playerOrTeamName;
	}

	public boolean isVeteran() {
		return isVeteran;
	}

	public String getDivision() {
		return division;
	}
}


text:
/*!
 * \file
 * \brief SPIR-V Assembly Tests for indexing with access chain operations.
 *//*--------------------------------------------------------------------*/

#include "vktSpvAsmIndexingTests.hpp"
#include "vktSpvAsmComputeShaderCase.hpp"
#include "vktSpvAsmComputeShaderTestUtil.hpp"
#include "vktSpvAsmGraphicsShaderTestUtil.hpp"

#include "tcuStringTemplate.hpp"

namespace vkt
{
namespace SpirVAssembly
{

using namespace vk;
using std::map;
using std::string;
using std::vector;
using std::pair;
using tcu::IVec3;
using tcu::RGBA;
using tcu::UVec4;
using tcu::Vec4;
using tcu::Mat4;
using tcu::StringTemplate;

namespace
{

enum ChainOp
{
	CHAIN_OP_ACCESS_CHAIN = 0,
	CHAIN_OP_IN_BOUNDS_ACCESS_CHAIN,
	CHAIN_OP_PTR_ACCESS_CHAIN,

	CHAIN_OP_LAST
};
static const int					idxSizes[]				= { 16, 32, 64 };
static const string					chainOpTestNames[]		= { "opaccesschain", "opinboundsaccesschain", "opptraccesschain" };

struct InputData
{
	Mat4	matrix[32][32];
};

void addComputeIndexingStructTests (tcu::TestCaseGroup* group)
{
	tcu::TestContext&				testCtx				= group->getTestContext();
	de::MovePtr<tcu::TestCaseGroup> structGroup			(new tcu::TestCaseGroup(testCtx, "struct", "Tests for indexing input struct."));
	de::Random						rnd					(deStringHash(group->getName()));
	const int						numItems			= 128;
	const int						numStructs			= 2;
	const int						numInputFloats		= (int)sizeof(InputData) / 4 * numStructs;
	vector<float>					inputData;
	vector<UVec4>					indexSelectorData;

	inputData.reserve(numInputFloats);
	for (deUint32 numIdx = 0; numIdx < numInputFloats; ++numIdx)
		inputData.push_back(rnd.getFloat());

	indexSelectorData.reserve(numItems);
	for (deUint32 numIdx = 0; numIdx < numItems; ++numIdx)
		indexSelectorData.push_back(UVec4(rnd.getUint32() % 32, rnd.getUint32() % 32, rnd.getUint32() % 4, rnd.getUint32() % 4));

	for (int chainOpIdx = 0; chainOpIdx < CHAIN_OP_LAST; ++chainOpIdx)
	{
		for (int idxSizeIdx = 0; idxSizeIdx < DE_LENGTH_OF_ARRAY(idxSizes); ++idxSizeIdx)
		{
			for (int sign = 0; sign < 2; ++sign)
			{
				const int					idxSize			= idxSizes[idxSizeIdx];
				const string				testName		= chainOpTestNames[chainOpIdx] + string(sign == 0 ? "_u" : "_s") + de::toString(idxSize);
				VulkanFeatures				vulkanFeatures;
				map<string, string>			specs;
				vector<float>				outputData;
				ComputeShaderSpec			spec;
				int							element			= 0;

				// Index an input buffer containing 2D array of 4x4 matrices. The indices are read from another
				// input and converted to the desired bit size and sign.
				const StringTemplate		shaderSource(
					"                             OpCapability Shader\n"
					"                             ${intcaps:opt}\n"
					"                             ${variablepointercaps:opt}\n"
					"                             ${extensions:opt}\n"
					"                        %1 = OpExtInstImport \"GLSL.std.450\"\n"
					"                             OpMemoryModel Logical GLSL450\n"
					"                             OpEntryPoint GLCompute %main \"main\" %gl_GlobalInvocationID\n"
					"                             OpExecutionMode %main LocalSize 1 1 1\n"
					"                             OpSource GLSL 430\n"
					"                             OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId\n"
					"                             OpDecorate %_arr_float_uint_128 ArrayStride 4\n"
					"                             OpMemberDecorate %Output 0 Offset 0\n"
					"                             OpDecorate %Output BufferBlock\n"
					"                             OpDecorate %dataOutput DescriptorSet 0\n"
					"                             OpDecorate %dataOutput Binding 2\n"
					"                             OpDecorate %_arr_mat4v4float_uint_32 ArrayStride 64\n"
					"                             OpDecorate %_arr__arr_mat4v4float_uint_32_uint_32 ArrayStride 2048\n"
					"                             OpMemberDecorate %InputStruct 0 ColMajor\n"
					"                             OpMemberDecorate %InputStruct 0 Offset 0\n"
					"                             OpMemberDecorate %InputStruct 0 MatrixStride 16\n"
					"                             OpDecorate %InputStructArr ArrayStride 65536\n"
					"                             OpDecorate %Input ${inputdecoration}\n"
					"                             OpMemberDecorate %Input 0 Offset 0\n"
					"                             OpDecorate %dataInput DescriptorSet 0\n"
					"                             OpDecorate %dataInput Binding 0\n"
					"                             OpDecorate %_ptr_buffer_InputStruct ArrayStride 65536\n"
					"                             OpDecorate %_arr_v4uint_uint_128 ArrayStride 16\n"
					"                             OpMemberDecorate %DataSelector 0 Offset 0\n"
					"                             OpDecorate %DataSelector BufferBlock\n"
					"                             OpDecorate %selector DescriptorSet 0\n"
					"                             OpDecorate %selector Binding 1\n"
					"                     %void = OpTypeVoid\n"
					"                        %3 = OpTypeFunction %void\n"
					"                      %u32 = OpTypeInt 32 0\n"
					"                      %i32 = OpTypeInt 32 1\n"
					"${intdecl:opt}"
					"                    %idx_0 = OpConstant ${idx_int} 0\n"
					"                    %idx_1 = OpConstant ${idx_int} 1\n"
					"                    %idx_2 = OpConstant ${idx_int} 2\n"
					"                    %idx_3 = OpConstant ${idx_int} 3\n"
					"     %_ptr_Function_uint32 = OpTypePointer Function %u32\n"
					"                 %v3uint32 = OpTypeVector %u32 3\n"
					"      %_ptr_Input_v3uint32 = OpTypePointer Input %v3uint32\n"
					"    %gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint32 Input\n"
					"        %_ptr_Input_uint32 = OpTypePointer Input %u32\n"
					"                    %float = OpTypeFloat 32\n"
					"                 %uint_128 = OpConstant %u32 128\n"
					"                  %uint_32 = OpConstant %u32 32\n"
					"                   %uint_2 = OpConstant %u32 2\n"
					"      %_arr_float_uint_128 = OpTypeArray %float %uint_128\n"
					"                   %Output = OpTypeStruct %_arr_float_uint_128\n"
					"      %_ptr_Uniform_Output = OpTypePointer Uniform %Output\n"
					"               %dataOutput = OpVariable %_ptr_Uniform_Output Uniform\n"
					"                  %v4float = OpTypeVector %float 4\n"
					"              %mat4v4float = OpTypeMatrix %v4float 4\n"
					" %_arr_mat4v4float_uint_32 = OpTypeArray %mat4v4float %uint_32\n"
					" %_arr__arr_mat4v4float_uint_32_uint_32 = OpTypeArray %_arr_mat4v4float_uint_32 %uint_32\n"
					"              %InputStruct = OpTypeStruct %_arr__arr_mat4v4float_uint_32_uint_32\n"
					"           %InputStructArr = OpTypeArray %InputStruct %uint_2\n"
					"                    %Input = OpTypeStruct %InputStructArr\n"
					"        %_ptr_buffer_Input = OpTypePointer ${inputstorageclass} %Input\n"
					"                %dataInput = OpVariable %_ptr_buffer_Input ${inputstorageclass}\n"
					"  %_ptr_buffer_InputStruct = OpTypePointer ${inputstorageclass} %InputStruct\n"
					"                 %v4uint32 = OpTypeVector %u32 4\n"
					"     %_arr_v4uint_uint_128 = OpTypeArray %v4uint32 %uint_128\n"
					"             %DataSelector = OpTypeStruct %_arr_v4uint_uint_128\n"
					"%_ptr_Uniform_DataSelector = OpTypePointer Uniform %DataSelector\n"
					"                 %selector = OpVariable %_ptr_Uniform_DataSelector Uniform\n"
					"      %_ptr_Uniform_uint32 = OpTypePointer Uniform %u32\n"
					"       %_ptr_Uniform_float = OpTypePointer Uniform %float\n"
					"       ${ptr_buffer_float:opt}\n"

					"                     %main = OpFunction %void None %3\n"
					"                        %5 = OpLabel\n"
					"                        %i = OpVariable %_ptr_Function_uint32 Function\n"
					"                       %14 = OpAccessChain %_ptr_Input_uint32 %gl_GlobalInvocationID %idx_0\n"
					"                       %15 = OpLoad %u32 %14\n"
					"                             OpStore %i %15\n"
					"                   %uint_i = OpLoad %u32 %i\n"
					"                       %39 = OpAccessChain %_ptr_Uniform_uint32 %selector %idx_0 %uint_i %idx_0\n"
					"                       %40 = OpLoad %u32 %39\n"
					"                       %43 = OpAccessChain %_ptr_Uniform_uint32 %selector %idx_0 %uint_i %idx_1\n"
					"                       %44 = OpLoad %u32 %43\n"
					"                       %47 = OpAccessChain %_ptr_Uniform_uint32 %selector %idx_0 %uint_i %idx_2\n"
					"                       %48 = OpLoad %u32 %47\n"
					"                       %51 = OpAccessChain %_ptr_Uniform_uint32 %selector %idx_0 %uint_i %idx_3\n"
					"                       %52 = OpLoad %u32 %51\n"
					"                       %i0 = ${convert} ${idx_int} %40\n"
					"                       %i1 = ${convert} ${idx_int} %44\n"
					"                       %i2 = ${convert} ${idx_int} %48\n"
					"                       %i3 = ${convert} ${idx_int} %52\n"
					"        %inputFirstElement = OpAccessChain %_ptr_buffer_InputStruct %dataInput %idx_0 %idx_0\n"
					"                       %54 = ${accesschain}\n"
					"                       %55 = OpLoad %float %54\n"
					"                       %56 = OpAccessChain %_ptr_Uniform_float %dataOutput %idx_0 %uint_i\n"
					"                             OpStore %56 %55\n"
					"                             OpReturn\n"
					"                             OpFunctionEnd\n");

				switch (chainOpIdx)
				{
					case CHAIN_OP_ACCESS_CHAIN:
						specs["accesschain"]			= "OpAccessChain %_ptr_Uniform_float %inputFirstElement %idx_0 %i0 %i1 %i2 %i3\n";
						specs["inputdecoration"]		= "BufferBlock";
						specs["inputstorageclass"]		= "Uniform";
						break;
					case CHAIN_OP_IN_BOUNDS_ACCESS_CHAIN:
						specs["accesschain"]			= "OpInBoundsAccessChain %_ptr_Uniform_float %inputFirstElement %idx_0 %i0 %i1 %i2 %i3\n";
						specs["inputdecoration"]		= "BufferBlock";
						specs["inputstorageclass"]		= "Uniform";
						break;
					default:
						DE_ASSERT(chainOpIdx == CHAIN_OP_PTR_ACCESS_CHAIN);
						specs["accesschain"]			= "OpPtrAccessChain %_ptr_StorageBuffer_float %inputFirstElement %idx_1 %idx_0 %i0 %i1 %i2 %i3\n";
						specs["inputdecoration"]		= "Block";
						specs["inputstorageclass"]		= "StorageBuffer";
						specs["variablepointercaps"]	= "OpCapability VariablePointersStorageBuffer";
						specs["ptr_buffer_float"]		= "%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float";
						specs["extensions"]				= "OpExtension \"SPV_KHR_variable_pointers\"\n                             "
														  "OpExtension \"SPV_KHR_storage_buffer_storage_class\"";
						element = 1;
						vulkanFeatures.extVariablePointers = EXTVARIABLEPOINTERSFEATURES_VARIABLE_POINTERS_STORAGEBUFFER;
						spec.extensions.push_back("VK_KHR_variable_pointers");
						break;
				};

				spec.inputs.push_back(BufferSp(new Float32Buffer(inputData)));
				spec.inputs.push_back(BufferSp(new Buffer<UVec4>(indexSelectorData)));

				outputData.reserve(numItems);
				for (deUint32 numIdx = 0; numIdx < numItems; ++numIdx)
				{
					// Determine the selected output float for the selected indices.
					const UVec4 vec = indexSelectorData[numIdx];
					outputData.push_back(inputData[element * sizeof(InputData) / 4 + vec.x() * (32 * 4 * 4) + vec.y() * 4 * 4 + vec.z() * 4 + vec.w()]);
				}

				if (idxSize == 16)
				{
					specs["intcaps"] = "OpCapability Int16";
					specs["convert"] = "OpSConvert";
					specs["intdecl"] =	"                      %u16 = OpTypeInt 16 0\n"
								"                      %i16 = OpTypeInt 16 1\n";
				}
				else if (idxSize == 64)
				{
					specs["intcaps"] = "OpCapability Int64";
					specs["convert"] = "OpSConvert";
					specs["intdecl"] =	"                      %u64 = OpTypeInt 64 0\n"
								"                      %i64 = OpTypeInt 64 1\n";
				} else {
					specs["convert"] = "OpBitcast";
				}

				specs["idx_uint"] = "%u" + de::toString(idxSize);
				specs["idx_int"] = (sign ? "%i" : "%u") + de::toString(idxSize);

				spec.assembly					= shaderSource.specialize(specs);
				spec.numWorkGroups				= IVec3(numItems, 1, 1);
				spec.requestedVulkanFeatures	= vulkanFeatures;
				spec.inputs[0].setDescriptorType(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);
				spec.inputs[1].setDescriptorType(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);

				spec.outputs.push_back(BufferSp(new Float32Buffer(outputData)));

				if (idxSize == 16)
					spec.requestedVulkanFeatures.coreFeatures.shaderInt16 = VK_TRUE;

				if (idxSize == 64)
					spec.requestedVulkanFeatures.coreFeatures.shaderInt64 = VK_TRUE;

				structGroup->addChild(new SpvAsmComputeShaderCase(testCtx, testName.c_str(), testName.c_str(), spec));
			}
		}
	}
	group->addChild(structGroup.release());
}

void addGraphicsIndexingStructTests (tcu::TestCaseGroup* group)
{
	tcu::TestContext&				testCtx				= group->getTestContext();
	de::MovePtr<tcu::TestCaseGroup>	structGroup			(new tcu::TestCaseGroup(testCtx, "struct", "Tests for indexing input struct."));
	de::Random						rnd					(deStringHash(group->getName()));
	const int						numItems			= 128;
	const int						numStructs			= 2;
	const int						numInputFloats		= (int)sizeof(InputData) / 4 * numStructs;
	RGBA							defaultColors[4];
	vector<float>					inputData;
	vector<UVec4>					indexSelectorData;

	inputData.reserve(numInputFloats);
	for (deUint32 numIdx = 0; numIdx < numInputFloats; ++numIdx)
		inputData.push_back(rnd.getFloat());

	indexSelectorData.reserve(numItems);
	for (deUint32 numIdx = 0; numIdx < numItems; ++numIdx)
		indexSelectorData.push_back(UVec4(rnd.getUint32() % 32, rnd.getUint32() % 32, rnd.getUint32() % 4, rnd.getUint32() % 4));

	getDefaultColors(defaultColors);

	for (int chainOpIdx = 0; chainOpIdx < CHAIN_OP_LAST; ++chainOpIdx)
	{
		for (int idxSizeIdx = 0; idxSizeIdx < DE_LENGTH_OF_ARRAY(idxSizes); ++idxSizeIdx)
		{
			for (int sign = 0; sign < 2; sign++)
			{
				const int					idxSize			= idxSizes[idxSizeIdx];
				const string				testName		= chainOpTestNames[chainOpIdx] + string(sign == 0 ? "_u" : "_s") + de::toString(idxSize);
				VulkanFeatures				vulkanFeatures;
				vector<string>				extensions;
				SpecConstants				noSpecConstants;
				PushConstants				noPushConstants;
				GraphicsInterfaces			noInterfaces;
				map<string, string>			specs;
				map<string, string>			fragments;
				vector<float>				outputData;
				ComputeShaderSpec			spec;
				int							element			= 0;
				GraphicsResources			resources;

				const StringTemplate		preMain(
					"${intdecl:opt}"
					"                %c_i32_128 = OpConstant %i32 128\n"
					"                   %uint_0 = OpConstant ${idx_uint} 0\n"
					"                 %uint_128 = OpConstant %u32 128\n"
					"                  %uint_32 = OpConstant %u32 32\n"
					"                   %uint_1 = OpConstant ${idx_uint} 1\n"
					"                   %uint_2 = OpConstant ${idx_uint} 2\n"
					"                   %uint_3 = OpConstant ${idx_uint} 3\n"
					"      %_arr_float_uint_128 = OpTypeArray %f32 %uint_128\n"
					"                   %Output = OpTypeStruct %_arr_float_uint_128\n"
					"      %_ptr_Uniform_Output = OpTypePointer Uniform %Output\n"
					"               %dataOutput = OpVariable %_ptr_Uniform_Output Uniform\n"
					"                    %int_0 = OpConstant ${idx_int} 0\n"
					"              %mat4v4float = OpTypeMatrix %v4f32 4\n"
					" %_arr_mat4v4float_uint_32 = OpTypeArray %mat4v4float %uint_32\n"
					" %_arr__arr_mat4v4float_uint_32_uint_32 = OpTypeArray %_arr_mat4v4float_uint_32 %uint_32\n"
					"              %InputStruct = OpTypeStruct %_arr__arr_mat4v4float_uint_32_uint_32\n"
					"           %InputStructArr = OpTypeArray %InputStruct %uint_2\n"
					"                    %Input = OpTypeStruct %InputStructArr\n"
					"        %_ptr_buffer_Input = OpTypePointer ${inputstorageclass} %Input\n"
					"                %dataInput = OpVariable %_ptr_buffer_Input ${inputstorageclass}\n"
					"  %_ptr_buffer_InputStruct = OpTypePointer ${inputstorageclass} %InputStruct\n"
					"     %_arr_v4uint_uint_128 = OpTypeArray %v4u32 %uint_128\n"
					"             %DataSelector = OpTypeStruct %_arr_v4uint_uint_128\n"
					"%_ptr_Uniform_DataSelector = OpTypePointer Uniform %DataSelector\n"
					"                 %selector = OpVariable %_ptr_Uniform_DataSelector Uniform\n"
					"      %_ptr_Uniform_uint32 = OpTypePointer Uniform %u32\n"
					"       %_ptr_Uniform_float = OpTypePointer Uniform %f32\n"
					"       ${ptr_buffer_float:opt}\n");

				const StringTemplate		decoration(
					"OpDecorate %_arr_float_uint_128 ArrayStride 4\n"
					"OpMemberDecorate %Output 0 Offset 0\n"
					"OpDecorate %Output BufferBlock\n"
					"OpDecorate %dataOutput DescriptorSet 0\n"
					"OpDecorate %dataOutput Binding 2\n"
					"OpDecorate %_arr_mat4v4float_uint_32 ArrayStride 64\n"
					"OpDecorate %_arr__arr_mat4v4float_uint_32_uint_32 ArrayStride 2048\n"
					"OpMemberDecorate %InputStruct 0 ColMajor\n"
					"OpMemberDecorate %InputStruct 0 Offset 0\n"
					"OpMemberDecorate %InputStruct 0 MatrixStride 16\n"
					"OpDecorate %InputStructArr ArrayStride 65536\n"
					"OpDecorate %Input ${inputdecoration}\n"
					"OpMemberDecorate %Input 0 Offset 0\n"
					"OpDecorate %dataInput DescriptorSet 0\n"
					"OpDecorate %dataInput Binding 0\n"
					"OpDecorate %_ptr_buffer_InputStruct ArrayStride 65536\n"
					"OpDecorate %_arr_v4uint_uint_128 ArrayStride 16\n"
					"OpMemberDecorate %DataSelector 0 Offset 0\n"
					"OpDecorate %DataSelector BufferBlock\n"
					"OpDecorate %selector DescriptorSet 0\n"
					"OpDecorate %selector Binding 1\n");

				// Index an input buffer containing 2D array of 4x4 matrices. The indices are read from another
				// input and converted to the desired bit size and sign.
				const StringTemplate		testFun(
					"        %test_code = OpFunction %v4f32 None %v4f32_v4f32_function\n"
					"            %param = OpFunctionParameter %v4f32\n"

					"            %entry = OpLabel\n"
					"                %i = OpVariable %fp_i32 Function\n"
					"                     OpStore %i %c_i32_0\n"
					"                     OpBranch %loop\n"

					"             %loop = OpLabel\n"
					"               %15 = OpLoad %i32 %i\n"
					"               %lt = OpSLessThan %bool %15 %c_i32_128\n"
					"                     OpLoopMerge %merge %inc None\n"
					"                     OpBranchConditional %lt %write %merge\n"

					"            %write = OpLabel\n"
					"            %int_i = OpLoad %i32 %i\n"
					"               %39 = OpAccessChain %_ptr_Uniform_uint32 %selector %int_0 %int_i %uint_0\n"
					"               %40 = OpLoad %u32 %39\n"
					"               %43 = OpAccessChain %_ptr_Uniform_uint32 %selector %int_0 %int_i %uint_1\n"
					"               %44 = OpLoad %u32 %43\n"
					"               %47 = OpAccessChain %_ptr_Uniform_uint32 %selector %int_0 %int_i %uint_2\n"
					"               %48 = OpLoad %u32 %47\n"
					"               %51 = OpAccessChain %_ptr_Uniform_uint32 %selector %int_0 %int_i %uint_3\n"
					"               %52 = OpLoad %u32 %51\n"
					"               %i0 = ${convert} ${idx_uint} %40\n"
					"               %i1 = ${convert} ${idx_uint} %44\n"
					"               %i2 = ${convert} ${idx_uint} %48\n"
					"               %i3 = ${convert} ${idx_uint} %52\n"
					"%inputFirstElement = OpAccessChain %_ptr_buffer_InputStruct %dataInput %uint_0 %uint_0\n"
					"               %54 = ${accesschain}\n"
					"               %55 = OpLoad %f32 %54\n"
					"               %56 = OpAccessChain %_ptr_Uniform_float %dataOutput %int_0 %int_i\n"
					"                     OpStore %56 %55\n"
					"                     OpBranch %inc\n"

					"              %inc = OpLabel\n"
					"               %67 = OpLoad %i32 %i\n"
					"               %69 = OpIAdd %i32 %67 %c_i32_1\n"
					"                     OpStore %i %69\n"
					"                     OpBranch %loop\n"

					"            %merge = OpLabel\n"
					"                     OpReturnValue %param\n"

					"                     OpFunctionEnd\n");

				resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
				resources.inputs.push_back(Resource(BufferSp(new Buffer<UVec4>(indexSelectorData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));

				if (idxSize == 16)
				{
					fragments["capability"] = "OpCapability Int16\n";
					vulkanFeatures.coreFeatures.shaderInt16 = VK_TRUE;
					specs["convert"] = "OpUConvert";
					specs["intdecl"] =	"                      %u16 = OpTypeInt 16 0\n"
								"                      %i16 = OpTypeInt 16 1\n";
				}
				else if (idxSize == 64)
				{
					fragments["capability"] = "OpCapability Int64\n";
					vulkanFeatures.coreFeatures.shaderInt64 = VK_TRUE;
					specs["convert"] = "OpUConvert";
					specs["intdecl"] =	"                      %u64 = OpTypeInt 64 0\n"
								"                      %i64 = OpTypeInt 64 1\n";
				} else {
					specs["convert"] = "OpCopyObject";
				}

				specs["idx_uint"] = "%u" + de::toString(idxSize);
				specs["idx_int"] = (sign ? "%i" : "%u") + de::toString(idxSize);

				switch (chainOpIdx)
				{
					case CHAIN_OP_ACCESS_CHAIN:
						specs["accesschain"]				= "OpAccessChain %_ptr_Uniform_float %inputFirstElement %int_0 %i0 %i1 %i2 %i3\n";
						specs["inputdecoration"]			= "BufferBlock";
						specs["inputstorageclass"]			= "Uniform";
						break;
					case CHAIN_OP_IN_BOUNDS_ACCESS_CHAIN:
						specs["accesschain"]				= "OpInBoundsAccessChain %_ptr_Uniform_float %inputFirstElement %int_0 %i0 %i1 %i2 %i3\n";
						specs["inputdecoration"]			= "BufferBlock";
						specs["inputstorageclass"]			= "Uniform";
						break;
					default:
						DE_ASSERT(chainOpIdx == CHAIN_OP_PTR_ACCESS_CHAIN);
						specs["accesschain"]				= "OpPtrAccessChain %_ptr_StorageBuffer_float %inputFirstElement %uint_1 %int_0 %i0 %i1 %i2 %i3\n";
						specs["inputdecoration"]			= "Block";
						specs["inputstorageclass"]			= "StorageBuffer";
						specs["ptr_buffer_float"]			= "%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %f32";
						fragments["capability"]				+= "OpCapability VariablePointersStorageBuffer";
						fragments["extension"]				= "OpExtension \"SPV_KHR_variable_pointers\"\nOpExtension \"SPV_KHR_storage_buffer_storage_class\"";
						extensions.push_back				("VK_KHR_variable_pointers");
						vulkanFeatures.extVariablePointers	= EXTVARIABLEPOINTERSFEATURES_VARIABLE_POINTERS_STORAGEBUFFER;
						element = 1;
						break;
				};

				outputData.reserve(numItems);
				for (deUint32 numIdx = 0; numIdx < numItems; ++numIdx)
				{
					// Determine the selected output float for the selected indices.
					const UVec4 vec = indexSelectorData[numIdx];
					outputData.push_back(inputData[element * sizeof(InputData) / 4 + vec.x() * (32 * 4 * 4) + vec.y() * 4 * 4 + vec.z() * 4 + vec.w()]);
				}

				resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(outputData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));

				fragments["pre_main"]	= preMain.specialize(specs);
				fragments["decoration"]	= decoration.specialize(specs);
				fragments["testfun"]	= testFun.specialize(specs);

				createTestsForAllStages(
						testName.c_str(), defaultColors, defaultColors, fragments, noSpecConstants,
						noPushConstants, resources, noInterfaces, extensions, vulkanFeatures, structGroup.get());
			}
		}
	}
	group->addChild(structGroup.release());
}

void addGraphicsOutputComponentIndexingTests (tcu::TestCaseGroup* testGroup)
{
	RGBA				defaultColors[4];
	vector<string>		noExtensions;
	map<string, string>	fragments			= passthruFragments();
	const deUint32		numItems			= 4;
	vector<deInt32>		inputData;
	vector<float>		outputData;
	const deInt32		pattern[]			= { 2, 0, 1, 3 };

	for (deUint32 itemIdx = 0; itemIdx < numItems; ++itemIdx)
	{
		Vec4 output(0.0f);
		output[pattern[itemIdx]] = 1.0f;
		outputData.push_back(output.x());
		outputData.push_back(output.y());
		outputData.push_back(output.z());
		outputData.push_back(output.w());
		inputData.push_back(pattern[itemIdx]);
	}

	getDefaultColors(defaultColors);

	fragments["pre_main"] =
		"             %a3u32 = OpTypeArray %u32 %c_i32_3\n"
		"          %ip_a3u32 = OpTypePointer Input %a3u32\n"
		"%v4f32_u32_function = OpTypeFunction %v4f32 %u32\n";

	fragments["interface_op_func"] =
		"%interface_op_func = OpFunction %v4f32 None %v4f32_u32_function\n"
		"        %io_param1 = OpFunctionParameter %u32\n"
		"            %entry = OpLabel\n"
		"              %ret = OpCompositeConstruct %v4f32 %c_f32_0 %c_f32_0 %c_f32_0 %c_f32_0\n"
		"                     OpReturnValue %ret\n"
		"                     OpFunctionEnd\n";

	fragments["post_interface_op_vert"] = fragments["post_interface_op_frag"] =
		"%cpntPtr = OpAccessChain %op_f32 %IF_output %IF_input_val\n"
		"           OpStore %cpntPtr %c_f32_1\n";

	fragments["post_interface_op_tessc"] =
		"%cpntPtr0 = OpAccessChain %op_f32 %IF_output %c_i32_0 %IF_input_val0\n"
		"           OpStore %cpntPtr0 %c_f32_1\n"
		"%cpntPtr1 = OpAccessChain %op_f32 %IF_output %c_i32_1 %IF_input_val1\n"
		"           OpStore %cpntPtr1 %c_f32_1\n"
		"%cpntPtr2 = OpAccessChain %op_f32 %IF_output %c_i32_2 %IF_input_val2\n"
		"           OpStore %cpntPtr2 %c_f32_1\n";

	fragments["post_interface_op_tesse"] = fragments["post_interface_op_geom"] =
		"%cpntPtr = OpAccessChain %op_f32 %IF_output %IF_input_val0\n"
		"           OpStore %cpntPtr %c_f32_1\n";

	fragments["input_type"]		= "u32";
	fragments["output_type"]	= "v4f32";

	GraphicsInterfaces	interfaces;

	interfaces.setInputOutput(std::make_pair(IFDataType(1, NUMBERTYPE_UINT32), BufferSp(new Int32Buffer(inputData))),
							  std::make_pair(IFDataType(4, NUMBERTYPE_FLOAT32), BufferSp(new Float32Buffer(outputData))));

	createTestsForAllStages("component", defaultColors, defaultColors, fragments, interfaces, noExtensions, testGroup);
}

void addComputeIndexingNon16BaseAlignmentTests (tcu::TestCaseGroup* group)
{
	tcu::TestContext&				testCtx					= group->getTestContext();
	de::MovePtr<tcu::TestCaseGroup> non16BaseAlignmentGroup	(new tcu::TestCaseGroup(testCtx, "non16basealignment", "Tests for indexing array with base alignment less than 16."));
	de::Random						rnd						(deStringHash(group->getName()));
	const int						floatArraySize			= 18;
	const int						numFloatArrays			= 32;

	const int						numInputFloats			= floatArraySize * numFloatArrays;
	const int						numOutputFloats			= numFloatArrays;
	vector<float>					inputData;
	VulkanFeatures					vulkanFeatures;
	vector<float>					outputData;
	ComputeShaderSpec				spec;
	const ChainOp					chainOps[]				= { CHAIN_OP_ACCESS_CHAIN, CHAIN_OP_PTR_ACCESS_CHAIN };

	// Input is the following structure:
	//
	// struct
	// {
	//     struct
	//     {
	//         float f[18];
	//     } struct1[];
	// } struct 0;
	//
	// Each instance calculates a sum of f[0]..f[17] and outputs the result into float array.
	string							shaderStr				=
			"                             OpCapability Shader\n"
			"                             ${variablepointercaps:opt}\n"
			"                             ${extensions:opt}\n"
			"                        %1 = OpExtInstImport \"GLSL.std.450\"\n"
			"                             OpMemoryModel Logical GLSL450\n"
			"                             OpEntryPoint GLCompute %main \"main\" %gl_GlobalInvocationID\n"
			"                             OpExecutionMode %main LocalSize 1 1 1\n"
			"                             OpSource GLSL 430\n"
			"                             OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId\n"
			"                             OpDecorate %input_array ArrayStride 4\n"
			"                             OpDecorate %output_array ArrayStride 4\n";
	shaderStr +=
			"                             OpDecorate %runtimearr_struct1 ArrayStride " + de::toString(floatArraySize * 4) + "\n";
	shaderStr +=
			"                             OpDecorate %_ptr_struct1_sb ArrayStride " + de::toString(floatArraySize * 4) + "\n";
	shaderStr +=
			"                             OpMemberDecorate %Output 0 Offset 0\n"
			"                             OpDecorate %Output Block\n"
			"                             OpDecorate %dataOutput DescriptorSet 0\n"
			"                             OpDecorate %dataOutput Binding 1\n"
			"                             OpMemberDecorate %struct0 0 Offset 0\n"
			"                             OpMemberDecorate %struct1 0 Offset 0\n"
			"                             OpDecorate %struct0 Block\n"
			"                             OpDecorate %dataInput DescriptorSet 0\n"
			"                             OpDecorate %dataInput Binding 0\n"
			"                     %void = OpTypeVoid\n"
			"                        %3 = OpTypeFunction %void\n"
			"                      %u32 = OpTypeInt 32 0\n"
			"                      %i32 = OpTypeInt 32 1\n"
			"     %_ptr_Function_uint32 = OpTypePointer Function %u32\n"
			"                 %v3uint32 = OpTypeVector %u32 3\n"
			"      %_ptr_Input_v3uint32 = OpTypePointer Input %v3uint32\n"
			"    %gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint32 Input\n"
			"        %_ptr_Input_uint32 = OpTypePointer Input %u32\n"
			"                    %float = OpTypeFloat 32\n";
	for (deUint32 floatIdx = 0; floatIdx < floatArraySize + 1; ++floatIdx)
		shaderStr += string("%uint_") + de::toString(floatIdx) + " = OpConstant %u32 " + de::toString(floatIdx) + "\n";
	shaderStr +=
			"                  %uint_" + de::toString(numFloatArrays) + " = OpConstant %u32 " + de::toString(numFloatArrays) + "\n";
	shaderStr +=
			"              %input_array = OpTypeArray %float %uint_" + de::toString(floatArraySize) + "\n";
	shaderStr +=
			"             %output_array = OpTypeArray %float %uint_" + de::toString(numFloatArrays) + "\n";
	shaderStr +=
			"                   %Output = OpTypeStruct %output_array\n"
			"           %_ptr_sb_Output = OpTypePointer StorageBuffer %Output\n"
			"               %dataOutput = OpVariable %_ptr_sb_Output StorageBuffer\n"
			"                  %struct1 = OpTypeStruct %input_array\n"
			"       %runtimearr_struct1 = OpTypeRuntimeArray %struct1\n"
			"                  %struct0 = OpTypeStruct %runtimearr_struct1\n"
			"          %_ptr_struct0_sb = OpTypePointer StorageBuffer %struct0\n"
			"          %_ptr_struct1_sb = OpTypePointer StorageBuffer %struct1\n"
			"            %_ptr_float_sb = OpTypePointer StorageBuffer %float\n"
			"                %dataInput = OpVariable %_ptr_struct0_sb StorageBuffer\n"
			"                     %main = OpFunction %void None %3\n"
			"                    %entry = OpLabel\n"
			"                     %base = OpAccessChain %_ptr_struct1_sb %dataInput %uint_0 %uint_0\n"
			"                %invid_ptr = OpAccessChain %_ptr_Input_uint32 %gl_GlobalInvocationID %uint_0\n"
			"                    %invid = OpLoad %u32 %invid_ptr\n";
	for (deUint32 floatIdx = 0; floatIdx < floatArraySize; ++floatIdx)
	{
		shaderStr += string("%dataPtr") + de::toString(floatIdx) + " = ${chainop} %invid %uint_0 %uint_" + de::toString(floatIdx) + "\n";
		if (floatIdx == 0)
		{
			shaderStr += "%acc0 = OpLoad %float %dataPtr0\n";
		}
		else
		{
			shaderStr += string("%tmp") + de::toString(floatIdx) + " = OpLoad %float %dataPtr" + de::toString(floatIdx) + "\n";
			shaderStr += string("%acc") + de::toString(floatIdx) + " = OpFAdd %float %tmp" + de::toString(floatIdx) + " %acc" + de::toString(floatIdx - 1) + "\n";
		}
	}
	shaderStr +=
			"                   %outPtr = OpAccessChain %_ptr_float_sb %dataOutput %uint_0 %invid\n";
	shaderStr +=
			"                             OpStore %outPtr %acc" + de::toString(floatArraySize - 1) + "\n";
	shaderStr +=
			"                             OpReturn\n"
			"                             OpFunctionEnd\n";

	vulkanFeatures.extVariablePointers = EXTVARIABLEPOINTERSFEATURES_VARIABLE_POINTERS_STORAGEBUFFER;
	spec.extensions.push_back("VK_KHR_variable_pointers");

	inputData.reserve(numInputFloats);
	for (deUint32 numIdx = 0; numIdx < numInputFloats; ++numIdx)
	{
		float f = rnd.getFloat();

		// CPU might not use the same rounding mode as the GPU. Use whole numbers to avoid rounding differences.
		f = deFloatFloor(f);

		inputData.push_back(f);
	}

	spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));

	outputData.reserve(numOutputFloats);
	for (deUint32 outputIdx = 0; outputIdx < numOutputFloats; ++outputIdx)
	{
		float f = 0.0f;
		for (deUint32 arrIdx = 0; arrIdx < floatArraySize; ++arrIdx)
			f += inputData[outputIdx * floatArraySize + arrIdx];
		outputData.push_back(f);
	}

	spec.numWorkGroups				= IVec3(numFloatArrays, 1, 1);
	spec.requestedVulkanFeatures	= vulkanFeatures;
	spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(outputData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));

	for (int chainOpIdx = 0; chainOpIdx < DE_LENGTH_OF_ARRAY(chainOps); ++chainOpIdx)
	{
		const ChainOp		chainOp		= chainOps[chainOpIdx];
		const string		testName	= chainOpTestNames[chainOp];
		map<string, string>	specs;

		specs["variablepointercaps"]	= "OpCapability VariablePointersStorageBuffer";
		specs["extensions"]				= "OpExtension \"SPV_KHR_variable_pointers\"\n                             "
										  "OpExtension \"SPV_KHR_storage_buffer_storage_class\"";
		switch(chainOp)
		{
			case CHAIN_OP_ACCESS_CHAIN:
				specs["chainop"] = "OpAccessChain %_ptr_float_sb %dataInput %uint_0 %uint_0";
				specs["chainop"] = "OpAccessChain %_ptr_float_sb %dataInput %uint_0";
				break;
			case CHAIN_OP_PTR_ACCESS_CHAIN:
				specs["chainop"] = "OpPtrAccessChain %_ptr_float_sb %base";
				break;
			default:
				DE_FATAL("Unexpected chain op");
				break;
		}

		spec.assembly					= StringTemplate(shaderStr).specialize(specs);

		non16BaseAlignmentGroup->addChild(new SpvAsmComputeShaderCase(testCtx, testName.c_str(), testName.c_str(), spec));
	}

	group->addChild(non16BaseAlignmentGroup.release());
}

} // anonymous

tcu::TestCaseGroup* createIndexingComputeGroup (tcu::TestContext& testCtx)
{
	de::MovePtr<tcu::TestCaseGroup> indexingGroup	(new tcu::TestCaseGroup(testCtx, "indexing", "Compute tests for data indexing."));
	de::MovePtr<tcu::TestCaseGroup> inputGroup		(new tcu::TestCaseGroup(testCtx, "input", "Tests for indexing input data."));

	addComputeIndexingStructTests(inputGroup.get());
	addComputeIndexingNon16BaseAlignmentTests(inputGroup.get());

	indexingGroup->addChild(inputGroup.release());

	return indexingGroup.release();
}

tcu::TestCaseGroup* createIndexingGraphicsGroup (tcu::TestContext& testCtx)
{
	de::MovePtr<tcu::TestCaseGroup> indexingGroup	(new tcu::TestCaseGroup(testCtx, "indexing", "Graphics tests for data indexing."));
	de::MovePtr<tcu::TestCaseGroup> inputGroup		(new tcu::TestCaseGroup(testCtx, "input", "Tests for indexing input data."));
	de::MovePtr<tcu::TestCaseGroup> outputGroup		(new tcu::TestCaseGroup(testCtx, "output", "Tests for indexing output data."));

	addGraphicsIndexingStructTests(inputGroup.get());
	addGraphicsOutputComponentIndexingTests(outputGroup.get());

	indexingGroup->addChild(inputGroup.release());
	indexingGroup->addChild(outputGroup.release());

	return indexingGroup.release();
}

} // SpirVAssembly
} // vkt


text:
<?php

namespace Nucleus\Binder;

class InvalidScopeException extends \RuntimeException
{
    public static function formatMessage($scope)
    {
        return 'The scope [' . $scope . '] cannot be found';
    }
}


text:
'use strict';

export type A = number;

export type invalidA = mixed => mixed;

export class testClass {}


text:
'use strict';

var fs = require('fs');
var url = require('url');
var path = require('path');
var grunt = require('grunt');

var opts;

var fileDoesntExist = function(normalizedPath, reference) {
    grunt.log.warn('Static asset "' + normalizedPath + '" skipped because it wasn\'t found, original reference=' + reference);
    return false;
};

var doesFileExist = function(filepath) {
    if (!grunt.file.exists(filepath)) {
        grunt.log.warn('Source file "' + filepath + '" not found.');
        return false;
    } else {
        return true;
    }
};

var removeIgnoredPatterns = function(parsedUrl) {
    if (opts.ignorePatterns) {
        var matched = opts.ignorePatterns.some(function(pattern) {
            return new RegExp(pattern, 'ig').test(parsedUrl.href);
        });

        if (matched) {
            return false;
        }
    }

    return true;
};

module.exports = function() {
    grunt.registerMultiTask('cacheBust', 'Bust static assets from the cache using content hashing', function() {
        opts = this.options(require('./lib/defaultOptions'));

        var processedFileMap = {};
        var filesToDelete = [];

        var utils = require('./lib/utils');
        var findStaticAssets = require('./lib/findStaticAssets')(opts);

        // Kick things off!
        this.files.forEach(function(file) {
            file.src
                .filter(doesFileExist)
                .forEach(function(filepath) {
                    var markup = grunt.file.read(filepath);

                    findStaticAssets(markup, (/\.css$/).test(filepath))
                        .filter(removeIgnoredPatterns)
                        .forEach(function(parsedUrl) {
                            var normalizedPath = utils.normalizePath(opts, file, path.dirname(filepath), parsedUrl);
                            var originalReference = decodeURI(parsedUrl.href);
                            var newPathname = decodeURI(parsedUrl.pathname);
                            var generateFileHash = utils.generateFileHash(opts);
                            var removePreviousHash = utils.removePreviousHash(opts);
                            var newReference;
                            var domain;

                            if (opts.rename) {

                                // If the file has already been cached, use that
                                if (processedFileMap[parsedUrl.pathname]) {
                                    markup = markup.replace(new RegExp(utils.regexEscape(parsedUrl.pathname), 'g'), processedFileMap[parsedUrl.pathname]);
                                } else {
                                    // Remove any previous hashes from the filename
                                    normalizedPath = removePreviousHash(normalizedPath);
                                    newPathname = removePreviousHash(newPathname);

                                    // Replacing specific terms in the import path so renaming files
                                    if (opts.replaceTerms && opts.replaceTerms.length > 0) {
                                        opts.replaceTerms.forEach(function(obj) {
                                            grunt.util._.each(obj, function(replacement, term) {
                                                normalizedPath = normalizedPath.replace(term, replacement);
                                                newPathname = newPathname.replace(term, replacement);
                                            });
                                        });
                                    }

                                    // Check if file exists
                                    if (!grunt.file.exists(normalizedPath)) {
                                        return fileDoesntExist(normalizedPath, parsedUrl.pathname);
                                    }

                                    // Generate the file hash
                                    var fileHash = generateFileHash(grunt.file.read(normalizedPath, {
                                        encoding: null
                                    }));

                                    // Create our new filename
                                    var newFilename = utils.addFileHash(normalizedPath, fileHash, opts.separator);

                                    // Create the new reference
                                    domain = (parsedUrl.hostname ? (parsedUrl.protocol ? parsedUrl.protocol : '') + '//' + (parsedUrl.hostname ? parsedUrl.hostname : '') : '');
                                    newReference = domain + utils.addFileHash(newPathname, fileHash, opts.separator) + (parsedUrl.hash ? parsedUrl.hash : '');

                                    // Update the reference in the markup
                                    markup = markup.replace(new RegExp(utils.regexEscape(originalReference)), newReference);

                                    // Create our new file
                                    grunt.file.copy(normalizedPath, newFilename);

                                    grunt.verbose.writeln(newFilename + ' was created!');
                                }
                            } else {
                                // Remove any previous hashes from the filename
                                normalizedPath = removePreviousHash(normalizedPath);
                                newPathname = removePreviousHash(newPathname);

                                // Check if file exists
                                if (!grunt.file.exists(normalizedPath)) {
                                    return fileDoesntExist(normalizedPath, parsedUrl.pathname);
                                }

                                // Create the new reference
                                domain = (parsedUrl.hostname ? (parsedUrl.protocol ? parsedUrl.protocol : '') + '//' + (parsedUrl.hostname ? parsedUrl.hostname : '') : '');
                                newReference = domain + newPathname + '?' + generateFileHash(grunt.file.read(normalizedPath, {
                                        encoding: null
                                    })) + (parsedUrl.hash ? parsedUrl.hash : '');

                                // Update the reference in the markup
                                markup = markup.replace(new RegExp(utils.regexEscape(originalReference)), newReference);
                            }

                            processedFileMap[parsedUrl.pathname] = newReference;

                            if (opts.deleteOriginals) {
                                filesToDelete.push(normalizedPath);
                            }
                        });

                    if (opts.enableUrlFragmentHint && opts.removeUrlFragmentHint) {
                        markup = markup.replace(/#grunt-cache-bust/g, '');
                    }

                    // Write back to the source file with changes
                    grunt.file.write(filepath, markup);

                    // Log that we've busted the file
                    grunt.log.writeln(['The file ', filepath, ' was busted!'].join(''));
                });
        });

        // Delete the original files
        if (opts.deleteOriginals) {
            filesToDelete.forEach(function(filename) {
                if (grunt.file.exists(filename)) {
                    grunt.file.delete(filename);
                }
            });
        }

        // Generate a JSON file with the swapped file names if requested
        if (opts.jsonOutput) {
            var name = typeof opts.jsonOutput === 'string' ? opts.jsonOutput : opts.jsonOutputFilename;

            grunt.log.writeln(['File map has been exported to ', path.normalize(opts.baseDir + '/' + name), '!'].join(''));
            grunt.file.write(path.normalize(opts.baseDir + '/' + name), JSON.stringify(processedFileMap));
        }
    });

};


text:
<?php
declare(strict_types=1);

namespace PhpMud\IO\Command;

use PhpMud\Enum\AccessLevel;
use PhpMud\IO\Command\Command;
use PhpMud\Enum\Disposition;
use PhpMud\IO\Input;
use PhpMud\IO\Output;
use PhpMud\Server;
use Pimple\Container;
use Pimple\ServiceProviderInterface;

class SitCommand implements ServiceProviderInterface
{
    public function register(Container $pimple)
    {
        $pimple['sit'] = $pimple->protect(function () {
            return new class implements Command
            {
                public function execute(Server $server, Input $input): Output
                {
                    if ($input->getDisposition()->equals(Disposition::SITTING())) {
                        return new Output('You are already sitting.');
                    }

                    if ($input->getDisposition()->equals(Disposition::FIGHTING())) {
                        return new Output('No way! You are fighting.');
                    }

                    $input->getMob()->setDisposition(Disposition::SITTING());

                    return new Output('You sit.');
                }

                public function getRequiredAccessLevel(): AccessLevel
                {
                    return AccessLevel::MOB();
                }
            };
        });
    }
}


text:
#ifndef _ERRNO_H
#define _ERRNO_H

extern int errno;

/*
 * Error number definitions
 */
#define EPERM		1	/* not permitted */
#define ENOENT		2	/* file or directory not found */
#define EIO		5	/* input/output error */
#define ENOMEM		12	/* not enough space */
#define EACCES		13	/* permission denied */
#define EFAULT		14	/* bad address */
#define EBUSY		16	/* resource busy */
#define EEXIST		17	/* file already exists */
#define ENODEV		19	/* device not found */
#define EINVAL		22	/* invalid argument */
#define EDOM		33	/* math argument out of domain of func */
#define ERANGE		34	/* math result not representable */

#endif


text:
<?php

namespace Phpf\Package;

/**
 * Modules are customizable packages.
 *
 * Each module should define a class that extends Phpf\Package\Module.
 * Custom contructor and load methods are permitted.
 */
class Module extends AbstractPackage {

	final public function getType(){
		return 'module';
	}

}


text:
package com.programmaticallyspeaking.ncd.nashorn

import com.programmaticallyspeaking.ncd.infra.CompiledScript

object NameConvert {
  def sourceNameToUrl(typeName: => String, sourceName: String): String = sourceName match {
    case x if x.contains("<eval>") =>
      // For evaluated scripts, convert the type name into something that resembles a file URI.
      "eval:/" + typeNameToUrl(typeName)
    case CompiledScript(cs) =>
      cs.url
    case _ =>
      sourceName // keep it simple
  }

  private def typeNameToUrl(typeName: String): String = {
    typeName
      .replace("jdk.nashorn.internal.scripts.", "")
      .replace('.', '/')
      .replace('\\', '/')
      .replaceAll("[$^_]", "")
      .replaceFirst("/eval/?$", "")
  }
}


text:
class PagePart < ActiveRecord::Base
  attr_accessible :content, :name, :filter

  # Relationships
  belongs_to :page

  class << self

    def defaults
      %w{ body side footer }
    end

    def filters
      { 0 => 'WYSIWYG', 1 => 'HTML' }
    end

  end
end