text:
import("jsutils.*");
import("sqlbase.sqlcommon");
import("fastJSON");
import("timer");

jimport("java.lang.System.out.println");

function _sqlbase() {
  return sqlcommon.getSqlBase();
}

/**
 * Creates a SQL table suitable for storing a mapping from String to JSON value.
 * Maximum key length is 128 characters. Has no effect if the table already exists.
 */
function createJSONTable(tableName) {
  _sqlbase().createJSONTable(String(tableName));
}

/**
 * Retrieves a JavaScript object or value from a table.  Returns undefined
 * if there is no mapping for the given string key.  Requires that the table
 * exist.
 */
function getJSON(tableName, stringKey) {
  var result = _sqlbase().getJSON(String(tableName), String(stringKey));
  if (result) {

    return fastJSON.parse(String(result))['x'];

    /* performance-testing JSON
    var obj1 = timer.time("JSON.parse (json2)", function() {
      return JSON.parse(String(result))['x'];
    });
    var obj2 = timer.time("JSON.parse (fastJSON)", function() {
      return fastJSON.parse(String(result))['x'];
    });
    return obj2;
    */
  }
  return undefined;
}

function getAllJSON(tableName, start, count) {
  var result = _sqlbase().getAllJSON(String(tableName), Number(start), Number(count));
  return Array.prototype.map.call(result, function(x) {
    return {id: x.id(), value: fastJSON.parse(String(x.value()))['x']};
  })
}

function getAllJSONKeys(tableName) {
  var result = _sqlbase().getAllJSONKeys(String(tableName));
  return Array.prototype.map.call(result, function(x) { return String(x); });
}

/**
 * Assigns a JavaScript object or primitive value to a string key in a table.
 * Maximum key length is 128 characters. Requires that the table exist.
 */
function putJSON(tableName, stringKey, objectOrValue) {
  var obj = ({x:objectOrValue});

  var json = fastJSON.stringify(obj);

  /* performance-testing JSON

  var json1 = timer.time("JSON.stringify (json2)", function() {
    return JSON.stringify(obj);
  });
  var json2 = timer.time("JSON.stringify (fastJSON)", function() {
    return fastJSON.stringify(obj);
  });

  if (json1 != json2) {
    println("json strings do not match!");
    println("\n\n");
    println(json1);
    println("\n");
    println(json2);
    println("\n\n");
  }*/

  _sqlbase().putJSON(String(tableName), String(stringKey), json);
}

/**
 * Removes the mapping for a string key from a table.  Requires that the table
 * exist.
 */
function deleteJSON(tableName, stringKey) {
  _sqlbase().deleteJSON(String(tableName), String(stringKey));
}

/**
 * Creates a SQL table suitable for storing a mapping from (key,n) to string.
 * The mapping may be sparse, but storage is most efficient when n are consecutive.
 * The "length" of the array is not stored and must be externally maintained.
 * Maximum key length is 128 characters.  This call has no effect if the table
 * already exists.
 */
function createStringArrayTable(tableName) {
  _sqlbase().createStringArrayTable(String(tableName));
}

/**
 * Assigns a string value to a (key,n) pair in a StringArray table.  Maximum key length
 * is 128 characters.  Requires that the table exist.
 */
function putStringArrayElement(tableName, stringKey, n, value) {
  _sqlbase().putStringArrayElement(String(tableName), String(stringKey),
				Number(n), String(value));
}

/**
 * Equivalent to a series of consecutive puts of the elements of valueArray, with the first
 * one going to n=startN, the second to n=startN+1, and so on, but much more efficient.
 */
function putConsecutiveStringArrayElements(tableName, stringKey, startN, valueArray) {
  var putter = _sqlbase().putMultipleStringArrayElements(String(tableName), String(stringKey));
  for(var i=0;i<valueArray.length;i++) {
    putter.put(Number(startN)+i, String(valueArray[i]));
  }
  putter.finish();
}

/**
 * Equivalent to a series of puts of the (key,value) entries of the JavaScript object
 * nToValue, using as few database operations as possible.
 */
function putDictStringArrayElements(tableName, stringKey, nToValue) {
  var nArray = [];
  for(var n in nToValue) {
    nArray.push(n);
  }
  nArray.sort(function(a,b) { return Number(a) - Number(b); });

  var putter = _sqlbase().putMultipleStringArrayElements(String(tableName), String(stringKey));
  nArray.forEach(function(n) {
    putter.put(Number(n), String(nToValue[n]));
  });
  putter.finish();
}

/**
 * Retrieves a string value from a StringArray table.  Returns undefined
 * if there is no mapping for the given (key,n) pair.  Requires that the table
 * exist.
 */
function getStringArrayElement(tableName, stringKey, n) {
  var result = _sqlbase().getStringArrayElement(String(tableName),
    String(stringKey), Number(n));
  if (result) {
    return String(result);
  }
  return undefined;
}

/**
 * Retrieves all values from the database page that contains the mapping for n.
 * Properties are added to destMap for n, if present in the database, and any other
 * numeric entries in the same page.  No return value.
 */
function getPageStringArrayElements(tableName, stringKey, n, destMap) {
  var array = _sqlbase().getPageStringArrayElements(String(tableName), String(stringKey), n);
  for(var i=0;i<array.length;i++) {
    var entry = array[i];
    destMap[entry.index()] = String(entry.value());
  }
}

/**
 * Removes the mapping for a (key,n) pair from a StringArray table.  Requires that the table
 * exist.
 */
function deleteStringArrayElement(tableName, stringKey, n) {
  _sqlbase().putStringArrayElement(String(tableName), String(stringKey), Number(n), null);
}

/**
 * Removes all mappings and metadata associated with a given key in a table.
 */
function clearStringArray(tableName, stringKey) {
  _sqlbase().clearStringArray(String(tableName), stringKey);
}

function getStringArrayAllKeys(tableName) {
  var result = _sqlbase().getStringArrayAllKeys(String(tableName));
  return Array.prototype.map.call(result, function(x) { return String(x); });
}


text:
package com.komi.slider.mode;

import android.view.View;

/**
 * Created by Komi on 2016/2/21.
 */
public class AllMode extends SlidableMode {
    private static AllMode ourInstance = new AllMode();

    public static AllMode getInstance() {
        return ourInstance;
    }

    private AllMode() {

    }

    @Override
    public View getSlidableChild(View touchChild) {
        return touchChild;
    }

}

redpajama_set_name: RedPajamaGithub


text:
/*
 * This file contains sample wrappers showing Android Java Developers
 * who are not familiar with the NDK or JNI how to get data in and out of the
 * CPP and how to incorporate the sample code in
 * http://leveldb.googlecode.com/svn/trunk/doc/index.html into their JNI
 */
#include <string.h>
#include <jni.h>

#include <stdio.h>
#include <stdlib.h>
#include <android/log.h>

#include "leveldb/db.h"

#define  LOG_TAG    "AndroidLevelDB"
#define  LOGI(...)  __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
#define  LOGE(...)  __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)

leveldb::DB* db;
bool isDBopen;
char* databasePath;

extern "C" {
JNIEXPORT jstring JNICALL Java_com_google_code_p_leveldb_LevelDB_dbGet(JNIEnv * env, jobject thiz, jstring key1);
};

JNIEXPORT jstring JNICALL Java_com_google_code_p_leveldb_LevelDB_dbGet(JNIEnv * env, jobject thiz, jstring key1)
{
	//LOGI("In the get ");
	if(! isDBopen){
		LOGE("Trying to get when DB wasn't open");
//		LOGI("Opening database");

		leveldb::Options options;
		options.create_if_missing = true;
		leveldb::Status status = leveldb::DB::Open(options, databasePath, &db);
		if (status.ok()) {
			LOGI("Opened database");
			isDBopen = true;
		}else{
			LOGE("Failed to open database");
			isDBopen = false;
			databasePath = const_cast<char*>("");
			return env->NewStringUTF("NotFound");
		}
	}
	const char* key = env->GetStringUTFChars(key1,0);
	//LOGI("Key");
//	LOGI(key);

	std::string value;
	leveldb::Status status = db->Get(leveldb::ReadOptions(), key, &value);

	if (status.ok()) {
		const char* re =  value.c_str();
//		LOGI(re);
		return env->NewStringUTF(re);
	}else{
		const char* re =  status.ToString().c_str();
//		LOGI(re);
		return env->NewStringUTF("NotFound");
	}

}

extern "C" {
JNIEXPORT jstring JNICALL Java_com_google_code_p_leveldb_LevelDB_dbPut(JNIEnv * env, jobject thiz, jstring key1, jstring value1);
};

JNIEXPORT jstring JNICALL Java_com_google_code_p_leveldb_LevelDB_dbPut(JNIEnv * env, jobject thiz, jstring key1, jstring value1)
{
	if(! isDBopen){
		LOGE("Trying to put when DB wasn't open");
//		LOGI("Opening database");
		leveldb::Options options;
		options.create_if_missing = true;
		leveldb::Status status = leveldb::DB::Open(options, databasePath, &db);
		if (status.ok()) {
			LOGI("Opened database");
			isDBopen = true;
		}else{
			LOGE("Failed to open database");
			isDBopen = false;
			databasePath = const_cast<char*>("");
			return env->NewStringUTF("NotFound");
		}
	}
//	LOGI("In the put ");

	const char* key = env->GetStringUTFChars(key1,0);
	const char* value = env->GetStringUTFChars(value1,0);
	//LOGI("Key");
//	LOGI(key);
	//LOGI("Value");
//	LOGI(value);

	leveldb::Status status = db->Put(leveldb::WriteOptions(), key, value);
	if (status.ok()) {
		const char* re =  status.ToString().c_str();
//		LOGI(re);
		return env->NewStringUTF(key);
	}else{
		const char* re =  status.ToString().c_str();
		return env->NewStringUTF("NotFound");
	}

}
extern "C" {
JNIEXPORT jstring JNICALL Java_com_google_code_p_leveldb_LevelDB_dbOpen(JNIEnv* env, jobject thiz, jstring dbpath);
};

JNIEXPORT jstring JNICALL Java_com_google_code_p_leveldb_LevelDB_dbOpen(JNIEnv* env, jobject thiz, jstring dbpath)
{
	if(isDBopen){
		LOGI("DB was already open");
		return env->NewStringUTF("DB was already open");
	}
	const char* path = env->GetStringUTFChars(dbpath,0);
//	LOGI("Opening database");

	leveldb::Options options;
	options.create_if_missing = true;
	leveldb::Status status = leveldb::DB::Open(options, path, &db);
	if (status.ok()) {
		LOGI(path);
		LOGI("Opened database");
		isDBopen = true;
		databasePath = const_cast<char*>(path);
	}else{
		LOGE("Failed to open database");
		isDBopen = false;
		databasePath = const_cast<char*>("");
	}
	const char* re =  status.ToString().c_str();
	return env->NewStringUTF(re);
}

extern "C" {
JNIEXPORT jstring JNICALL Java_com_google_code_p_leveldb_LevelDB_dbClose(JNIEnv* env, jobject thiz, jstring dbpath);

};

JNIEXPORT jstring JNICALL Java_com_google_code_p_leveldb_LevelDB_dbClose(JNIEnv* env, jobject thiz, jstring dbpath)
{
	if(isDBopen){
		delete db;
		isDBopen = false;
		LOGI("Closed database");
	}else{
		LOGI("DB was already closed.");
	}
	return env->NewStringUTF("Closed database");
}
extern "C" {
JNIEXPORT jstring JNICALL Java_com_google_code_p_leveldb_LevelDB_dbDestroy(JNIEnv* env, jobject thiz, jstring dbpath);

};

JNIEXPORT jstring JNICALL Java_com_google_code_p_leveldb_LevelDB_dbDestroy(JNIEnv* env, jobject thiz, jstring dbpath)
{
	if(isDBopen){
		delete db;
	}
	const char* path = env->GetStringUTFChars(dbpath,0);
	leveldb::Options options;
	options.create_if_missing = true;
	leveldb::Status status = DestroyDB(path, options);
	LOGI("Destroyed (ie, cleared) database");

	/*re-open database */
	status = leveldb::DB::Open(options, path, &db);
	if (status.ok()) {
		LOGI(path);
		LOGI("Opened database");
		isDBopen = true;
		databasePath = const_cast<char*>(path);
	}else{
		LOGE("Failed to open database");
		isDBopen = false;
		databasePath = const_cast<char*>("");
	}
	return env->NewStringUTF("Destroyed (ie, cleared) database");
}
extern "C" {
JNIEXPORT jstring JNICALL Java_com_google_code_p_leveldb_LevelDB_dbDelete(JNIEnv * env, jobject thiz, jstring key1);
};

JNIEXPORT jstring JNICALL Java_com_google_code_p_leveldb_LevelDB_dbDelete(JNIEnv * env, jobject thiz, jstring key1)
{
	if(! isDBopen){
		LOGE("Trying to delete when DB wasn't open");
//		LOGI("Opening database");
		leveldb::Options options;
		options.create_if_missing = true;
		leveldb::Status status = leveldb::DB::Open(options, databasePath, &db);
		if (status.ok()) {
			LOGI("Opened database");
			isDBopen = true;
		}else{
			LOGE("Failed to open database");
			isDBopen = false;
			databasePath = const_cast<char*>("");
			return env->NewStringUTF("NotFound");
		}
	}
	LOGI("In the delete ");

	const char* key = env->GetStringUTFChars(key1,0);
	//LOGI("Key");
//	LOGI(key);

	leveldb::Status status = db->Delete(leveldb::WriteOptions(), key);
	if (status.ok()) {
//		LOGI("success");
		const char* re =  status.ToString().c_str();
		return env->NewStringUTF(re);
	}else{
//		LOGI("failure");
		const char* re =  status.ToString().c_str();
		return env->NewStringUTF("NotFound");
	}

}
extern "C" {
JNIEXPORT jstring JNICALL Java_com_google_code_p_leveldb_LevelDB_GetProperty(JNIEnv * env, jobject thiz);
};

JNIEXPORT jstring JNICALL Java_com_google_code_p_leveldb_LevelDB_GetProperty(JNIEnv * env, jobject thiz)
{
	return env->NewStringUTF("calling get property to find out db size etc");
}


text:
package com.comcast.money.core.async

import scala.concurrent.ExecutionContext

class DirectExecutionContext extends ExecutionContext {
  override def execute(runnable: Runnable): Unit = {
    try {
      runnable.run()
    } catch {
      case t: Throwable =>
        reportFailure(t)
    }
  }
  override def reportFailure(cause: Throwable): Unit = ExecutionContext.defaultReporter
}


text:
var fs, spelunk;

fs = require( 'fs' );
spelunk = require( 'spelunk' );

module.exports = function(grunt) {

	'use strict';

	grunt.registerMultiTask('spelunk', 'Flatten a folder to a JSON file representing its contents', function() {

		var done, options, key, root, dest, exclusions, path, result, contentsAreNumeric, removeExclusions, processFile, processDir, getKey;

		done = this.async();

		// Task config
		options = this.options({
			replacer: null,
			jsonpCallback: null,
			amd: false,
			processContent: null
		});

		root = this.data.root;
		dest = this.data.dest;

		// Error checking
		if ( !root ) {
			grunt.log.error( 'You must specify a root folder' );
			return false;
		}

		if ( !dest ) {
			grunt.log.error( 'You must specify a destination file' );
			return false;
		}

		if ( !grunt.file.exists( root ) || !grunt.file.isDir( root ) ) {
			grunt.log.error( 'Specified root folder does not exist' );
			return false;
		}

		// No errors, on with the show
		spelunk( root, { exclude: options.exclude }, function ( err, result ) {
			if ( err ) {
				done( false );
			}

			else {
				grunt.log.writeln( 'Writing file ' + dest );

				if ( options.amd ) {
					grunt.file.write( dest, 'define([],function () {\nreturn ' + JSON.stringify( result, options.replacer, options.space ) + ';\n}());' );
				} else if ( options.jsonpCallback ) {
					grunt.file.write( dest, options.jsonpCallback + '(' + JSON.stringify( result, options.replacer, options.space ) + ');' );
				} else {
					grunt.file.write( dest, JSON.stringify( result, options.replacer, options.space ) );
				}

				done();
			}
		});

	});

};


text:
AndroLua
========

AndroLua is the [Lua](http://www.lua.org/) interpreter ported to the [Android](http://www.android.com/) platform. Others have ported Lua to Android, but this project is special:

* it includes [LuaJava](http://www.keplerproject.org/luajava/), so you can access (almost) everything the [Android API](http://developer.android.com/reference/classes.html) provides
* because writing code on the soft keyboard can be hard, you can connect to it using TCP an upload code from your computer

I created it because I wanted to learn how to use the [Android NDK](http://developer.android.com/sdk/ndk/index.html) and explore the Android API without having to go through the fuss of creating a project, writing boilerplate code, compiling and uploading the APK just to test a few lines of code.

Depending on the interest, it may become something more...

Requirements
------------

* [Android SDK](http://developer.android.com/sdk/index.html)
* [Android NDK](http://developer.android.com/sdk/ndk/index.html)
* (optionally) Eclipse with the [ADT](http://developer.android.com/sdk/eclipse-adt.html) plugin

Lua and LuaJava sources are included.

Building
--------

Assuming that `$SDK` points to your SDK and `$NDK` points to your NDK installation, run the following:

    git clone git://github.com/mkottman/AndroLua.git
    cd AndroLua
    $NDK/ndk-build

This will build the native library, consisting of Lua and LuaJava. Then import the project into Eclipse, or run the following

    $SDK/tools/android update project -p .
    ant debug
    ant install

Usage
-----

The UI consist of the following:

* a large "Execute" button (that's what you want to do, after all)
* a text editor, where you can write Lua code, conveniently preloaded with the classic "Hello World!" example. A long click on the whole editor will clear it.
* a status/output window, that shows the output of 'print' function, and is scrollable should there be many lines of output

You can also work interactively by connecting to the TCP port 3333 of the device. You can do that either directly by using WiFi, or through the USB cable. For that you need to run the following:

    $SDK/platform-tools/adb forward tcp:3333 tcp:3333

In this version, there is a simple client `interp.lua` that uses LuaSocket. By default it will initially read stuff from `init.lua`.

For example:

	$ lua interp.lua
	loading init.lua

	> = activity
	sk.kottman.androlua.Main@405166c0
	> for i = 1,4 do print(i) end
	1
	2
	3
	4


text:
package org.apache.sling.maven.htl;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.sling.scripting.sightly.compiler.CompilationResult;
import org.apache.sling.scripting.sightly.compiler.CompilationUnit;
import org.apache.sling.scripting.sightly.compiler.CompilerMessage;
import org.apache.sling.scripting.sightly.compiler.SightlyCompiler;
import org.codehaus.plexus.util.Scanner;
import org.codehaus.plexus.util.StringUtils;
import org.sonatype.plexus.build.incremental.BuildContext;

/**
 * Validates HTL scripts.
 */
@Mojo(
        name = "validate",
        defaultPhase = LifecyclePhase.COMPILE,
        threadSafe = true
)
public class ValidateMojo extends AbstractMojo {

    private static final String DEFAULT_INCLUDES = "**/*.html";
    private static final String DEFAULT_EXCLUDES = "";

    @Component
    private BuildContext buildContext;

    @Parameter(defaultValue = "${project}", readonly = true, required = true)
    protected MavenProject project;

    /**
     * Defines the root folder where this Mojo expects to find Sightly scripts to validate.
     */
    @Parameter(property = "htl.sourceDirectory",
               defaultValue = "${project.build.sourceDirectory}")
    private File sourceDirectory;

    /**
     * List of files to include. Specified as fileset patterns which are relative to the input directory whose contents will be scanned
     * (see the sourceDirectory configuration option).
     */
    @Parameter(defaultValue = DEFAULT_INCLUDES)
    private String[] includes;

    /**
     * List of files to exclude. Specified as fileset patterns which are relative to the input directory whose contents will be scanned
     * (see the sourceDirectory configuration option).
     */
    @Parameter
    private String[] excludes;

    /**
     * If set to "true" it will fail the build on compiler warnings.
     */
    @Parameter(property = "htl.failOnWarnings",
               defaultValue = "false")
    private boolean failOnWarnings;

    /**
     * If set to "true" the validation will be skipped.
     */
    @Parameter(property = "htl.skip", defaultValue = "false")
    private boolean skip;

    private boolean hasWarnings = false;
    private boolean hasErrors = false;
    private String processedIncludes = null;
    private String processedExcludes = null;
    private List<File> processedFiles = Collections.emptyList();

    private int sourceDirectoryLength = 0;

    public void execute() throws MojoExecutionException, MojoFailureException {
        if (skip) {
            getLog().info("Skipping validation.");
            return;
        }

        long start = System.currentTimeMillis();

        if (!sourceDirectory.isAbsolute()) {
            sourceDirectory = new File(project.getBasedir(), sourceDirectory.getPath());
        }
        if (!sourceDirectory.exists()) {
            getLog().info("Source directory does not exist, skipping.");
            return;
        }
        if (!sourceDirectory.isDirectory()) {
            throw new MojoExecutionException(
                    String.format("Configured sourceDirectory={%s} is not a directory.", sourceDirectory.getAbsolutePath()));
        }

        if ( !buildContext.hasDelta(sourceDirectory )) {
            getLog().info("No files found to validate, skipping.");
            return;
        }

        // don't fail execution in Eclipse as it generates an error marker in the POM file, which is not desired
        boolean mayFailExecution = !buildContext.getClass().getName().startsWith("org.eclipse.m2e");

        sourceDirectoryLength = sourceDirectory.getAbsolutePath().length();
        processedIncludes = processIncludes();
        processedExcludes = processExcludes();
        try {
            SightlyCompiler compiler = new SightlyCompiler();

            Scanner scanner = buildContext.newScanner(sourceDirectory);
            scanner.setExcludes(new String[] { processedExcludes } );
            scanner.setIncludes(new String[] { processedIncludes } );
            scanner.scan();

            String[] includedFiles = scanner.getIncludedFiles();

            processedFiles = new ArrayList<>(includedFiles.length);
            for ( String includedFile : includedFiles ) {
                processedFiles.add(new File(sourceDirectory, includedFile));
            }
            Map<File, CompilationResult> compilationResults = new HashMap<>();
            for (File script : processedFiles) {
                compilationResults.put(script, compiler.compile(getCompilationUnit(script)));
            }
            for (Map.Entry<File, CompilationResult> entry : compilationResults.entrySet()) {
                File script = entry.getKey();
                CompilationResult result = entry.getValue();
                buildContext.removeMessages(script);

                if (result.getWarnings().size() > 0) {
                    for (CompilerMessage message : result.getWarnings()) {
                        buildContext.addMessage(script, message.getLine(), message.getColumn(), message.getMessage(), BuildContext.SEVERITY_WARNING, null);
                    }
                    hasWarnings = true;
                }
                if (result.getErrors().size() > 0) {
                    for (CompilerMessage message : result.getErrors()) {
                        String messageString = message.getMessage().replaceAll(System.lineSeparator(), "");
                        buildContext.addMessage(script, message.getLine(), message.getColumn(), messageString, BuildContext.SEVERITY_ERROR, null);
                    }
                    hasErrors = true;
                }
            }

            getLog().info("Processed " + processedFiles.size() + " files in " + ( System.currentTimeMillis() - start ) + " milliseconds");

            if (mayFailExecution && hasWarnings && failOnWarnings) {
                throw new MojoFailureException("Compilation warnings were configured to fail the build.");
            }
            if (mayFailExecution && hasErrors) {
                throw new MojoFailureException("Please check the reported syntax errors.");
            }
        } catch (IOException e) {
            throw new MojoExecutionException(String.format("Cannot filter files from {%s} with includes {%s} and excludes {%s}.",
                    sourceDirectory.getAbsolutePath(), processedIncludes, processedExcludes), e);
        }

    }

    public File getSourceDirectory() {
        return sourceDirectory;
    }

    public boolean shouldFailOnWarnings() {
        return failOnWarnings;
    }

    public boolean hasWarnings() {
        return hasWarnings;
    }

    public boolean hasErrors() {
        return hasErrors;
    }

    public String getIncludes() {
        return processedIncludes;
    }

    public String getExcludes() {
        return processedExcludes;
    }

    public List<File> getProcessedFiles() {
        return processedFiles;
    }

    private String processIncludes() {
        // since default = "" leads to null deal with that as well here
        if (includes == null) {
            return "";
        }
        return join(includes, ',');
    }

    private String processExcludes() {
        if (excludes == null) {
            return DEFAULT_EXCLUDES;
        }
        return join(excludes, ',');
    }

    private String join(String[] array, char joinChar) {
        StringBuilder stringBuilder = new StringBuilder();
        for (int index = 0; index < array.length; index++) {
            stringBuilder.append(StringUtils.trim(array[index]));
            if (index < array.length - 1) {
                stringBuilder.append(joinChar);
            }
        }
        return stringBuilder.toString();
    }

    private CompilationUnit getCompilationUnit(final File file) throws FileNotFoundException {
        final Reader reader = new FileReader(file);
        return new CompilationUnit() {
            public String getScriptName() {
                return file.getAbsolutePath().substring(sourceDirectoryLength);
            }

            public Reader getScriptReader() {
                return reader;
            }
        };
    }

    // visible for testing only
    void setBuildContext(BuildContext buildContext) {

        this.buildContext = buildContext;
    }
}


text:
(function() {
  if (!this.require) {
    var modules = {}, cache = {};

    var require = function(name, root) {
      var path = expand(root, name), indexPath = expand(path, './index'), module, fn;
      module   = cache[path] || cache[indexPath];
      if (module) {
        return module;
      } else if (fn = modules[path] || modules[path = indexPath]) {
        module = {id: path, exports: {}};
        cache[path] = module.exports;
        fn(module.exports, function(name) {
          return require(name, dirname(path));
        }, module);
        return cache[path] = module.exports;
      } else {
        throw 'module ' + name + ' not found';
      }
    };

    var expand = function(root, name) {
      var results = [], parts, part;
      // If path is relative
      if (/^\.\.?(\/|$)/.test(name)) {
        parts = [root, name].join('/').split('/');
      } else {
        parts = name.split('/');
      }
      for (var i = 0, length = parts.length; i < length; i++) {
        part = parts[i];
        if (part == '..') {
          results.pop();
        } else if (part != '.' && part != '') {
          results.push(part);
        }
      }
      return results.join('/');
    };

    var dirname = function(path) {
      return path.split('/').slice(0, -1).join('/');
    };

    this.require = function(name) {
      return require(name, '');
    };

    this.require.define = function(bundle) {
      for (var key in bundle) {
        modules[key] = bundle[key];
      }
    };

    this.require.modules = modules;
    this.require.cache   = cache;
  }

  return this.require;
}).call(this);
this.require.define({"app/controllers/inspector/dimensions":function(exports, require, module){(function() {
  var Dimensions,
    __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };

  Dimensions = (function(_super) {

    __extends(Dimensions, _super);

    Dimensions.name = 'Dimensions';

    Dimensions.prototype.className = 'dimensions';

    Dimensions.prototype.events = {
      'change input': 'change'
    };

    Dimensions.prototype.elements = {
      'input': '$inputs',
      'input[name=width]': '$width',
      'input[name=height]': '$height',
      'input[name=x]': '$x',
      'input[name=y]': '$y'
    };

    function Dimensions() {
      this.update = __bind(this.update, this);

      this.render = __bind(this.render, this);
      Dimensions.__super__.constructor.apply(this, arguments);
      $(document).bind('resize.element move.element', this.update);
      this.html(JST['app/views/inspector/dimensions'](this));
    }

    Dimensions.prototype.render = function() {
      this.disabled = !this.stage.selection.isSingle();
      this.update();
      this.el.toggleClass('disabled', this.disabled);
      this.$inputs.attr('disabled', this.disabled);
      return this;
    };

    Dimensions.prototype.update = function() {
      this.disabled = !this.stage.selection.isSingle();
      if (this.disabled) {
        return;
      }
      this.$width.val(this.stage.selection.get('width'));
      this.$height.val(this.stage.selection.get('height'));
      this.$x.val(this.stage.selection.get('left'));
      return this.$y.val(this.stage.selection.get('top'));
    };

    Dimensions.prototype.change = function(e) {
      this.stage.history.record('dimensions');
      this.stage.selection.set('width', parseInt(this.$width.val(), 10));
      this.stage.selection.set('height', parseInt(this.$height.val(), 10));
      this.stage.selection.set('left', parseInt(this.$x.val(), 10));
      return this.stage.selection.set('top', parseInt(this.$y.val(), 10));
    };

    Dimensions.prototype.release = function() {
      $(document).unbind('resize.element', this.update);
      $(document).unbind('move.element', this.update);
      return Dimensions.__super__.release.apply(this, arguments);
    };

    return Dimensions;

  })(Spine.Controller);

  module.exports = Dimensions;

}).call(this);
;}});


text:
/*

Name:       Base16 Colors Light
Author:     mrmrs (http://clrs.cc)

Prism template by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/prism/)
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)

*/
code[class*="language-"],
pre[class*="language-"] {
  font-family: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace;
  font-size: 14px;
  line-height: 1.375;
  direction: ltr;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  -moz-tab-size: 4;
  -o-tab-size: 4;
  tab-size: 4;
  -webkit-hyphens: none;
  -moz-hyphens: none;
  -ms-hyphens: none;
  hyphens: none;
  background: #ffffff;
  color: #555555;
}

pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
  text-shadow: none;
  background: #dddddd;
}

pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
code[class*="language-"]::selection, code[class*="language-"] ::selection {
  text-shadow: none;
  background: #dddddd;
}

/* Code blocks */
pre[class*="language-"] {
  padding: 1em;
  margin: .5em 0;
  overflow: auto;
}

/* Inline code */
:not(pre) > code[class*="language-"] {
  padding: .1em;
  border-radius: .3em;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #999999;
}

.token.punctuation {
  color: #555555;
}

.token.namespace {
  opacity: .7;
}

.token.operator,
.token.boolean,
.token.number {
  color: #ff851b;
}

.token.property {
  color: #ffdc00;
}

.token.tag {
  color: #0074d9;
}

.token.string {
  color: #7fdbff;
}

.token.selector {
  color: #b10dc9;
}

.token.attr-name {
  color: #ff851b;
}

.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: #7fdbff;
}

.token.attr-value,
.token.keyword,
.token.control,
.token.directive,
.token.unit {
  color: #2ecc40;
}

.token.statement,
.token.regex,
.token.atrule {
  color: #7fdbff;
}

.token.placeholder,
.token.variable {
  color: #0074d9;
}

.token.deleted {
  text-decoration: line-through;
}

.token.inserted {
  border-bottom: 1px dotted #111111;
  text-decoration: none;
}

.token.italic {
  font-style: italic;
}

.token.important,
.token.bold {
  font-weight: bold;
}

.token.important {
  color: #ff4136;
}

.token.entity {
  cursor: help;
}

pre > code.highlight {
  outline: 0.4em solid #ff4136;
  outline-offset: .4em;
}


text:
layout: page
title: Davis Island Global Award Ceremony
date: 2016-05-24
author: Kimberly Hartman
tags: weekly links, java
status: published
summary: Suspendisse non sollicitudin dui, eget interdum.
banner: images/banner/leisure-02.jpg
booking:
  startDate: 03/19/2018
  endDate: 03/23/2018
  ctyhocn: GSOFSHX
  groupCode: DIGAC
published: true
---
Integer in risus est. Pellentesque consequat metus in vulputate vulputate. Donec molestie risus ac sapien tempor, ac accumsan lacus consectetur. In vehicula hendrerit elit, sed cursus leo fermentum vel. Donec efficitur neque lacus, nec imperdiet ipsum fermentum faucibus. Aliquam erat volutpat. Nam iaculis metus nec nibh accumsan, vel vestibulum nisi dignissim. Maecenas viverra orci eget quam tristique ultricies. Etiam quam diam, malesuada ac ultricies ut, euismod et ante. Suspendisse tristique sem at tortor bibendum, et aliquet neque ultricies.
Maecenas porttitor et nunc vel lobortis. Sed semper ullamcorper odio ac porta. Ut commodo vehicula nunc mollis pretium. Ut vitae nibh tincidunt enim blandit luctus a vitae leo. Suspendisse in aliquet orci, vitae commodo libero. Nam a tincidunt libero. Vivamus nec dolor sed ante imperdiet viverra. Donec id arcu massa. Duis aliquet posuere eros eu blandit. Donec ligula odio, faucibus pharetra magna quis, pharetra venenatis ante. Sed sit amet urna nibh. Aliquam et eleifend tortor, sed tristique leo. Integer volutpat accumsan felis scelerisque suscipit. Aliquam a euismod felis. Praesent dignissim mi molestie enim mollis, eu vestibulum massa imperdiet.

1 Mauris eu sem id mi consequat accumsan
1 Fusce ac arcu eu metus finibus viverra vel sed turpis.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sit amet ipsum nec nisi vestibulum semper. Donec laoreet, elit ac rutrum facilisis, turpis tortor pulvinar orci, sit amet laoreet sem nibh quis mi. Aliquam nec quam ac sapien suscipit consequat. Aenean faucibus rutrum dolor, sed convallis mauris venenatis eu. Nam nec dolor sagittis, viverra ex quis, ullamcorper lectus. Nullam facilisis ultricies suscipit. Cras dolor dolor, laoreet sit amet laoreet et, interdum in tellus.


text:
using System.ComponentModel.DataAnnotations;

namespace OptionsWebSite.ViewModels.Account
{
    public class RegisterViewModel
    {
        [Required(ErrorMessage = "{0} is required.")]
        [Display(Name = "Student Number")]
        [MaxLength(9)]
        [RegularExpression(@"^A00\d{6}$", ErrorMessage = "Proper format is: A00######")]
        public string UserName { get; set; }

        [Required(ErrorMessage = "{0} is required.")]
        [EmailAddress(ErrorMessage = "That is not a proper email format.")]
        [Display(Name = "Email")]
        public string Email { get; set; }

        [Required(ErrorMessage = "{0} is required.")]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [Required(ErrorMessage = "{0} is required.")]
        [DataType(DataType.Password)]
        [Display(Name = "Confirm password")]
        [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }
    }
}


text:
FileData::FileData(FileType type, const std::string& path, SystemEnvironmentData* envData, SystemData* system)
	: mType(type), mPath(path), mSystem(system), mEnvData(envData), mSourceFileData(NULL), mParent(NULL), metadata(type == GAME ? GAME_METADATA : FOLDER_METADATA) // metadata is REALLY set in the constructor!
{
	// metadata needs at least a name field (since that's what getName() will return)
	if(metadata.get("name").empty())
		metadata.set("name", getDisplayName());
	mSystemName = system->getName();
	metadata.resetChangedFlag();
}

FileData::~FileData()
{
	if(mParent)
		mParent->removeChild(this);

	if(mType == GAME)
		mSystem->getIndex()->removeFromIndex(this);

	mChildren.clear();
}

std::string FileData::getDisplayName() const
{
	std::string stem = Utils::FileSystem::getStem(mPath);
	if(mSystem && mSystem->hasPlatformId(PlatformIds::ARCADE) || mSystem->hasPlatformId(PlatformIds::NEOGEO))
		stem = MameNames::getInstance()->getRealName(stem);

	return stem;
}

std::string FileData::getCleanName() const
{
	return Utils::String::removeParenthesis(this->getDisplayName());
}

const std::string FileData::getThumbnailPath() const
{
	std::string thumbnail = metadata.get("thumbnail");

	// no thumbnail, try image
	if(thumbnail.empty())
	{
		thumbnail = metadata.get("image");

		// no image, try to use local image
		if(thumbnail.empty() && Settings::getInstance()->getBool("LocalArt"))
		{
			const char* extList[2] = { ".png", ".jpg" };
			for(int i = 0; i < 2; i++)
			{
				if(thumbnail.empty())
				{
					std::string path = mEnvData->mStartPath + "/images/" + getDisplayName() + "-image" + extList[i];
					if(Utils::FileSystem::exists(path))
						thumbnail = path;
				}
			}
		}
	}

	return thumbnail;
}

const std::string& FileData::getName()
{
	return metadata.get("name");
}

const std::string& FileData::getSortName()
{
	if (metadata.get("sortname").empty())
		return metadata.get("name");
	else
		return metadata.get("sortname");
}

const std::vector<FileData*>& FileData::getChildrenListToDisplay() {

	FileFilterIndex* idx = CollectionSystemManager::get()->getSystemToView(mSystem)->getIndex();
	if (idx->isFiltered()) {
		mFilteredChildren.clear();
		for(auto it = mChildren.cbegin(); it != mChildren.cend(); it++)
		{
			if (idx->showFile((*it))) {
				mFilteredChildren.push_back(*it);
			}
		}

		return mFilteredChildren;
	}
	else
	{
		return mChildren;
	}
}

const std::string FileData::getVideoPath() const
{
	std::string video = metadata.get("video");

	// no video, try to use local video
	if(video.empty() && Settings::getInstance()->getBool("LocalArt"))
	{
		std::string path = mEnvData->mStartPath + "/images/" + getDisplayName() + "-video.mp4";
		if(Utils::FileSystem::exists(path))
			video = path;
	}

	return video;
}

const std::string FileData::getMarqueePath() const
{
	std::string marquee = metadata.get("marquee");

	// no marquee, try to use local marquee
	if(marquee.empty() && Settings::getInstance()->getBool("LocalArt"))
	{
		const char* extList[2] = { ".png", ".jpg" };
		for(int i = 0; i < 2; i++)
		{
			if(marquee.empty())
			{
				std::string path = mEnvData->mStartPath + "/images/" + getDisplayName() + "-marquee" + extList[i];
				if(Utils::FileSystem::exists(path))
					marquee = path;
			}
		}
	}

	return marquee;
}

const std::string FileData::getImagePath() const
{
	std::string image = metadata.get("image");

	// no image, try to use local image
	if(image.empty())
	{
		const char* extList[2] = { ".png", ".jpg" };
		for(int i = 0; i < 2; i++)
		{
			if(image.empty())
			{
				std::string path = mEnvData->mStartPath + "/images/" + getDisplayName() + "-image" + extList[i];
				if(Utils::FileSystem::exists(path))
					image = path;
			}
		}
	}

	return image;
}

std::vector<FileData*> FileData::getFilesRecursive(unsigned int typeMask, bool displayedOnly) const
{
	std::vector<FileData*> out;
	FileFilterIndex* idx = mSystem->getIndex();

	for(auto it = mChildren.cbegin(); it != mChildren.cend(); it++)
	{
		if((*it)->getType() & typeMask)
		{
			if (!displayedOnly || !idx->isFiltered() || idx->showFile(*it))
				out.push_back(*it);
		}

		if((*it)->getChildren().size() > 0)
		{
			std::vector<FileData*> subchildren = (*it)->getFilesRecursive(typeMask, displayedOnly);
			out.insert(out.cend(), subchildren.cbegin(), subchildren.cend());
		}
	}

	return out;
}

std::string FileData::getKey() {
	return getFileName();
}

const bool FileData::isArcadeAsset()
{
	const std::string stem = Utils::FileSystem::getStem(mPath);
	return (
		(mSystem && (mSystem->hasPlatformId(PlatformIds::ARCADE) || mSystem->hasPlatformId(PlatformIds::NEOGEO)))
		&&
		(MameNames::getInstance()->isBios(stem) || MameNames::getInstance()->isDevice(stem))
	);
}

FileData* FileData::getSourceFileData()
{
	return this;
}

void FileData::addChild(FileData* file)
{
	assert(mType == FOLDER);
	assert(file->getParent() == NULL);

	const std::string key = file->getKey();
	if (mChildrenByFilename.find(key) == mChildrenByFilename.cend())
	{
		mChildrenByFilename[key] = file;
		mChildren.push_back(file);
		file->mParent = this;
	}
}

void FileData::removeChild(FileData* file)
{
	assert(mType == FOLDER);
	assert(file->getParent() == this);
	mChildrenByFilename.erase(file->getKey());
	for(auto it = mChildren.cbegin(); it != mChildren.cend(); it++)
	{
		if(*it == file)
		{
			file->mParent = NULL;
			mChildren.erase(it);
			return;
		}
	}

	// File somehow wasn't in our children.
	assert(false);

}

void FileData::sort(ComparisonFunction& comparator, bool ascending)
{
	std::stable_sort(mChildren.begin(), mChildren.end(), comparator);

	for(auto it = mChildren.cbegin(); it != mChildren.cend(); it++)
	{
		if((*it)->getChildren().size() > 0)
			(*it)->sort(comparator, ascending);
	}

	if(!ascending)
		std::reverse(mChildren.begin(), mChildren.end());
}

void FileData::sort(const SortType& type)
{
	sort(*type.comparisonFunction, type.ascending);
}

void FileData::launchGame(Window* window)
{
	LOG(LogInfo) << "Attempting to launch game...";

	AudioManager::getInstance()->deinit();
	VolumeControl::getInstance()->deinit();
	InputManager::getInstance()->deinit();
	window->deinit();

	std::string command = mEnvData->mLaunchCommand;

	const std::string rom      = Utils::FileSystem::getEscapedPath(getPath());
	const std::string basename = Utils::FileSystem::getStem(getPath());
	const std::string rom_raw  = Utils::FileSystem::getPreferredPath(getPath());
	const std::string name     = getName();

	command = Utils::String::replace(command, "%ROM%", rom);
	command = Utils::String::replace(command, "%BASENAME%", basename);
	command = Utils::String::replace(command, "%ROM_RAW%", rom_raw);

	Scripting::fireEvent("game-start", rom, basename, name);

	LOG(LogInfo) << "	" << command;
	int exitCode = runSystemCommand(command);

	if(exitCode != 0)
	{
		LOG(LogWarning) << "...launch terminated with nonzero exit code " << exitCode << "!";
	}

	Scripting::fireEvent("game-end");

	window->init();
	InputManager::getInstance()->init();
	VolumeControl::getInstance()->init();
	window->normalizeNextUpdate();

	//update number of times the game has been launched

	FileData* gameToUpdate = getSourceFileData();

	int timesPlayed = gameToUpdate->metadata.getInt("playcount") + 1;
	gameToUpdate->metadata.set("playcount", std::to_string(static_cast<long long>(timesPlayed)));

	//update last played time
	gameToUpdate->metadata.set("lastplayed", Utils::Time::DateTime(Utils::Time::now()));
	CollectionSystemManager::get()->refreshCollectionSystems(gameToUpdate);

	gameToUpdate->mSystem->onMetaDataSavePoint();
}

CollectionFileData::CollectionFileData(FileData* file, SystemData* system)
	: FileData(file->getSourceFileData()->getType(), file->getSourceFileData()->getPath(), file->getSourceFileData()->getSystemEnvData(), system)
{
	// we use this constructor to create a clone of the filedata, and change its system
	mSourceFileData = file->getSourceFileData();
	refreshMetadata();
	mParent = NULL;
	metadata = mSourceFileData->metadata;
	mSystemName = mSourceFileData->getSystem()->getName();
}

CollectionFileData::~CollectionFileData()
{
	// need to remove collection file data at the collection object destructor
	if(mParent)
		mParent->removeChild(this);
	mParent = NULL;
}

std::string CollectionFileData::getKey() {
	return getFullPath();
}

FileData* CollectionFileData::getSourceFileData()
{
	return mSourceFileData;
}

void CollectionFileData::refreshMetadata()
{
	metadata = mSourceFileData->metadata;
	mDirty = true;
}

const std::string& CollectionFileData::getName()
{
	if (mDirty) {
		mCollectionFileName = Utils::String::removeParenthesis(mSourceFileData->metadata.get("name"));
		mCollectionFileName += " [" + Utils::String::toUpper(mSourceFileData->getSystem()->getName()) + "]";
		mDirty = false;
	}

	if (Settings::getInstance()->getBool("CollectionShowSystemInfo"))
		return mCollectionFileName;
	return mSourceFileData->metadata.get("name");
}

// returns Sort Type based on a string description
FileData::SortType getSortTypeFromString(std::string desc) {
	std::vector<FileData::SortType> SortTypes = FileSorts::SortTypes;
	// find it
	for(unsigned int i = 0; i < FileSorts::SortTypes.size(); i++)
	{
		const FileData::SortType& sort = FileSorts::SortTypes.at(i);
		if(sort.description == desc)
		{
			return sort;
		}
	}
	// if not found default to name, ascending
	return FileSorts::SortTypes.at(0);
}


text:
<?php
$this->breadcrumbs=array(
	'Kepribadians'=>array('index'),
	$model->id_pribadi=>array('view','id'=>$model->id_pribadi),
	'Update',
);

$this->menu=array(
	array('label'=>'List Kepribadian','url'=>array('index')),
	array('label'=>'Create Kepribadian','url'=>array('create')),
	array('label'=>'View Kepribadian','url'=>array('view','id'=>$model->id_pribadi)),
	array('label'=>'Manage Kepribadian','url'=>array('admin')),
);
?>

<?php $box = $this->beginWidget('bootstrap.widgets.TbBox', array(
	'title' => 'PERBAHARUI KEPRIBADIAN',
	'headerIcon' => 'icon-share',
	'htmlOptions'=>array('class'=>'inline'),
	// when displaying a table, if we include bootstra-widget-table class
	// the table will be 0-padding to the box
));?>
<?php echo $this->renderPartial('_form',array('model'=>$model)); ?>
<?php $this->endWidget(); ?>


text:
#include <stdio.h>
#include <limits.h>

#include "utf_tab.h"
#include "cpk_uncompress.h"
#include "util.h"
#include "error_stuff.h"

void analyze_CPK(reader_t *infile, const char *base_name, long file_length);

int main(int argc, char **argv)
{
    printf("cpk_unpack " VERSION "\n\n");
    if (argc != 2)
    {
        fprintf(stderr,"Incorrect program usage\n\nusage: %s file\n",argv[0]);
        exit(EXIT_FAILURE);
    }

    /* open file */
    reader_t *infile = open_reader_file(argv[1]);
    CHECK_ERRNO(!infile, "fopen");

    const char *base_postfix = "_unpacked";
    char *base_name = malloc(strlen(argv[1])+strlen(base_postfix)+1);
    CHECK_ERRNO(!base_name, "malloc");
    strcpy(base_name, strip_path(argv[1]));
    strcat(base_name, base_postfix);

    long file_length = reader_length(infile);

    analyze_CPK(infile, base_name, file_length);

    free(base_name);
    close_reader(infile);

    exit(EXIT_SUCCESS);
}

void analyze_CPK(reader_t *infile, const char *base_name, long file_length)
{
    const long CpkHeader_offset = 0x0;
    char *toc_string_table = NULL;

    /* check header */
    {
        unsigned char buf[4];
        static const char CPK_signature[4] = "CPK "; /* intentionally unterminated */
        get_bytes_seek(CpkHeader_offset, infile, buf, 4);
        CHECK_ERROR (memcmp(buf, CPK_signature, sizeof(CPK_signature)), "CPK signature not found");
    }

    long toc_offset, content_offset, CpkHeader_count;
    {
        reader_t *cpk_crypt_infile = open_reader_crypt(infile, CpkHeader_offset+0x10, 0x5f, 0x15);

        /* check CpkHeader */
        {
            struct utf_query_result result = query_utf_nofail(cpk_crypt_infile, CpkHeader_offset+0x10, NULL);

            CHECK_ERROR (result.rows != 1, "wrong number of rows in CpkHeader");
        }

        /* get TOC offset */
        toc_offset = query_utf_8byte(cpk_crypt_infile, CpkHeader_offset+0x10, 0, "TocOffset");

        /* get content offset */
        content_offset = query_utf_8byte(cpk_crypt_infile, CpkHeader_offset+0x10, 0, "ContentOffset");

        /* get file count from CpkHeader */
        CpkHeader_count = query_utf_4byte(cpk_crypt_infile, CpkHeader_offset+0x10, 0, "Files");

        close_reader(cpk_crypt_infile);
    }

    {
        reader_t *toc_crypt_infile = open_reader_crypt(infile, toc_offset+0x10, 0x5f, 0x15);

        /* check TOC header */
        {
            unsigned char buf[4];
            static const char TOC_signature[4] = "TOC "; /* intentionally unterminated */
            get_bytes_seek(toc_offset, infile, buf, 4);
            CHECK_ERROR (memcmp(buf, TOC_signature, sizeof(TOC_signature)), "TOC signature not found");
        }

        /* get TOC entry count, string table */
        long toc_entries;
        {
            struct utf_query_result result = query_utf_nofail(toc_crypt_infile, toc_offset+0x10, NULL);

            toc_entries = result.rows;
            toc_string_table = load_utf_string_table(toc_crypt_infile, toc_offset+0x10);
        }

        /* check that counts match */
        CHECK_ERROR( toc_entries != CpkHeader_count, "CpkHeader file count and TOC entry count do not match" );

        /* extract files */
        for (int i = 0; i < toc_entries; i++)
        {
#if 1
            reader_t *data_crypt_infile = NULL;
#else
            reader_t *data_crypt_infile = infile;
#endif

            /* get file name */
            const char *file_name = query_utf_string(toc_crypt_infile, toc_offset+0x10, i,
                    "FileName", toc_string_table);

            /* get directory name */
            const char *dir_name = query_utf_string(toc_crypt_infile, toc_offset+0x10, i,
                    "DirName", toc_string_table);

            /* get file size */
            long file_size = query_utf_4byte(toc_crypt_infile, toc_offset+0x10, i,
                    "FileSize");

            /* get extract size */
            long extract_size = query_utf_4byte(toc_crypt_infile, toc_offset+0x10, i,
                    "ExtractSize");

            /* get file offset */
            uint64_t file_offset_raw =
                query_utf_8byte(toc_crypt_infile, toc_offset+0x10, i, "FileOffset");
            if (content_offset < toc_offset)
            {
                file_offset_raw += content_offset;
            }
            else
            {
                file_offset_raw += toc_offset;
            }

            CHECK_ERROR( file_offset_raw > LONG_MAX, "File offset too large, will be unable to seek" );
            long file_offset = file_offset_raw;

            printf("%s/%s 0x%lx %ld\n",
                    dir_name, file_name, (unsigned long)file_offset, file_size);
            FILE *outfile = open_file_in_directory(base_name, dir_name, '/', file_name, "w+b");
            CHECK_ERRNO(!outfile, "fopen");

#if 1
            data_crypt_infile = open_reader_crypt(infile, file_offset, 0x5f, 0x15);
#endif

            if (extract_size > file_size)
            {
                long uncompressed_size =
                    uncompress(data_crypt_infile, file_offset, file_size, outfile);
                printf("   uncompressed to %ld\n", uncompressed_size);

                CHECK_ERROR( uncompressed_size != extract_size ,
                        "uncompressed size != ExtractSize");
            }
            else
            {
                dump(data_crypt_infile, outfile, file_offset, file_size);
            }
            CHECK_ERRNO(fclose(outfile) != 0, "fclose");

#if 1
            close_reader(data_crypt_infile);
#endif
        }

        close_reader(toc_crypt_infile);
    }

    if (toc_string_table)
    {
        free_utf_string_table(toc_string_table);
        toc_string_table = NULL;
    }
}


text:
#if !defined(HB_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR)
#error "Include <hb.h> instead."
#endif

#ifndef HB_UNICODE_H
#define HB_UNICODE_H

#include "hb-common.h"

HB_BEGIN_DECLS

/**
 * HB_UNICODE_MAX:
 *
 * Maximum valid Unicode code point.
 *
 * Since: 1.9.0
 **/
#define HB_UNICODE_MAX 0x10FFFFu

/**
 * hb_unicode_general_category_t:
 * @HB_UNICODE_GENERAL_CATEGORY_CONTROL:              [Cc]
 * @HB_UNICODE_GENERAL_CATEGORY_FORMAT:		      [Cf]
 * @HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED:	      [Cn]
 * @HB_UNICODE_GENERAL_CATEGORY_PRIVATE_USE:	      [Co]
 * @HB_UNICODE_GENERAL_CATEGORY_SURROGATE:	      [Cs]
 * @HB_UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER:     [Ll]
 * @HB_UNICODE_GENERAL_CATEGORY_MODIFIER_LETTER:      [Lm]
 * @HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER:	      [Lo]
 * @HB_UNICODE_GENERAL_CATEGORY_TITLECASE_LETTER:     [Lt]
 * @HB_UNICODE_GENERAL_CATEGORY_UPPERCASE_LETTER:     [Lu]
 * @HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK:	      [Mc]
 * @HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK:	      [Me]
 * @HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK:     [Mn]
 * @HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER:	      [Nd]
 * @HB_UNICODE_GENERAL_CATEGORY_LETTER_NUMBER:	      [Nl]
 * @HB_UNICODE_GENERAL_CATEGORY_OTHER_NUMBER:	      [No]
 * @HB_UNICODE_GENERAL_CATEGORY_CONNECT_PUNCTUATION:  [Pc]
 * @HB_UNICODE_GENERAL_CATEGORY_DASH_PUNCTUATION:     [Pd]
 * @HB_UNICODE_GENERAL_CATEGORY_CLOSE_PUNCTUATION:    [Pe]
 * @HB_UNICODE_GENERAL_CATEGORY_FINAL_PUNCTUATION:    [Pf]
 * @HB_UNICODE_GENERAL_CATEGORY_INITIAL_PUNCTUATION:  [Pi]
 * @HB_UNICODE_GENERAL_CATEGORY_OTHER_PUNCTUATION:    [Po]
 * @HB_UNICODE_GENERAL_CATEGORY_OPEN_PUNCTUATION:     [Ps]
 * @HB_UNICODE_GENERAL_CATEGORY_CURRENCY_SYMBOL:      [Sc]
 * @HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL:      [Sk]
 * @HB_UNICODE_GENERAL_CATEGORY_MATH_SYMBOL:	      [Sm]
 * @HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL:	      [So]
 * @HB_UNICODE_GENERAL_CATEGORY_LINE_SEPARATOR:	      [Zl]
 * @HB_UNICODE_GENERAL_CATEGORY_PARAGRAPH_SEPARATOR:  [Zp]
 * @HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR:      [Zs]
 *
 * Data type for the "General_Category" (gc) property from
 * the Unicode Character Database.
 **/

/* Unicode Character Database property: General_Category (gc) */
typedef enum
{
  HB_UNICODE_GENERAL_CATEGORY_CONTROL,			/* Cc */
  HB_UNICODE_GENERAL_CATEGORY_FORMAT,			/* Cf */
  HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED,		/* Cn */
  HB_UNICODE_GENERAL_CATEGORY_PRIVATE_USE,		/* Co */
  HB_UNICODE_GENERAL_CATEGORY_SURROGATE,		/* Cs */
  HB_UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER,		/* Ll */
  HB_UNICODE_GENERAL_CATEGORY_MODIFIER_LETTER,		/* Lm */
  HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER,		/* Lo */
  HB_UNICODE_GENERAL_CATEGORY_TITLECASE_LETTER,		/* Lt */
  HB_UNICODE_GENERAL_CATEGORY_UPPERCASE_LETTER,		/* Lu */
  HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK,		/* Mc */
  HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK,		/* Me */
  HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK,		/* Mn */
  HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER,		/* Nd */
  HB_UNICODE_GENERAL_CATEGORY_LETTER_NUMBER,		/* Nl */
  HB_UNICODE_GENERAL_CATEGORY_OTHER_NUMBER,		/* No */
  HB_UNICODE_GENERAL_CATEGORY_CONNECT_PUNCTUATION,	/* Pc */
  HB_UNICODE_GENERAL_CATEGORY_DASH_PUNCTUATION,		/* Pd */
  HB_UNICODE_GENERAL_CATEGORY_CLOSE_PUNCTUATION,	/* Pe */
  HB_UNICODE_GENERAL_CATEGORY_FINAL_PUNCTUATION,	/* Pf */
  HB_UNICODE_GENERAL_CATEGORY_INITIAL_PUNCTUATION,	/* Pi */
  HB_UNICODE_GENERAL_CATEGORY_OTHER_PUNCTUATION,	/* Po */
  HB_UNICODE_GENERAL_CATEGORY_OPEN_PUNCTUATION,		/* Ps */
  HB_UNICODE_GENERAL_CATEGORY_CURRENCY_SYMBOL,		/* Sc */
  HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL,		/* Sk */
  HB_UNICODE_GENERAL_CATEGORY_MATH_SYMBOL,		/* Sm */
  HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL,		/* So */
  HB_UNICODE_GENERAL_CATEGORY_LINE_SEPARATOR,		/* Zl */
  HB_UNICODE_GENERAL_CATEGORY_PARAGRAPH_SEPARATOR,	/* Zp */
  HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR		/* Zs */
} hb_unicode_general_category_t;

/**
 * hb_unicode_combining_class_t:
 * @HB_UNICODE_COMBINING_CLASS_NOT_REORDERED: Spacing and enclosing marks; also many vowel and consonant signs, even if nonspacing
 * @HB_UNICODE_COMBINING_CLASS_OVERLAY: Marks which overlay a base letter or symbol
 * @HB_UNICODE_COMBINING_CLASS_NUKTA: Diacritic nukta marks in Brahmi-derived scripts
 * @HB_UNICODE_COMBINING_CLASS_KANA_VOICING: Hiragana/Katakana voicing marks
 * @HB_UNICODE_COMBINING_CLASS_VIRAMA: Viramas
 * @HB_UNICODE_COMBINING_CLASS_CCC10: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC11: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC12: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC13: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC14: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC15: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC16: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC17: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC18: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC19: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC20: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC21: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC22: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC23: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC24: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC25: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC26: [Hebrew]
 * @HB_UNICODE_COMBINING_CLASS_CCC27: [Arabic]
 * @HB_UNICODE_COMBINING_CLASS_CCC28: [Arabic]
 * @HB_UNICODE_COMBINING_CLASS_CCC29: [Arabic]
 * @HB_UNICODE_COMBINING_CLASS_CCC30: [Arabic]
 * @HB_UNICODE_COMBINING_CLASS_CCC31: [Arabic]
 * @HB_UNICODE_COMBINING_CLASS_CCC32: [Arabic]
 * @HB_UNICODE_COMBINING_CLASS_CCC33: [Arabic]
 * @HB_UNICODE_COMBINING_CLASS_CCC34: [Arabic]
 * @HB_UNICODE_COMBINING_CLASS_CCC35: [Arabic]
 * @HB_UNICODE_COMBINING_CLASS_CCC36: [Syriac]
 * @HB_UNICODE_COMBINING_CLASS_CCC84: [Telugu]
 * @HB_UNICODE_COMBINING_CLASS_CCC91: [Telugu]
 * @HB_UNICODE_COMBINING_CLASS_CCC103: [Thai]
 * @HB_UNICODE_COMBINING_CLASS_CCC107: [Thai]
 * @HB_UNICODE_COMBINING_CLASS_CCC118: [Lao]
 * @HB_UNICODE_COMBINING_CLASS_CCC122: [Lao]
 * @HB_UNICODE_COMBINING_CLASS_CCC129: [Tibetan]
 * @HB_UNICODE_COMBINING_CLASS_CCC130: [Tibetan]
 * @HB_UNICODE_COMBINING_CLASS_CCC133: [Tibetan]
 * @HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT: Marks attached at the bottom left
 * @HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW: Marks attached directly below
 * @HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE: Marks attached directly above
 * @HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT: Marks attached at the top right
 * @HB_UNICODE_COMBINING_CLASS_BELOW_LEFT: Distinct marks at the bottom left
 * @HB_UNICODE_COMBINING_CLASS_BELOW: Distinct marks directly below
 * @HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT: Distinct marks at the bottom right
 * @HB_UNICODE_COMBINING_CLASS_LEFT: Distinct marks to the left
 * @HB_UNICODE_COMBINING_CLASS_RIGHT: Distinct marks to the right
 * @HB_UNICODE_COMBINING_CLASS_ABOVE_LEFT: Distinct marks at the top left
 * @HB_UNICODE_COMBINING_CLASS_ABOVE: Distinct marks directly above
 * @HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT: Distinct marks at the top right
 * @HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW: Distinct marks subtending two bases
 * @HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE: Distinct marks extending above two bases
 * @HB_UNICODE_COMBINING_CLASS_IOTA_SUBSCRIPT: Greek iota subscript only
 * @HB_UNICODE_COMBINING_CLASS_INVALID: Invalid combining class
 *
 * Data type for the Canonical_Combining_Class (ccc) property
 * from the Unicode Character Database.
 *
 * <note>Note: newer versions of Unicode may add new values.
 * Client programs should be ready to handle any value in the 0..254 range
 * being returned from hb_unicode_combining_class().</note>
 *
 **/
typedef enum
{
  HB_UNICODE_COMBINING_CLASS_NOT_REORDERED	= 0,
  HB_UNICODE_COMBINING_CLASS_OVERLAY		= 1,
  HB_UNICODE_COMBINING_CLASS_NUKTA		= 7,
  HB_UNICODE_COMBINING_CLASS_KANA_VOICING	= 8,
  HB_UNICODE_COMBINING_CLASS_VIRAMA		= 9,

  /* Hebrew */
  HB_UNICODE_COMBINING_CLASS_CCC10	=  10,
  HB_UNICODE_COMBINING_CLASS_CCC11	=  11,
  HB_UNICODE_COMBINING_CLASS_CCC12	=  12,
  HB_UNICODE_COMBINING_CLASS_CCC13	=  13,
  HB_UNICODE_COMBINING_CLASS_CCC14	=  14,
  HB_UNICODE_COMBINING_CLASS_CCC15	=  15,
  HB_UNICODE_COMBINING_CLASS_CCC16	=  16,
  HB_UNICODE_COMBINING_CLASS_CCC17	=  17,
  HB_UNICODE_COMBINING_CLASS_CCC18	=  18,
  HB_UNICODE_COMBINING_CLASS_CCC19	=  19,
  HB_UNICODE_COMBINING_CLASS_CCC20	=  20,
  HB_UNICODE_COMBINING_CLASS_CCC21	=  21,
  HB_UNICODE_COMBINING_CLASS_CCC22	=  22,
  HB_UNICODE_COMBINING_CLASS_CCC23	=  23,
  HB_UNICODE_COMBINING_CLASS_CCC24	=  24,
  HB_UNICODE_COMBINING_CLASS_CCC25	=  25,
  HB_UNICODE_COMBINING_CLASS_CCC26	=  26,

  /* Arabic */
  HB_UNICODE_COMBINING_CLASS_CCC27	=  27,
  HB_UNICODE_COMBINING_CLASS_CCC28	=  28,
  HB_UNICODE_COMBINING_CLASS_CCC29	=  29,
  HB_UNICODE_COMBINING_CLASS_CCC30	=  30,
  HB_UNICODE_COMBINING_CLASS_CCC31	=  31,
  HB_UNICODE_COMBINING_CLASS_CCC32	=  32,
  HB_UNICODE_COMBINING_CLASS_CCC33	=  33,
  HB_UNICODE_COMBINING_CLASS_CCC34	=  34,
  HB_UNICODE_COMBINING_CLASS_CCC35	=  35,

  /* Syriac */
  HB_UNICODE_COMBINING_CLASS_CCC36	=  36,

  /* Telugu */
  HB_UNICODE_COMBINING_CLASS_CCC84	=  84,
  HB_UNICODE_COMBINING_CLASS_CCC91	=  91,

  /* Thai */
  HB_UNICODE_COMBINING_CLASS_CCC103	= 103,
  HB_UNICODE_COMBINING_CLASS_CCC107	= 107,

  /* Lao */
  HB_UNICODE_COMBINING_CLASS_CCC118	= 118,
  HB_UNICODE_COMBINING_CLASS_CCC122	= 122,

  /* Tibetan */
  HB_UNICODE_COMBINING_CLASS_CCC129	= 129,
  HB_UNICODE_COMBINING_CLASS_CCC130	= 130,
  HB_UNICODE_COMBINING_CLASS_CCC133	= 132,

  HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT	= 200,
  HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW		= 202,
  HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE		= 214,
  HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT	= 216,
  HB_UNICODE_COMBINING_CLASS_BELOW_LEFT			= 218,
  HB_UNICODE_COMBINING_CLASS_BELOW			= 220,
  HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT		= 222,
  HB_UNICODE_COMBINING_CLASS_LEFT			= 224,
  HB_UNICODE_COMBINING_CLASS_RIGHT			= 226,
  HB_UNICODE_COMBINING_CLASS_ABOVE_LEFT			= 228,
  HB_UNICODE_COMBINING_CLASS_ABOVE			= 230,
  HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT		= 232,
  HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW		= 233,
  HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE		= 234,

  HB_UNICODE_COMBINING_CLASS_IOTA_SUBSCRIPT		= 240,

  HB_UNICODE_COMBINING_CLASS_INVALID	= 255
} hb_unicode_combining_class_t;

/*
 * hb_unicode_funcs_t
 */

/**
 * hb_unicode_funcs_t:
 *
 * Data type containing a set of virtual methods used for
 * accessing various Unicode character properties.
 *
 * HarfBuzz provides a default function for each of the
 * methods in #hb_unicode_funcs_t. Client programs can implement
 * their own replacements for the individual Unicode functions, as
 * needed, and replace the default by calling the setter for a
 * method.
 **/
typedef struct hb_unicode_funcs_t hb_unicode_funcs_t;

/*
 * just give me the best implementation you've got there.
 */
HB_EXTERN hb_unicode_funcs_t *
hb_unicode_funcs_get_default (void);

HB_EXTERN hb_unicode_funcs_t *
hb_unicode_funcs_create (hb_unicode_funcs_t *parent);

HB_EXTERN hb_unicode_funcs_t *
hb_unicode_funcs_get_empty (void);

HB_EXTERN hb_unicode_funcs_t *
hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs);

HB_EXTERN void
hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs);

HB_EXTERN hb_bool_t
hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs,
				hb_user_data_key_t *key,
				void *              data,
				hb_destroy_func_t   destroy,
				hb_bool_t           replace);

HB_EXTERN void *
hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs,
				hb_user_data_key_t *key);

HB_EXTERN void
hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs);

HB_EXTERN hb_bool_t
hb_unicode_funcs_is_immutable (hb_unicode_funcs_t *ufuncs);

HB_EXTERN hb_unicode_funcs_t *
hb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs);

/*
 * funcs
 */

/* typedefs */

/**
 * hb_unicode_combining_class_func_t:
 * @ufuncs: A Unicode-functions structure
 * @unicode: The code point to query
 * @user_data: User data pointer passed by the caller
 *
 * A virtual method for the #hb_unicode_funcs_t structure.
 *
 * This method should retrieve the Canonical Combining Class (ccc)
 * property for a specified Unicode code point.
 *
 * Return value: The #hb_unicode_combining_class_t of @unicode
 *
 **/
typedef hb_unicode_combining_class_t	(*hb_unicode_combining_class_func_t)	(hb_unicode_funcs_t *ufuncs,
										 hb_codepoint_t      unicode,
										 void               *user_data);

/**
 * hb_unicode_general_category_func_t:
 * @ufuncs: A Unicode-functions structure
 * @unicode: The code point to query
 * @user_data: User data pointer passed by the caller
 *
 * A virtual method for the #hb_unicode_funcs_t structure.
 *
 * This method should retrieve the General Category property for
 * a specified Unicode code point.
 *
 * Return value: The #hb_unicode_general_category_t of @unicode
 *
 **/
typedef hb_unicode_general_category_t	(*hb_unicode_general_category_func_t)	(hb_unicode_funcs_t *ufuncs,
										 hb_codepoint_t      unicode,
										 void               *user_data);

/**
 * hb_unicode_mirroring_func_t:
 * @ufuncs: A Unicode-functions structure
 * @unicode: The code point to query
 * @user_data: User data pointer passed by the caller
 *
 * A virtual method for the #hb_unicode_funcs_t structure.
 *
 * This method should retrieve the Bi-Directional Mirroring Glyph
 * code point for a specified Unicode code point.
 *
 * <note>Note: If a code point does not have a specified
 * Bi-Directional Mirroring Glyph defined, the method should
 * return the original code point.</note>
 *
 * Return value: The #hb_codepoint_t of the Mirroring Glyph for @unicode
 *
 **/
typedef hb_codepoint_t			(*hb_unicode_mirroring_func_t)		(hb_unicode_funcs_t *ufuncs,
										 hb_codepoint_t      unicode,
										 void               *user_data);

/**
 * hb_unicode_script_func_t:
 * @ufuncs: A Unicode-functions structure
 * @unicode: The code point to query
 * @user_data: User data pointer passed by the caller
 *
 * A virtual method for the #hb_unicode_funcs_t structure.
 *
 * This method should retrieve the Script property for a
 * specified Unicode code point.
 *
 * Return value: The #hb_script_t of @unicode
 *
 **/
typedef hb_script_t			(*hb_unicode_script_func_t)		(hb_unicode_funcs_t *ufuncs,
										 hb_codepoint_t      unicode,
										 void               *user_data);

/**
 * hb_unicode_compose_func_t:
 * @ufuncs: A Unicode-functions structure
 * @a: The first code point to compose
 * @b: The second code point to compose
 * @ab: (out): The composed code point
 * @user_data: user data pointer passed by the caller
 *
 * A virtual method for the #hb_unicode_funcs_t structure.
 *
 * This method should compose a sequence of two input Unicode code
 * points by canonical equivalence, returning the composed code
 * point in a #hb_codepoint_t output parameter (if successful).
 * The method must return an #hb_bool_t indicating the success
 * of the composition.
 *
 * Return value: %true is @a,@b composed, %false otherwise
 *
 **/
typedef hb_bool_t			(*hb_unicode_compose_func_t)		(hb_unicode_funcs_t *ufuncs,
										 hb_codepoint_t      a,
										 hb_codepoint_t      b,
										 hb_codepoint_t     *ab,
										 void               *user_data);

/**
 * hb_unicode_decompose_func_t:
 * @ufuncs: A Unicode-functions structure
 * @ab: The code point to decompose
 * @a: (out): The first decomposed code point
 * @b: (out): The second decomposed code point
 * @user_data: user data pointer passed by the caller
 *
 * A virtual method for the #hb_unicode_funcs_t structure.
 *
 * This method should decompose an input Unicode code point,
 * returning the two decomposed code points in #hb_codepoint_t
 * output parameters (if successful). The method must return an
 * #hb_bool_t indicating the success of the composition.
 *
 * Return value: %true if @ab decomposed, %false otherwise
 *
 **/
typedef hb_bool_t			(*hb_unicode_decompose_func_t)		(hb_unicode_funcs_t *ufuncs,
										 hb_codepoint_t      ab,
										 hb_codepoint_t     *a,
										 hb_codepoint_t     *b,
										 void               *user_data);

/* func setters */

/**
 * hb_unicode_funcs_set_combining_class_func:
 * @ufuncs: A Unicode-functions structure
 * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
 * @user_data: Data to pass to @func
 * @destroy: (nullable): The function to call when @user_data is not needed anymore
 *
 * Sets the implementation function for #hb_unicode_combining_class_func_t.
 *
 * Since: 0.9.2
 **/
HB_EXTERN void
hb_unicode_funcs_set_combining_class_func (hb_unicode_funcs_t *ufuncs,
					   hb_unicode_combining_class_func_t func,
					   void *user_data, hb_destroy_func_t destroy);

/**
 * hb_unicode_funcs_set_general_category_func:
 * @ufuncs: A Unicode-functions structure
 * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
 * @user_data: Data to pass to @func
 * @destroy: (nullable): The function to call when @user_data is not needed anymore
 *
 * Sets the implementation function for #hb_unicode_general_category_func_t.
 *
 * Since: 0.9.2
 **/
HB_EXTERN void
hb_unicode_funcs_set_general_category_func (hb_unicode_funcs_t *ufuncs,
					    hb_unicode_general_category_func_t func,
					    void *user_data, hb_destroy_func_t destroy);

/**
 * hb_unicode_funcs_set_mirroring_func:
 * @ufuncs: A Unicode-functions structure
 * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
 * @user_data: Data to pass to @func
 * @destroy: (nullable): The function to call when @user_data is not needed anymore
 *
 * Sets the implementation function for #hb_unicode_mirroring_func_t.
 *
 * Since: 0.9.2
 **/
HB_EXTERN void
hb_unicode_funcs_set_mirroring_func (hb_unicode_funcs_t *ufuncs,
				     hb_unicode_mirroring_func_t func,
				     void *user_data, hb_destroy_func_t destroy);

/**
 * hb_unicode_funcs_set_script_func:
 * @ufuncs: A Unicode-functions structure
 * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
 * @user_data: Data to pass to @func
 * @destroy: (nullable): The function to call when @user_data is not needed anymore
 *
 * Sets the implementation function for #hb_unicode_script_func_t.
 *
 * Since: 0.9.2
 **/
HB_EXTERN void
hb_unicode_funcs_set_script_func (hb_unicode_funcs_t *ufuncs,
				  hb_unicode_script_func_t func,
				  void *user_data, hb_destroy_func_t destroy);

/**
 * hb_unicode_funcs_set_compose_func:
 * @ufuncs: A Unicode-functions structure
 * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
 * @user_data: Data to pass to @func
 * @destroy: (nullable): The function to call when @user_data is not needed anymore
 *
 * Sets the implementation function for #hb_unicode_compose_func_t.
 *
 * Since: 0.9.2
 **/
HB_EXTERN void
hb_unicode_funcs_set_compose_func (hb_unicode_funcs_t *ufuncs,
				   hb_unicode_compose_func_t func,
				   void *user_data, hb_destroy_func_t destroy);

/**
 * hb_unicode_funcs_set_decompose_func:
 * @ufuncs: A Unicode-functions structure
 * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
 * @user_data: Data to pass to @func
 * @destroy: (nullable): The function to call when @user_data is not needed anymore
 *
 * Sets the implementation function for #hb_unicode_decompose_func_t.
 *
 * Since: 0.9.2
 **/
HB_EXTERN void
hb_unicode_funcs_set_decompose_func (hb_unicode_funcs_t *ufuncs,
				     hb_unicode_decompose_func_t func,
				     void *user_data, hb_destroy_func_t destroy);

/* accessors */

/**
 * hb_unicode_combining_class:
 * @ufuncs: The Unicode-functions structure
 * @unicode: The code point to query
 *
 * Retrieves the Canonical Combining Class (ccc) property
 * of code point @unicode.
 *
 * Return value: The #hb_unicode_combining_class_t of @unicode
 *
 * Since: 0.9.2
 **/
HB_EXTERN hb_unicode_combining_class_t
hb_unicode_combining_class (hb_unicode_funcs_t *ufuncs,
			    hb_codepoint_t unicode);

/**
 * hb_unicode_general_category:
 * @ufuncs: The Unicode-functions structure
 * @unicode: The code point to query
 *
 * Retrieves the General Category (gc) property
 * of code point @unicode.
 *
 * Return value: The #hb_unicode_general_category_t of @unicode
 *
 * Since: 0.9.2
 **/
HB_EXTERN hb_unicode_general_category_t
hb_unicode_general_category (hb_unicode_funcs_t *ufuncs,
			     hb_codepoint_t unicode);

/**
 * hb_unicode_mirroring:
 * @ufuncs: The Unicode-functions structure
 * @unicode: The code point to query
 *
 * Retrieves the Bi-directional Mirroring Glyph code
 * point defined for code point @unicode.
 *
 * Return value: The #hb_codepoint_t of the Mirroring Glyph for @unicode
 *
 * Since: 0.9.2
 **/
HB_EXTERN hb_codepoint_t
hb_unicode_mirroring (hb_unicode_funcs_t *ufuncs,
		      hb_codepoint_t unicode);

/**
 * hb_unicode_script:
 * @ufuncs: The Unicode-functions structure
 * @unicode: The code point to query
 *
 * Retrieves the #hb_script_t script to which code
 * point @unicode belongs.
 *
 * Return value: The #hb_script_t of @unicode
 *
 * Since: 0.9.2
 **/
HB_EXTERN hb_script_t
hb_unicode_script (hb_unicode_funcs_t *ufuncs,
		   hb_codepoint_t unicode);

HB_EXTERN hb_bool_t
hb_unicode_compose (hb_unicode_funcs_t *ufuncs,
		    hb_codepoint_t      a,
		    hb_codepoint_t      b,
		    hb_codepoint_t     *ab);

HB_EXTERN hb_bool_t
hb_unicode_decompose (hb_unicode_funcs_t *ufuncs,
		      hb_codepoint_t      ab,
		      hb_codepoint_t     *a,
		      hb_codepoint_t     *b);

HB_END_DECLS

#endif /* HB_UNICODE_H */


text:
package be.fror.projecteuler.problem;

/**
 *

 * If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9.
 * The sum of these multiples is 23.

 *

 * Find the sum of all the multiples of 3 or 5 below 1000.

 *
 * @author Olivier Grégoire <fror@users.noreply.github.com>
 */
public class Problem1 extends AbstractProblem {

    @Override
    public Object solve() {
        int MAX = 999;
        return sumOfMultiples(3, MAX) + sumOfMultiples(5, MAX) - sumOfMultiples(3 * 5, MAX);
    }

    private int sumOfMultiples(int n, int max) {
        int nMax = max / n;
        return nMax * (nMax + 1) / 2 * n;
    }

}


text:
package CoreModule

import "C"
import (
	"fmt"
	"github.com/bwmarrin/discordgo"
	"github.com/gendonl/genbot/Bot"
	"github.com/gendonl/saucenao-go"
	"net/url"
	"strconv"
	"strings"
)

func initSourceCommand() (cc CoreCommand) {
	cc = CoreCommand{
		name:        "source",
		description: "Gives the source of an image of either the url given as argument or the last image sent.",
		usage:       "`%ssource [image url]`",
		aliases:	 []string{"sauce"},
		permission:  discordgo.PermissionSendMessages,
		execute:     (*CoreModule).sourceCommand,
	}
	return
}

func (c *CoreModule) sourceCommand(cmd CoreCommand, s *discordgo.Session, m *discordgo.MessageCreate, data *Bot.ServerData) {
	extensions := []string{".jpg", ".jpeg", ".png", ".gif", ".bmp"}
	input := strings.SplitN(m.Content, " ", 2)

	var imageUrl string
	if len(input) == 1 {
		amountOfMessages := 10
		res, err := c.Bot.FindLastMessageWithAttachOrEmbed(s, m, amountOfMessages)
		if err != nil {
			s.ChannelMessageSend(m.ChannelID, fmt.Sprintf("Unable to find an image to query in last %d messages.", amountOfMessages))
			return
		}
		imageUrl = res
	} else {
		imageUrl = input[1]
	}

	if !isValidUrl(imageUrl) {
		s.ChannelMessageSend(m.ChannelID, "Unable to parse command arguments to URL.")
		return
	}

	// Only query something that looks like an image.
	// We do not want to waste requests due to the API rate-limit.
	// FIXME: Use meta-data rather than url to determine whether something is an image.
	hasExtension := false
	for _, ext := range extensions {
		if strings.Contains(imageUrl, ext) {
			hasExtension = true
		}
	}

	if !hasExtension {
		_, _ = s.ChannelMessageSend(m.ChannelID, "URL has a non-supported file extension.")
		return
	}

	sauceClient := saucenao.New(c.Bot.Config.SauceNaoToken)

	sauceResult, err := sauceClient.FromURL(imageUrl)

	if err != nil || len(sauceResult.Data) == 0 {
		Log.Errorf("%s \n %s", err, sauceResult)
		_, _ = s.ChannelMessageSend(m.ChannelID, "Something went wrong while contacting the SauceNAO API." +
			"You could try sourcing your images manually at https://saucenao.com/")
		return
	}

	e := Bot.NewEmbed().
		SetAuthorFromUser(m.Author).
		SetColorFromUser(s, m.ChannelID, m.Author).
		SetThumbnail(imageUrl).
		SetFooter("This command is powered by SauceNAO.")

	similarity, err := strconv.ParseFloat(sauceResult.Data[0].Header.Similarity, 32)
	if err != nil || similarity < 80.0 {
		e.SetTitle("No results found")
		e.SetDescription("No images found with a confidence over 80.")
	} else {
		e.SetTitle(fmt.Sprintf("[Source] %s", sauceResult.Data[0].Data.Title)).
			SetURL(sauceResult.Data[0].Data.ExtUrls[0]).
			SetDescription(fmt.Sprintf("Result found with %s%% confidence", sauceResult.Data[0].Header.Similarity))
	}

	_, err = s.ChannelMessageSendEmbed(m.ChannelID, e.MessageEmbed)
}

func isValidUrl(toTest string) bool {
	_, err := url.ParseRequestURI(toTest)
	if err != nil {
		return false
	} else {
		return true
	}
}


text:
package em.embedded.org.restncs;

import org.evomaster.client.java.controller.EmbeddedSutController;
import org.evomaster.client.java.controller.InstrumentedSutStarter;
import org.evomaster.client.java.controller.internal.db.DbSpecification;
import org.evomaster.client.java.controller.problem.ProblemInfo;
import org.evomaster.client.java.controller.problem.RestProblem;
import org.evomaster.client.java.controller.api.dto.AuthenticationDto;
import org.evomaster.client.java.controller.api.dto.SutInfoDto;
import org.restncs.NcsApplication;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.sql.Connection;
import java.util.List;
import java.util.Map;

/**
 * Class used to start/stop the SUT. This will be controller by the EvoMaster process
 */
public class EmbeddedEvoMasterController extends EmbeddedSutController {

    public static void main(String[] args) {

        int port = 40100;
        if (args.length > 0) {
            port = Integer.parseInt(args[0]);
        }

        EmbeddedEvoMasterController controller = new EmbeddedEvoMasterController(port);
        InstrumentedSutStarter starter = new InstrumentedSutStarter(controller);

        starter.start();
    }

    private ConfigurableApplicationContext ctx;

    public EmbeddedEvoMasterController() {
        this(40100);
    }

    public EmbeddedEvoMasterController(int port) {
        setControllerPort(port);
    }

    @Override
    public String startSut() {

        ctx = SpringApplication.run(NcsApplication.class, new String[]{
                "--server.port=0"
        });

        return "http://localhost:" + getSutPort();
    }

    protected int getSutPort() {
        return (Integer) ((Map) ctx.getEnvironment()
                .getPropertySources().get("server.ports").getSource())
                .get("local.server.port");
    }

    @Override
    public boolean isSutRunning() {
        return ctx != null && ctx.isRunning();
    }

    @Override
    public void stopSut() {
        ctx.stop();
    }

    @Override
    public String getPackagePrefixesToCover() {
        return "org.restncs.";
    }

    @Override
    public void resetStateOfSUT() {
    }

    @Override
    public List<AuthenticationDto> getInfoForAuthentication() {
        return null;
    }

    @Override
    public ProblemInfo getProblemInfo() {
        return new RestProblem(
                "http://localhost:" + getSutPort() + "/v2/api-docs",
                null
        );
    }

    @Override
    public SutInfoDto.OutputFormat getPreferredOutputFormat() {
        return SutInfoDto.OutputFormat.JAVA_JUNIT_4;
    }

    @Override
    public List<DbSpecification> getDbSpecifications() {
        return null;
    }
}


text:
require "test_helper"

describe Listitem do
  before do
    @listitem = Listitem.new
  end

  it "must be valid" do
    @listitem.valid?.must_equal true
  end
end


text:
module Vmstator

  class DiskSummary
    attr_reader :disks
    attr_reader :partitions
    attr_reader :total_reads
    attr_reader :merged_reads
    attr_reader :read_sectors
    attr_reader :milli_reading
    attr_reader :writes
    attr_reader :merged_writes
    attr_reader :written_sectors
    attr_reader :milli_writing
    attr_reader :inprogress_io
    attr_reader :milli_spent_io

    def initialize(data=false)
      if data
        update(data)
      end
      true
    end

    def update(data)
      if data
        @disks           = data[:disks]
        @partitions      = data[:partitions]
        @total_reads     = data[:total_reads]
        @merged_reads    = data[:merged_reads]
        @read_sectors    = data[:read_sectors]
        @milli_reading   = data[:milli_reading]
        @writes          = data[:writes]
        @merged_writes   = data[:merged_writes]
        @written_sectors = data[:written_sectors]
        @milli_writing   = data[:milli_writing]
        @inprogress_io   = data[:inprogress_io]
        @milli_spent_io  = data[:milli_spent_io]
      else
        return false
      end
      true
    end

  end
end


text:
using System;
using System.IO;
using System.IO.FileSystem.Tests;
using System.Linq;
using System.Runtime.InteropServices;
using Xunit;

public class Directory_GetFiles_str : FileSystemTest
{
    #region Utilities

    public virtual String[] GetFiles(String path)
    {
        return Directory.GetFiles(path);
    }

    #endregion

    #region UniversalTests

    [Fact]
    public void NullPath()
    {
        Assert.Throws<ArgumentNullException>(() => GetFiles(null));
    }

    [Fact]
    public void EmptyPath()
    {
        Assert.Throws<ArgumentException>(() => GetFiles(String.Empty));
    }

    [Fact]
    public void InvalidFileNames()
    {
        DirectoryInfo testDir = new DirectoryInfo(TestDirectory);
        Assert.Throws<DirectoryNotFoundException>(() => GetFiles(","));
        Assert.Throws<DirectoryNotFoundException>(() => GetFiles("DoesNotExist"));
    }

    [Fact]
    public void EmptyDirectory()
    {
        String testDir = Path.Combine(TestDirectory, GetTestFilePath());
        new DirectoryInfo(testDir).Create();
        Assert.Empty(GetFiles(testDir));
    }

    [Fact]
    public void GetFilesThenDelete()
    {
        String testDirPath = Path.Combine(TestDirectory, GetTestFilePath());
        DirectoryInfo testDirInfo = new DirectoryInfo(testDirPath);
        testDirInfo.Create();
        String testDir1 = GetTestFileName();
        String testDir2 = GetTestFileName();
        String testDir3 = GetTestFileName();
        String testDir4 = GetTestFileName();
        String testDir5 = GetTestFileName();
        String testFile1 = GetTestFileName();
        String testFile2 = GetTestFileName();
        String testFile3 = GetTestFileName();
        String testFile4 = GetTestFileName();
        String testFile5 = GetTestFileName();
        testDirInfo.CreateSubdirectory(testDir1);
        testDirInfo.CreateSubdirectory(testDir2);
        testDirInfo.CreateSubdirectory(testDir3);
        testDirInfo.CreateSubdirectory(testDir4);
        testDirInfo.CreateSubdirectory(testDir5);
        using (File.Create(Path.Combine(testDirPath, testFile1)))
        using (File.Create(Path.Combine(testDirPath, testFile2)))
        using (File.Create(Path.Combine(testDirPath, testFile3)))
        {
            String[] results;
            using (File.Create(Path.Combine(testDirPath, testFile4)))
            using (File.Create(Path.Combine(testDirPath, testFile5)))
            {
                results = GetFiles(testDirPath);
                Assert.NotNull(results);
                Assert.NotEmpty(results);
                Assert.Equal(5, results.Length);
                Assert.Contains(Path.Combine(testDirPath, testFile1), results);
                Assert.Contains(Path.Combine(testDirPath, testFile2), results);
                Assert.Contains(Path.Combine(testDirPath, testFile3), results);
                Assert.Contains(Path.Combine(testDirPath, testFile4), results);
                Assert.Contains(Path.Combine(testDirPath, testFile5), results);
            }

            File.Delete(Path.Combine(testDirPath, testFile4));
            File.Delete(Path.Combine(testDirPath, testFile5));

            results = GetFiles(testDirPath);
            Assert.NotNull(results);
            Assert.NotEmpty(results);
            Assert.Equal(3, results.Length);
            Assert.Contains(Path.Combine(testDirPath, testFile1), results);
            Assert.Contains(Path.Combine(testDirPath, testFile2), results);
            Assert.Contains(Path.Combine(testDirPath, testFile3), results);
        }
    }

    [Fact]
    public void IgnoreSubDirectoryFiles()
    {
        String testDir = GetTestFileName();
        String testFile1 = Path.Combine(TestDirectory, GetTestFileName());
        String testFile2 = Path.Combine(TestDirectory, testDir, GetTestFileName());
        Directory.CreateDirectory(Path.Combine(TestDirectory, testDir));
        using (File.Create(testFile1))
        using (File.Create(testFile2))
        {
            String[] results = GetFiles(TestDirectory);
            Assert.DoesNotContain(testFile2, results);
        }
    }

    #endregion

    #region PlatformSpecific

    [Fact]
    [PlatformSpecific(PlatformID.Windows)]
    public void WildCharactersFileName()
    {
        String strTempDir = Path.Combine("dls;d", "442349-0", "v443094(*)(+*$#$*") + new string(Path.DirectorySeparatorChar, 3);
        Assert.Throws<ArgumentException>(() => GetFiles(strTempDir));
    }

    [Fact]
    [PlatformSpecific(PlatformID.Windows)]
    public void WindowsWhitespacePath()
    {
        Assert.Throws<ArgumentException>(() => GetFiles("\n"));
        Assert.Throws<ArgumentException>(() => GetFiles("          "));
        Assert.Throws<ArgumentException>(() => GetFiles(" "));
        Assert.Throws<ArgumentException>(() => GetFiles(""));
        Assert.Throws<ArgumentException>(() => GetFiles(">"));
        Assert.Throws<ArgumentException>(() => GetFiles("\0"));
    }

    [Fact]
    [PlatformSpecific(PlatformID.AnyUnix)]
    public void UnixFilePathWithSpaces()
    {
        Assert.Throws<ArgumentException>(() => GetFiles("\0"));
        using (File.Create(Path.Combine(TestDirectory, " ")))
        using (File.Create(Path.Combine(TestDirectory, "          ")))
        using (File.Create(Path.Combine(TestDirectory, "\n")))
        {
            String[] results = GetFiles(TestDirectory);
            Assert.Contains(Path.Combine(TestDirectory, " "), results);
            Assert.Contains(Path.Combine(TestDirectory, "          "), results);
            Assert.Contains(Path.Combine(TestDirectory, "\n"), results);
        }
    }

    [Fact]
    [PlatformSpecific(PlatformID.AnyUnix)]
    public void EnumerateWithSymLinkToFile()
    {
        using (var containingFolder = new TemporaryDirectory())
        {
            string linkPath;

            // Test a symlink to a file that does and then doesn't exist
            using (var targetFile = new TemporaryFile())
            {
                linkPath = Path.Combine(containingFolder.Path, Path.GetRandomFileName());
                Assert.Equal(0, symlink(targetFile.Path, linkPath));
                Assert.True(File.Exists(linkPath));
                Assert.Equal(1, GetFiles(containingFolder.Path).Count());
            }

            // The symlink still exists even though the target file is gone.
            Assert.Equal(1, GetFiles(containingFolder.Path).Count());

            // The symlink is gone
            File.Delete(linkPath);
            Assert.Equal(0, GetFiles(containingFolder.Path).Count());
        }
    }

    [DllImport("libc", SetLastError = true)]
    private static extern int symlink(string path1, string path2);

    #endregion
}


text:
<!DOCTYPE html>

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

    <title>Cal Poly Software Engineering Capstone 2015</title>

    <link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" type="text/css" />

    <link href="css/heroic-features.css" rel="stylesheet">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>
                Home

                        Trogdor!!

                        Schoolyard Booleans

                        Windows 9

bidfresh by Schoolyard Booleans

The bidfresh platform consists of two components: the administrator web console and the iPhone bidder application.

				The administrator web console allows organizations to create auctions, add items, monitor auction progress, view donors, and verify payments of items.

				The iPhone application is for bidders at the auctions. Through the app users can search through auction items,
				place bids, view bidding history and get notified when they have been outbid

Salesforce app Installation

Install the bidfresh app in your salesforce organization...

Downlaod the app from the folowing url: https://login.salesforce.com/packaging/installPackage.apexp?p0=04tj0000000WOCs

Press the 'Continue' button

Set up the bidfresh Connected App

Go to setup -> develop -> sites

Enter a subdomain.

click "new" to create a new site

Enter "bidfresh" as the site label, site name, and default web address

specify the "Active Site Home Page" as any page… the value doesn't matter

make sure the site is "active" and that "require https" is enabled

on your new site, goto Public Access Settings -> enabled apex class access (near bottom)

Of available classes, selected the following ones for public access:

AuctionGrabber

AuctionVenueGrabber

FinishRegister

ItemGrabber

LoginUser

NonprofitGroupGrabber

PostingAuctionItemBid

SingleNonprofitGrabber

getBidderBids

Administrator Web Console Installation

To view the admin console...

go to the following url: https://schoolyardbooleans-auction-app.herokuapp.com/oauth

Press the 'Login with Salesforce' button

For the Username, enter dev@schoolyardbooleans.org

For the password, enter penguin2

You are now logged into the administrator web console. Feel free to explore!

Bidder iPhone Application Installation

To use the iPhone application...

Clone the git repository https://github.com/SchoolyardBooleans/AuctionAppiOS.git

Open the project in XCode (version 6.3 or greater). Go to File->Open and click on the folder of the cloned project

Run the project on an iPhone 5 or 6 emulator or load it onto your phone


text:
package backend;

import java.lang.Math;

public class Heading {

	private double angle;

	public Heading(double angle) {
		this.angle = angle;
	}

	public void setAngle(double newAngle) {
		angle = newAngle;
	}

	public double getAngle() {
		return angle;
	}

	public double getAngleRads() {
		return (angle / 180) * Math.PI;
	}

}


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

namespace PageOfBob.NFountain {
	public interface IParser {
		IEnumerable<Element> Transform(TextReader str);
	}
}


text:
//
//  Copyright 2014 Gustavo J Knuppe (https://github.com/knuppe)
//
//   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.
//
//   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//   - May you do good and not evil.                                         -
//   - May you find forgiveness for yourself and forgive others.             -
//   - May you share freely, never taking more than you give.                -
//   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//

using SharpNL.Extensions;
using SharpNL.Tokenize;
using SharpNL.Utility;

namespace SharpNL.DocumentCategorizer {
    ///
    /// This class reads in string encoded training samples, parses them and outputs <see cref="DocumentSample"/> objects.
    ///
    /// <remarks>
    /// Format:

    /// Each line contains one sample document.

    /// The category is the first string in the line followed by a tab and whitespace separated document tokens.

    /// Sample line: category-string tab-char whitespace-separated-tokens line-break-char(s)
    /// </remarks>
    public class DocumentSampleStream : FilterObjectStream<string, DocumentSample> {
        ///
        /// Initializes a new instance of the <see cref="DocumentSampleStream"/> with the given samples.
        ///
        /// <param name="samples">The samples.</param>
        public DocumentSampleStream(IObjectStream<string> samples) : base(samples) {}

        ///
        /// Returns the next object. Calling this method repeatedly until it returns ,
        /// null will return each object from the underlying source exactly once.
        ///
        /// <returns>
        /// The next object or null to signal that the stream is exhausted.
        /// </returns>
        public override DocumentSample Read() {
            var sampleString = Samples.Read();

            if (sampleString == null)
                return null;

            var tokens = WhitespaceTokenizer.Instance.Tokenize(sampleString);

            if (tokens.Length > 1) {
                return new DocumentSample(tokens[0], tokens.SubArray(1, tokens.Length - 1));
            }

            throw new InvalidFormatException("Empty lines, or lines with only a category string are not allowed!");
        }
    }
}


text:
package com.xiaomi.market.sdk;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteStatement;
import android.util.Log;

public class r extends SQLiteOpenHelper
{

    static final String a = "xiaomi_market_sdk_update.db";
    static final int b = 1;
    private static r c;
    private static final String d = "MarketSDKDatabaseHelper";

    private r(Context context)
    {
        super(context, "xiaomi_market_sdk_update.db", null, 1);
    }

    private void a(SQLiteDatabase sqlitedatabase)
    {
        sqlitedatabase.execSQL("CREATE TABLE update_download (_id INTEGER PRIMARY KEY AUTOINCREMENT,package_name TEXT,download_id INTEGER, version_code INTEGER, apk_url TEXT, apk_hash TEXT, diff_url TEXT, diff_hash TEXT, apk_path TEXT, UNIQUE(package_name));");
    }

    public static r j(Context context)
    {
        if (c == null)
        {
            c = new r(context);
        }
        return c;
    }

    public long a(ContentValues contentvalues)
    {
        SQLiteStatement sqlitestatement = getWritableDatabase().compileStatement("INSERT OR REPLACE INTO update_download(package_name,download_id,version_code,apk_url,apk_hash,diff_url,diff_hash,apk_path) VALUES(?,?,?,?,?,?,?,?)");
        sqlitestatement.bindString(1, contentvalues.getAsString("package_name"));
        sqlitestatement.bindLong(2, contentvalues.getAsLong("download_id").longValue());
        sqlitestatement.bindLong(3, contentvalues.getAsInteger("version_code").intValue());
        sqlitestatement.bindString(4, contentvalues.getAsString("apk_url"));
        sqlitestatement.bindString(5, contentvalues.getAsString("apk_hash"));
        sqlitestatement.bindString(6, contentvalues.getAsString("diff_url"));
        sqlitestatement.bindString(7, contentvalues.getAsString("diff_hash"));
        sqlitestatement.bindString(8, contentvalues.getAsString("apk_path"));
        sqlitestatement.execute();
        return 1L;
    }

    public long a(String s, ContentValues contentvalues)
    {
        this;
        JVM INSTR monitorenter ;
        long l = getWritableDatabase().insert(s, null, contentvalues);
        this;
        JVM INSTR monitorexit ;
        return l;
        Exception exception;
        exception;
        throw exception;
    }

    public void onCreate(SQLiteDatabase sqlitedatabase)
    {
        Log.d("MarketSDKDatabaseHelper", "create database");
        a(sqlitedatabase);
    }

    public void onUpgrade(SQLiteDatabase sqlitedatabase, int i, int k)
    {
    }

    public Cursor query(String s, String as[], String s1, String as1[], String s2, String s3, String s4)
    {
        return getReadableDatabase().query(s, as, s1, as1, s2, s3, s4);
    }
}


text:
package freecli
package option
package dsl

import cats.free.FreeApplicative
import shapeless._
import shapeless.ops.hlist.Prepend

import core.api.{CanProduce, Description}
import option.api._

case class VersionDslBuilder[H <: HList](list: H) {

  def --(
    name: String)
   (implicit ev: Prepend[H, OptionFieldName :: HNil],
    ev2: NotContainsConstraint[H, OptionFieldName]) =

    new VersionDslBuilder(list :+ OptionFieldName(name))

  def -(
    abbr: Char)
   (implicit ev: Prepend[H, OptionFieldAbbreviation :: HNil],
    ev2: NotContainsConstraint[H, OptionFieldAbbreviation]) =

    new VersionDslBuilder(list :+ OptionFieldAbbreviation(abbr))

  def -~(
    description: Description)
   (implicit ev: Prepend[H, Description :: HNil],
    ev2: NotContainsConstraint[H, Description]) =

    new VersionDslBuilder(list :+ description)

  def -~(
    value: StringValue)
   (implicit ev: Prepend[H, StringValue :: HNil],
    ev2: NotContainsConstraint[H, StringValue]) =

    new VersionDslBuilder(list :+ value)

}

object VersionDslBuilder {
  def version: VersionDslBuilder[HNil] =
    new VersionDslBuilder[HNil](HNil)

  implicit def canProduceOptionDsl[H <: HList, L <: HList](
    implicit canProduceField: CanProduce.Aux[H, (OptionField, L)],
    canProduceStringValue: CanProduce.Aux[L, (StringValue, HNil)]):
    CanProduce.Aux[VersionDslBuilder[H], OptionDsl[HNil]] = {
    new CanProduce[VersionDslBuilder[H]] {
      type Out = OptionDsl[HNil]
      def apply(t: VersionDslBuilder[H]): Out = {
        val (field, rem) = canProduceField.apply(t.list)
        val (value, _) = canProduceStringValue.apply(rem)
        FreeApplicative.lift(Version[HNil](field, value, identity))
      }
    }
  }
}