text:
srcdir = .

# Where to install the programs and man pages.
prefix = /usr/local
exec_prefix = ${prefix}
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
includedir = $(prefix)/include
binprefix =
manprefix =
manext = 1
mandir = $(prefix)/man/man$(manext)

# The name of your C compiler:
CC= /usr/share/clang/scan-build/ccc-analyzer

# You may need to adjust these cc options:
CFLAGS= -O2  -I$(srcdir)
# Generally, we recommend defining any configuration symbols in jconfig.h,
# NOT via -D switches here.
# However, any special defines for ansi2knr.c may be included here:
ANSI2KNRFLAGS=

# Link-time cc options:
LDFLAGS=

# To link any special libraries, add the necessary -l commands here.
LDLIBS=

# If using GNU libtool, LIBTOOL references it; if not, LIBTOOL is empty.
LIBTOOL =
# $(O) expands to "lo" if using libtool, plain "o" if not.
# Similarly, $(A) expands to "la" or "a".
O = o
A = a

# Library version ID; libtool uses this for the shared library version number.
# Note: we suggest this match the macro of the same name in jpeglib.h.
JPEG_LIB_VERSION = 62

# Put here the object file name for the correct system-dependent memory
# manager file.  For Unix this is usually jmemnobs.o, but you may want
# to use jmemansi.o or jmemname.o if you have limited swap space.
SYSDEPMEM= jmemnobs.$(O)

# miscellaneous OS-dependent stuff
SHELL= /bin/sh
# linker
LN= $(CC)
# file deletion command
RM= rm -f
# directory creation command
MKDIR= mkdir
# library (.a) file creation command
AR= ar rc
# second step in .a creation (use "touch" if not needed)
AR2= ranlib
# installation program
INSTALL= /usr/bin/install -c
INSTALL_PROGRAM= ${INSTALL}
INSTALL_LIB= ${INSTALL} -m 644
INSTALL_DATA= ${INSTALL} -m 644

# End of configurable options.

# source files: JPEG library proper
LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
        jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
        jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
        jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
        jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
        jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
        jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \
        jquant2.c jutils.c jmemmgr.c
# memmgr back ends: compile only one of these into a working library
SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c \
        rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \
        rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
# files included by source files
INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
        jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h
# documentation, test, and support files
DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \
        wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \
        coderules.doc filelist.doc change.log
MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \
        makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \
        makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \
        maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \
        makvms.opt
CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \
        jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \
        jconfig.vms
CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh
OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \
        testimgp.jpg
DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) \
        $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
# library object files common to compression and decompression
COMOBJECTS= jcomapi.$(O) jutils.$(O) jerror.$(O) jmemmgr.$(O) $(SYSDEPMEM)
# compression library object files
CLIBOBJECTS= jcapimin.$(O) jcapistd.$(O) jctrans.$(O) jcparam.$(O) \
        jdatadst.$(O) jcinit.$(O) jcmaster.$(O) jcmarker.$(O) jcmainct.$(O) \
        jcprepct.$(O) jccoefct.$(O) jccolor.$(O) jcsample.$(O) jchuff.$(O) \
        jcphuff.$(O) jcdctmgr.$(O) jfdctfst.$(O) jfdctflt.$(O) \
        jfdctint.$(O)
# decompression library object files
DLIBOBJECTS= jdapimin.$(O) jdapistd.$(O) jdtrans.$(O) jdatasrc.$(O) \
        jdmaster.$(O) jdinput.$(O) jdmarker.$(O) jdhuff.$(O) jdphuff.$(O) \
        jdmainct.$(O) jdcoefct.$(O) jdpostct.$(O) jddctmgr.$(O) \
        jidctfst.$(O) jidctflt.$(O) jidctint.$(O) jidctred.$(O) \
        jdsample.$(O) jdcolor.$(O) jquant1.$(O) jquant2.$(O) jdmerge.$(O)
# These objectfiles are included in libjpeg.a
LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
# object files for sample applications (excluding library files)
COBJECTS= cjpeg.$(O) rdppm.$(O) rdgif.$(O) rdtarga.$(O) rdrle.$(O) \
        rdbmp.$(O) rdswitch.$(O) cdjpeg.$(O)
DOBJECTS= djpeg.$(O) wrppm.$(O) wrgif.$(O) wrtarga.$(O) wrrle.$(O) \
        wrbmp.$(O) rdcolmap.$(O) cdjpeg.$(O)
TROBJECTS= jpegtran.$(O) rdswitch.$(O) cdjpeg.$(O) transupp.$(O)

all:  libjpeg.$(A) cjpeg djpeg jpegtran rdjpgcom wrjpgcom

# Special compilation rules to support ansi2knr and libtool.
.SUFFIXES: .lo .la

# How to compile with libtool.
# .c.lo:
# 	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$*.c

# How to use ansi2knr, when not using libtool.
# .c.o:
# 	./ansi2knr $(srcdir)/$*.c knr/$*.c
# 	$(CC) $(CFLAGS) -c knr/$*.c
# 	$(RM) knr/$*.c

# How to use ansi2knr AND libtool.
# .c.lo:
# 	./ansi2knr $(srcdir)/$*.c knr/$*.c
# 	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c knr/$*.c
# 	$(RM) knr/$*.c

ansi2knr: ansi2knr.c
	$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr $(srcdir)/ansi2knr.c
	$(MKDIR) knr

# the library:

# without libtool:
libjpeg.a:  $(LIBOBJECTS)
	$(RM) libjpeg.a
	$(AR) libjpeg.a  $(LIBOBJECTS)
	$(AR2) libjpeg.a

# with libtool:
libjpeg.la:  $(LIBOBJECTS)
	$(LIBTOOL) --mode=link $(CC) -o libjpeg.la $(LIBOBJECTS) \
		-rpath $(libdir) -version-info $(JPEG_LIB_VERSION)

# sample programs:

cjpeg: $(COBJECTS) libjpeg.$(A)
	$(LN) $(LDFLAGS) -o cjpeg $(COBJECTS) libjpeg.$(A) $(LDLIBS)

djpeg: $(DOBJECTS) libjpeg.$(A)
	$(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) libjpeg.$(A) $(LDLIBS)

jpegtran: $(TROBJECTS) libjpeg.$(A)
	$(LN) $(LDFLAGS) -o jpegtran $(TROBJECTS) libjpeg.$(A) $(LDLIBS)

rdjpgcom: rdjpgcom.$(O)
	$(LN) $(LDFLAGS) -o rdjpgcom rdjpgcom.$(O) $(LDLIBS)

wrjpgcom: wrjpgcom.$(O)
	$(LN) $(LDFLAGS) -o wrjpgcom wrjpgcom.$(O) $(LDLIBS)

# Installation rules:

install: cjpeg djpeg jpegtran rdjpgcom wrjpgcom
	$(INSTALL_PROGRAM) cjpeg $(bindir)/$(binprefix)cjpeg
	$(INSTALL_PROGRAM) djpeg $(bindir)/$(binprefix)djpeg
	$(INSTALL_PROGRAM) jpegtran $(bindir)/$(binprefix)jpegtran
	$(INSTALL_PROGRAM) rdjpgcom $(bindir)/$(binprefix)rdjpgcom
	$(INSTALL_PROGRAM) wrjpgcom $(bindir)/$(binprefix)wrjpgcom
	$(INSTALL_DATA) $(srcdir)/cjpeg.1 $(mandir)/$(manprefix)cjpeg.$(manext)
	$(INSTALL_DATA) $(srcdir)/djpeg.1 $(mandir)/$(manprefix)djpeg.$(manext)
	$(INSTALL_DATA) $(srcdir)/jpegtran.1 $(mandir)/$(manprefix)jpegtran.$(manext)
	$(INSTALL_DATA) $(srcdir)/rdjpgcom.1 $(mandir)/$(manprefix)rdjpgcom.$(manext)
	$(INSTALL_DATA) $(srcdir)/wrjpgcom.1 $(mandir)/$(manprefix)wrjpgcom.$(manext)

install-lib: libjpeg.$(A) install-headers
	$(INSTALL_LIB) libjpeg.$(A) $(libdir)/$(binprefix)libjpeg.$(A)

install-headers: jconfig.h
	$(INSTALL_DATA) jconfig.h $(includedir)/jconfig.h
	$(INSTALL_DATA) $(srcdir)/jpeglib.h $(includedir)/jpeglib.h
	$(INSTALL_DATA) $(srcdir)/jmorecfg.h $(includedir)/jmorecfg.h
	$(INSTALL_DATA) $(srcdir)/jerror.h $(includedir)/jerror.h

clean:
	$(RM) *.o *.lo libjpeg.a libjpeg.la
	$(RM) cjpeg djpeg jpegtran rdjpgcom wrjpgcom
	$(RM) ansi2knr core testout* config.log config.status
	$(RM) -r knr .libs _libs

distclean: clean
	$(RM) Makefile jconfig.h libtool config.cache

test: cjpeg djpeg jpegtran
	$(RM) testout*
	./djpeg -dct int -ppm -outfile testout.ppm  $(srcdir)/testorig.jpg
	./djpeg -dct int -bmp -colors 256 -outfile testout.bmp  $(srcdir)/testorig.jpg
	./cjpeg -dct int -outfile testout.jpg  $(srcdir)/testimg.ppm
	./djpeg -dct int -ppm -outfile testoutp.ppm $(srcdir)/testprog.jpg
	./cjpeg -dct int -progressive -opt -outfile testoutp.jpg $(srcdir)/testimg.ppm
	./jpegtran -outfile testoutt.jpg $(srcdir)/testprog.jpg
	cmp $(srcdir)/testimg.ppm testout.ppm
	cmp $(srcdir)/testimg.bmp testout.bmp
	cmp $(srcdir)/testimg.jpg testout.jpg
	cmp $(srcdir)/testimg.ppm testoutp.ppm
	cmp $(srcdir)/testimgp.jpg testoutp.jpg
	cmp $(srcdir)/testorig.jpg testoutt.jpg

check: test

# Mistake catcher:

jconfig.h: jconfig.doc
	echo You must prepare a system-dependent jconfig.h file.
	echo Please read the installation directions in install.doc.
	exit 1

# GNU Make likes to know which target names are not really files to be made:
.PHONY: all install install-lib install-headers clean distclean test check

jcapimin.$(O): jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcapistd.$(O): jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jccoefct.$(O): jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jccolor.$(O): jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcdctmgr.$(O): jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jchuff.$(O): jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
jcinit.$(O): jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcmainct.$(O): jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcmarker.$(O): jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcmaster.$(O): jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcomapi.$(O): jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcparam.$(O): jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcphuff.$(O): jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
jcprepct.$(O): jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jcsample.$(O): jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jctrans.$(O): jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdapimin.$(O): jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdapistd.$(O): jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdatadst.$(O): jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
jdatasrc.$(O): jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
jdcoefct.$(O): jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdcolor.$(O): jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jddctmgr.$(O): jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jdhuff.$(O): jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
jdinput.$(O): jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmainct.$(O): jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmarker.$(O): jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmaster.$(O): jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdmerge.$(O): jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdphuff.$(O): jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
jdpostct.$(O): jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdsample.$(O): jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jdtrans.$(O): jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jerror.$(O): jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
jfdctflt.$(O): jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jfdctfst.$(O): jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jfdctint.$(O): jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jidctflt.$(O): jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jidctfst.$(O): jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jidctint.$(O): jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jidctred.$(O): jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
jquant1.$(O): jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jquant2.$(O): jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jutils.$(O): jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
jmemmgr.$(O): jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemansi.$(O): jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemname.$(O): jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemnobs.$(O): jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemdos.$(O): jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
jmemmac.$(O): jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
cjpeg.$(O): cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
djpeg.$(O): djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
jpegtran.$(O): jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
rdjpgcom.$(O): rdjpgcom.c jinclude.h jconfig.h
wrjpgcom.$(O): wrjpgcom.c jinclude.h jconfig.h
cdjpeg.$(O): cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdcolmap.$(O): rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdswitch.$(O): rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
transupp.$(O): transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
rdppm.$(O): rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrppm.$(O): wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdgif.$(O): rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrgif.$(O): wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdtarga.$(O): rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrtarga.$(O): wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdbmp.$(O): rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrbmp.$(O): wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
rdrle.$(O): rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
wrrle.$(O): wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h


text:
package org.gradle.api.internal.plugins;

import org.gradle.api.Nullable;
import org.gradle.plugin.internal.PluginId;

public interface PluginImplementation<T> extends PotentialPlugin<T> {
    String getDisplayName();

    /**
     * An id for the plugin implementation, if known.
     */
    @Nullable
    PluginId getPluginId();

    boolean isAlsoKnownAs(PluginId id);
}

redpajama_set_name: RedPajamaGithub


text:
package test.simple;

import com.takin.rpc.server.RPCServer;

public class ServerTest {

    public static void main(String[] args) {
        try {
            RPCServer server = new RPCServer();
            server.init(new String[] {}, false);
            server.start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}


text:
package pl.nort.dayoneevernote.push;

import pl.nort.dayoneevernote.note.Note;

/**
 * Provides standard implementation to some of the {@link pl.nort.dayoneevernote.push.Pusher} methods
 *
 * @author Norbert Potocki
 */
public abstract class AbstractPusher implements Pusher {

    @Override
    public boolean push(Iterable<Note> notes) {

        for(Note note : notes) {
            if(!push(note)) {
                return false;
            }
        }

        return true;
    }

    /**
     * Push a note
     */
    public abstract boolean push(Note note);
}


text:
<?php

namespace SlothsTest\Http;

use SlothsTest\TestCase;
use Sloths\Http\Headers;

class HeadersTest extends TestCase
{
    public function test()
    {
        $raw = [
            'foo' => 'foo',
            'foo-bar' => 'foo-bar',
        ];

        $headers = new Headers($raw);
        $this->assertSame(['Foo' => 'foo', 'Foo-Bar' => 'foo-bar'], $headers->toArray());

        $this->assertTrue($headers->has('foo'));
        $this->assertTrue($headers->has('Foo'));
        $this->assertFalse($headers->has('bar'));

        $this->assertSame('foo', $headers->get('Foo'));

        $headers->remove('Foo');
        $this->assertFalse($headers->has('foo'));

        $this->assertSame('Foo-Bar: foo-bar', $headers->getLine('foo-bar'));
        $this->assertSame(['Foo-Bar: foo-bar'], $headers->getLines());
        $this->assertSame('Foo-Bar: foo-bar', $headers->toString());

        $this->assertNull($headers->getLine('non-existing'));
    }
}


text:
FOUNDATION_EXPORT double Pods_HPTest_ExampleVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_HPTest_ExampleVersionString[];


text:
import { ProcessInstanceGroup } from './process-instance-group';

export class CollaborationGroup {
    constructor(public id: string = "",
        public status: string,
        public name: string = "",
        public archived: boolean = false,
        public isArchiveable: boolean = false,
        public associatedProcessInstanceGroups: ProcessInstanceGroup[],
        public federationId: string = null) {
    }
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template type="basic" name="CpH1N15amideINIT" author="Agilent" investigator=""
        time_created="20111219T120000" tabname="BioSolidsPack" menu1="Commands" menu2="Init Probe File" apptype="solidsseq1d"
        application="BioSolids" scans="CpH1N15amideINIT" seqfil="ahX">
  <protocol title="CpH1N15amideINIT" type="protocol">
    <action  type="CMD" status="Ready" lock="off" title="CpH1N15amideINIT" exp="CpH1N15amideINIT"
        time="1:45" macro="CpH1N15amideINIT" data="" />
  </protocol>
</template>


text:
describe('pixi/display/DisplayObjectContainer', function () {
    'use strict';

    var expect = chai.expect;
    var DisplayObjectContainer = PIXI.DisplayObjectContainer;

    it('Module exists', function () {
        expect(DisplayObjectContainer).to.be.a('function');
    });

    it('Confirm new instance', function () {
        var obj = new DisplayObjectContainer();

        pixi_display_DisplayObjectContainer_confirmNew(obj);
        expect(obj).to.have.property('hitArea', null);
        expect(obj).to.have.property('interactive', false);
        expect(obj).to.have.property('renderable', false);
        expect(obj).to.have.property('stage', null);
    });
});


text:
@implementation GalleryModel

@end


text:
@deprecate path(t::Trie, str::AbstractString) partial_path(t::Trie, str::AbstractString)
@deprecate find_root find_root!
@deprecate top first
@deprecate reverse_iter Iterators.reverse
# Deprecations from #700
Base.@deprecate_binding DisjointSets DisjointSet
Base.@deprecate_binding IntDisjointSets IntDisjointSet
@deprecate DisjointSets(xs...) DisjointSet(xs)
# Enqueue and dequeue deprecations
@deprecate enqueue!(q::Queue, x) Base.push!(q, x)
@deprecate enqueue!(q::PriorityQueue, x) Base.push!(q, x)
@deprecate enqueue!(q::PriorityQueue, k, v) Base.push!(q, k=>v)
@deprecate dequeue!(q::Queue) Base.popfirst!(q)
@deprecate dequeue!(q::PriorityQueue) Base.popfirst!(q).first # maybe better: `val, _ = popfirst!(pq)`
@deprecate dequeue!(q::PriorityQueue, x) popat!(q, x).first
@deprecate dequeue_pair!(q::PriorityQueue) Base.popfirst!(q)
@deprecate dequeue_pair!(q::PriorityQueue, key) popat!(q, key)

@deprecate startof(m::SortedContainer) firstindex(m::SortedContainer)
@deprecate endof(m::SortedContainer) lastindex(m::SortedContainer)
@deprecate insert!(m::SortedSet, k) push_return_semitoken!(m::SortedSet, k)
@deprecate insert!(m::SortedDict, k, d) push_return_semitoken!(m::SortedDict, k=>d)
@deprecate insert!(m::SortedMultiDict, k, d) (push_return_semitoken!(m::SortedMultiDict, k=>d))[2]

function Base.peek(q::PriorityQueue)
    Expr(:meta, :noinline)
    Base.depwarn("`peek(q::PriorityQueue)` is deprecated, use `first(q)` instead.", :peek)
    first(q)
end


text:
(function() {
  'use strict';

  let encoder = new TextEncoder('utf-8');
  let decoder = new TextDecoder('utf-8');

  /* Custom Bluetooth Service UUIDs */

  const CANDLE_SERVICE_UUID = 0xFF02;

  /* Custom Bluetooth Characteristic UUIDs */

  const CANDLE_DEVICE_NAME_UUID = 0xFFFF;
  const CANDLE_COLOR_UUID = 0xFFFC;
  const CANDLE_EFFECT_UUID = 0xFFFB;
  const CANDLE_BLOW_NOTIFICATIONS_UUID = 0x2A37;

  class PlaybulbCandle {
    constructor() {
      this.device = null;
      this.server = null;
      this._characteristics = new Map();
      this._isEffectSet = false;
      this._debug = false;
    }
    request() {
      let options = {filters:[{services:[ CANDLE_SERVICE_UUID ]}],
                     optionalServices: ['battery_service']};
      return navigator.bluetooth.requestDevice(options)
      .then(device => {
        this.device = device;
      })
    }
    connect() {
      if (!this.device) {
        return Promise.reject('Device is not connected.');
      }
      return this.device.gatt.connect()
      .then(server => {
        this.server = server;
        return Promise.all([
          server.getPrimaryService(CANDLE_SERVICE_UUID).then(service => {
            return Promise.all([
              this._cacheCharacteristic(service, CANDLE_DEVICE_NAME_UUID),
              this._cacheCharacteristic(service, CANDLE_COLOR_UUID),
              this._cacheCharacteristic(service, CANDLE_EFFECT_UUID),
              this._cacheCharacteristic(service, CANDLE_BLOW_NOTIFICATIONS_UUID),
            ])
          }),
          server.getPrimaryService('battery_service').then(service => {
            return this._cacheCharacteristic(service, 'battery_level')
          }),
        ]);
      })
    }

    /* Candle Service */

    getDeviceName() {
      return this._readCharacteristicValue(CANDLE_DEVICE_NAME_UUID)
      .then(this._decodeString);
    }
    setDeviceName(name) {
      let data = this._encodeString(name);
      return this._writeCharacteristicValue(CANDLE_DEVICE_NAME_UUID, data)
    }
    setColor(r, g, b) {
      return Promise.resolve()
      .then(_ => {
        if (this._isEffectSet) {
          // Turn off Color Effect first.
          let data = [0x00, r, g, b, 0x05, 0x00, 0x01, 0x00];
          return this._writeCharacteristicValue(CANDLE_EFFECT_UUID, new Uint8Array(data))
        }
      })
      .then(_ => {
        let data = [0x00, r, g, b];
        return this._writeCharacteristicValue(CANDLE_COLOR_UUID, new Uint8Array(data))
      })
      .then(_ => [r,g,b]); // Returns color when fulfilled.
    }
    setCandleEffectColor(r, g, b) {
      let data = [0x00, r, g, b, 0x04, 0x00, 0x01, 0x00];
      return this._writeCharacteristicValue(CANDLE_EFFECT_UUID, new Uint8Array(data))
      .then(_ => {
        this._isEffectSet = true;
        return [r,g,b]; // Returns color when fulfilled.
      });
    }
    setFlashingColor(r, g, b) {
      let data = [0x00, r, g, b, 0x00, 0x00, 0x1F, 0x00];
      return this._writeCharacteristicValue(CANDLE_EFFECT_UUID, new Uint8Array(data))
      .then(_ => {
        this._isEffectSet = true;
        return [r,g,b]; // Returns color when fulfilled.
      });
    }
    setPulseColor(r, g, b) {
      // We have to correct user color to make it look nice for real...
      let newRed = Math.min(Math.round(r / 64) * 64, 255);
      let newGreen = Math.min(Math.round(g / 64) * 64, 255);
      let newBlue = Math.min(Math.round(b / 64) * 64, 255);
      let data = [0x00, newRed, newGreen, newBlue, 0x01, 0x00, 0x09, 0x00];
      return this._writeCharacteristicValue(CANDLE_EFFECT_UUID, new Uint8Array(data))
      .then(_ => {
        this._isEffectSet = true;
        return [r,g,b]; // Returns color when fulfilled.
      });
    }
    setRainbow() {
      let data = [0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00];
      return this._writeCharacteristicValue(CANDLE_EFFECT_UUID, new Uint8Array(data))
      .then(_ => {
        this._isEffectSet = true;
      });
    }
    setRainbowFade() {
      let data = [0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x26, 0x00];
      return this._writeCharacteristicValue(CANDLE_EFFECT_UUID, new Uint8Array(data))
      .then(_ => {
        this._isEffectSet = true;
      });
    }
    startBlowNotifications(listener) {
      let characteristic = this._characteristics.get(CANDLE_BLOW_NOTIFICATIONS_UUID);
      return characteristic.startNotifications()
      .then(_ => {
        characteristic.addEventListener('characteristicvaluechanged', listener);
      });
    }
    stopBlowNotifications(listener) {
      let characteristic = this._characteristics.get(CANDLE_BLOW_NOTIFICATIONS_UUID);
      return characteristic.stopNotifications()
      .then(_ => {
        characteristic.removeEventListener('characteristicvaluechanged', listener);
      });
    }

    /* Battery Service */

    getBatteryLevel() {
      return this._readCharacteristicValue('battery_level')
      .then(data => data.getUint8(0));
    }

    /* Utils */

    _cacheCharacteristic(service, characteristicUuid) {
      return service.getCharacteristic(characteristicUuid)
      .then(characteristic => {
        this._characteristics.set(characteristicUuid, characteristic);
      });
    }
    _readCharacteristicValue(characteristicUuid) {
      let characteristic = this._characteristics.get(characteristicUuid);
      return characteristic.readValue()
      .then(value => {
        if (this._debug) {
          for (var i = 0, a = []; i < value.byteLength; i++) { a.push(value.getUint8(i)); }
          console.debug('READ', characteristic.uuid, a);
        }
        return value;
      });
    }
    _writeCharacteristicValue(characteristicUuid, value) {
      let characteristic = this._characteristics.get(characteristicUuid);
      if (this._debug) {
        console.debug('WRITE', characteristic.uuid, value);
      }
      return characteristic.writeValue(value);
    }
    _decodeString(data) {
      return decoder.decode(data);
    }
    _encodeString(data) {
      return encoder.encode(data);
    }
  }

  window.playbulbCandle = new PlaybulbCandle();

})();


text:
#ifndef ALPHA_BOX2_HEADER
#define ALPHA_BOX2_HEADER

#include <cmath>

namespace nt {

/**
 * A 2-dimensional bounding box.
 */
template <typename Scalar>
class Box2
{
    Scalar _left;
    Scalar _right;
    Scalar _top;
    Scalar _bottom;

public:
    Box2(
        const Scalar& left,
        const Scalar& right,
        const Scalar& top,
        const Scalar& bottom) :
        _left(left),
        _right(right),
        _top(top),
        _bottom(bottom)
    {}

    Box2() :
        _left(),
        _right(),
        _top(),
        _bottom()
    {}

    const Scalar& left() const;
    const Scalar& right() const;
    const Scalar& top() const;
    const Scalar& bottom() const;

    const Scalar width() const;
    const Scalar height() const;

    void set(const Scalar& left, const Scalar& right, const Scalar& top, const Scalar& bottom);
    void setVertical(const Scalar& left, const Scalar& right);
    void setHorizontal(const Scalar& left, const Scalar& right);

    void setLeft(const Scalar& left);
    void setRight(const Scalar& right);
    void setTop(const Scalar& top);
    void setBottom(const Scalar& bottom);

    void clear();
};

template <typename Scalar>
const Scalar& Box2<Scalar>::left() const
{
    return _left;
}

template <typename Scalar>
const Scalar& Box2<Scalar>::right() const
{
    return _right;
}

template <typename Scalar>
const Scalar& Box2<Scalar>::top() const
{
    return _top;
}

template <typename Scalar>
const Scalar& Box2<Scalar>::bottom() const
{
    return _bottom;
}

template <typename Scalar>
const Scalar Box2<Scalar>::width() const
{
    return std::abs(right() - left());
}

template <typename Scalar>
const Scalar Box2<Scalar>::height() const
{
    return std::abs(bottom() - top());
}

template <typename Scalar>
void Box2<Scalar>::setVertical(const Scalar& top, const Scalar& bottom)
{
    setTop(top);
    setBottom(bottom);
}

template <typename Scalar>
void Box2<Scalar>::setHorizontal(const Scalar& left, const Scalar& right)
{
    setLeft(left);
    setRight(right);
}

template <typename Scalar>
void Box2<Scalar>::setLeft(const Scalar& left)
{
    _left = left;
}

template <typename Scalar>
void Box2<Scalar>::setRight(const Scalar& right)
{
    _right = right;
}

template <typename Scalar>
void Box2<Scalar>::setTop(const Scalar& top)
{
    _top = top;
};

template <typename Scalar>
void Box2<Scalar>::setBottom(const Scalar& bottom)
{
    _bottom = bottom;
};

template <typename Scalar>
void Box2<Scalar>::clear()
{
    set(0, 0, 0, 0);
}

} // namespace nt

#endif // ALPHA_BOX2_HEADER


text:
project_path: /web/_project.yaml
book_path: /web/fundamentals/_book.yaml
description: Uso de etiquetas ARIA para crear descripciones de elementos accesibles

{# wf_updated_on: 2016-10-04 #}
{# wf_published_on: 2016-10-04 #}

# Etiquetas y relaciones de ARIA {: .page-title }

{% include "web/_shared/contributors/megginkearney.html" %}
{% include "web/_shared/contributors/dgash.html" %}
{% include "web/_shared/contributors/aliceboxhall.html" %}

## Etiquetas

ARIA brinda varios mecanismos para agregarles etiquetas y descripciones a elementos.
De hecho, ARIA es la única forma de agregar ayuda accesible o texto descriptivo. Ahora
veamos las propiedades que usa ARIA para crear etiquetas accesibles.

### aria-label

`aria-label` nos permite especificar una string para usar como etiqueta accesible.
Esto anula cualquier otro mecanismo de etiquetado nativo, como un elemento `label`
— por ejemplo, si un `button` tiene contenido de texto y una `aria-label`,
solo se usará el valor de la `aria-label`.

Puedes usar un atributo de `aria-label` cuando tienes algún tipo de indicación
visual del objetivo de un elemento, como un botón que use un gráfico en lugar
de texto, pero igualmente necesitas aclarar el objetivo para quien no pueda acceder a la
indicación visual, como un botón que use solo una imagen para indicar su
propósito.

![uso de aria-label para identificar un botón solo de imagen](imgs/aria-label.jpg)

### aria-labelledby

`aria-labelledby` permite especificar la ID de otro elemento del DOM como
etiqueta de un elemento.

![uso de aria-labelledby para identificar un grupo de radio](imgs/aria-labelledby.jpg)

Es parecido a un elemento `label`, con algunas diferencias claves.

 1. `aria-labelledby` se puede usar en cualquier elemento, no solo en elementos etiquetables.
 1. A pesar de que un elemento `label` se refiere a aquello que etiqueta, la relación se
    invierte en el caso de `aria-labelledby` — lo que se
    etiqueta se refiere a aquello que lo etiqueta.
 1. Solo se puede asociar un elemento de etiqueta a un elemento etiquetable, pero
    `aria-labelledby` puede tomar una lista de IDREFs para componer una etiqueta de varios
    elementos. La etiqueta se concatenará en el orden que se les
    da a los IDREFs.
 1. Puedes usar `aria-labelledby` para referirte a elementos ocultos que
    de otra forma no estarían en el árbol de accesibilidad. Por ejemplo, podrías agregar un
    oculto `span` junto a un elemento que desees etiquetar, y referirte a eso con
    `aria-labelledby`.
 1. Sin embargo, ya que ARIA solo afecta al árbol de accesibilidad, `aria-labelledby`
    no te brinda el conocido comportamiento de hacer clic en la etiqueta que recibes usando un elemento
    `label`.

Es importante que `aria-labelledby` anula **todas** las otras fuentes de nombre de un
elemento. Entonces, por ejemplo, si un elemento tiene tanto `aria-labelledby` como
`aria-label`, o una `aria-labelledby` y una `label` nativa de HTML, la etiqueta
`aria-labelledby` siempre tiene prioridad.

## Relaciones

`aria-labelledby` es un ejemplo de un "atributo de relación". Un atributo
de relación crea una relación semántica entre los elementos de la página
sin importar su relación con el DOM. En el caso de la `aria-labelledby`, esa
relación es "este elemento etiquetado por ese elemento".

Las especificaciones de ARIA enumeran [ocho atributos
de relación](https://www.w3.org/TR/wai-aria/states_and_properties#attrs_relationships){: .external }.
Seis de estos, `aria-activedescendant`, `aria-controls`, `aria-describedby`,
`aria-labelledby` y `aria-owns`, hacen referencia a uno o más elementos para
crear un nuevo vínculo entre elementos de la página. La diferencia en cada caso es
lo que significa ese vínculo y como se les presenta a los usuarios.

### aria-owns

`aria-owns` es una de las relaciones de ARIA más usadas. Este atributo
nos permite decirle a la tecnología asistencial que un elemento separado del
DOM se debería tratar como un elemento secundario del actual, o que se reorganicen
los elementos secundarios existentes en otro orden. Por ejemplo, si un submenú
en ventana emergente está visualmente ubicado cerca de su menú principal, pero no puede ser un DOM secundario
de su principal porque afectaría a la presentación visual, puedes usar
`aria-owns` para presentar el submenú como secundario del menú principal para un lector de
pantalla.

![uso de aria-owns para establecer una relación entre un menú y un submenú](imgs/aria-owns.jpg)

### aria-activedescendant

`aria-activedescendant` tiene una función relacionada. Así como el elemento activo de una
página es el que tiene el foco, la configuración de un descendiente activo
nos permite decirle a la tecnología asistencial que debería presentarse al
usuario un elemento como elemento en foco cuando el elemento principal es el que tiene el foco. Por
ejemplo, en un cuadro de lista, tal vez desees dejar el foco de página en el contendor
de cuadro de lista y mantener su atributo `aria-activedescendant` actualizado al
elemento de lista actualmente seleccionado. Esto hace que el artículo actualmente seleccionado le aparezca a la
tecnología asistencial como si tuviese el foco.

![uso de aria-activedescendant para establecer una relación en un cuadro de lista](imgs/aria-activedescendant.jpg)

### aria-describedby

`aria-describedby` brinda una descripción accesible de la misma manera en que
`aria-labelledby` brinda una etiqueta. Como `aria-labelledby`, `aria-describedby`
puede hacer referencia a elementos que de otra forma no son visibles, ya sea que están ocultos del
DOM u ocultos de los usuarios de tecnología asistencial. Esta es una técnica útil cuando
hay texto explicativo adicional que un usuario puede necesitar, ya sea si se aplica
solo a usuarios de tecnología asistencial o a todos los usuarios.

Un ejemplo común es un campo de entrada de contraseña acompañado de
texto descriptivo que explica los requisitos mínimos de contraseña. A diferencia de una etiqueta,
esta descripción puede o no presentarse al usuario. Este puede tener la
opción de acceder o no a ella, o la descripción puede aparecer después de toda la otra información,
o puede estar anticipada por otra cosa. Por ejemplo, si el usuario está ingresando
información, se reproducirá su entrada y puede interrumpir la descripción
del elemento. Sin embargo, una descripción es una excelente manera de comunicar información complementaria,
pero no fundamental. No se interpondrá en el camino de la información
más crítica, como el rol del elemento.

![uso de aria-describedby par establecer una relación con un campo de contraseña](imgs/aria-describedby.jpg)

### aria-posinset y aria-setsize

Los atributos de relación restantes son algo diferentes y trabajan en conjunto.
`aria-posinset` ("posición en set") y `aria-setsize` ("tamaño de set") se tratan de
definir una relación entre elementos relacionados en un set, como una lista.

Cuando el tamaño de un set no se puede determinar sobre la base de los elementos presentes en el DOM
— como cuando se usa la representación vaga para evitar una gran lista
del DOM a la vez — `aria-setsize` puede especificar el tamaño real del set y
`aria-posinset` puede especificar la posición del elemento en el set. Por ejemplo, en un
set que puede contener 1000 elementos, se podría decir que un elemento en especial
tiene un `aria-posinset` de 857, a pesar de que aparezca primero en el DOM, y se pueden
usar técnicas de HTML dinámicas para garantizar que el usuario pueda explorar la lista completa a
voluntad.

![uso de aria-posinset y aria-setsize para establecer una relación en una lista](imgs/aria-posinset.jpg)

{# wf_devsite_translation #}


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

	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Slider - jQuery EasyUI Demo</title>
	<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../themes/icon.css">
	<link rel="stylesheet" type="text/css" href="demo.css">

Slider

Drag the slider to change the font size.

		<input id="ss" value="12" showTip="true" rule="[0,'|',25,'|',50,'|',75,'|',100]" style="width:300px">

jQuery EasyUI


text:
from google.appengine.ext import ndb
from utility import convertToUtfIfNeeded
import logging

class RideSearch(ndb.Model): #ndb.Model
    person_id = ndb.StringProperty()
    person_name_lastname = ndb.StringProperty()
    person_username = ndb.StringProperty()

    percorso = ndb.StringProperty() # mapping to percorso entry key (percorso.py)

    timestamp = ndb.DateTimeProperty()

    number_results_programmati = ndb.IntegerProperty()
    number_results_abituali = ndb.IntegerProperty()
    autisti_list_count = ndb.IntegerProperty()

    def getPersonName(self):
        return convertToUtfIfNeeded(self.person_name_lastname)

    def getPercorso(self):
        return convertToUtfIfNeeded(self.percorso)

    def getRouteEntry(self):
        from route import Route
        result = Route.get_by_id(self.percorso)
        if result is None:
            logging.warning('None route with percorso {} for ride_offer: {}'.format(self.percorso, self))
        return result

def addRideSearch(person, timestamp, percorso, number_results_programmati, number_results_abituali, autisti_list_count):
    import date_time_util as dtu
    s = RideSearch(
        person_id = person.getId(),
        timestamp = timestamp,
        person_name_lastname = person.getFirstNameLastName(),
        person_username=person.getUsername(),
        percorso=percorso,
        number_results_programmati = number_results_programmati,
        number_results_abituali = number_results_abituali,
        autisti_list_count = autisti_list_count
    )
    s.put()
    return s

def getRideSearchInsertedLastDaysQry(days):
    import date_time_util as dtu
    from datetime import timedelta
    return RideSearch.query(
        RideSearch.timestamp >= dtu.removeTimezone(dtu.nowCET()) - timedelta(days=days)
    )


text:
typedef struct trust_worker *trust_worker_pt;

celix_status_t trustWorker_create(bundle_context_pt context, trust_worker_pt *worker, trust_manager_pt *tm);
celix_status_t trustWorker_destroy(trust_worker_pt worker);


text:
<?xml version="1.0" encoding="UTF-8" ?>
<web-app
    xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.2">

<!-- This is a deployment description file for deploying on the Geronimo application server -->

    <environment>
        <moduleId>
            <groupId>se.media4u101</groupId>
            <artifactId>lift-advanced-md</artifactId>
            <version>2.1.0-SNAPSHOT</version>
        </moduleId>
        <dependencies>

        </dependencies>
        <import-package> !org.apache.commons.codec*</import-package>
    </environment>

   <context-root>/lift-advanced-md</context-root>

</web-app>


text:
General:
  title: Title
  description: Description
  metakeys: Keys
  template: post
  processor: markdown_extra
Taxonomy:
  Cat:
    Cat1:
      Subcat1:
        - Elem1Subcat1
  Tag:
    - Tag2
---
Header {#header}
======

*Lorem*
**Ipsum**


text:
package com.evolveum.midpoint.web.page.admin.certification.dto;

import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.query.*;
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.SelectorOptions;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.exception.CommunicationException;
import com.evolveum.midpoint.util.exception.ConfigurationException;
import com.evolveum.midpoint.util.exception.ExpressionEvaluationException;
import com.evolveum.midpoint.util.exception.ObjectNotFoundException;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.exception.SecurityViolationException;
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.data.BaseSortableDataProvider;
import com.evolveum.midpoint.web.page.error.PageError;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType;
import org.apache.wicket.Component;
import org.apache.wicket.RestartResponseException;
import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
import org.jetbrains.annotations.NotNull;

import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import static com.evolveum.midpoint.schema.GetOperationOptions.*;
import static com.evolveum.midpoint.schema.SelectorOptions.createCollection;

/**
 * @author lazyman
 * @author mederly
 */
public class CertCaseDtoProvider extends BaseSortableDataProvider<CertCaseOrWorkItemDto> {
    private static final long serialVersionUID = 1L;

    private static final Trace LOGGER = TraceManager.getTrace(CertCaseDtoProvider.class);
    private static final String DOT_CLASS = CertCaseDtoProvider.class.getName() + ".";
    private static final String OPERATION_SEARCH_OBJECTS = DOT_CLASS + "searchObjects";
    private static final String OPERATION_COUNT_OBJECTS = DOT_CLASS + "countObjects";

    private String campaignOid;
    // case query is stored in super.query

    public CertCaseDtoProvider(Component component) {
        super(component, false);        // TODO make this cacheable
    }

    @Override
    public Iterator<CertCaseOrWorkItemDto> internalIterator(long first, long count) {
        LOGGER.trace("begin::iterator() from {} count {}.", first, count);
        getAvailableData().clear();

        Task task = getPage().createSimpleTask(OPERATION_SEARCH_OBJECTS);
        OperationResult result = task.getResult();
        try {
            ObjectPaging paging = createPaging(first, count);
            Collection<SelectorOptions<GetOperationOptions>> resolveNames = createCollection(createResolveNames());
            List<AccessCertificationCaseType> caseList = searchCases(campaignOid, paging, resolveNames, getPage().getPrismContext(), task, result);
            for (AccessCertificationCaseType acase : caseList) {
                getAvailableData().add(new CertCaseDto(acase, getPage(), task, result));
            }
        } catch (Exception ex) {
            result.recordFatalError(getPage().createStringResource("CertCaseDtoProvider.message.internalIterator.fatalError").getString(), ex);
            LoggingUtils.logUnexpectedException(LOGGER, "Couldn't list decisions", ex);
        } finally {
            result.computeStatusIfUnknown();
        }

        if (!WebComponentUtil.isSuccessOrHandledError(result)) {
            handleNotSuccessOrHandledErrorInIterator(result);
        }

        LOGGER.trace("end::iterator()");
        return getAvailableData().iterator();
    }

    private void handleNotSuccessOrHandledErrorInIterator(OperationResult result){
        getPage().showResult(result);
        throw new RestartResponseException(PageError.class);
    }

    @Override
    protected int internalSize() {
        LOGGER.trace("begin::internalSize()");
        int count = 0;
        OperationResult result = new OperationResult(OPERATION_COUNT_OBJECTS);
        try {
            Task task = getPage().createSimpleTask(OPERATION_COUNT_OBJECTS);
            count = countCases(campaignOid, null, getPage().getPrismContext(), task, result);
        } catch (Exception ex) {
            result.recordFatalError(getPage().createStringResource("CertCaseDtoProvider.message.internalSize.fatalError").getString(), ex);
            LoggingUtils.logUnexpectedException(LOGGER, "Couldn't count objects", ex);
        } finally {
            result.computeStatusIfUnknown();
        }

        if (!WebComponentUtil.isSuccessOrHandledError(result)) {
            getPage().showResult(result, false);
            throw new RestartResponseException(PageError.class);
        }

        LOGGER.trace("end::internalSize()");
        return count;
    }

    @SuppressWarnings("unused")
    public String getCampaignOid() {
        return campaignOid;
    }

    public void setCampaignOid(String campaignOid) {
        this.campaignOid = campaignOid;
    }

    private List<AccessCertificationCaseType> searchCases(String campaignOid, ObjectPaging paging,
            Collection<SelectorOptions<GetOperationOptions>> options, PrismContext prismContext,
            Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException, CommunicationException {
        InOidFilter inOidFilter = prismContext.queryFactory().createOwnerHasOidIn(campaignOid);
        ObjectQuery query = createFinalQuery(inOidFilter, prismContext);
        query.setPaging(paging);
        return getModel().searchContainers(AccessCertificationCaseType.class, query, options, task, result);
    }

    private int countCases(String campaignOid, Collection<SelectorOptions<GetOperationOptions>> options,
            PrismContext prismContext, Task task, OperationResult result)
            throws SchemaException, ObjectNotFoundException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException, CommunicationException {
        InOidFilter inOidFilter = prismContext.queryFactory().createOwnerHasOidIn(campaignOid);
        ObjectQuery query = createFinalQuery(inOidFilter, prismContext);
        return getModel().countContainers(AccessCertificationCaseType.class, query, options, task, result);
    }

    @NotNull
    private ObjectQuery createFinalQuery(InOidFilter inOidFilter, PrismContext prismContext) {
        ObjectQuery query = getQuery();
        if (query != null) {
            query = query.clone();
            if (query.getFilter() == null) {
                query.setFilter(inOidFilter);
            } else {
                query.setFilter(prismContext.queryFactory().createAnd(query.getFilter(), inOidFilter));
            }
        } else {
            query = getPrismContext().queryFactory().createQuery(inOidFilter);
        }
        return query;
    }

    @NotNull
    @Override
    protected List<ObjectOrdering> createObjectOrderings(SortParam<String> sortParam) {
        return SearchingUtils.createObjectOrderings(sortParam, false, getPrismContext());
    }

}


text:
package com.infospace.sdk.models;

import java.util.Locale;

/**
 * The type of result group.
 */
public enum ResultGroupType {
	MAIN("MAIN"),
	RELATED("RELATED"),
	TOP("TOP"),
	LEFT("LEFT"),
	RIGHT("RIGHT"),
	BOTTOM("BOTTOM"),
	SITE("SITE"),
	HOROSCOPE("HOROSCOPE"),
	SPELLING("SPELLING"),
	STOCK("STOCK"),
	WEATHER("WEATHER"),

	WEBGROUP("WEBGROUP"),
	IMAGEGROUP("IMAGEGROUP"),
	VIDEOGROUP("VIDEOGROUP"),
	NEWSGROUP("NEWSGROUP"),
	SHOPPINGGROUP("SHOPPINGGROUP"),
	DEALGROUP("DEALGROUP"),
	OFFERGROUP("OFFERGROUP"),

	RELATEDGROUP("RELATEDGROUP"),
	REVIEWS("REVIEWS");

	private final String value;

	ResultGroupType(String value) {
		this.value = value.toUpperCase(Locale.US);
	}

	@Override
	public String toString() {
		return super.toString();
	}

	public static ResultGroupType fromString(String value) {
		for (ResultGroupType category : values()) {
			if (category.value.equalsIgnoreCase(value)) {
				return category;
			}
		}
		return getDefault();
	}

	public static ResultGroupType getDefault() {
		return MAIN;
	}
}


text:
layout: post
status: publish
published: true
title: Hiplock, l'antivol portable
author: mick
author_login: mick
author_email: mickael@flochlay.com
wordpress_id: 50
wordpress_url: http://morningcoffee.mickaelflochlay.com/?p=50
date: 2011-04-11 08:36:14.000000000 +02:00
categories:
- Uncategorized
tags:
- style
comments: []
---

> Cyclists can transport their locks in a variety of ways while they're riding,
> but most approaches involve inherent disadvantages for safety, flexibility or style.
> The Hiplok, on the other hand, is a brand-new alternative from UK-based Plus 8 Industries
> that can be simply worn around the waist when it's not being used.</blockquote>

Très bonne idée. Tarif prohibitif (70£, c'est presque le prix d'un vélo).

via [Bicycle lock can be safely worn around the waist - Springwise][1]

[1]: http://www.springwise.com/lifestyle_leisure/hiplok/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+springwise+%28Springwise%29


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>Index</title>
  <meta name="weex-viewport" content="750">
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-touch-fullscreen" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="format-detection" content="telephone=no, email=no">


text:
var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
    res.render('gallery');
});

module.exports = router;


text:
import { WebContents } from 'electron';
import { Event } from 'vs/base/common/event';
import { IProcessEnvironment } from 'vs/base/common/platform';
import { URI } from 'vs/base/common/uri';
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { ICodeWindow } from 'vs/platform/window/electron-main/window';
import { IOpenEmptyWindowOptions, IWindowOpenable } from 'vs/platform/window/common/window';

export const IWindowsMainService = createDecorator<IWindowsMainService>('windowsMainService');

export interface IWindowsMainService {

	readonly _serviceBrand: undefined;

	readonly onDidChangeWindowsCount: Event<IWindowsCountChangedEvent>;

	readonly onDidOpenWindow: Event<ICodeWindow>;
	readonly onDidSignalReadyWindow: Event<ICodeWindow>;
	readonly onDidTriggerSystemContextMenu: Event<{ window: ICodeWindow; x: number; y: number }>;
	readonly onDidDestroyWindow: Event<ICodeWindow>;

	open(openConfig: IOpenConfiguration): ICodeWindow[];
	openEmptyWindow(openConfig: IOpenEmptyConfiguration, options?: IOpenEmptyWindowOptions): ICodeWindow[];
	openExistingWindow(window: ICodeWindow, openConfig: IOpenConfiguration): void;
	openExtensionDevelopmentHostWindow(extensionDevelopmentPath: string[], openConfig: IOpenConfiguration): ICodeWindow[];

	sendToFocused(channel: string, ...args: any[]): void;
	sendToAll(channel: string, payload?: any, windowIdsToIgnore?: number[]): void;

	getWindows(): ICodeWindow[];
	getWindowCount(): number;

	getFocusedWindow(): ICodeWindow | undefined;
	getLastActiveWindow(): ICodeWindow | undefined;

	getWindowById(windowId: number): ICodeWindow | undefined;
	getWindowByWebContents(webContents: WebContents): ICodeWindow | undefined;
}

export interface IWindowsCountChangedEvent {
	readonly oldCount: number;
	readonly newCount: number;
}

export const enum OpenContext {

	// opening when running from the command line
	CLI,

	// macOS only: opening from the dock (also when opening files to a running instance from desktop)
	DOCK,

	// opening from the main application window
	MENU,

	// opening from a file or folder dialog
	DIALOG,

	// opening from the OS's UI
	DESKTOP,

	// opening through the API
	API
}

export interface IBaseOpenConfiguration {
	readonly context: OpenContext;
	readonly contextWindowId?: number;
}

export interface IOpenConfiguration extends IBaseOpenConfiguration {
	readonly cli: NativeParsedArgs;
	readonly userEnv?: IProcessEnvironment;
	readonly urisToOpen?: IWindowOpenable[];
	readonly waitMarkerFileURI?: URI;
	readonly preferNewWindow?: boolean;
	readonly forceNewWindow?: boolean;
	readonly forceNewTabbedWindow?: boolean;
	readonly forceReuseWindow?: boolean;
	readonly forceEmpty?: boolean;
	readonly diffMode?: boolean;
	readonly mergeMode?: boolean;
	addMode?: boolean;
	readonly gotoLineMode?: boolean;
	readonly initialStartup?: boolean;
	readonly noRecentEntry?: boolean;
	/**
	 * The remote authority to use when windows are opened with either
	 * - no workspace (empty window)
	 * - a workspace that is neither `file://` nor `vscode-remote://`
	 */
	readonly remoteAuthority?: string;
}

export interface IOpenEmptyConfiguration extends IBaseOpenConfiguration { }


text:
// ============================================================================
// Copyright (C) 2006-2018 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// https://github.com/Talend/data-prep/blob/master/LICENSE
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================

package org.talend.dataprep.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.AsyncListenableTaskExecutor;
import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * Return the async task execution configuration.
 */
@Configuration
@SuppressWarnings("InsufficientBranchCoverage")
public class TaskExecution {

    /**
     * @return an Authenticated task executor for event multi casting.
     * @see DataPrepEvents
     */
    @Bean(name = "applicationEventMulticaster#executor")
    public TaskExecutor dataPrepAsyncTaskExecutor() {
        final ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
        taskExecutor.setCorePoolSize(2);
        taskExecutor.setMaxPoolSize(10);
        taskExecutor.setWaitForTasksToCompleteOnShutdown(false);
        taskExecutor.initialize();
        return taskExecutor;
    }

    /**
     *

     * Important note Naming of the executor is very important, code relies on documentation naming conventions
     * for async task executor injection.
     *

     *
     * @return A {@link TaskExecutor} for non-blocking HTTP request execution.
     * @see Async
     * @see org.springframework.scheduling.annotation.EnableAsync
     */
    @Bean(name = Async.EXECUTOR)
    public TaskExecutor asyncTaskExecutor() {
        return new SimpleAsyncTaskExecutor();
    }

    /**
     * @return A {@link TaskExecutor} for non-blocking CSV serialization.
     * @see org.talend.dataprep.schema.csv.CSVSerializer
     */
    @Bean(name = "serializer#csv#executor")
    TaskExecutor getCsvTaskExecutor() {
        return getAsyncExecutor();
    }

    /**
     * @return A {@link TaskExecutor} for non-blocking HTML serialization.
     * @see org.talend.dataprep.schema.csv.CSVSerializer
     */
    @Bean(name = "serializer#html#executor")
    TaskExecutor getHtmlTaskExecutor() {
        return getAsyncExecutor();
    }

    /**
     * @return A {@link TaskExecutor} for non-blocking CSV serialization.
     * @see org.talend.dataprep.schema.xls.XlsSerializer
     */
    @Bean(name = "serializer#excel#executor")
    TaskExecutor getExcelTaskExecutor() {
        return getAsyncExecutor();
    }

    /**
     * @return A {@link TaskExecutor} for non-blocking JSON serialization.
     */
    @Bean(name = "serializer#json#executor")
    TaskExecutor getJsonTaskExecutor() {
        return getAsyncExecutor();
    }

    /**
     * @return A {@link TaskExecutor} for non-blocking dataset serialization.
     */
    @Bean(name = "serializer#dataset#executor")
    TaskExecutor getDatasetTaskExecutor() {
        return getAsyncExecutor();
    }

    /**
     * @return an Authenticated task executor ready to run.
     */
    protected AsyncListenableTaskExecutor getAsyncExecutor() {
        final ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(2);
        executor.setMaxPoolSize(10);
        executor.setWaitForTasksToCompleteOnShutdown(false);
        executor.initialize();
        return executor;
    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Eft.Core.ECS.Components
{
    public class SubComponentTestComponent : Component
    {

    }
}


text:
def total(array)
 a = 0
  for i in 0...array.length
   a = a + array[i]
  end
  return a
end

# 3. total refactored solution

def total(array)
  array.inject {|sum, a| sum + a }
end

# 4. sentence_maker pseudocode
# make sure all pseudocode is commented out!
# Input: An array of strings
# Output: An English sentence.

# Steps to solve the problem.

# Capatalize first element in string
# Combine everything as strings
# Add in spaces and period

# 5. sentence_maker initial solution

def sentence_maker(array)
 sentence = array[0].capitalize
  for w in 1...array.length
   sentence = sentence + " " + array[w].to_s
  end
  return sentence + "."
end

# 6. sentence_maker refactored solution

def sentence_maker(array)
  array.join(" ").capitalize + "."
end


text:
<?php

namespace GameBackend\Entity\SRO\Shard;

use Doctrine\ORM\Mapping as ORM;
use GameBackend\Entity\Game\InventoryInterface;

/**
 * Inventory
 *
 * @ORM\Table(name="_Inventory")
 * @ORM\Entity(repositoryClass="GameBackend\Entity\SRO\Shard\Repository\Inventory")
 */
class Inventory implements InventoryInterface
{
    /**
     * @var Character
     *
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="Character", inversedBy="inventory")
     * @ORM\JoinColumn(name="CharID", referencedColumnName="CharID")
     **/
    private $char;

    /**
     * @var integer
     *
     * @ORM\Id
     * @ORM\Column(name="Slot", type="integer", nullable=false)
     */
    private $slot;

    /**
     * @var Item
     *
     * @ORM\OneToOne(targetEntity="Item", fetch="EXTRA_LAZY")
     * @ORM\JoinColumn(name="ItemID", referencedColumnName="ID64")
     */
    private $item;

    /**
     * @return Character
     */
    public function getCharacter()
    {
        return $this->char;
    }

    /**
     * @param Character $char
     *
     * @return Inventory
     */
    public function setCharacter($char)
    {
        $this->char = $char;
        return $this;
    }

    /**
     * @return int
     */
    public function getSlot()
    {
        return $this->slot;
    }

    /**
     * @param int $slot
     *
     * @return Inventory
     */
    public function setSlot($slot)
    {
        $this->slot = $slot;
        return $this;
    }

    /**
     * @return Item
     */
    public function getItem()
    {
        return $this->item;
    }

    /**
     * @param Item $item
     *
     * @return Inventory
     */
    public function setItem($item)
    {
        $this->item = $item;
        return $this;
    }

}


text:
import os
import numpy as np
import tempfile
import shutil
import pickle
import ntpath
import nipype.pipeline.engine as pe
import nipype.interfaces.utility as niu
from nipype.interfaces.base import (TraitedSpec, File, traits, InputMultiPath,
                                    BaseInterface, OutputMultiPath, BaseInterfaceInputSpec, isdefined)
from nipype.utils.filemanip import (load_json, save_json, split_filename, fname_presuffix, copyfile)

from src.obj import transform_objectCommand, volume_object_evaluateCommand

def get_surf_workflow(name, infosource, datasink, opts):
    workflow = pe.Workflow(name=name)

    inputnode = pe.Node(niu.IdentityInterface(fields=["vol_file","obj_file","T1MNI", "MNIT1", "PETT1", "T1PET"]), name='inputnode')
    internode = pe.Node(niu.IdentityInterface(fields=["surface"]), name='internode')
    outputnode = pe.Node(niu.IdentityInterface(fields=["surface", "mask"]), name='outputnode')

    if opts.analysis_space == 'icbm152':
        if opts.surface_space == 'icbm152':
            workflow.connect(inputnode, 'obj_file', internode, 'surface')

        # MNI --> PET
        if opts.surface_space == 'pet' :
            transform_MNI_T1 = pe.Node( transform_object(), name="transform_MNI_T1")
            workflow.connect(inputnode, 'obj_file', transform_MNI_T1, 'in_file' )
            workflow.connect(inputnode, 'MNIT1', transform_MNI_T1, 'tfm_file' )

            transform_T1_PET = pe.Node( transform_object(), name="transform_T1_PET")
            workflow.connect(transform_MNI_T1, 'out_file', transform_T1_PET, 'in_file' )
            workflow.connect(inputnode, 'T1PET', transform_T1_PET, 'in_file' )

            workflow.connect(transform_T1_PET, 'out_file', internode, 'surface')

        # MNI --> T1
        if opts.surface_space == 't1' :
            transform_MNI_T1 = pe.Node( transform_object(), name="transform_MNI_T1")
            workflow.connect(inputnode, 'obj_file', transform_MNI_T1, 'in_file' )
            workflow.connect(inputnode, 'MNIT1', transform_MNI_T1, 'tfm_file' )

            workflow.connect(transform_MNI_T1, 'out_file', internode, 'surface')

    elif opts.analysis_space == 'pet':
        # PET --> MNI
        if opts.surface_space == 'icbm152' :
            transform_PET_T1 = pe.Node( transform_object(), name="transform_MNI_T1")
            workflow.connect(inputnode, 'obj_file', transform_PET_T1, 'in_file' )
            workflow.connect(inputnode, 'PETT1', transform_PET_T1, 'tfm_file' )

            transform_T1_MNI = pe.Node( transform_object(), name="transform_T1_MNI")
            workflow.connect(transform_T1_MNI, 'out_file', transform_T1_MNI, 'in_file' )
            workflow.connect(inputnode, 'T1MNI', transform_T1_MNI, 'in_file' )

            workflow.connect(transform_T1_MNI, 'out_file', internode, 'surface')

        if opts.surface_space == 'pet' :
            workflow.connect(inputnode, 'obj_file', internode, 'surface')

        # PET -> T1
        if opts.surface_space == 't1' :
            transform_PET_T1 = pe.Node( transform_object(), name="transform_MNI_T1")
            workflow.connect(inputnode, 'obj_file', transform_PET_T1, 'in_file' )
            workflow.connect(inputnode, 'PETT1', transform_PET_T1, 'tfm_file' )

            workflow.connect(transform_PET_T1, 'out_file', internode, 'surface')

    elif opts.analysis_space == 't1':

        # T1 --> MNI
        if opts.surface_space == 'icbm152' :
            transform_T1_MNI = pe.Node( transform_object(), name="transform_T1_MNI")
            workflow.connect(inputnode, 'obj_file', transform_T1_MNI, 'in_file' )
            workflow.connect(inputnode, 'T1MNI', transform_T1_MNI, 'tfm_file' )

            workflow.connect(transform_T1_MNI, 'out_file', internode, 'surface')

        # T1 --> PET
        if opts.surface_space == 'pet' :
            transform_T1_PET = pe.Node( transform_object(), name="transform_T1_PET")
            workflow.connect(inputnode, 'obj_file', transform_T1_PET, 'in_file' )
            workflow.connect(inputnode, 'PETT1', transform_T1_PET, 'tfm_file' )

            workflow.connect(transform_T1_PET, 'out_file', internode, 'surface')

        if opts.surface_space == 't1' :
            workflow.connect(inputnode, 'obj_file', internode, 'surface')
    else :
        print("Error: variable <analysis_space> was not one of : icbm152, pet, t1")
        exit(1)

    volume_interpolateNode = pe.Node( volume_object_evaluateCommand(), name="volume_interpolate"  )
    workflow.connect(internode, 'surface', volume_interpolateNode, 'obj_file')
    workflow.connect(inputnode, 'vol_file', volume_interpolateNode, 'vol_file')

    workflow.connect(volume_interpolateNode, 'out_file', outputnode, 'mask' )
    workflow.connect(internode, 'surface', outputnode, 'surface' )

    return(workflow)


text:
.. index

Connecting a HD44780 based Display
==================================

http://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi/wiring


text:
package org.nem.core.model.observers;

import org.hamcrest.core.IsEqual;
import org.junit.*;
import org.nem.core.model.Account;
import org.nem.core.test.Utils;

public class AccountNotificationTest {

	@Test
	public void canCreateNotification() {
		// Act:
		final Account account = Utils.generateRandomAccount();
		final AccountNotification notification = new AccountNotification(account);

		// Assert:
		Assert.assertThat(notification.getType(), IsEqual.equalTo(NotificationType.Account));
		Assert.assertThat(notification.getAccount(), IsEqual.equalTo(account));
	}
}


text:
// vim: set softtabstop=16 shiftwidth=16:

try {
                var fs = require("graceful-fs")
} catch (er) {
                var fs = require("fs")
}

module.exports = readJson

var LRU = require("lru-cache")
readJson.cache = new LRU({max: 1000})
var path = require("path")
var glob = require("glob")
var normalizeData = require("normalize-package-data")

// put more stuff on here to customize.
readJson.extraSet = [
                gypfile,
                serverjs,
                authors,
                readme,
                mans,
                bins,
                githead
]

var typoWarned = {}

function readJson (file, log_, strict_, cb_) {
                var log, strict, cb
                for (var i = 1; i < arguments.length - 1; i++) {
                                if (typeof arguments[i] === 'boolean')
                                                strict = arguments[i]
                                else if (typeof arguments[i] === 'function')
                                                log = arguments[i]
                }
                if (!log) log = function () {};
                cb = arguments[ arguments.length - 1 ]

                var c = readJson.cache.get(file)
                if (c) {
                                cb = cb.bind(null, null, c)
                                return process.nextTick(cb);
                }
                cb = (function (orig) { return function (er, data) {
                                if (data) readJson.cache.set(file, data);
                                return orig(er, data)
                } })(cb)
                readJson_(file, log, strict, cb)
}

function readJson_ (file, log, strict, cb) {
                fs.readFile(file, "utf8", function (er, d) {
                                parseJson(file, er, d, log, strict, cb)
                })
}

function stripBOM(content) {
                // Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
                // because the buffer-to-string conversion in `fs.readFileSync()`
                // translates it to FEFF, the UTF-16 BOM.
                if (content.charCodeAt(0) === 0xFEFF) {
                                content = content.slice(1);
                }
                return content;
}

function parseJson (file, er, d, log, strict, cb) {
                if (er && er.code === "ENOENT") {
                                indexjs(file, er, log, strict, cb)
                                return
                }
                if (er) return cb(er);
                try {
                                d = JSON.parse(stripBOM(d))
                } catch (er) {
                                d = parseIndex(d)
                                if (!d) return cb(parseError(er, file));
                }
                extras(file, d, log, strict, cb)
}

function indexjs (file, er, log, strict, cb) {
                if (path.basename(file) === "index.js") {
                                return cb(er);
                }
                var index = path.resolve(path.dirname(file), "index.js")
                fs.readFile(index, "utf8", function (er2, d) {
                                if (er2) return cb(er);
                                d = parseIndex(d)
                                if (!d) return cb(er);
                                extras(file, d, log, strict, cb)
                })
}

readJson.extras = extras
function extras (file, data, log_, strict_, cb_) {
                var log, strict, cb
                for (var i = 2; i < arguments.length - 1; i++) {
                                if (typeof arguments[i] === 'boolean')
                                                strict = arguments[i]
                                else if (typeof arguments[i] === 'function')
                                                log = arguments[i]
                }
                cb = arguments[i]
                var set = readJson.extraSet
                var n = set.length
                var errState = null
                set.forEach(function (fn) {
                                fn(file, data, then)
                })
                function then(er) {
                                if (errState) return;
                                if (er) return cb(errState = er);
                                if (--n > 0) return;
                                final(file, data, log, strict, cb);
                }
}

function gypfile (file, data, cb) {
                var dir = path.dirname(file)
                var s = data.scripts || {}
                if (s.install || s.preinstall)
                                return cb(null, data);
                glob("*.gyp", { cwd: dir }, function (er, files) {
                                if (er) return cb(er);
                                gypfile_(file, data, files, cb)
                })
}

function gypfile_ (file, data, files, cb) {
                if (!files.length) return cb(null, data);
                var s = data.scripts || {}
                s.install = "node-gyp rebuild"
                data.scripts = s
                data.gypfile = true
                return cb(null, data);
}

function serverjs (file, data, cb) {
                var dir = path.dirname(file)
                var s = data.scripts || {}
                if (s.start) return cb(null, data)
                glob("server.js", { cwd: dir }, function (er, files) {
                                if (er) return cb(er);
                                serverjs_(file, data, files, cb)
                })
}
function serverjs_ (file, data, files, cb) {
                if (!files.length) return cb(null, data);
                var s = data.scripts || {}
                s.start = "node server.js"
                data.scripts = s
                return cb(null, data)
}

function authors (file, data, cb) {
                if (data.contributors) return cb(null, data);
                var af = path.resolve(path.dirname(file), "AUTHORS")
                fs.readFile(af, "utf8", function (er, ad) {
                                // ignore error.  just checking it.
                                if (er) return cb(null, data);
                                authors_(file, data, ad, cb)
                })
}
function authors_ (file, data, ad, cb) {
                ad = ad.split(/\r?\n/g).map(function (line) {
                                return line.replace(/^\s*#.*$/, '').trim()
                }).filter(function (line) {
                                return line
                })
                data.contributors = ad
                return cb(null, data)
}

var defDesc = "Unnamed repository; edit this file " +
              "'description' to name the repository."
function gitDescription (file, data, cb) {
                if (data.description) return cb(null, data);
                var dir = path.dirname(file)
                // just cuz it'd be nice if this file mattered...
                var gitDesc = path.resolve(dir, '.git/description')
                fs.readFile(gitDesc, 'utf8', function (er, desc) {
                                if (desc) desc = desc.trim()
                                if (!er && desc !== defDesc)
                                                data.description = desc
                                return cb(null, data)
                })
}

function readmeDescription (file, data) {
                if (data.description) return cb(null, data);
                var d = data.readme
                if (!d) return;
                // the first block of text before the first heading
                // that isn't the first line heading
                d = d.trim().split('\n')
                for (var s = 0; d[s] && d[s].trim().match(/^(#|$)/); s ++);
                var l = d.length
                for (var e = s + 1; e < l && d[e].trim(); e ++);
                data.description = d.slice(s, e).join(' ').trim()
}

function readme (file, data, cb) {
                if (data.readme) return cb(null, data);
                var dir = path.dirname(file)
                var globOpts = { cwd: dir, nocase: true, mark: true }
                glob("README?(.*)", globOpts, function (er, files) {
                                if (er) return cb(er);
                                // don't accept directories.
                                files = files.filter(function (file) {
                                                return !file.match(/\/$/)
                                })
                                if (!files.length) return cb();
                                var rm = path.resolve(dir, files[0])
                                readme_(file, data, rm, cb)
                })
}
function readme_(file, data, rm, cb) {
                var rmfn = path.basename(rm);
                fs.readFile(rm, "utf8", function (er, rm) {
                                // maybe not readable, or something.
                                if (er) return cb()
                                data.readme = rm
                                data.readmeFilename = rmfn
                                return cb(er, data)
                })
}

function mans (file, data, cb) {
                var m = data.directories && data.directories.man
                if (data.man || !m) return cb(null, data);
                m = path.resolve(path.dirname(file), m)
                glob("**/*.[0-9]", { cwd: m }, function (er, mans) {
                                if (er) return cb(er);
                                mans_(file, data, mans, cb)
                })
}
function mans_ (file, data, mans, cb) {
                var m = data.directories && data.directories.man
                data.man = mans.map(function (mf) {
                                return path.resolve(path.dirname(file), m, mf)
                })
                return cb(null, data)
}

function bins (file, data, cb) {
                if (Array.isArray(data.bin)) {
                                return bins_(file, data, data.bin, cb)
                }
                var m = data.directories && data.directories.bin
                if (data.bin || !m) return cb(null, data);
                m = path.resolve(path.dirname(file), m)
                glob("**", { cwd: m }, function (er, bins) {
                                if (er) return cb(er);
                                bins_(file, data, bins, cb)
                })
}
function bins_ (file, data, bins, cb) {
                var m = data.directories && data.directories.bin || '.'
                data.bin = bins.reduce(function (acc, mf) {
                                if (mf && mf.charAt(0) !== '.') {
                                                var f = path.basename(mf)
                                                acc[f] = path.join(m, mf)
                                }
                                return acc
                }, {})
                return cb(null, data)
}

function githead (file, data, cb) {
                if (data.gitHead) return cb(null, data);
                var dir = path.dirname(file)
                var head = path.resolve(dir, '.git/HEAD')
                fs.readFile(head, 'utf8', function (er, head) {
                                if (er) return cb(null, data);
                                githead_(file, data, dir, head, cb)
                })
}
function githead_ (file, data, dir, head, cb) {
                if (!head.match(/^ref: /)) {
                                data.gitHead = head.trim()
                                return cb(null, data)
                }
                var headFile = head.replace(/^ref: /, '').trim()
                headFile = path.resolve(dir, '.git', headFile)
                fs.readFile(headFile, 'utf8', function (er, head) {
                                if (er || !head) return cb(null, data)
                                head = head.replace(/^ref: /, '').trim()
                                data.gitHead = head
                                return cb(null, data)
                })
}

function final (file, data, log, strict, cb) {
                var pId = makePackageId(data)
                function warn(msg) {
                                if (typoWarned[pId]) return;
                                if (log) log("package.json", pId, msg);
                }
                try {
                                normalizeData(data, warn, strict)
                }
                catch (error) {
                                return cb(error)
                }
                typoWarned[pId] = true
                readJson.cache.set(file, data)
                cb(null, data)
}

function makePackageId (data) {
                return cleanString(data.name) + "@" + cleanString(data.version)
}

function cleanString(str) {
                return (!str || typeof(str) !== "string") ? "" : str.trim()
}

// /**package { "name": "foo", "version": "1.2.3", ... } **/
function parseIndex (data) {
                data = data.split(/^\/\*\*package(?:\s|$)/m)
                if (data.length < 2) return null
                data = data[1]
                data = data.split(/\*\*\/$/m)
                if (data.length < 2) return null
                data = data[0]
                data = data.replace(/^\s*\*/mg, "")
                try {
                                return JSON.parse(data)
                } catch (er) {
                                return null
                }
}

function parseError (ex, file) {
                var e = new Error("Failed to parse json\n"+ex.message)
                e.code = "EJSONPARSE"
                e.file = file
                return e
}


text:
package parser

import (
	"github.com/twtiger/gosecco/tree"
	. "gopkg.in/check.v1"
)

type RuleSuite struct{}

var _ = Suite(&RuleSuite{})

func parseRuleHeadCheck(c *C, s string, r tree.Rule) {
	res, ok := parseRuleHead(s)
	c.Assert(ok, Equals, true)
	c.Check(res, Equals, r)
}

func (s *RuleSuite) Test_parseRuleHead_parsesValidRuleHeads(c *C) {
	parseRuleHeadCheck(c, "read", tree.Rule{Name: "read"})
	parseRuleHeadCheck(c, "write", tree.Rule{Name: "write"})
	parseRuleHeadCheck(c, "\t write  ", tree.Rule{Name: "write"})
	parseRuleHeadCheck(c, "fcntl[]", tree.Rule{Name: "fcntl"})
	parseRuleHeadCheck(c, "fcntl [ ] ", tree.Rule{Name: "fcntl"})
	parseRuleHeadCheck(c, " fcntl [ +kill ] ", tree.Rule{Name: "fcntl", PositiveAction: "kill"})
	parseRuleHeadCheck(c, " fcntl[ -kill] ", tree.Rule{Name: "fcntl", NegativeAction: "kill"})
	parseRuleHeadCheck(c, " fcntl[ -kill, +trace] ", tree.Rule{Name: "fcntl", NegativeAction: "kill", PositiveAction: "trace"})
	parseRuleHeadCheck(c, " fcntl[+trace,-kill] ", tree.Rule{Name: "fcntl", NegativeAction: "kill", PositiveAction: "trace"})
	parseRuleHeadCheck(c, " fcntl[+trace,-42] ", tree.Rule{Name: "fcntl", NegativeAction: "42", PositiveAction: "trace"})

	_, ok := parseRuleHead("")
	c.Assert(ok, Equals, false)

	_, ok = parseRuleHead("fcntl[+trace,+42]")
	c.Assert(ok, Equals, false)

	_, ok = parseRuleHead("fcntl[-trace,-42]")
	c.Assert(ok, Equals, false)

	_, ok = parseRuleHead("fcntl[hm]")
	c.Assert(ok, Equals, false)
}

func (s *RuleSuite) Test_parseRule_returnsErrorForInvalidLine(c *C) {
	_, err := parseRule("  read:  ")
	c.Assert(err, ErrorMatches, "No expression specified for rule: read")
}