text:
<!DOCTYPE html>

		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>Blueprint: Nested Accordion</title>
		<meta name="description" content="Blueprint: Nested Accordion" />
		<meta name="keywords" content="nested, accordion, simple, vertical, web development, css3, javascript" />
		<meta name="author" content="Codrops" />
		<link rel="shortcut icon" href="../favicon.ico">
		<link rel="stylesheet" type="text/css" href="css/accord_default.css" />
		<link rel="stylesheet" type="text/css" href="css/accord_component.css" />
				<link rel="stylesheet" type="text/css" href="css/demo.css" />
		<link rel="stylesheet" type="text/css" href="css/component.css" />
		<link rel="stylesheet" type="text/css" href="css/push_default.css" />
		<link rel="stylesheet" type="text/css" href="css/push_component.css" />
				<link rel="stylesheet" type="text/css" href="css/normalize.css" />
		<link rel="stylesheet" type="text/css" href="css/book_demo.css" />
		<link rel="stylesheet" type="text/css" href="css/bookblock.css" />
		<link rel="stylesheet" type="text/css" href="css/book_component.css" />

My Sanbox

			Three.js
			#UP! & Ionic
			Famo.us
			Ten Page Books
			Chatyeo
			Twillio
			UX Stuff
			Ionic
			Gamify

					 sandbox

I'm Francke Jones, a travelling artist, designer & programmer. I make innovative technologies productive and enjoyable.

To the left is where I show off my skills so you'll hire me.

I've worked for Avenue, Manifest Digital, Lightbank, Groupon,  Monthlys,    Code Academy,  General Assembly  and BenchPrep.

Oh, and here is a playlist I made just for you.

francke.jones@gmail.com  | 312-806-7979    /    Github    /    Google+    /    Twitter

Back to my spiel...

				FRANCKE JONES, circa 1999

Research

My personal expiratmentation.

Angular & Firebase

HTML5 Hybird Mobile Web Apps

New technologies in 2014 now make hybrid apps realistic as a foundation for digitial properties. I list a series of apps that I've been creating with these technologies.

CST Cross Platform Prototype

In November 2013, designed and developed the Chicago Sun Times main news app in iOS. Subsequently, wrote the app as a hybrid using Angular and Ionic. Check this out.

Francke Jones Mobile Portfolio

Here I use Ionic, Angular and Firebase to power my 2013 personal portfolio app.

My Angular Seed Projects

Have compared some patterns of the top Angular stars starter projects. Can easily tell you which patterns I think are the best.

Angular, Ionic and Cordova

Try my hybrid on your mobile phone. Supply your number and I'll text you the link.

										<form method="POST" action="http://franckejones.nodejitsu.com/message?to=to">
										   <input type="text" name="to" value="312-806-7979" />
										   <input type="submit" value="Submit">
										</form>

Chicago Sun Times Cross Platform

Full Resolution Design Deck - View Complete Design Deck

My Mobile Portfolio in IonicAngular

									<form method="POST" action="http://franckejones.nodejitsu.com/message?to=to">
										   <input type="text" name="to" value="312-806-7979" />
										   <input type="submit" value="Submit">
										</form>

Github Starter Apps

I have a decent amount of angular projects publically available to check-out. Please feel free. My Github

Navigate with arrow keys

New Prototypes

Curioshi, Tround, Gamify - prototyping is one of my favorite things to do. Have done some wonderful things recently with Invision.

Gamify

App centered around youth mechanics training.

Tround

Todo list based on trending geotagged photos from around the world.

Curioshi, Node.js

First node.js project, chat server that captures keywords in text and visualizes them by exploiting a dozen different API's.

Gamify

Full Resolution Design Deck - View Complete Design Deck

Tround

Full Resolution Design Deck - View Complete Design Deck

Curioshi

Curioshi was my original Chatyeo server re-written in Node.js. Originally, Chatyeo was written in Erlang. Higher Resolution

Navigate with arrow keys

Getup, Ionic and Famo.us

Hybrid Apps in 2014 will be different

Ionic

New framework built ontop of Cordova, based on Angular.js. Helps create incredibly native feeling experiences in HTML 5.

NG Cordova

NG Cordova is a new library that's making cordova eaiser to work within inside of Angular.

Get #UP!

#UP! get's your computer ready for cross platform development.

Famo.us

I host the kitchen sink here. Have it sent to your phone. Enlarge.

Ionic Framework

Ionic is a Framework I'm quite familiar of and proud of - See Ionics Showcase

NGCordova

Never touch Cordova/Phonegap. Clean Angular API for using Cordova to do things like, access contacts natively, camera, video, geo, accelerometer, etc. Get with the program: NGCordova

Get #UP!

Watch as I devour cross-platform.

Famou.us Sandbox

I'll send the latest Famo.us stuff to your phone to checkout. I have it hosted here.

									<input type="text" name="to" value="312-806-7979" />
										   <input type="submit" value="Submit">

Navigate with arrow keys

User Research

My Experience in User Studies, Consumer Behavior Research, Usability Testing

Dough.com Forensic User Research

Quant & Qual user research, usability testing and proof of concept exploration for a new type options trading platform.

Snapsheet UX Research & Design

Enterprise software research and design.

Zaption.com Usability Testing

Tested variations of Zaption's core product with individual users to ensure things we're truly coming across.

Pickie, aquired by RetailMeNot

Product concept, theory and wireframes to proof-of-concept.

User Research

Conducted multiple user research sessions on various segments. Here is one: View Presentation

User Research and UI

Full Resolution Design Deck -  Check out a deck

Usability Testing

Helped Zaption figure out some things. Check out a sample deck

Pickie UX & Ideation

Helped pull together some fascinating ideas for Pickie just before they sold. Check out a deck

Navigate with arrow keys

Recent Projects

Many of these projects are in their early stages.

Development

Liquorice jelly-o oat cake gingerbread chocolate caramels chupa chups muffin candy.

Chicago Sun Times Cross Platform

Built prototype of CST Native App as an Ionic Hybrid App.

Ruby on Rails

Lead architect and front-end evangelist for entire project.

Angular Web App

New technologies in 2014 now make hybrid apps realistic as a foundation for digitial properties. I list a series of apps that I've been creating with these technologies.

Chicago Sun-Times Ionic Hybrid App

Full Resolution Design Deck - View Complete Design Deck

Huge Ruby on Rails Project

Led development, front-end and other aspects of a very large RoR project. Check out the source here: Monthlys on Github

Coming Soon...

Francke add more dev projects here asap.

Navigate with arrow keys

Design

Curioshi, Tround, Gamify - prototyping is one of my favorite things to do. Have done some wonderful things recently with Invision.

Unite4Good Conceptual Design

Did not win bid to build this landing page - a unique design none the less.

BodyShopBids Transactional Email System

RoR, Sendgrid, Delayed Job, Redis. Where were you Customer.io and Mandrill when I needed you?

Benchprep Art & UX Direction

Designed cross platform test prep app on web, native Android and iOS. Massive two year project, from concept to Series B.

Medycation

Kickass healthcare project for Shawn Bercuson, a friend and a mentor. Authored complete art, ux and design framework.

Getable Web & iOS Design

Order rental construction equipment from your phone. Get it same day. Overhauled entire experience.

Tagkast Android Tablet & Web

Photographers at parties take pics and let people tag themselves in the high res photos. Experiential marketing at it's finest.

Unite4Good Social Network

Designed a complete prototype for a non-profit social network based on the gamification of acts of kindness.

App Builder

Create your own native Android and iOS app with ShipMyApp - designed complete project and user experience.

Kou.pn Media Design & UI Design

UX Work and User Interface for Kou.pn Media.

Gamify

Full Resolution Design Deck - View Complete Design Deck

Tround

Full Resolution Design Deck - View Complete Design Deck

BenchPrep Explainer

Most of what you see in this video, including the video is my work. My other hobby is film and animation.

Gamify

Full Resolution Design Deck - View Complete Design Deck

Tround

Full Resolution Design Deck - View Complete Design Deck

Tround

Full Resolution Design Deck - View Complete Design Deck

Koupn

Sample Design - Click Here

Navigate with arrow keys

Ventures

Because who doesn't want to be an entrepreneur?

Dillyeo.com

Sold my first venture at age twenty-seven (for a small sum), which at the time seemed like a lot. Seven months into the daily deal industry and Dillyeo was shipping a cointainer a week of random goods and electronics. Active since 2006 - the company is now focused mainly on b2b fulfillment and sourcing for industry giants such as Groupon, 1sale, NoMoreRack, Amazon, Walmart.

Monthlys.com

Entreprenour in residence with Eric Lefkofsky and Brad Keywell of Lightbank in 2012.

Gamify Inc.

Current venture of choice. Things are going well. Using your freelance donations to help fund my lifelong ambition to breakdown and deliver sports mechanics training for youth athletes.

Resume

In short, Francke "Jones" Pinto is a developer/designer hybrid. Capable of full-stack JS based development, Ruby on Rails and Front-end, end-to-end development. He has served the Chicago startup community as a mentor, angel investor and tech-startup evangelist for ten years, four of which in residence at Lightbank.

Traditional Resume

Download PDF Resume and/or watch video below and or catch me on Google Plus

Scrapbook


text:
  <cron-selection [labelCurrent]="getLabelCurrent" #CronScheduleComponent [labelEdit]='getText' [originCron]='originCron' (inputvalue)="scheduleGc($event)"></cron-selection>
  <button class="btn btn-outline btn-sm gc-start-btn" (click)="gcNow()" [disabled]="disableGC">{{'GC.GC_NOW' | translate}}</button>

redpajama_set_name: RedPajamaGithub


text:
package godaddy

import (
	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

// Provider returns a terraform.ResourceProvider.
func Provider() *schema.Provider {
	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"key": {
				Type:        schema.TypeString,
				Required:    true,
				DefaultFunc: schema.EnvDefaultFunc("GODADDY_API_KEY", nil),
				Description: "GoDaddy API Key.",
			},

			"secret": {
				Type:        schema.TypeString,
				Required:    true,
				DefaultFunc: schema.EnvDefaultFunc("GODADDY_API_SECRET", nil),
				Description: "GoDaddy API Secret.",
			},

			"baseurl": {
				Type:        schema.TypeString,
				Optional:    true,
				Default:     "https://api.godaddy.com",
				Description: "GoDaddy Base Url(defaults to production).",
			},
		},

		ResourcesMap: map[string]*schema.Resource{
			"godaddy_domain_record": resourceDomainRecord(),
		},

		ConfigureFunc: providerConfigure,
	}
}

func providerConfigure(d *schema.ResourceData) (interface{}, error) {
	config := Config{
		Key:     d.Get("key").(string),
		Secret:  d.Get("secret").(string),
		BaseURL: d.Get("baseurl").(string),
	}

	return config.Client()
}


text:
package com.meizu.smartbar.tab;

import com.meizu.smartbar.R;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class RecentActivity extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.text_content);
		TextView text = (TextView) findViewById(android.R.id.text1);
		text.setText("Recent");
	}

	@Override
	protected void onResume() {
		getParent().getActionBar().setTitle("Recent title");
		super.onResume();
	}
}


text:
unless defined?(CI_ORM)
  CI_ORM = (ENV["CI_ORM"] || :active_record).to_sym
end
require 'rubygems'

# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) && !ENV['TRAVIS']


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

'use strict';

async function main(projectId) {
  // [START data_catalog_search_assets]
  // Import the Google Cloud client library.
  const {DataCatalogClient} = require('@google-cloud/datacatalog').v1;
  const datacatalog = new DataCatalogClient();

  async function searchAssets() {
    // Search data assets.

    /**
     * TODO(developer): Uncomment the following lines before running the sample.
     */
    // const projectId = 'my_project'; // Google Cloud Platform project

    // Set custom query.
    const query = 'type=dataset';

    // Create request.
    const scope = {
      includeProjectIds: [projectId],
      // Alternatively, search using Google Cloud Organization scopes.
      // includeOrgIds: [organizationId],
    };

    const request = {
      scope: scope,
      query: query,
    };

    const [result] = await datacatalog.searchCatalog(request);

    console.log(`Found ${result.length} datasets in project ${projectId}.`);
    console.log('Datasets:');
    result.forEach(dataset => {
      console.log(dataset.relativeResourceName);
    });
  }
  searchAssets();
  // [END data_catalog_search_assets]
}
main(...process.argv.slice(2));


text:
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.EntityFrameworkCore;
using Elixr.Api.Services;
using Microsoft.AspNetCore.Mvc.Formatters;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;

namespace Elixr.Api
{
    public class Startup
    {
        private readonly IConfigurationRoot configuration;
        public Startup(IHostingEnvironment env)
        {
            var builder = new ConfigurationBuilder();
            builder.AddJsonFile("AppSettings.json");

            configuration = builder.Build();
        }
        public async void Configure(IApplicationBuilder app, Seeder seeder, ElixrDbContext ctx)
        {
            app.UseCors("AllowAll");
            app.UseMvc();

            await ConfigureAsync(ctx);
            seeder.Seed();
        }

        private async Task ConfigureAsync(ElixrDbContext dbContext)
        {
            await dbContext.Database.MigrateAsync();
        }

        public void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddMvc(options =>
            {
                options.Filters.Add(typeof(Filters.TokenFilter));
                options.Filters.Add(typeof(Filters.ExceptionFilter));
                options.OutputFormatters.RemoveType<HttpNoContentOutputFormatter>();
            });

            services.AddSingleton<ElixrSettings>(sp => new ElixrSettings(configuration["GameMasterPassword"], configuration["HashingSecret"]));
            services.AddScoped<UserSession>();
            services.AddTransient<Seeder>();
            services.AddTransient<Utilities>();
            services.AddDbContext<ElixrDbContext>(options => options.UseNpgsql(configuration["ConnectionString"]));
        }
    }
}


text:
module Azure end
module Azure::Cosmosdb end
module Azure::Cosmosdb::Mgmt end
module Azure::Cosmosdb::Mgmt::V2020_09_01 end


text:
#pragma once

#include <string>
#include <fstream>
#include <iostream>
#include <cmath>

#include "../player/unit.h"
#include "../player/abstractunit.h"
#include "../util/filesystemhandler.h"

/*!
 * @author kovlev
 */

/*!
 * @class UnitHandler loads all unit templates
 * When getUnit is used it generates a new unit based on level
 * Therefore you should handle deletion yourself
 */
class UnitHandler {
public:
	UnitHandler();
	~UnitHandler();

	//Creates a new unit
	Unit* getUnit(std::string name, int level);

	//Works the same way as the item type and rarity translators
	UnitType translateT(std::string unitTypeString);
	std::string translateT(UnitType unitType);
private:
	void loadUnitData();
	void translaterInit();

	std::string basePath;
	//Unit templates for generating real units
	std::map<std::string, AbstractUnit*> baseUnits;

	std::map<std::string, UnitType> translaterSUT;
	std::map<UnitType, std::string> translaterUTS;

	double levelMultipliers;
	double levelMultipliersForEXP;
	double levelMultipliersForNOA;

	//Statistics
	int numberOfCreatedUnits;
};


text:
import re
import yaml

error_types = ["No recipe available",
               "No packages found in current linux-64 channels",
               "missing build dependency",
               "test failure: missing dependency",
               "test failure: other reasons",
               "invalid syntax",
               "unclassified"]

def has_missing_test_dependency(log):
    """
    Return: (Status, missing packages)
    """
    None

def no_packages_found(log):
    p = re.compile("Error: No packages found in current linux-64 channels")
    return any([re.match(p, line) for line in log])

def split_build_and_test(log):
    # XXX: This can be very memory inefficient
    # Maybe don't even need to split the test and build parts

    try:
        p = re.compile("TEST START")
        test_start = [re.match(p, line) is not None for line in log]
        start_index = test_start.index(True)
        return log[:start_index], log[start_index:]
    except ValueError:
        return log, []

def has_missing_dependency(log):
    p = re.compile("ImportError:")
    return any([re.match(p, line) for line in log])

def has_test_failure(log):
    p = re.compile("TESTS FAILED")
    return re.match(p, log[-1]) is not None

def has_missing_build_dependency(log):
    p = re.compile("RuntimeError: Setuptools downloading is disabled")
    return any([re.match(p, line) for line in log])

def has_invalid_syntax(log):
    p = re.compile("SyntaxError: invalid syntax")
    return any([re.match(p, line) for line in log])

def classify_build_log(log_file, package):
    """
    Takes a build log file object as an input and returns
    a tupe `(category, sub-category, sub-category)`

    - missing dependency:
        - Build Dependency
        - Test Dependency
    - Runtime error (other than missing dependency)
    """
    if package['recipe'] is False:
        return "No recipe available"

    log = log_file.readlines()
    if no_packages_found(log):
        return "No packages found in current linux-64 channels"

    build_log, test_log = split_build_and_test(log)
    if test_log:
        if has_missing_dependency(test_log):
            return "test failure: missing dependency"
        if has_test_failure(test_log):
            return "test failure: other reasons"

    if has_missing_build_dependency(log):
        return "missing build dependency"

    if has_invalid_syntax(log):
        return "invalid syntax"

    return "unclassified"

def classify_all_logs():
    packages = yaml.load(file('packages.yaml', 'r'))
    log_dir = "./logs/"

    for package in packages:
        if package['build'] is False:
            log_file_name = log_dir + "%s_build.log" % (package['name'])
            log_file = open(log_file_name, 'r')
            error_type = classify_build_log(log_file, package)
        else:
            error_type = None
        package['build_error_type'] = error_type

    open('packages.yaml', 'w').writelines(yaml.dump(packages))

if __name__ == "__main__":
    packages = yaml.load(file('packages.yaml', 'r'))
    classify_all_logs()
    package_dict = dict([(package['name'], i) for i, package in enumerate(packages)])


text:
package org.apache.airavata.gfac.ssh.security;

import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.IOUtil;
import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.credential.store.credential.Credential;
import org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
import org.apache.airavata.credential.store.store.CredentialReader;
import org.apache.airavata.gfac.core.GFacConstants;
import org.apache.airavata.gfac.core.GFacException;
import org.apache.airavata.gfac.core.RequestData;
import org.apache.airavata.gfac.core.GFacUtils;
import org.apache.airavata.gfac.core.authentication.SSHPublicKeyFileAuthentication;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.*;
import java.util.Properties;

public class TokenizedSSHAuthInfo implements SSHPublicKeyFileAuthentication {
    protected static final Logger log = LoggerFactory.getLogger(TokenizedSSHAuthInfo.class);

    private String publicKeyFile;

    private String privateKeyFile;

    private String passPhrase = null;

    private SSHCredential gssCredentials = null;

    private CredentialReader credentialReader;

    private RequestData requestData;

    public TokenizedSSHAuthInfo(CredentialReader credentialReader, RequestData requestData) {
        this.credentialReader = credentialReader;
        this.requestData = requestData;
    }

    public TokenizedSSHAuthInfo(RequestData requestData) {
        this.requestData = requestData;
    }

    public String getPublicKeyFile(String userName, String hostName) {
        return publicKeyFile;
    }

    public String getPrivateKeyFile(String userName, String hostName) {
        return privateKeyFile;
    }

    public String getPassPhrase() {
        return passPhrase;
    }

    public void bannerMessage(String message) {

    }

    public SSHCredential getCredentials() throws SecurityException {

        if (gssCredentials == null) {

            try {
                gssCredentials = getCredentialsFromStore();
            } catch (Exception e) {
                log.error("An exception occurred while retrieving credentials from the credential store. " +
                        "Will continue with my proxy user name and password. Provided TokenId:" + requestData.getTokenId() + e.getMessage(), e);
            }

            if (gssCredentials == null) {
                System.out.println("Authenticating with provided token failed, so falling back to authenticate with defaultCredentials");
                try {
                    gssCredentials = getDefaultCredentials();
                } catch (Exception e) {
                    throw new SecurityException("Error retrieving my proxy using username password",e.getCause());
                }
            }
            // if still null, throw an exception
            if (gssCredentials == null) {
                throw new SecurityException("Unable to retrieve my proxy credentials to continue operation.");
            }
        }

        return gssCredentials;
    }

    /**
     * Reads the credentials from credential store.
     *
     * @return If token is found in the credential store, will return a valid credential. Else returns null.
     * @throws Exception If an error occurred while retrieving credentials.
     */
    public SSHCredential getCredentialsFromStore() throws Exception {

        if (getCredentialReader() == null) {
            credentialReader = GFacUtils.getCredentialReader();
            if(credentialReader == null){
            	 return null;
            }
        }

        Credential credential = getCredentialReader().getCredential(getRequestData().getGatewayId(),
                getRequestData().getTokenId());

        if (credential instanceof SSHCredential) {
            SSHCredential credential1 = (SSHCredential) credential;
            this.publicKeyFile = writeFileToDisk(credential1.getPublicKey());
            this.privateKeyFile = writeFileToDisk(credential1.getPrivateKey());
            this.passPhrase = credential1.getPassphrase();
            System.out.println(this.publicKeyFile);
            System.out.println(this.privateKeyFile);
            System.out.println(this.passPhrase);
            this.getRequestData().setRequestUser(credential1.getPortalUserName());
            return credential1;
        } else {
            log.info("Could not find SSH credentials for token - " + getRequestData().getTokenId() + " and "
                    + "gateway id - " + getRequestData().getGatewayId());
        }

        return null;
    }

    /**
     * Gets the default proxy certificate.
     *
     * @return Default my proxy credentials.
     * @throws GFacException                            If an error occurred while retrieving credentials.
     * @throws org.apache.airavata.common.exception.ApplicationSettingsException
     */
    public SSHCredential getDefaultCredentials() throws GFacException, ApplicationSettingsException, IOException {
        Properties configurationProperties = ServerSettings.getProperties();
        String sshUserName = configurationProperties.getProperty(GFacConstants.SSH_USER_NAME);
        this.getRequestData().setRequestUser(sshUserName);
        this.privateKeyFile = configurationProperties.getProperty(GFacConstants.SSH_PRIVATE_KEY);
        this.publicKeyFile = configurationProperties.getProperty(GFacConstants.SSH_PUBLIC_KEY);
        this.passPhrase = configurationProperties.getProperty(GFacConstants.SSH_PRIVATE_KEY_PASS);
        this.getRequestData().setRequestUser(sshUserName);
        return new SSHCredential(IOUtil.readToByteArray(new File(this.privateKeyFile)), IOUtil.readToByteArray(new File(this.publicKeyFile)), this.passPhrase, requestData.getGatewayId(), sshUserName);
    }

    public CredentialReader getCredentialReader() {
        return credentialReader;
    }

    public RequestData getRequestData() {
        return requestData;
    }

    private String writeFileToDisk(byte[] data) {
        File temp = null;
        try {
            temp = File.createTempFile("id_rsa", "");
            //write it
            FileOutputStream bw = new FileOutputStream(temp);
            bw.write(data);
            bw.close();
        } catch (IOException e) {
            log.error(e.getMessage(), e);
        }
        return temp.getAbsolutePath();
    }
}


text:
package freecli
package command
package api

import cats.Show
import cats.implicits._

import core.api.Description
import core.formatting._

case class CommandField(name: CommandFieldName, description: Option[Description]) {
  def matches(s: String): Boolean = name.show === s
  def shortDescription: String = name.show
  def longDescription: String = s"${name.show}${showWithSpace(description)}"
}

object CommandField {
  implicit object showInstance extends Show[CommandField] {
    override def show(f: CommandField): String =
      f.name.show + f.description.fold("")(d => " " + d)
  }
}

class CommandFieldName private(val name: String) {
  override def toString = CommandFieldName.showInstance.show(this)

  def canEqual(other: Any): Boolean = other.isInstanceOf[CommandFieldName]

  override def equals(other: Any): Boolean = other match {
    case that: CommandFieldName =>
      (that canEqual this) &&
        name == that.name
    case _ => false
  }

  override def hashCode(): Int = {
    val state = Seq(name)
    state.map(_.hashCode()).foldLeft(0)((a, b) => 31 * a + b)
  }
}

object CommandFieldName {
  private val commandFieldNameCanditateRegex = "^[a-zA-Z]([a-zA-Z0-9]|[_-])*[a-zA-Z0-9]$"
  private val commandFieldNameRegex = "^[a-zA-Z]([a-zA-Z0-9]|[_-])*[a-zA-Z0-9]$"

  def isCommandFieldName(value: String): Boolean =
    value.matches(s"$commandFieldNameRegex")

  def apply(name: String): CommandFieldName = {
    if (!name.toString.matches(commandFieldNameCanditateRegex))
      throw new IllegalArgumentException(
        "Command Field name needs to start with letters and only include letters, numbers, dashes or underscores")

    new CommandFieldName(name)
  }

  implicit def showInstance: Show[CommandFieldName] = new Show[CommandFieldName] {
    def show(f: CommandFieldName): String = f.name
  }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PronoFoot.Data.Model
{
    public class Team
    {
        public int TeamId { get; set; }
        public string Name { get; set; }

        public virtual ICollection<Edition> Editions { get; set; }
    }
}


text:
var Promise = require('bluebird');
var request = require('request-promise');
var cheerio = require('cheerio');

var h = require('./helpers');

function search(opts) {

    return new Promise(function (resolve, reject) {

        if (opts.num && opts.num > 250) {
            throw Error("The number of results can't exceed 250");
        }

        var query = {
            term: encodeURIComponent(opts.term),
            lang: opts.lang || 'en',
            country: opts.country || 'us',
            num: opts.num || 20,
            apps: [],
            fullDetail: opts.fullDetail
        };

        doSearch(query)
            .then(resolve)
            .catch(reject);
    });
}

function buildUrl(query) {
    var url = 'https://play.google.com/store/search?c=apps&q=' + query.term + '&hl=' + query.lang + '&gl=' + query.country;

    if (query.nextToken) {
        url += '&pagTok=' + query.nextToken;
    }
    return url;
}

function doSearch(query) {

    function processResponse(html) {
        query.nextToken = getNextToken(html);
        var $ = cheerio.load(html);
        return h.getParseList(query)($);
    }

    function processApps(apps) {
        query.apps = query.apps.concat(apps);
        return query;
    }

    return request(buildUrl(query))
        .then(processResponse, h.requestError)
        .then(processApps)
        .then(checkFinished);
}

function getNextToken(html) {
    //extract the token for the next page request
    //for the record, I hate regexps
    var s = html.match(/\\42(GAE.+?)\\42/);
    if (!s) {
        return undefined;
    }
    return s[1].replace(/\\\\u003d/g, '=');
}

function checkFinished(query) {
    //if enough resutls or no more pages, return
    if (query.apps.length >= query.num || !query.nextToken) {
        return query.apps.slice(0, query.num);
    }

    //else fetch next page
    return doSearch(query);
}

module.exports = search;


text:
package org.jabref.logic.openoffice;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class OpenOfficePreferences {

    public static final String DEFAULT_WINDOWS_PATH = "C:\\Program Files\\LibreOffice 5";
    public static final String DEFAULT_WIN_EXEC_PATH = "C:\\Program Files\\LibreOffice 5\\program";
    public static final String WINDOWS_EXECUTABLE = "soffice.exe";

    public static final String DEFAULT_OSX_PATH = "/Applications/LibreOffice.app";
    public static final String DEFAULT_OSX_EXEC_PATH = "/Applications/LibreOffice.app/Contents/MacOS/soffice";
    public static final String OSX_EXECUTABLE = "soffice";

    public static final String DEFAULT_LINUX_PATH = "/usr/lib/libreoffice";
    public static final String DEFAULT_LINUX_EXEC_PATH = "/usr/lib/libreoffice/program/soffice";
    public static final String LINUX_EXECUTABLE = "soffice";

    public static final List<String> OO_JARS = Arrays.asList("unoil.jar", "jurt.jar", "juh.jar", "ridl.jar");

    private String executablePath = "";
    private String installationPath = "";
    private boolean useAllDatabases;
    private boolean syncWhenCiting;
    private boolean showPanel;
    private List<String> externalStyles = new ArrayList<>();
    private String currentStyle = "";
    private String jarsPath = "";

    public OpenOfficePreferences(
            String jarsPath,
            String executablePath,
            String installationPath,
            boolean useAllDatabases,
            boolean syncWhenCiting,
            boolean showPanel,
            List<String> externalStyles,
            String currentStyle
    ) {
        this.jarsPath = jarsPath;
        this.executablePath = executablePath;
        this.installationPath = installationPath;
        this.useAllDatabases = useAllDatabases;
        this.syncWhenCiting = syncWhenCiting;
        this.showPanel = showPanel;
        this.externalStyles = externalStyles;
        this.currentStyle = currentStyle;
    }

    public void clearCurrentStyle() {
        this.currentStyle = null;
        // TODO: sync to prefs
    }

    /**
     * path to soffice-file
     */
    public String getExecutablePath() {
        return executablePath;
    }

    public void setExecutablePath(String executablePath) {
        this.executablePath = executablePath;
    }

    /**
     * main directory for OO/LO installation, used to detect location on Win/OS X when using manual connect
     */
    public String getInstallationPath() {
        return installationPath;
    }

    public void setInstallationPath(String installationPath) {
        this.installationPath = installationPath;
    }

    /**
     * true if all databases should be used when citing
     */
    public Boolean getUseAllDatabases() {
        return useAllDatabases;
    }

    public void setUseAllDatabases(Boolean useAllDatabases) {
        this.useAllDatabases = useAllDatabases;
    }

    /**
     * true if the reference list is updated when adding a new citation
     */
    public Boolean getSyncWhenCiting() {
        return syncWhenCiting;
    }

    public void setSyncWhenCiting(boolean syncWhenCiting) {
        this.syncWhenCiting = syncWhenCiting;
    }

    /**
     * true if the OO panel is shown on startup
     */
    public boolean getShowPanel() {
        return showPanel;
    }

    public void setShowPanel(boolean showPanel) {
        this.showPanel = showPanel;
    }

    /**
     * list with paths to external style files
     */
    public List<String> getExternalStyles() {
        return externalStyles;
    }

    public void setExternalStyles(List<String> externalStyles) {
        this.externalStyles = externalStyles;
    }

    /**
     * path to the used style file
     */
    public String getCurrentStyle() {
        return currentStyle;
    }

    public void setCurrentStyle(String currentStyle) {
        this.currentStyle = currentStyle;
    }

    /**
     * directory that contains juh.jar, jurt.jar, ridl.jar, unoil.jar
     */
    public String getJarsPath() {
        return jarsPath;
    }

    public void setJarsPath(String jarsPath) {
        this.jarsPath = jarsPath;
    }

    public void updateConnectionParams(String ooPath, String execPath, String jarsPath) {
        setInstallationPath(ooPath);
        setExecutablePath(execPath);
        setJarsPath(jarsPath);
    }

    public void clearConnectionSettings() {
        this.installationPath = "";
        this.executablePath = "";
        this.jarsPath = "";
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<cibet xmlns="http://www.logitags.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.logitags.com ../../main/resources/cibet-config_1.4.xsd"
	name="cibet-config1">

   <notificationProvider>
      <class>com.logitags.cibet.notification.EmailNotificationProvider</class>
      <properties>
         <from>from@test.de</from>
         <smtpHost>localhost</smtpHost>
         <smtpPort>8854</smtpPort>
      </properties>
   </notificationProvider>

	<actuator name="LOADCONTROL">
		<properties>
			<customMonitors>com.cibethelper.loadcontrol.DummyMonitor,
				com.cibethelper.loadcontrol.DummyMonitor</customMonitors>
		</properties>
	</actuator>

	<actuator name="TESTSUBSUB">
		<class>com.cibethelper.base.SubSub4EyesController</class>
		<properties>
			<dummy1>1234456789123</dummy1>
			<dummy2>false</dummy2>
			<intParamB>234</intParamB>
			<doubleParam>45.67</doubleParam>
			<doubleParamB>34.22</doubleParamB>
			<floatParam>12.55</floatParam>
			<floatParamB>102.456</floatParamB>
			<strParam>Hallo</strParam>
			<boolParam>True</boolParam>
			<shortParamB>12</shortParamB>
			<shortParam>12</shortParam>
			<longParam>123456</longParam>
		</properties>
	</actuator>

	<actuator name="ARCHIVE2">
		<class>com.logitags.cibet.actuator.archive.ArchiveActuator</class>
		<properties>
			<jndiName>CibetEntityManager.jndiName</jndiName>
		</properties>
	</actuator>

	<actuator name="SCHED1"> <class>com.logitags.cibet.actuator.scheduler.SchedulerActuator</class>
		<properties>
		    <timerStart>+ 6</timerStart>
		    <throwPostponedException>true</throwPostponedException>
		    <autoRemoveScheduledDate>true</autoRemoveScheduledDate>
		    <batchInterceptor>com.cibethelper.base.SchedulerPersistIntercept</batchInterceptor>
		</properties>
	</actuator>

	<setpoint id="A">
		<controls>
			<tenant>
				<include>ApiTest-loadXMLConfiguration-Owner</include>
			</tenant>
			<event>
				<include>UPDATE</include>
			</event>
			<target>
				<include>com.cibethelper.entities.TEntity</include>
			</target>
		</controls>
		<actuator name="FOUR_EYES" />
		<actuator name="ARCHIVE" />
	</setpoint>

	<setpoint id="B">
		<controls>
			<tenant>
				<include>ApiTest-loadXMLConfiguration-Owner</include>
			</tenant>
			<event>
				<include>INSERT</include>
			</event>
			<target>
				<include>com.cibethelper.entities.TComplexEntity</include>
			</target>
		</controls>
		<actuator name="ARCHIVE" />
	</setpoint>

	<setpoint id="C">
		<controls>
			<tenant>
				<include>ApiTest-loadXMLConfiguration-Owner</include>
			</tenant>
			<event>
				<include>INVOKE</include>
			</event>
			<target>
				<include>com.cibethelper.base.TrueCustomControl</include>
			</target>
			<method>
				<include>setGaga</include>
			</method>
		</controls>
		<actuator name="ARCHIVE" />
	</setpoint>

	<setpoint id="D">
		<controls>
			<tenant>
				<include>ApiTest-loadXMLConfiguration-Owner</include>
			</tenant>
			<event>
				<include>INVOKE</include>
			</event>
			<target>
				<include>com.cibethelper.base.TrueCustomControl</include>
			</target>
			<method>
				<include>getName()</include>
			</method>
		</controls>
		<actuator name="ARCHIVE2" />
	</setpoint>

	<setpoint id="com.logitags.cibet.actuator.loadcontrol.x">
		<controls>
			<target>
				<include>com.cibethelper.loadcontrol.MonitorTestClass</include>
			</target>
			<method>
				<include>cibet*</include>
			</method>
		</controls>
		<actuator name="LOADCONTROL" />
	</setpoint>

	<setpoint id="ConditionControlTest-1">
		<controls>
			<event>
				<include>INSERT</include>
			</event>
			<target>
				<include>com.logitags.cibet.util.TEntity</include>
			</target>
			<invoker>
				<include>com.logitags.cibet.controller.controls.InvokerControlTest.evaluateInclude1()</include>
			</invoker>
			<stateChange>
				<exclude>counter, ten.counter</exclude>
			</stateChange>
			<condition>
				<include>
				var date = java.util.Calendar.getInstance();
				date.get(java.util.Calendar.YEAR) >= 2003
				&& date.get(java.util.Calendar.YEAR) <= 2050
				&& $EVENT.name().equals("INVOKE")
				&& $SESSIONSCOPE.getProperty("Klaus") != null
				&& $SESSIONSCOPE.getProperty("Klaus").getCounter() == 7
				&& $SESSIONSCOPE.getProperty("Emil") == 2
				</include>
			</condition>
		</controls>
		<actuator name="ARCHIVE" />
	</setpoint>

   <setpoint id="ConditionControlTest-2">
      <controls>
         <event>
         	<include>INSERT</include>
         </event>
         <target>
         	<include>com.logitags.cibet.util.TEntity</include>
         </target>
         <method>
         	<include>getBytes(int)</include>
         </method>
         <invoker>
             <exclude>com.logitags.cibet.ConfigurationTest.methodEvaluation2()</exclude>
             <exclude>com.logitags.x*</exclude>
         </invoker>
         <stateChange>
         	<include>counter, ten.counter</include>
         </stateChange>
         <condition>
         	<include>
              var DATE = new java.util.Date();
              print(DATE);
              print($PARAM2);
              $TARGETOBJECT.getCounter() == 7
              && $PARAM0 == 2
              && $PARAM2.before(DATE)
              && $PARAM3 == null
              && $TARGETOBJECT.getCounter() == 7
              </include>
         </condition>
      </controls>
      <actuator name="ARCHIVE"/>
   </setpoint>

   <setpoint id="ConditionControlTest-3">
      <controls>
         <tenant>
         	<include>ten1</include>
         </tenant>
         <event>
         	<include>INSERT, INVOKE,UPDATEQUERY</include>
         </event>
         <target>
         	<include>com.logitags.*</include>
         </target>
         <method>
         	<include>hasenmethode()</include>
         </method>
         <invoker>
         	<exclude>com.logitags.cibet.*</exclude>
         </invoker>
         <stateChange>
         	<include>nixxi</include>
         </stateChange>
         <condition>
         	<include>"Sting".equals($TARGETOBJECT.getOwner())</include>
         </condition>
      </controls>
      <actuator name="ARCHIVE"/>
   </setpoint>

</cibet>


text:
package com.github.icedland.iced.x86.info;

final class InstrInfoConstants {
	private InstrInfoConstants() {
	}

	static final int OP_INFO0_COUNT = 13;
	static final int OP_INFO1_COUNT = 7;
	static final int OP_INFO2_COUNT = 3;
	static final int OP_INFO3_COUNT = 2;
	static final int OP_INFO4_COUNT = 2;
	static final int RFLAGS_INFO_COUNT = 79;
	static final int DEFAULT_USED_REGISTER_COLL_CAPACITY = 10;
	static final int DEFAULT_USED_MEMORY_COLL_CAPACITY = 8;
}


text:
  {#each sections as section, i}

      <Sprite url='images/vtoc.jpg' width=320 columns=3 index={section.sprite_index}/>
      {section.title}
      {#if section.subtitle}
        {section.subtitle}
      {/if}

      try in a  notebook

  {/each}


text:
use anyhow::Result;

use diem_types::{account_address::AccountAddress, event::EventKey};
use diemdb::diemsum::Diemsum;
use serde::Serialize;
use serde_json::to_string_pretty;
use std::path::PathBuf;
use structopt::StructOpt;

#[derive(StructOpt)]
#[structopt(
    name = "Diemsum",
    about = "A command line tool that offers multiple data access commands for DiemDB"
)]
struct Opt {
    /// The parent dir of diemdb
    #[structopt(long = "db", parse(from_os_str))]
    db_dir: PathBuf,

    /// Whether output in json format
    #[structopt(long)]
    json: bool,

    #[structopt(subcommand)]
    cmd: Command,
}

#[derive(StructOpt)]
enum Command {
    /// Get the latest ledger version
    Status,
    /// Transaction related query
    Txn(TxnOp),
    /// Account related query
    Account(AccountCmd),
    /// Event related query
    #[structopt(flatten)]
    Event(EventCmd),
}

#[derive(StructOpt)]
enum TxnOp {
    Get {
        /// The version of the target transaction
        #[structopt(long, short)]
        version: u64,
    },
    Scan {
        /// The lower bound of the version range in transaction scan
        #[structopt(default_value = "0", long = "from")]
        from_version: u64,
        /// The upper bound (inclusive) of the version range in transaction scan, by default the current ledger version
        #[structopt(long = "to")]
        to_version: Option<u64>,
    },
}

#[derive(StructOpt)]
struct AccountCmd {
    /// The Account Address in hex
    #[structopt(short, long, short)]
    address: AccountAddress,
    #[structopt(subcommand)]
    account_op: AccountOp,
}

#[derive(StructOpt)]
enum AccountOp {
    Get {
        /// The version at which the account data is requested
        #[structopt(long, short)]
        version: u64,
    },
}

#[derive(StructOpt)]
enum EventCmd {
    /// Look for a range of event stream of an EventKey
    EventByKey {
        /// The event key
        #[structopt(short, long = "key", short = "k")]
        event_key: EventKey,
        #[structopt(subcommand)]
        event_op: EventOp,
    },
    /// Look for events emitted by the txn at the specified version
    EventByVersion {
        /// The target version for the interested events
        #[structopt(long, short)]
        version: u64,
    },
}

#[derive(StructOpt)]
enum EventOp {
    Get {
        /// The sequence at which the event is requested
        #[structopt(long, short)]
        seq: u64,
    },
    Scan {
        /// The lower bound of the sequence range in event scan
        #[structopt(default_value = "0", long = "from")]
        from_seq: u64,
        /// The upper bound (inclusive) of the sequence range in event scan, by default the latest sequence
        #[structopt(long = "to")]
        to_seq: Option<u64>,
    },
}

fn main() {
    if let Err(err) = run_cmd() {
        println!("Error: {}", err);
    }
}

fn run_cmd() -> Result<()> {
    let opt = Opt::from_args();
    let diemsum = Diemsum::new(opt.db_dir)?;
    let is_json = opt.json;
    match opt.cmd {
        Command::Status => {
            print(diemsum.get_startup_info()?, is_json)?;
        }
        Command::Txn(txn_op) => match txn_op {
            TxnOp::Get { version } => {
                print(&diemsum.get_txn_by_version(version)?, is_json)?;
            }
            TxnOp::Scan {
                from_version,
                to_version,
            } => {
                let to_version = match to_version {
                    Some(to_version) => to_version,
                    None => diemsum.get_committed_version()?,
                };
                print(
                    diemsum.scan_txn_by_version(from_version, to_version)?,
                    is_json,
                )?;
            }
        },
        Command::Account(account_cmd) => {
            let address = account_cmd.address;
            match account_cmd.account_op {
                AccountOp::Get { version } => {
                    print(
                        diemsum.get_account_state_by_version(address, version)?,
                        is_json,
                    )?;
                }
            }
        }
        Command::Event(event_cmd) => match event_cmd {
            EventCmd::EventByKey {
                event_key,
                event_op,
            } => match event_op {
                EventOp::Get { seq } => {
                    print(diemsum.scan_events_by_seq(&event_key, seq, seq)?, is_json)?;
                }
                EventOp::Scan { from_seq, to_seq } => {
                    let to_seq = match to_seq {
                        Some(to_version) => to_version,
                        None => u64::max_value(),
                    };
                    print(
                        diemsum.scan_events_by_seq(&event_key, from_seq, to_seq)?,
                        is_json,
                    )?;
                }
            },
            EventCmd::EventByVersion { version } => {
                print(diemsum.get_events_by_version(version)?, is_json)?;
            }
        },
    }
    Ok(())
}

fn print<T>(data: T, is_json: bool) -> Result<()>
where
    T: Serialize + std::fmt::Debug,
{
    if is_json {
        println!("{}", to_string_pretty(&data)?);
    } else {
        println!("{:?}", data)
    }
    Ok(())
}


text:
package org.sakaiproject.nakamura.site.search;

import static org.apache.sling.jcr.resource.JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY;
import static org.sakaiproject.nakamura.api.search.SearchConstants.PARAMS_ITEMS_PER_PAGE;

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.io.JSONWriter;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.ComponentContext;
import org.sakaiproject.nakamura.api.search.Aggregator;
import org.sakaiproject.nakamura.api.search.SearchBatchResultProcessor;
import org.sakaiproject.nakamura.api.search.SearchConstants;
import org.sakaiproject.nakamura.api.search.SearchException;
import org.sakaiproject.nakamura.api.search.SearchResultProcessor;
import org.sakaiproject.nakamura.api.search.SearchResultSet;
import org.sakaiproject.nakamura.api.search.SearchServiceFactory;
import org.sakaiproject.nakamura.api.search.SearchUtil;
import org.sakaiproject.nakamura.api.site.SiteService;
import org.sakaiproject.nakamura.util.ExtendedJSONWriter;
import org.sakaiproject.nakamura.util.RowUtils;

import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.query.Query;
import javax.jcr.query.QueryManager;
import javax.jcr.query.QueryResult;
import javax.jcr.query.Row;
import javax.jcr.query.RowIterator;

@Component(immediate = true, label = "SiteContentSearchResultProcessor")
@Properties(value = {
    @Property(name = "service.vendor", value = "The Sakai Foundation"),
    @Property(name = "service.description", value = "Formats search results for content nodes in sites."),
    @Property(name = "sakai.search.batchprocessor", value = "SiteContent") })
@Service(value = SearchBatchResultProcessor.class)
@Reference(referenceInterface = SiteService.class, name = "SiteService")
public class SiteContentSearchResultProcessor implements SearchBatchResultProcessor {

  private SiteService siteService;
  protected SearchResultProcessorTracker tracker;

  @Reference
  protected SearchServiceFactory searchServiceFactory;

  /**
   * {@inheritDoc}
   *
   * @see org.sakaiproject.nakamura.api.search.SearchBatchResultProcessor#writeNodes(org.apache.sling.api.SlingHttpServletRequest,
   *      org.apache.sling.commons.json.io.JSONWriter,
   *      org.sakaiproject.nakamura.api.search.Aggregator, javax.jcr.query.RowIterator)
   */
  public void writeNodes(SlingHttpServletRequest request, JSONWriter write,
      Aggregator aggregator, RowIterator iterator) throws JSONException,
      RepositoryException {

    long toSkip = SearchUtil.getPaging(request);
    iterator.skip(toSkip);
    long items = SearchUtil.longRequestParameter(request, PARAMS_ITEMS_PER_PAGE,
        SearchConstants.DEFAULT_PAGED_ITEMS);

    long i = 0;
    while (iterator.hasNext() && i < items) {
      Row row = iterator.nextRow();
      writeNode(request, write, aggregator, row);
      i++;
    }

  }

  /**
   * {@inheritDoc}
   *
   * @see org.sakaiproject.nakamura.api.search.SearchResultProcessor#getSearchResultSet(org.apache.sling.api.SlingHttpServletRequest,
   *      javax.jcr.query.Query)
   */
  public SearchResultSet getSearchResultSet(SlingHttpServletRequest request, Query query)
      throws SearchException {
    try {
      // Perform the query
      QueryResult qr = query.execute();
      RowIterator iterator = searchServiceFactory.getPathFilteredRowIterator(qr.getRows());

      // Do another query to get the files.
      Session session = request.getResourceResolver().adaptTo(Session.class);
      QueryManager qm = session.getWorkspace().getQueryManager();
      String statement = "//element(*, sakai:site)//*[@sling:resourceType='sakai/link']/jcr:deref(@jcr:reference, '*')[jcr:contains(.,'*u*')] order by @jcr:score descending";
      Query q = qm.createQuery(statement, Query.XPATH);
      QueryResult filesQueryResult = q.execute();
      RowIterator filesIterator = filesQueryResult.getRows();

      RowIterator mergedIterator = searchServiceFactory.getMergedRowIterator(iterator, filesIterator);

      return searchServiceFactory.getSearchResultSet(mergedIterator);

    } catch (RepositoryException e) {
      throw new SearchException(500, "Unable to do files query.");
    }
  }

  private void writeDefaultNode(JSONWriter write, Aggregator aggregator, Row row,
      Node siteNode, Session session) throws JSONException, RepositoryException {
    Node node = RowUtils.getNode(row, session);
    if (aggregator != null) {
      aggregator.add(node);
    }
    write.object();
    // We don't dump the member-count, since that is very expensive.
    write.key("site");
    ExtendedJSONWriter.writeNodeToWriter(write, siteNode);
    write.key("excerpt");
    write.value(RowUtils.getDefaultExcerpt(row));
    write.key("data");
    ExtendedJSONWriter.writeNodeToWriter(write, node);
    write.endObject();
  }

  private void writeNode(SlingHttpServletRequest request, JSONWriter write,
      Aggregator aggregator, Row row) throws JSONException, RepositoryException {
    Session session = request.getResourceResolver().adaptTo(Session.class);
    Node node = RowUtils.getNode(row, session);

    Node siteNode = node;
    boolean foundSite = false;
    while (!siteNode.getPath().equals("/")) {

      if (siteService.isSite(siteNode)) {
        foundSite = true;
        break;
      }
      siteNode = siteNode.getParent();
    }
    if (foundSite) {
      if (node.hasProperty(SLING_RESOURCE_TYPE_PROPERTY)) {
        String type = node.getProperty(SLING_RESOURCE_TYPE_PROPERTY).getString();

        // From looking at the type we determine how we should represent this node.
        SearchResultProcessor processor = tracker.getSearchResultProcessorByType(type);
        if (processor != null) {
          write.object();
          write.key("site");
          ExtendedJSONWriter.writeNodeToWriter(write, siteNode);
          write.key("type");
          write.value(node.getProperty(SLING_RESOURCE_TYPE_PROPERTY).getString());
          write.key("excerpt");
          write.value(RowUtils.getDefaultExcerpt(row));
          write.key("data");
          processor.writeNode(request, write, aggregator, row);
          write.endObject();
        } else {
          // No processor found, just dump the properties
          writeDefaultNode(write, aggregator, row, siteNode, session);
        }

      } else {
        // No type, just dump the properties
        writeDefaultNode(write, aggregator, row, siteNode, session);
      }
    }
  }

  protected void activate(ComponentContext context) {
    BundleContext bundleContext = context.getBundleContext();
    tracker = new SearchResultProcessorTracker(bundleContext);
    tracker.open();
  }

  protected void deactivate(ComponentContext context) {
    if (tracker != null) {
      tracker.close();
      tracker = null;
    }
  }

  protected void bindSiteService(SiteService siteService) {
    this.siteService = siteService;
  }

  protected void unbindSiteService(SiteService siteService) {
    this.siteService = null;
  }

}


text:
namespace blink { class WebAudioBus; }

namespace content {

// Decode in-memory audio file data.
bool DecodeAudioFileData(blink::WebAudioBus* destination_bus, const char* data,
                         size_t data_size);

}  // namespace content

#endif  // CONTENT_RENDERER_MEDIA_AUDIO_DECODER_H_


text:
Exposes UINavigationController Storyboard functionality to Mac OSX

At the moment the view controller management is provided by BFNavigationController internally but this is likely to change soon.

Early version. Expect bugs!

Documentation to follow


text:
package org.apache.fluo.accumulo.iterators;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.IteratorEnvironment;
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iterators.SortedMapIterator;
import org.apache.fluo.accumulo.util.ColumnType;
import org.junit.Assert;
import org.junit.Test;

public class SnapshotIteratorTest {
  SnapshotIterator newSI(TestData input, long startTs, boolean returnReadLocks) {
    SnapshotIterator si = new SnapshotIterator();

    Map<String, String> options = new HashMap<>();
    options.put(SnapshotIterator.RETURN_READLOCK_PRESENT_OPT, returnReadLocks + "");
    options.put(SnapshotIterator.TIMESTAMP_OPT, startTs + "");

    IteratorEnvironment env = TestIteratorEnv.create(IteratorScope.scan, true);

    try {
      SortedKeyValueIterator<Key, Value> source = new SortedMapIterator(input.data);
      si.init(source, options, env);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    return si;
  }

  SnapshotIterator newSI(TestData input, long startTs) {
    return newSI(input, startTs, true);
  }

  @Test
  public void testBasic() {
    TestData input = new TestData();

    input.add("0 f q WRITE 16", "11");
    input.add("0 f q DATA 11", "15");

    input.add("0 f q WRITE 10", "9");
    input.add("0 f q DATA 9", "14");

    TestData output = new TestData(newSI(input, 6));
    Assert.assertEquals(0, output.data.size());

    TestData expected = new TestData().add("0 f q DATA 9", "14");
    checkInput(input, expected, 11);

    expected = new TestData().add("0 f q DATA 11", "15");
    checkInput(input, expected, 17);
  }

  @Test
  public void testLock() {
    TestData input = new TestData();

    input.add("0 f q WRITE 16", "11");
    input.add("0 f q LOCK 21", "1 f q");
    input.add("0 f q LOCK 11", "1 f q");
    input.add("0 f q DATA 11", "15");

    TestData output = new TestData(newSI(input, 6));
    Assert.assertEquals(0, output.data.size());

    output = new TestData(newSI(input, 15));
    Assert.assertEquals(0, output.data.size());

    TestData expected = new TestData().add("0 f q DATA 11", "15");
    checkInput(input, expected, 17);

    expected = new TestData().add("0 f q LOCK 21", "1 f q");
    checkInput(input, expected, 22);
  }

  @Test
  public void testDelLock() {
    // sometimes commit TS is used for del lock and sometimes start TS is used... either should
    // suppress a lock

    TestData input = new TestData();

    input.add("0 f q DEL_LOCK 21", "0 ROLLBACK");
    input.add("0 f q WRITE 16", "11");
    input.add("0 f q LOCK 21", "1 f q");
    input.add("0 f q LOCK 11", "1 f q");
    input.add("0 f q DATA 21", "16");
    input.add("0 f q DATA 11", "15");

    TestData output = new TestData(newSI(input, 6));
    Assert.assertEquals(0, output.data.size());

    output = new TestData(newSI(input, 15));
    Assert.assertEquals(0, output.data.size());

    TestData expected = new TestData().add("0 f q DATA 11", "15");
    checkInput(input, expected, 17);

    expected = new TestData().add("0 f q DATA 11", "15");
    checkInput(input, expected, 23);

    // test case where there is newer lock that's not invalidated by DEL_LOCK
    input = new TestData();
    input.add("0 f q DEL_LOCK 18", "0 ABORT");
    input.add("0 f q WRITE 16", "11");
    input.add("0 f q LOCK 21", "1 f q");
    input.add("0 f q LOCK 18", "1 f q");
    input.add("0 f q LOCK 11", "1 f q");
    input.add("0 f q DATA 21", "16");
    input.add("0 f q DATA 11", "15");

    output = new TestData(newSI(input, 6));
    Assert.assertEquals(0, output.data.size());

    expected = new TestData().add("0 f q DATA 11", "15");
    checkInput(input, expected, 17);

    expected = new TestData().add("0 f q DATA 11", "15");
    checkInput(input, expected, 19);

    expected = new TestData().add("0 f q LOCK 21", "1 f q");
    checkInput(input, expected, 23);
  }

  @Test
  public void testSeek() {

    // data contains multiple columns and multiple rows
    TestData input = new TestData();

    input.add("0 f q1 WRITE 16", "11");
    input.add("0 f q1 LOCK 21", "1 f q");
    input.add("0 f q1 LOCK 11", "1 f q");
    input.add("0 f q1 DATA 21", "j");
    input.add("0 f q1 DATA 11", "i");

    input.add("0 f q2 WRITE 26", "20");
    input.add("0 f q2 WRITE 18", "9");
    input.add("0 f q2 LOCK 20", "1 f q");
    input.add("0 f q2 LOCK 9", "1 f q");
    input.add("0 f q2 DATA 20", "b");
    input.add("0 f q2 DATA 9", "a");

    input.add("1 f q1 DEL_LOCK 21", "0 ROLLBACK");
    input.add("1 f q1 WRITE 18", "9");
    input.add("1 f q1 LOCK 21", "1 f q");
    input.add("1 f q1 LOCK 9", "1 f q");
    input.add("1 f q1 DATA 21", "y");
    input.add("1 f q1 DATA 9", "x");

    for (Range range : new Range[] {Range.exact("0"), Range.exact("1"), Range.exact("0", "f"),
        Range.exact("0", "f", "q1"), Range.exact("0", "f", "q2"), Range.exact("1", "f", "q1")}) {
      TestData output = new TestData(newSI(input, 6), range);
      Assert.assertEquals(0, output.data.size());

      output = new TestData(newSI(input, 17), range);
      TestData expected = new TestData();
      expected.addIfInRange("0 f q1 DATA 11", "i", range);
      Assert.assertEquals(expected, output);

      output = new TestData(newSI(input, 19), range);
      expected = new TestData();
      expected.addIfInRange("0 f q1 DATA 11", "i", range);
      expected.addIfInRange("0 f q2 DATA 9", "a", range);
      expected.addIfInRange("1 f q1 DATA 9", "x", range);
      Assert.assertEquals(expected, output);

      output = new TestData(newSI(input, 22), range);
      expected = new TestData();
      expected.addIfInRange("0 f q1 LOCK 21", "1 f q", range);
      expected.addIfInRange("0 f q2 DATA 9", "a", range);
      expected.addIfInRange("1 f q1 DATA 9", "x", range);
      Assert.assertEquals(expected, output);

      output = new TestData(newSI(input, 27), range);
      expected = new TestData();
      expected.addIfInRange("0 f q1 LOCK 21", "1 f q", range);
      expected.addIfInRange("0 f q2 DATA 20", "b", range);
      expected.addIfInRange("1 f q1 DATA 9", "x", range);
      Assert.assertEquals(expected, output);
    }
  }

  @Test
  public void testColumnsWithManyWrites() throws Exception {
    TestData input = new TestData();

    int numToWrite = 1000;

    for (int i = 0; i < numToWrite * 3; i += 3) {
      int commitTime = i + 1;
      int startTime = i;
      int val1 = ("" + i).hashCode();
      int val2 = ("" + val1).hashCode();

      input.add("0 f q1 WRITE " + commitTime, "" + startTime);
      input.add("0 f q1 LOCK " + startTime, "1 f q");
      input.add("0 f q1 DATA " + startTime, "" + val1);

      input.add("1 f q1 TX_DONE " + commitTime, "" + startTime);
      input.add("1 f q1 WRITE " + commitTime, "" + startTime);
      input.add("1 f q1 LOCK " + startTime, "1 f q");
      input.add("1 f q1 DATA " + startTime, "" + val2);
    }

    Range[] ranges = new Range[] {new Range(), Range.exact("0", "f", "q1"),
        Range.exact("1", "f", "q1"), Range.exact("2", "f", "q1")};

    for (Range range : ranges) {
      checkManyColumnData(input, numToWrite, range);
    }

    // add locks
    int startTime = numToWrite * 3;
    input.add("1 f q1 LOCK " + startTime, "1 f q");
    input.add("1 f q1 DATA " + startTime, "foo");
    TestData output = new TestData(newSI(input, startTime + 1), new Range());
    TestData expected = new TestData();
    expected.add("1 f q1 LOCK " + startTime, "1 f q");
    startTime -= 3;
    expected.add("0 f q1 DATA " + startTime, ("" + startTime).hashCode() + "");
    Assert.assertEquals(expected, output);

    for (Range range : ranges) {
      checkManyColumnData(input, numToWrite, range);
    }
  }

  @Test
  public void testReadLock() {
    TestData input = new TestData();

    input.add("0 f q WRITE 16", "11 DELETE");
    input.add("0 f q DATA 11", "15");
    input.add("0 f q DEL_RLOCK 5", "6");
    input.add("0 f q RLOCK 5", " 0 f q");

    input.add("1 f q WRITE 16", "11");
    input.add("1 f q DATA 11", "15");

    input.add("2 f q WRITE 16", "11");
    input.add("2 f q DATA 11", "17");
    input.add("2 f q DEL_RLOCK 5", "6");
    input.add("2 f q RLOCK 5", " 0 f q");

    TestData expected = new TestData();
    expected.add("0 f q DATA 11", "15");
    expected.add("1 f q DATA 11", "15");
    expected.add("2 f q DATA 11", "17");

    checkInput(input, expected, 20, false);

    expected.add("0 f q DEL_RLOCK 5", "6");
    expected.add("2 f q DEL_RLOCK 5", "6");

    checkInput(input, expected, 20);

  }

  private void checkInput(TestData input, TestData expected, long startTs) {
    checkInput(input, expected, startTs, true);
  }

  private void checkInput(TestData input, TestData expected, long startTs,
      boolean returnReadLocks) {
    // run test with a single seek followed by many next calls
    TestData output = new TestData(newSI(input, startTs, returnReadLocks), new Range());
    Assert.assertEquals(expected, output);

    // run test reseeking after each key
    output = new TestData(newSI(input, startTs, returnReadLocks), new Range(), true);
    Assert.assertEquals(expected, output);
  }

  private void checkManyColumnData(TestData input, int numToWrite, Range range) throws IOException {
    for (int i = numToWrite * 3 - 1; i > 3; i -= 3) {
      TestData output = new TestData(newSI(input, i), range);
      TestData expected = new TestData();
      // snapshot time of committed transaction
      int st = i - 2;
      int val1 = ("" + st).hashCode();
      int val2 = ("" + val1).hashCode();
      expected.addIfInRange("0 f q1 DATA " + st, val1 + "", range);
      expected.addIfInRange("1 f q1 DATA " + st, val2 + "", range);
      Assert.assertEquals(expected, output);
    }
  }

  @Test(expected = IllegalArgumentException.class)
  public void testNegativeTime() {
    SnapshotIterator.setSnaptime(null, -3);
  }

  @Test(expected = IllegalArgumentException.class)
  public void testNonZeroPrefix() {
    SnapshotIterator.setSnaptime(null, ColumnType.DATA.encode(6));
  }
}


text:
package org.sirix.index.art;

import java.util.AbstractCollection;
import java.util.Iterator;

// contains all stuff borrowed from TreeMap
// such methods/utilities should be taken out and made a library of their own
// so any implementation of NavigableMap can reuse it, while the implementation
// provides certain primitive methods (getEntry, successor, predecessor, etc)

class Values<K, V> extends AbstractCollection<V> {
	private final AdaptiveRadixTree<K, V> m;

	Values(AdaptiveRadixTree<K, V> m){
		this.m = m;
	}

	@Override
	public Iterator<V> iterator() {
		return m.valueIterator();
	}

	@Override
	public int size() {
		return m.size();
	}

	@Override
	public boolean contains(Object o) {
		return m.containsValue(o);
	}

	@Override
	public boolean remove(Object o) {
		for (LeafNode<K,V> e = m.getFirstEntry(); e != null; e = AdaptiveRadixTree.successor(e)) {
			if (AdaptiveRadixTree.valEquals(e.getValue(), o)) {
				m.deleteEntry(e);
				return true;
			}
		}
		return false;
	}

	@Override
	public void clear() {
		m.clear();
	}

	// TODO: implement Spliterator
}


text:
<?php

declare(strict_types=1);

namespace GrumPHP\Composer;

use Composer\Script\Event;
use GrumPHP\Collection\ProcessArgumentsCollection;
use GrumPHP\Process\ProcessFactory;
use GrumPHP\Util\Filesystem;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\ProcessBuilder;

class DevelopmentIntegrator
{
    /**
     * This method makes sure that GrumPHP registers itself during development.
     */
    public static function integrate(Event $event): void
    {
        $filesystem = new Filesystem();

        $composerBinDir = $event->getComposer()->getConfig()->get('bin-dir');
        $executable = dirname(__DIR__, 2).$filesystem->ensureValidSlashes('/bin/grumphp');
        $composerExecutable = $composerBinDir.'/grumphp';
        $filesystem->copy(
            $filesystem->ensureValidSlashes($executable),
            $filesystem->ensureValidSlashes($composerExecutable)
        );

        $commandlineArgs = ProcessArgumentsCollection::forExecutable($composerExecutable);
        $commandlineArgs->add('git:init');
        $process = self::fixInternalComposerProcessVersion($commandlineArgs);

        $process->run();
        if (!$process->isSuccessful()) {
            $event->getIO()->write(
                '<fg=red>GrumPHP can not sniff your commits. Did you specify the correct git-dir?</fg=red>'
            );
            $event->getIO()->write('<fg=red>'.$process->getErrorOutput().'</fg=red>');

            return;
        }

        $event->getIO()->write('<fg=yellow>'.$process->getOutput().'</fg=yellow>');
    }

    /**
     * Composer contains symfony/process:v2.8 internally
     * This causes this integration hook to fail. (Since the Process class is being loaded from internal composer PHAR)
     * @see https://github.com/composer/composer/blob/1.9.1/composer.lock#L772-L773
     *
     * This one can be removed once composer udpates its dependencies to at least symfony/process 3.3
     */
    private static function fixInternalComposerProcessVersion(
        ProcessArgumentsCollection $commandlineArgs
    ): Process {
        if (class_exists(ProcessBuilder::class, true)) {
            return ProcessBuilder::create($commandlineArgs->getValues())->getProcess();
        }

        return ProcessFactory::fromArguments($commandlineArgs);
    }
}


text:
package com.webcohesion.enunciate.modules.jackson1.model;

import com.webcohesion.enunciate.EnunciateException;
import com.webcohesion.enunciate.facets.Facet;
import com.webcohesion.enunciate.facets.HasFacets;
import com.webcohesion.enunciate.javac.decorations.element.DecoratedElement;
import com.webcohesion.enunciate.javac.decorations.element.DecoratedExecutableElement;
import com.webcohesion.enunciate.javac.decorations.element.DecoratedTypeElement;
import com.webcohesion.enunciate.javac.decorations.element.PropertyElement;
import com.webcohesion.enunciate.javac.decorations.type.TypeMirrorUtils;
import com.webcohesion.enunciate.metadata.ClientName;
import com.webcohesion.enunciate.metadata.Ignore;
import com.webcohesion.enunciate.modules.jackson1.EnunciateJackson1Context;
import org.codehaus.jackson.annotate.*;

import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.TypeVariable;
import javax.lang.model.type.WildcardType;
import javax.lang.model.util.ElementFilter;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import java.util.*;

/**
 * A json type definition.
 *
 * @author Ryan Heaton
 */
public abstract class TypeDefinition extends DecoratedTypeElement implements HasFacets {

  private final SortedSet<Member> members;
  private final Value value;
  private final WildcardMember wildcardMember;
  private final LinkedList<javax.lang.model.element.Element> referencedFrom = new LinkedList<javax.lang.model.element.Element>();
  private final Set<Facet> facets = new TreeSet<Facet>();
  protected final EnunciateJackson1Context context;

  protected TypeDefinition(TypeElement delegate, EnunciateJackson1Context context) {
    super(delegate, context.getContext().getProcessingEnvironment());

    String[] propOrder = null;
    boolean alphabetical = false;

    if (context.isHonorJaxb()) {
      XmlType typeInfo = getAnnotation(XmlType.class);
      if (typeInfo != null) {
        propOrder = typeInfo.propOrder();
        if (propOrder.length == 1 && "".equals(propOrder[0])) {
          propOrder = null;
        }
      }
    }

    JsonPropertyOrder propOrderInfo = getAnnotation(JsonPropertyOrder.class);
    if (propOrderInfo != null) {
      propOrder = propOrderInfo.value();
      alphabetical = propOrderInfo.alphabetic();
    }

    MemberComparator comparator = new MemberComparator(propOrder, alphabetical, env);
    SortedSet<Member> memberAccessors = new TreeSet<Member>(comparator);
    Value value = null;
    WildcardMember wildcardMember = null;
    JsonIgnoreType ignoreType = getAnnotation(JsonIgnoreType.class);
    if (ignoreType == null || !ignoreType.value()) {
      AccessorFilter filter = new AccessorFilter(getAnnotation(JsonAutoDetect.class), getAnnotation(JsonIgnoreProperties.class), context.isHonorJaxb(), getAnnotation(XmlAccessorType.class));
      value = null;

      wildcardMember = null;
      for (javax.lang.model.element.Element accessor : loadPotentialAccessors(filter)) {
        if (isValue(accessor)) {
          if (value != null) {
            throw new EnunciateException("Accessor " + accessor.getSimpleName() + " of " + getQualifiedName() + ": a type definition cannot have more than one json value.");
          }

          value = new Value(accessor, this, context);
        }
        else if (isWildcardProperty(accessor)) {
          wildcardMember = new WildcardMember(accessor, this, context);
        }
        else {
          //its an property accessor.

          if (accessor instanceof PropertyElement) {
            //if the accessor is a property and either the getter or setter overrides ANY method of ANY superclass, exclude it.
            if (overridesAnother(((PropertyElement) accessor).getGetter()) || overridesAnother(((PropertyElement) accessor).getSetter())) {
              continue;
            }
          }

          memberAccessors.add(new Member(accessor, this, context));
        }
      }
    }

    this.members = Collections.unmodifiableSortedSet(memberAccessors);
    this.value = value;
    this.wildcardMember = wildcardMember;
    this.facets.addAll(Facet.gatherFacets(delegate));
    this.facets.addAll(Facet.gatherFacets(this.env.getElementUtils().getPackageOf(delegate)));
    this.context = context;
  }

  protected TypeDefinition(TypeDefinition copy) {
    super(copy.delegate, copy.env);
    this.members = copy.members;
    this.value = copy.value;
    this.wildcardMember = copy.wildcardMember;
    this.facets.addAll(copy.facets);
    this.context = copy.context;
  }

  public EnunciateJackson1Context getContext() {
    return context;
  }

  /**
   * Load the potential accessors for this type definition.
   *
   * @param filter The filter.
   * @return the potential accessors for this type definition.
   */
  protected List<javax.lang.model.element.Element> loadPotentialAccessors(AccessorFilter filter) {
    List<VariableElement> potentialFields = new ArrayList<VariableElement>();
    List<PropertyElement> potentialProperties = new ArrayList<PropertyElement>();
    aggregatePotentialAccessors(potentialFields, potentialProperties, this, filter, false);

    List<javax.lang.model.element.Element> accessors = new ArrayList<javax.lang.model.element.Element>();
    accessors.addAll(potentialFields);
    accessors.addAll(potentialProperties);
    return accessors;
  }

  /**
   * Aggregate the potential accessor into their separate buckets for the given class declaration, recursively including transient superclasses.
   *
   * @param fields     The fields.
   * @param properties The properties.
   * @param clazz      The class.
   * @param filter     The filter.
   */
  protected void aggregatePotentialAccessors(List<VariableElement> fields, List<PropertyElement> properties, DecoratedTypeElement clazz, AccessorFilter filter, boolean childIsIgnored) {
    if (Object.class.getName().equals(clazz.getQualifiedName().toString())) {
      return;
    }

    DecoratedTypeElement superDeclaration = clazz.getSuperclass() != null ? (DecoratedTypeElement) this.env.getTypeUtils().asElement(clazz.getSuperclass()) : null;
    if (superDeclaration != null && (isJsonIgnored(superDeclaration) || childIsIgnored)) {
      childIsIgnored = true;
      aggregatePotentialAccessors(fields, properties, superDeclaration, filter, childIsIgnored);
    }

    for (VariableElement fieldDeclaration : ElementFilter.fieldsIn(clazz.getEnclosedElements())) {
      JsonUnwrapped unwrapped = fieldDeclaration.getAnnotation(JsonUnwrapped.class);
      if (unwrapped != null && unwrapped.enabled()) {
        TypeMirror typeMirror = fieldDeclaration.asType();
        if (!(typeMirror instanceof DeclaredType)) {
          throw new EnunciateException(String.format("%s: %s cannot be JSON unwrapped.", fieldDeclaration, typeMirror));
        }
        aggregatePotentialAccessors(fields, properties, (DecoratedTypeElement) ((DeclaredType)typeMirror).asElement(), filter, childIsIgnored);
      }
      else if (!filter.accept((DecoratedElement) fieldDeclaration)) {
        remove(fieldDeclaration, fields);
      }
      else {
        addOrReplace(fieldDeclaration, fields);
      }
    }

    for (PropertyElement propertyDeclaration : clazz.getProperties()) {
      JsonUnwrapped unwrapped = propertyDeclaration.getAnnotation(JsonUnwrapped.class);
      if (unwrapped != null && unwrapped.enabled()) {
        DecoratedTypeElement element;
        TypeMirror typeMirror = propertyDeclaration.asType();
        switch (typeMirror.getKind()) {
          case DECLARED:
            element = (DecoratedTypeElement) ((DeclaredType)typeMirror).asElement();
            break;
          case TYPEVAR:
            typeMirror = ((TypeVariable) typeMirror).getUpperBound();
            element = (DecoratedTypeElement) ((DeclaredType)typeMirror).asElement();
            break;
          case WILDCARD:
            TypeMirror bound = ((WildcardType) typeMirror).getExtendsBound();
            if (bound == null) {
              bound = ((WildcardType) typeMirror).getSuperBound();
            }
            if (!(bound instanceof DeclaredType)) {
              bound = TypeMirrorUtils.objectType(this.env);
            }
            element = (DecoratedTypeElement) ((DeclaredType)bound).asElement();
            break;
          default:
            throw new EnunciateException(String.format("%s: %s cannot be JSON unwrapped.", propertyDeclaration, typeMirror));
        }

        aggregatePotentialAccessors(fields, properties, element, filter, childIsIgnored);
      }
      else if (!filter.accept(propertyDeclaration)) {
        remove(propertyDeclaration, properties);
      }
      else {
        addOrReplace(propertyDeclaration, properties);
      }
    }
  }

  /**
   * Whether the given method declaration overrides any method.
   *
   * @param method The method declaration.
   * @return Whether the given method declaration overrides any method.
   */
  protected boolean overridesAnother(DecoratedExecutableElement method) {
    if (method == null) {
      return false;
    }

    final TypeElement declaringType = (TypeElement) method.getEnclosingElement();
    TypeElement superType = (TypeElement) this.env.getTypeUtils().asElement(declaringType.getSuperclass());
    while (superType != null && !Object.class.getName().equals(superType.getQualifiedName().toString())) {
      List<ExecutableElement> methods = ElementFilter.methodsIn(superType.getEnclosedElements());
      for (ExecutableElement candidate : methods) {
        if (this.env.getElementUtils().overrides(method, candidate, declaringType)) {
          return true;
        }
      }

      superType = (TypeElement) this.env.getTypeUtils().asElement(superType.getSuperclass());
    }

    return false;
  }

  /**
   * Add the specified member declaration, or if it is already in the list (by name), replace it.
   *
   * @param memberDeclaration  The member to add/replace.
   * @param memberDeclarations The other members.
   */
  protected <M extends javax.lang.model.element.Element> void addOrReplace(M memberDeclaration, List<M> memberDeclarations) {
    remove(memberDeclaration, memberDeclarations);
    memberDeclarations.add(memberDeclaration);
  }

  /**
   * Remove specified member declaration from the specified list, if it exists..
   *
   * @param memberDeclaration  The member to remove.
   * @param memberDeclarations The other members.
   */
  protected <M extends javax.lang.model.element.Element> void remove(M memberDeclaration, List<M> memberDeclarations) {
    Iterator<M> it = memberDeclarations.iterator();
    while (it.hasNext()) {
      javax.lang.model.element.Element candidate = it.next();
      if (candidate.getSimpleName().equals(memberDeclaration.getSimpleName())) {
        it.remove();
      }
    }
  }

  /**
   * Whether a declaration is a json value.
   *
   * @param declaration The declaration to check.
   * @return Whether a declaration is an value.
   */
  protected boolean isValue(javax.lang.model.element.Element declaration) {
    return (declaration.getAnnotation(JsonValue.class) != null);
  }

  /**
   * Whether the member declaration is a wildcard member.
   *
   * @param declaration The declaration.
   * @return Whether the member declaration is a wildcard member.
   */
  protected boolean isWildcardProperty(javax.lang.model.element.Element declaration) {
    return declaration.getAnnotation(JsonAnyGetter.class) != null;
  }

  /**
   * The simple name for client-side code generation.
   *
   * @return The simple name for client-side code generation.
   */
  public String getClientSimpleName() {
    String clientSimpleName = getSimpleName().toString();
    ClientName clientName = getAnnotation(ClientName.class);
    if (clientName != null) {
      clientSimpleName = clientName.value();
    }
    return clientSimpleName;
  }

  /**
   * The "wildcard" member.
   *
   * @return The "wildcard" member.
   */
  public WildcardMember getWildcardMember() {
    return wildcardMember;
  }

  /**
   * The members of this type definition.
   *
   * @return The members of this type definition.
   */
  public SortedSet<Member> getMembers() {
    return members;
  }

  /**
   * The value of this type definition.
   *
   * @return The value of this type definition.
   */
  public Value getValue() {
    return value;
  }

  /**
   * Whether a declaration is json ignored.
   *
   * @param declaration The declaration on which to determine json ignorance.
   * @return Whether a declaration is json ignored.
   */
  protected boolean isJsonIgnored(javax.lang.model.element.Element declaration) {
    JsonIgnore ignore = declaration.getAnnotation(JsonIgnore.class);
    return (ignore != null && ignore.value()) || declaration.getAnnotation(Ignore.class) != null;
  }

  /**
   * Whether this is a complex type.
   *
   * @return Whether this is a complex type.
   */
  public boolean isObject() {
    return false;
  }

  /**
   * Whether this is a enum type.
   *
   * @return Whether this is a enum type.
   */
  public boolean isEnum() {
    return false;
  }

  /**
   * Whether this is a simple type.
   *
   * @return Whether this is a simple type.
   */
  public boolean isSimple() {
    return false;
  }

  /**
   * Whether this type definition is a base object (i.e. a root of the object hierarchy).
   *
   * @return Whether this type definition is a base object
   */
  public boolean isBaseObject() {
    return true;
  }

  /**
   * Set of (human-readable) locations that this type definition is referenced from.
   *
   * @return The referenced-from list.
   */
  public LinkedList<javax.lang.model.element.Element> getReferencedFrom() {
    return referencedFrom;
  }

  /**
   * The facets here applicable.
   *
   * @return The facets here applicable.
   */
  public Set<Facet> getFacets() {
    return facets;
  }

  public boolean isHasTypeInfo() {
    return getAnnotation(JsonTypeInfo.class) != null;
  }

  public JsonTypeInfo.Id getTypeIdType() {
    JsonTypeInfo.Id typeIdType = JsonTypeInfo.Id.CLASS;

    JsonTypeInfo typeInfo = getAnnotation(JsonTypeInfo.class);
    if (typeInfo != null) {
      typeIdType = typeInfo.use();
    }

    return typeIdType;
  }

  public JsonTypeInfo.As getTypeIdInclusion() {
    JsonTypeInfo.As inclusion = JsonTypeInfo.As.PROPERTY;

    JsonTypeInfo typeInfo = getAnnotation(JsonTypeInfo.class);
    if (typeInfo != null) {
      inclusion = typeInfo.include();
    }

    return inclusion;
  }

  public String getTypeIdProperty() {
    String property = null;

    JsonTypeInfo typeInfo = getAnnotation(JsonTypeInfo.class);
    if (typeInfo != null) {
      property = typeInfo.property();
      if ("".equals(property)) {
        property = null;
      }
    }

    return null;
  }

  public List<Accessor> getAllAccessors() {
    ArrayList<Accessor> accessors = new ArrayList<Accessor>();
    Value value = getValue();
    if (value != null) {
      accessors.add(value);
    }
    accessors.addAll(getMembers());
    return accessors;
  }
}


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

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *

 * Describes the monitoring for the instance.
 *

 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class LaunchTemplatesMonitoring implements Serializable, Cloneable {

    /**
     *

     * Indicates whether detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
     *

     */
    private Boolean enabled;

    /**
     *

     * Indicates whether detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
     *

     *
     * @param enabled
     *        Indicates whether detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
     */

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    /**
     *

     * Indicates whether detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
     *

     *
     * @return Indicates whether detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
     */

    public Boolean getEnabled() {
        return this.enabled;
    }

    /**
     *

     * Indicates whether detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
     *

     *
     * @param enabled
     *        Indicates whether detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public LaunchTemplatesMonitoring withEnabled(Boolean enabled) {
        setEnabled(enabled);
        return this;
    }

    /**
     *

     * Indicates whether detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
     *

     *
     * @return Indicates whether detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
     */

    public Boolean isEnabled() {
        return this.enabled;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getEnabled() != null)
            sb.append("Enabled: ").append(getEnabled());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof LaunchTemplatesMonitoring == false)
            return false;
        LaunchTemplatesMonitoring other = (LaunchTemplatesMonitoring) obj;
        if (other.getEnabled() == null ^ this.getEnabled() == null)
            return false;
        if (other.getEnabled() != null && other.getEnabled().equals(this.getEnabled()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getEnabled() == null) ? 0 : getEnabled().hashCode());
        return hashCode;
    }

    @Override
    public LaunchTemplatesMonitoring clone() {
        try {
            return (LaunchTemplatesMonitoring) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
Usually encountered as a [decorator][decorators] that controls read / write access to a [class attribute][class-attributes], but actually implemented as a specialized class all its own. See the [docs][docs-property-as-function] for details.

[decorators]: ../decorators.md
[class-attributes]: ../class_attributes.md
[docs-property-as-function]: https://docs.python.org/3/library/functions.html#property


text:
"""
inet/__init__.py

Created by Thomas Mangin on 2015-06-04.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""

# This is a legacy file to handle 3.4.x like format

from exabgp.protocol.ip import IP
from exabgp.protocol.ip import NoNextHop

from exabgp.bgp.message import OUT

from exabgp.protocol.family import AFI
from exabgp.protocol.family import SAFI

from exabgp.bgp.message.update.nlri.cidr import CIDR
from exabgp.bgp.message.update.nlri.qualifier import Labels
from exabgp.bgp.message.update.nlri.qualifier import RouteDistinguisher
from exabgp.bgp.message.update.attribute import Attribute

from exabgp.rib.change import Change

from exabgp.configuration.core import Section

# from exabgp.configuration.static.parser import inet
from exabgp.configuration.static.parser import mpls
from exabgp.configuration.static.parser import attribute
from exabgp.configuration.static.parser import next_hop
from exabgp.configuration.static.parser import origin
from exabgp.configuration.static.parser import med
from exabgp.configuration.static.parser import as_path
from exabgp.configuration.static.parser import local_preference
from exabgp.configuration.static.parser import atomic_aggregate
from exabgp.configuration.static.parser import aggregator
from exabgp.configuration.static.parser import originator_id
from exabgp.configuration.static.parser import cluster_list
from exabgp.configuration.static.parser import community
from exabgp.configuration.static.parser import large_community
from exabgp.configuration.static.parser import extended_community
from exabgp.configuration.static.parser import aigp
from exabgp.configuration.static.parser import path_information
from exabgp.configuration.static.parser import name as named
from exabgp.configuration.static.parser import split
from exabgp.configuration.static.parser import watchdog
from exabgp.configuration.static.parser import withdraw
from exabgp.configuration.static.mpls import route_distinguisher
from exabgp.configuration.static.mpls import label

# Take an integer an created it networked packed representation for the right family (ipv4/ipv6)
def pack_int (afi, integer):
	return ''.join([chr((integer >> (offset * 8)) & 0xff) for offset in range(IP.length(afi)-1,-1,-1)])

class ParseStaticRoute (Section):
	# put next-hop first as it is a requirement atm
	definition = [
		'next-hop <ip>',
		'path-information <ipv4 formated number>',
		'route-distinguisher|rd <ipv4>:<port>|<16bits number>:<32bits number>|<32bits number>:<16bits number>',
		'origin IGP|EGP|INCOMPLETE',
		'as-path [ <asn>.. ]',
		'med <16 bits number>',
		'local-preference <16 bits number>',
		'atomic-aggregate',
		'community <16 bits number>',
		'large-community <96 bits number>',
		'extended-community target:<16 bits number>:<ipv4 formated number>',
		'originator-id <ipv4>',
		'cluster-list <ipv4>',
		'label <15 bits number>',
		'aggregator ( <asn16>:<ipv4> )',
		'aigp <40 bits number>',
		'attribute [ generic attribute format ]'
		'name <mnemonic>',
		'split /<mask>',
		'watchdog <watchdog-name>',
		'withdraw',
	]

	syntax = \
		'route <ip>/<netmask> { ' \
		'\n   ' + ' ;\n   '.join(definition) + '\n}'

	known = {
		'path-information':    path_information,
		'rd':                  route_distinguisher,
		'route-distinguisher': route_distinguisher,
		'label':               label,
		'attribute':           attribute,
		'next-hop':            next_hop,
		'origin':              origin,
		'med':                 med,
		'as-path':             as_path,
		'local-preference':    local_preference,
		'atomic-aggregate':    atomic_aggregate,
		'aggregator':          aggregator,
		'originator-id':       originator_id,
		'cluster-list':        cluster_list,
		'community':           community,
		'large-community':     large_community,
		'extended-community':  extended_community,
		'aigp':                aigp,
		'name':                named,
		'split':               split,
		'watchdog':            watchdog,
		'withdraw':            withdraw,
	}

	action = {
		'path-information':    'nlri-set',
		'rd':                  'nlri-set',
		'route-distinguisher': 'nlri-set',
		'label':               'nlri-set',
		'attribute':           'attribute-add',
		'next-hop':            'nexthop-and-attribute',
		'origin':              'attribute-add',
		'med':                 'attribute-add',
		'as-path':             'attribute-add',
		'local-preference':    'attribute-add',
		'atomic-aggregate':    'attribute-add',
		'aggregator':          'attribute-add',
		'originator-id':       'attribute-add',
		'cluster-list':        'attribute-add',
		'community':           'attribute-add',
		'large-community':     'attribute-add',
		'extended-community':  'attribute-add',
		'name':                'attribute-add',
		'split':               'attribute-add',
		'watchdog':            'attribute-add',
		'withdraw':            'attribute-add',
		'aigp':                'attribute-add',
	}

	assign = {
		'path-information':    'path_info',
		'rd':                  'rd',
		'route-distinguisher': 'rd',
		'label':               'labels',
	}

	name = 'static/route'

	def __init__ (self, tokeniser, scope, error, logger):
		Section.__init__(self,tokeniser,scope,error,logger)

	def clear (self):
		return True

	def pre (self):
		self.scope.set(self.name,mpls(self.tokeniser.iterate))
		# self.scope.set(self.name,inet(self.tokeniser.iterate))
		return True

	def post (self):
		# self._family()
		self._split()
		# self.scope.to_context()
		routes = self.scope.pop(self.name)
		if routes:
			for route in routes:
				# if route.nlri.has_rd():
				if route.nlri.rd is not RouteDistinguisher.NORD:
					route.nlri.safi = SAFI(SAFI.mpls_vpn)
				# elif route.nlri.has_label():
				elif route.nlri.labels is not Labels.NOLABEL:
					route.nlri.safi = SAFI(SAFI.nlri_mpls)

			self.scope.extend('routes',routes)
		return True

	# def _family (self):
	# 	last = self.scope.get(self.name)
	# 	if last.nlri.labels and not last.nlri.safi.has_label():
	# 		last.nlri.safi = SAFI(SAFI.nlri_mpls)

	def _check (self):
		if not self.check(self.scope.get(self.name)):
			return self.error.set(self.syntax)
		return True

	@staticmethod
	def check (change):
		if change.nlri.nexthop is NoNextHop \
			and change.nlri.action == OUT.ANNOUNCE \
			and change.nlri.afi == AFI.ipv4 \
			and change.nlri.safi in (SAFI.unicast,SAFI.multicast):
			return False
		return True

	@staticmethod
	def split (last):
		if Attribute.CODE.INTERNAL_SPLIT not in last.attributes:
			yield last
			return

		# ignore if the request is for an aggregate, or the same size
		mask = last.nlri.cidr.mask
		cut = last.attributes[Attribute.CODE.INTERNAL_SPLIT]
		if mask >= cut:
			yield last
			return

		# calculate the number of IP in the /<size> of the new route
		increment = pow(2,last.nlri.afi.mask() - cut)
		# how many new routes are we going to create from the initial one
		number = pow(2,cut - last.nlri.cidr.mask)

		# convert the IP into a integer/long
		ip = 0
		for c in last.nlri.cidr.ton():
			ip <<= 8
			ip += ord(c)

		afi = last.nlri.afi
		safi = last.nlri.safi

		# Really ugly
		klass = last.nlri.__class__
		path_info = last.nlri.path_info
		nexthop = last.nlri.nexthop
		if klass.has_label():
			labels = last.nlri.labels
		if klass.has_rd():
			rd = last.nlri.rd

		# XXX: Looks weird to set and then set to None, check
		last.nlri.cidr.mask = cut
		last.nlri = None

		# generate the new routes
		for _ in range(number):
			# update ip to the next route, this recalculate the "ip" field of the Inet class
			nlri = klass(afi,safi,OUT.ANNOUNCE)
			nlri.cidr = CIDR(pack_int(afi,ip),cut)
			nlri.nexthop = nexthop  # nexthop can be NextHopSelf
			nlri.path_info = path_info
			# Really ugly
			if klass.has_label():
				nlri.labels = labels
			if klass.has_rd():
				nlri.rd = rd
			# next ip
			ip += increment
			yield Change(nlri,last.attributes)

	def _split (self):
		for splat in self.split(self.scope.pop(self.name)):
			self.scope.append(self.name,splat)