text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <title>Lunatech management realises MBO</title>
    <meta name="description" content="" />

    <meta name="HandheldFriendly" content="True" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="shortcut icon" href="https://pepite.github.io/hubpress.io/favicon.ico">

    <link rel="stylesheet" type="text/css" href="//pepite.github.io/hubpress.io/themes/casper/assets/css/screen.css?v=1505825289200" />
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic|Open+Sans:700,400" />

    <link rel="canonical" href="https://pepite.github.io/hubpress.io/2015/12/22/Lunatech-management-realises-MBO.html" />
    <meta name="referrer" content="origin" />

    <meta property="og:site_name" content="Lunatech's engineer blog" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="Lunatech management realises MBO" />
    <meta property="og:description" content="Ray Kemp and Nicolas Leroux, jointly CEO, have successfully realized a management buy-out ("MBO") of Lunatech Labs BV ("Lunatech"). Also, some staff members acquired a small stake in the company in this transaction. Lunatech is a Dutch IT service provider specialised in system integration, customised software implementation and web applications." />
    <meta property="og:url" content="https://pepite.github.io/hubpress.io/2015/12/22/Lunatech-management-realises-MBO.html" />
    <meta property="article:tag" content="company" />

    <meta name="twitter:card" content="summary" />
    <meta name="twitter:title" content="Lunatech management realises MBO" />
    <meta name="twitter:description" content="Ray Kemp and Nicolas Leroux, jointly CEO, have successfully realized a management buy-out ("MBO") of Lunatech Labs BV ("Lunatech"). Also, some staff members acquired a small stake in the company in this transaction. Lunatech is a Dutch IT service provider specialised in system integration, customised software implementation and web applications." />
    <meta name="twitter:url" content="https://pepite.github.io/hubpress.io/2015/12/22/Lunatech-management-realises-MBO.html" />

    <meta name="generator" content="HubPress" />
    <link rel="alternate" type="application/rss+xml" title="Lunatech's engineer blog" href="https://pepite.github.io/hubpress.io/rss/" />

Lunatech management realises MBO

                <time class="post-date" datetime="2015-12-22">22 December 2015</time>  on company

Ray Kemp and Nicolas Leroux, jointly CEO, have successfully realized a management buy-out ("MBO") of Lunatech Labs BV ("Lunatech"). Also, some staff members acquired a small stake in the company in this transaction. Lunatech is a Dutch IT service provider specialised in system integration, customised software implementation and web applications.

Main Corporate Finance has structured the MBO and arranged the debt financing. Bank financing has been provided by Rabobank. The transaction was partly financed with a mezzanine loan provided by Main Mezzanine Capital.Lunatech stands out in linking and structuring applications between back-end and front-end. Lunatech provides support for complex IT system integration and migration projects and they support IT departments of organisations. The company offers high quality solutions including consultancy and supplying project teams of Scala professionals.

Lunatech was founded in 1993 and located in Rotterdam. Lunatech provides its services to proven customers in the Netherlands and France, as for example: ING, SDU, Alcatel, Disney and UPS.

The strength of Lunatech is also recognised by the investors, says Lars van 't Hoenderdaal:

"Lunatech is a very nice company with a strong management team and international growth potential. We experienced great interest among our funders to participate in this mezzanine proposition."

After reaching agreement on the transaction structure and financing structure, the transaction has been completed within 4 weeks. Rabobank has also shown their strength by acting quickly.

Ray Kemp, CEO Lunatech, is very satisfied with the realised MBO:

"Due to funding from the bank and mezzanine we were able to realise the MBO without a private equity investor. In this way we can realise our growth independently."

Main Mezzanine Capital is part of Main Capital Partners, an investment and financing company, as well as a corporate finance advisor, with a focus on growing and profitable companies in the TMT sector in the Netherlands. Main Mezzanine Capital is funded by its own shareholders, wealthy individuals, family offices and (former) entrepreneurs, who like to invest in companies with an interesting risk-return profile.

                Antoinelunatech's Picture

Antoinelunatech

Read more posts by this author.

Share this post

                    Twitter

                    Facebook

                    Google+

Lunatech's engineer blog © 2017

Proudly published with HubPress


text:
package com.aegeus.engine.config;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ConfigFormat {
    String name() default "";

    String longName() default "";

    boolean arg() default true;
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.tiles.request;

/**
 * Delegate for ease of customization.
 *
 * @version $Rev: 1215002 $ $Date: 2011-12-16 01:27:17 +0100 (Fri, 16 Dec 2011) $
 */
public interface RequestWrapper extends Request {

    /**
     * Returns the wrapped Tiles request.
     *
     * @return The wrapped Tiles request.
     */
    Request getWrappedRequest();

}


text:
BOOT-INF文件夹的生成.md

使用这个插件生成的文件夹
```
<plugin>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

```

如果什么也不配置,这个项目的源代码将不会打包到进去
可能会报错:main class is not found

需要配置
<start-class>cn.yeamoney.service.ipc.Application</start-class>

```
<plugin>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-maven-plugin</artifactId>
	<!-- defined in spring-cloud-starter-parent pom (as documentation hint),
		but needs to be repeated here -->
	<configuration>
		<requiresUnpack>
			<dependency>
				<groupId>com.netflix.eureka</groupId>
				<artifactId>eureka-core</artifactId>
			</dependency>
			<dependency>
				<groupId>com.netflix.eureka</groupId>
				<artifactId>eureka-client</artifactId>
			</dependency>
		</requiresUnpack>
	</configuration>
</plugin>
```

上面的配置将会把源码打包进去

#### BOOT-INF文件夹的生成会造成Ebean的 springboot jar 项目找不到需要enhance的类

因为他会把所有的依赖包放在 和classes并排的lib文件夹下面,里面都是jar包
否则都是源文件 。


text:
package io.chymyst.util

import scala.language.higherKinds

trait LabeledType[X] {
  type T

  /** Convert a collection of raw type `X` into a collection of labeled type.
    * This does not iterate over the collection and does not allocate memory.
    *
    * @param xs A collection of raw type.
    * @tparam F The collection's type constructor.
    * @return Collection of labeled type.
    */
  def maptype[F[_]](xs: F[X]): F[T]

  /** Convert a collection of labeled type into a collection of raw type `X`.
    * This does not iterate over the collection and does not allocate memory.
    *
    * @param ts A collection of labeled type.
    * @tparam F The collection's type constructor.
    * @return Collection of raw type.
    */
  def unmaptype[F[_]](ts: F[T]): F[X]

  /** Convert a value of raw type `X` into a labeled type.
    * No memory allocation is performed during this conversion.
    *
    * @param x A value of raw type `X`.
    * @return A value of labeled type.
    */
  def apply(x: X): T

  /** Convert a value of labeled type into a value of the raw type `X`.
    * No memory allocation is performed during this conversion.
    *
    * @param t A value of labeled type.
    * @return A value of corresponding raw type.
    */
  def get(t: T): X
}

trait LabeledSubtype[X] {
  type T <: X

  /** Convert a value of raw type `X` into a labeled type.
    * This does not iterate over the collection and does not allocate memory.
    *
    * @param x A value of raw type `X`.
    * @return A value of labeled type.
    */
  def apply(x: X): T

  /** Convert a collection of raw type `X` into a collection of labeled type.
    *
    * @param xs A collection of raw type.
    * @tparam F The collection's type constructor.
    * @return Collection of labeled type.
    */
  def maptype[F[_]](xs: F[X]): F[T]
}

/** Light-weight type aliases.
  * Unlike type classes, these type aliases never perform any memory allocation at run time.
  */
object LabeledTypes {

  /** Define a type alias for an existing type `X`.
    * Example usage:
    * {{{
    *   val UserName = Newtype[String]
    *   type UserName = UserName.T // optional, for convenience
    *
    *   val x = UserName("user 1") // create a UserName
    *   val length = UserName.get(x).length // need conversion to recover the underlying String
    * }}}
    * The new type `UserName.T` will not be the same as `X` and will not be a subtype of `X`.
    *
    * @tparam X An existing type.
    * @return A constructor for a new type alias.
    */
  def Newtype[X]: LabeledType[X] = new LabeledType[X] {
    type T = X

    def maptype[F[_]](fs: F[X]): F[T] = fs

    def unmaptype[F[_]](fs: F[T]): F[X] = fs

    def apply(x: X): T = x

    def get(lbl: T): X = lbl
  }

  /** Define a subtype alias for an existing type `X`.
    * Example usage:
    * {{{
    *   val UserName = Subtype[String]
    *   type UserName = UserName.T // optional, for convenience
    *
    *   val x = UserName("user 1") // create a UserName
    *   val length = x.length // recover and use the underlying String without conversion
    * }}}
    * The new type `UserName.T` will not be the same as `String` but will be a subtype of `String`.
    * Due to subtyping, conversion from `UserName` back to `String` is immediate and requires no code.
    * Also, conversion of `List[UserName]` back to `List[String]` is immediate.
    *
    * @tparam X An existing type.
    * @return A constructor for a new type alias.
    */
  def Subtype[X]: LabeledSubtype[X] = new LabeledSubtype[X] {
    type T = X

    def maptype[F[_]](fs: F[X]): F[T] = fs

    def apply(x: X): T = x
  }
}


text:
import {AUTH_ERROR, LOGIN_SUCCESS, LOGOUT_SUCCESS} from './constants';

export const status = (state = false, {type}) => {
    switch (type) {
        case LOGIN_SUCCESS:
            return true;
        case AUTH_ERROR:
        case LOGOUT_SUCCESS:
            return false;
        default:
            return state;
    }
};

export const error = (state = null, {type, payload}) => {
    switch (type) {
        case LOGIN_SUCCESS:
        case LOGOUT_SUCCESS:
            return null;
        case AUTH_ERROR:
            return payload;
        default:
            return state;
    }
};

export const loading = (state = true, {type}) => {
    switch (type) {
        case LOGIN_SUCCESS:
        case AUTH_ERROR:
            return false;
        default:
            return state;
    }
};


text:
namespace Examples.Data
{
    using Models;
    using System;
    using System.Data.Entity;
    using System.Linq;

    public class ExamplesModel : DbContext
    {
        // Your context has been configured to use a 'ExamplesModel' connection string from your application's
        // configuration file (App.config or Web.config). By default, this connection string targets the
        // 'Examples.Data.ExamplesModel' database on your LocalDb instance.
        //
        // If you wish to target a different database and/or database provider, modify the 'ExamplesModel'
        // connection string in the application configuration file.
        public ExamplesModel()
            : base("name=ExamplesModel")
        {
        }

        public virtual DbSet<Example> Examples { get; set; }
    }
}


text:
package org.jbpm.executor.impl.wih;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

import java.util.Map;
import java.util.Properties;

import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.jbpm.executor.ExecutorServiceFactory;
import org.jbpm.runtime.manager.impl.DefaultRegisterableItemsFactory;
import org.jbpm.services.task.identity.JBossUserGroupCallbackImpl;
import org.jbpm.test.util.AbstractBaseTest;
import org.jbpm.test.util.TestUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.kie.api.executor.ExecutorService;
import org.kie.api.io.ResourceType;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.manager.RuntimeEngine;
import org.kie.api.runtime.manager.RuntimeEnvironment;
import org.kie.api.runtime.manager.RuntimeEnvironmentBuilder;
import org.kie.api.runtime.manager.RuntimeManager;
import org.kie.api.runtime.manager.RuntimeManagerFactory;
import org.kie.api.runtime.process.ProcessInstance;
import org.kie.api.runtime.process.WorkItemHandler;
import org.kie.api.task.UserGroupCallback;
import org.kie.internal.io.ResourceFactory;
import org.kie.internal.runtime.manager.RuntimeManagerRegistry;
import org.kie.internal.runtime.manager.context.EmptyContext;

import bitronix.tm.resource.jdbc.PoolingDataSource;

public class AsyncWorkItemHandlerTest extends AbstractBaseTest {

    private PoolingDataSource pds;
    private UserGroupCallback userGroupCallback;
    private RuntimeManager manager;
    private ExecutorService executorService;
    private EntityManagerFactory emf = null;
    @Before
    public void setup() {
        TestUtil.cleanupSingletonSessionId();
        pds = TestUtil.setupPoolingDataSource();
        Properties properties= new Properties();
        properties.setProperty("mary", "HR");
        properties.setProperty("john", "HR");
        userGroupCallback = new JBossUserGroupCallbackImpl(properties);
        executorService = buildExecutorService();
    }

    @After
    public void teardown() {
        executorService.destroy();
        if (manager != null) {
            RuntimeManagerRegistry.get().remove(manager.getIdentifier());
            manager.close();
        }
        if (emf != null) {
        	emf.close();
        }
        pds.close();
    }

    @Test
    public void testRunProcessWithAsyncHandler() throws Exception {

        RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder()
                .userGroupCallback(userGroupCallback)
                .addAsset(ResourceFactory.newClassPathResource("BPMN2-ScriptTask.bpmn2"), ResourceType.BPMN2)
                .registerableItemsFactory(new DefaultRegisterableItemsFactory() {

                    @Override
                    public Map<String, WorkItemHandler> getWorkItemHandlers(RuntimeEngine runtime) {

                        Map<String, WorkItemHandler> handlers = super.getWorkItemHandlers(runtime);
                        handlers.put("async", new AsyncWorkItemHandler(executorService, "org.jbpm.executor.commands.PrintOutCommand"));
                        return handlers;
                    }

                })
                .get();

        manager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);
        assertNotNull(manager);

        RuntimeEngine runtime = manager.getRuntimeEngine(EmptyContext.get());
        KieSession ksession = runtime.getKieSession();
        assertNotNull(ksession);

        ProcessInstance processInstance = ksession.startProcess("ScriptTask");
        assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());

        Thread.sleep(3000);

        processInstance = runtime.getKieSession().getProcessInstance(processInstance.getId());
        assertNull(processInstance);
    }

    @Test
    public void testRunProcessWithAsyncHandlerWithAbort() throws Exception {

        RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder()
                .userGroupCallback(userGroupCallback)
                .addAsset(ResourceFactory.newClassPathResource("BPMN2-ScriptTask.bpmn2"), ResourceType.BPMN2)
                .registerableItemsFactory(new DefaultRegisterableItemsFactory() {

                    @Override
                    public Map<String, WorkItemHandler> getWorkItemHandlers(RuntimeEngine runtime) {

                        Map<String, WorkItemHandler> handlers = super.getWorkItemHandlers(runtime);
                        handlers.put("async", new AsyncWorkItemHandler(executorService, "org.jbpm.executor.commands.PrintOutCommand"));
                        return handlers;
                    }

                })
                .get();

        manager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);
        assertNotNull(manager);

        RuntimeEngine runtime = manager.getRuntimeEngine(EmptyContext.get());
        KieSession ksession = runtime.getKieSession();
        assertNotNull(ksession);

        ProcessInstance processInstance = ksession.startProcess("ScriptTask");
        assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());

        runtime.getKieSession().abortProcessInstance(processInstance.getId());

        Thread.sleep(3000);

        processInstance = runtime.getKieSession().getProcessInstance(processInstance.getId());
        assertNull(processInstance);
    }

    @Test
    public void testRunProcessWithAsyncHandlerDuplicatedRegister() throws Exception {

        RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder()
                .userGroupCallback(userGroupCallback)
                .addAsset(ResourceFactory.newClassPathResource("BPMN2-ScriptTask.bpmn2"), ResourceType.BPMN2)
                .registerableItemsFactory(new DefaultRegisterableItemsFactory() {

                    @Override
                    public Map<String, WorkItemHandler> getWorkItemHandlers(RuntimeEngine runtime) {

                        Map<String, WorkItemHandler> handlers = super.getWorkItemHandlers(runtime);
                        handlers.put("async", new AsyncWorkItemHandler(executorService, "org.jbpm.executor.commands.PrintOutCommand"));
                        return handlers;
                    }

                })
                .get();

        manager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);
        assertNotNull(manager);

        RuntimeEngine runtime = manager.getRuntimeEngine(EmptyContext.get());
        KieSession ksession = runtime.getKieSession();
        assertNotNull(ksession);

        ProcessInstance processInstance = ksession.startProcess("ScriptTask");
        assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());

        Thread.sleep(3000);

        processInstance = runtime.getKieSession().getProcessInstance(processInstance.getId());
        assertNull(processInstance);

        manager.close();

        manager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);

    }

    private ExecutorService buildExecutorService() {
        emf = Persistence.createEntityManagerFactory("org.jbpm.executor");

        executorService = ExecutorServiceFactory.newExecutorService(emf);

        executorService.init();

        return executorService;
    }
}


text:
package ua.stqa.pft.addressbook;

public class ContactData {
    private final String firstname;
    private final String lastname;
    private final String title;
    private final String company;
    private final String address;
    private final String home;
    private final String email;

    public ContactData(String firstname, String lastname, String title, String company, String address, String home, String email) {
        this.firstname = firstname;
        this.lastname = lastname;
        this.title = title;
        this.company = company;
        this.address = address;
        this.home = home;
        this.email = email;
    }

    public String getFirstname() {
        return firstname;
    }

    public String getLastname() {
        return lastname;
    }

    public String getTitle() {
        return title;
    }

    public String getCompany() {
        return company;
    }

    public String getAddress() {
        return address;
    }

    public String getHome() {
        return home;
    }

    public String getEmail() {
        return email;
    }
}


text:
SELECT * FROM SYSTEM_ATTRIBUTES
 WHERE
SYSTEM_NAME = ?
 AND DELETE_FLAG = 0;


text:
package org.willianzhao.omnitureanalysis.mapred.xplatformtxnattr.domain.transByTimezone.geoParse.mapreduce;

import org.willianzhao.omnitureanalysis.mapred.commons.model.TransactionGeography;
import org.willianzhao.omnitureanalysis.mapred.commons.model.TransactionRecord;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;
import java.util.Iterator;

/**
 * Created by weilzhao on 8/21/14.
 */
public class GeoParseReducer extends Reducer<Text,TransactionGeography,NullWritable,TransactionGeography> {
    @Override
    protected void setup(Context context) throws IOException, InterruptedException {
        super.setup(context);
    }

    @Override
    protected void reduce(Text key, Iterable<TransactionGeography> values, Context context) throws IOException, InterruptedException {
        Iterator<TransactionGeography> trItr = values.iterator();
        if (trItr.hasNext()) {
            TransactionGeography transactionGeography=trItr.next();
            NullWritable nullWritable=NullWritable.get();
            context.write(nullWritable,transactionGeography);
        }
    }
}


text:
<?php
namespace Froggy;

class Ribbet
{
    public function talk()
    {
        return 'urrrp';
    }
}


text:
<?php

namespace League\CLImate\TerminalObject\Basic;

class Border extends BasicTerminalObject
{
    /**
     * The character to repeat for the border
     *
     * @var string $char
     */
    protected $char = '-';

    /**
     * The length of the border
     *
     * @var integer $length
     */
    protected $length;

    public function __construct($char = null, $length = null)
    {
        $this->char($char)->length($length);
    }

    /**
     * Set the character to repeat for the border
     *
     * @param string $char
     *
     * @return Border
     */
    public function char($char)
    {
        $this->set('char', $char);

        return $this;
    }

    /**
     * Set the length of the border
     *
     * @param integer $length
     *
     * @return Border
     */
    public function length($length)
    {
        $this->set('length', $length);

        return $this;
    }

    /**
     * Return the border
     *
     * @return string
     */
    public function result()
    {
        $length = $this->length ?: $this->util->width() ?: 100;
        $str    = str_repeat($this->char, $length);
        $str    = substr($str, 0, $length);

        return $str;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using ILPathways.Library;
using ILPathways.Controllers;
using ILPathways.Utilities;
using GroupManager = Isle.BizServices.GroupServices;
using MyManager = Isle.BizServices.ContentServices;
using ILPathways.Business;
using AppUser = LRWarehouse.Business.Patron; //ILPathways.Business.AppUser;
using AcctManager = Isle.BizServices.AccountServices;

//prefer to prevent direct reference to LR
using LRWarehouse.Business;
using ResManager = Isle.BizServices.ResourceBizService;

namespace ILPathways.LRW.controls
{
    public partial class ResourcePage : BaseUserControl
    {
        const string thisClassName = "ResourcePage";
        MyManager myManager = new MyManager();

        #region Properties
        ///
        /// Set value used when check form privileges
        ///
        public string FormSecurityName
        {
            get { return this.txtFormSecurityName.Text; }
            set { this.txtFormSecurityName.Text = value; }
        }
        public int CurrentRecordID
        {
            get { return int.Parse( this.txtCurrentContentId.Text ); }
            set { this.txtCurrentContentId.Text = value.ToString(); }
        }
        public string resourceTitle;
        public string resourceSummary;
        public string resourceFrameSource;
        public string redirectTarget;

        #endregion

        ///
        /// Handle Page Load
        ///
        /// <param name="sender"></param>
        /// <param name="ex"></param>
        protected void Page_Load( object sender, EventArgs ex )
        {

            if ( !IsPostBack )
            {
                this.InitializeForm();
            }
        }//

        ///
        /// Perform form initialization activities
        ///
        private void InitializeForm()
        {
            if ( IsUserAuthenticated() )
            {
                CurrentUser = GetAppUser();
                if ( CurrentUser.ParentOrgId == -1 )
                {
                    CurrentUser.ParentOrgId = 0;
                    //get has not been attempted, do now
                    string statusMessage = string.Empty;
                    Organization org = AcctManager.GetOrganization( CurrentUser, ref statusMessage );
                    if ( org != null && org.Id > 0 )
                    {
                        CurrentUser.ParentOrgId = org.ParentId;
                    }
                    //update session
                    this.WebUser = CurrentUser;
                }
            }

            try
            {
                string rid = this.GetRequestKeyValue( "rid", "" );

                string _author = "";
                string _org = "";
                string request = Request.RawUrl;

                if ( Page.RouteData.Values.ContainsKey( "RouteID" ) )
                {
                    string _routeID = "";
                    if ( Page.RouteData.Values.Count > 0 )
                        _routeID = Page.RouteData.Values[ "RouteID" ].ToString();
                    else
                        _routeID = "";
                    if ( _routeID.Length > 0 && IsInteger( _routeID ) )
                    {
                        CurrentRecordID = Int32.Parse( _routeID );
                    }
                    else if ( _routeID.Length == 36 )
                    {
                        rid = _routeID;
                    }
                }
                if ( request.ToLower().IndexOf( "k12/home/" ) > -1 )
                {
                    if ( Page.RouteData.Values.ContainsKey( "OrgName" ) )
                    {
                        _org = Page.RouteData.Values[ "OrgName" ].ToString();
                        //look up district
                    }

                    if ( Page.RouteData.Values.ContainsKey( "Author" ) )
                    {
                        _author = Page.RouteData.Values[ "Author" ].ToString();
                        //look up author, use district, determine if home page exists
                    }
                }
                if ( rid.Trim().Length == 36 )
                {
                    this.Get( rid );
                }
                else
                {
                    if ( CurrentRecordID == 0 )
                    {
                        CurrentRecordID = this.GetRequestKeyValue( "cidx", 0 );
                    }
                    if ( CurrentRecordID > 0 )
                        Get( CurrentRecordID );
                }
                if ( CurrentRecordID == 0 )
                    SetConsoleErrorMessage( "Invalid page request" );
            }
            catch
            {
                SetConsoleErrorMessage( "Invalid ID specified" );
                return;
            }

        }	// End

        #region retrieval
        private ContentItem Get()
        {
            ContentItem entity = new ContentItem();
            string rid = this.GetRequestKeyValue( "rid", "" );
            if ( rid.Trim().Length == 36 )
            {
                entity = myManager.GetByRowId( rid );
            }
            else
            {
                int id = this.GetRequestKeyValue( "cidx", 0 );
                if ( id > 0 )
                    entity = myManager.Get( id );
            }
            return entity;
        }
        ///
        /// Get - retrieve form data
        ///
        /// <param name="recId"></param>
        private void Get( int recId )
        {
            try
            {
                ContentItem entity = myManager.Get( recId );

                if ( entity == null || entity.IsValid == false )
                {
                    this.SetConsoleErrorMessage( "Sorry the requested record does not exist" );
                    return;

                }
                else
                {
                    PopulateForm( entity );
                }

            }
            catch ( System.Exception ex )
            {
                //Action??		- display message and close form??
                LoggingHelper.LogError( ex, thisClassName + ".Get() - Unexpected error encountered" );
                this.SetConsoleErrorMessage( "Unexpected error encountered - Close this form and try again. (System Admin has been notified)
" + ex.ToString() );

            }

        }	// End method

        private void Get( string recId )
        {
            try
            {
                ContentItem entity = myManager.GetByRowId( recId );

                if ( entity == null || entity.IsValid == false )
                {
                    this.SetConsoleErrorMessage( "Sorry the requested record does not exist" );
                    return;

                }
                else
                {
                    PopulateForm( entity );
                }

            }
            catch ( System.Exception ex )
            {
                //Action??		- display message and close form??
                LoggingHelper.LogError( ex, thisClassName + ".Get() - Unexpected error encountered" );
                this.SetConsoleErrorMessage( "Unexpected error encountered - Close this form and try again. (System Admin has been notified)
" + ex.ToString() );

            }

        }	// End method

        ///
        /// Populate the form
        ///
        private void PopulateForm( ContentItem entity )
        {

            CurrentRecordID = entity.Id;
            resourceTitle = entity.Title;
            lblContentState.Text = "Status: " + entity.Status + "
"
                            + "Privileges: " + entity.PrivilegeType + "
";

            resourceSummary = entity.Summary;
            lblAuthor.Text = entity.Author;

            // check privileges to determine if current user/guest can view
            if ( CanView( entity ) == false )
            {
                pageContent.Text += privateContentMsg.Text;
                notAllowedPanel.Visible = true;
                return;
            }
            lblStatus.Text = entity.Status;
            if ( entity.StatusId > 0 )
            {
                string style = entity.Status.Replace( " ", "" ).ToLower();
                lblStatus.CssClass = style + "Status";
            }
            if ( entity.StatusId == ContentItem.PUBLISHED_STATUS )
            {
                statusDiv.Visible = false;
            }

            //Page Title
            Page.Title = entity.Title + " | ISLE OER";
            //OK
            detailPanel.Visible = true;

            lblPrivileges.Text = entity.PrivilegeType;
            lblUsageRights.Text = entity.ConditionsOfUse;
            if ( entity.ConditionsOfUseIconUrl.Length > 0 )
            {
                lblUsageRights.Text = string.Format( ccouImageLinkTemplate.Text, entity.ConditionsOfUseUrl,  entity.ConditionsOfUseIconUrl, entity.ConditionsOfUse );

            }

            pageContent.Text = entity.Description;

            resourceFrameSource = CurrentRecordID.ToString();
            if ( entity.ResourceVersionId > 0 )
            {
                communityViewPanel.Visible = true;
                ResourceVersion rv = ResManager.ResourceVersion_Get( entity.ResourceVersionId );
                string url = new PublishController().FormatFriendlyResourceUrl( rv );
                this.hlResourceVerionLink.NavigateUrl = url;    // string.Format( this.rvLink.Text, entity.ResourceVersionId );

            }
            else
            {
                communityViewPanel.Visible = false;
                this.hlResourceVerionLink.NavigateUrl = "";
                hlResourceVerionLink.Text = "Not available";
            }

            //get attachments
            PopulateSupplements( entity );
            //get references
            PopulateReferences( entity );
            //check for standards
            if ( entity.ResourceVersionId > 0)
                PopulateStandards( entity );

            if ( attachmentsPanel.Visible == false && referencesPanel.Visible == false && this.standardsPanel.Visible == false )
                supplementsPanel.Visible = false;

            buttonBox.Visible = false;
            if ( entity.StatusId == ContentItem.INPROGRESS_STATUS )
            {
                //TODO - need to handle updates. ON update, will not be publishing/
                //if has a LR RV record
                if ( entity.ResourceVersionId == 0 && UserCanPublishThisResource( entity ) )
                {
                    buttonBox.Visible = true;
                    publishSection.Visible = true;
                }

            }
            else if ( entity.StatusId == ContentItem.REVISIONS_REQUIRED_STATUS )
            {
                //TODO - need to handle updates. ON update, will not be publishing/
                //if has a LR RV record
                if ( UserCanPublishThisResource( entity ) )
                {
                    buttonBox.Visible = true;
                    requestApprovalButton.Visible = true;
                }

            }
            else if ( entity.StatusId == ContentItem.SUBMITTED_STATUS )
            {

                if ( UserCanApproveThisResource( entity ) )
                {
                    buttonBox.Visible = true;
                    approveSection.Visible = true;
                }
                else
                {
                    approveSection.Visible = false;
                }
            }
        }//

        private bool CanView( ContentItem entity )
        {
            bool isValid = false;
            if ( IsUserAuthenticated() && WebUser.Id == entity.CreatedById )
                return true;

            //allow approvers
            if ( entity.StatusId > ContentItem.INPROGRESS_STATUS && UserCanApproveThisResource( entity ) )
                return true;

            if ( IsUserAuthenticated() && WebUser.Id == 2 )
            {
                //notAllowedPanel.Visible = true;
                //SetConsoleInfoMessage( "OVERRIDE - Normally MAY not be allowed" );
                //return true;
            }
            string allow = this.GetRequestKeyValue( "ov", "" );
            if ( allow.ToLower() == "isle" && System.DateTime.Now < new System.DateTime( 2013, 9, 15 ) )
            {
                SetConsoleInfoMessage( "OVERRIDE - Normally MAY not be allowed" );
                return true;
            }

            if ( entity.StatusId < ContentItem.PUBLISHED_STATUS )
                return false;

            //TODO - only caveat may be to allow a reviewer to see this view?
            //       they would have to be authnticated with org admin status???
            if ( entity.PrivilegeTypeId == ContentItem.PUBLIC_PRIVILEGE )
                return true;

            //else must be authenticated
            if ( IsUserAuthenticated() == false)
                return false;

            CurrentUser = GetAppUser();
            //must have an orgId, although not for the state
            if ( CurrentUser.OrgId == 0 )
                return false;

            if (  entity.PrivilegeTypeId == ContentItem.MY_ORG_PRIVILEGE
               && entity.OrgId == CurrentUser.OrgId )
                return true;

            //hmm what for district??
            //==> need to include parent with content, and also get user parent - should persist, or maybe an oppurtunity for cookies???
            //-should have a state level access, or admin check
            //start with having an org - since

            if ( entity.PrivilegeTypeId == ContentItem.MY_REGION_PRIVILEGE )
            {
                if ( entity.OrgId == CurrentUser.OrgId
                  || entity.OrgId == CurrentUser.ParentOrgId
                  || entity.ParentOrgId == CurrentUser.ParentOrgId
                  || entity.ParentOrgId == CurrentUser.OrgId
                 )
                return true;
            }

            return isValid;
        }//

        private void PopulateSupplements( ContentItem entity )
        {
            List<ContentSupplement> list = myManager.ContentSupplementsSelectList( entity.Id );

            if ( list.Count > 0 )
            {
                attachmentsPanel.Visible = true;
                foreach ( ContentSupplement item in list )
                {
                    //supplements.Text += item.Title;
                    if ( item .PrivilegeTypeId > ContentItem.PUBLIC_PRIVILEGE)
                        supplements.Text +=  "Privilege: " + item.PrivilegeType + "
";

                    if ( item.Description.Trim().Length > 0)
                        supplements.Text += item.Description + "
";

                    if ( IsUserAuthenticated() == false &&
                        ( entity.PrivilegeTypeId != 1 || item.PrivilegeTypeId != 1 ) )
                    {

                        supplements.Text += "
Private document, viewing is prohibited: " + item.Title;

                    }
                    else
                    {
                        if ( item.RelatedDocument != null && item.RelatedDocument.HasValidRowId() )
                        {
                            //if ( IsTestEnv() )
                            //    supplements.Text += "
(test only): " + item.RelatedDocument.FileName;

                            //check if file exists on server, if not it will be downloaded
                            string fileUrl = ValidateDocumentOnServer( entity, item.RelatedDocument );
                            if ( fileUrl.Length > 10 )
                            {
                                if ( showingImageAttachmentsInline.Text.Equals( "yes" ) )
                                {
                                    //would also need to check file size to ensure not excessive
                                }
                                /*if ( item.RelatedDocument.MimeType.ToLower().IndexOf("image") > -1
                                    || fileUrl.ToLower().IndexOf( "jpg" ) > -1 )
                                {
                                    //show actual image
                                    supplements.Text += string.Format( imageLinkTemplate.Text, item.RelatedDocument.RowId ) + "
";
                                }
                                else*/
                                supplements.Text += "" + string.Format( docLinkTemplate.Text, fileUrl, item.Title ) + "
";

                            }
                            else
                                supplements.Text += "
Sorry issue encountered locating the related document.";
                        }
                    }

                    supplements.Text += "

";
                }

            }
        }//
        private string ValidateDocumentOnServer( ContentItem parentEntity, DocumentVersion doc )
        {
            string fileUrl = "";
            try
            {

                string documentFolder = FileResourceController.DetermineDocumentPath( parentEntity );

                string message = FileSystemHelper.HandleDocumentCaching( documentFolder, doc );
                if ( message == "" )
                {
                    //blank returned message means ok
                    fileUrl = FileResourceController.DetermineDocumentUrl( parentEntity, doc.FileName );

                }
                else
                {
                    //error, should return a message
                    this.SetConsoleErrorMessage( message );
                }
            }
            catch ( Exception ex )
            {
                LoggingHelper.LogError( ex, thisClassName + ".ValidateDocumentOnServer() - Unexpected error encountered while retrieving document" );

                this.SetConsoleErrorMessage( "Unexpected error encountered - Close this form and try again. (System Admin has been notified)
" + ex.ToString() );
            }

            return fileUrl;
        }//

        private void PopulateReferences( ContentItem entity )
        {
            List<ContentReference> list = myManager.ContentReferencesSelectList( entity.Id );

            if ( list.Count > 0 )
            {
                referencesPanel.Visible = true;
                foreach ( ContentReference item in list )
                {
                    if ( item.Title.Trim().Length > 0 )
                        lblReferences.Text += "" + item.Title + "
";
                    if ( item.Author.Trim().Length > 0 )
                        lblReferences.Text += "Author: " + item.Author + "
";

                    if ( item.Publisher.Trim().Length > 0 )
                        lblReferences.Text += "Publisher: " + item.Publisher + "
";
                    if ( item.AdditionalInfo.Trim().Length > 0 )
                        lblReferences.Text += "Additional Information: " + item.AdditionalInfo + "
";
                    if ( item.ISBN.Trim().Length > 0 )
                        lblReferences.Text += "ISBN: " + item.ISBN + "
";

                    if ( item.ReferenceUrl.Length > 0 )
                    {
                        if (showingRefUrl.Text.Equals("yes"))
                            lblReferences.Text += "
" + item.ReferenceUrl + "
";
                        else
                            lblReferences.Text += "
Website
";
                    }

                    lblReferences.Text += "

";
                }

            }
        }//

        private void PopulateStandards( ContentItem entity )
        {
            //Standards
            ResManager standardManager = new ResManager();
            ResourceStandardCollection standardsList = standardManager.SelectResourceStandardsByVersion( entity.ResourceVersionId );

            if ( standardsList != null && standardsList.Count > 0 )
            {
                lblStandardsList.Text = "
";
                foreach ( ResourceStandard standard in standardsList )
                {
                    if ( standard.AlignmentTypeValue == "" )
                    {
                        standard.AlignmentTypeValue = "Aligns To";
                    }
                    if ( standard.AlignmentTypeCodeId == 0 )
                    {
                        standard.AlignmentTypeCodeId = 0;
                    }
                    lblStandardsList.Text = lblStandardsList.Text + "
The Resource " + standard.AlignmentTypeValue + " This Standard:
 " + standard.StandardNotationCode + "";
                }
                lblStandardsList.Text = lblStandardsList.Text + "
";

                standardsPanel.Visible = true;
            }

        }//

        #endregion

        #region Events

        public void PublishButton_Click( object sender, EventArgs e )
        {
            if ( UserCanPublishThisResource() )
            {
                //Response.Redirect( "/Publish.aspx" ); //Keeps targeting the iframe
                redirectTarget = Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port + "/Publish.aspx";
                Session.Add( "authoredResourceID", CurrentRecordID.ToString() );
                Session.Add( "authoredResourceURL", Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port + Request.RawUrl );
            }
        }
        public void RequestApprovalButton_Click( object sender, EventArgs e )
        {
            if ( UserCanPublishThisResource() )
            {
                string statusMessage = string.Empty;
                AppUser user = GetAppUser();
                if ( ContentController.RequestApproval( CurrentRecordID, user, ref statusMessage ) == true )
                {
                    SetConsoleSuccessMessage( "An email was sent requesting a review of your resource." );
                    //refresh
                    requestApprovalButton.Visible = false;
                    Get( CurrentRecordID );
                }
                else
                    SetConsoleErrorMessage( "An error occurred attempting to initiate a review of your resource.
System administration has been notified.
" + statusMessage );

            }
        }

        public void ApproveButton_Click( object sender, EventArgs e )
        {
            /* set status to Published
            * set resource to active (or whatever other steps)
            * insert record in audit table
            *
            * send approved message
            */

            string statusMessage = string.Empty;
            AppUser user = GetAppUser();

            if ( ContentController.HandleApprovedAction( CurrentRecordID, user, ref statusMessage ) == true )
            {
                SetConsoleSuccessMessage( "A notification of this approval was sent to the author of this resource.
" );
                //refresh
                approveButton.Visible = false;
                Get( CurrentRecordID );
            }
            else
            {
                SetConsoleErrorMessage( "An error occurred attempting to approve this resource.
System administration has been notified.
" + statusMessage );
            }

        }

        public void DeclineButton_Click( object sender, EventArgs e )
        {
            /* set status to Declined
            * set resource to inactive (in case previously published)
            * ??do we need some qualifier as to way a resource is inactive to prevent part of a cleanup
            * insert record in audit table
            * a reason will be required, include in an email and audit table
            * send email
            *
            */
            //check that a reason was given
            txtReason.Text = FormHelper.CleanText( txtReason.Text );
            if ( txtReason.Text.Trim().Length < 20 )
            {
                SetConsoleErrorMessage( "Please provide a reason of at least 20 characters" );
            }

            string statusMessage = string.Empty;
            AppUser user = GetAppUser();

            if ( ContentController.HandleDeclinedAction( CurrentRecordID, txtReason.Text, user, ref statusMessage ) == true )
            {
                SetConsoleSuccessMessage( "A notification of this action was sent to the author of this resource." );
                //refresh
                approveButton.Visible = false;
                Get( CurrentRecordID );
            }
            else
            {
                SetConsoleErrorMessage( "An error occurred attempting to approve this resource.
System administration has been notified.
" + statusMessage );
            }
        }
        #endregion

        #region Validation Methods
        ///
        /// validate form content
        ///
        /// <returns></returns>
        private bool IsFormValid()
        {
            //int recId = 0;
            bool isValid = true;

            try
            {
                Page.Validate();
                isValid = HasRequiredFields();
            }
            catch ( System.Exception ex )
            {
                //SetFormMessage( "Unexpected error encountered
Contact system administration.
" + ex.ToString() );
                return false;
            }

            return isValid;
        } //

        ///
        /// verify required fields are present
        ///
        /// <returns></returns>
        private bool HasRequiredFields()
        {
            bool isValid = true;

            return isValid;
        } //

        protected bool UserCanPublishThisResource()
        {

            if ( !IsUserAuthenticated() )
            {
                return false;
            }

            //TODO - need to handle with rowId
            ContentItem entity = new ContentItem();
            if ( CurrentRecordID > 0 )
            {
                entity = myManager.Get( CurrentRecordID );
            }
            else
            {
                entity = Get();
            }

            return UserCanPublishThisResource( entity );

        }
        protected bool UserCanPublishThisResource( ContentItem entity )
        {

            if ( !IsUserAuthenticated() )
            {
                return false;
            }

            if ( entity.CreatedById == WebUser.Id )
            {
                return true;
            }
            else
            {
                return false;
            }

        }
        protected bool UserCanApproveThisResource()
        {

            if ( !IsUserAuthenticated() )
            {
                return false;
            }

            //TODO - need to handle with rowId
            ContentItem entity = new ContentItem();
            if ( CurrentRecordID > 0 )
            {
                entity = myManager.Get( CurrentRecordID );
            }
            else
            {
                entity = Get();
            }

            return UserCanApproveThisResource( entity );

        }

        protected bool UserCanApproveThisResource( ContentItem entity )
        {

            if ( !IsUserAuthenticated() )
            {
                return false;
            }

            CurrentUser = GetAppUser();

            //for now, don't allow author to approve,even if an approver??
            if ( entity.CreatedById == CurrentUser.Id && canAuthorApproveOwnContent.Text == "no" )
            {
                return false;
            }
            /*
             * get orgId, and parentOrgId, or specific method
             *
             *
             */

            return ContentController.IsUserOrgApprover( entity, CurrentUser.Id );
            //string statusMessage = "";
            //if ( entity.OrgId > 0 )
            //{
            //    if ( GroupManager.IsUserAnOrgApprover( entity.OrgId, CurrentUser.Id ) )
            //        return true;
            //    else
            //        return false;
            //}
            //AcctManager mgr = new AcctManager();
            //AppUser author = mgr.Get( entity.CreatedById );
            //   //if valid
            //Organization org = AcctManager.GetOrganization( author, ref statusMessage );
            //if ( org != null && org.Id > 0 )
            //{
            //    if ( GroupManager.IsUserAnOrgApprover( org.Id, CurrentUser.Id ) )
            //        return true;
            //}

            //return false;
        }
        #endregion

    }
}


text:
<?php
/*
 * This work is hereby released into the Public Domain.
 * To view a copy of the public domain dedication,
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
 *
 */

/*
 * Get the minimum of an array and ignore non numeric values
 */
function array_min($array) {

	if(is_array($array) and count($array) > 0) {

		do {
			$min = array_pop($array);
			if(is_numeric($min) === FALSE) {
				$min = NULL;
			}
		} while(count($array) > 0 and $min === NULL);

		if($min !== NULL) {
			$min = (float)$min;
		}

		foreach($array as $value) {
			if(is_numeric($value) and (float)$value < $min) {
				$min = (float)$value;
			}
		}

		return $min;

	}

	return NULL;

}

/*
 * Get the maximum of an array and ignore non numeric values
 */
function array_max($array) {

	if(is_array($array) and count($array) > 0) {

		do {
			$max = array_pop($array);
			if(is_numeric($max) === FALSE) {
				$max = NULL;
			}
		} while(count($array) > 0 and $max === NULL);

		if($max !== NULL) {
			$max = (float)$max;
		}

		foreach($array as $value) {
			if(is_numeric($value) and (float)$value > $max) {
				$max = (float)$value;
			}
		}

		return $max;

	}

	return NULL;

}
/*
 * Define file_put_contents() if needed
 */
if(function_exists('file_put_contents') === FALSE) {

	function file_put_contents($file, $content) {
		$fp = fopen($file, 'w');
		if($fp) {
			fwrite($fp, $content);
			fclose($fp);
		}
	}

}

/*
 * Change error handler
 */
set_error_handler('errorHandlerArtichow');

function errorHandlerArtichow($level, $message, $file, $line) {
	awImage::drawError($message.' in '.$file.' on line '.$line.'.');
}


text:
Login - {{message}}

		<form class="form-horizontal">
			<fieldset>

					User Name

						<input type="email" class="form-control" id="inputUserName"
							placeholder="user@domain.com" ng-model="credentials.username" required>

					Password

						<input type="password" class="form-control" id="inputPassword"
							placeholder="Password" ng-model="credentials.password" required>

								<input type="checkbox"> Remember me

						<input class="btn btn-primary" ng-click="login()" value="Log In"/>

						<input class="btn btn-default" ng-click="signup()" value="Sign up"/>

			</fieldset>
		</form>


text:
""" Test DICOM functionality.
"""

from zipfile import ZipFile

import numpy as np

import pytest

import imageio.v2 as iio
import imageio.v3 as iio3
from imageio import core
import imageio.plugins.dicom
from conftest import deprecated_test

@pytest.fixture(scope="module")
def examples(test_images, tmp_path_factory):
    """Create two dirs, one with one dataset and one with two datasets"""

    workdir = tmp_path_factory.getbasetemp() / "test_dicom"

    # Prepare sources
    fname1 = test_images / "dicom_sample1.zip"
    fname2 = test_images / "dicom_sample2.zip"
    dname1 = workdir / "dicom_sample1"
    dname2 = workdir / "dicom_sample2"

    # folder 1
    ZipFile(fname1).extractall(dname1)

    # folder 2
    ZipFile(fname1).extractall(dname2)
    ZipFile(fname2).extractall(dname2)

    # a file from each folder
    # tests expect this to be a string
    fname1 = str(next(dname1.iterdir()))
    fname2 = str(next(dname2.iterdir()))

    yield dname1, dname2, fname1, fname2

@deprecated_test
def test_read_empty_dir(tmp_path):
    # Test that no format is found, but no error is raised
    request = core.Request(tmp_path, "ri")
    assert iio.formats.search_read_format(request) is None

def test_dcmtk():
    # This should not crach, we make no assumptions on whether its
    # available or not
    imageio.plugins.dicom.get_dcmdjpeg_exe()

@deprecated_test
def test_selection(test_images, tmp_path, examples):

    dname1, dname2, fname1, fname2 = examples

    # Test that DICOM can examine file
    F = iio.formats.search_read_format(core.Request(fname1, "ri"))
    assert F.name == "DICOM"
    assert isinstance(F, type(iio.formats["DICOM"]))

    # Test that we cannot save
    request = core.Request(tmp_path / "test.dcm", "wi")
    assert not F.can_write(request)

    # Test fail on wrong file
    fname2 = fname1 + ".fake"
    bb = open(fname1, "rb").read()
    bb = bb[:128] + b"XXXX" + bb[132:]
    open(fname2, "wb").write(bb)
    with pytest.raises(Exception):
        F.get_reader(core.Request(fname2, "ri"))

    # Test special files with other formats
    im = iio.imread(test_images / "dicom_file01.dcm")
    assert im.shape == (512, 512)
    im = iio.imread(test_images / "dicom_file03.dcm")
    assert im.shape == (512, 512)
    im = iio.imread(test_images / "dicom_file04.dcm")
    assert im.shape == (512, 512)

    # Expected fails
    fname = test_images / "dicom_file90.dcm"
    with pytest.raises(RuntimeError):
        iio.imread(fname)  # 1.2.840.10008.1.2.4.91
    fname = test_images / "dicom_file91.dcm"
    with pytest.raises(RuntimeError):
        iio.imread(fname)  # not pixel data

    # This one *should* work, but does not, see issue #18
    try:
        iio.imread(test_images / "dicom_file02.dcm")
    except Exception:
        pass

def test_progress(examples):

    dname1, dname2, fname1, fname2 = examples

    iio.imread(fname1, progress=True)
    iio.imread(fname1, progress=core.StdoutProgressIndicator("test"))
    iio.imread(fname1, progress=None)
    with pytest.raises(ValueError):
        iio.imread(fname1, progress=3)

def test_different_read_modes(examples):

    dname1, dname2, fname1, fname2 = examples

    for fname, dname, n in [(fname1, dname1, 1), (fname2, dname2, 2)]:

        # Test imread()
        im = iio.imread(fname)
        assert isinstance(im, np.ndarray)
        assert im.shape == (512, 512)

        # Test mimread()
        ims = iio.mimread(fname)
        assert isinstance(ims, list)
        assert ims[0].shape == im.shape
        assert len(ims) > 1
        #
        ims2 = iio.mimread(dname, format="DICOM")
        assert len(ims) == len(ims2)

        # Test volread()
        vol = iio.volread(dname, format="DICOM")
        assert vol.ndim == 3
        assert vol.shape[0] > 10
        assert vol.shape[1:] == (512, 512)
        #
        vol2 = iio.volread(fname)  # fname works as well
        assert (vol == vol2).all()

        # Test mvolread()
        vols = iio.mvolread(dname, format="DICOM")
        assert isinstance(vols, list)
        assert len(vols) == n
        assert vols[0].shape == vol.shape
        assert sum([v.shape[0] for v in vols]) == len(ims)

def test_different_read_modes_with_readers(examples):

    dname1, dname2, fname1, fname2 = examples

    for fname, dname, n in [(fname1, dname1, 1), (fname2, dname2, 2)]:

        # Test imread()
        R = iio.read(fname, "DICOM", "i")
        assert len(R) == 1
        assert isinstance(R.get_meta_data(), dict)
        assert isinstance(R.get_meta_data(0), dict)

        # Test mimread()
        R = iio.read(fname, "DICOM", "I")
        if n == 1:
            assert len(R) > 10
        else:
            assert len(R) == 20 + 25
        assert isinstance(R.get_meta_data(), dict)
        assert isinstance(R.get_meta_data(0), dict)

        # Test volread()
        R = iio.read(fname, "DICOM", "v")
        assert len(R) == n  # we ask for one, but get an honest number
        assert isinstance(R.get_meta_data(), dict)
        assert isinstance(R.get_meta_data(0), dict)

        # Test mvolread()
        R = iio.read(fname, "DICOM", "V")
        assert len(R) == n
        assert isinstance(R.get_meta_data(), dict)
        assert isinstance(R.get_meta_data(0), dict)

        # Touch DicomSeries objects
        assert repr(R._series[0])
        assert R._series[0].description
        assert len(R._series[0].sampling) == 3

        R = iio.read(fname, "DICOM", "?")
        with pytest.raises(RuntimeError):
            R.get_length()

def test_v3_reading(test_images):
    # this is a regression test for
    # https://github.com/imageio/imageio/issues/862
    expected = iio.imread(test_images / "dicom_file01.dcm")
    actual = iio3.imread(test_images / "dicom_file01.dcm")

    assert np.allclose(actual, expected)


text:
import setupStore from 'dummy/tests/helpers/store';
import DS from 'ember-data';

import {module, test} from 'qunit';

var env, adapter;

module("unit/adapters/build-url-mixin/path-for-type - DS.BuildURLMixin#pathForType", {
  beforeEach() {

    // test for overriden pathForType methods which return null path values
    var customPathForType = {
      pathForType(type) {
        if (type === 'rootModel') { return ''; }
        return this._super(type);
      }
    };

    var Adapter = DS.Adapter.extend(DS.BuildURLMixin, customPathForType);

    env = setupStore({
      adapter: Adapter
    });

    adapter = env.adapter;
  }
});

test('pathForType - works with camelized types', function(assert) {
  assert.equal(adapter.pathForType('superUser'), "superUsers");
});

test('pathForType - works with dasherized types', function(assert) {
  assert.equal(adapter.pathForType('super-user'), "superUsers");
});

test('pathForType - works with underscored types', function(assert) {
  assert.equal(adapter.pathForType('super_user'), "superUsers");
});

test('buildURL - works with empty paths', function(assert) {
  assert.equal(adapter.buildURL('rootModel', 1), "/1");
});

test('buildURL - find requestType delegates to urlForFindRecord', function(assert) {
  assert.expect(4);
  var snapshotStub = { snapshot: true };
  var originalMethod = adapter.urlForFindRecord;
  adapter.urlForFindRecord = function(id, type, snapshot) {
    assert.equal(id, 1);
    assert.equal(type, 'super-user');
    assert.equal(snapshot, snapshotStub);
    return originalMethod.apply(this, arguments);
  };
  assert.equal(adapter.buildURL('super-user', 1, snapshotStub, 'findRecord'), '/superUsers/1');
});

test('buildURL - findAll requestType delegates to urlForFindAll', function(assert) {
  assert.expect(2);
  var originalMethod = adapter.urlForFindAll;
  adapter.urlForFindAll = function(type) {
    assert.equal(type, 'super-user');
    return originalMethod.apply(this, arguments);
  };
  assert.equal(adapter.buildURL('super-user', null, null, 'findAll'), '/superUsers');
});

test('buildURL - query requestType delegates to urlForQuery', function(assert) {
  assert.expect(3);
  var originalMethod = adapter.urlForQuery;
  var queryStub = { limit: 10 };
  adapter.urlForQuery = function(query, type) {
    assert.equal(query, queryStub);
    assert.equal(type, 'super-user');
    return originalMethod.apply(this, arguments);
  };
  assert.equal(adapter.buildURL('super-user', null, null, 'query', queryStub), '/superUsers');
});

test('buildURL - queryRecord requestType delegates to urlForQueryRecord', function(assert) {
  assert.expect(3);
  var originalMethod = adapter.urlForQueryRecord;
  var queryStub = { companyId: 10 };
  adapter.urlForQueryRecord = function(query, type) {
    assert.equal(query, queryStub);
    assert.equal(type, 'super-user');
    return originalMethod.apply(this, arguments);
  };
  assert.equal(adapter.buildURL('super-user', null, null, 'queryRecord', queryStub), '/superUsers');
});

test('buildURL - findMany requestType delegates to urlForFindMany', function(assert) {
  assert.expect(3);
  var originalMethod = adapter.urlForFindMany;
  var idsStub = [1, 2, 3];
  adapter.urlForFindMany = function(ids, type) {
    assert.equal(ids, idsStub);
    assert.equal(type, 'super-user');
    return originalMethod.apply(this, arguments);
  };
  assert.equal(adapter.buildURL('super-user', idsStub, null, 'findMany'), '/superUsers');
});

test('buildURL - findHasMany requestType delegates to urlForFindHasMany', function(assert) {
  assert.expect(3);
  var originalMethod = adapter.urlForFindHasMany;
  adapter.urlForFindHasMany = function(id, type) {
    assert.equal(id, 1);
    assert.equal(type, 'super-user');
    return originalMethod.apply(this, arguments);
  };
  assert.equal(adapter.buildURL('super-user', 1, null, 'findHasMany'), '/superUsers/1');
});

test('buildURL - findBelongsTo requestType delegates to urlForFindBelongsTo', function(assert) {
  assert.expect(3);
  var originalMethod = adapter.urlForFindBelongsTo;
  adapter.urlForFindBelongsTo = function(id, type) {
    assert.equal(id, 1);
    assert.equal(type, 'super-user');
    return originalMethod.apply(this, arguments);
  };
  assert.equal(adapter.buildURL('super-user', 1, null, 'findBelongsTo'), '/superUsers/1');
});

test('buildURL - createRecord requestType delegates to urlForCreateRecord', function(assert) {
  assert.expect(3);
  var snapshotStub = { snapshot: true };
  var originalMethod = adapter.urlForCreateRecord;
  adapter.urlForCreateRecord = function(type, snapshot) {
    assert.equal(type, 'super-user');
    assert.equal(snapshot, snapshotStub);
    return originalMethod.apply(this, arguments);
  };
  assert.equal(adapter.buildURL('super-user', null, snapshotStub, 'createRecord'), '/superUsers');
});

test('buildURL - updateRecord requestType delegates to urlForUpdateRecord', function(assert) {
  assert.expect(4);
  var snapshotStub = { snapshot: true };
  var originalMethod = adapter.urlForUpdateRecord;
  adapter.urlForUpdateRecord = function(id, type, snapshot) {
    assert.equal(id, 1);
    assert.equal(type, 'super-user');
    assert.equal(snapshot, snapshotStub);
    return originalMethod.apply(this, arguments);
  };
  assert.equal(adapter.buildURL('super-user', 1, snapshotStub, 'updateRecord'), '/superUsers/1');
});

test('buildURL - deleteRecord requestType delegates to urlForDeleteRecord', function(assert) {
  assert.expect(4);
  var snapshotStub = { snapshot: true };
  var originalMethod = adapter.urlForDeleteRecord;
  adapter.urlForDeleteRecord = function(id, type, snapshot) {
    assert.equal(id, 1);
    assert.equal(type, 'super-user');
    assert.equal(snapshot, snapshotStub);
    return originalMethod.apply(this, arguments);
  };
  assert.equal(adapter.buildURL('super-user', 1, snapshotStub, 'deleteRecord'), '/superUsers/1');
});

test('buildURL - unknown requestType', function(assert) {
  assert.equal(adapter.buildURL('super-user', 1, null, 'unknown'), '/superUsers/1');
  assert.equal(adapter.buildURL('super-user', null, null, 'unknown'), '/superUsers');
});


text:
package hr.fer.zemris.jcms.beans;

public class AssessmentFlagBean {

	private String id;
	private String name;
	private String shortName;
	private String assesmentFlagTagID;
	private String courseInstanceID;
	private String programType;
	private String program;
	private int programVersion;
	private String visibility;
	private int sortIndex;

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getShortName() {
		return shortName;
	}
	public void setShortName(String shortName) {
		this.shortName = shortName;
	}
	public String getAssesmentFlagTagID() {
		return assesmentFlagTagID;
	}
	public void setAssesmentFlagTagID(String assesmentFlagTagID) {
		this.assesmentFlagTagID = assesmentFlagTagID;
	}
	public String getCourseInstanceID() {
		return courseInstanceID;
	}
	public void setCourseInstanceID(String courseInstanceID) {
		this.courseInstanceID = courseInstanceID;
	}
	public String getProgramType() {
		return programType;
	}
	public void setProgramType(String programType) {
		this.programType = programType;
	}
	public String getProgram() {
		return program;
	}
	public void setProgram(String program) {
		this.program = program;
	}
	public int getProgramVersion() {
		return programVersion;
	}
	public void setProgramVersion(int programVersion) {
		this.programVersion = programVersion;
	}

	public String getVisibility() {
		return visibility;
	}
	public void setVisibility(String visibility) {
		this.visibility = visibility;
	}
	public int getSortIndex() {
		return sortIndex;
	}
	public void setSortIndex(int sortIndex) {
		this.sortIndex = sortIndex;
	}
}


text:
import polymorphism2
polymorphism2.test()


text:
<jqxDataTable
    [width]="850" [source]="dataAdapter" [columns]="columns"
    [altRows]="true" [pageable]="true" [sortable]="true" [rtl]="true">
</jqxDataTable>


text:
import aozoracli.client

def main(options):
    ranking = aozoracli.client.get_ranking(options['type'], options['year'], options['month']).json()

    if ranking == None:
        print("Could not get aozora ranking data")
        return False

    if len(ranking) == 0:
        print("Not found ranking")
        return False

    return ranking


text:
var async = require('async');
var functions = require('./functions');

var update = function (db, data) {

  var state = {
    db: db,
    data: data,
  };

  return {

    success: function (callback) {

      async.waterfall([

        functions.getInstances.bind(null, state),
        functions.parentData,
        functions.targetData,
        functions.instancesData,
        functions.updateInstances,

      ], function (err, state) {
        callback(state.stored_instances);
      });

    }

  };

};

module.exports = update;


text:
from __future__ import absolute_import, print_function

import copy

from pyundo.task import TaskBase
from pyundo.exceptions import DoError, UndoError

class LineFlow(object):
    def __init__(self, retry=0):
        self.retry = retry
        self._tasks = []

    def add(self, task):
        """Add a task to execute."""
        if not isinstance(task, TaskBase):
            raise TypeError("Task must be the sub-class pytask.TaskBase")

        self._tasks.append(task)

    def tasks(self, index=None):
        """Get the task(s).

        If giving `index`, return the specific Nth task. Or, return the list
        of all the task.
        """
        if index:
            return self._tasks[index]
        return copy.deepcopy(self._tasks)

    def _do(self, task):
        for i in range(self.retry):
            try:
                task.do()
            except Exception as err:
                _err = err
            else:
                return

        raise DoError(_err)

    def _undo(self, task):
        count = 0
        for i in range(self.retry):
            count += 1
            try:
                task.undo()
            except Exception as err:
                _err = err
            else:
                return

        raise UndoError("Failed to undo the {0}th task: {1}".format(count, _err))

    def execute(self):
        """Execute all the tasks.

        If a certain task fails, it will undo all the tasks that have executed
        successfully.

        @Exception:
            If a task failed and undo succeeded, raise `DoError`.
            If undo failed, raise `UndoError`.
        """
        _exec_tasks = []
        count = 0
        _err = None
        for task in self._tasks:
            count += 1
            try:
                self._do(task)
            except DoError as err:
                _err = err
                break
            else:
                _exec_tasks.append(task)

        if _err:
            for task in reversed(_exec_tasks):
                self._undo(task)

            raise DoError("Failed to execute the {0}th task: {1}".format(count, _err))

    def __len__(self):
        return len(self._tasks)


text:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    tools:context="freerunningapps.veggietizer.view.activity.OverviewActivity"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"  >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

	    <LinearLayout
	        android:layout_width="match_parent"
	        android:layout_height="wrap_content"
	        android:paddingTop="@dimen/line_margin_instant_feedback_popup"
	        android:gravity="center_vertical"
	        android:orientation="horizontal" >

	        <ImageView
	            android:id="@+id/instant_feedback_icon_meat"
	            android:layout_width="wrap_content"
	            android:layout_height="wrap_content"
	            android:maxHeight="@dimen/IconChartIconSize"
	            android:maxWidth="@dimen/IconChartIconSize"
	            android:paddingRight="@dimen/icon_margin_instant_feedback_popup"
	            android:src="@drawable/ic_meat" />

	        <TextView
	            android:id="@+id/instant_feedback_popup_meat"
	            android:layout_width="wrap_content"
	            android:layout_height="wrap_content"
	            android:text="@string/placeholder"
	            android:textSize="@dimen/text_size_instant_feedback_popup"
				android:textColor="@color/text_gray"/>

	    </LinearLayout>

		<LinearLayout
		        android:layout_width="match_parent"
		        android:layout_height="wrap_content"
		        android:paddingTop="@dimen/line_margin_instant_feedback_popup"
		        android:gravity="center_vertical"
		        android:orientation="horizontal" >

		    <ImageView
	            android:id="@+id/instant_feedback_icon_carbon"
	            android:layout_width="wrap_content"
	            android:layout_height="wrap_content"
	            android:paddingRight="@dimen/icon_margin_instant_feedback_popup"
	            android:src="@drawable/ic_co2" />

	        <TextView
	            android:id="@+id/instant_feedback_popup_carbon"
	            android:layout_width="wrap_content"
	            android:layout_height="wrap_content"
	            android:text="@string/placeholder"
	            android:textSize="@dimen/text_size_instant_feedback_popup"
				android:textColor="@color/text_gray"/>

	    </LinearLayout>

	    <LinearLayout
	        android:layout_width="match_parent"
	        android:layout_height="wrap_content"
	        android:paddingTop="@dimen/line_margin_instant_feedback_popup"
	        android:gravity="center_vertical"
	        android:orientation="horizontal" >

	        <ImageView
	            android:id="@+id/instant_feedback_icon_water"
	            android:layout_width="wrap_content"
	            android:layout_height="wrap_content"
	            android:paddingRight="@dimen/icon_margin_instant_feedback_popup"
	            android:src="@drawable/ic_water" />

	        <TextView
	            android:id="@+id/instant_feedback_popup_water"
	            android:layout_width="wrap_content"
	            android:layout_height="wrap_content"
	            android:text="@string/placeholder"
	            android:textSize="@dimen/text_size_instant_feedback_popup"
				android:textColor="@color/text_gray"/>
	    </LinearLayout>

	    <LinearLayout
	        android:layout_width="match_parent"
	        android:layout_height="wrap_content"
	        android:paddingTop="@dimen/line_margin_instant_feedback_popup"
	        android:gravity="center_vertical"
	        android:orientation="horizontal" >

	        <ImageView
	            android:id="@+id/instant_feedback_icon_feed"
	            android:layout_width="wrap_content"
	            android:layout_height="wrap_content"
	            android:paddingRight="@dimen/icon_margin_instant_feedback_popup"
	            android:src="@drawable/ic_feed" />

	        <TextView
	            android:id="@+id/instant_feedback_popup_feed"
	            android:layout_width="wrap_content"
	            android:layout_height="wrap_content"
	            android:text="@string/placeholder"
	            android:textSize="@dimen/text_size_instant_feedback_popup"
				android:textColor="@color/text_gray"/>

	    </LinearLayout>

    </LinearLayout>

</ScrollView>


text:
using namespace std;
using namespace Tins;

typedef Dot11::address_type address_type;

class Dot11DeauthenticationTest : public testing::Test {
public:
    static const address_type empty_addr, hwaddr;
    static const uint8_t expected_packet[];
};

const uint8_t Dot11DeauthenticationTest::expected_packet[] = {
    193, 1, 79, 35, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6,
    7, 0, 0, 243, 146
};

void test_equals(const Dot11Deauthentication& dot1, const Dot11Deauthentication& dot2) {
    EXPECT_EQ(dot1.reason_code(), dot2.reason_code());
    test_equals(
        static_cast<const Dot11ManagementFrame&>(dot1),
        static_cast<const Dot11ManagementFrame&>(dot2)
    );
}

void test_equals_expected(const Dot11Deauthentication& dot11) {
    test_equals_expected(static_cast<const Dot11ManagementFrame&>(dot11));
    EXPECT_EQ(dot11.reason_code(), 0x92f3);
    EXPECT_EQ(dot11.subtype(), Dot11::DEAUTH);
}

TEST_F(Dot11DeauthenticationTest, Constructor) {
    Dot11Deauthentication dot11;
    test_equals_empty(static_cast<const Dot11ManagementFrame&>(dot11));
    EXPECT_EQ(dot11.reason_code(), 0);
    EXPECT_EQ(dot11.subtype(), Dot11::DEAUTH);
}

TEST_F(Dot11DeauthenticationTest, ConstructorFromBuffer) {
    Dot11Deauthentication dot11(expected_packet, sizeof(expected_packet));
    test_equals_expected(dot11);
}

TEST_F(Dot11DeauthenticationTest, CopyConstructor) {
    Dot11Deauthentication dot1(expected_packet, sizeof(expected_packet));
    Dot11Deauthentication dot2(dot1);
    test_equals(dot1, dot2);
}

TEST_F(Dot11DeauthenticationTest, CopyAssignmentOperator) {
    Dot11Deauthentication dot1(expected_packet, sizeof(expected_packet));
    Dot11Deauthentication dot2;
    dot2 = dot1;
    test_equals(dot1, dot2);
}

TEST_F(Dot11DeauthenticationTest, ReasonCode) {
    Dot11Deauthentication dot11;
    dot11.reason_code(0x92f3);
    EXPECT_EQ(dot11.reason_code(), 0x92f3);
}

TEST_F(Dot11DeauthenticationTest, ClonePDU) {
    Dot11Deauthentication dot1(expected_packet, sizeof(expected_packet));
    Internals::smart_ptr<Dot11Deauthentication>::type dot2(dot1.clone());
    test_equals(dot1, *dot2);
}

TEST_F(Dot11DeauthenticationTest, FromBytes) {
    Internals::smart_ptr<PDU>::type dot11(Dot11::from_bytes(expected_packet, sizeof(expected_packet)));
    ASSERT_TRUE(dot11.get() != NULL);
    const Dot11Deauthentication* inner = dot11->find_pdu<Dot11Deauthentication>();
    ASSERT_TRUE(inner != NULL);
    test_equals_expected(*inner);
}

TEST_F(Dot11DeauthenticationTest, Serialize) {
    Dot11Deauthentication pdu(expected_packet, sizeof(expected_packet));
    PDU::serialization_type buffer = pdu.serialize();
    ASSERT_EQ(sizeof(expected_packet), buffer.size());
    EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
}

#endif // TINS_HAVE_DOT11


text:
// Lucene version compatibility level 4.8.1
using J2N.Collections.Generic.Extensions;
using Lucene.Net.Index;
using NUnit.Framework;
using RandomizedTesting.Generators;
using System;
using System.Collections.Generic;
using System.Globalization;
using Assert = Lucene.Net.TestFramework.Assert;
using JCG = J2N.Collections.Generic;

namespace Lucene.Net.Facet.Taxonomy
{

    using DirectoryReader = Lucene.Net.Index.DirectoryReader;
    using DirectoryTaxonomyReader = Lucene.Net.Facet.Taxonomy.Directory.DirectoryTaxonomyReader;
    using DirectoryTaxonomyWriter = Lucene.Net.Facet.Taxonomy.Directory.DirectoryTaxonomyWriter;
    using Document = Lucene.Net.Documents.Document;
    using IndexSearcher = Lucene.Net.Search.IndexSearcher;
    using IndexWriter = Lucene.Net.Index.IndexWriter;
    using IndexWriterConfig = Lucene.Net.Index.IndexWriterConfig;
    using IOUtils = Lucene.Net.Util.IOUtils;
    using MatchAllDocsQuery = Lucene.Net.Search.MatchAllDocsQuery;
    using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
    using Store = Lucene.Net.Documents.Field.Store;
    using StringField = Lucene.Net.Documents.StringField;
    using Term = Lucene.Net.Index.Term;
    using TermQuery = Lucene.Net.Search.TermQuery;
    [TestFixture]
    public class TestTaxonomyFacetCounts2 : FacetTestCase
    {

        private static readonly Term A = new Term("f", "a");
        private const string CP_A = "A", CP_B = "B";
        private const string CP_C = "C", CP_D = "D"; // indexed w/ NO_PARENTS
        private const int NUM_CHILDREN_CP_A = 5, NUM_CHILDREN_CP_B = 3;
        private const int NUM_CHILDREN_CP_C = 5, NUM_CHILDREN_CP_D = 5;
        private static readonly FacetField[] CATEGORIES_A, CATEGORIES_B;
        private static readonly FacetField[] CATEGORIES_C, CATEGORIES_D;

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1810:Initialize reference type static fields inline", Justification = "Complexity")]
        static TestTaxonomyFacetCounts2()
        {
            CATEGORIES_A = new FacetField[NUM_CHILDREN_CP_A];
            for (int i = 0; i < NUM_CHILDREN_CP_A; i++)
            {
                CATEGORIES_A[i] = new FacetField(CP_A, Convert.ToString(i, CultureInfo.InvariantCulture));
            }
            CATEGORIES_B = new FacetField[NUM_CHILDREN_CP_B];
            for (int i = 0; i < NUM_CHILDREN_CP_B; i++)
            {
                CATEGORIES_B[i] = new FacetField(CP_B, Convert.ToString(i, CultureInfo.InvariantCulture));
            }

            // NO_PARENTS categories
            CATEGORIES_C = new FacetField[NUM_CHILDREN_CP_C];
            for (int i = 0; i < NUM_CHILDREN_CP_C; i++)
            {
                CATEGORIES_C[i] = new FacetField(CP_C, Convert.ToString(i, CultureInfo.InvariantCulture));
            }

            // Multi-level categories
            CATEGORIES_D = new FacetField[NUM_CHILDREN_CP_D];
            for (int i = 0; i < NUM_CHILDREN_CP_D; i++)
            {
                string val = Convert.ToString(i, CultureInfo.InvariantCulture);
                CATEGORIES_D[i] = new FacetField(CP_D, val, val + val); // e.g. D/1/11, D/2/22...
            }
        }

        private static Net.Store.Directory indexDir, taxoDir;
        private static IDictionary<string, int> allExpectedCounts, termExpectedCounts;

        [OneTimeTearDown]
        public override void AfterClass() // LUCENENET specific - renamed from AfterClassCountingFacetsAggregatorTest() to ensure calling order
        {
            IOUtils.Dispose(indexDir, taxoDir);
            base.AfterClass();
        }

        private static IList<FacetField> RandomCategories(Random random)
        {
            // add random categories from the two dimensions, ensuring that the same
            // category is not added twice.
            int numFacetsA = random.Next(3) + 1; // 1-3
            int numFacetsB = random.Next(2) + 1; // 1-2
            JCG.List<FacetField> categories_a = new JCG.List<FacetField>();
            categories_a.AddRange(CATEGORIES_A);
            JCG.List<FacetField> categories_b = new JCG.List<FacetField>();
            categories_b.AddRange(CATEGORIES_B);
            categories_a.Shuffle(Random);
            categories_b.Shuffle(Random);

            JCG.List<FacetField> categories = new JCG.List<FacetField>();
            categories.AddRange(categories_a.GetView(0, numFacetsA)); // LUCENENET: Checked length for correctness
            categories.AddRange(categories_b.GetView(0, numFacetsB)); // LUCENENET: Checked length for correctness

            // add the NO_PARENT categories
            categories.Add(CATEGORIES_C[Util.LuceneTestCase.Random.Next(NUM_CHILDREN_CP_C)]);
            categories.Add(CATEGORIES_D[Util.LuceneTestCase.Random.Next(NUM_CHILDREN_CP_D)]);

            return categories;
        }

        private static void AddField(Document doc)
        {
            doc.Add(new StringField(A.Field, A.Text, Store.NO));
        }

        private static void AddFacets(Document doc, FacetsConfig config, bool updateTermExpectedCounts)
        {
            IList<FacetField> docCategories = RandomCategories(Random);
            foreach (FacetField ff in docCategories)
            {
                doc.Add(ff);
                string cp = ff.Dim + "/" + ff.Path[0];
                allExpectedCounts[cp] = allExpectedCounts[cp] + 1;
                if (updateTermExpectedCounts)
                {
                    termExpectedCounts[cp] = termExpectedCounts[cp] + 1;
                }
            }
            // add 1 to each NO_PARENTS dimension
            allExpectedCounts[CP_B] = allExpectedCounts[CP_B] + 1;
            allExpectedCounts[CP_C] = allExpectedCounts[CP_C] + 1;
            allExpectedCounts[CP_D] = allExpectedCounts[CP_D] + 1;
            if (updateTermExpectedCounts)
            {
                termExpectedCounts[CP_B] = termExpectedCounts[CP_B] + 1;
                termExpectedCounts[CP_C] = termExpectedCounts[CP_C] + 1;
                termExpectedCounts[CP_D] = termExpectedCounts[CP_D] + 1;
            }
        }

        private static FacetsConfig GetConfig()
        {
            FacetsConfig config = new FacetsConfig();
            config.SetMultiValued("A", true);
            config.SetMultiValued("B", true);
            config.SetRequireDimCount("B", true);
            config.SetHierarchical("D", true);
            return config;
        }

        private static void IndexDocsNoFacets(IndexWriter indexWriter)
        {
            int numDocs = AtLeast(2);
            for (int i = 0; i < numDocs; i++)
            {
                Document doc = new Document();
                AddField(doc);
                indexWriter.AddDocument(doc);
            }
            indexWriter.Commit(); // flush a segment
        }

        private static void IndexDocsWithFacetsNoTerms(IndexWriter indexWriter, ITaxonomyWriter taxoWriter, IDictionary<string, int> expectedCounts)
        {
            Random random = Random;
            int numDocs = AtLeast(random, 2);
            FacetsConfig config = GetConfig();
            for (int i = 0; i < numDocs; i++)
            {
                Document doc = new Document();
                AddFacets(doc, config, false);
                indexWriter.AddDocument(config.Build(taxoWriter, doc));
            }
            indexWriter.Commit(); // flush a segment
        }

        private static void IndexDocsWithFacetsAndTerms(IndexWriter indexWriter, ITaxonomyWriter taxoWriter, IDictionary<string, int> expectedCounts)
        {
            Random random = Random;
            int numDocs = AtLeast(random, 2);
            FacetsConfig config = GetConfig();
            for (int i = 0; i < numDocs; i++)
            {
                Document doc = new Document();
                AddFacets(doc, config, true);
                AddField(doc);
                indexWriter.AddDocument(config.Build(taxoWriter, doc));
            }
            indexWriter.Commit(); // flush a segment
        }

        private static void IndexDocsWithFacetsAndSomeTerms(IndexWriter indexWriter, ITaxonomyWriter taxoWriter, IDictionary<string, int> expectedCounts)
        {
            Random random = Random;
            int numDocs = AtLeast(random, 2);
            FacetsConfig config = GetConfig();
            for (int i = 0; i < numDocs; i++)
            {
                Document doc = new Document();
                bool hasContent = random.NextBoolean();
                if (hasContent)
                {
                    AddField(doc);
                }
                AddFacets(doc, config, hasContent);
                indexWriter.AddDocument(config.Build(taxoWriter, doc));
            }
            indexWriter.Commit(); // flush a segment
        }

        // initialize expectedCounts w/ 0 for all categories
        private static IDictionary<string, int> newCounts()
        {
            IDictionary<string, int> counts = new Dictionary<string, int>();
            counts[CP_A] = 0;
            counts[CP_B] = 0;
            counts[CP_C] = 0;
            counts[CP_D] = 0;
            foreach (FacetField ff in CATEGORIES_A)
            {
                counts[ff.Dim + "/" + ff.Path[0]] = 0;
            }
            foreach (FacetField ff in CATEGORIES_B)
            {
                counts[ff.Dim + "/" + ff.Path[0]] = 0;
            }
            foreach (FacetField ff in CATEGORIES_C)
            {
                counts[ff.Dim + "/" + ff.Path[0]] = 0;
            }
            foreach (FacetField ff in CATEGORIES_D)
            {
                counts[ff.Dim + "/" + ff.Path[0]] = 0;
            }
            return counts;
        }

        [OneTimeSetUp]
        public override void BeforeClass() // LUCENENET specific - renamed from BeforeClassCountingFacetsAggregatorTest() to ensure calling order
        {
            base.BeforeClass();

            indexDir = NewDirectory();
            taxoDir = NewDirectory();

            // create an index which has:
            // 1. Segment with no categories, but matching results
            // 2. Segment w/ categories, but no results
            // 3. Segment w/ categories and results
            // 4. Segment w/ categories, but only some results

            IndexWriterConfig conf = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random));
            conf.MergePolicy = NoMergePolicy.COMPOUND_FILES; // prevent merges, so we can control the index segments
            IndexWriter indexWriter = new IndexWriter(indexDir, conf);
            ITaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir);

            allExpectedCounts = newCounts();
            termExpectedCounts = newCounts();

            // segment w/ no categories
            IndexDocsNoFacets(indexWriter);

            // segment w/ categories, no content
            IndexDocsWithFacetsNoTerms(indexWriter, taxoWriter, allExpectedCounts);

            // segment w/ categories and content
            IndexDocsWithFacetsAndTerms(indexWriter, taxoWriter, allExpectedCounts);

            // segment w/ categories and some content
            IndexDocsWithFacetsAndSomeTerms(indexWriter, taxoWriter, allExpectedCounts);

            IOUtils.Dispose(indexWriter, taxoWriter);
        }

        [Test]
        public virtual void TestDifferentNumResults()
        {
            // test the collector w/ FacetRequests and different numResults
            DirectoryReader indexReader = DirectoryReader.Open(indexDir);
            var taxoReader = new DirectoryTaxonomyReader(taxoDir);
            IndexSearcher searcher = NewSearcher(indexReader);

            FacetsCollector sfc = new FacetsCollector();
            TermQuery q = new TermQuery(A);
            searcher.Search(q, sfc);
            Facets facets = GetTaxonomyFacetCounts(taxoReader, GetConfig(), sfc);
            FacetResult result = facets.GetTopChildren(NUM_CHILDREN_CP_A, CP_A);
            Assert.AreEqual(-1, (int)result.Value);
            foreach (LabelAndValue labelValue in result.LabelValues)
            {
                Assert.AreEqual(termExpectedCounts[CP_A + "/" + labelValue.Label], labelValue.Value);
            }
            result = facets.GetTopChildren(NUM_CHILDREN_CP_B, CP_B);
            Assert.AreEqual(termExpectedCounts[CP_B], result.Value);
            foreach (LabelAndValue labelValue in result.LabelValues)
            {
                Assert.AreEqual(termExpectedCounts[CP_B + "/" + labelValue.Label], labelValue.Value);
            }

            IOUtils.Dispose(indexReader, taxoReader);
        }

        [Test]
        public virtual void TestAllCounts()
        {
            DirectoryReader indexReader = DirectoryReader.Open(indexDir);
            var taxoReader = new DirectoryTaxonomyReader(taxoDir);
            IndexSearcher searcher = NewSearcher(indexReader);

            FacetsCollector sfc = new FacetsCollector();
            searcher.Search(new MatchAllDocsQuery(), sfc);

            Facets facets = GetTaxonomyFacetCounts(taxoReader, GetConfig(), sfc);

            FacetResult result = facets.GetTopChildren(NUM_CHILDREN_CP_A, CP_A);
            Assert.AreEqual(-1, (int)result.Value);
            int prevValue = int.MaxValue;
            foreach (LabelAndValue labelValue in result.LabelValues)
            {
                Assert.AreEqual(allExpectedCounts[CP_A + "/" + labelValue.Label], labelValue.Value);
                Assert.IsTrue((int)labelValue.Value <= prevValue, "wrong sort order of sub results: labelValue.value=" + labelValue.Value + " prevValue=" + prevValue);
                prevValue = (int)labelValue.Value;
            }

            result = facets.GetTopChildren(NUM_CHILDREN_CP_B, CP_B);
            Assert.AreEqual(allExpectedCounts[CP_B], result.Value);
            prevValue = int.MaxValue;
            foreach (LabelAndValue labelValue in result.LabelValues)
            {
                Assert.AreEqual(allExpectedCounts[CP_B + "/" + labelValue.Label], labelValue.Value);
                Assert.IsTrue((int)labelValue.Value <= prevValue, "wrong sort order of sub results: labelValue.value=" + labelValue.Value + " prevValue=" + prevValue);
                prevValue = (int)labelValue.Value;
            }

            IOUtils.Dispose(indexReader, taxoReader);
        }

        [Test]
        public virtual void TestBigNumResults()
        {
            DirectoryReader indexReader = DirectoryReader.Open(indexDir);
            var taxoReader = new DirectoryTaxonomyReader(taxoDir);
            IndexSearcher searcher = NewSearcher(indexReader);

            FacetsCollector sfc = new FacetsCollector();
            searcher.Search(new MatchAllDocsQuery(), sfc);

            Facets facets = GetTaxonomyFacetCounts(taxoReader, GetConfig(), sfc);

            FacetResult result = facets.GetTopChildren(int.MaxValue, CP_A);
            Assert.AreEqual(-1, (int)result.Value);
            foreach (LabelAndValue labelValue in result.LabelValues)
            {
                Assert.AreEqual(allExpectedCounts[CP_A + "/" + labelValue.Label], labelValue.Value);
            }
            result = facets.GetTopChildren(int.MaxValue, CP_B);
            Assert.AreEqual(allExpectedCounts[CP_B], result.Value);
            foreach (LabelAndValue labelValue in result.LabelValues)
            {
                Assert.AreEqual(allExpectedCounts[CP_B + "/" + labelValue.Label], labelValue.Value);
            }

            IOUtils.Dispose(indexReader, taxoReader);
        }

        [Test]
        public virtual void TestNoParents()
        {
            DirectoryReader indexReader = DirectoryReader.Open(indexDir);
            var taxoReader = new DirectoryTaxonomyReader(taxoDir);
            IndexSearcher searcher = NewSearcher(indexReader);

            var sfc = new FacetsCollector();
            searcher.Search(new MatchAllDocsQuery(), sfc);

            Facets facets = GetTaxonomyFacetCounts(taxoReader, GetConfig(), sfc);

            FacetResult result = facets.GetTopChildren(NUM_CHILDREN_CP_C, CP_C);
            Assert.AreEqual(allExpectedCounts[CP_C], result.Value);
            foreach (LabelAndValue labelValue in result.LabelValues)
            {
                Assert.AreEqual(allExpectedCounts[CP_C + "/" + labelValue.Label], labelValue.Value);
            }
            result = facets.GetTopChildren(NUM_CHILDREN_CP_D, CP_D);
            Assert.AreEqual(allExpectedCounts[CP_C], result.Value);
            foreach (LabelAndValue labelValue in result.LabelValues)
            {
                Assert.AreEqual(allExpectedCounts[CP_D + "/" + labelValue.Label], labelValue.Value);
            }

            IOUtils.Dispose(indexReader, taxoReader);
        }
    }
}


text: Practice Advisors


text:
<!DOCTYPE html>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Troubleshooting — CookCC 0.4.3 documentation</title>

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

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

        <link rel="index" title="Index"
              href="genindex.html"/>
        <link rel="search" title="Search" href="search.html"/>
    <link rel="top" title="CookCC 0.4.3 documentation" href="index.html"/>
        <link rel="next" title="Input Encoding Detection" href="Input-Encoding-Detection.html"/>
        <link rel="prev" title="Yacc" href="Output-Yacc.html"/>

             CookCC

                0.4.3

  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>

CookCC documentation

Tutorial (pdf)

Command Line Options

Maven

Ant Task

Lexer

Regular Expression

Parser

Input

Java

XML

Yacc

Output

Java

Plain Text

XML

Yacc

Miscellaneous

JavaDoc

Troubleshooting

Mysterious Crash in APT

Test cases

Discussion group

LICENSE

Input Encoding Detection

ASCII map

Unicode map

          CookCC

Docs »

Troubleshooting

Troubleshooting¶

Mysterious Crash in APT¶

For the following exception

[cookcc] An exception has occurred in apt (1.6.0_22). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
[cookcc] java.lang.ClassCastException: com.sun.tools.javac.tree.JCTree$JCErroneous cannot be cast to com.sun.tools.javac.tree.JCTree$JCAnnotation
[cookcc]     at com.sun.tools.javac.comp.Annotate.enterAttributeValue(Annotate.java:205)
[cookcc]     at com.sun.tools.javac.comp.Annotate.enterAttributeValue(Annotate.java:219)
[cookcc]     at com.sun.tools.javac.comp.Annotate.enterAnnotation(Annotate.java:167)
[cookcc]     at com.sun.tools.javac.comp.MemberEnter.enterAnnotations(MemberEnter.java:743)
[cookcc]     at com.sun.tools.javac.comp.MemberEnter.access$300(MemberEnter.java:42)
[cookcc]     at com.sun.tools.javac.comp.MemberEnter$5.enterAnnotation(MemberEnter.java:711)
[cookcc]     at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:95)
[cookcc]     at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:87)
[cookcc]     at com.sun.tools.javac.comp.Enter.complete(Enter.java:485)
[cookcc]     at com.sun.tools.javac.comp.Enter.main(Enter.java:442)
[cookcc]     at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:250)
[cookcc]     at com.sun.tools.apt.main.Main.compile(Main.java:1102)
[cookcc]     at com.sun.tools.apt.main.Main.compile(Main.java:964)
[cookcc]     at com.sun.tools.apt.Main.processing(Main.java:95)
[cookcc]     at com.sun.tools.apt.Main.process(Main.java:43)
[cookcc]     at com.sun.tools.apt.Main.main(Main.java:34)

The cause of the issue is likely due to an extra comma after the last
element in the annotation array.

@Shortcuts ( shortcuts = {
    @Shortcut (name="arg", pattern="[^=;, \\t\\r\\n\\f'\"]"),
    @Shortcut (name="ws", pattern="[ \\t\\r\\n\\f]"),
})

Eclipse Java Compiler (ECJ) does not report the extra comma in
annotation arrays as a syntax error. Sun's APT does not report the
correct error message. So it gets a bit confusing. Once removing this
extra comma, the problem would go away.

If the problem still persists, check your class path passed to APT. The
incorrect PATH separator can lead to the similar back trace as well.

        Next

         Previous

        © Copyright 2017-2018, Heng Yuan.

  Built with Sphinx using a theme provided by Read the Docs.