text:
package org.apache.hadoop.mapreduce.jobhistory;

import java.util.Set;

import org.apache.avro.util.Utf8;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.mapred.ProgressSplitsBlock;
import org.apache.hadoop.mapreduce.Counters;
import org.apache.hadoop.mapreduce.TaskAttemptID;
import org.apache.hadoop.mapreduce.TaskID;
import org.apache.hadoop.mapreduce.TaskType;
import org.apache.hadoop.mapreduce.util.JobHistoryEventUtils;
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEvent;
import org.apache.hadoop.yarn.api.records.timelineservice.TimelineMetric;

/**
 * Event to record successful completion of a reduce attempt
 *
 */
@InterfaceAudience.Private
@InterfaceStability.Unstable
public class ReduceAttemptFinishedEvent implements HistoryEvent {

  private ReduceAttemptFinished datum = null;

  private TaskAttemptID attemptId;
  private TaskType taskType;
  private String taskStatus;
  private long shuffleFinishTime;
  private long sortFinishTime;
  private long finishTime;
  private String hostname;
  private String rackName;
  private int port;
  private String state;
  private Counters counters;
  int[][] allSplits;
  int[] clockSplits;
  int[] cpuUsages;
  int[] vMemKbytes;
  int[] physMemKbytes;

  /**
   * Create an event to record completion of a reduce attempt
   * @param id Attempt Id
   * @param taskType Type of task
   * @param taskStatus Status of the task
   * @param shuffleFinishTime Finish time of the shuffle phase
   * @param sortFinishTime Finish time of the sort phase
   * @param finishTime Finish time of the attempt
   * @param hostname Name of the host where the attempt executed
   * @param port RPC port for the tracker host.
   * @param rackName Name of the rack where the attempt executed
   * @param state State of the attempt
   * @param counters Counters for the attempt
   * @param allSplits the "splits", or a pixelated graph of various
   *        measurable worker node state variables against progress.
   *        Currently there are four; wallclock time, CPU time,
   *        virtual memory and physical memory.
   */
  public ReduceAttemptFinishedEvent
    (TaskAttemptID id, TaskType taskType, String taskStatus,
     long shuffleFinishTime, long sortFinishTime, long finishTime,
     String hostname, int port,  String rackName, String state,
     Counters counters, int[][] allSplits) {
    this.attemptId = id;
    this.taskType = taskType;
    this.taskStatus = taskStatus;
    this.shuffleFinishTime = shuffleFinishTime;
    this.sortFinishTime = sortFinishTime;
    this.finishTime = finishTime;
    this.hostname = hostname;
    this.rackName = rackName;
    this.port = port;
    this.state = state;
    this.counters = counters;
    this.allSplits = allSplits;
    this.clockSplits = ProgressSplitsBlock.arrayGetWallclockTime(allSplits);
    this.cpuUsages = ProgressSplitsBlock.arrayGetCPUTime(allSplits);
    this.vMemKbytes = ProgressSplitsBlock.arrayGetVMemKbytes(allSplits);
    this.physMemKbytes = ProgressSplitsBlock.arrayGetPhysMemKbytes(allSplits);
  }

  /**
   * @deprecated please use the constructor with an additional
   *              argument, an array of splits arrays instead.  See
   *              {@link org.apache.hadoop.mapred.ProgressSplitsBlock}
   *              for an explanation of the meaning of that parameter.
   *
   * Create an event to record completion of a reduce attempt
   * @param id Attempt Id
   * @param taskType Type of task
   * @param taskStatus Status of the task
   * @param shuffleFinishTime Finish time of the shuffle phase
   * @param sortFinishTime Finish time of the sort phase
   * @param finishTime Finish time of the attempt
   * @param hostname Name of the host where the attempt executed
   * @param state State of the attempt
   * @param counters Counters for the attempt
   */
  public ReduceAttemptFinishedEvent
    (TaskAttemptID id, TaskType taskType, String taskStatus,
     long shuffleFinishTime, long sortFinishTime, long finishTime,
     String hostname, String state, Counters counters) {
    this(id, taskType, taskStatus,
         shuffleFinishTime, sortFinishTime, finishTime,
         hostname, -1, "", state, counters, null);
  }

  ReduceAttemptFinishedEvent() {}

  public Object getDatum() {
    if (datum == null) {
      datum = new ReduceAttemptFinished();
      datum.setTaskid(new Utf8(attemptId.getTaskID().toString()));
      datum.setAttemptId(new Utf8(attemptId.toString()));
      datum.setTaskType(new Utf8(taskType.name()));
      datum.setTaskStatus(new Utf8(taskStatus));
      datum.setShuffleFinishTime(shuffleFinishTime);
      datum.setSortFinishTime(sortFinishTime);
      datum.setFinishTime(finishTime);
      datum.setHostname(new Utf8(hostname));
      datum.setPort(port);
      if (rackName != null) {
        datum.setRackname(new Utf8(rackName));
      }
      datum.setState(new Utf8(state));
      datum.setCounters(EventWriter.toAvro(counters));

      datum.setClockSplits(AvroArrayUtils.toAvro(ProgressSplitsBlock
          .arrayGetWallclockTime(allSplits)));
      datum.setCpuUsages(AvroArrayUtils.toAvro(ProgressSplitsBlock
          .arrayGetCPUTime(allSplits)));
      datum.setVMemKbytes(AvroArrayUtils.toAvro(ProgressSplitsBlock
          .arrayGetVMemKbytes(allSplits)));
      datum.setPhysMemKbytes(AvroArrayUtils.toAvro(ProgressSplitsBlock
          .arrayGetPhysMemKbytes(allSplits)));
    }
    return datum;
  }

  public void setDatum(Object oDatum) {
    this.datum = (ReduceAttemptFinished)oDatum;
    this.attemptId = TaskAttemptID.forName(datum.getAttemptId().toString());
    this.taskType = TaskType.valueOf(datum.getTaskType().toString());
    this.taskStatus = datum.getTaskStatus().toString();
    this.shuffleFinishTime = datum.getShuffleFinishTime();
    this.sortFinishTime = datum.getSortFinishTime();
    this.finishTime = datum.getFinishTime();
    this.hostname = datum.getHostname().toString();
    this.rackName = datum.getRackname().toString();
    this.port = datum.getPort();
    this.state = datum.getState().toString();
    this.counters = EventReader.fromAvro(datum.getCounters());
    this.clockSplits = AvroArrayUtils.fromAvro(datum.getClockSplits());
    this.cpuUsages = AvroArrayUtils.fromAvro(datum.getCpuUsages());
    this.vMemKbytes = AvroArrayUtils.fromAvro(datum.getVMemKbytes());
    this.physMemKbytes = AvroArrayUtils.fromAvro(datum.getPhysMemKbytes());
  }

  /** Get the Task ID */
  public TaskID getTaskId() { return attemptId.getTaskID(); }
  /** Get the attempt id */
  public TaskAttemptID getAttemptId() {
    return attemptId;
  }
  /** Get the task type */
  public TaskType getTaskType() {
    return taskType;
  }
  /** Get the task status */
  public String getTaskStatus() { return taskStatus.toString(); }
  /** Get the finish time of the sort phase */
  public long getSortFinishTime() { return sortFinishTime; }
  /** Get the finish time of the shuffle phase */
  public long getShuffleFinishTime() { return shuffleFinishTime; }
  /** Get the finish time of the attempt */
  public long getFinishTime() { return finishTime; }
  /** Get the name of the host where the attempt ran */
  public String getHostname() { return hostname.toString(); }
  /** Get the tracker rpc port */
  public int getPort() { return port; }

  /** Get the rack name of the node where the attempt ran */
  public String getRackName() {
    return rackName == null ? null : rackName.toString();
  }

  /** Get the state string */
  public String getState() { return state.toString(); }
  /** Get the counters for the attempt */
  Counters getCounters() { return counters; }
  /** Get the event type */
  public EventType getEventType() {
    return EventType.REDUCE_ATTEMPT_FINISHED;
  }

  public int[] getClockSplits() {
    return clockSplits;
  }
  public int[] getCpuUsages() {
    return cpuUsages;
  }
  public int[] getVMemKbytes() {
    return vMemKbytes;
  }
  public int[] getPhysMemKbytes() {
    return physMemKbytes;
  }

  @Override
  public TimelineEvent toTimelineEvent() {
    TimelineEvent tEvent = new TimelineEvent();
    tEvent.setId(StringUtils.toUpperCase(getEventType().name()));
    tEvent.addInfo("TASK_TYPE", getTaskType().toString());
    tEvent.addInfo("ATTEMPT_ID", getAttemptId() == null ?
        "" : getAttemptId().toString());
    tEvent.addInfo("FINISH_TIME", getFinishTime());
    tEvent.addInfo("STATUS", getTaskStatus());
    tEvent.addInfo("STATE", getState());
    tEvent.addInfo("SHUFFLE_FINISH_TIME", getShuffleFinishTime());
    tEvent.addInfo("SORT_FINISH_TIME", getSortFinishTime());
    tEvent.addInfo("HOSTNAME", getHostname());
    tEvent.addInfo("PORT", getPort());
    tEvent.addInfo("RACK_NAME", getRackName());
    return tEvent;
  }

  @Override
  public Set<TimelineMetric> getTimelineMetrics() {
    Set<TimelineMetric> metrics = JobHistoryEventUtils
        .countersToTimelineMetric(getCounters(), finishTime);
    return metrics;
  }

}


text:
package org.familysearch.platform.discussions;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.familysearch.platform.rt.FamilySearchPlatformModelVisitor;
import org.gedcomx.common.ResourceReference;
import org.gedcomx.links.HypermediaEnabledData;
import org.gedcomx.rt.json.JsonElementWrapper;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * A discussion.
 *
 */
@XmlRootElement
@JsonElementWrapper (name = "discussions")
@XmlType ( name = "Discussion", propOrder = { "title", "details", "created", "contributor", "modified", "numberOfComments", "comments" } )
@JsonInclude ( JsonInclude.Include.NON_NULL )
public class Discussion extends HypermediaEnabledData {

  private String title;
  private String details;
  private ResourceReference contributor;
  private Date created;
  private Date modified;    // last date of any change to comments or discussion details
  private Integer numberOfComments;
  private List<Comment> comments;

  //TODO: need to add a URI to point to the specific resource (eg person) that the discussion is about

  /**
   * get the one-line summary or "subject" of the discussion
   * @return the one-line summary text
   */
  public String getTitle() {
    return title;
  }

  /**
   * Set the one-line summary or "subject" of the discussion
   * @param title the one-line summary text
   */
  public void setTitle(String title) {
    this.title = title;
  }

  /**
   * Build out this discussion by applying a title.
   *
   * @param title The title.
   * @return this.
   */
  public Discussion title(String title) {
    setTitle(title);
    return this;
  }

  /**
   * Get detailed text of the discussion
   * @return  The text or "message body" of the discussion
   */
  public String getDetails() {
    return details;
  }

  /**
   * Set discussion details, or "message body" of discussion
   * @param details Details
   */
  public void setDetails(String details) {
    this.details = details;
  }

  /**
   * Build out this discussion by applying details.
   *
   * @param details The details.
   * @return this.
   */
  public Discussion details(String details) {
    setDetails(details);
    return this;
  }

  /**
   * Get the contributor who submitted this discussion
   * @return contributor of discussion
   */
  public ResourceReference getContributor() {
    return contributor;
  }

  /**
   * Set the contributor of this discussion
   * @param contributor reference to who submitted the discussion
   */
  public void setContributor(ResourceReference contributor) {
    this.contributor = contributor;
  }

  /**
   * Build out this discussion by applying a contributor.
   *
   * @param contributor The contributor.
   * @return this.
   */
  public Discussion contributor(ResourceReference contributor) {
    setContributor(contributor);
    return this;
  }

  /**
   * Get the date of discussion creation
   * @return date of creation
   */
  public Date getCreated() {
    return created;
  }

  /**
   * Set the date the discussion was created
   * @param created date of creation
   */
  public void setCreated(Date created) {
    this.created = created;
  }

  /**
   * Build out this discussion by applying a created date.
   *
   * @param created The created date.
   * @return this.
   */
  public Discussion created(Date created) {
    setCreated(created);
    return this;
  }

  /** Last date of any change to comments or discussion details
   * @return Date of last modification
   */
  public Date getModified() {
    return modified;
  }

  /**
   * Set the modified date of this discussion. Should be the last date of any change to comments or discussion details
   * @param modified date of last modification
   */
  public void setModified(Date modified) {
    this.modified = modified;
  }

  /**
   * Build out this discussion by applying a modified date.
   *
   * @param modified The modified date.
   * @return this.
   */
  public Discussion modified(Date modified) {
    setModified(modified);
    return this;
  }

  /**
   * Get the number of comments associated with this discussion
   * @return Number of comments
   */
  public Integer getNumberOfComments() {
    return numberOfComments;
  }

  /**
   * Set the number of comments associated with this discussion
   * @param numberOfComments number of comment objects with this discussion
   */
  public void setNumberOfComments(Integer numberOfComments) {
    this.numberOfComments = numberOfComments;
  }

  /**
   * Build our this discussion by setting a number of comments.
   *
   * @param numberOfComments The number of comments.
   * @return this.
   */
  public Discussion numberOfComments(Integer numberOfComments) {
    setNumberOfComments(numberOfComments);
    return this;
  }

  /**
   * The comments on this discussion.
   *
   * @return The comments on this discussion.
   */
  @XmlElement ( name="comment" )
  @JsonProperty ( "comments" )
  public List<Comment> getComments() {
    return comments;
  }

  /**
   * The comments on this discussion.
   *
   * @param comments The comments on this discussion.
   */
  @JsonProperty ( "comments" )
  public void setComments(List<Comment> comments) {
    this.comments = comments;
  }

  /**
   * Add a comment.
   *
   * @param comment The comment to add.
   */
  public void addComment(Comment comment) {
    if (comments == null) {
      comments = new ArrayList<Comment>();
    }
    comments.add( comment );
  }

  /**
   * Build out this discussion by adding a comment.
   *
   * @param comment The comment to add.
   * @return this.
   */
  public Discussion comment(Comment comment) {
    addComment(comment);
    return this;
  }

  /**
   * Accept a visitor.
   *
   * @param visitor The visitor to accept.
   */
  public void accept(FamilySearchPlatformModelVisitor visitor) {
    visitor.visitDiscussion(this);
  }

  public void embed(Discussion discussion) {
    List<Comment> comments = discussion.getComments();
    if (comments != null) {
      for (Comment comment : comments) {
        boolean found = false;
        if (comment.getId() != null) {
          if (getComments() != null) {
            for (Comment target : getComments()) {
              if (comment.getId().equals(target.getId())) {
                target.embed(comment);
                found = true;
                break;
              }
            }
          }
        }

        if (!found) {
          addComment(comment);
        }
      }
    }

    super.embed(discussion);
  }
}

redpajama_set_name: RedPajamaGithub


text:
using System;

namespace _07.Cake_Ingredients
{
    public class Program
    {
        public static void Main()
        {
            var ingredients = Console.ReadLine();
            int counter = 0;
            while (ingredients != "Bake!")
            {
                Console.WriteLine($"Adding ingredient {ingredients}.");
                ingredients = Console.ReadLine();
                counter++;
            }
            Console.WriteLine($"Preparing cake with {counter} ingredients.");
        }
    }
}


text:
package main

import (
	"archive/tar"
	"archive/zip"
	"bufio"
	"bytes"
	"compress/gzip"
	"encoding/base64"
	"flag"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"mime/multipart"
	"net/http"
	"os"
	"os/exec"
	"path/filepath"
	"regexp"
	"runtime"
	"strings"
)

var (
	tag      = flag.String("tag", "release", "mercurial tag to check out")
	repo     = flag.String("repo", "https://code.google.com/p/go", "repo URL")
	verbose  = flag.Bool("v", false, "verbose output")
	upload   = flag.Bool("upload", true, "upload resulting files to Google Code")
	wxsFile  = flag.String("wxs", "", "path to custom installer.wxs")
	addLabel = flag.String("label", "", "additional label to apply to file when uploading")

	username, password string // for Google Code upload
)

const (
	uploadURL = "https://go.googlecode.com/files"
)

var preBuildCleanFiles = []string{
	"lib/codereview",
	"misc/dashboard/godashboard",
	"src/cmd/cov",
	"src/cmd/prof",
	"src/pkg/exp",
	"src/pkg/old",
}

var cleanFiles = []string{
	".hg",
	".hgtags",
	".hgignore",
	"VERSION.cache",
}

var sourceCleanFiles = []string{
	"bin",
	"pkg",
}

var fileRe = regexp.MustCompile(`^go\.([a-z0-9-.]+)\.(src|([a-z0-9]+)-([a-z0-9]+))\.`)

func main() {
	flag.Usage = func() {
		fmt.Fprintf(os.Stderr, "usage: %s [flags] targets...\n", os.Args[0])
		flag.PrintDefaults()
		os.Exit(2)
	}
	flag.Parse()
	if flag.NArg() == 0 {
		flag.Usage()
	}
	if runtime.GOOS == "windows" {
		checkWindowsDeps()
	}

	if *upload {
		if err := readCredentials(); err != nil {
			log.Println("readCredentials:", err)
		}
	}
	for _, targ := range flag.Args() {
		var b Build
		if m := fileRe.FindStringSubmatch(targ); m != nil {
			// targ is a file name; upload it to googlecode.
			version := m[1]
			if m[2] == "src" {
				b.Source = true
			} else {
				b.OS = m[3]
				b.Arch = m[4]
			}
			if !*upload {
				log.Printf("%s: -upload=false, skipping", targ)
				continue
			}
			if err := b.Upload(version, targ); err != nil {
				log.Printf("%s: %v", targ, err)
			}
			continue
		}
		if targ == "source" {
			b.Source = true
		} else {
			p := strings.SplitN(targ, "-", 2)
			if len(p) != 2 {
				log.Println("Ignoring unrecognized target:", targ)
				continue
			}
			b.OS = p[0]
			b.Arch = p[1]
		}
		if err := b.Do(); err != nil {
			log.Printf("%s: %v", targ, err)
		}
	}
}

type Build struct {
	Source bool // if true, OS and Arch must be empty
	OS     string
	Arch   string
	root   string
}

func (b *Build) Do() error {
	work, err := ioutil.TempDir("", "bindist")
	if err != nil {
		return err
	}
	defer os.RemoveAll(work)
	b.root = filepath.Join(work, "go")

	// Clone Go distribution and update to tag.
	_, err = b.run(work, "hg", "clone", "-q", *repo, b.root)
	if err != nil {
		return err
	}
	_, err = b.run(b.root, "hg", "update", *tag)
	if err != nil {
		return err
	}

	// Remove exp and old packages.
	if err := b.clean(preBuildCleanFiles); err != nil {
		return err
	}

	src := filepath.Join(b.root, "src")
	if b.Source {
		if runtime.GOOS == "windows" {
			log.Print("Warning: running make.bash on Windows; source builds are intended to be run on a Unix machine")
		}
		// Build dist tool only.
		_, err = b.run(src, "bash", "make.bash", "--dist-tool")
	} else {
		// Build.
		if b.OS == "windows" {
			_, err = b.run(src, "cmd", "/C", "make.bat")
		} else {
			_, err = b.run(src, "bash", "make.bash")
		}
	}
	if err != nil {
		return err
	}

	// Get version strings.
	var (
		version     string // "weekly.2012-03-04"
		fullVersion []byte // "weekly.2012-03-04 9353aa1efdf3"
	)
	pat := filepath.Join(b.root, "pkg/tool/*/dist*") // trailing * for .exe
	m, err := filepath.Glob(pat)
	if err != nil {
		return err
	}
	if len(m) == 0 {
		return fmt.Errorf("couldn't find dist in %q", pat)
	}
	fullVersion, err = b.run("", m[0], "version")
	if err != nil {
		return err
	}
	fullVersion = bytes.TrimSpace(fullVersion)
	v := bytes.SplitN(fullVersion, []byte(" "), 2)
	version = string(v[0])

	// Write VERSION file.
	err = ioutil.WriteFile(filepath.Join(b.root, "VERSION"), fullVersion, 0644)
	if err != nil {
		return err
	}

	// Clean goroot.
	if err := b.clean(cleanFiles); err != nil {
		return err
	}
	if b.Source {
		if err := b.clean(sourceCleanFiles); err != nil {
			return err
		}
	}

	// Create packages.
	base := fmt.Sprintf("%s.%s-%s", version, b.OS, b.Arch)
	if !strings.HasPrefix(base, "go") {
		base = "go." + base
	}
	var targs []string
	switch b.OS {
	case "linux", "freebsd", "":
		// build tarball
		targ := base
		if b.Source {
			targ = fmt.Sprintf("%s.src", version)
			if !strings.HasPrefix(targ, "go") {
				targ = "go." + targ
			}
		}
		targ += ".tar.gz"
		err = makeTar(targ, work)
		targs = append(targs, targ)
	case "darwin":
		// arrange work so it's laid out as the dest filesystem
		etc := filepath.Join(b.root, "misc/dist/darwin/etc")
		_, err = b.run(work, "cp", "-r", etc, ".")
		if err != nil {
			return err
		}
		localDir := filepath.Join(work, "usr/local")
		err = os.MkdirAll(localDir, 0755)
		if err != nil {
			return err
		}
		_, err = b.run(work, "mv", "go", localDir)
		if err != nil {
			return err
		}
		// build package
		pkgdest, err := ioutil.TempDir("", "pkgdest")
		if err != nil {
			return err
		}
		defer os.RemoveAll(pkgdest)
		dist := filepath.Join(runtime.GOROOT(), "misc/dist")
		_, err = b.run("", "pkgbuild",
			"--identifier", "com.googlecode.go",
			"--version", "1.0",
			"--scripts", filepath.Join(dist, "darwin/scripts"),
			"--root", work,
			filepath.Join(pkgdest, "com.googlecode.go.pkg"))
		if err != nil {
			return err
		}
		targ := base + ".pkg"
		_, err = b.run("", "productbuild",
			"--distribution", filepath.Join(dist, "darwin/Distribution"),
			"--resources", filepath.Join(dist, "darwin/Resources"),
			"--package-path", pkgdest,
			targ)
		if err != nil {
			return err
		}
		targs = append(targs, targ)
	case "windows":
		// Create ZIP file.
		zip := filepath.Join(work, base+".zip")
		err = makeZip(zip, work)
		// Copy zip to target file.
		targ := base + ".zip"
		err = cp(targ, zip)
		if err != nil {
			return err
		}
		targs = append(targs, targ)

		// Create MSI installer.
		win := filepath.Join(b.root, "misc/dist/windows")
		installer := filepath.Join(win, "installer.wxs")
		if *wxsFile != "" {
			installer = *wxsFile
		}
		appfiles := filepath.Join(work, "AppFiles.wxs")
		msi := filepath.Join(work, "installer.msi")
		// Gather files.
		_, err = b.run(work, "heat", "dir", "go",
			"-nologo",
			"-gg", "-g1", "-srd", "-sfrag",
			"-cg", "AppFiles",
			"-template", "fragment",
			"-dr", "INSTALLDIR",
			"-var", "var.SourceDir",
			"-out", appfiles)
		if err != nil {
			return err
		}
		// Build package.
		_, err = b.run(work, "candle",
			"-nologo",
			"-dVersion="+version,
			"-dArch="+b.Arch,
			"-dSourceDir=go",
			installer, appfiles)
		if err != nil {
			return err
		}
		appfiles = filepath.Join(work, "AppFiles.wixobj")
		installer = filepath.Join(work, "installer.wixobj")
		_, err = b.run(win, "light",
			"-nologo",
			"-ext", "WixUIExtension",
			"-ext", "WixUtilExtension",
			installer, appfiles,
			"-o", msi)
		if err != nil {
			return err
		}
		// Copy installer to target file.
		targ = base + ".msi"
		err = cp(targ, msi)
		targs = append(targs, targ)
	}
	if err == nil && *upload {
		for _, targ := range targs {
			err = b.Upload(version, targ)
			if err != nil {
				return err
			}
		}
	}
	return err
}

func (b *Build) run(dir, name string, args ...string) ([]byte, error) {
	buf := new(bytes.Buffer)
	absName, err := lookPath(name)
	if err != nil {
		return nil, err
	}
	cmd := exec.Command(absName, args...)
	var output io.Writer = buf
	if *verbose {
		log.Printf("Running %q %q", absName, args)
		output = io.MultiWriter(buf, os.Stdout)
	}
	cmd.Stdout = output
	cmd.Stderr = output
	cmd.Dir = dir
	cmd.Env = b.env()
	if err := cmd.Run(); err != nil {
		fmt.Fprintf(os.Stderr, "%s", buf.Bytes())
		return nil, fmt.Errorf("%s %s: %v", name, strings.Join(args, " "), err)
	}
	return buf.Bytes(), nil
}

var cleanEnv = []string{
	"GOARCH",
	"GOBIN",
	"GOHOSTARCH",
	"GOHOSTOS",
	"GOOS",
	"GOROOT",
	"GOROOT_FINAL",
}

func (b *Build) env() []string {
	env := os.Environ()
	for i := 0; i < len(env); i++ {
		for _, c := range cleanEnv {
			if strings.HasPrefix(env[i], c+"=") {
				env = append(env[:i], env[i+1:]...)
			}
		}
	}
	final := "/usr/local/go"
	if b.OS == "windows" {
		final = `c:\go`
	}
	env = append(env,
		"GOARCH="+b.Arch,
		"GOHOSTARCH="+b.Arch,
		"GOHOSTOS="+b.OS,
		"GOOS="+b.OS,
		"GOROOT="+b.root,
		"GOROOT_FINAL="+final,
	)
	return env
}

func (b *Build) Upload(version string, filename string) error {
	// Prepare upload metadata.
	var labels []string
	os_, arch := b.OS, b.Arch
	switch b.Arch {
	case "386":
		arch = "x86 32-bit"
	case "amd64":
		arch = "x86 64-bit"
	}
	if arch != "" {
		labels = append(labels, "Arch-"+b.Arch)
	}
	switch b.OS {
	case "linux":
		os_ = "Linux"
		labels = append(labels, "Type-Archive", "OpSys-Linux")
	case "freebsd":
		os_ = "FreeBSD"
		labels = append(labels, "Type-Archive", "OpSys-FreeBSD")
	case "darwin":
		os_ = "Mac OS X"
		labels = append(labels, "Type-Installer", "OpSys-OSX")
	case "windows":
		os_ = "Windows"
		labels = append(labels, "OpSys-Windows")
	}
	summary := fmt.Sprintf("%s %s (%s)", version, os_, arch)
	if b.OS == "windows" {
		switch {
		case strings.HasSuffix(filename, ".msi"):
			labels = append(labels, "Type-Installer")
			summary += " MSI installer"
		case strings.HasSuffix(filename, ".zip"):
			labels = append(labels, "Type-Archive")
			summary += " ZIP archive"
		}
	}
	if b.Source {
		labels = append(labels, "Type-Source")
		summary = fmt.Sprintf("%s (source only)", version)
	}
	if *addLabel != "" {
		labels = append(labels, *addLabel)
	}
	// Put "Go" prefix on summary when it doesn't already begin with "go".
	if !strings.HasPrefix(strings.ToLower(summary), "go") {
		summary = "Go " + summary
	}

	// Open file to upload.
	f, err := os.Open(filename)
	if err != nil {
		return err
	}
	defer f.Close()

	// Prepare multipart payload.
	body := new(bytes.Buffer)
	w := multipart.NewWriter(body)
	if err := w.WriteField("summary", summary); err != nil {
		return err
	}
	for _, l := range labels {
		if err := w.WriteField("label", l); err != nil {
			return err
		}
	}
	fw, err := w.CreateFormFile("filename", filename)
	if err != nil {
		return err
	}
	if _, err = io.Copy(fw, f); err != nil {
		return err
	}
	if err := w.Close(); err != nil {
		return err
	}

	// Send the file to Google Code.
	req, err := http.NewRequest("POST", uploadURL, body)
	if err != nil {
		return err
	}
	token := fmt.Sprintf("%s:%s", username, password)
	token = base64.StdEncoding.EncodeToString([]byte(token))
	req.Header.Set("Authorization", "Basic "+token)
	req.Header.Set("Content-type", w.FormDataContentType())

	resp, err := http.DefaultTransport.RoundTrip(req)
	if err != nil {
		return err
	}
	if resp.StatusCode/100 != 2 {
		fmt.Fprintln(os.Stderr, "upload failed")
		defer resp.Body.Close()
		io.Copy(os.Stderr, resp.Body)
		return fmt.Errorf("upload: %s", resp.Status)
	}
	return nil
}

func (b *Build) clean(files []string) error {
	for _, name := range files {
		err := os.RemoveAll(filepath.Join(b.root, name))
		if err != nil {
			return err
		}
	}
	return nil
}

func exists(path string) bool {
	_, err := os.Stat(path)
	return err == nil
}

func readCredentials() error {
	name := os.Getenv("HOME")
	if runtime.GOOS == "windows" {
		name = os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH")
	}
	name = filepath.Join(name, ".gobuildkey")
	f, err := os.Open(name)
	if err != nil {
		return err
	}
	defer f.Close()
	r := bufio.NewReader(f)
	for i := 0; i < 3; i++ {
		b, _, err := r.ReadLine()
		if err != nil {
			return err
		}
		b = bytes.TrimSpace(b)
		switch i {
		case 1:
			username = string(b)
		case 2:
			password = string(b)
		}
	}
	return nil
}

func cp(dst, src string) error {
	sf, err := os.Open(src)
	if err != nil {
		return err
	}
	defer sf.Close()
	df, err := os.Create(dst)
	if err != nil {
		return err
	}
	defer df.Close()
	_, err = io.Copy(df, sf)
	return err
}

func makeTar(targ, workdir string) error {
	f, err := os.Create(targ)
	if err != nil {
		return err
	}
	zout := gzip.NewWriter(f)
	tw := tar.NewWriter(zout)

	err = filepath.Walk(workdir, func(path string, fi os.FileInfo, err error) error {
		if !strings.HasPrefix(path, workdir) {
			log.Panicf("walked filename %q doesn't begin with workdir %q", path, workdir)
		}
		name := path[len(workdir):]

		// Chop of any leading / from filename, leftover from removing workdir.
		if strings.HasPrefix(name, "/") {
			name = name[1:]
		}
		// Don't include things outside of the go subdirectory (for instance,
		// the zip file that we're currently writing here.)
		if !strings.HasPrefix(name, "go/") {
			return nil
		}
		if *verbose {
			log.Printf("adding to tar: %s", name)
		}
		hdr, err := tarFileInfoHeader(fi, path)
		if err != nil {
			return err
		}
		hdr.Name = name
		hdr.Uname = "root"
		hdr.Gname = "root"
		hdr.Uid = 0
		hdr.Gid = 0

		// Force permissions to 0755 for executables, 0644 for everything else.
		if fi.Mode().Perm()&0111 != 0 {
			hdr.Mode = hdr.Mode&^0777 | 0755
		} else {
			hdr.Mode = hdr.Mode&^0777 | 0644
		}

		err = tw.WriteHeader(hdr)
		if err != nil {
			return fmt.Errorf("Error writing file %q: %v", name, err)
		}
		if fi.IsDir() {
			return nil
		}
		r, err := os.Open(path)
		if err != nil {
			return err
		}
		defer r.Close()
		_, err = io.Copy(tw, r)
		return err
	})
	if err != nil {
		return err
	}
	if err := tw.Close(); err != nil {
		return err
	}
	if err := zout.Close(); err != nil {
		return err
	}
	return f.Close()
}

func makeZip(targ, workdir string) error {
	f, err := os.Create(targ)
	if err != nil {
		return err
	}
	zw := zip.NewWriter(f)

	err = filepath.Walk(workdir, func(path string, fi os.FileInfo, err error) error {
		if !strings.HasPrefix(path, workdir) {
			log.Panicf("walked filename %q doesn't begin with workdir %q", path, workdir)
		}
		name := path[len(workdir):]

		// Convert to Unix-style named paths, as that's the
		// type of zip file that archive/zip creates.
		name = strings.Replace(name, "\\", "/", -1)
		// Chop of any leading / from filename, leftover from removing workdir.
		if strings.HasPrefix(name, "/") {
			name = name[1:]
		}
		// Don't include things outside of the go subdirectory (for instance,
		// the zip file that we're currently writing here.)
		if !strings.HasPrefix(name, "go/") {
			return nil
		}
		if *verbose {
			log.Printf("adding to zip: %s", name)
		}
		fh, err := zip.FileInfoHeader(fi)
		if err != nil {
			return err
		}
		fh.Name = name
		fh.Method = zip.Deflate
		if fi.IsDir() {
			fh.Name += "/"        // append trailing slash
			fh.Method = zip.Store // no need to deflate 0 byte files
		}
		w, err := zw.CreateHeader(fh)
		if err != nil {
			return err
		}
		if fi.IsDir() {
			return nil
		}
		r, err := os.Open(path)
		if err != nil {
			return err
		}
		defer r.Close()
		_, err = io.Copy(w, r)
		return err
	})
	if err != nil {
		return err
	}
	if err := zw.Close(); err != nil {
		return err
	}
	return f.Close()
}

type tool struct {
	name       string
	commonDirs []string
}

var wixTool = tool{
	"http://wix.sourceforge.net/, version 3.5",
	[]string{`C:\Program Files\Windows Installer XML v3.5\bin`,
		`C:\Program Files (x86)\Windows Installer XML v3.5\bin`},
}

var hgTool = tool{
	"http://mercurial.selenic.com/wiki/WindowsInstall",
	[]string{`C:\Program Files\Mercurial`,
		`C:\Program Files (x86)\Mercurial`,
	},
}

var gccTool = tool{
	"Mingw gcc; http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/",
	[]string{`C:\Mingw\bin`},
}

var windowsDeps = map[string]tool{
	"gcc":    gccTool,
	"heat":   wixTool,
	"candle": wixTool,
	"light":  wixTool,
	"cmd":    {"Windows cmd.exe", nil},
	"hg":     hgTool,
}

func checkWindowsDeps() {
	for prog, help := range windowsDeps {
		absPath, err := lookPath(prog)
		if err != nil {
			log.Fatalf("Failed to find necessary binary %q in path or common locations; %s", prog, help)
		}
		if *verbose {
			log.Printf("found windows dep %s at %s", prog, absPath)
		}
	}
}

func lookPath(prog string) (absPath string, err error) {
	absPath, err = exec.LookPath(prog)
	if err == nil {
		return
	}
	t, ok := windowsDeps[prog]
	if !ok {
		return
	}
	for _, dir := range t.commonDirs {
		for _, ext := range []string{"exe", "bat"} {
			absPath = filepath.Join(dir, prog+"."+ext)
			if _, err1 := os.Stat(absPath); err1 == nil {
				err = nil
				os.Setenv("PATH", os.Getenv("PATH")+";"+dir)
				return
			}
		}
	}
	return
}

// sysStat, if non-nil, populates h from system-dependent fields of fi.
var sysStat func(fi os.FileInfo, h *tar.Header) error

// Mode constants from the tar spec.
const (
	c_ISDIR  = 040000
	c_ISFIFO = 010000
	c_ISREG  = 0100000
	c_ISLNK  = 0120000
	c_ISBLK  = 060000
	c_ISCHR  = 020000
	c_ISSOCK = 0140000
)

// tarFileInfoHeader creates a partially-populated Header from an os.FileInfo.
// The filename parameter is used only in the case of symlinks, to call os.Readlink.
// If fi is a symlink but filename is empty, an error is returned.
func tarFileInfoHeader(fi os.FileInfo, filename string) (*tar.Header, error) {
	h := &tar.Header{
		Name:    fi.Name(),
		ModTime: fi.ModTime(),
		Mode:    int64(fi.Mode().Perm()), // or'd with c_IS* constants later
	}
	switch {
	case fi.Mode()&os.ModeType == 0:
		h.Mode |= c_ISREG
		h.Typeflag = tar.TypeReg
		h.Size = fi.Size()
	case fi.IsDir():
		h.Typeflag = tar.TypeDir
		h.Mode |= c_ISDIR
	case fi.Mode()&os.ModeSymlink != 0:
		h.Typeflag = tar.TypeSymlink
		h.Mode |= c_ISLNK
		if filename == "" {
			return h, fmt.Errorf("archive/tar: unable to populate Header.Linkname of symlinks")
		}
		targ, err := os.Readlink(filename)
		if err != nil {
			return h, err
		}
		h.Linkname = targ
	case fi.Mode()&os.ModeDevice != 0:
		if fi.Mode()&os.ModeCharDevice != 0 {
			h.Mode |= c_ISCHR
			h.Typeflag = tar.TypeChar
		} else {
			h.Mode |= c_ISBLK
			h.Typeflag = tar.TypeBlock
		}
	case fi.Mode()&os.ModeSocket != 0:
		h.Mode |= c_ISSOCK
	default:
		return nil, fmt.Errorf("archive/tar: unknown file mode %v", fi.Mode())
	}
	if sysStat != nil {
		return h, sysStat(fi, h)
	}
	return h, nil
}


text:
struct UIMouse;

struct UIObject
{
	virtual ~UIObject() {}

	virtual void Size(int w, int h)
	{
		this->area.w = w;
		this->area.h = h;
	}

	virtual void Move(int x, int y)
	{
		this->area.x = x;
		this->area.y = y;
	}

	// Undefined
	virtual void OnDraw(FWSDK::IRenderer* renderer) {}
	virtual bool OnInput(FWSDK::UIMouse* mouse, FWSDK::UIKeyboard* keyboard) { return false; }

	FWSDK::UIObject*	parent;
	FWSDK::ColorScheme	scheme;
	FWSDK::Area2D		area;
};


text:
package org.apache.hadoop.hive.ql.io.arrow;

import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.arrow.vector.VarCharVector;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.common.type.HiveChar;
import org.apache.hadoop.hive.common.type.HiveDecimal;
import org.apache.hadoop.hive.common.type.HiveIntervalDayTime;
import org.apache.hadoop.hive.common.type.HiveIntervalYearMonth;
import org.apache.hadoop.hive.common.type.HiveVarchar;
import org.apache.hadoop.hive.common.type.Timestamp;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.serde.serdeConstants;
import org.apache.hadoop.hive.serde2.AbstractSerDe;
import org.apache.hadoop.hive.serde2.SerDeException;
import org.apache.hadoop.hive.serde2.SerDeUtils;
import org.apache.hadoop.hive.serde2.io.ByteWritable;
import org.apache.hadoop.hive.serde2.io.DateWritableV2;
import org.apache.hadoop.hive.serde2.io.DoubleWritable;
import org.apache.hadoop.hive.serde2.io.HiveCharWritable;
import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
import org.apache.hadoop.hive.serde2.io.HiveIntervalDayTimeWritable;
import org.apache.hadoop.hive.serde2.io.HiveIntervalYearMonthWritable;
import org.apache.hadoop.hive.serde2.io.HiveVarcharWritable;
import org.apache.hadoop.hive.serde2.io.ShortWritable;
import org.apache.hadoop.hive.serde2.io.TimestampWritableV2;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.StructField;
import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;
import org.apache.hadoop.io.BooleanWritable;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.FloatWritable;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.junit.Before;
import org.junit.Test;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.TimeUnit;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

public class TestArrowColumnarBatchSerDe {
  private Configuration conf;

  private final static Object[][] INTEGER_ROWS = {
      {byteW(0), shortW(0), intW(0), longW(0)},
      {byteW(1), shortW(1), intW(1), longW(1)},
      {byteW(-1), shortW(-1), intW(-1), longW(-1)},
      {byteW(Byte.MIN_VALUE), shortW(Short.MIN_VALUE), intW(Integer.MIN_VALUE),
          longW(Long.MIN_VALUE)},
      {byteW(Byte.MAX_VALUE), shortW(Short.MAX_VALUE), intW(Integer.MAX_VALUE),
          longW(Long.MAX_VALUE)},
      {null, null, null, null},
  };

  private final static Object[][] FLOAT_ROWS = {
      {floatW(0f), doubleW(0d)},
      {floatW(1f), doubleW(1d)},
      {floatW(-1f), doubleW(-1d)},
      {floatW(Float.MIN_VALUE), doubleW(Double.MIN_VALUE)},
      {floatW(-Float.MIN_VALUE), doubleW(-Double.MIN_VALUE)},
      {floatW(Float.MAX_VALUE), doubleW(Double.MAX_VALUE)},
      {floatW(-Float.MAX_VALUE), doubleW(-Double.MAX_VALUE)},
      {floatW(Float.POSITIVE_INFINITY), doubleW(Double.POSITIVE_INFINITY)},
      {floatW(Float.NEGATIVE_INFINITY), doubleW(Double.NEGATIVE_INFINITY)},
      {null, null},
  };

  private final static Object[][] STRING_ROWS = {
      {text(""), charW("", 10), varcharW("", 10)},
      {text("Hello"), charW("Hello", 10), varcharW("Hello", 10)},
      {text("world!"), charW("world!", 10), varcharW("world!", 10)},
      {text("안녕?"), charW("안녕?", 10), varcharW("안녕?", 10)},
      {null, null, null},
  };

  private final static long TIME_IN_MILLIS = TimeUnit.DAYS.toMillis(365 + 31 + 3);
  private final static long NEGATIVE_TIME_IN_MILLIS = TimeUnit.DAYS.toMillis(-9 * 365 + 31 + 3);
  private final static Timestamp TIMESTAMP;
  private final static Timestamp NEGATIVE_TIMESTAMP_WITHOUT_NANOS;

  static {
    TIMESTAMP = Timestamp.ofEpochMilli(TIME_IN_MILLIS);
    NEGATIVE_TIMESTAMP_WITHOUT_NANOS = Timestamp.ofEpochMilli(NEGATIVE_TIME_IN_MILLIS);
  }

  private final static Object[][] DTI_ROWS = {
      {
          new DateWritableV2(DateWritableV2.millisToDays(TIME_IN_MILLIS)),
          new TimestampWritableV2(TIMESTAMP),
          new HiveIntervalYearMonthWritable(new HiveIntervalYearMonth(1, 2)),
          new HiveIntervalDayTimeWritable(new HiveIntervalDayTime(1, 2, 3, 4, 5_000_000))
      },
      {
          new DateWritableV2(DateWritableV2.millisToDays(NEGATIVE_TIME_IN_MILLIS)),
          new TimestampWritableV2(NEGATIVE_TIMESTAMP_WITHOUT_NANOS),
          null,
          null
      },
      {null, null, null, null},
  };

  private final static Object[][] DECIMAL_ROWS = {
      {decimalW(HiveDecimal.ZERO)},
      {decimalW(HiveDecimal.ONE)},
      {decimalW(HiveDecimal.ONE.negate())},
      {decimalW(HiveDecimal.create("0.000001"))},
      {decimalW(HiveDecimal.create("100000"))},
      {null},
  };

  private final static Object[][] BOOLEAN_ROWS = {
      {new BooleanWritable(true)},
      {new BooleanWritable(false)},
      {null},
  };

  private final static Object[][] BINARY_ROWS = {
      {new BytesWritable("".getBytes())},
      {new BytesWritable("Hello".getBytes())},
      {new BytesWritable("world!".getBytes())},
      {null},
  };

  @Before
  public void setUp() {
    conf = new Configuration();
  }

  private static ByteWritable byteW(int value) {
    return new ByteWritable((byte) value);
  }

  private static ShortWritable shortW(int value) {
    return new ShortWritable((short) value);
  }

  private static IntWritable intW(int value) {
    return new IntWritable(value);
  }

  private static LongWritable longW(long value) {
    return new LongWritable(value);
  }

  private static FloatWritable floatW(float value) {
    return new FloatWritable(value);
  }

  private static DoubleWritable doubleW(double value) {
    return new DoubleWritable(value);
  }

  private static Text text(String value) {
    return new Text(value);
  }

  private static HiveCharWritable charW(String value, int length) {
    return new HiveCharWritable(new HiveChar(value, length));
  }

  private static HiveVarcharWritable varcharW(String value, int length) {
    return new HiveVarcharWritable(new HiveVarchar(value, length));
  }

  private static HiveDecimalWritable decimalW(HiveDecimal value) {
    return new HiveDecimalWritable(value);
  }

  private void initAndSerializeAndDeserialize(String[][] schema, Object[][] rows) throws SerDeException {
    ArrowColumnarBatchSerDe serDe = new ArrowColumnarBatchSerDe();
    StructObjectInspector rowOI = initSerDe(serDe, schema);
    serializeAndDeserialize(serDe, rows, rowOI);
  }

  private StructObjectInspector initSerDe(AbstractSerDe serDe, String[][] schema)
      throws SerDeException {
    List<String> fieldNameList = newArrayList();
    List<String> fieldTypeList = newArrayList();
    List<TypeInfo> typeInfoList = newArrayList();

    for (String[] nameAndType : schema) {
      String name = nameAndType[0];
      String type = nameAndType[1];
      fieldNameList.add(name);
      fieldTypeList.add(type);
      typeInfoList.add(TypeInfoUtils.getTypeInfoFromTypeString(type));
    }

    String fieldNames = Joiner.on(',').join(fieldNameList);
    String fieldTypes = Joiner.on(',').join(fieldTypeList);

    Properties schemaProperties = new Properties();
    schemaProperties.setProperty(serdeConstants.LIST_COLUMNS, fieldNames);
    schemaProperties.setProperty(serdeConstants.LIST_COLUMN_TYPES, fieldTypes);
    SerDeUtils.initializeSerDe(serDe, conf, schemaProperties, null);
    return (StructObjectInspector) TypeInfoUtils.getStandardWritableObjectInspectorFromTypeInfo(
        TypeInfoFactory.getStructTypeInfo(fieldNameList, typeInfoList));
  }

  private void serializeAndDeserialize(ArrowColumnarBatchSerDe serDe, Object[][] rows,
      StructObjectInspector rowOI) {
    ArrowWrapperWritable serialized = null;
    for (Object[] row : rows) {
      serialized = serDe.serialize(row, rowOI);
    }
    // Pass null to complete a batch
    if (serialized == null) {
      serialized = serDe.serialize(null, rowOI);
    }
    final Object[][] deserializedRows = (Object[][]) serDe.deserialize(serialized);

    for (int rowIndex = 0; rowIndex < Math.min(deserializedRows.length, rows.length); rowIndex++) {
      final Object[] row = rows[rowIndex];
      final Object[] deserializedRow = deserializedRows[rowIndex];
      assertEquals(row.length, deserializedRow.length);

      final List<? extends StructField> fields = rowOI.getAllStructFieldRefs();
      for (int fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++) {
        final StructField field = fields.get(fieldIndex);
        final ObjectInspector fieldObjInspector = field.getFieldObjectInspector();
        switch (fieldObjInspector.getCategory()) {
          case PRIMITIVE:
            final PrimitiveObjectInspector primitiveObjInspector =
                (PrimitiveObjectInspector) fieldObjInspector;
            switch (primitiveObjInspector.getPrimitiveCategory()) {
              case STRING:
              case VARCHAR:
              case CHAR:
                assertEquals(Objects.toString(row[fieldIndex]),
                    Objects.toString(deserializedRow[fieldIndex]));
                break;
              default:
                assertEquals(row[fieldIndex], deserializedRow[fieldIndex]);
                break;
            }
            break;
          case STRUCT:
            final Object[] rowStruct = (Object[]) row[fieldIndex];
            final List deserializedRowStruct = (List) deserializedRow[fieldIndex];
            if (rowStruct == null) {
              assertNull(deserializedRowStruct);
            } else {
              assertArrayEquals(rowStruct, deserializedRowStruct.toArray());
            }
            break;
          case LIST:
          case UNION:
            assertEquals(row[fieldIndex], deserializedRow[fieldIndex]);
            break;
          case MAP:
            final Map rowMap = (Map) row[fieldIndex];
            final Map deserializedRowMap = (Map) deserializedRow[fieldIndex];
            if (rowMap == null) {
              assertNull(deserializedRowMap);
            } else {
              final Set rowMapKeySet = rowMap.keySet();
              final Set deserializedRowMapKeySet = deserializedRowMap.keySet();
              assertEquals(rowMapKeySet, deserializedRowMapKeySet);
              for (Object key : rowMapKeySet) {
                assertEquals(rowMap.get(key), deserializedRowMap.get(key));
              }
            }
            break;
        }
      }
    }
  }

  @Test
  public void testComprehensive() throws SerDeException {
    String[][] schema = {
        {"datatypes.c1", "int"},
        {"datatypes.c2", "boolean"},
        {"datatypes.c3", "double"},
        {"datatypes.c4", "string"},
        {"datatypes.c5", "array<int>"},
        {"datatypes.c6", "map<int,string>"},
        {"datatypes.c7", "map<string,string>"},
        {"datatypes.c8", "struct<r:string,s:int,t:double>"},
        {"datatypes.c9", "tinyint"},
        {"datatypes.c10", "smallint"},
        {"datatypes.c11", "float"},
        {"datatypes.c12", "bigint"},
        {"datatypes.c13", "array<array<string>>"},
        {"datatypes.c14", "map<int,map<int,int>>"},
        {"datatypes.c15", "struct<r:int,s:struct<a:int,b:string>>"},
        {"datatypes.c16", "array<struct<m:map<string,string>,n:int>>"},
        {"datatypes.c17", "timestamp"},
        {"datatypes.c18", "decimal(16,7)"},
        {"datatypes.c19", "binary"},
        {"datatypes.c20", "date"},
        {"datatypes.c21", "varchar(20)"},
        {"datatypes.c22", "char(15)"},
        {"datatypes.c23", "binary"},
    };

    Object[][] comprehensiveRows = {
        {
          intW(0), // c1:int
            new BooleanWritable(false), // c2:boolean
            doubleW(0), // c3:double
            text("Hello"), // c4:string
            newArrayList(intW(0), intW(1), intW(2)), // c5:array<int>
            Maps.toMap(
                newArrayList(intW(0), intW(1), intW(2)),
                input -> text("Number " + input)), // c6:map<int,string>
            Maps.toMap(
                newArrayList(text("apple"), text("banana"), text("carrot")),
                input -> text(input.toString().toUpperCase())), // c7:map<string,string>
            new Object[] {text("0"), intW(1), doubleW(2)}, // c8:struct<r:string,s:int,t:double>
            byteW(0), // c9:tinyint
            shortW(0), // c10:smallint
            floatW(0), // c11:float
            longW(0), // c12:bigint
            newArrayList(
                newArrayList(text("a"), text("b"), text("c")),
                newArrayList(text("A"), text("B"), text("C"))), // c13:array<array<string>>
            Maps.toMap(
                newArrayList(intW(0), intW(1), intW(2)),
                x -> Maps.toMap(
                    newArrayList(x, intW(x.get() * 2)),
                    y -> y)), // c14:map<int,map<int,int>>
            new Object[] {
                intW(0),
                newArrayList(
                    intW(1),
                    text("Hello"))}, // c15:struct<r:int,s:struct<a:int,b:string>>
            Collections.singletonList(
                newArrayList(
                    Maps.toMap(
                        newArrayList(text("hello")),
                        input -> text(input.toString().toUpperCase())),
                    intW(0))), // c16:array<struct<m:map<string,string>,n:int>>
            new TimestampWritableV2(TIMESTAMP), // c17:timestamp
            decimalW(HiveDecimal.create(0, 0)), // c18:decimal(16,7)
            new BytesWritable("Hello".getBytes()), // c19:binary
            new DateWritableV2(123), // c20:date
            varcharW("x", 20), // c21:varchar(20)
            charW("y", 15), // c22:char(15)
            new BytesWritable("world!".getBytes()), // c23:binary
        }, {
            null, null, null, null, null, null, null, null, null, null, // c1-c10
            null, null, null, null, null, null, null, null, null, null, // c11-c20
            null, null, null, // c21-c23
        }
    };

    initAndSerializeAndDeserialize(schema, comprehensiveRows);
  }

  private <E> List<E> newArrayList(E ... elements) {
    return Lists.newArrayList(elements);
  }

  @Test
  public void testPrimitiveInteger() throws SerDeException {
    String[][] schema = {
        {"tinyint1", "tinyint"},
        {"smallint1", "smallint"},
        {"int1", "int"},
        {"bigint1", "bigint"}
    };

    initAndSerializeAndDeserialize(schema, INTEGER_ROWS);
  }

  @Test
  public void testPrimitiveBigInt10000() throws SerDeException {
    String[][] schema = {
        {"bigint1", "bigint"}
    };

    final int batchSize = 1000;
    final Object[][] integerRows = new Object[batchSize][];
    final ArrowColumnarBatchSerDe serDe = new ArrowColumnarBatchSerDe();
    StructObjectInspector rowOI = initSerDe(serDe, schema);

    for (int j = 0; j < 10; j++) {
      for (int i = 0; i < batchSize; i++) {
        integerRows[i] = new Object[] {longW(i + j * batchSize)};
      }

      serializeAndDeserialize(serDe, integerRows, rowOI);
    }
  }

  @Test
  public void testPrimitiveBigIntRandom() {
    try {
      String[][] schema = {
          {"bigint1", "bigint"}
      };

      final ArrowColumnarBatchSerDe serDe = new ArrowColumnarBatchSerDe();
      StructObjectInspector rowOI = initSerDe(serDe, schema);

      final Random random = new Random();
      for (int j = 0; j < 1000; j++) {
        final int batchSize = random.nextInt(1000);
        final Object[][] integerRows = new Object[batchSize][];
        for (int i = 0; i < batchSize; i++) {
          integerRows[i] = new Object[] {longW(random.nextLong())};
        }

        serializeAndDeserialize(serDe, integerRows, rowOI);
      }
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }

  @Test
  public void testPrimitiveFloat() throws SerDeException {
    String[][] schema = {
        {"float1", "float"},
        {"double1", "double"},
    };

    initAndSerializeAndDeserialize(schema, FLOAT_ROWS);
  }

  @Test(expected = AssertionError.class)
  public void testPrimitiveFloatNaN() throws SerDeException {
    String[][] schema = {
        {"float1", "float"},
    };

    Object[][] rows = {{new FloatWritable(Float.NaN)}};

    initAndSerializeAndDeserialize(schema, rows);
  }

  @Test(expected = AssertionError.class)
  public void testPrimitiveDoubleNaN() throws SerDeException {
    String[][] schema = {
        {"double1", "double"},
    };

    Object[][] rows = {{new DoubleWritable(Double.NaN)}};

    initAndSerializeAndDeserialize(schema, rows);
  }

  @Test
  public void testPrimitiveString() throws SerDeException {
    String[][] schema = {
        {"string1", "string"},
        {"char1", "char(10)"},
        {"varchar1", "varchar(10)"},
    };

    initAndSerializeAndDeserialize(schema, STRING_ROWS);
  }

  @Test
  public void testPrimitiveDTI() throws SerDeException {
    String[][] schema = {
        {"date1", "date"},
        {"timestamp1", "timestamp"},
        {"interval_year_month1", "interval_year_month"},
        {"interval_day_time1", "interval_day_time"},
    };

    initAndSerializeAndDeserialize(schema, DTI_ROWS);
  }

  @Test
  public void testPrimitiveRandomTimestamp() throws SerDeException {
    String[][] schema = {
        {"timestamp1", "timestamp"},
    };

    int size = HiveConf.getIntVar(conf, HiveConf.ConfVars.HIVE_ARROW_BATCH_SIZE);
    Random rand = new Random(294722773L);
    Object[][] rows = new Object[size][];
    for (int i = 0; i < size; i++) {
      long millis = ((long) rand.nextInt(Integer.MAX_VALUE)) * 1000;
      Timestamp timestamp = Timestamp.ofEpochMilli(rand.nextBoolean() ? millis : -millis);
      timestamp.setNanos(rand.nextInt(1000) * 1000);
      rows[i] = new Object[] {new TimestampWritableV2(timestamp)};
    }

    initAndSerializeAndDeserialize(schema, rows);
  }

  @Test
  public void testTimestampNanosPrecisionUpTo6Digits() throws SerDeException {
    String[][] schema = {
        {"timestamp1", "timestamp"},
    };
    //Nanos precise upto 6 digits
    Object[][] tsRows = new Object[][]{
        {new TimestampWritableV2(Timestamp.valueOf("1800-04-01 09:01:10.123999"))},
        {new TimestampWritableV2(Timestamp.valueOf("2050-04-01 09:01:10.999999"))},
        null
    };
    initAndSerializeAndDeserialize(schema, tsRows);
  }

  @Test
  public void testPositiveNegativeTSWithNanos() throws SerDeException {
    String[][] schema = {
        {"timestamp1", "timestamp"},
    };

    Object[][] tsRows = new Object[][]{
        {new TimestampWritableV2(Timestamp.valueOf("1963-04-01 09:01:10.123"))},
        {new TimestampWritableV2(Timestamp.valueOf("1800-04-01 09:01:10.123999"))},
        {new TimestampWritableV2(Timestamp.valueOf("1750-04-01 09:01:10.123999"))},
        {new TimestampWritableV2(Timestamp.valueOf("1700-04-01 09:01:10.999999"))},
        {new TimestampWritableV2(Timestamp.valueOf("2050-04-01 09:01:10.999999"))},
        {new TimestampWritableV2(Timestamp.valueOf("1991-06-05 09:01:10.999999"))},
        {new TimestampWritableV2(Timestamp.valueOf("1992-11-04 09:01:10.999999"))},
        {new TimestampWritableV2(Timestamp.valueOf("1970-01-01 00:00:00"))},
        {new TimestampWritableV2(Timestamp.valueOf("1964-01-01 00:00:04.78"))},
        {new TimestampWritableV2(Timestamp.valueOf("1950-01-01 09:23:03.21"))},
        {new TimestampWritableV2(Timestamp.valueOf("1956-01-01 10:09:03.00"))},
        {new TimestampWritableV2(Timestamp.valueOf("1947-08-27 10:25:36.26"))},
        null
    };
    initAndSerializeAndDeserialize(schema, tsRows);
  }

  @Test
  public void testPrimitiveDecimal() throws SerDeException {
    String[][] schema = {
        {"decimal1", "decimal(38,10)"},
    };

    initAndSerializeAndDeserialize(schema, DECIMAL_ROWS);
  }

  @Test
  public void testRandomPrimitiveDecimal() throws SerDeException {
    String[][] schema = {
        {"decimal1", "decimal(38,10)"},
    };

    int size = 1000;
    Object[][] randomDecimals = new Object[size][];
    Random random = new Random();
    for (int i = 0; i < size; i++) {
      StringBuilder builder = new StringBuilder();
      builder.append(random.nextBoolean() ? '+' : '-');
      for (int j = 0; j < 28 ; j++) {
        builder.append(random.nextInt(10));
      }
      builder.append('.');
      for (int j = 0; j < 10; j++) {
        builder.append(random.nextInt(10));
      }
      randomDecimals[i] = new Object[] {decimalW(HiveDecimal.create(builder.toString()))};
    }

    initAndSerializeAndDeserialize(schema, randomDecimals);
  }

  @Test
  public void testPrimitiveBoolean() throws SerDeException {
    String[][] schema = {
        {"boolean1", "boolean"},
    };

    initAndSerializeAndDeserialize(schema, BOOLEAN_ROWS);
  }

  @Test
  public void testPrimitiveBinary() throws SerDeException {
    String[][] schema = {
        {"binary1", "binary"},
    };

    initAndSerializeAndDeserialize(schema, BINARY_ROWS);
  }

  private List[][] toList(Object[][] rows) {
    List[][] array = new List[rows.length][];
    for (int rowIndex = 0; rowIndex < rows.length; rowIndex++) {
      Object[] row = rows[rowIndex];
      array[rowIndex] = new List[row.length];
      for (int fieldIndex = 0; fieldIndex < row.length; fieldIndex++) {
        array[rowIndex][fieldIndex] = newArrayList(row[fieldIndex]);
      }
    }
    return array;
  }

  @Test
  public void testListInteger() throws SerDeException {
    String[][] schema = {
        {"tinyint_list", "array<tinyint>"},
        {"smallint_list", "array<smallint>"},
        {"int_list", "array<int>"},
        {"bigint_list", "array<bigint>"},
    };

    initAndSerializeAndDeserialize(schema, toList(INTEGER_ROWS));
  }

  @Test
  public void testListFloat() throws SerDeException {
    String[][] schema = {
        {"float_list", "array<float>"},
        {"double_list", "array<double>"},
    };

    initAndSerializeAndDeserialize(schema, toList(FLOAT_ROWS));
  }

  @Test
  public void testListString() throws SerDeException {
    String[][] schema = {
        {"string_list", "array<string>"},
        {"char_list", "array<char(10)>"},
        {"varchar_list", "array<varchar(10)>"},
    };

    initAndSerializeAndDeserialize(schema, toList(STRING_ROWS));
  }

  @Test
  public void testListDTI() throws SerDeException {
    String[][] schema = {
        {"date_list", "array<date>"},
        {"timestamp_list", "array<timestamp>"},
        {"interval_year_month_list", "array<interval_year_month>"},
        {"interval_day_time_list", "array<interval_day_time>"},
    };

    initAndSerializeAndDeserialize(schema, toList(DTI_ROWS));
  }

  @Test
  public void testListBoolean() throws SerDeException {
    String[][] schema = {
        {"boolean_list", "array<boolean>"},
    };

    initAndSerializeAndDeserialize(schema, toList(BOOLEAN_ROWS));
  }

  @Test
  public void testListBinary() throws SerDeException {
    String[][] schema = {
        {"binary_list", "array<binary>"},
    };

    initAndSerializeAndDeserialize(schema, toList(BINARY_ROWS));
  }

  private Object[][][] toStruct(Object[][] rows) {
    Object[][][] struct = new Object[rows.length][][];
    for (int rowIndex = 0; rowIndex < rows.length; rowIndex++) {
      Object[] row = rows[rowIndex];
      struct[rowIndex] = new Object[][] {row};
    }
    return struct;
  }

  @Test
  public void testStructInteger() throws SerDeException {
    String[][] schema = {
        {"int_struct", "struct<tinyint1:tinyint,smallint1:smallint,int1:int,bigint1:bigint>"},
    };

    initAndSerializeAndDeserialize(schema, toStruct(INTEGER_ROWS));
  }

  @Test
  public void testStructFloat() throws SerDeException {
    String[][] schema = {
        {"float_struct", "struct<float1:float,double1:double>"},
    };

    initAndSerializeAndDeserialize(schema, toStruct(FLOAT_ROWS));
  }

  @Test
  public void testStructString() throws SerDeException {
    String[][] schema = {
        {"string_struct", "struct<string1:string,char1:char(10),varchar1:varchar(10)>"},
    };

    initAndSerializeAndDeserialize(schema, toStruct(STRING_ROWS));
  }

  @Test
  public void testStructDTI() throws SerDeException {
    String[][] schema = {
        {"date_struct", "struct<date1:date,timestamp1:timestamp," +
            "interval_year_month1:interval_year_month,interval_day_time1:interval_day_time>"},
    };

    initAndSerializeAndDeserialize(schema, toStruct(DTI_ROWS));
  }

  @Test
  public void testStructDecimal() throws SerDeException {
    String[][] schema = {
        {"decimal_struct", "struct<decimal1:decimal(38,10)>"},
    };

    initAndSerializeAndDeserialize(schema, toStruct(DECIMAL_ROWS));
  }

  @Test
  public void testStructBoolean() throws SerDeException {
    String[][] schema = {
        {"boolean_struct", "struct<boolean1:boolean>"},
    };

    initAndSerializeAndDeserialize(schema, toStruct(BOOLEAN_ROWS));
  }

  @Test
  public void testStructBinary() throws SerDeException {
    String[][] schema = {
        {"binary_struct", "struct<binary1:binary>"},
    };

    initAndSerializeAndDeserialize(schema, toStruct(BINARY_ROWS));
  }

  private Object[][] toMap(Object[][] rows) {
    Map[][] array = new Map[rows.length][];
    for (int rowIndex = 0; rowIndex < rows.length; rowIndex++) {
      Object[] row = rows[rowIndex];
      array[rowIndex] = new Map[row.length];
      for (int fieldIndex = 0; fieldIndex < row.length; fieldIndex++) {
        Map map = Maps.newHashMap();
        map.put(new Text(String.valueOf(row[fieldIndex])), row[fieldIndex]);
        array[rowIndex][fieldIndex] = map;
      }
    }
    return array;
  }

  @Test
  public void testMapInteger() throws SerDeException {
    String[][] schema = {
        {"tinyint_map", "map<string,tinyint>"},
        {"smallint_map", "map<string,smallint>"},
        {"int_map", "map<string,int>"},
        {"bigint_map", "map<string,bigint>"},
    };

    initAndSerializeAndDeserialize(schema, toMap(INTEGER_ROWS));
  }

  @Test
  public void testMapFloat() throws SerDeException {
    String[][] schema = {
        {"float_map", "map<string,float>"},
        {"double_map", "map<string,double>"},
    };

    initAndSerializeAndDeserialize(schema, toMap(FLOAT_ROWS));
  }

  @Test
  public void testMapString() throws SerDeException {
    String[][] schema = {
        {"string_map", "map<string,string>"},
        {"char_map", "map<string,char(10)>"},
        {"varchar_map", "map<string,varchar(10)>"},
    };

    initAndSerializeAndDeserialize(schema, toMap(STRING_ROWS));
  }

  @Test
  public void testMapDTI() throws SerDeException {
    String[][] schema = {
        {"date_map", "map<string,date>"},
        {"timestamp_map", "map<string,timestamp>"},
        {"interval_year_month_map", "map<string,interval_year_month>"},
        {"interval_day_time_map", "map<string,interval_day_time>"},
    };

    initAndSerializeAndDeserialize(schema, toMap(DTI_ROWS));
  }

  @Test
  public void testMapBoolean() throws SerDeException {
    String[][] schema = {
        {"boolean_map", "map<string,boolean>"},
    };

    initAndSerializeAndDeserialize(schema, toMap(BOOLEAN_ROWS));
  }

  @Test
  public void testMapBinary() throws SerDeException {
    String[][] schema = {
        {"binary_map", "map<string,binary>"},
    };

    initAndSerializeAndDeserialize(schema, toMap(BINARY_ROWS));
  }

  @Test
  public void testPrimitiveCharPadding() throws SerDeException {
    String[][] schema = {
        {"char1", "char(10)"},
    };

    HiveCharWritable[][] rows = new HiveCharWritable[][] {
        {charW("Hello", 10)}, {charW("world!", 10)}};
    ArrowColumnarBatchSerDe serDe = new ArrowColumnarBatchSerDe();
    StructObjectInspector rowOI = initSerDe(serDe, schema);

    ArrowWrapperWritable serialized = null;
    for (Object[] row : rows) {
      serialized = serDe.serialize(row, rowOI);
    }
    // Pass null to complete a batch
    if (serialized == null) {
      serialized = serDe.serialize(null, rowOI);
    }

    VarCharVector varCharVector = (VarCharVector) serialized.getVectorSchemaRoot().getFieldVectors().get(0);
    for (int i = 0; i < rows.length; i++) {
      assertEquals(rows[i][0].getPaddedValue().toString(), new String(varCharVector.get(i)));
    }
  }

  @Test
  public void testMapDecimal() throws SerDeException {
    String[][] schema = {
        {"decimal_map", "map<string,decimal(38,10)>"},
    };

    initAndSerializeAndDeserialize(schema, toMap(DECIMAL_ROWS));
  }

  @Test
  public void testListDecimal() throws SerDeException {
    String[][] schema = {
        {"decimal_list", "array<decimal(38,10)>"},
    };

    initAndSerializeAndDeserialize(schema, toList(DECIMAL_ROWS));
  }

}


text:
/*jslint browser: true */
/*global jQuery: true */
(function ($) {
    "use strict";

    var list = $('.search-list'),
        form = $('form#search-form'),
        showResults,
        doSearch,
        searching = false,
        searchQueued = false,
        previousQuery = form.serialize(),
        firstQuery = true;

    showResults = function (page) {
        var newList = $(page);

        list.html(newList.html());
        list.parent().removeClass('hidden');
        list.find('ul.packages li:first').addClass('selected');
        $('.order-by-group').attr('href', function (index, current) {
            return current.replace(/q=.*?&/, 'q=' + encodeURIComponent($('input[type="search"]', form).val()) + '&')
        });
        $('#order-bys-wrapper').removeClass('hidden');

        searching = false;

        if (searchQueued) {
            doSearch();
            searchQueued = false;
        }
    };

    doSearch = function () {
        var currentQuery,
            q,
            pathname,
            urlPrefix,
            url,
            title;

        if (searching) {
            searchQueued = true;
            return;
        }

        if ($('#search_query_query').val().match(/^\s*$/) !== null) {
            if (!firstQuery) {
                list.parent().addClass('hidden');
                $('#order-bys-wrapper').addClass('hidden');
            }
            return;
        }

        currentQuery = form.serialize();

        if (previousQuery === currentQuery) {
            return;
        }

        $('.order-by-group .active').removeClass('active');

        if (window.history.pushState) {
            q = encodeURIComponent($('input[type="search"]', form).val());

            pathname = window.location.pathname;

            if (pathname.indexOf('/app_dev.php') === 0) {
                urlPrefix = '/app_dev.php';
            } else if (pathname.indexOf('/app.php') === 0) {
                urlPrefix = '/app.php';
            } else {
                urlPrefix = '';
            }

            url = urlPrefix + '/search/?q=' + q;
            title = 'Search';

            if (firstQuery) {
                window.history.pushState(null, title, url);
                firstQuery = false;
            } else {
                window.history.replaceState(null, title, url);
            }
        }

        $.ajax({
            url: form.attr('action'),
            data: currentQuery,
            success: showResults
        });

        searching = true;
        previousQuery = currentQuery;
    };

    form.bind('keyup search', doSearch);

    form.bind('keydown', function (event) {
        var keymap,
            currentSelected,
            nextSelected;

        keymap = {
            enter: 13,
            left: 37,
            up: 38,
            right: 39,
            down: 40
        };

        if (keymap.up !== event.which && keymap.down !== event.which && keymap.enter !== event.which) {
            return;
        }

        if ($('#search_query_query').val().match(/^\s*$/) !== null) {
            document.activeElement.blur();
            return;
        }

        event.preventDefault();

        currentSelected = list.find('ul.packages li.selected');
        nextSelected = (keymap.down === event.which) ? currentSelected.next('li') : currentSelected.prev('li');

        if (currentSelected.length === 0 && keymap.down === event.which) {
            currentSelected = list.find('ul.packages li:first').addClass('selected');
        }

        if (keymap.enter === event.which && currentSelected.data('url')) {
            window.location = currentSelected.data('url');
            return;
        }

        if (nextSelected.length > 0) {
            currentSelected.removeClass('selected');
            nextSelected.addClass('selected');

            var elTop = nextSelected.position().top,
                elHeight = nextSelected.height(),
                windowTop = $(window).scrollTop(),
                windowHeight = $(window).height();

            if (elTop < windowTop) {
                $(window).scrollTop(elTop);
            } else if (elTop + elHeight > windowTop + windowHeight) {
                $(window).scrollTop(elTop + elHeight + 20 - windowHeight);
            }
        }
    });
}(jQuery));


text:
* Improve chat layout (position send box under message box)
* Make chat embeddable and configurable
* Anonymous nickname
* Flux
* Customize chat message color
* Groups


text:
// Copyright 2004, 2005 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package org.ops4j.gaderian.impl;

import java.util.HashMap;
import java.util.Map;

/**
 * Holds a utility method that converts java type names (as they might appear in source code) into
 * JVM class names.
 *
 * @author Howard M. Lewis Ship
 * @since 1.1
 */
public class JavaTypeUtils
{
    /**
     * Mapping between a primitive type and its Java VM representation Used for the encoding of
     * array types
     */
    private static Map<String,String> PRIMITIVE_TYPE_CODES = new HashMap<String,String>();

    static
    {
        PRIMITIVE_TYPE_CODES.put("boolean", "Z");
        PRIMITIVE_TYPE_CODES.put("short", "S");
        PRIMITIVE_TYPE_CODES.put("int", "I");
        PRIMITIVE_TYPE_CODES.put("long", "J");
        PRIMITIVE_TYPE_CODES.put("float", "F");
        PRIMITIVE_TYPE_CODES.put("double", "D");
        PRIMITIVE_TYPE_CODES.put("char", "C");
        PRIMITIVE_TYPE_CODES.put("byte", "B");
    }

    /**
     * Map from Java type name to Class.
     */
    private static final Map<String,Class> PRIMITIVE_CLASSES = new HashMap<String,Class>();

    static
    {
        PRIMITIVE_CLASSES.put("boolean", boolean.class);
        PRIMITIVE_CLASSES.put("short", short.class);
        PRIMITIVE_CLASSES.put("char", char.class);
        PRIMITIVE_CLASSES.put("byte", byte.class);
        PRIMITIVE_CLASSES.put("int", int.class);
        PRIMITIVE_CLASSES.put("long", long.class);
        PRIMITIVE_CLASSES.put("float", float.class);
        PRIMITIVE_CLASSES.put("double", double.class);
    }

    private JavaTypeUtils()
    {
        // Prevent instantiation
    }

    /**
     * Translates types from standard Java format to Java VM format. For example, java.util.Locale
     * remains java.util.Locale, but int[][] is translated to [[I and java.lang.Object[] to
     * [Ljava.lang.Object;
     */
    public static String getJVMClassName(String type)
    {
        // if it is not an array, just return the type itself
        if (!type.endsWith("[]"))
            return type;

        // if it is an array, convert it to JavaVM-style format
        StringBuffer buffer = new StringBuffer();

        while (type.endsWith("[]"))
        {
            buffer.append("[");
            type = type.substring(0, type.length() - 2);
        }

        String primitiveIdentifier = (String) PRIMITIVE_TYPE_CODES.get(type);
        if (primitiveIdentifier != null)
            buffer.append(primitiveIdentifier);
        else
        {
            buffer.append("L");
            buffer.append(type);
            buffer.append(";");
        }

        return buffer.toString();
    }

    /**
     * Translates a primitive type ("boolean", "char", etc.) to the corresponding
     * Class.
     *
     * @return the corresponding class, or null if type is not a primitive type.
     *
     */

    public static Class getPrimtiveClass(String type)
    {
        return PRIMITIVE_CLASSES.get(type);
    }
}


text:
import unittest

from ghinbox import app

class GHInboxTestCase(unittest.TestCase):

    def setUp(self):
        app.config['TESTING'] = True
        app.config['ghuser'] = 'testuser'
        app.config['ghpassword'] = 'testpassword'
        app.config['ghrepository'] = 'testuser/testrepo'

        self.app = app.test_client()


text:
<!DOCTYPE html>

		<meta charset="utf-8" />
		<base href="../../../" />

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

[name]

		An exporter for *EXR*.

		EXR ( Extended Dynamic Range) is an
		open format specification
		for professional-grade image storage format of the motion picture industry. The purpose of
		format is to accurately and efficiently represent high-dynamic-range scene-linear image data
		and associated metadata. The library is widely used in host application software where accuracy
		is critical, such as photorealistic rendering, texture access, image compositing, deep compositing,
		and DI.

Code Example

		// Instantiate a exporter
		const exporter = new EXRExporter();

		// Parse the input render target data and generate the EXR output
		const EXR = exporter.parse( renderer, renderTarget, options );
		downloadFile( EXR );

Constructor

[name]()

		Creates a new [name].

Methods

[method:null parse]( [param:WebGLRenderer renderer], [param:WebGLRenderTarget renderTarget], [param:Object options] )

			[page:Function renderTarget] — WebGLRenderTarget containing data used for exporting EXR image.

			[page:Options options] — Export options.

type - Output datatype for internal EXR data. Available options:

THREE.HalfFloatType // default option
THREE.FloatType

compression - Internal compression algorithm. Available options:

NO_COMPRESSION
ZIP_COMPRESSION // default option
ZIPS_COMPRESSION

		Generates a .exr output from the input render target.

Source

			[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/EXRExporter.js examples/jsm/exporters/EXRExporter.js]


text:
package org.zstack.test.network;

import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
import org.zstack.core.cloudbus.CloudBus;
import org.zstack.core.componentloader.ComponentLoader;
import org.zstack.core.db.DatabaseFacade;
import org.zstack.header.cluster.ClusterInventory;
import org.zstack.header.network.l2.*;
import org.zstack.header.query.QueryCondition;
import org.zstack.header.query.QueryOp;
import org.zstack.test.Api;
import org.zstack.test.ApiSenderException;
import org.zstack.test.DBUtil;
import org.zstack.test.deployer.Deployer;
import org.zstack.utils.Utils;
import org.zstack.utils.logging.CLogger;

import java.util.ArrayList;

public class TestQueryL2Network {
    CLogger logger = Utils.getLogger(TestQueryL2Network.class);
    Deployer deployer;
    Api api;
    ComponentLoader loader;
    CloudBus bus;
    DatabaseFacade dbf;

    @Before
    public void setUp() throws Exception {
        DBUtil.reDeployDB();
        deployer = new Deployer("deployerXml/network/TestQueryL2Network.xml");
        deployer.build();
        api = deployer.getApi();
        loader = deployer.getComponentLoader();
        bus = loader.getComponent(CloudBus.class);
        dbf = loader.getComponent(DatabaseFacade.class);
    }

	@Test
	public void test() throws InterruptedException,ApiSenderException {
	    APIQueryL2NetworkMsg msg = new APIQueryL2NetworkMsg();
	    QueryCondition qc = new QueryCondition();
	    qc.setName("description");
	    qc.setOp(QueryOp.IN.toString());
	    qc.setValue("Test");
	    msg.getConditions().add(qc);
	    APIQueryL2NetworkReply reply = api.query(msg, APIQueryL2NetworkReply.class);
	    Assert.assertEquals(7, reply.getInventories().size());

        boolean hasVlanL2 = false;
        for (L2NetworkInventory inv : reply.getInventories()) {
            if (inv instanceof L2VlanNetworkInventory) {
                hasVlanL2 = true;
                break;
            }
        }

        Assert.assertTrue(hasVlanL2);

        msg = new APIQueryL2NetworkMsg();
        qc = new QueryCondition();
        qc.setName("description");
        qc.setOp(QueryOp.NOT_IN.toString());
        qc.setValue("Test");
        msg.getConditions().add(qc);
        reply = api.query(msg, APIQueryL2NetworkReply.class);
        Assert.assertEquals(0, reply.getInventories().size());

        ClusterInventory cinv = deployer.clusters.get("TestCluster");
        msg = new APIQueryL2NetworkMsg();
        msg.addQueryCondition("attachedClusterUuids", QueryOp.IN, cinv.getUuid());
        reply = api.query(msg, APIQueryL2NetworkReply.class);
        Assert.assertEquals(2, reply.getInventories().size());

        msg = new APIQueryL2NetworkMsg();
        msg.addQueryCondition("type", QueryOp.EQ, L2NetworkConstant.L2_VLAN_NETWORK_TYPE);
        msg.addQueryCondition("vlan", QueryOp.EQ, "10");
        reply = api.query(msg, APIQueryL2NetworkReply.class);
        Assert.assertEquals(1, reply.getInventories().size());
        Assert.assertTrue(reply.getInventories().get(0) instanceof L2VlanNetworkInventory);

        msg = new APIQueryL2NetworkMsg();
        msg.setSortBy("physicalInterface");
        msg.setSortDirection("desc");
        msg.setConditions(new ArrayList<QueryCondition>());
        reply = api.query(msg, APIQueryL2NetworkReply.class);
        Assert.assertTrue(reply.getInventories().get(0) instanceof L2VlanNetworkInventory);
	}

}


text:
package cn.hashdata.bireme;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.concurrent.Callable;
import java.util.concurrent.CompletionService;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import cn.hashdata.bireme.Provider.Transformer;

/**
 * {@code Dispatcher} constantly poll {@code ChangeSet} and offer the {@code ChangeSet} to right
 * {@code Transformer}. After transformation complete, {@code Dispatcher} insert the result to
 * suitable {@code RowCache}.
 *
 * @author yuze
 *
 */
public class Dispatcher implements Callable<Long> {
  static final protected Long TIMEOUT_MS = 1000L;

  private Logger logger = LogManager.getLogger("Bireme." + Dispatcher.class);

  protected Context cxt;
  protected ChangeSet changeSet;
  protected LinkedBlockingQueue<ChangeSet> changeSetIn;
  protected ExecutorService transformerThreadPool;
  protected CompletionService<RowSet> cs;
  protected LinkedBlockingQueue<Future<RowSet>> results;
  protected LinkedBlockingQueue<Transformer> transformers;

  /**
   * Create a new {@code Dispatcher}.
   *
   * @param cxt bireme context.
   */
  public Dispatcher(Context cxt) {
    this.cxt = cxt;
    changeSetIn = cxt.changeSetQueue;
    transformerThreadPool = Executors.newFixedThreadPool(cxt.conf.transform_pool_size);
    cs = new ExecutorCompletionService<RowSet>(transformerThreadPool);
    results = new LinkedBlockingQueue<Future<RowSet>>(cxt.conf.trans_result_queue_size);
    transformers = new LinkedBlockingQueue<Transformer>(cxt.conf.trans_result_queue_size);
  }

  /**
   * Call the {@code Dispatcher} to work.
   */
  public Long call() throws BiremeException, InterruptedException {
    Thread.currentThread().setName("Dispatcher");

    logger.info("Dispatcher Start.");

    try {
      while (!cxt.stop) {
        do {
          changeSet = changeSetIn.poll(TIMEOUT_MS, TimeUnit.MILLISECONDS);
          checkTansformResults();
        } while (changeSet == null && !cxt.stop);

        if (cxt.stop) {
          break;
        }

        dispatch(changeSet);
      }
    } catch (BiremeException e) {
      logger.fatal("Dispatcher exit on error.");
      logger.fatal("Stack Trace: ", e);
      throw e;
    } finally {
      transformerThreadPool.shutdown();
    }

    logger.info("Dispatcher exit.");
    return 0L;
  }

  private void dispatch(ChangeSet changeSet) throws BiremeException, InterruptedException {
    Transformer transformer = changeSet.provider.borrowTransformer(changeSet);
    transformers.offer(transformer);
    Future<RowSet> result = cs.submit(transformer);
    boolean success;

    do {
      success = results.offer(result, TIMEOUT_MS, TimeUnit.MILLISECONDS);
      checkTansformResults();
    } while (!success && !cxt.stop);
  }

  private void checkTansformResults() throws BiremeException, InterruptedException {
    RowSet rowSet = null;
    while (!results.isEmpty() && !cxt.stop) {
      Future<RowSet> head = results.peek();

      if (head.isDone()) {
        results.remove();

        Transformer trans = transformers.take();
        Provider provider = trans.getProvider();
        provider.returnTransformer(trans);

        try {
          rowSet = head.get();
        } catch (ExecutionException e) {
          throw new BiremeException("Transform failed.\n", e.getCause());
        }

        insertRowSet(rowSet);
      } else {
        break;
      }
    }
  }

  private void insertRowSet(RowSet rowSet) throws BiremeException, InterruptedException {
    HashMap<String, ArrayList<Row>> bucket = rowSet.rowBucket;
    ConcurrentHashMap<String, RowCache> tableCache = cxt.tableRowCache;

    for (Entry<String, ArrayList<Row>> entry : bucket.entrySet()) {
      String fullTableName = entry.getKey();
      ArrayList<Row> rows = entry.getValue();
      RowCache cache = tableCache.get(fullTableName);
      cache.addRows(rows, rowSet.callback);
      cxt.idleRowArrays.returnObject(rows);
    }
    cxt.idleRowSets.returnObject(rowSet);
  }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Calculate and plot a correlation matrix. — plot_heatmap • llamar</title>

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">

<link href="../pkgdown.css" rel="stylesheet">

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">

      </button>
      llamar

  Reference

Calculate and plot a correlation matrix.

Plots coefficients from a model, along with standard errors.  Coefficients that are statistically significant at agiven level are highlighted in darker text. Inspired by https://github.com/jaredlander/coefplot/blob/master/R/coefplot.r but works w/ ggplot2 version > 2.2

plot_heatmap(df, fill_var = "value", remove_same = TRUE,
  remove_half = TRUE, label_pct = TRUE, stroke_colour = "white",
  stroke_size = 0.5, square_tiles = TRUE, fill_palette = brewer.pal(11,
  "RdYlBu"), fill_limits = c(-1, 1), font_normal = "Lato",
  font_semi = "Lato Light", font_light = "Lato Light")

 Arguments

    <colgroup><col class="name" /><col class="desc" /></colgroup>

      df

data frame in a tidy format

Examples

plot_corr(mtcars)

#> Error in plot_corr(mtcars): could not find function "plot_corr"

Contents

Arguments

Examples

Developed by Laura Hughes.

Site built with pkgdown.


text:
@interface HASampleTest : SenTestCase {
@private
    NSString* dbFilePath;
}

@end


text:
package DocsExamples.Programming_with_documents.Contents_management;

import DocsExamples.DocsExamplesBase;
import org.testng.annotations.Test;
import com.aspose.words.Document;

@Test
public class WorkingWithRanges extends DocsExamplesBase
{
    @Test
    public void rangesDeleteText() throws Exception
    {
        //ExStart:RangesDeleteText
        Document doc = new Document(getMyDir() + "Document.docx");
        doc.getSections().get(0).getRange().delete();
        //ExEnd:RangesDeleteText
    }

    @Test
    public void rangesGetText() throws Exception
    {
        //ExStart:RangesGetText
        Document doc = new Document(getMyDir() + "Document.docx");
        String text = doc.getRange().getText();
        //ExEnd:RangesGetText
    }
}


text:
#include "sys-core.h"

/***********************************************************************
**
*/	REBSER *Make_Block(REBCNT length)
/*
**		Make a block series. Add 1 extra for the terminator.
**		Set TAIL to zero and set terminator.
**
***********************************************************************/
{
	REBSER *series = Make_Series(length + 1, sizeof(REBVAL), FALSE);
	SET_END(BLK_HEAD(series));
	PG_Reb_Stats->Blocks++;
	return series;
}

/***********************************************************************
**
*/	REBSER *Copy_Block(REBSER *block, REBCNT index)
/*
**		Shallow copy a block from the given index thru the tail.
**
***********************************************************************/
{
	REBCNT len = SERIES_TAIL(block);
	REBSER *series;

	if (index > len) return Make_Block(0);

	len -= index;
	series = Make_Series(len + 1, sizeof(REBVAL), FALSE);
	COPY_BLK_PART(series, BLK_SKIP(block, index), len);

	PG_Reb_Stats->Blocks++;

	return series;
}

/***********************************************************************
**
*/	REBSER *Copy_Block_Len(REBSER *block, REBCNT index, REBCNT len)
/*
**		Shallow copy a block from the given index for given length.
**
***********************************************************************/
{
	REBSER *series;

	if (index > SERIES_TAIL(block)) return Make_Block(0);
	if (index + len > SERIES_TAIL(block)) len = SERIES_TAIL(block) - index;

	series = Make_Series(len + 1, sizeof(REBVAL), FALSE);
	COPY_BLK_PART(series, BLK_SKIP(block, index), len);

	PG_Reb_Stats->Blocks++;

	return series;
}

/***********************************************************************
**
*/	REBSER *Copy_Values(REBVAL *blk, REBCNT length)
/*
**		Shallow copy a block from current value for length values.
**
***********************************************************************/
{
	REBSER *series;

	series = Make_Series(length + 1, sizeof(REBVAL), FALSE);
	COPY_BLK_PART(series, blk, length);

	PG_Reb_Stats->Blocks++;

	return series;
}

/***********************************************************************
**
*/	void Copy_Deep_Values(REBSER *block, REBCNT index, REBCNT tail, REBU64 types)
/*
**		Copy the contents of values specified by types. If the
**		DEEP flag is set, recurse into sub-blocks and objects.
**
***********************************************************************/
{
	REBVAL *val;

	for (; index < tail; index++) {

		val = BLK_SKIP(block, index);

		if ((types & TYPESET(VAL_TYPE(val)) & TS_SERIES_OBJ) != 0) {
			// Replace just the series field of the value
			// Note that this should work for objects too (the frame).
			VAL_SERIES(val) = Copy_Series(VAL_SERIES(val));
			if ((types & TYPESET(VAL_TYPE(val)) & TS_BLOCKS_OBJ) != 0) {
				PG_Reb_Stats->Blocks++;
				// If we need to copy recursively (deep):
				if ((types & CP_DEEP) != 0)
					Copy_Deep_Values(VAL_SERIES(val), 0, VAL_TAIL(val), types);
			}
		} else if (types & TYPESET(VAL_TYPE(val)) & TS_FUNCLOS)
			Clone_Function(val, val);
	}
}

/***********************************************************************
**
*/	REBSER *Copy_Block_Values(REBSER *block, REBCNT index, REBCNT tail, REBU64 types)
/*
**		Copy a block, copy specified values, deeply if indicated.
**
***********************************************************************/
{
	REBSER *series;

	if (index > tail) index = tail;
	if (index > SERIES_TAIL(block)) return Make_Block(0);

	series = Copy_Values(BLK_SKIP(block, index), tail - index);

	if (types != 0) Copy_Deep_Values(series, 0, SERIES_TAIL(series), types);

	return series;
}

/***********************************************************************
**
*/	REBSER *Clone_Block(REBSER *block)
/*
**		Deep copy block, including all series (strings and blocks),
**		but not images, bitsets, maps, etc.
**
***********************************************************************/
{
	return Copy_Block_Values(block, 0, SERIES_TAIL(block), TS_CODE);
}

/***********************************************************************
**
*/	REBSER *Clone_Block_Value(REBVAL *code)
/*
**		Same as above, but uses a value.
**
***********************************************************************/
{
	// Note: TAIL will be clipped to correct size if INDEX is not zero.
	return Copy_Block_Values(VAL_SERIES(code), VAL_INDEX(code), VAL_TAIL(code), TS_CODE);
}

#ifdef obsolete
/***********************************************************************
**
x*/	REBSER *Copy_Block_Deep(REBSER *block, REBCNT index, REBINT len, REBCNT mode)
/*
**		A useful function for copying a block and its contents.
**
**		index - used to indicate the start of the copy.
**		length - can be zero, which means use the series length - index,
**			or it can be any length, which if its less than the length
**			of the series will clip it, or if it's longer will allocate
**			extra space for it.
**		mode - indicates what to copy, how deep to copy.
**
***********************************************************************/
{
	REBSER *series;
	REBVAL *val;
	REBINT maxlen = (REBINT)SERIES_TAIL(block) - index;

	CHECK_STACK(&series);

	if (mode & COPY_OBJECT) mode |= COPY_STRINGS;

	//DISABLE_GC; // Copy deep may trigger recycle

	if (maxlen < 0) maxlen = 0;
	if (len == 0 || len > maxlen) len = maxlen; // (clip size)

	series = (mode & COPY_SAME) ? block : Copy_Values(BLK_SKIP(block, index), len);

	val = BLK_HEAD(series);
	if (mode & COPY_SAME) {
		val += index;
		mode &= ~COPY_SAME;
	}

	for (; len > 0; len--, val++) {
		if (
			((mode & COPY_DEEP) && (ANY_BLOCK(val) || IS_OBJECT(val) || IS_PORT(val)))
			||
			((mode & COPY_OBJECT) && ANY_BLOCK(val))
		) {
			VAL_SERIES(val) = Copy_Block_Deep(VAL_SERIES(val), 0, 0, mode);
		}
		if ((mode & COPY_STRINGS) && ANY_BINSTR(val)) {
			VAL_SERIES(val) = Copy_Series(VAL_SERIES(val));
		}
	}
	//ENABLE_GC;

	return series;
}
#endif

/***********************************************************************
**
*/	REBSER *Copy_Expand_Block(REBSER *block, REBCNT extra)
/*
**		Create an expanded copy of the block, but with same tail.
**
***********************************************************************/
{
	REBCNT len = SERIES_TAIL(block);
	REBSER *series = Make_Series(len + extra + 1, sizeof(REBVAL), FALSE);
	COPY_BLK_PART(series, BLK_HEAD(block), len);
	PG_Reb_Stats->Blocks++;
	return series;
}

/***********************************************************************
**
*/	void Copy_Stack_Values(REBINT start, REBVAL *into)
/*
**		Copy computed values from the stack into the series
**		specified by "into", or if into is NULL then store it as a
**		block on top of the stack.  (Also checks to see if into
**		is protected, and will trigger a trap if that is the case.)
**
***********************************************************************/
{
	REBSER *series;
	REBVAL *blk = DS_Base + start;
	REBCNT len = DSP - start + 1;
	REBCNT type;

	if (into) {
		type = VAL_TYPE(into);
		series = VAL_SERIES(into);
		if (IS_PROTECT_SERIES(series)) Trap0(RE_PROTECTED);
		len = Insert_Series(series, VAL_INDEX(into), (REBYTE*)blk, len);
	} else {
		series = Make_Series(len + 1, sizeof(REBVAL), FALSE);
		COPY_BLK_PART(series, blk, len);
		len = 0;
		type = REB_BLOCK;
		PG_Reb_Stats->Blocks++;
	}

	DSP = start;
	blk = DS_TOP;
	VAL_SET(blk, type);
	VAL_SERIES(blk) = series;
	VAL_INDEX(blk) = len;
	VAL_SERIES_SIDE(blk) = 0;
}

/***********************************************************************
**
*/	REBVAL *Append_Value(REBSER *block)
/*
**		Append a value to a block series at its tail.
**		Expand it if necessary. Update the termination and tail.
**		Returns the new value for you to initialize.
**
***********************************************************************/
{
	REBVAL *value;

	EXPAND_SERIES_TAIL(block, 1);
	value = BLK_TAIL(block);
	SET_END(value);
	value--;
	SET_NONE(value);  // Expand_Series leaves a hole here to be filled
	return value;
}

#ifdef ndef
/***********************************************************************
**
*/	void Append_Block(REBSER *block, REBSER *added)
/*
**		Append a block to the tail of a block.
**		Expand it if necessary. Update the termination and tail.
**
***********************************************************************/
{
	Insert_Series(block, block->tail, (void*)BLK_HEAD(added), added->tail);
}
#endif

/***********************************************************************
**
*/	void Append_Val(REBSER *block, REBVAL *val)
/*
**		Append a value to a block series at its tail.
**		Expand it if necessary. Update the termination and tail.
**
***********************************************************************/
{
	REBVAL *value;

	EXPAND_SERIES_TAIL(block, 1);
	value = BLK_TAIL(block);
	SET_END(value);
	value--;
	*value = *val;
}

/***********************************************************************
**
*/	REBINT Find_Same_Block(REBSER *blk, REBVAL *val)
/*
**		Scan a block for any values that reference blocks related
**		to the value provided.
**
**		Defect: only checks certain kinds of values.
**
***********************************************************************/
{
	REBVAL *bp;
	REBINT index = 0;

	for (bp = BLK_HEAD(blk); NOT_END(bp); bp++, index++) {

		if (VAL_TYPE(bp) >= REB_BLOCK &&
			VAL_TYPE(bp) <= REB_MAP &&
			VAL_BLK(bp) == VAL_BLK(val)
		) return index+1;

		if (
			VAL_TYPE(bp) >= REB_OBJECT &&
			VAL_TYPE(bp) <= REB_PORT &&
			VAL_OBJ_FRAME(bp) == VAL_OBJ_FRAME(val)
		) return index+1;
	}
	return -1;
}

#ifdef ndef
/***********************************************************************
**
*/	REBSER *Copy_Side_Series(REBSER *ser)
/*
**		Copy a hash or list side series
**
***********************************************************************/
{
	REBSER *ret;

	ret = Make_Series(ser->tail, SERIES_WIDE(ser), FALSE);
	ret->tail = ser->tail;
	memcpy(ret->data, ser->data, ret->tail * SERIES_WIDE(ret));
	return ret;
}
#endif

/***********************************************************************
**
*/	void Clear_Value_Opts(REBSER *ser)
/*
**		Clear all options for values of a block series.
**
***********************************************************************/
{
	REBVAL *val = BLK_HEAD(ser);

	for (; NOT_END(val); val++) {
		VAL_OPTS(val) = 0;
	}
}

/***********************************************************************
**
*/	void Unmark(REBVAL *val)
/*
**		Clear the recusion markers for series and object trees.
**
**		Note: these markers are also used for GC. Functions that
**		call this must not be able to trigger GC!
**
***********************************************************************/
{
	// The next line works because VAL_OBJ_FRAME(val) == VAL_SERIES(val)
	REBSER *series = VAL_SERIES(val);
	if (!ANY_SERIES(val)
		&& !IS_OBJECT(val)
		&& !IS_MODULE(val)
		&& !IS_ERROR(val)
		&& !IS_PORT(val)) {
		return;
	}

	if (!IS_MARK_SERIES(series)) return; // avoid loop

	UNMARK_SERIES(series);

	for (val = VAL_BLK(val); NOT_END(val); val++) {
			Unmark(val);
	}
}


text:
package main

import (
	"context"

	debugger "cloud.google.com/go/debugger/apiv2"
	clouddebuggerpb "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2"
)

func main() {
	ctx := context.Background()
	c, err := debugger.NewDebugger2Client(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &clouddebuggerpb.ListDebuggeesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/clouddebugger/v2#ListDebuggeesRequest.
	}
	resp, err := c.ListDebuggees(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

// [END clouddebugger_v2_generated_Debugger2_ListDebuggees_sync]