text:
package org.eclipse.ceylon.compiler.java.tools;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;

import org.eclipse.ceylon.cmr.api.ModuleDependencyInfo;
import org.eclipse.ceylon.cmr.api.ModuleInfo;
import org.eclipse.ceylon.cmr.impl.IOUtils;
import org.eclipse.ceylon.cmr.impl.XmlDependencyResolver;
import org.eclipse.ceylon.model.cmr.JDKUtils;
import org.eclipse.ceylon.model.typechecker.model.Module;
import org.eclipse.ceylon.model.typechecker.model.ModuleImport;
import org.eclipse.ceylon.model.typechecker.model.Package;

import org.eclipse.ceylon.langtools.classfile.Attribute;
import org.eclipse.ceylon.langtools.classfile.Attributes;
import org.eclipse.ceylon.langtools.classfile.ClassFile;
import org.eclipse.ceylon.langtools.classfile.ClassWriter;
import org.eclipse.ceylon.langtools.classfile.ConstantPool;
import org.eclipse.ceylon.langtools.classfile.ConstantPool.CPInfo;
import org.eclipse.ceylon.langtools.classfile.ModuleMainClass_attribute;
import org.eclipse.ceylon.langtools.classfile.ModulePackages_attribute;
import org.eclipse.ceylon.langtools.classfile.Module_attribute;

public class Java9Util {

    private static String sanitiseName(String name) {
        return name.replace('-', '_');
    }

    static class Java9ModuleDescriptor {
        final String name, version, main;
        final Set<String> exportedPackages = new HashSet<String>(), concealedPackages = new HashSet<String>();
        final List<Java9ModuleImport> imports = new LinkedList<Java9ModuleImport>();

        Java9ModuleDescriptor(Module module){
            name = sanitiseName(module.getNameAsString());
            version = module.getVersion();
            for(Package pkg : module.getPackages()){
                if(isShared(pkg))
                    exportedPackages.add(pkg.getNameAsString());
                else
                    concealedPackages.add(pkg.getNameAsString());
            }
            Set<String> importedModules = new HashSet<>();
            for(ModuleImport imp : module.getImports()){
                // skip optional deps since create-mlib will skip them too
                if(imp.isOptional())
                    continue;
                String dependency = JDKUtils.getJava9ModuleName(imp.getModule().getNameAsString(), imp.getModule().getVersion());
                // never import a module twice, and due to jdk8->9 aliases this can be the case
                if(!importedModules.add(dependency))
                    continue;
                if(skipModuleImport(dependency))
                    continue;
                imports.add(new Java9ModuleImport(dependency, imp.isExport()));
            }
            addImplicitImports();
            main = getMain(module.getNameAsString());
        }

        public Java9ModuleDescriptor(String name, String version, ModuleInfo info, Set<String> packages) {
            this.name = sanitiseName(name);
            this.version = version;
            exportedPackages.addAll(packages);
            Set<String> importedModules = new HashSet<>();
            for(ModuleDependencyInfo imp : info.getDependencies()){
                // skip optional deps since create-mlib will skip them too
                if(imp.isOptional())
                    continue;
                String dependency = JDKUtils.getJava9ModuleName(imp.getName(), imp.getVersion());
                // never import a module twice, and due to jdk8->9 aliases this can be the case
                if(!importedModules.add(dependency))
                    continue;
                if(skipModuleImport(dependency))
                    continue;
                imports.add(new Java9ModuleImport(dependency, imp.isExport()));
            }
            addImplicitImports();
            main = getMain(name);
        }

        private boolean skipModuleImport(String dependency) {
            // model depends on language but only at runtime, Java 9 adds this dependency at runtime and
            // will barf if it sees it at compile-time, so special-case it
            if(name.equals("org.eclipse.ceylon.model") && dependency.equals(Module.LANGUAGE_MODULE_NAME))
                return true;
            // same for slf4j
            if(name.equals("org.slf4j.api") && dependency.equals("org.slf4j.simple"))
                return true;
            return false;
        }

        private String getMain(String module) {
            if(module.equals("org.eclipse.ceylon.java.main"))
                return "org.eclipse.ceylon.compiler.java.runtime.Main2";
            else
                return null;
        }

        private boolean isShared(Package pkg) {
            // Special case for the language module where we don't want Ceylon users to access this package, but
            // we need our produced Java code to be allowed to
            if(pkg.getModule().isLanguageModule()){
                String name = pkg.getNameAsString();
                if(name.equals("org.eclipse.ceylon.compiler.java.runtime.metamodel")
                        || name.equals("org.eclipse.ceylon.compiler.java.runtime")
                        || name.equals("org.eclipse.ceylon.compiler.java.metadata")
                        || name.equals("org.eclipse.ceylon.compiler.java"))
                    return true;
            }
            return pkg.isShared();
        }

        private void addImplicitImports() {
            for(Java9ModuleImport imp : imports){
                if(imp.name.equals("java.base"))
                    return;
            }
            imports.add(new Java9ModuleImport("java.base", true));
        }

        int getPackagesSize(){
            return exportedPackages.size() + concealedPackages.size();
        }
    }

    static class Java9ModuleImport {
        final String name;
        final boolean exported;
        Java9ModuleImport(String name, boolean exported){
            this.name = sanitiseName(name);
            this.exported = exported;
        }
    }

    public static void writeModuleDescriptor(File outputFolder, Java9ModuleDescriptor module) {
        ClassWriter classWriter = new ClassWriter();
        ClassFile classFile = generateModuleDescriptor(module);
        try (OutputStream os = new FileOutputStream(new File(outputFolder, "module-info.class"))){
            classWriter.write(classFile, os);
        } catch (IOException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }

    private static void writeModuleDescriptor(ZipOutputStream zos, Java9ModuleDescriptor module) {
        ClassWriter classWriter = new ClassWriter();
        ClassFile classFile = generateModuleDescriptor(module);
        try {
            zos.putNextEntry(new ZipEntry("module-info.class"));
            classWriter.write(classFile, zos);
            zos.flush();
            zos.closeEntry();
        } catch (IOException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }

    private static ClassFile generateModuleDescriptor(Java9ModuleDescriptor module) {
        CPInfo[] pool = new ConstantPool.CPInfo[1+7
                                                + (module.imports.size() * 2)
                                                + (module.getPackagesSize() * 2)
                                                + (module.main != null ? 3 : 0)];
        ConstantPool constantPool = new ConstantPool(pool);

        int cp = 1;
        // 1: this_class name
        pool[cp++] = new ConstantPool.CONSTANT_Utf8_info("module-info");
        // 2: this_class
        pool[cp++] = new ConstantPool.CONSTANT_Class_info(constantPool, 1);
        // 3: module attr
        pool[cp++] = new ConstantPool.CONSTANT_Utf8_info(Attribute.Module);
        // 4: module pkgs attr
        pool[cp++] = new ConstantPool.CONSTANT_Utf8_info(Attribute.ModulePackages);
        // 5: version
        pool[cp++] = new ConstantPool.CONSTANT_Utf8_info(module.version);
        // 6: module name
        pool[cp++] = new ConstantPool.CONSTANT_Utf8_info(module.name);
        // 7: module info
        pool[cp++] = new ConstantPool.CONSTANT_Module_info(constantPool, 6);
        if(module.main != null){
            // 8: main attr
            pool[cp++] = new ConstantPool.CONSTANT_Utf8_info(Attribute.ModuleMainClass);
            // 9: main class name
            pool[cp++] = new ConstantPool.CONSTANT_Utf8_info(module.main.replace('.', '/'));
            // 10: main class
            pool[cp++] = new ConstantPool.CONSTANT_Class_info(constantPool, 9);
        }
        int i=0;
        // now imports
        Module_attribute.RequiresEntry[] requires = new Module_attribute.RequiresEntry[module.imports.size()];
        for(Java9ModuleImport imp : module.imports){
            pool[cp] = new ConstantPool.CONSTANT_Utf8_info(imp.name);
            pool[cp+1] = new ConstantPool.CONSTANT_Module_info(constantPool, cp);
            int flag = 0;
            if(imp.exported)
                flag |= Module_attribute.ACC_TRANSITIVE;
            // FIXME: add version info!
            requires[i] = new Module_attribute.RequiresEntry(cp+1, flag, 0);
            i++;
            cp+=2;
        }
        Module_attribute.ExportsEntry[] exports = new Module_attribute.ExportsEntry[module.exportedPackages.size()];
        i = 0;
        int[] modulePackages = new int[module.exportedPackages.size() + module.concealedPackages.size()];
        int m=0;
        for(String pkg : module.exportedPackages){
            pool[cp] = new ConstantPool.CONSTANT_Utf8_info(pkg.replace('.', '/'));
            pool[cp+1] = new ConstantPool.CONSTANT_Package_info(constantPool, cp);
            exports[i++] = new Module_attribute.ExportsEntry(cp+1, 0, new int[0]);
            modulePackages[m++] = cp+1;
            cp+=2;
        }
        for(String pkg : module.concealedPackages){
            pool[cp] = new ConstantPool.CONSTANT_Utf8_info(pkg.replace('.', '/'));
            pool[cp+1] = new ConstantPool.CONSTANT_Package_info(constantPool, cp);
            modulePackages[m++] = cp+1;
            cp+=2;
        }
        Attribute[] attributesArray = new Attribute[2 + (module.main != null ? 1 : 0)];
        attributesArray[0] = new Module_attribute(3,
                        7, // module name index
                        0, // flags
                        5, // version
                        requires,
                        exports,
                        new Module_attribute.OpensEntry[0],
                        new int[0],
                        new Module_attribute.ProvidesEntry[0]);
        attributesArray[1] = new ModulePackages_attribute(4, modulePackages);
        if(module.main != null)
            attributesArray[2] = new ModuleMainClass_attribute(8, 10);

        Attributes attributes = new Attributes(constantPool, attributesArray );
        return new ClassFile(org.eclipse.ceylon.langtools.tools.javac.jvm.ClassFile.JAVA_MAGIC,
                org.eclipse.ceylon.langtools.tools.javac.jvm.ClassFile.Version.V53.minor,
                org.eclipse.ceylon.langtools.tools.javac.jvm.ClassFile.Version.V53.major,
                constantPool,
                new org.eclipse.ceylon.langtools.classfile.AccessFlags(org.eclipse.ceylon.langtools.classfile.AccessFlags.ACC_MODULE),
                2,
                0,
                new int[0],
                new org.eclipse.ceylon.langtools.classfile.Field[0],
                new org.eclipse.ceylon.langtools.classfile.Method[0],
                attributes);
    }

    private static final String METAINF_JBOSSMODULES = "META-INF/jbossmodules/";
    private static final String MODULE_XML = "module.xml";

    public static void main(String[] args) throws IOException {
        System.err.println("Add Java9 Module info for "+args[0]);
        // FIXME: check arg
        String jarName = args[0];
        File jarFile = new File(jarName);
        ZipFile zipFile = new ZipFile(jarFile);
        File outFile = File.createTempFile(jarName, ".jar");
        ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(outFile));
        Enumeration<? extends ZipEntry> entries = zipFile.entries();
        Set<String> packages = new HashSet<String>();
        ModuleInfo info = null;
        String moduleName = null, version = null;
        while(entries.hasMoreElements()){
            ZipEntry entry = entries.nextElement();
            String name = entry.getName();
            if(name.equals("module-info.class")){
                System.err.println(" Already has a module info!");
                zipFile.close();
                zos.close();
                outFile.delete();
                return;
            }else if(name.endsWith(".class")){
                int lastSlash = name.lastIndexOf('/');
                // ignore the default package (not sure if we can import or conceal it in Java 9
                if(lastSlash != -1){
                    String pkg = name.substring(0, lastSlash).replace('/', '.');
                    packages.add(pkg);
                }
            }else if(name.startsWith(METAINF_JBOSSMODULES)
                    && name.endsWith("module.xml")){
                String path = name.substring(METAINF_JBOSSMODULES.length());
                path = path.substring(0, path.length() - MODULE_XML.length() - 1);
                int p = path.lastIndexOf('/');
                if (p > 0) {
                    moduleName = path.substring(0, p).replace('/', '.');
                    version = path.substring(p + 1);
                }
                try(InputStream is = zipFile.getInputStream(entry)){
                    // name/version only used when we have an override
                    info = XmlDependencyResolver.INSTANCE.resolveFromInputStream(is, null, null, null);
                    System.err.println(" Found module descriptor at "+name);
                }
            }
            zos.putNextEntry(entry);
            if(!entry.isDirectory())
                IOUtils.copyStream(zipFile.getInputStream(entry), zos, true, false);
            zos.closeEntry();
        }
        zipFile.close();

        if(info != null && moduleName != null && version != null){
            writeModuleDescriptor(zos, new Java9ModuleDescriptor(moduleName, version, info, packages));
        }
        zos.flush();
        zos.close();
        // rename
        jarFile.delete();
        Files.copy(outFile.toPath(), jarFile.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES);
        outFile.delete();
    }
}


text:
from twisted.web.resource import Resource

import synapse.metrics

METRICS_PREFIX = "/_synapse/metrics"

class MetricsResource(Resource):
    isLeaf = True

    def __init__(self, hs):
        Resource.__init__(self)  # Resource is old-style, so no super()

        self.hs = hs

    def render_GET(self, request):
        response = synapse.metrics.render_all()

        request.setHeader("Content-Type", "text/plain")
        request.setHeader("Content-Length", str(len(response)))

        # Encode as UTF-8 (default)
        return response.encode()

redpajama_set_name: RedPajamaGithub


text:
import React, { ChangeEvent, createRef } from 'react';

import Field from "../elements/Field";
import { _t, _td } from '../../../languageHandler';
import { IFieldState, IValidationResult } from "../elements/Validation";
import BaseDialog from "./BaseDialog";
import DialogButtons from "../elements/DialogButtons";
import { IDialogProps } from "./IDialogProps";

interface IProps extends IDialogProps {
    title?: string;
    description?: React.ReactNode;
    value?: string;
    placeholder?: string;
    button?: string;
    busyMessage?: string; // pass _td string
    focus?: boolean;
    hasCancel?: boolean;
    validator?: (fieldState: IFieldState) => Promise<IValidationResult>; // result of withValidation
    fixedWidth?: boolean;
}

interface IState {
    value: string;
    busy: boolean;
    valid: boolean;
}

export default class TextInputDialog extends React.Component<IProps, IState> {
    private field = createRef<Field>();

    public static defaultProps = {
        title: "",
        value: "",
        description: "",
        busyMessage: _td("Loading..."),
        focus: true,
        hasCancel: true,
    };

    constructor(props: IProps) {
        super(props);

        this.state = {
            value: this.props.value,
            busy: false,
            valid: false,
        };
    }

    public componentDidMount(): void {
        if (this.props.focus) {
            // Set the cursor at the end of the text input
            // this._field.current.value = this.props.value;
            this.field.current.focus();
        }
    }

    private onOk = async (ev: React.FormEvent): Promise<void> => {
        ev.preventDefault();
        if (this.props.validator) {
            this.setState({ busy: true });
            await this.field.current.validate({ allowEmpty: false });

            if (!this.field.current.state.valid) {
                this.field.current.focus();
                this.field.current.validate({ allowEmpty: false, focused: true });
                this.setState({ busy: false });
                return;
            }
        }
        this.props.onFinished(true, this.state.value);
    };

    private onCancel = (): void => {
        this.props.onFinished(false);
    };

    private onChange = (ev: ChangeEvent<HTMLInputElement>): void => {
        this.setState({
            value: ev.target.value,
        });
    };

    private onValidate = async (fieldState: IFieldState): Promise<IValidationResult> => {
        const result = await this.props.validator(fieldState);
        this.setState({
            valid: result.valid,
        });
        return result;
    };

    public render(): JSX.Element {
        return (
            <BaseDialog
                className="mx_TextInputDialog"
                onFinished={this.props.onFinished}
                title={this.props.title}
                fixedWidth={this.props.fixedWidth}
            >
                <form onSubmit={this.onOk}>

                             { this.props.description }

                            <Field
                                className="mx_TextInputDialog_input"
                                ref={this.field}
                                type="text"
                                label={this.props.placeholder}
                                value={this.state.value}
                                onChange={this.onChange}
                                onValidate={this.props.validator ? this.onValidate : undefined}
                            />

                </form>
                <DialogButtons
                    primaryButton={this.state.busy ? _t(this.props.busyMessage) : this.props.button}
                    disabled={this.state.busy}
                    onPrimaryButtonClick={this.onOk}
                    onCancel={this.onCancel}
                    hasCancel={this.props.hasCancel}
                />
            </BaseDialog>
        );
    }
}


text:
package com.github.thesmartenergy.ontop.jersey;

import com.github.thesmartenergy.rdfp.BaseURI;
import javax.inject.Inject;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 *
 * @author Maxime Lefrançois <maxime.lefrancois at emse.fr>
 */
@WebListener
public class Listener implements ServletContextListener{

    @Inject
    @BaseURI
    private String base;

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        // force resource map initialization
        RepresentationsMap.get(base);
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
    }

}


text:
for bottles in (1..100).reverse_each
  puts "#{bottles} bottles of beer on the wall,"
  puts "#{bottles} bottles of beer!"
  puts "If one take one down and pass it around..."
  puts "#{bottles - 1} bottles of beer on the wall!"
  puts
end

puts "Hey, somebody better go on a beer run!"


text:
package oneview

import (
	"fmt"
	"testing"

	"github.com/HewlettPackard/oneview-golang/ov"
	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
	"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

func TestAccStorageVolumeTemplate_1(t *testing.T) {
	var storageVolumeTemplate ov.StorageVolumeTemplate

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckStorageVolumeTemplateDestroy,
		Steps: []resource.TestStep{
			{
				Config: testAccStorageVolumeTemplate,
				Check: resource.ComposeTestCheckFunc(
					testAccCheckStorageVolumeTemplateExists(
						"oneview_storage_volume_template.test", &storageVolumeTemplate),
					resource.TestCheckResourceAttr(
						"oneview_storage_volume_template.test", "name", "DemoStorageVolumeTemplate",
					),
				),
			},
			{
				ResourceName:      testAccStorageVolumeTemplate,
				ImportState:       true,
				ImportStateVerify: true,
			},
		},
	})
}

func testAccCheckStorageVolumeTemplateExists(n string, storageVolumeTemplate *ov.StorageVolumeTemplate) resource.TestCheckFunc {
	return func(s *terraform.State) error {
		rs, ok := s.RootModule().Resources[n]
		if !ok {
			return fmt.Errorf("Not found :%v", n)
		}

		if rs.Primary.ID == "" {
			return fmt.Errorf("No ID is set")
		}

		config, err := testProviderConfig()
		if err != nil {
			return err
		}

		testStorageVolumeTemplate, err := config.ovClient.GetStorageVolumeTemplateByName(rs.Primary.ID)
		if err != nil {
			return err
		}
		if testStorageVolumeTemplate.Name != rs.Primary.ID {
			return fmt.Errorf("Instance not found")
		}
		*storageVolumeTemplate = testStorageVolumeTemplate
		return nil
	}
}

func testAccCheckStorageVolumeTemplateDestroy(s *terraform.State) error {
	config := testAccProvider.Meta().(*Config)
	for _, rs := range s.RootModule().Resources {
		if rs.Type != "oneview_storage_volume_template" {
			continue
		}

		testSVT, _ := config.ovClient.GetStorageVolumeTemplateByName(rs.Primary.ID)

		if testSVT.Name != "" {
			return fmt.Errorf("StorageVolumeTemplate still exists")
		}
	}

	return nil
}

var testAccStorageVolumeTemplate = `resource "oneview_storage_volume_template" "test" {
  count = 1
  name = "DemoStorageVolumeTemplate"
  root_template_uri = "/rest/storage-volume-templates/96196d4c-3cac-4d6b-ab6b-a93c0143ac75"
  description = "Test SVT"
}`


text:
package adt.spatial.quad;

import java.util.Iterator;

final class IntQuadTreeSetIterator<E> implements Iterator<E> {
	IntQuadTreeSetIterator(IntQuadTreeSetNode<E> node) {
		prevNode = null;
		this.node = node;
		advance();
	}

	void advance() {
		while (node != null && node.elements.isEmpty()) {
			node = node.next();
		}
		if (node != null) {
			cursor = node.elements.iterator();
		}
	}

	@Override
	public boolean hasNext() {
		return cursor.hasNext();
	}

	@Override
	public E next() {
		E element = cursor.next();
		prevCursor = cursor;
		prevNode = node;
		if (!cursor.hasNext()) {
			node = node.next();
			advance();
		}
		return element;
	}

	@Override
	public void remove() {
		int count = prevNode.elements.size();
		prevCursor.remove();
		if (prevNode.elements.size() == count - 1) {
			--prevNode.owner.get().count;
		}
	}

	IntQuadTreeSetNode<E> prevNode;
	IntQuadTreeSetNode<E> node;
	Iterator<E> prevCursor;
	Iterator<E> cursor;
}


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>Hill's Hope - In Memory of Richard Hill</title>

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

    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css" type="text/css">

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

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

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

                </button>
                Hill's Hope

                        About

                        Get Involved

                        Gallery

                        Contact

Hill's Hope

In memory of Richard Hill.

IF I can stop one heart from breaking,

I shall not live in vain;

If I can ease one life the aching,

Or cool one pain,

Or help one fainting robin

Unto his nest again,

                    I shall not live in vain.

 -Emily Dickinson

                Find Out More

Our Story

In 2015 my grandson completed a school project that required us to create a new family tradition. We decided we wanted to use this opportunity to help others.  Our new tradition is called Hill's Hope, in honor of our late Uncle who was homeless. Each year at Thanksgiving we will be collecting winter donations filled with needed items to hand out to the homeless at Henry's Place in Beaumont, Texas.

According to Keith at Henry's place, 65 - 70 homeless individuals come through the facility daily. Our hope is to be able to provide something for each person in need.

How To Get Involved

DONATE

Each year around donation time we will announce our donation goals on our Facebook profile. In the past we have collected items such as coats, gloves, hats, socks, washcloths and blankets.

DELIVER

Please check our Facebook profile to find out where you can drop-off your donations, or email us to arrange delivery before DECEMBER 14th, 2016.

BLESS

Your donation will provide warmth and comfort for the homeless community at Henry's Place.

                                    Alek's Original Drawing

                                    A cross built in honor of Richard Hill

                                    Alek's Original Project Poster

Project Photos

Check our Facebook profile for updated project photos!

Reach Out

Questions about the project? Send us an email and we will get back to you as soon as possible!

Hill's Hope

hillshopeproject@gmail.com


text:
package edu.uiowa.icts.spring;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;

import edu.uiowa.icts.util.SortColumn;

public interface GenericDaoInterface<Type> {

	public void setSessionFactory(SessionFactory sessionFactory) ;
	public Session getSession();
	public SessionFactory getSessionFactory();
	public void  saveOrUpdate(Type obj);
	public void  update(Type obj);
	public void  save(Type obj);
	public void  persist(Type obj);
	public void  merge(Type obj);
	public long count();
	public void  delete(int id);
	public void  delete(long id);
	public void  delete(Type obj);

	public String getDomainName() ;
	public List<Type> search( String property, String search, Integer limit );

	public Type findByProperty(String propertyName, Object value);
	public Type findByProperties(HashMap<String, Object> propertyValues);
	public List<Type> listByProperty(String propertyName, Object value);
	public List<Type> listByProperties(HashMap<String, Object> propertyValues);

	public void saveOrUpdate( Collection<Type> list );
	public void save( Collection<Type> list );

	public List<Type[]> query(String st);
	public void setDomainName(String domainName) ;
	public Integer  maxOf(String s);
	public void  justSave(Type obj);
	public List<Type>  list();
	public List<Type>  list( Comparator<Type> comparator );
	public String dump();
	public List<Type> exec(String sql);
	public void execute( String sql );

	public void clean();
	public List<Type>  listOrdered(String order, String direction);

	public Integer count( GenericDaoListOptions options );
	public List<Type> list( GenericDaoListOptions options );
	public List<Type> list( Integer start, Integer limit );
	public List<Type> list( Integer start, Integer limit, ArrayList<SortColumn> sorts );
	public List<Type> list( Integer start, Integer limit, String search, ArrayList<String> searchColumns, ArrayList<SortColumn> sorts );
	public List<Type> list( Integer start, Integer limit, String search, ArrayList<String> searchColumns, ArrayList<SortColumn> sorts, HashMap<String,Object> individualLikes );
	public Integer countByProperty( String propertyName, Object value );

	public List<Type>  list( Integer start, Integer limit, String search, ArrayList<String> searchColumns, ArrayList<SortColumn> sorts, HashMap<String,Object> individualLikes, HashMap<String,Object> individualEquals);

	public List<Type> listByQuery(String s);

	public Integer countByProperties( HashMap<String, Object> propertyValues );
	public Integer count( String search, ArrayList<String> searchColumns );
	public Integer count( String search, ArrayList<String> searchColumns, HashMap<String,Object> individualLikes );
	public Integer count( String search, ArrayList<String> searchColumns, HashMap<String,Object> individualLikes, HashMap<String,Object> individualEquals);

	public void  flush();
	public void  close();
	public void  refresh(Object obj);

	/**
	 * @deprecated use {@link listByProperty(String propertyName, Object value)} instead.
	 */
	@Deprecated
	public Type  findByCriteria(String s);

	// used for serverside pagination on a table
	@Deprecated
	public Long countSearch(String searchst, List<String> searchCols, List<String> colType);

	@Deprecated
	public List<Object[]> listSearchPaged(int numResults, int firstResult, String searchst, List<String[]> orderData, List<String> colNames, List<String> searchCols, List<String> colType);

}


text:
package org.apache.camel.component.sparkrest;

import org.apache.camel.CamelContext;
import org.apache.camel.support.DefaultMessage;
import spark.Request;
import spark.Response;

/**
 * Spark based {@link org.apache.camel.Message}.
 * <p/>
 * This implementation allows direct access to the Spark {@link Request} using
 * the {@link #getRequest()} method.
 */
public class SparkMessage extends DefaultMessage {

    private final transient Request request;
    private final transient Response response;

    public SparkMessage(CamelContext camelContext, Request request, Response response) {
        super(camelContext);
        this.request = request;
        this.response = response;
    }

    public Request getRequest() {
        return request;
    }

    public Response getResponse() {
        return response;
    }

    @Override
    public DefaultMessage newInstance() {
        return new SparkMessage(getCamelContext(), request, response);
    }
}


text:
package ru.spoddubnyak.commandString;

public class InputParametrs {
    private int numberFloors;
    private double heightFloor;
    private double elevatorSpeed;
    private int timeMoveDoor;

    public InputParametrs(int numberFloors, double heightFloor, double elevatorSpeed, int timeMoveDoor) {
        this.numberFloors = numberFloors;
        this.heightFloor = heightFloor;
        this.elevatorSpeed = elevatorSpeed;
        this.timeMoveDoor = timeMoveDoor;
    }

    public int getNumberFloors() {
        return this.numberFloors;
    }

    public double getHeightFloor() {
        return this.heightFloor;
    }

    public double getElevatorSpeed() {
        return this.elevatorSpeed;
    }

    public int getTimeMoveDoor() {
        return this.timeMoveDoor;
    }

    @Override
    public String toString() {
        return String.format("InputParametrs: numberFloors = %s, heightFloor = %s, elevatorSpeed = %s, timeMoveDoor = %s.",
                              this.numberFloors, this.heightFloor, this.elevatorSpeed, this.timeMoveDoor);
    }
}


text:
hidemenu: true
buttons:
	- text: Sign Up Now
	  url: http://www.dreamhost.com/r.cgi?287326|STYLESHOUT
---
## [Host This Template on Dreamhost.](http://www.dreamhost.com/r.cgi?287326|STYLESHOUT)

Looking for an awesome and reliable webhosting? Try DreamHost.
Get $50 off when you sign up with the promocode STYLESHOUT.


text:
#ifndef _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CCOLL_II
#define _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CCOLL_II

#include "type_iso.CANY.h"

namespace AIMXML
{

namespace iso
{

class CCOLL_II : public ::AIMXML::iso::CANY
{
public:
	AIMXML_EXPORT CCOLL_II(xercesc::DOMNode* const& init);
	AIMXML_EXPORT CCOLL_II(CCOLL_II const& init);
	void operator=(CCOLL_II const& other) { m_node = other.m_node; }
	static altova::meta::ComplexType StaticInfo() { return altova::meta::ComplexType(types + _altova_ti_iso_altova_CCOLL_II); }
	AIMXML_EXPORT void SetXsiType();
};

} // namespace iso

}	// namespace AIMXML

#endif // _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CCOLL_II


text:
layout: post
title: What does non stealing have to do with yoga?
date: 2020-01-24 08:43:00
author: Lucy Tennyson
categories:
  - Blog
---

Asteya (non stealing) is the third of the five Yamas in Patanjali's Yoga Sutras, a guide to the philosophy of yoga compiled nearly 2000 years ago. Just like the other Yamas, 'non-stealing'  has a wide range of meanings. It can be thought of as far more than not taking something from someone else.

The concept of Asteya is mentioned and debated in many other spiritual texts, including the Mahabarata (of which the Bhagavad Gita is part), and the ancient philosophical writings collectively known as the Upanishads and the Vedas. In the 20th century Gandhi also wrote about Asteya/ non-stealing and he considered it one of his '11 Vows'. He expanded beyond the physical act of stealing – suggesting that humankind's greed and craving for more things including wealth is also a form of stealing.

This concept of Asteya has particular resonance for us today, with current concerns about the ecology of our planet, and whether we are living sustainable lifestyles. Are we 'stealing' from future generations to come?

How might we apply the idea of 'non-stealing' to our yoga practice? I'm sure you haven't even dreamt of stealing someone's blocks or mat\! Your suggestions welcome.

In our class sequence this week, we did some standing postures to strengthen the legs.  After a standing warm up, these included chair, and the head to knee forward bend, or pyramid pose (using blocks if your hands don't reach the floor).  Lying down, we did some pelvic rocks, first actively zipping up with the core muscles, and then passively using the leg muscles only. We finished off with some seated stretches, cross legged and then with the legs straight out in front.

![](/uploads/yogablog24jan.jpeg){: width="227" height="183"} ![](/uploads/yogablog24jan-1.jpg){: width="113" height="64"}


text:
<?php

namespace Vidal\DrugBundle\Entity;

use Doctrine\ORM\EntityRepository;

class ArticleCategoryRepository extends EntityRepository
{
	public function findByRubriqueLink($rubrique, $link)
	{
		return $this->_em->createQuery('
			SELECT c
			FROM VidalDrugBundle:ArticleCategory c
			LEFT JOIN c.rubrique r
			WHERE c.enabled = 1
			  AND r.rubrique = :rubrique
			  AND c.url = :link
			ORDER BY c.priority DESC, c.title ASC
		')->setParameter('rubrique', $rubrique)
            ->setParameter('link', $link)
			->getOneOrNullResult();
	}
}


text:
.. vim: set fileencoding=UTF-8 :
.. vim: set tw=80 :
.. include:: ../globals.rst

.. _secapi:

Spyder API
==========

This is the main documentation for the |spyder| API. This will hopefully provide
you with enough information to getting started for coding new features or help
with bugfixing.

.. toctree::
    :maxdepth: 2

    entrypoints
    masterprocess
    frontier
    queues
    workerprocess
    fetcher
    extractor
    scoper
    sink


text:
(function() {

var checkVersion = Dagaz.Model.checkVersion;

Dagaz.Model.checkVersion = function(design, name, value) {
  if (name != "renge-shogi-invariant") {
      checkVersion(design, name, value);
  }
}

var heuristic = Dagaz.AI.heuristic;

Dagaz.AI.heuristic = function(ai, design, board, move) {
  var n      = design.getDirection("n");
  var lp     = design.getPieceType("LeftPawn");
  var rp     = design.getPieceType("RightPawn");
  var lance  = design.getPieceType("Lance");
  var knight = design.getPieceType("Knight");
  if (move.isSimpleMove()) {
      var piece = board.getPiece(move.actions[0][0][0]);
      if (move.actions[0][2] !== null) {
          piece = move.actions[0][2][0];
      }
      if ((piece !== null) && ((piece.type == lp) || (piece.type == rp) || (piece.type == lance) || (piece.type == knight))) {
          var pos = move.actions[0][1][0];
          pos = design.navigate(board.player, pos, n);
          if (pos === null) return -1;
          if (piece.type == knight) {
              pos = design.navigate(board.player, pos, n);
              if (pos === null) return -1;
          }
      }
  }
  if (!_.isUndefined(heuristic)) {
      return heuristic(ai, design, board, move);
  } else {
      return 1;
  }
}

var checkGoals = Dagaz.Model.checkGoals;

Dagaz.Model.checkGoals = function(design, board, player) {
  var friends = 0;
  var enemies = 0;
  var king    = design.getPieceType("King");
  _.each(design.allPositions(), function(pos) {
      var piece = board.getPiece(pos);
      if ((piece !== null) && (piece.type == king)) {
          if (piece.player == player) {
              friends++;
          } else {
              enemies++;
          }
      }
  });
  if (enemies == 0) {
      return 1;
  }
  if (friends == 0) {
      return -1;
  }
  return checkGoals(design, board, player);
}

var findPiece = function(design, board, player, type) {
  for (var p = 0; p < design.positions.length; p++) {
       var piece = board.getPiece(p);
       if ((piece !== null) && (piece.type == type) && (piece.player == player)) {
           return p;
       }
  }
  return null;
}

var isKnightAttacked = function(design, board, player, pos, o, d, leapers) {
  var p = design.navigate(player, pos, o);
  if (p === null) return false;
  p = design.navigate(player, p, d);
  if (p === null) return false;
  var piece = board.getPiece(p);
  if (piece === null) return false;
  if (piece.player == player) return false;
  return _.indexOf(leapers, +piece.type) >= 0;
}

var isAttacked = function(design, board, player, pos, dir, leapers, riders) {
  var p = design.navigate(player, pos, dir);
  if (p === null) return false;
  var piece = board.getPiece(p);
  if (piece !== null) {
      if (piece.player == player) return false;
      if (_.indexOf(leapers, +piece.type) >= 0) return true;
      if (_.indexOf(riders, +piece.type) >= 0) return true;
      return false;
  }
  p = design.navigate(player, p, dir);
  while (p !== null) {
      piece = board.getPiece(p);
      if (piece !== null) {
          if (piece.player == player) return false;
          return _.indexOf(riders, +piece.type) >= 0;
      }
      p = design.navigate(player, p, dir);
  }
  return false;
}

var CheckInvariants = Dagaz.Model.CheckInvariants;

Dagaz.Model.CheckInvariants = function(board) {
  var design = Dagaz.Model.design;
  var king   = design.getPieceType("King");
  var bishop = design.getPieceType("Bishop");
  var gold   = design.getPieceType("Gold");
  var rook   = design.getPieceType("Rook");
  var silver = design.getPieceType("Silver");
  var lance  = design.getPieceType("Lance");
  var knight = design.getPieceType("Knight");
  var lp     = design.getPieceType("LeftPawn");
  var rp     = design.getPieceType("RightPawn");
  var n  = design.getDirection("n");  var w  = design.getDirection("w");
  var s  = design.getDirection("s");  var e  = design.getDirection("e");
  var nw = design.getDirection("nw"); var sw = design.getDirection("sw");
  var ne = design.getDirection("ne"); var se = design.getDirection("se");
  _.each(board.moves, function(m) {
      var b = board.apply(m);
      var pos = findPiece(design, b, board.player, king);
      if (pos === null) {
          m.failed = true;
          return;
      }
      if (isAttacked(design, b, board.player, pos, n, [king, gold, silver, lp, rp], [rook, lance]) ||
          isAttacked(design, b, board.player, pos, s, [king, gold], [rook]) ||
          isAttacked(design, b, board.player, pos, w, [king, gold], [rook]) ||
          isAttacked(design, b, board.player, pos, e, [king, gold], [rook]) ||
          isAttacked(design, b, board.player, pos, nw, [king, gold, silver], [bishop]) ||
          isAttacked(design, b, board.player, pos, ne, [king, gold, silver], [bishop]) ||
          isAttacked(design, b, board.player, pos, sw, [king, silver], [bishop]) ||
          isAttacked(design, b, board.player, pos, se, [king, silver], [bishop])) {
          m.failed = true;
          return;
      }
      if (isKnightAttacked(design, b, board.player, pos, n, nw, [knight]) ||
          isKnightAttacked(design, b, board.player, pos, n, ne, [knight])) {
          m.failed = true;
          return;
      }
  });
  CheckInvariants(board);
}

})();


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=../../cl_sys/constant.CL_BUILD_NONE.html">

Redirecting to ../../cl_sys/constant.CL_BUILD_NONE.html...


text:
license: >
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you 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.

title: accelerometerOptions
---

# accelerometerOptions

加速度計の値の検索をカスタマイズするオプションのパラメーター。

## オプション

*   **周波数**: 取得する頻度、 `Acceleration` (ミリ秒単位)。*(数)*(デフォルト: 10000)


text:
// DATA_TEMPLATE: empty_table
oTest.fnStart("aaSorting");

$(document).ready(function () {
    /* Check the default */
    var oTable = $('#example').dataTable({
        "sAjaxSource": "../../../examples/ajax/sources/arrays.txt"
    });
    var oSettings = oTable.fnSettings();

    oTest.fnWaitTest(
        "Default sorting is single column",
        null,
        function () {
            return oSettings.aaSorting.length == 1 && typeof oSettings.aaSorting[0] == 'object';
        }
    );

    oTest.fnWaitTest(
        "Default sorting is first column asc",
        null,
        function () {
            return oSettings.aaSorting[0].length == 3 && oSettings.aaSorting[0][0] == 0 &&
                oSettings.aaSorting[0][1] == 'asc';
        }
    );

    oTest.fnWaitTest(
        "Sorting is applied",
        null,
        function () {
            return $('#example tbody td:eq(0)').html() == "Gecko";
        }
    );

    oTest.fnWaitTest(
        "Custom sorting on single string column asc",
        function () {
            oSession.fnRestore();
            $('#example').dataTable({
                "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
                "aaSorting": [['1', 'asc']]
            });
        },
        function () {
            return $('#example tbody td:eq(1)').html() == "All others";
        }
    );

    oTest.fnWaitTest(
        "Custom sorting on single string column desc",
        function () {
            oSession.fnRestore();
            $('#example').dataTable({
                "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
                "aaSorting": [['1', 'desc']]
            });
        },
        function () {
            return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1";
        }
    );

    oTest.fnWaitTest(
        "Custom sorting on single int column asc",
        function () {
            oSession.fnRestore();
            $('#example').dataTable({
                "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
                "aaSorting": [['1', 'asc']]
            });
        },
        function () {
            return $('#example tbody td:eq(3)').html() == "-";
        }
    );

    oTest.fnWaitTest(
        "Custom sorting on single int column desc",
        function () {
            oSession.fnRestore();
            $('#example').dataTable({
                "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
                "aaSorting": [['1', 'desc']]
            });
        },
        function () {
            return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1";
        }
    );

    oTest.fnWaitTest(
        "Multi-column sorting (2 column) - string asc / string asc",
        function () {
            oSession.fnRestore();
            $('#example').dataTable({
                "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
                "aaSorting": [['0', 'asc'], ['1', 'asc']]
            });
        },
        function () {
            return $('#example tbody td:eq(1)').html() == "Camino 1.0";
        }
    );

    oTest.fnWaitTest(
        "Multi-column sorting (2 column) - string asc / string desc",
        function () {
            oSession.fnRestore();
            $('#example').dataTable({
                "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
                "aaSorting": [['0', 'asc'], ['1', 'desc']]
            });
        },
        function () {
            return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1";
        }
    );

    oTest.fnWaitTest(
        "Multi-column sorting (2 column) - string desc / string asc",
        function () {
            oSession.fnRestore();
            $('#example').dataTable({
                "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
                "aaSorting": [['0', 'desc'], ['1', 'asc']]
            });
        },
        function () {
            return $('#example tbody td:eq(1)').html() == "iPod Touch / iPhone";
        }
    );

    oTest.fnWaitTest(
        "Multi-column sorting (2 column) - string desc / string desc",
        function () {
            oSession.fnRestore();
            $('#example').dataTable({
                "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
                "aaSorting": [['0', 'desc'], ['1', 'desc']]
            });
        },
        function () {
            return $('#example tbody td:eq(1)').html() == "Safari 3.0";
        }
    );

    oTest.fnWaitTest(
        "Multi-column sorting (2 column) - string asc / int asc",
        function () {
            oSession.fnRestore();
            $('#example').dataTable({
                "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
                "aaSorting": [['0', 'asc'], ['3', 'asc']]
            });
        },
        function () {
            return $('#example tbody td:eq(3)').html() == "1";
        }
    );

    oTest.fnWaitTest(
        "Multi-column sorting (2 column) - string asc / int desc",
        function () {
            oSession.fnRestore();
            $('#example').dataTable({
                "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
                "aaSorting": [['0', 'asc'], ['3', 'desc']]
            });
        },
        function () {
            return $('#example tbody td:eq(3)').html() == "1.9";
        }
    );

    oTest.fnWaitTest(
        "Multi-column sorting (2 column) - string desc / int asc",
        function () {
            oSession.fnRestore();
            $('#example').dataTable({
                "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
                "aaSorting": [['0', 'desc'], ['3', 'asc']]
            });
        },
        function () {
            return $('#example tbody td:eq(3)').html() == "125.5";
        }
    );

    oTest.fnWaitTest(
        "Multi-column sorting (2 column) - string desc / int desc",
        function () {
            oSession.fnRestore();
            $('#example').dataTable({
                "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
                "aaSorting": [['0', 'desc'], ['3', 'desc']]
            });
        },
        function () {
            return $('#example tbody td:eq(3)').html() == "522.1";
        }
    );

    oTest.fnWaitTest(
        "Multi-column sorting (3 column) - string asc / int asc / string asc",
        function () {
            oSession.fnRestore();
            $('#example').dataTable({
                "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
                "aaSorting": [['0', 'asc'], ['3', 'asc'], ['1', 'asc']]
            });
        },
        function () {
            return $('#example tbody tr:eq(7) td:eq(1)').html() == "Firefox 1.0";
        }
    );

    oTest.fnComplete();
});


text:
#include <tesseract/capi.h>

#include "libavutil/opt.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

typedef struct OCRContext {
    const AVClass *class;

    char *datapath;
    char *language;
    char *whitelist;
    char *blacklist;

    TessBaseAPI *tess;
} OCRContext;

#define OFFSET(x) offsetof(OCRContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM

static const AVOption ocr_options[] = {
    { "datapath",  "set datapath",            OFFSET(datapath),  AV_OPT_TYPE_STRING, {.str=NULL},  0, 0, FLAGS },
    { "language",  "set language",            OFFSET(language),  AV_OPT_TYPE_STRING, {.str="eng"}, 0, 0, FLAGS },
    { "whitelist", "set character whitelist", OFFSET(whitelist), AV_OPT_TYPE_STRING, {.str="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.:;,-+_!?\"'[]{}()<>|/\\=*&%$#@!~"}, 0, 0, FLAGS },
    { "blacklist", "set character blacklist", OFFSET(blacklist), AV_OPT_TYPE_STRING, {.str=""},    0, 0, FLAGS },
    { NULL }
};

static av_cold int init(AVFilterContext *ctx)
{
    OCRContext *s = ctx->priv;

    s->tess = TessBaseAPICreate();
    if (TessBaseAPIInit3(s->tess, s->datapath, s->language) == -1) {
        av_log(ctx, AV_LOG_ERROR, "failed to init tesseract\n");
        return AVERROR(EINVAL);
    }

    if (!TessBaseAPISetVariable(s->tess, "tessedit_char_whitelist", s->whitelist)) {
        av_log(ctx, AV_LOG_ERROR, "failed to set whitelist\n");
        return AVERROR(EINVAL);
    }

    if (!TessBaseAPISetVariable(s->tess, "tessedit_char_blacklist", s->blacklist)) {
        av_log(ctx, AV_LOG_ERROR, "failed to set blacklist\n");
        return AVERROR(EINVAL);
    }

    av_log(ctx, AV_LOG_DEBUG, "Tesseract version: %s\n", TessVersion());

    return 0;
}

static int query_formats(AVFilterContext *ctx)
{
    static const enum AVPixelFormat pix_fmts[] = {
        AV_PIX_FMT_GRAY8,
        AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,
        AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,
        AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P,
        AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,
        AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P,
        AV_PIX_FMT_YUVJ411P,
        AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA420P,
        AV_PIX_FMT_NONE
    };

    AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
    if (!fmts_list)
        return AVERROR(ENOMEM);
    return ff_set_common_formats(ctx, fmts_list);
}

static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{
    AVDictionary **metadata = &in->metadata;
    AVFilterContext *ctx = inlink->dst;
    AVFilterLink *outlink = ctx->outputs[0];
    OCRContext *s = ctx->priv;
    char *result;

    result = TessBaseAPIRect(s->tess, in->data[0], 1,
                             in->linesize[0], 0, 0, in->width, in->height);
    av_dict_set(metadata, "lavfi.ocr.text", result, 0);
    TessDeleteText(result);

    return ff_filter_frame(outlink, in);
}

static av_cold void uninit(AVFilterContext *ctx)
{
    OCRContext *s = ctx->priv;

    TessBaseAPIEnd(s->tess);
    TessBaseAPIDelete(s->tess);
}

AVFILTER_DEFINE_CLASS(ocr);

static const AVFilterPad ocr_inputs[] = {
    {
        .name         = "default",
        .type         = AVMEDIA_TYPE_VIDEO,
        .filter_frame = filter_frame,
    },
    { NULL }
};

static const AVFilterPad ocr_outputs[] = {
    {
        .name         = "default",
        .type         = AVMEDIA_TYPE_VIDEO,
    },
    { NULL }
};

AVFilter ff_vf_ocr = {
    .name          = "ocr",
    .description   = NULL_IF_CONFIG_SMALL("Optical Character Recognition."),
    .priv_size     = sizeof(OCRContext),
    .priv_class    = &ocr_class,
    .query_formats = query_formats,
    .init          = init,
    .uninit        = uninit,
    .inputs        = ocr_inputs,
    .outputs       = ocr_outputs,
};


text:
package com.example.android.adaptertransition;

import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.transition.AutoTransition;
import android.transition.Scene;
import android.transition.Transition;
import android.transition.TransitionManager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.FrameLayout;
import android.widget.GridView;
import android.widget.ListView;
import android.widget.Toast;

/**
 * Main screen for AdapterTransition sample.
 */
public class AdapterTransitionFragment extends Fragment implements Transition.TransitionListener {

    /**
     * Since the transition framework requires all relevant views in a view hierarchy to be marked
     * with IDs, we use this ID to mark the root view.
     */
    private static final int ROOT_ID = 1;

    /**
     * A tag for saving state whether the mAbsListView is ListView or GridView.
     */
    private static final String STATE_IS_LISTVIEW = "is_listview";

    /**
     * This is where we place our AdapterView (ListView / GridView).
     */
    private FrameLayout mContent;

    /**
     * This is where we carry out the transition.
     */
    private FrameLayout mCover;

    /**
     * This list shows our contents. It can be ListView or GridView, and we toggle between them
     * using the transition framework.
     */
    private AbsListView mAbsListView;

    /**
     * This is our contents.
     */
    private MeatAdapter mAdapter;

    public static AdapterTransitionFragment newInstance() {
        return new AdapterTransitionFragment();
    }

    public AdapterTransitionFragment() {
    }

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

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // If savedInstanceState is available, we restore the state whether the list is a ListView
        // or a GridView.
        boolean isListView;
        if (null == savedInstanceState) {
            isListView = true;
        } else {
            isListView = savedInstanceState.getBoolean(STATE_IS_LISTVIEW, true);
        }
        inflateAbsList(inflater, container, isListView);
        return inflater.inflate(R.layout.fragment_adapter_transition, container, false);
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putBoolean(STATE_IS_LISTVIEW, mAbsListView instanceof ListView);
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        // Retaining references for FrameLayouts that we use later.
        mContent = (FrameLayout) view.findViewById(R.id.content);
        mCover = (FrameLayout) view.findViewById(R.id.cover);
        // We are attaching the list to the screen here.
        mContent.addView(mAbsListView);
    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.fragment_adapter_transition, menu);
    }

    @Override
    public void onPrepareOptionsMenu(Menu menu) {
        // We change the look of the icon every time the user toggles between list and grid.
        MenuItem item = menu.findItem(R.id.action_toggle);
        if (null != item) {
            if (mAbsListView instanceof ListView) {
                item.setIcon(R.drawable.ic_action_grid);
                item.setTitle(R.string.show_as_grid);
            } else {
                item.setIcon(R.drawable.ic_action_list);
                item.setTitle(R.string.show_as_list);
            }
        }
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.action_toggle: {
                toggle();
                return true;
            }
        }
        return false;
    }

    @Override
    public void onTransitionStart(Transition transition) {
    }

    @Override
    public void onTransitionEnd(Transition transition) {
        // When the transition ends, we remove all the views from the overlay and hide it.
        mCover.removeAllViews();
        mCover.setVisibility(View.INVISIBLE);
    }

    @Override
    public void onTransitionCancel(Transition transition) {
    }

    @Override
    public void onTransitionPause(Transition transition) {
    }

    @Override
    public void onTransitionResume(Transition transition) {
    }

    /**
     * Inflate a ListView or a GridView with a corresponding ListAdapter.
     *
     * @param inflater The LayoutInflater.
     * @param container The ViewGroup that contains this AbsListView. The AbsListView won't be
     *                  attached to it.
     * @param inflateListView Pass true to inflate a ListView, or false to inflate a GridView.
     */
    private void inflateAbsList(LayoutInflater inflater, ViewGroup container,
                                boolean inflateListView) {
        if (inflateListView) {
            mAbsListView = (AbsListView) inflater.inflate(R.layout.fragment_meat_list,
                    container, false);
            mAdapter = new MeatAdapter(inflater, R.layout.item_meat_list);
        } else {
            mAbsListView = (AbsListView) inflater.inflate(R.layout.fragment_meat_grid,
                    container, false);
            mAdapter = new MeatAdapter(inflater, R.layout.item_meat_grid);
        }
        mAbsListView.setAdapter(mAdapter);
        mAbsListView.setOnItemClickListener(mAdapter);
    }

    /**
     * Toggle the UI between ListView and GridView.
     */
    private void toggle() {
        // We use mCover as the overlay on which we carry out the transition.
        mCover.setVisibility(View.VISIBLE);
        // This FrameLayout holds all the visible views in the current list or grid. We use this as
        // the starting Scene of the Transition later.
        FrameLayout before = copyVisibleViews();
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
                FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
        mCover.addView(before, params);
        // Swap the actual list.
        swapAbsListView();
        // We also swap the icon for the toggle button.
        ActivityCompat.invalidateOptionsMenu(getActivity());
        // It is now ready to start the transition.
        mAbsListView.post(new Runnable() {
            @Override
            public void run() {

                Scene scene = new Scene(mCover, copyVisibleViews());
                Transition transition = new AutoTransition();
                transition.addListener(AdapterTransitionFragment.this);
                TransitionManager.go(scene, transition);

            }
        });
    }

    /**
     * Swap ListView with GridView, or GridView with ListView.
     */
    private void swapAbsListView() {
        // We save the current scrolling position before removing the current list.
        int first = mAbsListView.getFirstVisiblePosition();
        // If the current list is a GridView, we replace it with a ListView. If it is a ListView,
        // a GridView.
        LayoutInflater inflater = LayoutInflater.from(getActivity());
        inflateAbsList(inflater, (ViewGroup) mAbsListView.getParent(),
                mAbsListView instanceof GridView);
        mAbsListView.setAdapter(mAdapter);
        // We restore the scrolling position here.
        mAbsListView.setSelection(first);
        // The new list is ready, and we replace the existing one with it.
        mContent.removeAllViews();
        mContent.addView(mAbsListView);
    }

    /**
     * Copy all the visible views in the mAbsListView into a new FrameLayout and return it.
     *
     * @return a FrameLayout with all the visible views inside.
     */
    private FrameLayout copyVisibleViews() {
        // This is the FrameLayout we return afterwards.
        FrameLayout layout = new FrameLayout(getActivity());
        // The transition framework requires to set ID for all views to be animated.
        layout.setId(ROOT_ID);
        // We only copy visible views.
        int first = mAbsListView.getFirstVisiblePosition();
        int index = 0;
        while (true) {
            // This is one of the views that we copy. Note that the argument for getChildAt is a
            // zero-oriented index, and it doesn't usually match with its position in the list.
            View source = mAbsListView.getChildAt(index);
            if (null == source) {
                break;
            }
            // This is the copy of the original view.
            View destination = mAdapter.getView(first + index, null, layout);
            assert destination != null;
            destination.setId(ROOT_ID + first + index);
            FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
                    source.getWidth(), source.getHeight());
            params.leftMargin = (int) source.getX();
            params.topMargin = (int) source.getY();
            layout.addView(destination, params);
            ++index;
        }
        return layout;
    }

}


text:
<resources>
    <string name="app_name">WearMenu</string>
</resources>


text:
using JSON::HELPER::code_point_to_utf8;

class CodePoint2Utf8Test : public CPPUNIT_NS::TestFixture
{
	CPPUNIT_TEST_SUITE(CodePoint2Utf8Test);

    CPPUNIT_TEST(test_conversion);

	CPPUNIT_TEST_SUITE_END();

    void test_conversion()
    {
        std::wstring_convert<std::codecvt_utf8<char16_t>, char16_t> std_multi_byte_converter;

        for (char16_t code_point { 0x0000 }; code_point <= 0xD7FF; ++code_point) {
            CPPUNIT_ASSERT_EQUAL(
                    std_multi_byte_converter.to_bytes(code_point), code_point_to_utf8(code_point));
        }

        // skipping surrogates

        for (char16_t code_point { 0xE000 }; code_point <= 0xFFFFu; ++code_point) {
            CPPUNIT_ASSERT_EQUAL(
                    std_multi_byte_converter.to_bytes(code_point), code_point_to_utf8(code_point));
            if (code_point == 0xFFFF) break;
        }
    }

};

CPPUNIT_TEST_SUITE_REGISTRATION(CodePoint2Utf8Test);


text:
sap.ui.define(['sap/m/Text', 'sap/ui/core/mvc/View'],
	function(Text, View) {
	"use strict";

	return View.extend("testdata.customizing.customer.TypedCustomSubSubView", {
		createContent : function(oController) {
			return [
				new Text({text: "I am the customer replacement"}),
				sap.ui.extensionpoint(this, "extension44Typed")
			];
		}
	});
});


text:
<?php

namespace Census\Form;

use Zend\Form\Form;
use Zend\Form\Element\Submit;
use Zend\Form\Element\Select;
use Zend\Form\Element\Date;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\Form\Element\Hidden;

class Restricaomedica extends Form
{
	public function __construct(ServiceLocatorInterface $sm)
	{
		parent::__construct('formRestricaomedica');;

		$em = $sm->get('Doctrine\ORM\EntityManager');
		$arrRestricoes = array();

		$repoRestricoes = $em->getRepository('Census\Entity\Restricaotipo');
		$arrRestricoes += $repoRestricoes->fetchPairs();

		// polcodigo
		$polcodigo = new Hidden('polcodigo');
		$polcodigo->setLabel('Policial')
		->setAttributes(array(
				'id' => 'polcodigo',
				'class' => 'form-control',
		));
		$this->add($polcodigo);

		// inicio
		$inicio = new Date('inicio');
		$inicio->setLabel('Data Início')
		->setAttributes(array(
				'id' => 'inicio',
				'class' => 'form-control',
		));
		$this->add($inicio);

		// fim
		$fim = new Date('fim');
		$fim->setLabel('Data Fim')
			->setAttributes(array(
				'id' => 'fim',
				'class' => 'form-control',
		));
		$this->add($fim);

		// tipos (tabela restricao tipo)
		$retcodigo = new Select('retcodigo');
		$retcodigo->setLabel('Tipo')
			->setAttributes(array(
				'id' => 'retcodigo',
				'multiple' => true,
				'class' => 'form-control'))
			->setValueOptions($arrRestricoes);
		$this->add($retcodigo);

		//submit
		$submit = new Submit('submit');
		$submit->setAttributes(array(
				'id' => 'submit',
				'value' => 'Enviar',
				'type' => 'button',
				'class' => 'btn btn-default'
		));
		$this->add($submit);
	}
}


text:
package com.github.secondbase.webconsole;

import com.github.secondbase.flags.Flag;

/**
 * Configuration parameters for the WebConsole.
 */
public final class WebConsoleConfiguration {

    private WebConsoleConfiguration() {
    }

    @Flag(
            name = "webconsole-port",
            description = "The port used by the webconsole (default 0 will select an available "
                    + "port between X and Y)")
    public static int port = 5060;

    @Flag(
            name = "webconsole-shutdown-delay",
            description = "Time, in seconds, from requesting shutdown on the webconsole until "
            + "the server stops forcefully")
    public static int stopTimeout = 0;
}


text:
import sys
import os
import psycopg2
from datetime import datetime, date, time, timedelta
import configparser
import time
from sklearn.cross_validation import train_test_split
import pickle
import pandas as pd
import numpy as np
import tensorflow as tf
import data_helpers as dh
from datetime import datetime, date, time, timedelta

Config = configparser.ConfigParser()
Config.read('./conf/blackops.ini')
DATA_DIR="../data"
PRED_DIR = "../data/pred_dl"

'''
get pids for training date
get x_train for training date

get y_train for training date

get x_test for testing date
get y_test for testing date

'''

def getTestingData(curDate):
    pidList = dh.getPids(curDate)
    labels = dh.getLabel(curDate)
    x_train = [dh.transform_v3(pid, 200) for pid in pidList]
    y_train = np.array([dh.isReturn(labels,pid) for pid in pidList])

    features = np.zeros((len(x_train), 200), dtype=int)
    for i, row in enumerate(x_train):
        features[i, -len(row):] = np.array(row)

    return features, y_train, pidList

def get_batches(x, y,pids, batch_size=100):

    n_batches = len(x)//batch_size
    x, y = x[:n_batches*batch_size], y[:n_batches*batch_size]
    for ii in range(0, len(x), batch_size):
        yield x[ii:ii+batch_size], y[ii:ii+batch_size], pids[ii:ii+batch_size]

def testLSTM(lstm_size = 1024, lstm_layers = 4, batch_size = 256, learning_rate = 0.001):
    # Create the graph object
    graph = tf.Graph()
    #Add nodes to the graph
    with graph.as_default():
        inputs_ = tf.placeholder(tf.int32, [None, None], name='inputs')
        labels_ = tf.placeholder(tf.int32, [None, None], name='labels')
        keep_prob = tf.placeholder(tf.float32, name='keep_prob')

        embedding = tf.Variable(tf.random_uniform((8, 10), -1, 1))
        embed = tf.nn.embedding_lookup(embedding, inputs_)

        lstm = tf.contrib.rnn.BasicLSTMCell(lstm_size)

        # Add dropout to the cell
        drop = tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob)

        # Stack up multiple LSTM layers, for deep learning
        cell = tf.contrib.rnn.MultiRNNCell([drop] * lstm_layers)

        # Getting an initial state of all zeros
        initial_state = cell.zero_state(batch_size, tf.float32)

        outputs, final_state = tf.nn.dynamic_rnn(cell, embed,
                                                 initial_state=initial_state)
        predictions = tf.contrib.layers.fully_connected(outputs[:, -1], 1, activation_fn=tf.sigmoid)
        cost = tf.losses.mean_squared_error(labels_, predictions)

        optimizer = tf.train.AdamOptimizer(learning_rate).minimize(cost)

        correct_pred = tf.equal(tf.cast(tf.round(predictions), tf.int32), labels_)
        accuracy = tf.reduce_mean(tf.cast(correct_pred, tf.float32))
        saver = tf.train.Saver()

    x_test, y_test = getTestingData(date(2017, 8, 6))

    test_acc = []
    allPids = []
    all_pred = []
    with tf.Session(graph=graph) as sess:
        saver.restore(sess, tf.train.latest_checkpoint('checkpoints'))
        test_state = sess.run(cell.zero_state(batch_size, tf.float32))
        for ii, (x, y, pids) in enumerate(get_batches(x_test, y_test, batch_size), 1):
            feed = {inputs_: x,
                    labels_: y[:, None],
                    keep_prob: 1,
                    initial_state: test_state}
            batch_acc, test_state, y_pred = sess.run([accuracy, final_state, predictions], feed_dict=feed)
            allPids.extend(pids)
            all_pred.extend(y_pred)
            test_acc.append(batch_acc)
        print("Test accuracy: {:.3f}".format(np.mean(test_acc)))
    return allPids, all_pred

def main():
    dh.collectGameActionDataS3(tmp_ga = "/home/ubuntu/tmp_ga/", ga = "/home/ubuntu/honest-blackops/data/ga/", dPath = "/home/ubuntu/honest-blackops/data")

    # runs cron for yesterday
    yest = date(2017, 10, 9)
    #yest = datetime.now().date() - timedelta(days = 1)
    x_test, y_test, pids  = getTestingData(yest)
    print("Got dataset for : ", str(yest))
    X_train,X_test,y_train,y_test, pids = splitTrainTestData(df, 0)
    print(len(X_train), len(X_test) , len(y_train) ,len(y_test), len(pids))
    doPrediction(pids, X_train, yest)
    testLSTM()
if __name__ == "__main__":
    main()