text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-b10
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.06.13 at 03:17:43 PM CST
//

package org.ovirt.engine.api.model;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

/**
 *
Java class for Header complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="Header">
 *   <complexContent>
 *     <extension base="{}BaseResource">
 *       <sequence>
 *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="deprecated" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
 *       </sequence>
 *       <attribute name="required" type="{http://www.w3.org/2001/XMLSchema}boolean" />
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Header", propOrder = {
    "value",
    "deprecated"
})
public class Header
    extends BaseResource
{

    @XmlElement(required = true)
    protected String value;
    @XmlElement(type = String.class)
    @XmlJavaTypeAdapter(Adapter3 .class)
    @XmlSchemaType(name = "boolean")
    protected Boolean deprecated;
    @XmlAttribute(name = "required")
    @XmlJavaTypeAdapter(Adapter3 .class)
    @XmlSchemaType(name = "boolean")
    protected Boolean required;

    /**
     * Gets the value of the value property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getValue() {
        return value;
    }

    /**
     * Sets the value of the value property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setValue(String value) {
        this.value = value;
    }

    public boolean isSetValue() {
        return (this.value!= null);
    }

    /**
     * Gets the value of the deprecated property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public Boolean isDeprecated() {
        return deprecated;
    }

    /**
     * Sets the value of the deprecated property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setDeprecated(Boolean value) {
        this.deprecated = value;
    }

    public boolean isSetDeprecated() {
        return (this.deprecated!= null);
    }

    /**
     * Gets the value of the required property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public Boolean isRequired() {
        return required;
    }

    /**
     * Sets the value of the required property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setRequired(Boolean value) {
        this.required = value;
    }

}


text:
package com.xruby.runtime.lang;

import java.io.OutputStream;
import java.io.PrintStream;

import com.xruby.runtime.builtin.*;
import com.xruby.GeneratedMethods.*;
import com.rho.RhoClassFactory;
import com.rho.RhoEmptyLogger;
import com.rho.RhoLogger;
import com.rho.StringScanner;

import com.rho.Extensions;

public class RubyRuntime
{
	private static final RhoLogger LOG = RhoLogger.RHO_STRIP_LOG ? new RhoEmptyLogger() :
		new RhoLogger("RubyRuntime");

    public static RubyClass ObjectClass;
    public static RubyClass ModuleClass;
    public static RubyClass ClassClass;
    public static RubyModule KernelModule;
    public static RubyModule ComparableModule;
    public static RubyModule EnumerableModule;
    public static RubyModule ErrnoModule;
    public static RubyModule FileTestModule;
    public static RubyModule GCModule;
    public static RubyModule MarshalModule;
    public static RubyModule MathModule;
    public static RubyModule ObjectSpaceModule;
    public static RubyModule ProcessModule;
    public static RubyClass BindingClass;
    public static RubyClass NilClassClass;
    public static RubyClass TrueClassClass;
    public static RubyClass FalseClassClass;
    public static RubyClass NumericClass;
    public static RubyClass IntegerClass;
    public static RubyClass FixnumClass;
    public static RubyClass BignumClass;
    public static RubyClass StringClass;
    public static RubyClass FloatClass;
    public static RubyClass ArrayClass;
    public static RubyClass HashClass;
    public static RubyClass SymbolClass;
    public static RubyClass IOClass;
    public static RubyClass ProcClass;
    public static RubyClass RangeClass;
    public static RubyClass RegexpClass;
    public static RubyClass FileClass;
    public static RubyClass MethodClass;
    public static RubyClass TimeClass;
    public static RubyClass MatchDataClass;
    public static RubyClass DirClass;
    public static RubyClass StructClass;
    public static RubyClass ThreadGroupClass;
    public static RubyClass ThreadClass;
    public static RubyClass UnboundMethodClass;

    public static RubyClass ExceptionClass;
    public static RubyClass StandardErrorClass;
    public static RubyClass SystemExitClass;
    public static RubyClass TypeErrorClass;
    public static RubyClass ArgumentErrorClass;
    public static RubyClass IndexErrorClass;
    public static RubyClass RangeErrorClass;
    public static RubyClass NameErrorClass;
    public static RubyClass ThreadErrorClass;
    public static RubyClass NoMethodErrorClass;
    public static RubyClass IOErrorClass;
    public static RubyClass EOFErrorClass;
    public static RubyClass RuntimeErrorClass;
    public static RubyClass LocalJumpErrorClass;
    public static RubyClass SystemCallErrorClass;
    public static RubyClass ZeroDivErrorClass;

    public static RubyClass ScriptErrorClass;
    public static RubyClass SyntaxErrorClass;
    public static RubyClass LoadErrorClass;
    public static RubyClass NotImplementedErrorClass;

    public static RubyClass StringIOClass;

    //RHO
	private static RubyModule SQLite3Module;
    public static RubyClass DatabaseClass;
    public static RubyModule SyncEngineClass;
    public static RubyClass StringScannerClass;
    public static RubyClass PhonebookClass;
    public static RubyModule EventModule;
    public static RubyClass CalendarClass;
    public static RubyClass PBRecordClass;
    public static RubyClass EVRecordClass;
    public static RubyClass GeoLocationClass;
    public static RubyModule AsyncHttpModule;
    public static RubyModule SystemClass;
    public static RubyModule JSONClass;
    public static RubyClass CameraClass;
    public static RubyClass RhoBluetoothClass;
    public static RubyClass WebViewClass;
    public static RubyClass RhoConfClass;
    public static RubyClass AlertClass;
    public static RubyClass DateTimePickerClass;
    public static RubyClass NativeBarClass;
    public static RubyModule RingtoneManagerClass;
    public static RubyClass MediaErrorClass;
    public static RubyClass MutexClass;
    public static RubyClass TCPSocketClass;
    public static RubyClass SSLSocketClass;
    public static RubyClass TopSelfClass;
    public static RubyModule MapViewClass;
    public static RubyClass XMLParserClass;
    //RHO

    public static /*final*/ RubyValue TOP_LEVEL_SELF_VALUE;

    private static RubyMethod respondToMethod;

    public static boolean running = false;

    private static void registerExtensions() {
		int i;
		for (i = 0; i < Extensions.extensions.length; i++) {
			String ext_class = Extensions.extensions[i];
			if (ext_class.length() > 0) {
 		          Class wrapperClass = null;
		          try {
		            wrapperClass = Class.forName(ext_class);
		          } catch (ClassNotFoundException exc) {
		        	  LOG.ERROR("Extension class [" + ext_class + "] not exist !",exc);
		          }
		          if (wrapperClass != null) {
		        	Runnable ext_run = null;
		        	try {
		        		ext_run = (Runnable)wrapperClass.newInstance();
		        	} catch (Exception e) {
		            	  LOG.ERROR("Extension class [" + ext_class + "] not instantiated !",e);

		        	}
			        if (ext_run != null ) {
			        	ext_run.run();
			        }
			        else {
		            	  LOG.ERROR("Extension class [" + ext_class + "] not implemented Runnable interface !");
			        }
		          }
			}
		}
    }

//    static {
    private static void initClasses()
    {
        //Note: order is important: should creare parent classes first!

        ObjectClass = ClassFactory.defineBootClass("Object", null);
        ModuleClass = ClassFactory.defineBootClass("Module", RubyRuntime.ObjectClass);
        ClassClass = ClassFactory.defineBootClass("Class", RubyRuntime.ModuleClass);

        ClassClass.setRubyClass(ClassClass);

        RubySingletonClass metaClass = new RubySingletonClass(ObjectClass, ClassClass, null);
        metaClass = new RubySingletonClass(ModuleClass, metaClass, null);
        metaClass = new RubySingletonClass(ClassClass, metaClass, null);

        KernelModule = RubyAPI.defineModule("Kernel");

        NilClassClass = RubyAPI.defineClass("NilClass", RubyRuntime.ObjectClass);
        TrueClassClass = RubyAPI.defineClass("TrueClass", RubyRuntime.ObjectClass);
        FalseClassClass = RubyAPI.defineClass("FalseClass", RubyRuntime.ObjectClass);

        ComparableModule = RubyAPI.defineModule("Comparable");
        EnumerableModule = RubyAPI.defineModule("Enumerable");
        ErrnoModule = RubyAPI.defineModule("Errno");
        //FileTestModule = RubyTypeFactory.getModule(RubyFileTestModule.class);
        //GCModule = RubyTypeFactory.getModule(RubyGC.class);

        //MarshalModule = RubyTypeFactory.getModule(RubyMarshalModule.class);//RubyAPI.defineModule("Marshal");
        //MathModule = RubyTypeFactory.getModule(RubyMathModule.class);
        //MathModule = RubyAPI.defineModule("Math");
        //ObjectSpaceModule = RubyTypeFactory.getModule(ObjectSpace.class);

        ProcessModule = RubyAPI.defineModule("Process");

        BindingClass = RubyAPI.defineClass("Binding", RubyRuntime.ObjectClass);

      //RHO_ADDED
        FileTestModule = RubyAPI.defineModule("FileTest");
        RubyFileTestModule_Methods.initMethods(FileTestModule);

        GCModule = RubyAPI.defineModule("GC");
        RubyGC_Methods.initMethods(GCModule);

        MarshalModule = RubyAPI.defineModule("Marshal");
        RubyMarshalModule_Methods.initMethods(MarshalModule);

        MathModule = RubyAPI.defineModule("Math");
        RubyMathModule_Methods.initMethods(MathModule);

//        ObjectSpaceModule = RubyAPI.defineModule("ObjectSpace");
//        RubyObjectSpace_Methods.initMethods(ObjectSpaceModule);

        RubyModule_Methods.initMethods(ModuleClass);
        RubyModule.initDummyMethods(ModuleClass);
        RubyKernelModule_Methods.initMethods(KernelModule);
        RubyClass_Methods.initMethods(ClassClass);
        RubyClass.initDummyMethods(ClassClass);
        RubyObject_Methods.initMethods(ObjectClass);

        ObjectClass.includeModule(KernelModule);

        ArrayClass = RubyAPI.defineClass("Array", RubyRuntime.ObjectClass);
        ArrayClass.includeModule(EnumerableModule);
        RubyArray_Methods.initMethods(ArrayClass);

        SymbolClass = RubyAPI.defineClass("Symbol", RubyRuntime.ObjectClass);
        RubySymbol_Methods.initMethods(SymbolClass);

        IOClass = RubyAPI.defineClass("IO", RubyRuntime.ObjectClass);
        RubyIO_Methods.initMethods(IOClass);

        StringClass = RubyAPI.defineClass("String", RubyRuntime.ObjectClass);
        RubyString_Methods.initMethods(StringClass);

        NumericClass = RubyAPI.defineClass("Numeric", RubyRuntime.ObjectClass);
        RubyNumeric_Methods.initMethods(NumericClass);

        IntegerClass = RubyAPI.defineClass("Integer", RubyRuntime.NumericClass);
        RubyInteger_Methods.initMethods(IntegerClass);

        FixnumClass = RubyAPI.defineClass("Fixnum", RubyRuntime.IntegerClass);
        RubyFixnum_Methods.initMethods(FixnumClass);

        BignumClass = RubyAPI.defineClass("Bignum", RubyRuntime.IntegerClass);
        RubyBignum_Methods.initMethods(BignumClass);

        FloatClass = RubyAPI.defineClass("Float", RubyRuntime.NumericClass);
        RubyFloat_Methods.initMethods(FloatClass);

        RangeClass = RubyAPI.defineClass("Range", RubyRuntime.ObjectClass);
        RubyRange_Methods.initMethods(RangeClass);

        RegexpClass = RubyAPI.defineClass("Regexp", RubyRuntime.ObjectClass);
        RubyRegexp_Methods.initMethods(RegexpClass);

        TimeClass = RubyAPI.defineClass("Time", RubyRuntime.ObjectClass);
        RubyTime_Methods.initMethods(TimeClass);

        HashClass = RubyAPI.defineClass("Hash", RubyRuntime.ObjectClass);
        HashClass.includeModule(EnumerableModule);
        RubyHash_Methods.initMethods(HashClass);

        ProcClass = RubyAPI.defineClass("Proc", RubyRuntime.ObjectClass);
        RubyProc_Methods.initMethods(ProcClass);

        ThreadClass = RubyAPI.defineClass("Thread", RubyRuntime.ObjectClass);
        RubyThread_Methods.initMethods(ThreadClass);

        IOClass = RubyAPI.defineClass("IO", RubyRuntime.ObjectClass);
        RubyIO_Methods.initMethods(IOClass);

        FileClass = RubyAPI.defineClass("File", RubyRuntime.IOClass);
        RubyFile_Methods.initMethods(FileClass);

        MethodClass = RubyAPI.defineClass("Method", RubyRuntime.ObjectClass);
        RubyMethodValue_Methods.initMethods(MethodClass);

        TimeClass = RubyAPI.defineClass("Time", RubyRuntime.ObjectClass);
        RubyTime_Methods.initMethods(TimeClass);

        MatchDataClass = RubyAPI.defineClass("MatchData", RubyRuntime.ObjectClass);
        RubyMatchData_Methods.initMethods(MatchDataClass);

        DirClass = RubyAPI.defineClass("Dir", RubyRuntime.ObjectClass);
        RubyDir_Methods.initMethods(DirClass);
        DirClass.includeModule(EnumerableModule);

        StructClass = RubyAPI.defineClass("StructData", RubyRuntime.ObjectClass);
        RubyStruct_Methods.initMethods(StructClass);

        ThreadGroupClass = RubyAPI.defineClass("ThreadGroup", RubyRuntime.ObjectClass );
        RubyThreadGroup_Methods.initMethods(ThreadGroupClass);

        ExceptionClass = RubyAPI.defineClass("Exception", RubyRuntime.ObjectClass);
        RubyExceptionValue_Methods.initMethods(ExceptionClass);

		SQLite3Module = RubyAPI.defineModule("SQLite3");
		DatabaseClass = SQLite3Module.defineClass("Database", RubyRuntime.ObjectClass);
//        DBAdapterClass = RubyAPI.defineClass("DbAdapter", RubyRuntime.ObjectClass);
//        PerstLiteAdapter.initMethods(DBAdapterClass);

        SyncEngineClass = RubyAPI.defineModule("SyncEngine" );//, RubyRuntime.ObjectClass);
//        SyncEngine.initMethods(SyncEngineClass);

        StringScannerClass = RubyAPI.defineClass("StringScanner", RubyRuntime.ObjectClass);
        StringScanner.initMethods(StringScannerClass);

        RubyModule rhoModule = RubyAPI.defineModule("Rho");

        PhonebookClass = RubyAPI.defineClass("Phonebook", RubyRuntime.ObjectClass);
        EventModule = rhoModule.defineModule("RhoEvent");
        CalendarClass = RubyAPI.defineClass("Calendar", RubyRuntime.ObjectClass);
        PBRecordClass = RubyAPI.defineClass("PBRecord", RubyRuntime.ObjectClass);
        EVRecordClass = RubyAPI.defineClass("EVRecord", RubyRuntime.ObjectClass);
        GeoLocationClass = RubyAPI.defineClass("GeoLocation", RubyRuntime.ObjectClass);
        AsyncHttpModule = rhoModule.defineModule("AsyncHttp");
		SystemClass = RubyAPI.defineModule("System");//, RubyRuntime.ObjectClass);
        JSONClass = rhoModule.defineModule("JSON" );//, RubyRuntime.ObjectClass);
        CameraClass = RubyAPI.defineClass("Camera", RubyRuntime.ObjectClass);
        RhoBluetoothClass = RubyAPI.defineClass("RhoBluetooth", RubyRuntime.ObjectClass);
        WebViewClass = RubyAPI.defineClass("WebView", RubyRuntime.ObjectClass);
        RhoConfClass = RubyAPI.defineClass("RhoConf", RubyRuntime.ObjectClass);
        AlertClass = RubyAPI.defineClass("Alert", RubyRuntime.ObjectClass);
        DateTimePickerClass = RubyAPI.defineClass("DateTimePicker", RubyRuntime.ObjectClass);
        NativeBarClass = RubyAPI.defineClass("NativeBar", RubyRuntime.NativeBarClass);
        //RingtoneManagerClass = RubyAPI.defineClass("RingtoneManager", RubyRuntime.ObjectClass);
        RingtoneManagerClass = rhoModule.defineModule("RingtoneManager");
        MediaErrorClass = RubyAPI.defineClass("MediaError", RubyRuntime.ObjectClass);
        MutexClass = RubyAPI.defineClass("Mutex", RubyRuntime.ObjectClass);
        TCPSocketClass = RubyAPI.defineClass("TCPSocket", RubyRuntime.ObjectClass);
        SSLSocketClass = RubyAPI.defineClass("SSLSocket", RubyRuntime.ObjectClass);
        MapViewClass = RubyAPI.defineModule("MapView" );//, RubyRuntime.ObjectClass);
        RubyMutex.initMethods(MutexClass);

        RubyModule rexmlModule = RubyAPI.defineModule("REXML");
        RubyModule parsersModule = rexmlModule.defineModule("Parsers");
        XMLParserClass = parsersModule.defineClass("BaseParser", RubyRuntime.ObjectClass);

//      RhoPhonebook.initMethods(PhonebookClass);

//
        /*RubyTypeFactory.getClass(RubyObject.class);
        RubyTypeFactory.getClass(RubyModule.class);
        RubyTypeFactory.getClass(RubyClass.class);

        RubyModule m = RubyTypeFactory.getModule(RubyKernelModule.class);*/
        respondToMethod = KernelModule.findMethod(RubyID.RESPOND_TO_P);
/*        RubyTypeFactory.getModule(RubyRandom.class);

        NumericClass = RubyTypeFactory.getClass(RubyNumeric.class);
        IntegerClass = RubyTypeFactory.getClass(RubyInteger.class);
        FixnumClass = RubyTypeFactory.getClass(RubyFixnum.class);
        BignumClass = RubyTypeFactory.getClass(RubyBignum.class);
        StringClass = RubyTypeFactory.getClass(RubyString.class);
        FloatClass = RubyTypeFactory.getClass(RubyFloat.class);
        ArrayClass = RubyTypeFactory.getClass(RubyArray.class);
        HashClass = RubyTypeFactory.getClass(RubyHash.class);
        SymbolClass = RubyTypeFactory.getClass(RubySymbol.class);
        IOClass = RubyTypeFactory.getClass(RubyIO.class);
        ProcClass = RubyTypeFactory.getClass(RubyProc.class);
        RangeClass = RubyTypeFactory.getClass(RubyRange.class);
        RegexpClass = RubyTypeFactory.getClass(RubyRegexp.class);
        FileClass = RubyTypeFactory.getClass(RubyFile.class);
        MethodClass = RubyTypeFactory.getClass(RubyMethodValue.class);
        TimeClass = RubyTypeFactory.getClass(RubyTime.class);
        MatchDataClass = RubyTypeFactory.getClass(RubyMatchData.class);
        DirClass = RubyTypeFactory.getClass(RubyDir.class);
        StructClass = RubyTypeFactory.getClass(RubyStruct.class);
        ThreadGroupClass = RubyTypeFactory.getClass(RubyThreadGroup.class);
        ThreadClass = RubyTypeFactory.getClass(RubyThread.class);*/
        UnboundMethodClass = RubyAPI.defineClass("UnboundMethod", MethodClass);
//        ExceptionClass = RubyTypeFactory.getClass(RubyExceptionValue.class);
        SystemExitClass = RubyAPI.defineClass("SystemExit", ExceptionClass);
        StandardErrorClass = RubyAPI.defineClass("StandardError", ExceptionClass);
        TypeErrorClass = RubyAPI.defineClass("TypeError", StandardErrorClass);
        ArgumentErrorClass = RubyAPI.defineClass("ArgumentError", StandardErrorClass);
        IndexErrorClass = RubyAPI.defineClass("IndexError", StandardErrorClass);
        RangeErrorClass = RubyAPI.defineClass("RangeError", StandardErrorClass);
        NameErrorClass = RubyAPI.defineClass("NameError", StandardErrorClass);
        ThreadErrorClass = RubyAPI.defineClass("ThreadError", StandardErrorClass);
        NoMethodErrorClass = RubyAPI.defineClass("NoMethodError", NameErrorClass);
        IOErrorClass = RubyAPI.defineClass("IOError", StandardErrorClass);
        EOFErrorClass = RubyAPI.defineClass("EOFError", IOErrorClass);
        RuntimeErrorClass = RubyAPI.defineClass("RuntimeError", StandardErrorClass);
        LocalJumpErrorClass = RubyAPI.defineClass("LocalJumpError", StandardErrorClass);
        SystemCallErrorClass = RubyAPI.defineClass("SystemCallError", StandardErrorClass);
        ZeroDivErrorClass = RubyAPI.defineClass("ZeroDivisionError", StandardErrorClass);

        ScriptErrorClass = RubyAPI.defineClass("ScriptError", ExceptionClass);
        SyntaxErrorClass = RubyAPI.defineClass("SyntaxError", ScriptErrorClass);
        LoadErrorClass = RubyAPI.defineClass("LoadError", ScriptErrorClass);
        NotImplementedErrorClass = RubyAPI.defineClass("NotImplementedError", ScriptErrorClass);

        //TOP_LEVEL_SELF_VALUE = RubyTypeFactory.getObject(RubyTopSelf.class);
      //RHO_ADDED
        TopSelfClass = RubyAPI.defineClass("__TopSelf", ObjectClass);
        RubyTopSelf_Methods.initMethods(TopSelfClass);
        TOP_LEVEL_SELF_VALUE = TopSelfClass;//new RubyObject( TopSelfClass );//RubyTopSelf();

        StringIOClass = RubyAPI.defineClass("StringIO", RubyRuntime.ObjectClass);
        RubyStringIO_Methods.initMethods(StringIOClass);
        StringIOClass.includeModule(EnumerableModule);

        RhoSupport.init();

      //
        //StringIOClass = RubyTypeFactory.getClass(RubyStringIO.class);

        RubyThread.init();

    }

    private static void initARGV(String[] args) {
        RubyArray argv = new RubyArray();
        if (args != null) {
//            for (String arg : args) {
        	for( int i = 0; i<args.length; i++){
        		String arg = args[i];
                argv.add(ObjectFactory.createString(arg));
            }
        }

        RubyAPI.setTopLevelConstant(argv, "ARGV");
    }

    private static void loadBuildinDotRb() {
        try {
            Class c = Class.forName(RhoSupport.getAppName() + ".builtinME.main");
            Object o = c.newInstance();
            RubyProgram p = (RubyProgram) o;
            p.invoke();
        } catch (ClassNotFoundException e) {
        } catch (InstantiationException e) {
        } catch (IllegalAccessException e) {
            throw new Error(e.toString());
        }
    }

    public static void init(String[] args) {
        if (RubyRuntime.running) {
            return;
        }

        initClasses();

        initARGV(args);

	registerExtensions();

        RubyAPI.setTopLevelConstant(RubyAPI.isWindows() ? ObjectFactory.createString("mswin32") : ObjectFactory.createString("java"), "RUBY_PLATFORM");

        if (RubyAPI.isWindows()) {
            RubyAPI.setConstant(ObjectFactory.createString("\\"), RubyRuntime.FileClass, "ALT_SEPARATOR");
            RubyAPI.setConstant(ObjectFactory.createString(";"), RubyRuntime.FileClass, "PATH_SEPARATOR");
        } else {
        	RubyAPI.setConstant(ObjectFactory.createString(":"), RubyRuntime.FileClass, "PATH_SEPARATOR");
        }

    	RubyAPI.setConstant(ObjectFactory.createFixnum(RubyRegexp.RE_OPTION_IGNORECASE), RubyRuntime.RegexpClass, "IGNORECASE");
    	RubyAPI.setConstant(ObjectFactory.createFixnum(RubyRegexp.RE_OPTION_EXTENDED), RubyRuntime.RegexpClass, "EXTENDED");
    	RubyAPI.setConstant(ObjectFactory.createFixnum(RubyRegexp.RE_OPTION_MULTILINE), RubyRuntime.RegexpClass, "MULTILINE");

        //RubyTypeFactory.getObject(RubyENV.class);
        //RHO_ADDED
        RubyClass EnvClass = RubyAPI.defineClass("ENV", RubyRuntime.ObjectClass);
        RubyENV_Methods.initMethods(EnvClass);
        //
        GlobalVariables.initialize();

        //RHO_ADED
        RubyAPI.setTopLevelConstant(RubyConstant.QTRUE, "RHO_ME");

        try{
	        if( RhoClassFactory.createRhoRubyHelper().getPlatform().equals("Blackberry" ) )
	        	RubyAPI.setTopLevelConstant(RubyConstant.QTRUE, "RHO_DBME");
        }catch(Exception e)
        {
        }

        RubyAPI.setTopLevelConstant(ObjectFactory.createString("1.9.1"), "RUBY_VERSION");
        RubyAPI.setTopLevelConstant(ObjectFactory.createString("2009-05-12"), "RUBY_RELEASE_DATE");
        RubyAPI.setTopLevelConstant(ObjectFactory.createString("java"), "RUBY_PLATFORM");
        RubyAPI.setTopLevelConstant(ObjectFactory.createInteger(129), "RUBY_PATCHLEVEL");
        RubyAPI.setTopLevelConstant(ObjectFactory.createInteger(23412), "RUBY_REVISION");
        RubyAPI.setTopLevelConstant(ObjectFactory.createString("xruby"), "RUBY_DESCRIPTION");
        RubyAPI.setTopLevelConstant(ObjectFactory.createString("ruby - Copyright (C)"), "RUBY_COPYRIGHT");
        RubyAPI.setTopLevelConstant(ObjectFactory.createString("ruby"), "RUBY_ENGINE");

        //

        updateStdout();
        updateStderr();

        RubyAPI.setTopLevelConstant(RubyConstant.QTRUE, "TRUE");
        loadBuildinDotRb();
        RubyRuntime.running = true;
    }

    public static void fini() {
        AtExitBlocks.invokeAll();
    }

    private static boolean supported;
    public static boolean javaIsSupported(){
        return supported;
    }

    public static void setJavaSupported(boolean val){
        supported = val;
    }

    public static RubyMethod getRespondMethod() {
        return respondToMethod;
    }

    public static void setStdout(OutputStream os) {
    	/*PrintStream ps = getPrintStream(os);
        System.setOut(ps);
        updateStdout();*/
    	//RHO_COMMENT: setStdout
    }

    private static void updateStdout() {
        RubyIO io = new RubyFile(new OutputStreamExecutor(false), RubyRuntime.IOClass);
        RubyAPI.setTopLevelConstant(io, "STDOUT");
        GlobalVariables.set(io, "$stdout");
    }

    private static void updateStderr() {
        RubyIO io = new RubyFile(new OutputStreamExecutor(true), RubyRuntime.IOClass);
        RubyAPI.setTopLevelConstant(io, "STDERR");
        GlobalVariables.set(io, "$stderr");
    }

    private static PrintStream getPrintStream(OutputStream os) {
        return (os instanceof PrintStream) ? (PrintStream)os : new PrintStream(os);
    }
}

redpajama_set_name: RedPajamaGithub


text:
package ch.scaille.dataflowmgr.model.flowctrl;

import static ch.scaille.util.helpers.StreamExt.notEq;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toSet;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Stream;

import ch.scaille.dataflowmgr.model.Binding;
import ch.scaille.dataflowmgr.model.BindingRule;
import ch.scaille.dataflowmgr.model.BindingRule.Type;
import ch.scaille.dataflowmgr.model.CustomCall;
import ch.scaille.dataflowmgr.model.IFlowCheck;
import ch.scaille.dataflowmgr.model.WithId;

public class ConditionalFlowCtrl extends WithId implements IFlowCheck {

	public static class Builder {

		private final List<Binding.Builder> bindings = new ArrayList<>();

		private String check;

		private final String name;

		private boolean exclusive;

		public Builder(final String name) {
			this.name = name;
		}

		public void setExclusive(final boolean exclusive) {
			this.exclusive = exclusive;
		}

		public Builder setCheck(final String check) {
			this.check = check;
			return this;
		}

		public Builder conditional(CustomCall condition, final Binding.Builder binding) {
			bindings.add(binding.addRule(activator(condition)));
			return this;
		}

		public Builder fallback(final Binding.Builder binding) {
			if (getActivators(binding.getRules()).count() > 0 && getDefaultBinding().isPresent()) {
				throw new IllegalStateException("A default binding is already present");
			}
			bindings.add(binding);
			return this;
		}

		public Optional<Binding.Builder> getDefaultBinding() {
			return bindings.stream().filter(b -> getActivators(b.getRules()).count() == 0).findAny();
		}

		public ConditionalFlowCtrl build() {
			return new ConditionalFlowCtrl(this);
		}
	}

	public static Builder builder(final String name) {
		return new Builder(name);
	}

	private final Builder config;

	private final List<Binding> bindings = new ArrayList<>();
	private final Optional<Binding> defaultBinding;

	public ConditionalFlowCtrl(final Builder configuration) {
		super(UUID.randomUUID());
		this.config = configuration;

		final var defaultBindingBuilder = config.getDefaultBinding();
		bindings.addAll(config.bindings.stream().filter(notEq(defaultBindingBuilder.orElse(null)))
				.map(b -> b.addRule(condition(this)).build()).collect(toList()));

		this.defaultBinding = defaultBindingBuilder.map(b -> b.addRule(condition(this))
				.addRules(bindings.stream().map(ConditionalFlowCtrl::exclusion).collect(toSet())).build());
		this.defaultBinding.ifPresent(bindings::add);
	}

	public List<Binding> getBindings() {
		return bindings;
	}

	public Optional<Binding> getDefaultBinding() {
		return defaultBinding;
	}

	@Override
	public String getCheck() {
		return config.check;
	}

	public String getName() {
		return config.name;
	}

	public boolean isExclusive() {
		return config.exclusive;
	}

	public static BindingRule activator(final CustomCall condition) {
		return new BindingRule(Type.ACTIVATION, condition);
	}

	public static CustomCall activator(final BindingRule rule) {
		return rule.get(CustomCall.class);
	}

	public static Stream<CustomCall> getActivators(final Collection<BindingRule> rules) {
		return BindingRule.getAll(rules, Type.ACTIVATION, CustomCall.class);
	}

	public static BindingRule exclusion(final Binding exclusion) {
		return new BindingRule(Type.EXCLUSION, exclusion);
	}

	public static Stream<Binding> getExclusions(Collection<BindingRule> rules) {
		return BindingRule.getAll(rules, BindingRule.Type.EXCLUSION, Binding.class);
	}

	public static BindingRule condition(final ConditionalFlowCtrl condition) {
		return new BindingRule(Type.CONDITIONAL, condition);
	}

	public static Optional<ConditionalFlowCtrl> getCondition(final Collection<BindingRule> rules) {
		return BindingRule.getAll(rules, Type.CONDITIONAL, ConditionalFlowCtrl.class).findFirst();
	}

}


text:
CodeWatch
=========
* [About](#about)
* [Screenshots](#screenshots)
* [Issues](#issues)
* [Todo](#todo)
* [License](#license)
* [Extras](#extras)

### About
This is the capstone project [Udacity Android Developer Nanodegree]. To
know more about the design of the app see [extras](#extras).

```
Project Overview
In Stage 1, you designed and planned your Capstone app. Now, it's time to build it!

Nanodegree students must successfully complete the Capstone, Stage 1 project prior to beginning Stage 2.

Why this Project?
In this project, you will demonstrate the skills you've learned in your Nanodegree journey, and apply them to creating a unique app experience of your own. By the end of this project, you will have an app that you can submit to the Google Play Store for distribution.

What Will I Learn?
The Capstone project will give you the experience you need to own the full development cycle of an app.
```

### Screenshots

*Under construction*

### Issues

*Check Issues tab*

### Todo

 - [ ] Fix known issues.
 - [ ] Publish to the play store.
 - [ ] Advertise.

### LICENSE

```
Copyright 2017 Gurupad Mamadapur

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 ```

#### Extras

Checkout [Capstone Stage I repo](https://github.com/Protino/Capstone-Project) to know more about how the app was designed and built.

  [Udacity Android Developer Nanodegree]:https://www.udacity.com/degrees/android-developer-nanodegree-by-google--nd801


text:
.. _geoclaw_examples_multilayer_plane_wave:

Basic 2D Multi-Layer Shallow Water Examples
===========================================

These examples include simple setups for plane wave tests of the 2-layer
shallow water equations with a plane wave initial condition and a jump in
bathymetry.  The location and angles of the plane wave and bathymetry jump are
controlled via the *setrun.py* file.  Additionally the ability to run with a
similar topography but a gaussian hump as the initial condition has also been
included.  To run the basic plane-wave example use::

    make .plots

Running the *run_tests.py* script will execute a family of different setups for
both plane-waves incident at different angles to the grid and topography and a
set of the ``bubble tests``.  The basics of the Riemann solvers involved in
these examples can be found in [1].

1.	Mandli, K. T. A Numerical Method for the Two Layer Shallow Water Equations with Dry States. Ocean Modelling 72, 80–91 (2013).


text:
import {
    BaseMessage,
    ConnectionType,
    CometD,
    HandshakeListener,
    HandshakeMessage,
    Listener,
    Message,
    ReconnectAdvice,
    Status,
    SubscribeListener,
    SubscribeMessage,
    SuccessfulHandshakeMessage,
    SubscriptionHandle,
    UnsuccessfulHandshakeMessage,
} from "cometd";
import TimeSyncExtension from 'cometd/TimeSyncExtension';
import AckExtension from 'cometd/AckExtension';
import BinaryExtension from 'cometd/BinaryExtension';

const cometd = new CometD();

function assertNever(value: never): never {
    throw new Error(`Unexpected value: ${value}`);
}
function validateStatus(status: Status) {
    switch (status) {
        case 'connected': return true;
        case 'connecting': return true;
        case 'disconnected': return true;
        case 'disconnecting': return true;
        case 'handshaking': return true;
        default: return assertNever(status);
    }
}

validateStatus(cometd.getStatus());

// Configuring
// ===========

cometd.configure("http://localhost:8080/cometd");

cometd.configure({
    url: "http://localhost:8080/cometd"
});

cometd.registerExtension("ack", new AckExtension());
cometd.registerExtension("binary", new BinaryExtension());

const timesync = new TimeSyncExtension();
cometd.registerExtension("timesync", timesync);

const timeSyncSubscription = cometd.addListener("/foo/bar", () => {
    if (timesync.getNetworkLag() > 1000) {
        cometd.publish("/mychannel", { timesyncStats: {
                lag: timesync.getNetworkLag(),
                serverTime: timesync.getServerTime(),
                serverDate: timesync.getServerDate(),
                timeOffset: timesync.getTimeOffset(),
                timeOffsetSamples: timesync.getTimeOffsetSamples()
            }
        });
    }
});

cometd.unregisterTransport("websocket");

// Handshaking
// ===========

cometd.handshake(handshakeReply => {
    if (handshakeReply.successful) {
        // Successfully connected to the server.

        if (handshakeReply.reestablish) {
            // Restablished a connection to the server.
        }

        const { advice, supportedConnectionTypes } = handshakeReply;

        const callbackPollingType: ConnectionType = 'callback-polling';

        if (supportedConnectionTypes.indexOf(callbackPollingType) > -1) {
            // Callback polling is supported by the server.
        }

        if (advice && advice.reconnect === 'none') {
            // Server advises not to reconnect, CometD will stop attempting to connect or handshake.
        }
    }

    if (!handshakeReply.successful) {
        const { error } = handshakeReply;
    }
});

const additionalInfoHandshake = {
    "com.acme.credentials": {
        user: "cometd",
        token: "xyzsecretabc"
    }
};
cometd.handshake(additionalInfoHandshake, handshakeReply => {
    if (handshakeReply.successful) {
        // Successfully connected to the server.
        validateStatus(cometd.getStatus());
    }
});

cometd.init("http://host1:8080/cometd");

// Subscribing and Unsubscribing
// =============================

cometd.subscribe(
    "/foo",
    message => {},
    subscribeReply => {
        if (subscribeReply.successful) {
            // The server successfully subscribed this client to the "/foo" channel.
        }
    }
);

const additionalInfoSubscribe = {
    "com.acme.priority": 10
};
cometd.subscribe("/foo", message => {}, additionalInfoSubscribe, subscribeReply => {
    if (subscribeReply.successful) {
        // The server successfully subscribed this client to the "/foo" channel.
    }
});

const subscription1 = cometd.addListener("/meta/connect", () => {});
const subscription2 = cometd.subscribe("/foo/bar/", () => {});

cometd.unsubscribe(subscription2);
cometd.removeListener(subscription1);

const subscription3 = cometd.subscribe("/foo/bar/", () => {});

const additionalInfoUnsubscribe = {
    "com.acme.discard": true
};
cometd.unsubscribe(subscription3, additionalInfoUnsubscribe, unsubscribeReply => {
    const { subscription } = unsubscribeReply;
});

// Subscribers versus Listeners
// ============================

let _reportListener: SubscriptionHandle | undefined;

cometd.addListener("/meta/handshake", message => {
    // Only subscribe if the handshake is successful
    if (message.successful) {
        // Batch all subscriptions together
        cometd.batch(() => {
            // Correct to subscribe to broadcast channels
            cometd.subscribe("/members", m => {
                const { subscription } = m;
            });

            // Correct to subscribe to service channels
            cometd.subscribe("/service/status", m => {
                const { subscription } = m;
            });

            // Messy to add listeners after removal, prefer using cometd.subscribe(...)
            if (_reportListener) {
                cometd.removeListener(_reportListener);
                _reportListener = cometd.addListener("/service/report", m => {});
            }

            // Wrong to add listeners without removal
            cometd.addListener("/service/notification", m => {});
        });
    }
});

// Dynamic Resubscription
// ======================

let _subscription: SubscriptionHandle | undefined;

class Controller {
    dynamicSubscribe = () => {
        _subscription = cometd.subscribe("/dynamic", this.onEvent);
    }

    onEvent = (message: Message) => {
        if (message.successful) {
            // Your logic here.
        }
    }

    dynamicUnsubscribe = () => {
        if (_subscription) {
            cometd.unsubscribe(_subscription);
            _subscription = undefined;
        }
    }
}

cometd.addListener("/meta/handshake", message => {
    if (message.successful) {
        cometd.batch(() => {
            // Static subscription, no need to remember the subscription handle
            cometd.subscribe("/static", () => {});

            // Dynamic re-subscription
            if (_subscription) {
                _subscription = cometd.resubscribe(_subscription);
            }
        });
    }
});

// Listeners and Subscribers Exception Handling
// ============================================

cometd.onListenerException = function(exception, subscriptionHandle, isListener, message) {
    // Uh-oh, something went wrong, disable this listener/subscriber
    // Object "this" points to the CometD object
    if (isListener) {
        this.removeListener(subscriptionHandle);
    } else {
        this.unsubscribe(subscriptionHandle);
    }
};

// Meta Channel List
// =================

let _connected = false;

cometd.addListener("/meta/connect", message => {
    validateStatus(cometd.getStatus());

    if (cometd.isDisconnected()) {
        return;
    }

    const wasConnected = _connected;
    _connected = message.successful;
    if (!wasConnected && _connected) {
        // Reconnected
    } else if (wasConnected && !_connected) {
        // Disconnected
    }
});

cometd.addListener("/meta/disconnect", message => {
    validateStatus(cometd.getStatus());

    if (message.successful) {
        _connected = false;
    }
});

// Publishing
// ==========

cometd.publish("/mychannel", { mydata: { foo: "bar" } });

cometd.publish("/mychannel", { mydata: { foo: "bar" } }, publishAck => {
    if (publishAck.successful) {
        // The message reached the server
    }
});

// Publishing Binary Data
// ======================

// Create an ArrayBuffer.
const buffer = new ArrayBuffer(4);

// Fill it with the bytes.
const view = new DataView(buffer);
view.setUint8(0, 0xca);
view.setUint8(1, 0xfe);
view.setUint8(2, 0xba);
view.setUint8(3, 0xbe);

// Send it.
cometd.publishBinary("/binary", view, true, { prolog: "java" });

// Disconnecting
// =============

cometd.disconnect(disconnectReply => {
    validateStatus(cometd.getStatus());

    if (disconnectReply.successful) {
        // Server truly received the disconnect request
    }

    if (disconnectReply.successful) {
        const { error } = disconnectReply;
    }
});

const additionalInfoDisconnect = {
    "com.acme.reset": false
};
cometd.disconnect(additionalInfoDisconnect, disconnectReply => {
    if (disconnectReply.successful) {
        // Server truly received the disconnect request
    }
});

// Message Batching
// ================

cometd.batch(() => {
    cometd.publish("/channel1", { product: "foo" });
    cometd.publish("/channel2", { notificationType: "all" });
    cometd.publish("/channel3", { update: false });
});

// Alternatively, but not recommended:
cometd.startBatch();
cometd.publish("/channel1", { product: "foo" });
cometd.publish("/channel2", { notificationType: "all" });
cometd.publish("/channel3", { update: false });
cometd.endBatch();


text:
author: roundcrisis
comments: true
date: 2013-01-28 23:22:02+00:00
layout: post
slug: a-build-system-for-games
title: A build system for games
wordpress_id: 1046
categories:
- c#
- gamedev
- unit-testing
- xna
tags:
- build server
- gamedev
- monogame
- teamcity
- xna
---

As you might or might not know, I am one of the founders of BatCat Games, the important word about that sentence is **games. **The fact that we make games put a series of differences into our production that doesn't generally affect non game software development cycles.

For a start art and animation are key in a game, so are visual effects. In build server terms, that generally means two things: It requires space(for content building) and quite probably a graphics card (for the visual effects). Our ideal solution would be to have a virtual machine per supported platform , but we found that none of the virtualization software (VirtualBox, VMWare, etc) virtualizes the graphics card reliably (if you found a way, please let me know)  so we are running our server on a non virtual machine.

The objective is to build the whole game, tools, etc. at each commit. There are a series of tools available in the market at the moment that allows you to do just that. For example: TeamCity, Jenkins, CruiseControl, Hudson.. etc. There is a good comparison matrix [here](http://confluence.public.thoughtworks.org/display/CC/CI+Feature+Matrix).

We chose [TeamCity](http://www.jetbrains.com/teamcity/), mostly because we know it, we find it easy to use and it is free.

### Our setup

Our code is based around XNA and [monoGame](http://monogame.net/) (recently on version 3).

We have many projects: a game and engine project, a tool, a library and the content builder. This means we have a diverse project output. For example, in the case of the content, we are not interested in the actual build results (yet) however we are interested in knowing that it did build, and to report errors if it didn't.

The game and engine project reside in one solution and have many unit tests. We need the build server to not only build the project and after that run the unit and integration tests. Initially I set this up using [psake](https://github.com/psake/psake) (a tool that does the build with PowerShell) this is a great solution if you want to have a one click build, so I gave it a try, I found that setting up the tests assemblies was a manual process and that to get psake to talk to TeamCity nicely it would take more time that I had. So I tried running the build directly from TeamCity, and it was easier and I didn't loose to much flexibility so, I had to go for that solution (however is a decision I will revisit shortly).

[![Capture](http://roundcrisis.files.wordpress.com/2013/01/capture_thumb.png)](http://roundcrisis.files.wordpress.com/2013/01/capture.png)

Setting up each of the steps took me approximately 10~20 minutes if done this way. There are a few things that I want to improve on, however the end result is that in a very short time I can have a new project building and reporting.

Some of the disadvantages of the process as it is are:

  1. If I want to change the build type I need to do it manually, in this case, the target test assemblies will need to be updated

  2. At the moment we are using dropbox as our way to distribute the builds, it is a process some members of our team really like because they just get the new binaries and they can choose when to update (so that there is no friction). I would prefer if the tools would just auto-update, but this is working for the moment.

### Summary

As you can see the server setup is not perfect, there is loads to improve on, but setting this up from early on has proven very helpful. It allows us to have a one click build and a functional way to deliver our tools and product to the people in our team.

Note: This post was cross posted to [gamasutra](http://www.gamasutra.com/blogs/AndreaMagnorsky/20130129/185631/A_build_system_for_games.php), Thanks to [Kris ](http://www.twitter.com/KrisLigman) for her help.


text:
using System;
using System.Collections.Concurrent;
using static System.Environment;

namespace Greatbone
{
    /// <summary>
    /// A global byte/char buffer pool.
    /// </summary>
    public static class BufferUtility
    {
        // we use number of processor cores as a factor
        static readonly int factor = (int) Math.Log(ProcessorCount, 2) + 1;

        // pool of byte buffers
        static readonly Queue<byte[]>[] bPool =
        {
            new Queue<byte[]>(1024 * 4, factor * 32),
            new Queue<byte[]>(1024 * 16, factor * 16),
            new Queue<byte[]>(1024 * 64, factor * 16),
            new Queue<byte[]>(1024 * 256, factor * 8),
            new Queue<byte[]>(1024 * 1024, factor * 8)
        };

        // pool of char buffers
        static readonly Queue<char[]>[] cPool =
        {
            new Queue<char[]>(1024 * 1, factor * 16),
            new Queue<char[]>(1024 * 4, factor * 8),
            new Queue<char[]>(1024 * 16, factor * 8),
            new Queue<char[]>(1024 * 64, factor * 4)
        };

        public static byte[] GetByteBuffer(int demand)
        {
            // locate the queue
            for (int i = 0; i < bPool.Length; i++)
            {
                var queue = bPool[i];
                if (queue.Spec < demand) continue;
                if (!queue.TryDequeue(out var buf))
                {
                    buf = new byte[queue.Spec];
                }

                return buf;
            }

            // out of queues scope
            return new byte[demand];
        }

        public static void Return(byte[] buf)
        {
            int len = buf.Length;
            for (int i = 0; i < bPool.Length; i++)
            {
                var queue = bPool[i];
                if (queue.Spec == len) // the right queue to add
                {
                    if (queue.Count < queue.Limit)
                    {
                        queue.Enqueue(buf);
                    }
                }
                else if (queue.Spec > len)
                {
                    break;
                }
            }
        }

        public static char[] GetCharBuffer(int demand)
        {
            // locate the queue
            for (int i = 0; i < cPool.Length; i++)
            {
                var queue = cPool[i];
                if (queue.Spec < demand) continue;
                if (!queue.TryDequeue(out var buf))
                {
                    buf = new char[queue.Spec];
                }

                return buf;
            }

            // out of queues scope
            return new char[demand];
        }

        public static void Return(char[] buf)
        {
            int len = buf.Length;
            for (int i = 0; i < cPool.Length; i++)
            {
                var queue = cPool[i];
                if (queue.Spec == len) // the right queue to add
                {
                    if (queue.Count < queue.Limit)
                    {
                        queue.Enqueue(buf);
                    }
                }
                else if (queue.Spec > len)
                {
                    break;
                }
            }
        }

        public static bool Return(DynamicContent dcont)
        {
            if (dcont.IsBinary) // is a byte buffer
            {
                Return(dcont.ByteBuffer);
            }
            else
            {
                Return(dcont.CharBuffer);
            }

            return true;
        }

        class Queue<B> : ConcurrentQueue<B>
        {
            readonly int limit;

            // buffer size in bytes
            readonly int spec;

            internal Queue(int spec, int limit)
            {
                this.spec = spec;
                this.limit = limit;
            }

            internal int Spec => spec;

            internal int Limit => limit;
        }
    }
}


text:
/* jshint node: true */
'use strict';

module.exports = {
  name: 'ember-cli-browserstack'
};


text:
CompoundLists/loose-shallow.md

Item 1
Item 1 lazy continuation

Item 2
Item 2 continuation

Loose Item 3
 Item 3 deep indent continuation

Item 4
Item 4 lazy continuation
Item 4 continuation
 Item 4 deep indent continuation

Loose Item 5
Item 5 lazy continuation

Item 5 paragraph 1
Item 5 paragraph 1 lazy continuation
Item 5 paragraph 1 continuation
 Item 5 paragraph 1 deep indent continuation

Item 5 code block 1
    Item 5 code block 1 indented 1
        Item 5 code block indented x2
    Item 5 code block 1 indented 2
Item 5 code block 1.2

Item 5 paragraph 2
Item 5 paragraph 2 lazy continuation
Item 5 paragraph 2 continuation
 Item 5 paragraph 2 deep indent continuation

    Item 5 code block 2
        Item 5 code block 2 indented 1
            Item 5 code block indented x2
        Item 5 code block 2 indented 2
    Item 5 code block 2.2

Loose Item 6

Loose Item 7 after many blank lines

now the same for bullet lists

should be the same list


text:
using System;
using System.Collections.Generic;
using System.Text;
using BookStore.UI;
using BookStore.Domain;
using System.Data;

namespace BookStore.Controllers
{
    public class AddUserController : BaseController<IAddUserView>
    {
        readonly IAddUserView view = ApplicationFactory.CreateAddUserView();

        public override IAddUserView View
        {
            get { return view; }
        }

        protected override void DoRun()
        {
            view.GetDataFromUser();
            try
            {
                User user = new User(view.UserName, view.UserFirstName, view.UserLastName);
                ApplicationFactory.GetLibrary().AddUser(user);
            }
            catch (DuplicateNameException e)
            {
                view.ShowError("Could not create user because the name " + view.UserName + " is not unique",e);
                return;
            }
            catch (Exception e)
            {
                view.ShowError("Could not create user because: " + e.Message, e);
                return;
            }

            view.ShowMessage("Successfully created " + view.UserName);
        }

    }
}


text:
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
#if !DOTNETCORE
using AsciiDocNet;
using Nest.Litterateur.AsciiDoc;
#endif

namespace Nest.Litterateur.Documentation.Files
{
	public class RawDocumentationFile : DocumentationFile
	{
		public RawDocumentationFile(FileInfo fileLocation) : base(fileLocation) { }

		public override void SaveToDocumentationFolder()
		{
			//we simply do a copy of the markdown file
			var docFileName = this.CreateDocumentationLocation();

#if !DOTNETCORE
			var document = Document.Load(FileLocation.FullName);

			// make any modifications
			var rawVisitor = new RawAsciidocVisitor(FileLocation);
			document.Accept(rawVisitor);

			// write out asciidoc to file
			using (var visitor = new AsciiDocVisitor(docFileName.FullName))
			{
				document.Accept(visitor);
			}
#else
			this.FileLocation.CopyTo(docFileName.FullName, true);
#endif
		}

		protected override FileInfo CreateDocumentationLocation()
		{
			var testFullPath = this.FileLocation.FullName;
			var testInDocumenationFolder = Regex.Replace(testFullPath, @"(^.+\\Tests\\|\" + this.Extension + "$)", "").PascalToHyphen() + this.Extension;

			var documenationTargetPath = Path.GetFullPath(Path.Combine(Program.OutputDirPath, testInDocumenationFolder));
			var fileInfo = new FileInfo(documenationTargetPath);
			if (fileInfo.Directory != null)
				Directory.CreateDirectory(fileInfo.Directory.FullName);
			return fileInfo;
		}
	}
}


text:
static NSMutableArray *__groups;
NSArray *dispatch_groups() {
    if (!__groups) {
        __groups = [NSMutableArray array];
    }
    return __groups;
}

@interface STDispatchGroup : NSObject

@property (nonatomic, strong) NSMutableArray *tasks;

+ (NSMutableArray *)groups;
- (void)enqueue:(dispatch_block_t)task;

@end

static dispatch_group_t (*real_dispatch_group_create)(void);
dispatch_group_t st_dispatch_group_create(void) {
    if (STDispatch.behavior == STDispatchBehaviorAsynchronous) {
        return real_dispatch_group_create();
    } else {
        STDispatchGroup *group = [[STDispatchGroup alloc] init];
        [STDispatchGroup.groups addObject:group];
        return (dispatch_group_t)group;
    }
}

static void (*real_dispatch_group_async)(dispatch_group_t, dispatch_queue_t, dispatch_block_t);
void st_dispatch_group_async(dispatch_group_t group, dispatch_queue_t queue, dispatch_block_t block) {
    if (STDispatch.behavior == STDispatchBehaviorAsynchronous) {
        real_dispatch_group_async(group, queue, block);
    } else {
        [(id)queue enqueue:block];
        [(id)group enqueue:block];
    }
}

@implementation STDispatchGroup

+ (void)beforeEach {
    [self.groups removeAllObjects];
}

+ (void)initialize {
    real_dispatch_group_create = proxy_dispatch_group_create;
    proxy_dispatch_group_create = st_dispatch_group_create;

    real_dispatch_group_async = proxy_dispatch_group_async;
    proxy_dispatch_group_async = st_dispatch_group_async;
}

+ (NSMutableArray *)groups {
    if (!__groups) { dispatch_groups(); }
    return __groups;
}

- (instancetype)init {
    if (self = [super init]) {
        self.tasks = [NSMutableArray array];
    }
    return self;
}

- (void)enqueue:(dispatch_block_t)task {
    [self.tasks addObject:task];
}

@end


text:
'use strict';

describe('Module: angularTouchNav', function () {
  var scope, $sandbox, $compile, $timeout;

  // load the controller's module
  beforeEach(module('ngTouchNav'));

  beforeEach(inject(function ($injector, $rootScope, _$compile_, _$timeout_) {
    scope = $rootScope;
    $compile = _$compile_;
    $timeout = _$timeout_;

    $sandbox = $('

').appendTo($('body'));
  }));

  afterEach(function() {
    $sandbox.remove();
    scope.$destroy();
  });

  var templates = {
    'default': {
      scope: {},
      element: '

'
    }
  };

  function compileDirective(template) {
    template = template ? templates[template] : templates['default'];
    angular.extend(scope, template.scope || templates['default'].scope);
    var $element = $(template.element).appendTo($sandbox);
    $element = $compile($element)(scope);
    scope.$digest();
    return $element;
  }

  it('should correctly display hello world', function () {
    var elm = compileDirective();
    expect('hello world').toBe('hello world');
  });

});


text:
from aloe import *
from ensime_shared.symbol_format import *
from unittest import TestCase

tc = TestCase("__init__")

@step('Parameter type with name (.+)')
def given_parameter_type(step, tname):
    world.ptype = {"name": tname}

@step('We format the type')
def format_parameter_type(step):
    world.formatted = formatted_param_type(world.ptype)

@step('We get the format (.+)')
def get_formatted(step, expected_format):
    tc.assertEqual(world.formatted, expected_format)

@step('A list of type parameters:')
def given_a_list_of_type_parameters(step):
    world.tparams = [tp['tparam'] for tp in step.hashes]

@step('A list of parameters:')
def given_a_list_of_parameters(step):
    world.params = [(p['pname'], p['ptype']) for p in step.hashes]

@step('We concat the parameters')
def concat_parameters(step):
    world.formatted = concat_params(world.params)

@step('We get the empty string')
def get_formatted(step):
    tc.assertEqual(world.formatted, "")

@step('The section is (.*)implicit')
def section_implicit(step, implicit):
    world.implicit = implicit != 'not '

@step('We format the section')
def format_section(step):
    params = [(p[0], {"name": p[1]}) for p in world.params]
    section = {
        "params": params,
        "isImplicit": world.implicit
    }
    world.formatted = formatted_param_section(section)

@step('Completion with typehint (.+)')
def given_completion_callable(step, typehint):
    world.typehint = typehint

@step('TypeInfo with type (.+)')
def typeinfo_with_type(step, ctype):
    world.ctype = ctype

@step('TypeInfo with resultType (.+)')
def typeinfo_with_return_type(step, crtype):
    world.crtype = crtype

@step('We format the completion type')
def format_completion_type(step):
    world.completion = {
        "typeInfo": {
            "name": world.ctype,
            "typehint": world.typehint,
            "resultType": {"name": world.crtype}
        }
    }
    world.formatted = formatted_completion_type(world.completion)

@step('Name is (.+)')
def name_is(step, name):
    world.name = name

def hash_to_section(h):
    return {
        "params": [(h["pname"], {"name": h["ptype"]})],
        "isImplicit": h["implicit"] == "True"
    }

@step('Sections:')
def sections(step):
    world.sections = list(map(hash_to_section, step.hashes))

@step('We format the signature')
def format_sig(step):
    completion = {
        "name": world.name,
        "typeInfo": {
            "typehint": world.typehint,
            "paramSections": world.sections
        }
    }
    world.formatted = formatted_completion_sig(completion)

def hash_to_completion(h):
    completion = {
        "name": h["name"],
        "typeInfo": {
            "typehint": h["typehint"],
            "name": h["ctype"]
        }
    }

    if h["crtype"]:
        completion["typeInfo"]["resultType"] = {"name": h["crtype"]}

    completion["typeInfo"]["paramSections"] = [hash_to_section(h)] if h["pname"] else []
    return completion

@step('We have the following completions:')
def we_have_completions(step):
    world.completions = list(map(hash_to_completion, step.hashes))

@step('We convert completions to suggestions')
def convert_completions_to_suggestions(step):
    world.suggestions = list(map(completion_to_suggest, world.completions))

@step('We get the following suggestions')
def we_get_suggestions(step):
    expected_suggestions = list(step.hashes)
    for i in range(len(expected_suggestions)):
        expected_suggestions[i]["dup"] = 1
    tc.assertEqual(world.suggestions, expected_suggestions)


text:
use crate::cgmath::Matrix;
use crate::core::misc::read_file;
use crate::core::types::MInt;
use crate::visualizer::types::{Color4, ColorId, MFloat, MatId};
use cgmath::Matrix4;
use gl::types::{GLchar, GLenum, GLint, GLuint};
use glfw::with_c_str;
use std::path::Path;

pub struct Shader {
    id: GLuint,
}

impl Shader {
    pub fn new(vs_path: &Path, fs_path: &Path) -> Shader {
        // set_error_context!("loading shader (vs)", vs_path.as_str().unwrap());
        // set_error_context!("loading shader (fs)", fs_path.as_str().unwrap());
        compile_program(&read_file(vs_path), &read_file(fs_path))
    }

    pub fn activate(&self) {
        unsafe {
            verify!(gl::UseProgram(self.id));
        }
    }

    pub fn enable_attr(&self, name: &str, components_count: MInt) {
        let mut attr_id = 0;
        // let c_name = CString::new(name).unwrap();
        with_c_str(name, |n| unsafe {
            attr_id = verify!(gl::GetAttribLocation(self.id, n));
        });
        unsafe {
            verify!(gl::EnableVertexAttribArray(attr_id as GLuint));
        }
        let normalized = gl::FALSE;
        let stride = 0;
        unsafe {
            verify!(gl::VertexAttribPointer(
                attr_id as GLuint,
                components_count,
                gl::FLOAT,
                normalized,
                stride,
                std::ptr::null(),
            ));
        }
    }

    pub fn uniform_mat4f(&self, mat_id: MatId, mat: &Matrix4<MFloat>) {
        unsafe {
            verify!(gl::UniformMatrix4fv(
                mat_id.id as MInt,
                1,
                gl::FALSE,
                mat.as_ptr(),
            ));
        }
    }

    pub fn uniform_color(&self, color_id: ColorId, color: Color4) {
        unsafe {
            let data_ptr = std::mem::transmute(&color);
            verify!(gl::Uniform4fv(color_id.id as MInt, 1, data_ptr));
        }
    }

    pub fn get_uniform(&self, name: &str) -> GLuint {
        with_c_str(name, |name| unsafe {
            verify!(gl::GetUniformLocation(self.id, name) as GLuint)
        })
    }
}

impl Drop for Shader {
    fn drop(&mut self) {
        unsafe {
            verify!(gl::DeleteProgram(self.id));
        }
    }
}

fn compile_shader(src: &str, shader_type: GLenum) -> GLuint {
    unsafe {
        let shader = verify!(gl::CreateShader(shader_type));
        with_c_str(src, |s| {
            verify!(gl::ShaderSource(shader, 1, &s, std::ptr::null()));
        });
        verify!(gl::CompileShader(shader));
        let mut status = gl::FALSE as GLint;
        verify!(gl::GetShaderiv(shader, gl::COMPILE_STATUS, &mut status));
        if status != (gl::TRUE as GLint) {
            let mut len = 0;
            verify!(gl::GetShaderiv(shader, gl::INFO_LOG_LENGTH, &mut len));
            // subtract 1 to skip the trailing null character
            // let mut buf = std::vec::from_elem(len as u8 - 1, 0);
            let mut buf = vec![0_u8; (len) as usize];
            verify!(gl::GetShaderInfoLog(
                shader,
                len,
                std::ptr::null_mut(),
                buf.as_mut_ptr() as *mut GLchar
            ));
            panic!("compile_shader: {}", String::from_utf8(buf).unwrap());
        }
        shader
    }
}

fn link_program(vertex_shader: GLuint, fragment_shader: GLuint) -> GLuint {
    unsafe {
        let program = verify!(gl::CreateProgram());
        verify!(gl::AttachShader(program, vertex_shader));
        verify!(gl::AttachShader(program, fragment_shader));
        verify!(gl::LinkProgram(program));
        let mut status = gl::FALSE as GLint;
        verify!(gl::GetProgramiv(program, gl::LINK_STATUS, &mut status));
        if status != (gl::TRUE as GLint) {
            let mut len = 0;
            verify!(gl::GetProgramiv(program, gl::INFO_LOG_LENGTH, &mut len));
            // subtract 1 to skip the trailing null character
            let mut buf = std::vec::from_elem(len as u8 - 1, 0_usize);
            verify!(gl::GetProgramInfoLog(
                program,
                len,
                std::ptr::null_mut(),
                buf.as_mut_ptr() as *mut GLchar
            ));
            panic!("link_program: {}", String::from_utf8(buf).unwrap());
        }
        program
    }
}

fn compile_program(vertex_shader_src: &str, frag_shader_src: &str) -> Shader {
    let vertex_shader = compile_shader(vertex_shader_src, gl::VERTEX_SHADER);
    let fragment_shader = compile_shader(frag_shader_src, gl::FRAGMENT_SHADER);
    let program = link_program(vertex_shader, fragment_shader);
    // mark shaders for deletion after program deletion
    unsafe {
        verify!(gl::DeleteShader(fragment_shader));
        verify!(gl::DeleteShader(vertex_shader));
    }
    Shader { id: program }
}

// vim: set tabstop=4 shiftwidth=4 softtabstop=4 expandtab:


text:
package com.onlinelibrary.Test;

import com.onlinelibrary.DAO.UserDAOImpl;
import com.onlinelibrary.Model.User;

public class Test {

	public static void main(String[] args) {
		UserDAOImpl dao = new UserDAOImpl();

		// Add new user
        User user = new User();
        user.setName("Carl");
        user.setSurname("Smith");
        user.setEmail("carl.smith@gmail.com");
        user.setPassword("strongpsswd");
        dao.create(user);

        // Update user
        user.setEmail("carl.smith.updated@gmail.com");
        dao.update(user);

        // Delete user
        dao.delete(user.getId());

        // Get all users
        for (User iter : dao.getAll()) {
            System.out.println(iter);
        }

        // Get user by id
        System.out.println(dao.get(2));

		return;
	}
}


text:
"""
Simple example illustrating Qt Charts capabilities to plot curves with
a high number of points, using OpenGL accelerated series
"""

from PyQt5.QtChart import QChart, QChartView, QLineSeries
from PyQt5.QtGui import QPolygonF, QPainter
from PyQt5.QtWidgets import QMainWindow

import numpy as np

def series_to_polyline(xdata, ydata):
    """Convert series data to QPolygon(F) polyline

    This code is derived from PythonQwt's function named
    `qwt.plot_curve.series_to_polyline`"""
    size = len(xdata)
    polyline = QPolygonF(size)
    pointer = polyline.data()
    dtype, tinfo = np.float, np.finfo  # integers: = np.int, np.iinfo
    pointer.setsize(2 * polyline.size() * tinfo(dtype).dtype.itemsize)
    memory = np.frombuffer(pointer, dtype)
    memory[:(size - 1) * 2 + 1:2] = xdata
    memory[1:(size - 1) * 2 + 2:2] = ydata
    return polyline

class TestWindow(QMainWindow):
    def __init__(self, parent=None):
        super(TestWindow, self).__init__(parent=parent)
        self.ncurves = 0
        self.chart = QChart()
        self.chart.legend().hide()
        self.view = QChartView(self.chart)
        self.view.setRenderHint(QPainter.Antialiasing)
        self.setCentralWidget(self.view)

    def set_title(self, title):
        self.chart.setTitle(title)

    def add_data(self, xdata, ydata, color=None):
        curve = QLineSeries()
        pen = curve.pen()
        if color is not None:
            pen.setColor(color)
        pen.setWidthF(2.0)
        curve.setPen(pen)
        curve.setUseOpenGL(True)
        curve.append(series_to_polyline(xdata, ydata))
        self.chart.addSeries(curve)
        self.chart.createDefaultAxes()
        self.ncurves += 1

if __name__ == '__main__':
    import sys
    from PyQt5.QtWidgets import QApplication
    from PyQt5.QtCore import Qt
    app = QApplication(sys.argv)

    window = TestWindow()

    npoints = 100
    xdata = np.linspace(0., 10., npoints)
    window.add_data(xdata, np.sin(xdata), color=Qt.red)
    window.add_data(xdata, np.cos(xdata), color=Qt.blue)
    window.set_title("Simple example with %d curves of %d points "
                     "(OpenGL Accelerated Series)"
                     % (window.ncurves, npoints))
    window.setWindowTitle("Simple performance example")
    window.show()
    window.resize(500, 400)

    sys.exit(app.exec_())


text:
<!DOCTYPE html>

    <meta content="en-us" http-equiv="Content-Language" />
    <meta content="text/html; charset=utf-16" http-equiv="Content-Type" />
    <title _locid="PortabilityAnalysis0">.NET Portability Report</title>

.NET Portability Report

                    Submission Id
                    a285326b-e63a-4d9d-8fa2-f98642940689

            Portability Summary

                        Assembly
                            ASP.NET 5,Version=v1.0
                            Windows,Version=v8.1
                            .NET Framework,Version=v4.6
                            Windows Phone,Version=v8.1

                            SmartFormat
                                96.18 %
                                94.44 %
                                100.00 %
                                94.44 %

SmartFormat

                                Target type
                                ASP.NET 5,Version=v1.0
                                Windows,Version=v8.1
                                .NET Framework,Version=v4.6
                                Windows Phone,Version=v8.1
                                Recommended changes

                                    System.ComponentModel.InvalidEnumArgumentException

                                Use a different Exception type such as System.ArgumentOutOfRangeException

                                        #ctor

                                    System.Reflection.BindingFlags

                                    System.Reflection.MemberInfo

                                use "is FieldInfo", "is PropertyInfo", etc

                                        get_MemberType

                                    use "is FieldInfo", "is PropertyInfo", etc

                                    System.Reflection.MemberTypes

                                Use is operator.  Example:  if (membertype == membertypes.Field) --> if (member is FieldInfo)

                                    System.Reflection.PropertyInfo

                                Use PropertyInfo.GetMethod property

                                        GetGetMethod

                                    Use PropertyInfo.GetMethod property

                                    System.Runtime.Remoting.Messaging.CallContext

                                Consider using System.Threading.AsyncLocal<T>

                                        LogicalGetData(System.String)

                                        LogicalSetData(System.String,System.Object)

                                    System.StringComparer

                                CompareInfo.GetStringComparer

                                        get_InvariantCulture

                                    It is almost always incorrect to using InvariantCulture for string equality, see http://msdn.microsoft.com/en-us/library/dd465121(v=vs.110).aspx. The most common replacement is StringComparer.Ordinal, otherwise, if you need InvariantCulture, use CultureInfo.InvariantCulture.ComparerInfo.GetStringComparer(CompareOptions).

                                        get_InvariantCultureIgnoreCase

                                    CompareInfo.GetStringComparer

                                    System.Threading.Thread

                                        get_CurrentThread

                                        get_ManagedThreadId

                                    System.Type

                                .GetTypeInfo().IsEnum

                                        get_IsEnum

                                    .GetTypeInfo().IsEnum

                                        GetMember(System.String,System.Reflection.BindingFlags)

                    Back to Summary


text:
package com.google.gerrit.server.project;

import com.google.common.collect.Lists;
import com.google.gerrit.extensions.api.projects.BanCommitInput;
import com.google.gerrit.extensions.restapi.RestApiException;
import com.google.gerrit.extensions.restapi.UnprocessableEntityException;
import com.google.gerrit.server.git.BanCommitResult;
import com.google.gerrit.server.permissions.PermissionBackendException;
import com.google.gerrit.server.project.BanCommit.BanResultInfo;
import com.google.gerrit.server.update.BatchUpdate;
import com.google.gerrit.server.update.RetryHelper;
import com.google.gerrit.server.update.RetryingRestModifyView;
import com.google.gerrit.server.update.UpdateException;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jgit.lib.ObjectId;

@Singleton
public class BanCommit
    extends RetryingRestModifyView<ProjectResource, BanCommitInput, BanResultInfo> {
  private final com.google.gerrit.server.git.BanCommit banCommit;

  @Inject
  BanCommit(RetryHelper retryHelper, com.google.gerrit.server.git.BanCommit banCommit) {
    super(retryHelper);
    this.banCommit = banCommit;
  }

  @Override
  protected BanResultInfo applyImpl(
      BatchUpdate.Factory updateFactory, ProjectResource rsrc, BanCommitInput input)
      throws RestApiException, UpdateException, IOException, PermissionBackendException {
    BanResultInfo r = new BanResultInfo();
    if (input != null && input.commits != null && !input.commits.isEmpty()) {
      List<ObjectId> commitsToBan = new ArrayList<>(input.commits.size());
      for (String c : input.commits) {
        try {
          commitsToBan.add(ObjectId.fromString(c));
        } catch (IllegalArgumentException e) {
          throw new UnprocessableEntityException(e.getMessage());
        }
      }

      BanCommitResult result =
          banCommit.ban(rsrc.getNameKey(), rsrc.getUser(), commitsToBan, input.reason);
      r.newlyBanned = transformCommits(result.getNewlyBannedCommits());
      r.alreadyBanned = transformCommits(result.getAlreadyBannedCommits());
      r.ignored = transformCommits(result.getIgnoredObjectIds());
    }
    return r;
  }

  private static List<String> transformCommits(List<ObjectId> commits) {
    if (commits == null || commits.isEmpty()) {
      return null;
    }
    return Lists.transform(commits, ObjectId::getName);
  }

  public static class BanResultInfo {
    public List<String> newlyBanned;
    public List<String> alreadyBanned;
    public List<String> ignored;
  }
}


text: Page Not Found


text:
<?php
   ob_start();
   session_start();
?>
<?php
include 'header.php';
?>
<?php
include 'scripts.php';
?>

<?php

$uid = $_SESSION['userid'];
// Database Operations

$servername = "localhost";
$username = "sgstudio_mips";
$password = "MIPSroot";
$dbname = "sgstudio_mips";

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
     die("Connection failed: " . $conn->connect_error);
}

$query_string = "select * from masterdata where id = '$uid'";
$query = mysqli_query($conn,$query_string);
if (mysqli_num_rows($query) > 0) {
    while($row = mysqli_fetch_assoc($query)) {
      $id = $row["id"];
    	$email= $row["email"];
      $pic = $row["pic"];
      $name = $row["name"];
      $npi = $row["npi"];
      $tin = $row["tin"];
      $mscore = $row["mscore"];
      $mustage = $row["mustage"];
      $payout = $row["payout"];
      $ccn = $row["ccn"];
      $speciality = $row["speciality"];
      $zipcode = $row["zipcode"];
      $city = $row["city"];
      $address = $row["address"];
      $phone = $row["phone"];
      $education = $row["education"];
      $acceptsMedicare = $row["acceptsMedicare"];
      $ach = $row['ach'];
      $cmecredits = $row["cmecredits"];
    }
  }

?>

PROFILE

<img src="assets/images/<?php echo $pic;?>" class="userpic"/>

<?php echo $ach;?>

Name

<?php echo strtoupper($name);?>

NPI

<?php echo $npi;?>

TIN

<?php echo $tin;?>

2015 MU

STAGE <?php echo $mustage;?>

2014 SCORE

MIPS <?php echo $mscore;?>

2014 PAYOUT

<?php echo $payout;?>

Program Participation History

Personal Info

Alerts

Customer Support

CME Credits

<?php echo $cmecredits;?>

Linked Accounts

App Achievements

Logout


text:
vagrant ssh manager -c "sudo su - stack -c 'cd ~/devstack && ./clean.sh'"
vagrant ssh manager -c "sudo sed -i '/api/d' /etc/hosts"
vagrant ssh manager -c "echo '127.0.0.1 localhost' | sudo tee -a /etc/hosts"

VBOX_ID=$(VBoxManage list vms | grep 'devstack-vagrant_manager' | awk '{print $2}')
NAME=devstack-vagrant-`date +%Y%m%d`
vagrant package --base $VBOX_ID --output $NAME.box $NAME


text:
package org.lightadmin.core.config.domain.unit.visitor;

public interface VisitableConfigurationUnit {

    void accept(ConfigurationUnitVisitor<VisitableConfigurationUnit> configurationUnitVisitor);

}


text:
/**
 *  A class to test the creation of a new contact
 */

package ru.stqa.pft.addressbook.tests.ui.contacts;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.thoughtworks.xstream.XStream;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import ru.stqa.pft.addressbook.data.ContactData;
import ru.stqa.pft.addressbook.data.GroupData;
import ru.stqa.pft.addressbook.generator.BaseGenerator;
import ru.stqa.pft.addressbook.model.Contacts;
import ru.stqa.pft.addressbook.tests.ui.BaseTests;

import java.io.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;

public class ContactCreationTests extends BaseTests {
    @DataProvider
    public Iterator<Object[]> generateValidContacts() {
        List<Object[]> list = new ArrayList<>();
        for (int i = 0; i < BaseGenerator.generateRandom(5); i++) {
            list.add(new Object[]{new ContactData()});
        }
        return list.iterator();
    }

    @DataProvider
    public Iterator<Object[]> loadValidContactsXml() throws IOException {
        try (BufferedReader reader = new BufferedReader(new FileReader("src/test/resources/contacts.xml"))) {
            String xml = "";
            String line = reader.readLine();
            while (line != null) {
                xml += line;
                line = reader.readLine();
            }
            XStream xStream = new XStream();
            List<ContactData> groups = (List<ContactData>) xStream.fromXML(xml);
            return groups.stream().map((g) -> new Object[]{g}).collect(Collectors.toList()).iterator();
            }
    }

    @DataProvider
    public Iterator<Object[]> loadValidContactsJson() throws IOException {
        try (BufferedReader reader = new BufferedReader(new FileReader("src/test/resources/contacts.json"))) {
            String json = "";
            String line = reader.readLine();
            while (line != null) {
                json += line;
                line = reader.readLine();
            }
            Gson gson = new Gson();
            List<ContactData> contacts = gson.fromJson(json, new TypeToken<List<GroupData>>() {
            }.getType());
            return contacts.stream().map((g) -> new Object[]{g}).collect(Collectors.toList()).iterator();
        }
    }

    @BeforeMethod
    public void ensurePrecondition() {
        app.getNavigationHelper().gotoHomePage();
    }

    @Test(dataProvider = "generateValidContacts")
    // Base test creation contact
    public static void testContactCreationVer1(ContactData contact) {
        List<ContactData> beforeContactList = app.getContactHelper().getContactList();

        contact.setPhoto(new File("src/test/resources/image1.jpg"));

        app.getContactHelper().initContactCreation();
        app.getContactHelper().fillContactForm(contact);
        app.getContactHelper().submitModification();

        app.getNavigationHelper().returnToHomePage();

        // Check on the number of elements
        Assert.assertEquals(app.getContactHelper().getContactCount(), beforeContactList.size() + 1);

        List<ContactData> afterContactList = app.getContactHelper().getContactList();

        // Check on the number of elements
        Assert.assertEquals(afterContactList.size(), beforeContactList.size() + 1);

        // Find the maximum Id and assign the created element
        for (ContactData c : afterContactList) {
            if (c.getContactId() > contact.getContactId()) {
                contact.setContactId(c.getContactId());
            }
        }
        /* implementation without the for loop
        contact.setContactId(afterContactList.stream().max((o1, o2) -> Integer.compare(o1.getContactId(), o2.getContactId())).get().getContactId());
         */
        beforeContactList.add(contact);

        /* Sort the list by id
        Comparator<? super ContactData> byId = (c1, c2) -> Integer.compare(c1.getContactId(), c2.getContactId());
        beforeContactList.sort(byId);
        afterContactList.sort(byId);
        */

        // Check elements for identity verification
        Assert.assertEquals(new HashSet<Object>(beforeContactList), new HashSet<Object>(afterContactList));
    }

    @Test(dataProvider = "loadValidContactsXml")
    // Test creation contact fluent implementation
    public static void testContactCreationVer2(ContactData contact) {
        Contacts beforeContactSet = app.getContactHelper().all();

        contact.setPhoto(new File("src/test/resources/image2.png"));

        app.getContactHelper().initContactCreation();
        app.getContactHelper().fillContactForm(contact);
        app.getContactHelper().submitModification();

        app.getNavigationHelper().returnToHomePage();

        // Check on the number of elements
        assertThat(app.getContactHelper().getContactCount(), equalTo(beforeContactSet.size() + 1));

        Contacts afterContactSet = app.getContactHelper().all();

        // Check elements for identity verification
        assertThat(afterContactSet, equalTo(beforeContactSet.withAdded(contact.setContactId(afterContactSet.stream().mapToInt((g) -> g.getContactId()).max().getAsInt()))));
    }
}


text:
package org.neo4art.api.builder.mock.sentiment;

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

import org.neo4art.literature.domain.Letter;
import org.neo4art.sentiment.domain.SentimentAnalysis;

/**
 * @author Enrico De Benetti
 * @since 03 Mag 2015
 *
 */
public class BuildSentimentMock {

	public List<SentimentAnalysis> getSentimentAnalisys(String inputSearch){

	  List<SentimentAnalysis> resultList = new ArrayList<SentimentAnalysis>();

	  SentimentAnalysis sentimentAnalysis1 = new SentimentAnalysis();
	  sentimentAnalysis1.setNodeId(1);
	  sentimentAnalysis1.setPolarity("positive");
	  Letter sourceDocument1 = new Letter();
	  sourceDocument1.setDate("Sunday, 29 September 1884");
	  sentimentAnalysis1.setSource(sourceDocument1);

	  SentimentAnalysis sentimentAnalysis2 = new SentimentAnalysis();
	  sentimentAnalysis2.setNodeId(2);
	  sentimentAnalysis2.setPolarity("negative");
	  Letter sourceDocument2 = new Letter();
	  sourceDocument2.setDate("Monday, 30 September 1884");
	  sentimentAnalysis2.setSource(sourceDocument2);

	  SentimentAnalysis sentimentAnalysis3 = new SentimentAnalysis();
	  sentimentAnalysis3.setNodeId(3);
	  sentimentAnalysis3.setPolarity("positive");
	  Letter sourceDocument3 = new Letter();
	  sourceDocument3.setDate("Saturday, 26 October 1884");
	  sentimentAnalysis3.setSource(sourceDocument3);

	  SentimentAnalysis sentimentAnalysis4 = new SentimentAnalysis();
	  sentimentAnalysis4.setNodeId(4);
	  sentimentAnalysis4.setPolarity("negative");
	  Letter sourceDocument4 = new Letter();
	  sourceDocument4.setDate("Friday, 13 December 1884");
	  sentimentAnalysis4.setSource(sourceDocument4);

	  SentimentAnalysis sentimentAnalysis5 = new SentimentAnalysis();
	  sentimentAnalysis5.setNodeId(5);
	  sentimentAnalysis5.setPolarity("negative");
	  Letter sourceDocument5 = new Letter();
	  sourceDocument5.setDate("Tuesday, 28 January 1885");
	  sentimentAnalysis5.setSource(sourceDocument5);

	  resultList.add(sentimentAnalysis1);
	  resultList.add(sentimentAnalysis2);
	  resultList.add(sentimentAnalysis3);
	  resultList.add(sentimentAnalysis4);
	  resultList.add(sentimentAnalysis5);

	 return resultList;
	}

}


text:
package com.jinwen.thread.multithread.timer.example4;

import java.util.Timer;
import java.util.TimerTask;

/**
 * P256
 * schedule(TimerTask task, long delay, long period)方法
 * long类型
 * 在延时的情况下,若执行任务被延时,下次执行任务的开始时间是上一次任务的开始时间作为参考点
 */
public class Run4_schedule6 {
    static public class MyTask extends TimerTask {
        @Override
        public void run() {
            try {
                System.out.println("begin timer=" + System.currentTimeMillis());
                Thread.sleep(5000);
                System.out.println("end   timer=" + System.currentTimeMillis());
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String[] args) {
        MyTask task = new MyTask();
        System.out.println("当前时间:" + System.currentTimeMillis());
        Timer timer = new Timer();
        timer.schedule(task, 3000, 2000);
    }
}

/*
输出:
当前时间:1460737882848
begin timer=1460737885849
end   timer=1460737890849
begin timer=1460737890849
end   timer=1460737895849
begin timer=1460737895849
end   timer=1460737900850
begin timer=1460737900850
 */


text:
package com.utama.madtodo.fragments;

import java.text.DateFormat;
import java.util.Date;

import com.utama.madtodo.R;
import com.utama.madtodo.models.LocalTodo;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * The Class DetailsFragment represents a fragment that contains a form for viewing details of an
 * existing task record.
 */
public class DetailsFragment extends Fragment implements ViewUpdateable {

  /** The name text view. */
  protected TextView nameTextView;

  /** The description text view. */
  protected TextView descriptionTextView;

  /** The expiry text view. */
  protected TextView expiryTextView;

  /** The "is important" text view. */
  protected TextView isImportantTextView;

  /** The "is done" text view. */
  protected TextView isDoneTextView;

  /**
   * Inflate fragment_details.xml, setup the member variables and bind listener classes to them.
   *
   * @see android.app.Fragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup,
   *      android.os.Bundle)
   */
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_details, container);

    nameTextView = (TextView) view.findViewById(R.id.nameTextView);
    descriptionTextView = (TextView) view.findViewById(R.id.descriptionTextView);
    expiryTextView = (TextView) view.findViewById(R.id.listItemExpiryTextView);
    isImportantTextView = (TextView) view.findViewById(R.id.isImportantTextView);
    isDoneTextView = (TextView) view.findViewById(R.id.isDoneTextView);

    return view;
  }

  /**
   * This method will set up the text views with the data of a task.
   *
   * @param id The local task id to retrieve.
   * @see com.utama.madtodo.fragments.ViewUpdateable#updateView(long)
   */
  @Override
  public void updateView(long id) {
    if (id != -1) {
      LocalTodo todo = LocalTodo.findOne(id);

      if (todo != null) {
        nameTextView.setText(todo.getName());
        descriptionTextView.setText(todo.getDescription());

        Date expiry = todo.getExpiry();

        // Format text for due date
        if (expiry.getTime() > 0) {
          String expDate = DateFormat.getDateInstance().format(expiry);
          String expTime = DateFormat.getTimeInstance(DateFormat.SHORT).format(expiry);
          String expText = String.format(getString(R.string.task_due_text), expDate, expTime);
          expiryTextView.setText(expText);
        } else
          expiryTextView.setText(getString(R.string.task_no_due_text));

        if (todo.isImportant())
          isImportantTextView.setText(getString(R.string.task_important_text));
        else
          isImportantTextView.setText(getString(R.string.task_not_important_text));

        if (todo.isMarkedDone())
          isDoneTextView.setText(getString(R.string.task_done_text));
        else
          isDoneTextView.setText(getString(R.string.task_not_done_text));
      }
    } else {
      nameTextView.setText("");
      descriptionTextView.setText("");
      expiryTextView.setText("");
      isImportantTextView.setText("");
      isDoneTextView.setText("");
    }
  }

}


text:
namespace sober {
namespace network {
namespace http {
namespace unittest {

class Response : public utils::Test {
 public:
  using Pointer = std::unique_ptr<http::Response>;

  // Workaround for private constructor
  Pointer make_response(const std::string& message, delegate::Interface& d) {
    return Pointer(new http::Response(message, d));
  }

  virtual ~Response() override;
};

Response::~Response() {
}

TEST_F(Response, content_length_good) {
  std::string message(
      "HTTP/1.1 200 OK\r\n"
      "Date: Sun, 27 Apr 2014 19:02:53 GMT\r\n"
      "Server: Apache\r\n"
      "Content-Length: 12\r\n"
      "Content-Type: text/html;charset=ISO-8859-1\r\n"
      "\r\n"
      "Hello, body!"
  );

  delegate::String delegate;

  ASSERT_FALSE(delegate.ready());
  auto response = make_response(message, delegate);
  ASSERT_TRUE(delegate.ready());

  ASSERT_EQ(
      response->header().status_line.status_code,
      response::attribute::StatusCode::OK
  );
  ASSERT_STREQ("Hello, body!", delegate.body().c_str());
}

TEST_F(Response, content_length_bad) {
  std::string message(
      "HTTP/1.1 200 OK\r\n"
      "Date: Sun, 27 Apr 2014 19:02:53 GMT\r\n"
      "Server: Apache\r\n"
      "Content-Length: 13\r\n" // <--- bad size, must be 12
      "Content-Type: text/html;charset=ISO-8859-1\r\n"
      "\r\n"
      "Hello, body!"
  );

  delegate::String delegate;

  ASSERT_FALSE(delegate.ready());
  ASSERT_THROW(make_response(message, delegate), std::runtime_error);
  ASSERT_FALSE(delegate.ready());
}

TEST_F(Response, chunked_simple) {
  std::string message(
      "HTTP/1.1 200 OK\r\n"
      "Server: nginx\r\n"
      "Date: Sun, 27 Apr 2014 14:44:25 GMT\r\n"
      "Content-Type: application/json; charset=utf-8\r\n"
      "Transfer-Encoding: chunked\r\n"
      "Connection: keep-alive\r\n"
      "Access-Control-Allow-Origin: *\r\n"
      "Access-Control-Allow-Credentials: true\r\n"
      "Access-Control-Allow-Methods: GET, POST\r\n"
      "\r\n"
      "1\r\n"
      "A\r\n"
      "2\r\n"
      "BC\r\n"
      "0\r\n"
      "\r\n"
  );

  delegate::String delegate;

  ASSERT_FALSE(delegate.ready());
  auto response = make_response(message, delegate);
  ASSERT_TRUE(delegate.ready());

  ASSERT_STREQ("ABC", delegate.body().c_str());
  ASSERT_EQ(
      response->header().status_line.status_code,
      response::attribute::StatusCode::OK
  );
}

TEST_F(Response, chunked_forbidden) {
  std::string message(
      "HTTP/1.1 403 Forbidden\r\n"
      "Server: cloudflare-nginx\r\n"
      "Date: Thu, 15 May 2014 07:02:54 GMT\r\n"
      "Content-Type: text/html; charset=UTF-8\r\n"
      "Transfer-Encoding: chunked\r\n"
      "Connection: keep-alive\r\n"
      "Set-Cookie: __cfduid=; expires=Mon, 23-Dec-2019 23:50:00 GMT;"
          " path=/; HttpOnly\r\n"
      "Cache-Control: max-age=15\r\n"
      "Expires: Thu, 15 May 2014 07:03:09 GMT\r\n"
      "CF-RAY: -AMS\r\n"
      "\r\n"
      "0\r\n"
      "\r\n"
  );

  delegate::String delegate;

  ASSERT_FALSE(delegate.ready());
  auto response = make_response(message, delegate);
  ASSERT_TRUE(delegate.ready());
  ASSERT_STREQ("", delegate.body().c_str());

  ASSERT_EQ(
      response->header().status_line.status_code,
      response::attribute::StatusCode::FORBIDDEN
  );
}

TEST_F(Response, chunked_real) {
  std::string message(
      "HTTP/1.1 200 OK\r\n"
      "Server: nginx\r\n"
      "Date: Sun, 27 Apr 2014 14:44:25 GMT\r\n"
      "Content-Type: application/json; charset=utf-8\r\n"
      "Transfer-Encoding: chunked\r\n"
      "Connection: keep-alive\r\n"
      "Access-Control-Allow-Origin: *\r\n"
      "Access-Control-Allow-Credentials: true\r\n"
      "Access-Control-Allow-Methods: GET, POST\r\n"
      "\r\n"
      "1ad\r\n"
      "{\"coord\":{\"lon\":-95.56,\"lat\":33.66},\"sys\":{\"message\":"
      "0.0337,\"country\":\"US\",\"sunrise\":1398598610,\"sunset\":1398646960}"
      ",\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":"
      "\"sky is clear\",\"icon\":\"01d\"}],\"base\":\"cmc stations\",\"main\""
      ":{\"temp\":296.15,\"pressure\":1001,\"humidity\":73,\"temp_min\":296.15"
      ",\"temp_max\":296.15},\"wind\":{\"speed\":5.7,\"deg\":170},\"rain\":"
      "{\"3h\":1},\"clouds\":{\"all\":1},\"dt\":1398605700,\"id\":4717560,"
      "\"name\":\"Paris\",\"cod\":200}\n\r\n"
      "0\r\n"
      "\r\n"
  );

  delegate::String delegate;

  ASSERT_FALSE(delegate.ready());
  auto response = make_response(message, delegate);
  ASSERT_TRUE(delegate.ready());
  ASSERT_EQ(
      response->header().status_line.status_code,
      response::attribute::StatusCode::OK
  );
}

TEST_F(Response, chunked_fail) {
  std::string message(
      "HTTP/1.1 200 OK\r\n"
      "Server: nginx\r\n"
      "Date: Wed, 21 May 2014 10:56:04 GMT\r\n"
      "Content-Type: application/json; charset=utf-8\r\n"
      "Transfer-Encoding: chunked\r\n"
      "Connection: keep-alive\r\n"
      "Access-Control-Allow-Origin: *\r\n"
      "Access-Control-Allow-Credentials: true\r\n"
      "Access-Control-Allow-Methods: GET, POST\r\n"
      "\r\n"
      "1e4\r\n"
      "{\"coord\":{\"lon\":-74.26,\"lat\":4.73},"
      "\"sys\":{\"message\":0.0092,\"country\":\"CO\","
      "\"sunrise\":1400668981,\"sunset\":1400713462},"
      "\"weather\":[{\"id\":804,\"main\":\"Clouds\","
      "\"description\":\"overcast clouds\",\"icon\":\"04n\"}],"
      "\"base\":\"cmc stations\",\"m"
  );

  delegate::String delegate;

  ASSERT_FALSE(delegate.ready());
  ASSERT_THROW(make_response(message, delegate), std::runtime_error);
  ASSERT_FALSE(delegate.ready());
}

TEST_F(Response, location) {
  std::string message(
      "HTTP/1.1 200 OK\r\n"
      "Location: http://some.location.com\r\n"
      "Content-Length: 12\r\n"
      "\r\n"
      "Hello, body!"
  );

  delegate::String delegate;

  ASSERT_FALSE(delegate.ready());
  const auto response = make_response(message, delegate);
  ASSERT_TRUE(delegate.ready());
  ASSERT_TRUE(response->header().location.is_initialized());
  ASSERT_STREQ(
      response->header().location.get().string().c_str(),
      "http://some.location.com"
  );
}

TEST_F(Response, no_location) {
  std::string message(
      "HTTP/1.1 200 OK\r\n"
      "Content-Length: 12\r\n"
      "\r\n"
      "Hello, body!"
  );

  delegate::String delegate;

  ASSERT_FALSE(delegate.ready());
  const auto response = make_response(message, delegate);
  ASSERT_TRUE(delegate.ready());
  ASSERT_FALSE(response->header().location.is_initialized());
}

} // namespace unittest
} // namespace http
} // namespace network
} // namespace sober

#include <leathers/pop>