text:
/*** Louis Mazeaud Dev ***/
/******************************* Less Variables *****************************
*/
/*Colors*/
/*Font*/
/******************************** Less Media Queries Variables *******************************
*/
/******************************** Less Mixins *******************************
*/
/*************************************************************
************************* font face **************************
**************************************************************
______________________________________________________________
--------------------------------------------------------------
work : .font-face('Ubuntu','Ubuntu-R-webfont','fonts/',400,normal);
--------------------------------------------------------------
______________________________________________________________*/
section.container div.row {
  margin-top: -20px;
  margin-bottom: 140px;
}
@media only screen and (min-width: 426px) and (max-width: 768px) {
  section.container div.row {
    margin-bottom: 60px;
  }
}
section.container div.text {
  margin-top: -25px;
  padding: 5px 12% 5px 12%;
}
@media only screen and (max-width: 425px) {
  section.container div.text {
    margin-top: -160px;
  }
}
section.container div.text H1 {
  color: #ffa6b8;
  font-family: 'Oswald', sans-serif;
  margin-bottom: 20px;
}
section.container div.text p,
section.container div.text h5 {
  font-family: 'Oswald', sans-serif;
  font-weight: 300;
  font-size: 16px;
}
section.container div.text ul.social {
  margin-top: 20px;
  text-align: center;
}
section.container div.text ul.social li {
  display: inline-block;
  margin-top: 20px;
  margin-right: 12px;
  margin-left: 12px;
}
section.container div.text ul.social li img {
  height: 30px;
  width: 30px;
}
@media only screen and (max-width: 425px) {
  section.container form div.controls {
    margin-top: -120px;
  }
}
section.container form div.controls div.centered {
  margin-left: 10%;
}
@media only screen and (min-width: 426px) and (max-width: 768px) {
  section.container form div.controls div.centered {
    margin-left: 5%;
  }
}
@media only screen and (max-width: 425px) {
  section.container form div.controls div.centered {
    margin-left: 0%;
  }
}
section.container form div.controls input.form-control,
section.container form div.controls textarea.form-control {
  -webkit-border-radius: 0px;
  -moz-border-radius: 0px;
  border-radius: 0px;
  -moz-background-clip: padding;
  -webkit-background-clip: padding-box;
  background-clip: padding-box;
  border: none;
  border-bottom: 1px solid #e0b5af;
}
section.container form div.controls input.form-control:-ms-input-placeholder,
section.container form div.controls textarea.form-control:-ms-input-placeholder,
section.container form div.controls input.form-control::-webkit-input-placeholder,
section.container form div.controls textarea.form-control::-webkit-input-placeholder,
section.container form div.controls input.form-control::-moz-placeholder,
section.container form div.controls textarea.form-control::-moz-placeholder,
section.container form div.controls input.form-control:-moz-placeholder,
section.container form div.controls textarea.form-control:-moz-placeholder {
  color: #ababab;
}
section.container form div.controls input,
section.container form div.controls textarea,
section.container form div.controls input:focus,
section.container form div.controls input:active,
section.container form div.controls textarea:focus,
section.container form div.controls textarea:active {
  font-family: 'Oswald', sans-serif;
  font-size: 15px;
  font-weight: 300;
  -webkit-box-shadow: none;
  -moz-box-shadow: none;
  box-shadow: none;
  outline: none;
}
section.container form div.controls input.btn {
  -webkit-border-radius: 0px;
  -moz-border-radius: 0px;
  border-radius: 0px;
  -moz-background-clip: padding;
  -webkit-background-clip: padding-box;
  background-clip: padding-box;
  font-family: 'Oswald', sans-serif;
  font-size: 15px;
  font-weight: 300;
  background-color: #e0b5af;
  color: #000000;
  border: none;
  float: right;
}


text:
(function(){Template.__define__("about",Package.handlebars.Handlebars.json_ast_to_func(["
About Us
"]));

})();

redpajama_set_name: RedPajamaGithub


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Revis. gen. pl. (Leipzig) 3: 480 (1898)

#### Original name
Agaricus campestris var. silvicola Vittad., 1832

### Remarks
null


text:
layout: post
title: Busty babe Alison helps Tiffany get over a breakup
titleinfo: pornvd
desc: Watch Busty babe Alison helps Tiffany get over a breakup. Pornhub is the ultimate xxx porn and sex site.
---

Busty babe Alison helps Tiffany get over a breakup

Watch Busty babe Alison helps Tiffany get over a breakup. Pornhub is the ultimate xxx porn and sex site.


text:
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

#define HOSTNAME "raspberrypi.local"
#define PORT "6666"

/* TODO: Error checking
 * TODO: Get host from command line arguments
 * This is a prototype.
 * It will be improved once I figure things out.
 */
int main(void)
{
    int status;
    int sockfd;
    ssize_t read_bytes;
    struct addrinfo *servinfo, hints;
    char buffer[BUFSIZ];
    memset(&hints, 0, sizeof hints);
    hints.ai_family = AF_INET;
    hints.ai_socktype = SOCK_STREAM;
    if ((status = getaddrinfo(HOSTNAME, PORT, &hints, &servinfo)) != 0) {
        fprintf(stderr, "getaddrinfo() error: %s\n", gai_strerror(status));
        return 1;
    }
    // TODO: Iterate over servinfo and try to socket() and connect()
    if ((sockfd = socket(servinfo->ai_family, servinfo->ai_socktype, servinfo->ai_protocol)) == -1) {
        perror("socket() error");
        return 1;
    }
    if (connect(sockfd, servinfo->ai_addr, servinfo->ai_addrlen) == -1) {
        perror("connect() error");
        return 1;
    }
    freeaddrinfo(servinfo);
    // TODO: Proper error checking and handling for read() and send()
    while ((read_bytes = read(0, buffer, BUFSIZ)) > 0) {
        send(sockfd, buffer, read_bytes, 0);
    }
    close(sockfd);
    return 0;
}


text:
var pkgcloud = require('../../lib/pkgcloud'),
  fs = require('fs'),
  client,
  options;

//
// Create a pkgcloud compute instance
//
options = {
  provider: 'azure',
  storageAccount: 'test-storage-account',
  storageAccessKey: 'test-storage-access-key',
  subscriptionId: 'azure-account-subscription-id',
  key: fs.readFileSync('path to your account management key file', 'ascii'),
  cert: fs.readFileSync('path to your account management certificate pem file', 'ascii')
};
client = pkgcloud.compute.createClient(options);

//
// Create a server.
// This may take several minutes.
//
options = {
  // pkgcloud compute properties
  name:  'pkgcloud-test',   // name of the server
  flavor: 'ExtraSmall',     // azure vm size
  image: '5112500ae3b842c8b9c604889f8753c3__OpenLogic-CentOS63DEC20121220', // OS Image to use

  // Azure vm properties
  location:  'East US',       // Azure location for server
  username:  'pkgcloud',      // Username for server
  password:  'Pkgcloud!!',    // Password for server

  // Azure linux SSH properties
  ssh: {
    cert: fs.readFileSync('path to your ssh pem file', 'ascii')
  },

  // Azure ports (endpoints)
  ports: [
    {
      name : 'foo',             // name of port
      protocol : 'tcp',         // tcp or udp
      port: '12333',           // external port number
      localPort: '12333'       // internal port number
    }
  ]
};

console.log('creating server...');

client.createServer(options, function (err, server) {
  if (err) {
    console.log(err);
  } else {
    // Wait for the server to reach the RUNNING state.
    // This may take several minutes.
    console.log('waiting for server RUNNING state...');
    server.setWait({ status: server.STATUS.running }, 10000, function (err, server) {
      if (err) {
        console.log(err);
      } else {
        console.dir(server);
      }
    });
  }
});


text:
package com.amazonaws.services.rds.model;

import javax.annotation.Generated;

/**
 *
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class BackupPolicyNotFoundException extends com.amazonaws.services.rds.model.AmazonRDSException {
    private static final long serialVersionUID = 1L;

    /**
     * Constructs a new BackupPolicyNotFoundException with the specified error message.
     *
     * @param message
     *        Describes the error encountered.
     */
    public BackupPolicyNotFoundException(String message) {
        super(message);
    }

}


text:
{#-
  This file was automatically generated - do not edit
-#}
{% macro t(key) %}{{ {
  "language": "af",
  "clipboard.copy": "Kopieer na knipbord",
  "clipboard.copied": "gekopieer na knipbord",
  "edit.link.title": "Wysig hierdie bladsy",
  "footer.previous": "Vorige",
  "footer.next": "Volgende",
  "meta.comments": "Kommentaar",
  "meta.source": "Bron",
  "search.config.lang": "nl",
  "search.placeholder": "Soek",
  "search.result.placeholder": "Tik om te begin soek",
  "search.result.none": "Geen ooreenstemmende dokumente",
  "search.result.one": "1 ooreenstemmende dokument",
  "search.result.other": "# ooreenstemmende dokumente",
  "skip.link.title": "Slaan oor na inhoud",
  "source.link.title": "Slaan oor na inhoud",
  "source.file.date.updated": "Laaste opdatering",
  "source.file.date.created": "Geskep",
  "toc.title": "Inhoudsopgawe"
}[key] }}{% endmacro %}


text:
url: /tokens
---

# Tokens

## Overview

This document is designed to clarify and disambiguate the numerous types of tokens referenced in Auth0 documentation, what each is used for and how to use it.

First there are a couple different categories of tokens:

* JSON Web Tokens (JWT) - These are tokens that conform to the [JSON Web Token standard](https://tools.ietf.org/html/rfc7519) and contain information about an identity in the form of claims.  They are self-contained in that it is not necessary for the recipient to call a server to validate the token.
* Opaque tokens - Opaque tokens are tokens in a proprietary format that typically contain some identifier to information in a server's persistent storage.  To validate an opaque token, the recipient of the token needs to call the server that issued the token.

There are six primary tokens used in Auth0's token based authentication scenarios and referenced in Auth0 documentation:

- [Auth0 `id_token` (JWT)](#auth0-id_token-jwt-)
- [Auth0 `access_token`](#auth0-access_token)
- [Identity Provider Access Tokens](#identity-provider-access-tokens)
- [Auth0 `refresh_token`](#auth0-refresh_token)
- [Delegation Tokens](#delegation-tokens)
- [Auth0 Management APIv2 Token](#auth0-management-apiv2-token)

## Auth0 `id_token` (JWT)

The Auth0 `id_token` is a token in JSON Web Token (JWT) format, which provides a mechanism for transferring claims about a user from Identity Providers, who are authoritative sources of such information, to other relying parties, such as websites or web services, also known as service providers, who need such information.  The claims included in a JWT can be basic profile attributes such as a name or email address as well as security information such as a group membership or the support plan a user is entitled to use.

[More information](/tokens/id_token)

## Auth0 `access_token`

The Auth0 access token is a random, opaque string and was used to call portions of the Auth0 Management API (API v1) and the `/userinfo` endpoint within the Auth0 Authentication API.

[More information](/tokens/access_token)

## Identity Provider Access Tokens

When a user authenticates via Auth0 with another social provider's authentication service, such as Facebook or LinkedIn, the social provider will return an access token that can be used by the client program to call that social provider's API.

[More information](/tokens/idp)

## Auth0 `refresh_token`

The Refresh token is a long-lived token that is used to obtain a new [`id_token`](#auth0-idtoken-jwt) after a previous one has expired.  This is useful for applications running on mobile devices that call remote APIs and do not want to require the user to log in every time the user uses the mobile app.

[More information](/tokens/refresh_token)

## Delegation Tokens

The Auth0 [`id_token`](#auth0-idtoken-jwt)'s can be exchanged for another token, called a Delegation Token, that can be used to call either other application APIs registered as clients in the same Auth0 tenant or APIs represented by some types of application Addons registered in the same Auth0 tenant.

[More information](/tokens/delegation)

## Auth0 Management APIv2 Token

The Auth0 Management APIv2 token is used to call v2 of the Auth0 Management API.  This allows a specific tenant in Auth0 to call Auth0 APIv2.  This APIv2 token is a JWT, and contains various scope claims, such as `read:users` or `update:clients`, and is signed with a client API key and secret for the entire tenant.

[More information](/api/v2/tokens)

---

## Additional Reading and References

### Authenticating a user

* [Authentication with Lock widget](/libraries/lock)
* [Authentication with Auth0.js library](https://github.com/auth0/auth0.js)
* [List of tutorials for other languages](/tutorials)

### Getting User Profile info from Auth0

* [User profile overview](/user-profile)
* [Getting user profile with Lock widget](/libraries/lock)
* [Getting user profile with Auth0.js library](https://github.com/auth0/auth0.js)
* See the `/authorize`, `/userinfo` and `/tokeninfo` endpoints within the [Auth0 Authentication API](/auth-api)
* [List of tutorials for other languages](/tutorials)
* [Management APIv2 - User endpoints](/api/v2)

### Getting User Profile info from other providers

Some basic user profile information from third party providers is made available in the Auth0 user profile object.

* [User profile overview](/user-profile)

### Calling the Auth0 Management APIv2

The Auth0 Management APIv2 can be called from a web application (not a Single Page Application) by embedding the application's client id and client secret in the calls to the Auth0 Management APIv2 endpoints.

* [Management APIv2 Explorer page](/api/v2)
* [Management APIv2 vs APIv1 and some discussion of authorization and scopes](/api/v2/changes)

### Calling the Auth0 Authentication API endpoints

The Auth0 Authentication API endpoints provide a rich set of features for authenticating users, retrieving tokens, refreshing tokens, and obtaining tokens with which to call other APIs. This API provides the /authorize, /userinfo, /tokeninfo, /delegation, and  impersonation endpoints.

* [Auth0 authentication API](/auth-api)

### Calling the API of the social provider through which the user authenticated

* [Sample of what to do once the user is logged in](/what-to-do-once-the-user-is-logged-in/index)

### Calling an API developed by a customer

This is best done by registering the API in Auth0 and obtaining a delegation token with which to call the API.

* [Sequence Diagrams illustrating flow](/sequence-diagrams)

### Logout

* [Discussion of clearing cookies set by auth0, use of the returnTo parm](/logout)

### Account Linking

* [How to link accounts and impact on user profile and tokens](/link-accounts)


text:
<?php

namespace Gilles\UserRestBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class GillesUserRestBundle extends Bundle
{
}


text:
      <form class="toc-filter">

        <input type="text" id="toc_filter_input" placeholder="Enter here to filter..." onkeypress="if(event.keyCode==13) {return false;}">
      </form>

                    Api Documentation


text:
workspace( "GUCEF_exe_gucefPATCHERAPP_TestApp" )

  platforms( { "ALL" } )

  location( "projects\premake5\targets" )

  --
  -- Includes for all modules in the solution:
  --

filter "ALL"
  include( "platform/gucefCORE" )
  include( "platform/gucefLOADER" )
  include( "platform/gucefMT" )
  include( "tests/gucefPATCHERAPP_TestApp" )


text:
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.

#pragma once

class FCameraDetails : public IDetailCustomization
{
public:
	/** Makes a new instance of this detail layout class for a specific detail view requesting it */
	static TSharedRef<IDetailCustomization> MakeInstance();

	/** IDetailCustomization interface */
	virtual void CustomizeDetails( IDetailLayoutBuilder& DetailLayout ) override;

private:
	void OnAspectRatioChanged();
	TOptional<float> GetAspectRatio() const;
	void OnAspectRatioSpinnerChanged(float InValue);
	void UpdateAspectTextFromProperty();
	TSharedRef<SWidget> OnGetComboContent() const;
	void CommitAspectRatioText(FText ItemText);
	void OnCommitAspectRatioText(const FText& ItemFText, ETextCommit::Type CommitInfo);

	EVisibility ProjectionModeMatches(TSharedPtr<IPropertyHandle> Property, ECameraProjectionMode::Type DesiredMode) const;

	TSharedPtr<IPropertyHandle> AspectRatioProperty;
	TSharedPtr<SEditableTextBox> AspectTextBox;
	float LastParsedAspectRatioValue;

	static const float MinAspectRatio;
	static const float MaxAspectRatio;
	static const float LowestCommonAspectRatio;
	static const float HighestCommonAspectRatio;
};


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Threading.Tasks;
using AutoMapper;
using GamesStore.Common;
using GamesStore.Common.Admin.BindingModels;
using GamesStore.Common.Admin.ViewModels;
using GamesStore.Data;
using GamesStore.Models;
using GamesStore.Services.Interfaces;
using GamesStore.Web.Common;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;

namespace GamesStore.Web.Areas.Admin.Controllers
{
    public class GamesController : AdminController
    {
        private IGamesService gameService;

        public GamesController(IMapper mapper, GamesStoreContext context, IGamesService gamesService) : base(mapper, context)
        {
            this.gameService = gamesService;
        }

        [HttpGet]
        public IActionResult Add()
        {
            var categories = context.Categories.Select(x => x.Name).ToList();
            var model = new GameBindingModel();

            foreach (var c in categories)
            {
                model.Categories.Add(new SelectListItem(c, c));
            }

            return View(model);
        }

        [HttpPost]
        public IActionResult Add(GameBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return View();
            }

            var category = context.Categories.FirstOrDefault(x => x.Name == model.Category);

            var game = mapper.Map<Game>(model);
            game.CategoryId = category.Id;

            var gameInDb =
                context.Games.FirstOrDefault(x => x.Name.Trim().Equals(model.Name.Trim(), StringComparison.OrdinalIgnoreCase));

            if (gameInDb == null)
            {
                context.Games.Add(game);
            }
            else
            {
                TempData["exists"] = "Game Exists!";
                return RedirectToAction("Add");
            }
            context.SaveChanges();

            return RedirectToAction("Details", "Games", new { game.Id });

        }

        [HttpGet]
        public IActionResult Details(string id)
        {
            var game = gameService.GetGame(id);

            if (game == null)
            {
                return NotFound();
            }

            return this.View(game);
        }

        [HttpGet]
        public IActionResult Edit(string id)
        {
            var game = context.Games.Find(id);

            if (game == null)
            {
                return NotFound();
            }

            var categories = context.Categories.ToList();
            var gameModel = mapper.Map<GameViewModel>(game);
            var list = new List<SelectListItem>();

            foreach (var c in categories)
            {
                list.Add(new SelectListItem(c.Name, c.Id));
            }

            ViewBag.Categories = list;

            return View(gameModel);
        }

        [HttpPost]
        public IActionResult Edit(GameBindingModel gameBindingModel)
        {
            if (!ModelState.IsValid)
            {
                var categories = context.Categories.ToList();

                var list = new List<SelectListItem>();

                foreach (var c in categories)
                {
                    list.Add(new SelectListItem(c.Name, c.Id));
                }

                ViewBag.Categories = list;
                return View();
            }

            var game = mapper.Map<Game>(gameBindingModel);
            game.CategoryId = gameBindingModel.Category;

            context.Entry(game).State = EntityState.Modified;
            context.SaveChanges();

            return RedirectToAction("Details", new { id = game.Id });
        }

        public IActionResult Delete(string id)
        {
            var game = context.Games.Find(id);

            if (context.CartItems.Any(x => x.ProductId == game.Id))
            {
                TempData["inUseByUser"] = "Cannot delete game that is used by user";
                return RedirectToAction("Index", "Home");
            }

            context.Games.Remove(game);
            context.SaveChanges();
            return RedirectToAction("Index", "Home");
        }

    }
}


text:
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 * vim: set ts=8 sw=4 et tw=99:
 */

#include "tests.h"

const size_t N = 1000;
static jsval argv[N];

static JSBool
constructHook(JSContext *cx, JSObject *thisobj, uintN argc, jsval *argv, jsval *rval)
{
    // Check that arguments were passed properly from JS_New.
    JSObject *callee = JSVAL_TO_OBJECT(JS_ARGV_CALLEE(argv));
    if (!thisobj) {
        JS_ReportError(cx, "test failed, null 'this'");
        return false;
    }
    if (strcmp(JS_GET_CLASS(cx, thisobj)->name, "Object") != 0) {
        JS_ReportError(cx, "test failed, wrong class for 'this'");
        return false;
    }
    if (argc != 3) {
        JS_ReportError(cx, "test failed, argc == %d", argc);
        return false;
    }
    if (!JSVAL_IS_INT(argv[2]) || JSVAL_TO_INT(argv[2]) != 2) {
        JS_ReportError(cx, "test failed, wrong value in argv[2]");
        return false;
    }
    if (!JS_IsConstructing(cx)) {
        JS_ReportError(cx, "test failed, not constructing");
        return false;
    }

    // Perform a side-effect to indicate that this hook was actually called.
    if (!JS_SetElement(cx, callee, 0, &argv[0]))
        return false;

    *rval = OBJECT_TO_JSVAL(callee); // return the callee, perversely
    argv[0] = argv[1] = argv[2] = JSVAL_VOID;  // trash the argv, perversely
    return true;
}

BEGIN_TEST(testNewObject_1)
{
    jsval v;
    EVAL("Array", &v);
    JSObject *Array = JSVAL_TO_OBJECT(v);

    // With no arguments.
    JSObject *obj = JS_New(cx, Array, 0, NULL);
    CHECK(obj);
    jsvalRoot rt(cx, OBJECT_TO_JSVAL(obj));
    CHECK(JS_IsArrayObject(cx, obj));
    jsuint len;
    CHECK(JS_GetArrayLength(cx, obj, &len));
    CHECK(len == 0);

    // With one argument.
    argv[0] = INT_TO_JSVAL(4);
    obj = JS_New(cx, Array, 1, argv);
    CHECK(obj);
    rt = OBJECT_TO_JSVAL(obj);
    CHECK(JS_IsArrayObject(cx, obj));
    CHECK(JS_GetArrayLength(cx, obj, &len));
    CHECK(len == 4);

    // With N arguments.
    for (size_t i = 0; i < N; i++)
        argv[i] = INT_TO_JSVAL(i);
    obj = JS_New(cx, Array, N, argv);
    CHECK(obj);
    rt = OBJECT_TO_JSVAL(obj);
    CHECK(JS_IsArrayObject(cx, obj));
    CHECK(JS_GetArrayLength(cx, obj, &len));
    CHECK(len == N);
    CHECK(JS_GetElement(cx, obj, N - 1, &v));
    CHECK_SAME(v, INT_TO_JSVAL(N - 1));

    // With JSClass.construct.
    static JSClass cls = {
        "testNewObject_1",
        0,
        JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
        JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL,
        NULL, NULL, NULL, constructHook, NULL, NULL, NULL, NULL
    };
    JSObject *ctor = JS_NewObject(cx, &cls, NULL, NULL);
    CHECK(ctor);
    jsvalRoot rt2(cx, OBJECT_TO_JSVAL(ctor));
    obj = JS_New(cx, ctor, 3, argv);
    CHECK(obj);
    CHECK(obj == ctor);  // constructHook returns ctor, perversely
    CHECK(JS_GetElement(cx, ctor, 0, &v));
    CHECK_SAME(v, JSVAL_ZERO);
    CHECK_SAME(argv[0], JSVAL_ZERO);  // original argv should not have been trashed
    CHECK_SAME(argv[1], JSVAL_ONE);
    return true;
}
END_TEST(testNewObject_1)


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

<title>org.apache.cassandra.db.compaction Class Hierarchy (apache-cassandra API)</title>
<meta name="date" content="2015-06-18">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Hierarchy For Package org.apache.cassandra.db.compaction

Package Hierarchies:

All Packages

Class Hierarchy

java.lang.Object

org.apache.cassandra.db.compaction.AbstractCompactedRow (implements java.io.Closeable)

org.apache.cassandra.db.compaction.LazilyCompactedRow (implements java.lang.Iterable<T>)

org.apache.cassandra.db.compaction.PrecompactedRow

org.apache.cassandra.db.compaction.AbstractCompactionStrategy

org.apache.cassandra.db.compaction.DateTieredCompactionStrategy

org.apache.cassandra.db.compaction.LeveledCompactionStrategy (implements org.apache.cassandra.notifications.INotificationConsumer)

org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy

org.apache.cassandra.db.compaction.CompactionController

org.apache.cassandra.db.compaction.SSTableSplitter.SplitController

org.apache.cassandra.db.compaction.CompactionHistoryTabularData

org.apache.cassandra.db.compaction.CompactionInfo (implements java.io.Serializable)

org.apache.cassandra.db.compaction.CompactionInfo.Holder

org.apache.cassandra.db.compaction.AbstractCompactionIterable (implements java.lang.Iterable<T>)

org.apache.cassandra.db.compaction.CompactionIterable

org.apache.cassandra.db.compaction.ParallelCompactionIterable

org.apache.cassandra.db.compaction.CompactionManager (implements org.apache.cassandra.db.compaction.CompactionManagerMBean)

org.apache.cassandra.db.compaction.DateTieredCompactionStrategyOptions

org.apache.cassandra.db.compaction.LegacyLeveledManifest

org.apache.cassandra.db.compaction.LeveledManifest

org.apache.cassandra.db.compaction.LeveledManifest.CompactionCandidate

org.apache.cassandra.utils.MergeIterator.Reducer<In,Out>

org.apache.cassandra.db.compaction.CompactionIterable.Reducer

org.apache.cassandra.db.compaction.Scrubber (implements java.io.Closeable)

org.apache.cassandra.db.compaction.Scrubber.ScrubResult

org.apache.cassandra.db.compaction.SizeTieredCompactionStrategyOptions

org.apache.cassandra.db.compaction.SSTableSplitter

org.apache.cassandra.db.compaction.SSTableSplitter.StatsCollector (implements org.apache.cassandra.db.compaction.CompactionManager.CompactionExecutorStatsCollector)

java.lang.Throwable (implements java.io.Serializable)

java.lang.Exception

java.lang.RuntimeException

org.apache.cassandra.db.compaction.CompactionInterruptedException

org.apache.cassandra.db.compaction.Upgrader

org.apache.cassandra.utils.WrappedRunnable (implements java.lang.Runnable)

org.apache.cassandra.io.util.DiskAwareRunnable

org.apache.cassandra.db.compaction.AbstractCompactionTask

org.apache.cassandra.db.compaction.CompactionTask

org.apache.cassandra.db.compaction.LeveledCompactionTask

org.apache.cassandra.db.compaction.SSTableSplitter.SplittingCompactionTask

Interface Hierarchy

java.lang.AutoCloseable

java.io.Closeable

org.apache.cassandra.utils.CloseableIterator<T> (also extends java.util.Iterator<E>)

org.apache.cassandra.db.compaction.ICompactionScanner

org.apache.cassandra.db.compaction.CompactionManager.CompactionExecutorStatsCollector

org.apache.cassandra.db.compaction.CompactionManagerMBean

java.util.Iterator<E>

org.apache.cassandra.utils.CloseableIterator<T> (also extends java.io.Closeable)

org.apache.cassandra.db.compaction.ICompactionScanner

Enum Hierarchy

java.lang.Object

java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable)

org.apache.cassandra.db.compaction.OperationType

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2015 The Apache Software Foundation


text:
package com.chobostudy.datastructure

/**
  * Don't edit this.
  *
  * If you want edit to extends it.
  *
  * @author loustler
  * @since 08/11/2017 20:01
  */
trait List[+A] {}

object List extends ListFactory {}

case object Nil extends List[Nothing]
case class Cons[+A](head: A, tail: List[A]) extends List[A] // tail is covariant


text:
package org.brackit.server.node.txnode;

import org.brackit.xquery.util.log.Logger;
import org.brackit.server.metadata.pathSynopsis.NsMapping;
import org.brackit.server.metadata.vocabulary.DictionaryMgr;
import org.brackit.server.node.DocID;
import org.brackit.server.node.XTCdeweyID;
import org.brackit.xquery.atomic.Atomic;
import org.brackit.xquery.atomic.QNm;
import org.brackit.xquery.node.parser.SubtreeHandler;
import org.brackit.xquery.node.parser.SubtreeListener;
import org.brackit.xquery.node.parser.SubtreeProcessor;
import org.brackit.xquery.xdm.DocumentException;
import org.brackit.xquery.xdm.Kind;
import org.brackit.xquery.xdm.Node;

/**
 * @author Sebastian Baechle
 *
 */
public abstract class SubtreeBuilder<E extends TXNode<E>> extends
		SubtreeProcessor<E> implements SubtreeHandler {
	static final Logger log = Logger.getLogger(SubtreeBuilder.class);

	protected final E parent;

	protected final XTCdeweyID rootDeweyID;

	protected final boolean docMode;

	protected final int collectionID;

	protected int nextDocNumber;

	protected TXNode[] stack;

	protected int stackSize;

	protected int level;

	protected XTCdeweyID lastAttributeDeweyID;

	/**
	 * Use this constructor if this builder is used to build a subtree.
	 */
	public SubtreeBuilder(E parent, XTCdeweyID rootDeweyID,
			SubtreeListener<? super E>[] listeners) throws DocumentException {
		super(listeners);
		this.parent = parent;
		this.rootDeweyID = rootDeweyID;
		this.collectionID = rootDeweyID.getDocID().getCollectionID();
		this.docMode = false;
	}

	/**
	 * Use this constructor if this builder is used to build one or more
	 * documents.
	 */
	public SubtreeBuilder(int collectionID, int nextDocNumber,
			SubtreeListener<? super E>[] listeners) throws DocumentException {
		super(listeners);
		this.parent = null;
		this.rootDeweyID = null;
		this.collectionID = collectionID;
		this.nextDocNumber = nextDocNumber;
		this.docMode = true;
	}

	protected abstract E buildElement(E parent, QNm name, XTCdeweyID deweyID)
			throws DocumentException;

	protected abstract E buildDocument(XTCdeweyID deweyID)
			throws DocumentException;

	protected abstract E buildAttribute(E parent, QNm name, Atomic value,
			XTCdeweyID deweyID) throws DocumentException;

	protected abstract E buildText(E parent, Atomic text, XTCdeweyID deweyID)
			throws DocumentException;

	protected abstract E buildComment(E parent, Atomic text, XTCdeweyID deweyID)
			throws DocumentException;

	// TODO check params for PI's
	protected abstract E buildProcessingInstruction(E parent, QNm name,
			Atomic text, XTCdeweyID deweyID) throws DocumentException;

	@Override
	public void startDocument() throws DocumentException {

		try {
			notifyBeginDocument();
		} catch (DocumentException e) {
			notifyFail();
			throw e;
		}
	}

	@Override
	public void endDocument() throws DocumentException {

		try {
			notifyEndDocument();
		} catch (DocumentException e) {
			notifyFail();
			throw e;
		}
	}

	@Override
	public void beginFragment() throws DocumentException {
		try {
			notifyBeginFragment();

			if (docMode) {
				level++;
				lastAttributeDeweyID = null;
				pushNode(Kind.DOCUMENT, null, null);
			}

		} catch (DocumentException e) {
			notifyFail();
			throw e;
		}
	}

	@Override
	public void endFragment() throws DocumentException {
		try {
			notifyEndFragment();

			if (docMode) {
				level--;
				lastAttributeDeweyID = null;

				if (level > 0) {
					throw new DocumentException("Invalid Parser State!");
				}

				if (level < (stackSize - 1)) {
					stack[--stackSize] = null;
				}
			}

		} catch (DocumentException e) {
			notifyFail();
			throw e;
		}
	}

	@Override
	public void begin() throws DocumentException {
		try {
			stack = new TXNode[20];
			stackSize = 0;
			level = 0;
			notifyBegin();
		} catch (DocumentException e) {
			notifyFail();
			throw e;
		}
	}

	@Override
	public void text(Atomic content) throws DocumentException {
		try {
			level++;
			lastAttributeDeweyID = null;
			E node = pushNode(Kind.TEXT, null, content);
			notifyText(node);

			if (level < (stackSize - 1)) {
				stack[--stackSize] = null;
			}
			level--;
		} catch (DocumentException e) {
			notifyFail();
			throw e;
		}
	}

	@Override
	public void comment(Atomic content) throws DocumentException {
		try {
			// root-level comments are not supported yet
			if (level == 0) {
				return;
			}

			level++;
			lastAttributeDeweyID = null;
			E node = pushNode(Kind.COMMENT, null, content);
			notifyComment(node);

			if (level < (stackSize - 1)) {
				stack[--stackSize] = null;
			}
			level--;
		} catch (DocumentException e) {
			notifyFail();
			throw e;
		}
	}

	@Override
	public void processingInstruction(QNm name, Atomic content)
			throws DocumentException {
		try {
			// processing instructions not working yet
			// if (true) {
			// return;
			// }

			level++;
			lastAttributeDeweyID = null;
			E node = pushNode(Kind.PROCESSING_INSTRUCTION, name, content);
			notifyProcessingInstruction(node);

			if (level < (stackSize - 1)) {
				stack[--stackSize] = null;
			}
			level--;
		} catch (DocumentException e) {
			notifyFail();
			throw e;
		}
	}

	@Override
	public void startElement(QNm name) throws DocumentException {
		try {
			level++;
			lastAttributeDeweyID = null;
			// System.err.println("start element: Incremented level to " +
			// level);
			E node = pushNode(Kind.ELEMENT, name, null);

			notifyStartElement(node);
		} catch (DocumentException e) {
			notifyFail();
			throw e;
		}
	}

	public void attribute(QNm name, Atomic value) throws DocumentException {
		XTCdeweyID deweyID = lastAttributeDeweyID;

		if (deweyID == null) {
			XTCdeweyID elementDeweyID = stack[stackSize - 1].getDeweyID();
			deweyID = elementDeweyID.getAttributeRootID().getNewChildID();
		} else {
			deweyID = XTCdeweyID.newBetween(deweyID, null);
		}
		lastAttributeDeweyID = deweyID;

		E node = buildAttribute((E) ((stackSize > 0) ? stack[stackSize - 1]
				: null), name, value, deweyID);

		notifyAttribute(node);
	}

	private E pushNode(Kind kind, QNm name, Atomic text)
			throws DocumentException {
		E node = null;
		XTCdeweyID deweyID = null;

		if (kind == Kind.DOCUMENT) {
			if (stackSize > 1) {
				throw new DocumentException("Invalid Parser State!");
			}

			deweyID = new XTCdeweyID(new DocID(collectionID, nextDocNumber));
			nextDocNumber++;

			stack[0] = null;
			stackSize = 0;

		} else {
			// non document nodes
			if (stackSize == 0) {
				deweyID = rootDeweyID;
			} else {
				if (stackSize == level) // new sibling at this level
				{
					if (docMode && stackSize == 2) {
						// sibling of root node requested
						throw new DocumentException("Invalid Parser State!");
					}

					deweyID = XTCdeweyID.newBetween(
							stack[--stackSize].getDeweyID(), null);
					stack[stackSize] = null;
				} else // first child at this level
				{
					deweyID = stack[stackSize - 1].getDeweyID().getNewChildID();
				}
			}
		}

		E parent = (E) ((stackSize > 0) ? stack[stackSize - 1] : this.parent);

		if (kind == Kind.ELEMENT) {
			node = buildElement(parent, name, deweyID);
		} else if (kind == Kind.TEXT) {
			node = buildText(parent, text, deweyID);
		} else if (kind == Kind.COMMENT) {
			node = buildComment(parent, text, deweyID);
		} else if (kind == Kind.PROCESSING_INSTRUCTION) {
			node = buildProcessingInstruction(parent, name, text, deweyID);
		} else if (kind == Kind.DOCUMENT) {
			node = buildDocument(deweyID);
		}

		if (++stackSize == stack.length) {
			E[] newStack = (E[]) new Node[(stackSize * 3) / 2 + 1];
			System.arraycopy(stack, 0, newStack, 0, stack.length);
			stack = newStack;
		}
		stack[stackSize - 1] = node;

		return node;
	}

	@Override
	public void endElement(QNm name) throws DocumentException {
		try {
			notifyEndElement((E) stack[level - 1]);

			level--;
			lastAttributeDeweyID = null;
			// System.err.println("end element: Decremented level to " + level);

			if (level < (stackSize - 1)) {
				stack[--stackSize] = null;
			}
		} catch (DocumentException e) {
			notifyFail();
			throw e;
		}
	}

	@Override
	public void end() throws DocumentException {
		try {
			notifyEnd();
		} catch (DocumentException e) {
			notifyFail();
			throw e;
		}
	}

	@Override
	public void fail() throws DocumentException {
		notifyFail();
	}
}


text:
#ifndef QWINDOWSURFACE_VG_P_H
#define QWINDOWSURFACE_VG_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <QtGui/private/qwindowsurface_p.h>

QT_BEGIN_NAMESPACE

#if !defined(QT_NO_EGL)

class QVGEGLWindowSurfacePrivate;

class Q_OPENVG_EXPORT QVGWindowSurface : public QWindowSurface, public QPaintDevice
{
public:
    QVGWindowSurface(QWidget *window);
    QVGWindowSurface(QWidget *window, QVGEGLWindowSurfacePrivate *d);
    ~QVGWindowSurface();

    QPaintDevice *paintDevice();
    void flush(QWidget *widget, const QRegion &region, const QPoint &offset);

#if !defined(Q_WS_QPA)
    void setGeometry(const QRect &rect);
#else
	void resize(const QSize &size);
#endif

    bool scroll(const QRegion &area, int dx, int dy);

    void beginPaint(const QRegion &region);
    void endPaint(const QRegion &region);

    QPaintEngine *paintEngine() const;

    WindowSurfaceFeatures features() const;

protected:
    int metric(PaintDeviceMetric metric) const;

private:
    QVGEGLWindowSurfacePrivate *d_ptr;
};

#endif

QT_END_NAMESPACE

#endif // QWINDOWSURFACE_VG_P_H


text:
/*
 * Fragment.h
 *
 *  Created on: 2014
 *      Author: jc
 */
#pragma once

#include <string>

#include "Parser.h"

namespace RedZone {

class RZ_API Fragment {
public:
    Fragment( std::string const & rawText );

    std::string cleanFragment() const;

    ElementType type() const;

    std::string raw() const;
    std::string clean() const;

    virtual ~Fragment();

protected:
    std::string m_rawText;
    std::string m_cleanText;
};

} /* namespace RedZone */


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>douban</title>


text:
class CreateEntityMaintenanceEntities < ActiveRecord::Migration
  def change
    create_table :entity_maintenance_entities do |t|
      t.string :type

      t.string :first_name
      t.string :middle_name
      t.string :last_name
      t.string :prefix

      t.string :name
      t.string :industry

      t.timestamps
    end
  end
end


text:
package org.apache.sis.io.wkt;

/**
 * Whether WKT keywords shall be written with lower, upper or camel case styles.
 * The most common usage for WKT keywords is upper case.
 * However with version 2 of Well Known Text, camel case keywords may be easier to read
 * because WKT 2 has more keywords made by combination of words. Examples:
 *
 *

 *
WKT element case comparisons

 *
Upper case	                 Camel case

 *
{@code TIMEEXTENT}	         {@code TimeExtent}

 *
{@code ANGLEUNIT}	          {@code AngleUnit}

 *
{@code BASEGEODCRS}	        {@code BaseGeodCRS}

 *
{@code DERIVINGCONVERSION}	 {@code DerivingConversion}

 *
{@code ENGINEERINGDATUM}	   {@code EngineeringDatum}

 *

 *
 *
Note:
 * Well-Known Text keywords are case insensitive at parsing time. {@code KEYWORD} is equivalent to
 * {@code keyword} is equivalent to {@code KeyWord} and to {@code kEYwORd}.

 *
 * @author  Martin Desruisseaux (Geomatys)
 * @version 0.6
 * @since   0.4
 * @module
 */
public enum KeywordCase {
    /**
     * WKT formatting uses lower case keywords.
     */
    LOWER_CASE,

    /**
     * WKT formatting uses upper case keywords.
     * This is the most usual case in WKT 1 strings.
     */
    UPPER_CASE,

    /**
     * WKT formatting uses CamelCase keywords. This is more useful in WKT 2 strings, which
     * use longer keywords than WKT 1 did. Examples: {@code "TimeExtent"}, {@code "AngleUnit"}.
     */
    CAMEL_CASE,

    /**
     * Keywords case is determined by the WKT {@linkplain Convention convention}.
     * The current mapping is:
     *
     *

     *
Well Known Text version 2 uses camel case.

     *
Well Known Text version 1 uses upper case.

     *

     */
    DEFAULT
}


text:
namespace Services.Packages
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using Chains;
    using Chains.Play.Modules;
    using Platform.Runtime;
    using Platform.Runtime.Extensions.Xml;
    using Services.Management.Administration.Server;
    using Services.Management.Administration.Worker;
    using Services.Packages.Update;
    using Services.Communication.Protocol;

    public sealed class Repository : Chain<Repository>, IModular
    {
        public readonly WorkUnitContext workUnitContext;

        public List<AbstractChain> Modules { get; set; }

        public readonly string BaseFolder;

        public Repository(string baseFolder = null, WorkUnitContext workUnitContext = null)
        {
            this.workUnitContext = workUnitContext;
            BaseFolder = baseFolder;
            Modules = new List<AbstractChain>();

            if (string.IsNullOrWhiteSpace(baseFolder))
            {
                var adminData = workUnitContext.AdminServer.Do(new GetAdministratorData());

                baseFolder = adminData.DataFolder + "XmlDatabases" + Path.DirectorySeparatorChar
                    + workUnitContext.WorkerData.Id + Path.DirectorySeparatorChar;

                if (!Directory.Exists(baseFolder))
                {
                    Directory.CreateDirectory(baseFolder);
                }
            }

            if (string.IsNullOrWhiteSpace(XmlConnection.SchemaPath))
            {
                XmlConnection.SchemaPath = AppDomain.CurrentDomain.BaseDirectory + "schema.dbxml";
                XmlConnection.UseMemoryOperationsOnly = false;
            }

            Platform.Module.Packages.ModuleSqlProviderType = SqlProviderType.Xml;
            Platform.Module.Packages.ModuleConnectionString = baseFolder + "services.packages.database.dbxml";

            if (workUnitContext != null)
            {
                var dbPackages = Package.SearchByPackageName("*");
                if (dbPackages.Count > 0)
                {
                    workUnitContext.LogLine("Repository has been initialized at '{0}'.", Sql.ConnectionString);

                    var packageInThisRepo = "Packages included in this repo:\n"
                        + string.Join("\n", dbPackages.Select(x => x.PackageName).Distinct()) + "\n";

                    workUnitContext.LogLine(packageInThisRepo);
                }

                var dbLocalPackages = LocalPackage.SearchByPackageName("*");
                if (dbLocalPackages.Count > 0)
                {
                    workUnitContext.LogLine("Application repo has loaded at '{0}'.", Sql.ConnectionString);

                    var packageInThisRepo = "Packages exist in this app:\n"
                        + string.Join("\n", dbLocalPackages.Select(x => x.PackageName).Distinct()) + "\n";

                    workUnitContext.LogLine(packageInThisRepo);
                }
            }
        }

        internal string ToFile(PackageDescription package)
        {
            return BaseFolder + "Repo" + Path.DirectorySeparatorChar + package.PackageName
                + Path.DirectorySeparatorChar + package.Id + "." + package.VersionLabel + ".zip";
        }

        public Repository RegisterPackage(string name)
        {
            name = name.Trim();

            var dbPackages = LocalPackage.SearchByPackageNamePaged(name, 0, 1);
            if (dbPackages.Count == 0)
            {
                new LocalPackage
                {
                    PackageName = name
                }.Create();

                if (workUnitContext != null)
                {
                    workUnitContext.LogLine("Package '{0}' has been registered.", name);
                }
            }

            return this;
        }
    }
}


text:
set -u

keyspace=${KEYSPACE:-'test_keyspace'}
shard=${SHARD:-'0'}
uid=$1

printf -v alias '%s-%010d' $CELL $uid
printf -v tablet_dir 'vt_%010d' $uid

tablet_role='replica'
if [ "$uid" = "1" ]; then
    tablet_role='master'
fi

dbconfig_dba_flags="\
    -db-config-dba-uname root \
    -db-config-dba-charset utf8"

dbconfig_flags="$dbconfig_dba_flags \
    -db-config-app-uname root \
    -db-config-app-charset utf8 \
    -db-config-appdebug-uname root \
    -db-config-appdebug-charset utf8 \
    -db-config-allprivs-uname root \
    -db-config-allprivs-charset utf8 \
    -db-config-repl-uname root \
    -db-config-repl-charset utf8 \
    -db-config-filtered-uname root \
    -db-config-filtered-charset utf8"

init_db_sql_file="$VTROOT/init_db.sql"
echo "GRANT ALL ON *.* TO 'root'@'%';" > $init_db_sql_file

if [ "$tablet_role" = "master" ]; then
    echo "CREATE DATABASE vt_$keyspace;" >> $init_db_sql_file
fi

export EXTRA_MY_CNF=$VTROOT/config/mycnf/master_mysql56.cnf

mkdir -p $VTDATAROOT/backups

echo "Starting MySQL for tablet..."
action="init -init_db_sql_file $init_db_sql_file"
if [ -d $VTDATAROOT/$tablet_dir ]; then
  echo "Resuming from existing vttablet dir:"
  echo "    $VTDATAROOT/$tablet_dir"
  action='start'
fi

$VTROOT/bin/mysqlctl \
  -log_dir $VTDATAROOT/tmp \
  -tablet_uid $uid \
  $dbconfig_dba_flags \
  -mysql_port 3306 \
  $action &

wait

$VTROOT/bin/vtctl $TOPOLOGY_FLAGS AddCellInfo -root vitess/$CELL -server_address consul1:8500 $CELL

$VTROOT/bin/vtctl $TOPOLOGY_FLAGS CreateKeyspace $keyspace
$VTROOT/bin/vtctl $TOPOLOGY_FLAGS CreateShard $keyspace/$shard

$VTROOT/bin/vtctl $TOPOLOGY_FLAGS InitTablet -shard $shard -keyspace $keyspace -allow_master_override $alias $tablet_role

echo "Starting vttablet..."
exec $VTROOT/bin/vttablet \
  $TOPOLOGY_FLAGS \
  -logtostderr=true \
  -tablet-path $alias \
  -tablet_hostname "" \
  -health_check_interval 5s \
  -enable_semi_sync \
  -enable_replication_reporter \
  -port $WEB_PORT \
  -grpc_port $GRPC_PORT \
  -service_map 'grpc-queryservice,grpc-tabletmanager,grpc-updatestream' \
  -pid_file $VTDATAROOT/$tablet_dir/vttablet.pid \
  -vtctld_addr http://vtctld:$WEB_PORT/ \
  $dbconfig_flags


text:
using UnityEngine;
using System;
using System.Collections.Generic;

namespace CreateThis.Unity {
    public static class MaterialCache {
        private struct Key : IEquatable<Key> {
            public float r;
            public float g;
            public float b;
            public float a;
            public bool renderMesh;
            public bool renderWireframe;
            public bool renderNormals;
            public int textureCacheId;

            public bool Equals(Key other) {
                return r == other.r &&
                       g == other.g &&
                       b == other.b &&
                       a == other.a &&
                       renderMesh == other.renderMesh &&
                       renderWireframe == other.renderWireframe &&
                       renderNormals == other.renderNormals &&
                       textureCacheId == other.textureCacheId;
            }

            public override int GetHashCode() {
                return r.GetHashCode() ^ g.GetHashCode() ^ b.GetHashCode() ^ a.GetHashCode() ^ renderMesh.GetHashCode() ^ renderWireframe.GetHashCode() ^ renderNormals.GetHashCode() ^ textureCacheId.GetHashCode();
            }
        }
        private static int materialCount;
        private static Dictionary<Key, Material> cache;

        private static void Initialize() {
            if (cache == null) {
                cache = new Dictionary<Key, Material>();
                materialCount = 0;
            }
        }

        private static string ColorToString(Color color) {
            Color32 color32 = color;
            string hex = color32.r.ToString("X2") + color32.g.ToString("X2") + color32.b.ToString("X2");
            return hex;
        }

        private static Key ColorAndStatesToKey(Color color, bool renderMesh, bool renderWireframe, bool renderNormals, int textureCacheId = -1) {
            Key key = new Key();
            key.r = color.r;
            key.g = color.g;
            key.b = color.b;
            key.a = color.a;
            key.renderMesh = renderMesh;
            key.renderWireframe = renderWireframe;
            key.renderNormals = renderNormals;
            key.textureCacheId = textureCacheId;
            return key;
        }

        private static Material ColorAndStateToMaterial(Color color, bool renderMesh, bool renderWireframe, bool renderNormals, int textureCacheId = -1) {
            Material materialInstance;

#if AMAZING_WIREFRAME_SHADER
            if (renderMesh) {
                materialInstance = new Material(Shader.Find("VacuumShaders/The Amazing Wireframe/Geometry Shader"));
            } else {
                materialInstance = new Material(Shader.Find("Hidden/VacuumShaders/The Amazing Wireframe/Geometry Shader/Transparent/Simple/Diffuse"));
                materialInstance.SetInt("_Cull", 0);
                if (textureCacheId == -1) color.a = 0;
            }
#else
            materialInstance = new Material(Shader.Find("Standard"));
#endif

            materialInstance.SetColor("_Color", color);
            materialInstance.EnableKeyword("_EMISSION");
            Color wireframe = new Color();
            ColorUtility.TryParseHtmlString("#15FF3DFF", out wireframe);

            if (!renderWireframe) {
                wireframe.a = 0;
                materialInstance.SetFloat("_NHeight", 0);
                materialInstance.SetFloat("_NScale", 0);
            }

            if (renderNormals) {
                if (renderWireframe) {
                    materialInstance.SetFloat("_NHeight", 0.025f);
                    materialInstance.SetFloat("_NScale", 0.001f);
                }
            } else {
                materialInstance.SetFloat("_NHeight", 0);
                materialInstance.SetFloat("_NScale", 0);
            }

            materialInstance.SetColor("_V_WIRE_Color", wireframe);
            materialInstance.SetColor("_NColor", wireframe);

            materialInstance.name = "Material" + materialCount;
            if (textureCacheId != -1) {
                Texture2D mainTexture = TextureCache.TextureById(textureCacheId);
                materialInstance.mainTexture = mainTexture;
            }
            materialCount++;
            return materialInstance;
        }

        public static Material MaterialByColor(Color color, bool renderMesh, bool renderWireframe, bool renderNormals, int textureCacheId = -1) {
            Initialize();

            Key key = ColorAndStatesToKey(color, renderMesh, renderWireframe, renderNormals, textureCacheId);
            if (cache.ContainsKey(key)) return cache[key];

            Material material = ColorAndStateToMaterial(color, renderMesh, renderWireframe, renderNormals, textureCacheId);
            cache.Add(key, material);
            return material;
        }
    }
}


text:
require "spec_helper"

describe Mongoid::Persistence do

  before do
    @person = Person.new(:title => "Sir", :ssn => "6969696", :pets => true)
  end

  after do
    @person.delete
  end

  describe ".create" do

    it "saves and returns the document" do
      person = Person.create(:title => "Sensei", :ssn => "666-66-6666")
      person.should be_a_kind_of(Person)
      person.should_not be_a_new_record
    end

  end

  describe ".create!" do

    context "inserting with a field that is not unique" do

      context "when a unique index exists" do

        after do
          Person.delete_all
        end

        it "raises an error" do
          Person.create!(:ssn => "555-55-9999")
          lambda { Person.create!(:ssn => "555-55-9999") }.should raise_error
        end

      end

    end

  end

  describe "#delete" do

    context "deleting a root document" do

      before do
        @person.save
      end

      it "deletes the document" do
        @person.delete
        lambda { Person.find(@person.id) }.should raise_error
      end

      it "returns true" do
        @person.delete.should be_true
      end

    end

    context "deleting an embedded document" do

      before do
        @address = Address.new(:street => "Bond Street")
        @person.addresses << @address
      end

      context "when the document is not yet saved" do

        it "removes the document from the parent" do
          @address.delete
          @person.addresses.should be_empty
          @person.attributes[:addresses].should be_empty
        end

      end

      context "when the document has been saved" do

        before do
          @address.save
        end

        it "removes the object from the parent and database" do
          @address.delete
          from_db = Person.find(@person.id)
          from_db.addresses.should be_empty
        end

      end

    end

  end

  describe "#destroy" do

    context "destroying a root document" do

      before do
        @person.save
      end

      it "destroys the document" do
        @person.destroy
        lambda { Person.find(@person.id) }.should raise_error
      end

      it "returns true" do
        @person.destroy.should be_true
      end

    end

    context "deleting an embedded document" do

      before do
        @address = Address.new(:street => "Bond Street")
        @person.addresses << @address
      end

      context "when the document is not yet saved" do

        it "removes the document from the parent" do
          @address.destroy
          @person.addresses.should be_empty
          @person.attributes[:addresses].should be_empty
        end

      end

      context "when the document has been saved" do

        before do
          @address.save
        end

        it "removes the object from the parent and database" do
          @address.destroy
          from_db = Person.find(@person.id)
          from_db.addresses.should be_empty
        end
      end
    end
  end

  describe "#save" do

    context "when validation passes" do

      it "returns true" do
        @person.save.should be_true
      end

    end

  end

  describe "save!" do

    context "inserting with a field that is not unique" do

      context "when a unique index exists" do

        it "raises an error" do
          Person.create!(:ssn => "555-55-9999")
          person = Person.new(:ssn => "555-55-9999")
          lambda { person.save!(:ssn => "555-55-9999") }.should raise_error
        end

      end

    end

  end

  describe "#update_attributes" do

    before do
      @person.save
    end

    context "when validation passes" do

      it "returns true" do
        @person.update_attributes(:ssn => "555-55-1234").should be_true
      end

      it "saves the attributes" do
        @person.update_attributes(:ssn => "555-55-1235", :pets => false, :title => nil)
        @from_db = Person.find(@person.id)
        @from_db.ssn.should == "555-55-1235"
        @from_db.pets.should == false
        @from_db.title.should be_nil
      end
    end
  end

  describe "#delete_all" do

    before do
      @person.save
    end

    it "deletes all the documents" do
      Person.delete_all
      Person.count.should == 0
    end

    it "returns the number of documents deleted" do
      Person.delete_all.should == 1
    end
  end

  describe "#destroy_all" do

    before do
      @person.save
    end

    it "destroys all the documents" do
      Person.destroy_all
      Person.count.should == 0
    end

    it "returns the number of documents destroyed" do
      Person.destroy_all.should == 1
    end
  end
end


text:
// Copyright (c) 2012 Ecma International.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
es5id: 10.5-1-s
description: Strict Mode - arguments object is immutable
flags: [onlyStrict]
---*/

assert.throws(SyntaxError, function() {
            (function fun() {
                eval("arguments = 10");
            })(30);
});


text:
@import url(https://fonts.googleapis.com/css?family=EB+Garamond);

body, html {
	width: 100%;
	height: 100%;
	overflow: scroll;
	margin: 0px;
	padding: 0px;
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
}

/* SVG elements */

.date_label {
	font-family: Gill Sans, sans-serif;
	font-size: 1.0em;
	dominant-baseline: middle;
	cursor: default;
}

.song_title_text {
	font-family: Gill Sans,sans-serif;
	font-size:1.0em;
	cursor: default;
	text-anchor: middle;
}

.artist_name_text {
	text-anchor: start;
	font-family: Gill Sans,sans-serif;
	font-size:2.0em;
	cursor: default;
}

.chart_name_label {
	font-family: "Gill Sans";
	font-weight: 600;
	text-transform: uppercase;
	font-variant: small-caps;
	font-size: 0.8em;
	alignment-baseline: middle;
	cursor: default;
}

.speed_label {
	font-family: "Gill Sans";
	font-weight: 200;
	text-transform: uppercase;
	font-variant: small-caps;
	font-size: 0.8em;
	alignment-baseline: middle;
	cursor: pointer;
}

.speed_label_selected {
	font-weight:400;
}

/* Style for ranking axis in main visualization (1 - 100, represented by white gridlines */
.rank_axis {
	shape-rendering: crispEdges;
}

.rank_axis text {
	font: 10px sans-serif;
	fill: #000;
	cursor: default;
}

.rank_axis line,
.rank_axis path {
	fill: none;
	stroke: none;
}

/* Styles for lines/axes representing top music charts in each country */
.rankings_us {
	stroke: #b3cde3;
}

.rankings_uk {
	stroke: #ccebc5;
}

.rankings_jp {
	stroke: #fbb4ae;
}

/* Styles for artist country origin */
.artist_us {
	fill: #377eb8;
}

.artist_uk {
	fill: #4daf4a;
}

.artist_japan {
	fill: #e41a1c;
}

.artist_unassigned {
	fill: #000000;
}

.artist_deselect {
	fill: #CECECE;
	opacity: 0.05;
}

/* Styles for time axis in main visualization */
.time_axis path,
.time_axis line {
	fill: none;
	stroke: black;
	shape-rendering: crispEdges;
}

.time_axis text {
	font-family: Gill Sans, sans-serif;
	font-size: 1.0em;
	font-weight: 100;
	cursor: default;
}

.animation_time_axis path,
.animation_time_axis line {
	fill: none;
	stroke: #CCC;
	shape-rendering: crispEdges;
}

.animation_time_axis text {
	font-family: Gill Sans, sans-serif;
	font-size: 1.0em;
	font-weight: 100;
	cursor: default;
}

/* Page structure */
#wrapper {
	width: 100%;
	min-height: 600px;
	height: 100vh;
	overflow-x: hidden;
	margin: 0px;
	padding: 0px;
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
}

#header {
	width: 100%;
	margin: 0px;
	padding: 25px;
	flex: 0 0 auto;
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	text-align: left;
	border-bottom: 5px solid #EEE;
	display: flex;
	flex-direction: row;
}

#title_block {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
}

.title {
	font-family: Gill Sans, sans;
	line-height:100%;
	text-transform: lowercase;
	font-weight: 100;
	font-variant: small-caps;
	font-size: 4.0em;
	margin: 5px 0px 5px 0px;
	padding: 0px;
	flex: 1;
	align-self: flex-start;
	cursor: default;
}

.subtitle {
	font-family: Gill Sans, sans;
	line-height:100%;
	font-weight: 100;
	font-size: 1.4em;
	margin: 5px 0px 20px 0px;
	padding: 0px;
	flex: 1;
	align-self: flex-start;
	cursor: default;
}

#navigation_block {
	flex: 0 1 auto;
	display: flex;
	flex-direction: row;
	justify-content: flex-end;
	align-items: center;
}

.navigation_item {
	margin: 0px 25px 0px 25px;
	padding: 0px;
	flex: 0 1 auto;
	font-family: Gill Sans, sans;
	line-height:100%;
	text-transform: lowercase;
	font-weight: 100;
	font-variant: small-caps;
	font-size: 2.0em;
}

.navigation_item:hover {
	border-bottom: 8px solid steelblue;
}

.navigation_item a:link,
.navigation_item a:visited {
	color: steelblue;
	text-decoration: none;
}

#countries {
	position: relative;
	background: #F9F9F9;
	margin: 0px;
	padding: 0px;
	flex: 0 0 auto;
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
}

.page_division {
	flex: 0 0 auto;
	flex-direction: row;
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	margin: 0px;
	padding: 25px;
	font-family: Gill Sans, sans;
	line-height:100%;
	text-transform: lowercase;
	font-weight: 400;
	font-variant: small-caps;
	font-size: 3.0em;
	color: steelblue;
	border-bottom: 2px solid #EEE;
	border-top: 2px solid #EEE;
}

.section_header {
	font-family: Gill Sans, sans;
	line-height:100%;
	text-transform: lowercase;
	font-weight: 400;
	font-variant: small-caps;
	font-size: 2.0em;
	margin: 5px 0px 20px 0px;
}

.section_subheader {
	font-family: Gill Sans, sans;
	line-height:100%;
	font-weight: 200;
	font-style: italic;
	font-size: 1.4em;
	margin: 5px 0px 20px 0px;
}

.content_row {
	display: flex;
	flex: 0 0 auto;
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: space-between;
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	margin-top: 25px;
}

.page_division + .content_row {
	margin: 0px;
}

.content_section {
	flex: 1;
	background: #F9F9F9;
	padding: 25px;
	margin: 0px;
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
}

.text_block {
	width:100%;
	font-family: EB Garamond, serif;
	line-height:150%;
	font-weight: 100;
	font-size: 1.2em;
	margin: 5px 0px 20px 0px;
	text-align: justify;
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
}

.text_block a:link,
.text_block a:visited {
	color: #CC3300;
	text-decoration: none;
}

.text_block a:hover {
	text-decoration: underline;
}

#artists {
	flex: 0 0 auto;
	background: #F9F9F9;
	padding: 25px;
	margin: 0px;
	width: 100%;
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	position: relative;
}

#artist_select_wrapper {
	display: flex;
	flex-direction: row;
	row-wrap: nowrap;
}

#artist_select {
	flex: 0 1 25%;
	min-width:25%;
}

#artist_svg_wrapper {
	flex: 0 0 75%;
	position: relative;
}

.input_artist_search {
	width: 90%;
	padding: 10px;
	border: none;
	transition: border 0.3s;
	font-family: Gill Sans,sans-serif;
	font-size:1.2em;
	font-style: italic;
	font-weight: 400;
	border-bottom: solid 5px #ffcc66;
	background: #EEEEEE;
	color: #999999;
}

/* Style for autocomplete search with individual artist history data */
#autocomplete_container {
	z-index: 500;
	width: 200px;
	max-height: 200px;
	margin: 0px;
	padding: 0px;
	visibility: hidden;
	position: absolute;
	overflow-y: scroll;
	top: 0px;
	left: 0px;
}

.autocomplete_row {
	margin: 0px;
	padding: 5px;
	display: block;
	cursor: pointer;
	font-family: Gill Sans, sans;
	line-height:125%;
	font-weight: 100;
	font-size: 1.2em;
	background: rgba(204,204,204,0.95);
}

.autocomplete_row:hover {
	background: steelblue;
	color: #FFF;
}

/* Miscellaneous page elements */
.loading {
	position: relative;
	left: 50%;
	margin: -33px 0px 0px -33px;
}

.tooltip {
	position: absolute;
	text-align: left;
	padding: 5px;
	font-family: Gill Sans, sans-serif;
	font-size: 1.2em;
	background: rgba(255,255,255,0.9);
	border: 0px;
	pointer-events: none;
}

.key_image {
	width:90%;
	max-width: 1190px;
	margin: 0px 0px 25px 0px;
}

.initial_start_text {
    font-family: Gill Sans, sans;
    width: 100%;
    height: 100%;
    font-weight: 400;
    letter-spacing: 25px;
    text-transform: lowercase;
    font-variant: small-caps;
    font-size: 8.0em;
    margin: 0px;
    padding: 0px;
    color: #CCCCCC;
    cursor: pointer;
    position: absolute;
    top: 0px;
    left: 0px;
    display: flex;
    justify-content: center;
    align-items: center;
    alignment-baseline: middle;
}

.initial_start_text:hover {
	color: #AAAAAA;
}


text:
package com.esri.samples.group_layers;

import javafx.scene.control.CheckBox;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TreeCell;

import com.esri.arcgisruntime.layers.Layer;

/**
 * A custom tree cell for displaying a layer in a tree view. Includes a check box or radio button
 * for toggling the layer's visibility.
 */
public class LayerTreeCell extends TreeCell<Layer> {

  @Override
  public void updateItem(Layer layer, boolean empty) {
    super.updateItem(layer, empty);
    if (!empty) {

      // set the label to the layer's name
      setText(formatName(layer.getName()));

      if (layer.getName().equals("DevA_BuildingShells") || layer.getName().equals("DevB_BuildingShells")) {

        // if the layer is a building shell create a radio button and assign to the toggle group
        RadioButton radioButton = new RadioButton();
        setGraphic(radioButton);
        radioButton.setToggleGroup(GroupLayersSample.buildingsToggleGroup);

        // toggle the layer's visibility when the radio button is selected
        radioButton.setSelected(layer.isVisible());
        radioButton.selectedProperty().addListener(e -> layer.setVisible(radioButton.isSelected()));
      } else {

        // if the layer is not a building shell, create a checkbox
        CheckBox checkBox = new CheckBox();
        setGraphic(checkBox);

        // toggle the layer's visibility when the check box is toggled
        checkBox.setSelected(layer.isVisible());
        checkBox.selectedProperty().addListener(e -> layer.setVisible(checkBox.isSelected()));
      }
    } else {
      setText(null);
      setGraphic(null);
    }
  }

  /**
   * Format the layer's name property to a user-friendly string.
   *
   * @param layerName the name of the layer
   * @return a formatted string
   */
  private String formatName(String layerName) {
    switch (layerName) {
      case "DevA_Trees":
        return "Trees";
      case "DevA_Pathways":
        return "Pathways";
      case "DevA_BuildingShells":
        return "Buildings A";
      case "DevB_BuildingShells":
        return "Buildings B";
      case "DevelopmentProjectArea":
        return "Project Area";
      default:
        return layerName;
    }
  }
}


text:
<?php

return array(
    'doctrine' => array(
        'configuration' => array(
            'orm_default' => array(
                'default_repository_class_name' => 'DoctrineORMModuleTest\Assets\RepositoryClass',
            ),
        ),
        'driver' => array(
            'DoctrineORMModuleTest\Assets\Entity' => array(
                'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
                'cache' => 'array',
                'paths' => array(
                    __DIR__ . '/DoctrineORMModuleTest/Assets/Entity'
                ),
            ),
            'orm_default' => array(
                'drivers' => array(
                    'DoctrineORMModuleTest\Assets\Entity' => 'DoctrineORMModuleTest\Assets\Entity',
                ),
            ),
        ),
        'entity_resolver' => array(
            'orm_default' => array(
                'resolvers' => array(
                    'DoctrineORMModuleTest\Assets\Entity\TargetInterface'
                        => 'DoctrineORMModuleTest\Assets\Entity\TargetEntity',
                ),
            ),
        ),
        'connection' => array(
            'orm_default' => array(
                'configuration' => 'orm_default',
                'eventmanager'  => 'orm_default',
                'driverClass'   => 'Doctrine\DBAL\Driver\PDOSqlite\Driver',
                'params' => array(
                    'memory' => true,
                ),
            ),
        ),
    ),
);


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace ZD.Gui.Zen
{
    /// <summary>
    /// Keyboard navigation events that controls in a context menu must handle.
    /// </summary>
    public enum CtxtMenuNavKey
    {
        Down,
        Up,
        Enter,
        Space,
    }

    /// <summary>
    /// Functionality that a control in a context menu must implement.
    /// </summary>
    public interface ICtxtMenuControl
    {
        /// <summary>
        /// Handles a navigation key event.
        /// </summary>
        void DoNavKey(CtxtMenuNavKey key);

        /// <summary>
        /// Handles mouse leaving area of context menu control.
        /// </summary>
        void DoMouseLeave();

        /// <summary>
        /// Handles mouse moving above context menu control.
        /// </summary>
        void DoMouseMove(Point pt);

        /// <summary>
        /// Handles mouse clicked over context menu control.
        /// </summary>
        void DoMouseClick(Point pt);

        /// <summary>
        /// Gets reference to WinForms user control to be shown as context menu.
        /// </summary>
        UserControl AsUserControl { get; }

        /// <summary>
        /// Calculates tooltip's size and assumes it (after it's been added to context menu form and scale is known).
        /// </summary>
        void AssumeSize();
    }
}


text:
Kik and me ([@oryband](http://github.com/oryband)) are no longer maintaining this repository.
Thanks for all the contributions. You are welcome to fork and continue development.

# BigQuery Streamer <img src="bigquery.png" alt="BigQuery" width="32"> [![GoDoc][godoc image]][godoc]

[Stream insert][stream insert] data into [BigQuery][bigquery] *fast* and *concurrently*,
using [`InsertAll()`][InsertAll()].

## Features

- Insert rows from multiple tables, datasets, and projects, and insert them
  bulk. No need to manage data structures and sort rows by tables -
  bqstreamer does it for you.
- Multiple background workers (i.e. goroutines) to enqueue and insert rows.
- Insert can be done in a blocking or in the background (asynchronously).
- Perform insert operations in predefined set sizes, according to BigQuery's
  [quota policy][quota policy].
- Handle and retry BigQuery server errors.
- Backoff interval between failed insert operations.
- Error reporting.
- Production ready, and thoroughly tested. We - at [Rounds][rounds] (now acquired by [Kik][kik]) - are [using it in our data gathering workflow][blog post].
- Thorough testing and documentation for great good!

## Getting Started

1. Install Go, version should be at least 1.5.
1. Clone this repository and download dependencies:
  1. Version v2: `go get gopkg.in/kikinteractive/go-bqstreamer.v2`
  1. Version v1: `go get gopkg.in/kikinteractive/go-bqstreamer.v1`
1. [Acquire Google OAuth2/JWT credentials][credentials], so you can authenticate with BigQuery.

## How Does It Work?

There are two types of inserters you can use:

 1. `SyncWorker`, which is a single blocking (synchronous) worker.
  1. It enqueues rows and performs insert operations in a blocking manner.
 1. `AsyncWorkerGroup`, which employes multiple background `SyncWorker`s.
  1. The `AsyncWorkerGroup` enqueues rows, and its background workers pull and
     insert in a fan-out model.
  1. An insert operation is executed according to row amount or time thresholds
      for each background worker.
  1. Errors are reported to an error channel for processing by the user.
  1. This provides a higher insert throughput for larger scale scenarios.

## Examples

Check the GoDoc [examples][examples] section.

## Contribute

 1. Please check the [issues][issues] page.
 1. File new bugs and ask for improvements.
 1. Pull requests welcome!

### Test

```bash
# Run unit tests and check coverage.
$ make test

# Run integration tests.
# This requires an active project, dataset and pem key.
$ export BQSTREAMER_PROJECT=my-project
$ export BQSTREAMER_DATASET=my-dataset
$ export BQSTREAMER_TABLE=my-table
$ export BQSTREAMER_KEY=my-key.json
$ make testintegration
```

[godoc]: https://godoc.org/github.com/kikinteractive/go-bqstreamer
[godoc image]: https://godoc.org/github.com/kikinteractive/go-bqstreamer?status.svg

[stream insert]: https://cloud.google.com/bigquery/streaming-data-into-bigquery
[bigquery]: https://cloud.google.com/bigquery/
[InsertAll()]: https://cloud.google.com/bigquery/docs/reference/v2/tabledata/insertAll
[quota policy]: https://cloud.google.com/bigquery/quota-policy#streaminginserts
[credentials]: https://cloud.google.com/bigquery/authorization

[rounds]: http://rounds.com/
[kik]: http://kik.com/
[blog post]: https://medium.com/@oryband/collecting-user-data-and-usage-ffa84c4dba34
[examples]: https://godoc.org/github.com/kikinteractive/go-bqstreamer#pkg-examples
[issues]: https://github.com/kikinteractive/go-bqstreamer/issues


text:
package org.codehaus.gmaven.runtime.v1_5;

import org.codehaus.gmaven.feature.Component;
import org.codehaus.gmaven.feature.support.FeatureSupport;
import org.codehaus.gmaven.runtime.StubCompiler;
import org.codehaus.gmaven.runtime.support.CompilerSupport;
import org.codehaus.gmaven.runtime.support.stubgen.model.ModelFactory;
import org.codehaus.gmaven.runtime.support.stubgen.model.SourceDef;
import org.codehaus.gmaven.runtime.support.stubgen.parser.SourceType;
import org.codehaus.gmaven.runtime.support.stubgen.render.Renderer;
import org.codehaus.gmaven.runtime.support.stubgen.render.RendererFactory;
import org.codehaus.gmaven.runtime.v1_5.stubgen.ModelFactoryImpl;
import org.codehaus.gmaven.runtime.v1_5.stubgen.RendererFactoryImpl;

import java.io.*;
import java.net.URL;
import java.util.Iterator;
import java.util.Set;

/**
 * Provides the stub compilation feature.
 *
 * @version $Id$
 * @author Jason Dillon
 */
public class StubCompilerFeature
    extends FeatureSupport
{
    public StubCompilerFeature() {
        super(StubCompiler.KEY);
    }

    protected Component doCreate() throws Exception {
        return new StubCompilerImpl();
    }

    //
    // StubCompilerImpl
    //

    private class StubCompilerImpl
        extends CompilerSupport
        implements StubCompiler, StubCompiler.Keys
    {
        private ModelFactory modelFactory = new ModelFactoryImpl();

        private RendererFactory rendererFactory = new RendererFactoryImpl();

        private StubCompilerImpl() throws Exception {
            super(StubCompilerFeature.this);
        }

        public int compile() throws Exception {
            if (sources.isEmpty()) {
                log.debug("No sources added to compile; skipping");

                return 0;
            }

            log.debug("Compiling {} stubs for source(s)", String.valueOf(sources.size()));

            int count = 0;

            for (Iterator iter = sources.iterator(); iter.hasNext();) {
                URL url = (URL) iter.next();
                log.debug("    {}", url);

                count += render(url);
            }

            log.debug("Compiled {} stubs", String.valueOf(count));

            return count;
        }

        private int render(final URL url) throws Exception {
            assert url != null;

            SourceDef model;
            if (config.contains(SOURCE_ENCODING)) {
                model = modelFactory.create(url, config.get(SOURCE_ENCODING, (String)null));
            } else {
                model = modelFactory.create(url);
            }

            Set renderers = rendererFactory.create(model);

            Iterator iter = renderers.iterator();

            int count = 0;

            while (iter.hasNext()) {
                Renderer renderer = (Renderer)iter.next();

                Writer writer = createWriter(renderer, getTargetDirectory());

                try {
                    renderer.render(writer);
                    count ++;
                }
                finally {
                    writer.close();
                }
            }

            return count;
        }

        private PrintWriter createWriter(final Renderer renderer, final File outputDir) throws IOException {
            assert renderer != null;
            assert outputDir != null;

            StringBuffer buff = new StringBuffer();

            String pkg = renderer.getPackage();

            if (pkg != null) {
                buff.append(pkg.replace('.', '/'));
                buff.append("/");
            }

            buff.append(renderer.getName());
            buff.append(SourceType.JAVA_EXT);

            File outputFile = new File(outputDir, buff.toString());

            outputFile.getParentFile().mkdirs();

            return new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));
        }
    }
}