text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.08.07 at 06:17:52 PM CEST
//

package org.w3._2005.atom;

import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

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

 * <complexType>
 *   <complexContent>
 *     <extension base="{http://www.w3.org/2005/Atom}undefinedContent">
 *       <attGroup ref="{http://www.w3.org/2005/Atom}atomCommonAttributes"/>
 *       <attribute name="term" use="required" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
 *       <attribute name="scheme" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
 *       <attribute name="label" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "category")
public class Category
    extends UndefinedContent
{

    @XmlAttribute(name = "term", required = true)
    @XmlSchemaType(name = "anySimpleType")
    protected String term;
    @XmlAttribute(name = "scheme")
    @XmlSchemaType(name = "anySimpleType")
    protected String scheme;
    @XmlAttribute(name = "label")
    @XmlSchemaType(name = "anySimpleType")
    protected String label;
    @XmlAttribute(name = "base", namespace = "http://www.w3.org/XML/1998/namespace")
    @XmlSchemaType(name = "anyURI")
    protected String base;
    @XmlAttribute(name = "lang", namespace = "http://www.w3.org/XML/1998/namespace")
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    @XmlSchemaType(name = "language")
    protected String lang;

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

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

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

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

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

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

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

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

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

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

}


text:
import { combineReducers } from 'redux';

import auth from './auth';

export default combineReducers({
  auth
})

redpajama_set_name: RedPajamaGithub


text:
This is yet another starter template using React & Redux. However, this project attempts to create a bare bones starter to start developing on a side project, a demo or a POC right away.
I created this after being fed up of using different starter and spending a day clearing out unnecessary code out of them. It demonstrates simple react redux flow along with a few offline capabilities using the technologies listed below.

But first, the [demo!]() A basic counter, the buttons update the redux store via dispatching an action.
Note: Check the console for state changes. (thanks to [redux-logger](https://github.com/evgenyrodionov/redux-logger))

## Technologies used:

- [React](https://github.com/facebook/react)
- [Redux](https://github.com/rackt/redux)
- [React Router](https://github.com/rackt/react-router)
- [create-react-app](https://github.com/facebookincubator/create-react-app/)
- [Babel](http://babeljs.io/) and [Webpack](http://webpack.github.io/) (now behind the scenes thanks to create-react-app)

## Feature highlights:

#### Best React Practice - [Separating "smart" and "dumb" components](https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0)

This design pattern makes even more sense when using React along with Redux, where top-level smart components (a.k.a. containers in this codebase such as `Home`) subscribe to Redux state and dispatch Redux actions, while low level components (such as `User`) read data and invoke callbacks passed in as props.

Although it's "cool" to have universal (server-side, isomorphic) rendering these days, there are many situations (like this one) where that complexity is simply not useful or applicable.

## Getting Started
Thanks to [create-react-app](https://github.com/facebookincubator/create-react-app), we will have a configuration-free dev experience.

To get started, please clone this git repository and then run `npm install` once under the project top-level directory.

```
git clone https://github.com/vsc-github/simplest-offline-react-redux-starter awesome-project
cd awesome-project
npm install
```
This will install the dependencies for the client side.

**You'll need to have Node installed on your machine**. (Node >= 6 and npm >= 3 are recommended).

## While You're Developing...
Whenever you want to run/test the program, `cd` to the project top-level directory. Use these commands:

### `npm start`

Runs the app in the development mode, using the Webpack-provided "development server".

Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.

You will also see any lint errors in the console.

### `npm run build`

Builds the app for production to the `build` folder.

It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.

Your app is ready to be deployed!

### `npm run eject`

Note: `eject` is an advanced `create-react-app` tool. Read the [how-to](https://github.com/facebookincubator/create-react-app/blob/master/template/README.md) for details.

## How Do I ... ?

This project was ported to use [create-react-app](https://github.com/facebookincubator/create-react-app) for handling all assets.
Many questions are answered in its [how-to](https://github.com/facebookincubator/create-react-app/blob/master/template/README.md).


text:
module Last
module Environments

module Environment
  @@variables = {}

  def expect(variable_name, **options)
    environment_name           = options[:in] || :default
    @@variables[variable_name] = environment_name
  end

  def validate(environment_hash = ENV, environment_name = (ENV["RACK_ENV"] || :default))
    @@variables.each do |variable_name, target_environment|
      next if (target_environment != :default) && (target_environment != environment_name.to_sym)
      raise variable_name if environment_hash["#{variable_name.upcase}"].nil?
    end
  end
end

end
end


text:
DATE1=$(date +%Y%m%d%H%M)
DATE=$(date +%d-%m-%y_%H-%M)

mkdir -p /var/lib/backup/nginx

nginx_src='/nginx'

if [ ! -d $nginx_src ]; then

        echo "DATE:" "$DATE" > /tmp/nginx.txt
        echo "" >> /tmp/nginx.txt
        echo "DESCRIPTION: ${SOURCE_NAME}_Nginx backup" >> /tmp/nginx.txt
        echo "" >> /tmp/nginx.txt
        echo "STATUS: Nginx backup failed." >> /tmp/nginx.txt
        echo "" >> /tmp/nginx.txt
	echo "The source backup directory: nginx_src is not available" >> /tmp/nginx.txt
        < /tmp/nginx.txt mail -s "${SOURCE_NAME}: Nginx Data Backup" "${CRON_BACKUP_MAIL}"
	exit
else
	tar cvzf /var/lib/backup/nginx/"${SOURCE_NAME}"_nginx_data_backup_"${DATE1}".tgz ${nginx_src}/
fi

# Moving the backup to S3 bucket
if s3cmd put -r --no-mime-magic /var/lib/backup/nginx/ s3://"${S3_BUCKET_NGINX}"/;
then
        echo "DATE:" "$DATE" > /tmp/nginx.txt
        echo "" >> /tmp/nginx.txt
        echo "DESCRIPTION: ${SOURCE_NAME}_Nginx backup" >> /tmp/nginx.txt
        echo "" >> /tmp/nginx.txt
        echo "STATUS: Nginx backup succeeded." >> /tmp/nginx.txt
        echo "" >> /tmp/nginx.txt
        echo "******* Nginx Data Backup ****************" >> /tmp/nginx.txt
        echo "" >> /tmp/nginx.txt
        s3cmd ls --no-mime-magic s3://"${S3_BUCKET_NGINX}"/  --human-readable | grep -i "${SOURCE_NAME}"_nginx_data | cut -d' ' -f3- | tac | head -10 | sed "s,s3:\/\/${S3_BUCKET_NGINX}\/,,g" &>> /tmp/nginx.txt
        echo "" >> /tmp/nginx.txt
        echo "************** END **************************" >> /tmp/nginx.txt

else
        echo "DATE:" "$DATE" > /tmp/nginx.txt
        echo "" >> /tmp/nginx.txt
        echo "DESCRIPTION: ${SOURCE_NAME}_Nginx backup" >> /tmp/nginx.txt
        echo "" >> /tmp/nginx.txt
        echo "STATUS: Nginx backup failed." >> /tmp/nginx.txt
        echo "" >> /tmp/nginx.txt
        echo "Something went wrong, please check it"  >> /tmp/nginx.txt
        < /tmp/nginx.txt mail -s "${SOURCE_NAME}: Nginx Data Backup" "${CRON_BACKUP_MAIL}"
fi
< /tmp/nginx.txt mail -s "${SOURCE_NAME}: Nginx Data Backup" "${CRON_BACKUP_MAIL}"

# Remove the old backup data in local directory to avoid excessive storage use
find /var/lib/backup/nginx/ -type f -exec rm {} \;

exit


text: <app-course-list-item *ngFor="let test of tests"></app-course-list-item>


text:
package tooodo.glooory.com.tooodo.tasks;

import android.content.Intent;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView;
import android.support.test.espresso.IdlingResource;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.widget.FrameLayout;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;
import tooodo.glooory.com.tooodo.R;
import tooodo.glooory.com.tooodo.base.BaseActivity;
import tooodo.glooory.com.tooodo.base.MyApplication;
import tooodo.glooory.com.tooodo.statistics.StatisticsActivity;
import tooodo.glooory.com.tooodo.util.ActivityUtils;
import tooodo.glooory.com.tooodo.util.EspressoIdlingResource;

/**
 * Created by Glooory on 17/1/24.
 */

public class TasksActivity extends BaseActivity {

    private static final String CURRENT_FILTERING_KEY = "CURRENT_FILTERING_KEY";

    @Inject
    TasksPresenter mTasksPresenter;
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.container)
    FrameLayout mContainer;
    @BindView(R.id.fab_add_task)
    FloatingActionButton mFab;
    @BindView(R.id.coordinator_layout)
    CoordinatorLayout mCoordinatorLayout;
    @BindView(R.id.nav_view)
    NavigationView mNavView;
    @BindView(R.id.drawer_layout)
    DrawerLayout mDrawerLayout;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tasks);
        ButterKnife.bind(this);

        initViews();
        if (savedInstanceState != null) {
            TasksFilterType currentFiltering =
                    (TasksFilterType) savedInstanceState.getSerializable(CURRENT_FILTERING_KEY);
            mTasksPresenter.setFiltering(currentFiltering);
        }
        Log.d("TasksActivity", "onCreate() excuted.");
    }

    private void initViews() {
        setSupportActionBar(mToolbar);
        getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        mDrawerLayout.setStatusBarBackground(R.color.colorPrimaryDark);
        setUpDrawerContent(mNavView);
        TasksFragment tasksFragment =
                (TasksFragment) getSupportFragmentManager().findFragmentById(R.id.container);
        if (tasksFragment == null) {
            tasksFragment = TasksFragment.newInstance();
            ActivityUtils.addFragmentToActivity(getSupportFragmentManager(),
                    tasksFragment, R.id.container);
        }

        //Create the presenter.
        DaggerTasksComponent.builder()
                .tasksRepositoryComponent(((MyApplication) getApplication()).getTasksRepositoryComponent())
                .tasksPresenterModule(new TasksPresenterModule(tasksFragment))
                .build()
                .inject(this);
    }

    private void setUpDrawerContent(NavigationView navigationView) {
        navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
            @Override
            public boolean onNavigationItemSelected(@NonNull MenuItem item) {
                switch (item.getItemId()) {
                    case R.id.menu_nav_list:
                        // Do nothing.
                        break;
                    case R.id.menu_nav_statistics:
                        Intent intent =
                                new Intent(TasksActivity.this, StatisticsActivity.class);
                        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                                | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                        startActivity(intent);
                        break;
                    default:
                        break;
                }
                item.setChecked(true);
                mDrawerLayout.closeDrawer(GravityCompat.START);
                return true;
            }
        });
    }

    @Override
    public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
        outState.putSerializable(CURRENT_FILTERING_KEY, mTasksPresenter.getFiltering());
        super.onSaveInstanceState(outState, outPersistentState);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                mDrawerLayout.openDrawer(GravityCompat.START);
                return true;
        }
        return super.onOptionsItemSelected(item);
    }

    @VisibleForTesting
    public IdlingResource getCountingIdlingResource() {
        return EspressoIdlingResource.getIdlingResource();
    }
}


text:
/* global casper */

var kernel_prefix = 'conda-env',
  kernel_suffix = 'r',
  kernel_label = 'R';

casper.notebook_test_kernel(kernel_prefix, kernel_suffix, function(){
  casper.screenshot.init("env-r-kernel");
  casper.viewport(1440, 900)
    .then(default_python_kernel_test);
});

function default_python_kernel_test(){
  this.screenshot("kernel_indicator_name");
  this.test.assertSelectorHasText('.kernel_indicator_name', kernel_label);
}


text:
module.exports = task

var path = require('path')
  , join = path.join
  , SVGSprite = require('svg-sprite')
  , svgToPng = require('svg-to-png')
  , anyNewerFiles = require('any-newer-files')
  , fs = require('fs')

// Added to stop the SVGSprite hijacking the uncaughtException handler. Nasty :(
// process.removeAllListeners()

function task(pliers, config) {
  pliers('buildSprite', function (done) {

    var spriteDirectory = join(pliers.cwd, 'assets', 'stylus', config.projectId, 'sprite')

    pliers.mkdirp(spriteDirectory)
    if (!fs.existsSync(join(spriteDirectory, 'sprite-generated.styl'))) {
      pliers.logger.info('No sprite Stylus found. Recompiling sprite')
    } else if (!anyNewerFiles(pliers.filesets.singleSvgs, pliers.filesets.compiledSprites)) {
      pliers.logger.warn('No sprite changes found. No recompile required')
      return done()
    }

    var imageSrcDir = join(pliers.cwd, 'assets', 'img', config.projectId, 'sprite', 'raw')
      , imageOutDir = join(pliers.cwd, 'assets', 'img', config.projectId, 'sprite', 'generated')
      , options =
        { render:
          { css: false
          , styl:
            { dest: join(pliers.cwd, 'assets', 'stylus', config.projectId, 'sprite', 'sprite-generated.styl')
            , template: join(pliers.cwd, 'assets', 'stylus', 'common', 'sprite', 'sprite-template.styl')
            }
          }
        , variables:
          { replacedExpression: function () {
              if ( this.expression.indexOf('--hover') !== -1 ) {
                return '.btn:hover .' + this.expression.replace('--hover', '') +
                  ', .btn:focus .' + this.expression.replace('--hover', '') +
                  ', .text-btn:hover .' + this.expression.replace('--hover', '') +
                  ', .text-btn:focus .' + this.expression.replace('--hover', '')
              } else {
                return '.' + this.expression
              }
            }
          }
        , verbose: 0
        , padding: 2
        , common: 'icon'
        , prefix: 'icon-'
        , sprite: 'icon-sprite'
        , spritedir: ''
        }
      , callback = function(err, results) {
          if (err) throw err
          pliers.logger.info('SVG Sprite Created')
          pliers.logger.debug('Compiled SVG sprite from ' + results.data.svg.length + ' images')
          svgToPng.convert(imageOutDir, imageOutDir).then( function() {
            pliers.logger.info('PNG Sprite Created')
            done()
          })
        }

    SVGSprite.createSprite(imageSrcDir, imageOutDir, options, callback)

  })
}


text:
package com.covisint.cf.servicebroker.jacoco.model;

import java.util.HashMap;
import java.util.Map;

import com.covisint.cf.servicebroker.jacoco.model.BindingRequest;

import static org.junit.Assert.assertEquals;

/**
 * Test class for BindingRequest.
 *
 * @version 1.0, 2015-10-09
 * @author Lingeshm
 *
 */

public final class BindingRequestTest extends AbstractDeserializationTest<BindingRequest> {

    public BindingRequestTest() {
        super(BindingRequest.class);
    }

    @Override
    protected void assertContents(BindingRequest instance) {
        assertEquals("test-service-id", instance.getServiceId());
        assertEquals("test-plan-id", instance.getPlanId());
        assertEquals("test-app-guid", instance.getAppGuid());
    }

    @Override
    protected Map getMap() {
        Map<String, String> m = new HashMap<>();
        m.put("service_id", "test-service-id");
        m.put("plan_id", "test-plan-id");
        m.put("app_guid", "test-app-guid");

        return m;
    }

}


text:
package org.apache.hive.hcatalog.templeton.tool;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.hadoop.conf.Configuration;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooDefs.Ids;

/**
 * A storage implementation based on storing everything in ZooKeeper.
 * This keeps everything in a central location that is guaranteed
 * to be available and accessible.
 *
 * Data is stored with each key/value pair being a node in ZooKeeper.
 */
public class ZooKeeperStorage implements TempletonStorage {

  public static final String TRACKINGDIR = "/created";

  // Locations for each of the storage types
  public String storage_root = null;
  public String job_path = null;
  public String job_trackingpath = null;
  public String overhead_path = null;

  public static final String ZK_HOSTS = "templeton.zookeeper.hosts";
  public static final String ZK_SESSION_TIMEOUT
    = "templeton.zookeeper.session-timeout";

  public static final String ENCODING = "UTF-8";

  private static final Log LOG = LogFactory.getLog(ZooKeeperStorage.class);

  private CuratorFramework zk;

  /**
   * Open a ZooKeeper connection for the JobState.
   */
  public static CuratorFramework zkOpen(String zkHosts, int zkSessionTimeoutMs)
    throws IOException {
    //do we need to add a connection status listener?  What will that do?
    ExponentialBackoffRetry retryPolicy = new ExponentialBackoffRetry(1000, 3);
    CuratorFramework zk = CuratorFrameworkFactory.newClient(zkHosts, zkSessionTimeoutMs,
      CuratorFrameworkFactory.builder().getConnectionTimeoutMs(), retryPolicy);
    zk.start();
    return zk;
  }

  /**
   * Open a ZooKeeper connection for the JobState.
   */
  public static CuratorFramework zkOpen(Configuration conf) throws IOException {
    /*the silly looking call to Builder below is to get the default value of session timeout
    from Curator which itself exposes it as system property*/
    return zkOpen(conf.get(ZK_HOSTS),
      conf.getInt(ZK_SESSION_TIMEOUT, CuratorFrameworkFactory.builder().getSessionTimeoutMs()));
  }

  public ZooKeeperStorage() {
    // No-op -- this is needed to be able to instantiate the
    // class from the name.
  }

  /**
   * Close this ZK connection.
   */
  public void close() throws IOException {
    if (zk != null) {
      zk.close();
    }
  }

  public void startCleanup(Configuration config) {
    try {
      ZooKeeperCleanup.startInstance(config);
    } catch (Exception e) {
      LOG.warn("Cleanup instance didn't start.");
    }
  }

  /**
   * Create a node in ZooKeeper
   */
  public void create(Type type, String id)
    throws IOException {
    boolean wasCreated = false;
    try {
      zk.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT).withACL(Ids.OPEN_ACL_UNSAFE).forPath(makeZnode(type, id));
      wasCreated = true;
    }
    catch(KeeperException.NodeExistsException ex) {
      //we just created top level node for this jobId
    }
    catch(Exception ex) {
      throw new IOException("Error creating " + makeZnode(type, id), ex);
    }
    if(wasCreated) {
      try {
        // Really not sure if this should go here.  Will have
        // to see how the storage mechanism evolves.
        if (type.equals(Type.JOB)) {
          JobStateTracker jt = new JobStateTracker(id, zk, false, job_trackingpath);
          jt.create();
        }
      } catch (Exception e) {
        LOG.error("Error tracking (jobId=" + id + "): " + e.getMessage());
        // If we couldn't create the tracker node, don't create the main node.
        try {
          zk.delete().forPath(makeZnode(type, id));//default version is -1
        }
        catch(Exception ex) {
          //EK: it's not obvious that this is the right logic, if we don't record the 'callback'
          //for example and never notify the client of job completion
          throw new IOException("Failed to delete " + makeZnode(type, id) + ":" + ex);
        }
      }
    }
    try {
      if (zk.checkExists().forPath(makeZnode(type, id)) == null) {
        throw new IOException("Unable to create " + makeZnode(type, id));
      }
    }
    catch (Exception ex) {
      throw new IOException(ex);
    }
    if (wasCreated) {
      try {
        saveField(type, id, "created",
          Long.toString(System.currentTimeMillis()));
      } catch (NotFoundException nfe) {
        // Wow, something's really wrong.
        throw new IOException("Couldn't write to node " + id, nfe);
      }
    }
  }

  /**
   * Get the path based on the job type.
   *
   * @param type
   */
  public String getPath(Type type) {
    String typepath = overhead_path;
    switch (type) {
    case JOB:
      typepath = job_path;
      break;
    case JOBTRACKING:
      typepath = job_trackingpath;
      break;
    }
    return typepath;
  }

  public static String[] getPaths(String fullpath) {
    ArrayList<String> paths = new ArrayList<String>();
    if (fullpath.length() < 2) {
      paths.add(fullpath);
    } else {
      int location = 0;
      while ((location = fullpath.indexOf("/", location + 1)) > 0) {
        paths.add(fullpath.substring(0, location));
      }
      paths.add(fullpath);
    }
    String[] strings = new String[paths.size()];
    return paths.toArray(strings);
  }

  /**
   * A helper method that sets a field value.
   * @throws java.lang.Exception
   */
  private void setFieldData(Type type, String id, String name, String val) throws Exception {
    try {
      zk.create().withMode(CreateMode.PERSISTENT).withACL(Ids.OPEN_ACL_UNSAFE)
        .forPath(makeFieldZnode(type, id, name), val.getBytes(ENCODING));
    } catch (KeeperException.NodeExistsException e) {
      zk.setData().forPath(makeFieldZnode(type, id, name), val.getBytes(ENCODING));
    }
  }

  /**
   * Make a ZK path to the named field.
   */
  public String makeFieldZnode(Type type, String id, String name) {
    return makeZnode(type, id) + "/" + name;
  }

  /**
   * Make a ZK path to job
   */
  public String makeZnode(Type type, String id) {
    return getPath(type) + "/" + id;
  }

  @Override
  public void saveField(Type type, String id, String key, String val)
    throws NotFoundException {
    try {
      if (val != null) {
        create(type, id);
        setFieldData(type, id, key, val);
      }
    } catch (Exception e) {
      throw new NotFoundException("Writing " + key + ": " + val + ", "
        + e.getMessage());
    }
  }

  @Override
  public String getField(Type type, String id, String key) {
    try {
      byte[] b = zk.getData().forPath(makeFieldZnode(type, id, key));
      return new String(b, ENCODING);
    } catch (Exception e) {
      return null;
    }
  }

  @Override
  public boolean delete(Type type, String id) throws NotFoundException {
    try {

      for (String child : zk.getChildren().forPath(makeZnode(type, id))) {
        try {
          zk.delete().forPath(makeFieldZnode(type, id, child));
        } catch (Exception e) {
          // Other nodes may be trying to delete this at the same time,
          // so just log errors and skip them.
          throw new NotFoundException("Couldn't delete " +
            makeFieldZnode(type, id, child));
        }
      }
      try {
        zk.delete().forPath(makeZnode(type, id));
      } catch (Exception e) {
        // Same thing -- might be deleted by other nodes, so just go on.
        throw new NotFoundException("Couldn't delete " +
          makeZnode(type, id));
      }
    } catch (Exception e) {
      // Error getting children of node -- probably node has been deleted
      throw new NotFoundException("Couldn't get children of " +
        makeZnode(type, id));
    }
    return true;
  }

  @Override
  public List<String> getAllForType(Type type) {
    try {
      return zk.getChildren().forPath(getPath(type));
    } catch (Exception e) {
      return new ArrayList<String>();
    }
  }

  @Override
  public void openStorage(Configuration config) throws IOException {
    storage_root = config.get(STORAGE_ROOT);
    job_path = storage_root + "/jobs";
    job_trackingpath = storage_root + TRACKINGDIR;
    overhead_path = storage_root + "/overhead";

    if (zk == null) {
      zk = zkOpen(config);
    }
  }

  @Override
  public void closeStorage() throws IOException {
    close();
  }
}


text:
'use strict';

define(['app'], function(app) {

	return app.controller('HomePageController', ['$scope', '$rootScope', function ($scope, $rootScope) {

			$scope.controller = "HomePageController";
			$rootScope.homePage = true;
			$rootScope.portal = 'cs';

  }]);

});

// require('app').controller('HomePageController', ['$scope', '$rootScope', function ($scope, $rootScope) {
// 	$scope.controller = "HomePageController";

// 	$rootScope.homePage = true;
// 	$rootScope.portal = 'home';

// }]);

// 'use strict';

// define(['app'], function(app) {

// 	return app.controller('HomeController', ['$scope', '$rootScope', function ($scope, $rootScope) {

// 		$scope.controller = "HomeController";
// 		$rootScope.homePage = true;
// 		$rootScope.portal = 'home';

//   }]);
// });

// alert('test');


text:
package com.pivotallabs.robolectricgem.matchers;

import android.app.Activity;
import android.content.Intent;
import com.pivotallabs.greatexpectations.MatcherOf;
import com.xtremelabs.robolectric.shadows.ShadowIntent;

import static com.xtremelabs.robolectric.Robolectric.shadowOf;

@MatcherOf(Activity.class)
public class ActivityMatcher<T extends Activity, M extends ActivityMatcher<T, M>> extends AndroidMatcher<T, M> {
    public boolean toBeFinishing() {
        return actual.isFinishing();
    }

    public boolean toHaveStarted(Class<? extends Activity> expected) {
        return toHaveStarted(expected.getName());
    }

    public boolean toHaveStarted(String expected) {
        Intent nextStartedActivity = shadowOf(actual).getNextStartedActivity();
        if (nextStartedActivity == null) {
            return false;
        }
        ShadowIntent shadowIntent = shadowOf(nextStartedActivity);
        return shadowIntent.getComponent().getClassName().equals(expected);
    }
}


text:
#ifndef TVECTORIMAGE_INCLUDED
#define TVECTORIMAGE_INCLUDED

#include <memory>

#include "timage.h"

// da togliere spostando cose in altri file!!
#include "traster.h"
#include "tstream.h"

#include <set>

#undef DVAPI
#undef DVVAR
#ifdef TVECTORIMAGE_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif

//#define NEW_REGION_FILL
#define DISEGNO_OUTLINE 0

//=============================================================================
// Forward declarations
class TVectorImageP;
class TStroke;
class TRegion;
class TRegionId;
class TColorStyle;
class TVectorRenderData;
class TRegionId;
class TFilledRegionInf;
namespace TThread
{
class Mutex;
}

//=============================================================================

#define REGION_COMPUTING_PRECISION 128.0

const double c_newAutocloseTolerance = 1.15;

//-----------------------------------------------------------------------------

class VIStroke;

/*!
  TVectorImage: describe a vector image.
    A vector image is a set of strokes and regions.
  \relates  TImage
*/
class DVAPI TVectorImage : public TImage
{
	class Imp;
	int pickGroup(const TPointD &pos, bool onEnteredGroup) const;

public:
	std::unique_ptr<Imp> m_imp;

	struct IntersectionBranch {
		int m_strokeIndex;
		int m_style;
		double m_w;
		UINT m_currInter;
		UINT m_nextBranch;
		bool m_gettingOut;
	};
	//!if the vectorimage is loaded from disc, loaded=true
	TVectorImage(bool loaded = false);
	virtual ~TVectorImage();

	TImage::Type getType() const
	{
		return VECTOR;
	}

	/*!Set valid regions flags
	    call validateRegions() after region/stroke changes
     */
	void validateRegions(bool state = false);
	//! Get valid regions flags
	/*! Call validateRegions() after region/stroke changes
     */
	bool areValidRegions();

	//! Return a clone of image
	TVectorImageP clone() const;

	//! Create a new \b TImage
	TImage *cloneImage() const;

	//! Transform a stroke using an affine \b TAffine
	void transform(const TAffine &aff, bool doChangeThickness = false);

	// usato solo in pli
	//! Put a region in the regions' container
	void putRegion(TRegion *region);

	//! Return the regions' count
	UINT getRegionCount() const;
	//! Get a region at index position
	TRegion *getRegion(UINT index) const;
	//! Get a region at \b TRegionId id
	TRegion *getRegion(TRegionId) const;

	//! returns the region equivalent to region, 0 if does not exists.
	TRegion *findRegion(const TRegion &region) const;
	//calcola tutte le regioni che intersecano  rect(e qualcuna in piu' a volte...)
	void findRegions(const TRectD &rect);

	//! Return the strokes' count
	UINT getStrokeCount() const;
	//! Get a \b TStroke stroke at index position
	TStroke *getStroke(UINT index) const;
	//! Get a \b VIStroke stroke at index position
	VIStroke *getVIStroke(UINT index) const;
	//! Get a \b VIStroke stroke at id
	VIStroke *getStrokeById(int id) const;

	//! Get the stroke index by id
	int getStrokeIndexById(int id) const;

	//! Get the stroke index by id
	int getStrokeIndex(TStroke *stroke) const;

	//! Group strokes in the \b fromIndex - \b toIndex range
	/*! Only adjacent strokes can be grouped*/
	void group(int fromIndex, int count);

	//! Ungroup all the strokes in the group of index \b index.
	/*! Return the number of ungroped stroke.*/
	int ungroup(int index);

	bool isStrokeGrouped(UINT index) const { return getGroupDepth(index) > 0; }
	//! Return a value grater of zero if stroke of index \b index is contained in a group
	/*! The returned number is the depth of the nested group containing the stroke.*/
	int getGroupDepth(UINT index) const;

	//! it says if two strokes are in the same group, even qhen the image is entered in a group.

	bool sameSubGroup(int strokeIndex0, int strokeIndex1) const;

	int getCommonGroupDepth(int strokeIndex0, int strokeIndex1) const;

	//! Return -1 if two object are contained in the same group.
	/*! Objects can be strokes or regions: they are identified by \b index1 and \b index2.
		If objects aren't in the same group, the method return the number of equal level into the nested groups.*/
	int areDifferentGroup(UINT index1, bool isRegion1, UINT index2, bool isRegion2) const;

	//utility functions
	//! Return true if two strokes has common parent groups.
	bool sameParentGroupStrokes(UINT index1, UINT index2) const
	{
		int ret = areDifferentGroup(index1, false, index2, false);
		return (ret == -1 || ret >= 1);
	}
	//! Return true if two objects are contained into the same group.
	bool sameGroup(UINT index1, UINT index2) const
	{
		return areDifferentGroup(index1, false, index2, false) == -1;
	}
	//! Return true if a stroke and a region have common parent groups.
	bool sameGroupStrokeAndRegion(UINT strokeIndex, UINT regionIndex) const
	{
		return areDifferentGroup(strokeIndex, false, regionIndex, true) == -1;
	}

	//entering and exiting groups
	bool inCurrentGroup(int strokeIndex) const;
	bool canEnterGroup(int strokeIndex) const;
	bool selectable(int strokeIndex) const;
	bool enterGroup(int index);

	//return -1 if no possible to exit, otherwise a stroke index  which has same id of the exiting group
	int exitGroup();
	bool isEnteredGroupStroke(int index) const;
	bool canMoveStrokes(int strokeIndex, int count, int moveBefore) const;
	//returns depth of group inside.
	int isInsideGroup() const;

	int pickGroup(const TPointD &pos) const;
	int getGroupByStroke(UINT index) const;
	int getGroupByRegion(UINT index) const;

	/*!
      get the stroke nearest at point
      \note outw is stroke parameter w in [0,1]
      \par p [input] is point nearest stroke
      \par outw [output] is parameter of minimum in stroke
      \par strokeIndex [output] is index of stroke in vector image
      \par dist2 [output] is the square value of distance
      \ret true if a value is found
     */
	bool getNearestStroke(
		const TPointD &p,

		// output
		double &outw,
		UINT &strokeIndex,
		double &dist2,
		bool inCurrentGroup = true) const;

	//! Enable or disable the style of a stroke according to the \b enable param.
	static void enableStrokeStyle(int index, bool enable);
	//! Return true if the style of the stroke identified by \b index is enabled.
	static bool isStrokeStyleEnabled(int index);

	//! Remove the stroke of index \b index and if \b doComputeRegions is true recompute the regions
	TStroke *removeStroke(int index, bool doComputeRegions = true);
	//! Remove the strokes identified by indexes in the vector \b toBeRemoved
	/*! If \b deleteThem is true strokes are really delete;
        if \b doComputeRegions is true recompute the regions*/
	void removeStrokes(const std::vector<int> &tobeRemoved, bool deleteThem, bool recomputeRegions);

	//! Delete the \b TStroke stroke of index \b index
	void deleteStroke(int index);
	//! Delete the \b VIStroke stroke
	void deleteStroke(VIStroke *stroke);

	//! Add a stroke at the end of the vector; returns position of the stroke (or -1 if not added)
	int addStroke(TStroke *, bool discardPoints = true);
	int addStrokeToGroup(TStroke *stroke, int strokeIndex);
	//! Replace the stroke at index \b index with \b newStroke
	void replaceStroke(int index, TStroke *newStroke);

	//! Insert a \b VIStroke \b vs at index \b strokeIndex
	void insertStrokeAt(VIStroke *vs, int strokeIndex, bool recomputeRegions = true); //! Move \b count strokes starting from \b fromIndex before the stroke identified by the \b moveBefore index.
	void moveStrokes(int fromIndex, int count, int moveBefore);
	//! Find regions of a \b TVectorImage
	void findRegions(bool fromSwf = false);

// Gmt. VA TOLTO IL PRIMA POSSIBILE.
// E' una pessima cosa rendere platform dependent l'interfaccia pubblica di una
// classe cosi' importante come la VectorImage
#if defined(LINUX) || defined(MACOSX)
	void render(const TVectorRenderData &rd, TRaster32P &ras);
#endif

	//! Make the rendering of the vector image, return a \b TRaster32P with the image rendered
	TRaster32P render(bool onlyStrokes);
	//! Return the region which contains \b p, if none regions contains \b p return 0
	TRegion *getRegion(const TPointD &p);

	//! Fill the region which contains \b p with \b styleId. it returns the  style of the region before filling or -1 if not filled.
	int fill(const TPointD &p, int styleId, bool onlyEmpty = false);
	//! Fill all the regions and strokes contained in \b selectArea or contained into the regions formed by the stroke \b s with the style \b styleId.
	/*! If \b onlyUnfilled is true, only regions filled with the style 0 are filled with the new stile.
		If \b fillAreas is true regions are filled.
		If \b fillLines is true stroke are filled.*/
	bool selectFill(const TRectD &selectArea, TStroke *s, int styleId, bool onlyUnfilled, bool fillAreas, bool fillLines);

	//! Fill all regions contained in the \b stroke area with \b styleIndex
	void areaFill(TStroke *stroke, int styleIndex, bool onlyUnfilled);
	//! Fill the stroke which contains \b p with \b newStyleId; it returns the  style of stroke before filling or -1 if not filled.
	int fillStrokes(const TPointD &p, int newStyleId);

	//! Return true if \b computeRegion method was called
	bool isComputedRegionAlmostOnce() const;

	//! Return the image bounding box in the image coordinate system
	TRectD getBBox() const;

	//! Call the following method after stroke modification
	//! \note you must specify, using the second argument, whether the modification was a reflection
	void notifyChangedStrokes(const std::vector<int> &strokeIndexArray, const std::vector<TStroke *> &oldStrokeArray, bool areFlipped = false);

	//! Call the following method after stroke modification
	void notifyChangedStrokes(int strokeIndex, TStroke *oldStroke = 0, bool isFlipped = false);

	UINT getFillData(std::unique_ptr<IntersectionBranch[]>& v);
	void setFillData(std::unique_ptr<IntersectionBranch[]> const& v, UINT size, bool doComputeRegions = true);

	void drawAutocloses(const TVectorRenderData &rd) const; //debug method

	/*! Includes a (transformed) copy of imgs in this. If setSelected==true then selects imported strokes.
		It also includes the color informations.
		Try to assign the same stroke ids (if unused)
	*/
	void enableRegionComputing(bool enabled, bool notIntersectingStrokes);

	/*! if enabled, region edges are joined together when possible. for flash render, should be disabled!
  */
	void enableMinimizeEdges(bool enabled);
	/*! Creates a new Image using the selected strokes. If removeFlag==true then removes selected strokes
	    It includes (in the new image) the color informations too.
		It mantains stroke ids.
	*/
	TVectorImageP splitSelected(bool removeFlag);

	//! Merge the image with the \b img.
	void mergeImage(const TVectorImageP &img, const TAffine &affine, bool sameStrokeId = true);

	void mergeImage(const TVectorImageP &img, const TAffine &affine, const std::map<int, int> &styleTable, bool sameStrokeId = true);
	//! Merge the image with the vector of image \b images.
	void mergeImage(const std::vector<const TVectorImage *> &images);

	//! Insert the \b TVectorImageP \b img
	void insertImage(const TVectorImageP &img, const std::vector<int> &dstIndices);
	TVectorImageP splitImage(const std::vector<int> &indices, bool removeFlag);

	//! Return the used styles in the image
	void getUsedStyles(std::set<int> &styles) const;
	//! Reassign all stroke's style
	void reassignStyles(std::map<int, int> &table);

	//! Transfer the stroke style of the \b sourceStroke in the \b sourceImage to the style
	static void transferStrokeColors(TVectorImageP sourceImage,
									 int sourceStroke,
									 TVectorImageP destinationImage,
									 int destinationStroke);
	//! Set the edges of the stroke identified by \b strokeIndex with the styles \b leftColorIndex and \brightColorIndex.
	void setEdgeColors(int strokeIndex, int leftColorIndex, int rightColorIndex);

	/*! This functions splits stroke with index 'strokeIndex' in n+1 strokes, where n is the size of vector sortedW,
	    cutting it in points w specified in sortedW. SortedW must be sorted in ascending order.
		Resulting strokes are put in VectorImage in position strokeIndex,strokeIndex+1, ... strokeIndex+n.
		Information on fill colors are maintened, as much as possible. */
	void splitStroke(int strokeIndex, const std::vector<DoublePair> &sortedWRanges);
	VIStroke *joinStroke(int index1, int index2, int cpIndex1, int cpIndex2, bool isSmooth);
	VIStroke *extendStroke(int index, const TThickPoint &p, int cpIndex, bool isSmooth);
	/*! this method removes the parts  of the stroke that are not bounds of regions. only ending parts are removed.
  If the entire stroke is not bounding any region, it is kept entitely.
  it returns the original stroke (for undo)*/
	TStroke *removeEndpoints(int strokeIndex);

	/*! this method replaces  the stroke at index with oldstroke. Oldstroke is supposed to contain
   existing stroke. this method is used for undoing removeEndpoints . */
	void restoreEndpoints(int index, TStroke *oldStroke);

	//! Set the autoclose tolerance to the specified value.
	void setAutocloseTolerance(double val);
	//! Return the autoclose tolerance.
	double getAutocloseTolerance() const;

	//!forces the recomputing of all regions (it is actually done only after having loaded the vectorimage)
	void recomputeRegionsIfNeeded();

	/*! Remove all image strokes and all image regions with style index contained in \b styleIds vector.*/
	void eraseStyleIds(const std::vector<int> styleIds);

	TThread::Mutex *getMutex() const;

#ifdef _DEBUG
	void checkIntersections();
#endif

	void computeRegion(const TPointD &p, int styleId);

#ifdef NEW_REGION_FILL
	void resetRegionFinder();
#endif

private: //not implemented
	TVectorImage(const TVectorImage &);
	TVectorImage &operator=(const TVectorImage &);
};

DVAPI VIStroke *cloneVIStroke(VIStroke *vs);
DVAPI void deleteVIStroke(VIStroke *vs);

DVAPI void getClosingPoints(const TRectD &rect, double fac, const TVectorImageP &vi,
							std::vector<std::pair<int, double>> &startPoints,
							std::vector<std::pair<int, double>> &endPoints);

//-----------------------------------------------------------------------------

#ifdef _WIN32
template class DVAPI TSmartPointerT<TVectorImage>;
template class DVAPI TDerivedSmartPointerT<TVectorImage, TImage>;
#endif

class DVAPI TVectorImageP : public TDerivedSmartPointerT<TVectorImage, TImage>
{
public:
	TVectorImageP() {}
	TVectorImageP(TVectorImage *image) : DerivedSmartPointer(image) {}
	TVectorImageP(TImageP image) : DerivedSmartPointer(image) {}
#if !defined(_WIN32)
	TVectorImageP(TImage *image) : DerivedSmartPointer(TImageP(image))
	{
	}
#endif
	operator TImageP()
	{
		return TImageP(m_pointer);
	}
};

//-----------------------------------------------------------------------------

// GMT: DA TOGLIERE. vedi sopra
#ifdef LINUX
DVAPI void hardRenderVectorImage(const TVectorRenderData &rd,
								 TRaster32P &r,
								 const TVectorImageP &vimg);
#endif
//-----------------------------------------------------------------------------

//=============================================================================

class DVAPI TInputStreamInterface
{
public:
	TInputStreamInterface() {}
	virtual ~TInputStreamInterface() {}

	virtual TInputStreamInterface &operator>>(double &) = 0;
	virtual TInputStreamInterface &operator>>(int &) = 0;
	virtual TInputStreamInterface &operator>>(std::string &) = 0;
	virtual TInputStreamInterface &operator>>(UCHAR &) = 0;
	virtual TInputStreamInterface &operator>>(USHORT &) = 0;
	virtual TInputStreamInterface &operator>>(TRaster32P &) = 0;
	virtual TInputStreamInterface &operator>>(TPixel32 &pixel);

	virtual VersionNumber versionNumber() const { return VersionNumber(); }
};

//-----------------------------------------------------------------------------

class DVAPI TOutputStreamInterface
{
public:
	TOutputStreamInterface() {}
	virtual ~TOutputStreamInterface() {}

	virtual TOutputStreamInterface &operator<<(double) = 0;
	virtual TOutputStreamInterface &operator<<(int) = 0;
	virtual TOutputStreamInterface &operator<<(std::string) = 0;
	virtual TOutputStreamInterface &operator<<(UCHAR) = 0;
	virtual TOutputStreamInterface &operator<<(USHORT) = 0;
	virtual TOutputStreamInterface &operator<<(const TRaster32P &) = 0;
	virtual TOutputStreamInterface &operator<<(const TPixel32 &pixel);
};

#if DISEGNO_OUTLINE == 1
extern int CurrStrokeIndex;
#include "tvectorimage.h"
extern const TVectorImage *CurrVimg;
#else
#ifndef DISEGNO_OUTLINE
   *&^&%^^$%&^%$(^(
#endif
#endif

#endif


text:
package ebay

import (
	"encoding/xml"

)

const (
	Version = "933"
)

type Legacy_ErrorMessage struct {
	XmlName xml.Name `xml:"errorMessage"`
	Error   Error    `xml:"error"`
}

type Legacy_Errors struct {
	XmlName      xml.Name `xml:"Errors"`
	ShortMessage string   `xml:"ShortMessage"`
	LongMessage  string   `xml:"LongMessage"`
	ErrorCode    string   `xml:"ErrorCode"`
}

type Legacy_Error struct {
	ErrorId      string `xml:"errorId"`
	Domain       string `xml:"domain"`
	SeverityCode string `xml:"SeverityCode"`
	Severity     string `xml:"Severity"`
	Line         string `xml:"Line"`
	Column       string `xml:"Column"`
	Category     string `xml:"Category"`
	Message      string `xml:"ShortMessage"`
	SubDomain    string `xml:"subdomain"`
}

type Legacy_EBay struct {
	ApplicationId string
}

type Legacy_Item struct {
	ItemITitleD string
	ItemID string
	ListingDetails
	SellingStatus
}

type Legacy_ListingDetails struct {
	EndTime       string
	StartTime       string
	}

type Legacy_SellingStatus struct {
	CurrentPrice       string
	}

type Legacy_Pagination struct {
	EntriesPerPage       string
	OrdersPerPage        string
	PageNumber           string
	TotalNumberOfEntries int
	TotalNumberOfPages   int
}

type Legacy_RequesterCredentials struct {
	RequestToken string `xml:"eBayAuthToken"`
}

func (r *Legacy_RequesterCredentials) Legacy_SetToken(token string) {
	r.RequestToken = token
}

func Legacy_New(application_id string) *Legacy_EBay {
	e := Legacy_EBay{}
	e.ApplicationId = application_id

	return &e
}

func (p *Legacy_Pagination) Legacy_Setpagination(entriesperpage, pagenumber string) {
	p.EntriesPerPage = entriesperpage
	p.PageNumber = pagenumber
}


text:
package no.priv.bang.ukelonn.beans;

public class SumYearMonth extends SumYear {

    private int month;

    private SumYearMonth() {}

    public int getMonth() {
        return month;
    }

    public static SumYearMonthBuilder with() {
        return new SumYearMonthBuilder();
    }

    public static class SumYearMonthBuilder extends SumYearBuilder {
        private int month = -1;

        @Override
        public SumYearMonth build() {
            SumYearMonth sumYearMonth = new SumYearMonth();
            copyValues(sumYearMonth);
            sumYearMonth.month = this.month;
            return sumYearMonth;
        }

        @Override
        public SumYearMonthBuilder sum(double sum) {
            super.sum(sum);
            return this;
        }

        @Override
        public SumYearMonthBuilder year(int year) {
            super.year(year);
            return this;
        }

        public SumYearMonthBuilder month(int month) {
            this.month = month;
            return this;
        }

    }

}


text:
Try to follow PSR-2, and pay attention to whatever PHPMD complains about.

## Tools

API documentation will be written out to doc/

phpcs and phpmd should stay quiet as long as you don't anger them

### Windows
- vendor\bin\phpunit.bat --configuration phpunit.xml.dist --coverage-text
- vendor\bin\phpcs.bat --standard=phpcs.xml
- vendor\bin\phpmd.bat src text phpmd.xml
- vendor\bin\phpdoc.bat

### Sensible Operating Systems
- vendor/bin/phpunit --configuration phpunit.xml.dist --coverage-text
- vendor/bin/phpcs --standard=phpcs.xml
- vendor/bin/phpmd src text phpmd.xml
- vendor/bin/phpdoc


text:
#ifndef __SPIRA_H
#define __SPIRA_H

#include "hdif.h"

/*
 * The SPIRA structure
 *
 * NOTE: This is one of the only HDIF structure that we layout entirely
 * as a C struct because it's provided by us to the FSP. Almost everything
 * else is generated by the FSP, and thus must be "parsed" since the various
 * offsets and alignments might change.
 */

#define SPIRA_VERSION		0x20	/* Like 730 ? */

struct spira_ntuple {
	__be64		addr;
	__be16		alloc_cnt;
	__be16		act_cnt;
	__be32		alloc_len;
	__be32		act_len;
	__be32		tce_off;
	__be64		padding;
} __packed;

#define SPIRA_NTUPLES_COUNT	0x18

struct spira_ntuples {
	struct HDIF_array_hdr	array_hdr;
	struct spira_ntuple	sp_subsys;		/* 0x040 */
	struct spira_ntuple	ipl_parms;		/* 0x060 */
	struct spira_ntuple	nt_enclosure_vpd;	/* 0x080 */
	struct spira_ntuple	slca;			/* 0x0a0 */
	struct spira_ntuple	backplane_vpd;		/* 0x0c0 */
	struct spira_ntuple	system_vpd;		/* 0x0e0 */
	struct spira_ntuple	chip_tod;		/* 0x100 */
	struct spira_ntuple	proc_init;		/* 0x120 */
	struct spira_ntuple	clock_vpd;		/* 0x140 */
	struct spira_ntuple	anchor_vpd;		/* 0x160 */
	struct spira_ntuple	op_panel_vpd;		/* 0x180 */
	struct spira_ntuple	ext_cache_fru_vpd;	/* 0x1a0 */
	struct spira_ntuple	misc_cec_fru_vpd;	/* 0x1c0 */
	struct spira_ntuple	paca;			/* 0x1e0 */
	struct spira_ntuple	ms_vpd;			/* 0x200 */
	struct spira_ntuple	cec_iohub_fru;		/* 0x220 */
	struct spira_ntuple	cpu_ctrl;		/* 0x240 */
	struct spira_ntuple	mdump_src;		/* 0x260 */
	struct spira_ntuple	mdump_dst;		/* 0x280 */
	struct spira_ntuple	mdump_res;		/* 0x2a0 */
	struct spira_ntuple	heap;			/* 0x2c0 */
	struct spira_ntuple	pcia;			/* 0x2e0 */
	struct spira_ntuple	proc_chip;		/* 0x300 */
	struct spira_ntuple	hs_data;		/* 0x320 */
};

struct spira {
	struct HDIF_common_hdr	hdr;
	struct HDIF_idata_ptr	ntuples_ptr;
	__be64			pad;
	struct spira_ntuples	ntuples;
	u8			reserved[0x4c0];
} __packed __align(0x100);

extern struct spira spira;

/* This macro can be used to check the validity of a pointer returned
 * by one of the HDIF API functions. It returns true if the pointer
 * appears valid. If it's not valid and not NULL, it will print some
 * error in the log as well.
 */
#define CHECK_SPPTR(_ptr)	spira_check_ptr(_ptr, __FILE__, __LINE__)

#define get_hdif(ntuple, id) __get_hdif((ntuple), (id), __FILE__, __LINE__)

extern struct HDIF_common_hdr *__get_hdif(struct spira_ntuple *n,
					  const char id[],
					  const char *file, int line);

#define for_each_ntuple_idx(_ntuples, _p, _idx, _id)			\
	for (_p = get_hdif((_ntuples), _id ""), _idx = 0;		\
	     _p && _idx < be16_to_cpu((_ntuples)->act_cnt);		\
	     _p = (void *)_p + be32_to_cpu((_ntuples)->alloc_len), _idx++)

#define for_each_ntuple(_ntuples, _p, _id)				\
	for (_p = get_hdif((_ntuples), _id "");				\
	     _p && (void *)_p < ntuple_addr(_ntuples)			\
		     + (be16_to_cpu((_ntuples)->act_cnt) *		\
			be32_to_cpu((_ntuples)->alloc_len));		\
	     _p = (void *)_p + be32_to_cpu((_ntuples)->alloc_len))

#define for_each_paca(p) for_each_ntuple(&spira.ntuples.paca, p, PACA_HDIF_SIG)

#define for_each_pcia(p) for_each_ntuple(&spira.ntuples.pcia, p, SPPCIA_HDIF_SIG)

/* We override these for testing. */
#ifndef ntuple_addr
#define ntuple_addr(_ntuples) ((void *)BE64_TO_CPU((_ntuples)->addr))
#endif

#ifndef spira_check_ptr
extern bool spira_check_ptr(const void *ptr, const char *file,
			    unsigned int line);
#endif

struct proc_init_data {
	struct HDIF_common_hdr	hdr;
	struct HDIF_idata_ptr	regs_ptr;
	struct {
		__be64	nia;
		__be64	msr;
	} regs;
} __packed __align(0x10);

/*
 * The FRU ID structure is used in several tuples, so we
 * define it generically here
 */
struct spira_fru_id {
	__be16		slca_index;
	__be16		rsrc_id;	/* formerly VPD port number */
};

/*
 * The FRU operational status structure is used in several
 * tuples, so we define it generically here
 */
struct spira_fru_op_status {
	uint8_t	flags;
#define FRU_OP_STATUS_FLAG_USED		0x02 /* If 0 -> not used (redundant) */
#define FRU_OP_STATUS_FLAG_FUNCTIONAL	0x01 /* If 0 -> non-functional */
	uint8_t	reserved[3];
};

/*
 * Move VPD related stuff to another file ...
 */
#define VPD_ID(_a, _b)	((_a) << 8 | (_b))

/*
 * Service Processor Subsystem Structure
 *
 * This structure contains several internal data blocks
 * describing the service processor(s) in the system
 */

#define SPSS_HDIF_SIG	"SPINFO"

/* Idata index 0 : FRU ID Data */
#define SPSS_IDATA_FRU_ID	0

/* Idata index 1 : Keyword VPD for the FSP instance */
#define SPSS_IDATA_KEYWORD_VPD	1

/* Idata index 2 : SP Implementation */
#define SPSS_IDATA_SP_IMPL	2

struct spss_sp_impl {
	__be16	hw_version;
	__be16	sw_version;
	__be16	func_flags;
#define SPSS_SP_IMPL_FLAGS_INSTALLED	0x8000
#define SPSS_SP_IMPL_FLAGS_FUNCTIONAL	0x4000
#define SPSS_SP_IMPL_FLAGS_PRIMARY	0x2000
	u8	chip_version;
	u8	reserved;
};

/* Idata index 3 is deprecated */

/* Idata index 4 : SP Memory Locator */
#define SPSS_IDATA_SP_MEMLOC	4

/* Idata index 5 : SP I/O path array */
#define SPSS_IDATA_SP_IOPATH	5

/* An HDIF array of IO path */
struct spss_iopath {
	__be16	iopath_type;
#define SPSS_IOPATH_TYPE_IOHUB_PHB	0x0001
#define SPSS_IOPATH_TYPE_PSI		0x0002
	union {
		struct {
			__be16	iohub_chip_inst;
			__be16	iohub_chip_port;
			__be16	phb_id;
		} __packed iohub_phb;

		struct {
			__be16	link_status;
#define SPSS_IO_PATH_PSI_LINK_BAD_FRU	0x0000
#define SPSS_IO_PATH_PSI_LINK_CURRENT	0x0001
#define SPSS_IO_PATH_PSI_LINK_BACKUP	0x0002
			u8	ml2_version;
			u8	reserved;
			__be16	slca_count;
			u8	slca_idx[16];
			__be32	proc_chip_id;
			__be32	reserved2;
			__be64	gxhb_base;
		} __packed psi;
	};
} __packed;

/*
 * IPL Parms structure
 *
 */

/* Idata index 0: System Parameters */
#define IPLPARAMS_SYSPARAMS	0

struct iplparams_sysparams {
	char		sys_model[4];
	char		cpu_feature_code[4];
	__be32		effective_pvr;
	__be32		system_type;
	uint8_t		num_lpar_oct[8];
	__be32		abc_bus_speed;
	__be32		wxyz_bus_speed;
	__be32		sys_eco_mode;
	__be32		sys_attributes;
	__be32		mem_scrubbing;
	__be16		cur_spl_value;
	uint8_t		pump_mode;
	uint8_t		use_pore_sleep;
	__be32		pore_image_size;
} __packed;

/* Idata index 1: IPL parameters */
#define IPLPARAMS_IPLPARAMS	1

struct iplparams_iplparams {
	uint8_t		reserved;
	uint8_t		hv_ipl_dest;
	uint8_t		ipl_side;
#define IPLPARAMS_CEC_FW_IPL_SIDE_TEMP	0x10
#define IPLPARAMS_FSP_FW_IPL_SIDE_TEMP	0x01
	uint8_t		ipl_speed;
	__be16		cec_ipl_attrib;
	uint8_t		cec_ipl_maj_type;
	uint8_t		cec_ipl_min_type;
	uint8_t		os_ipl_mode;
	uint8_t		keylock_pos;
	uint8_t		lmb_size;
	uint8_t		deprecated;
	__be32		max_hsl_opticonnect;
	__be32		other_attrib;
#define IPLPARAMS_OATTR_RST_PCI_BUSNO	0x08000000
#define IPLPARAMS_OATTR_CLEAR_NVRAM	0x04000000
#define IPLPARAMS_OATRR_LIGHT_PATH	0x00000004
	__be16		huge_page_count;
	uint8_t		huge_page_size;
#define IPLPARAMS_HUGE_PG_SIZE_16G	0
	uint8_t		num_vlan_switches;
	__be64		reserved2;
};

/* Idata index 4: Platform Dump Descriptor */
#define IPLPARAMS_PLATFORM_DUMP		4

struct iplparams_dump {
	__be16	flags;
	uint8_t	reserved1;
	uint8_t policy;
#define HYP_DUMP_POLICY_NORMAL	0x00
	__be32	dump_id;
	__be64	reserved2;
	__be64	act_dump_sz;
	__be32	max_hw_dump_sz;
	__be32	act_hw_dump_sz;
	__be32	max_sp_dump_sz;
	__be32	plid;
};

/* Idata index 8: serial ports */
#define IPLPARMS_IDATA_SERIAL	8

/* An HDIF array of serial descriptions */
struct iplparms_serial {
	uint8_t		loc_code[LOC_CODE_SIZE];
	__be16		rsrc_id;
	__be16		flags;
#define PLPARMS_SERIAL_FLAGS_CALLHOME	0x8000
} __packed;

/*
 * Chip TOD structure
 *
 * This is an array of 32 entries (I assume per possible chip)
 */

/* Idata index 0: Chip ID data (array) */
#define CHIPTOD_IDATA_CHIPID	0

struct chiptod_chipid {
	__be32		chip_id;
	__be32		flags;
#define CHIPTOD_ID_FLAGS_PRIMARY	0x02
#define CHIPTOD_ID_FLAGS_SECONDARY	0x01
#define CHIPTOD_ID_FLAGS_STATUS_MASK	0x0c
#define CHIPTOD_ID_FLAGS_STATUS_OK	0x04
#define CHIPTOD_ID_FLAGS_STATUS_NOK	0x08
} __packed;

/* Idata index 0: Chip Initialization data */
#define CHIPTOD_IDATA_CHIPINIT	1

struct chiptod_chipinit {
	__be32		ctrl_reg_internal;
	__be32		tod_ctrl_reg;
} __packed;

/*
 * MS VPD - Memory Description Tree
 *
 * One such structure pointing to the various memory arrays
 * along with other infos about the BCRs, Page Mover, XSCOM,...
 */
#define MSVPD_HDIF_SIG	"MS VPD"

/* Idata index 0: Mainstore address config */
#define MSVPD_IDATA_MS_ADDR_CONFIG	0

/* Mainstore Address Configuration */
struct msvpd_ms_addr_config {
	__be64	 max_configured_ms_address;
	__be64	 max_possible_ms_address;
	__be32	 deprecated;
	__be64	 mirrorable_memory_starting_address;
} __attribute__((packed));

/* Idata index 1: Total configured mainstore */
#define MSVPD_IDATA_TOTAL_CONFIG_MS	1

struct msvpd_total_config_ms {
	__be64	 total_in_mb;
};

/* Idata index 2: Page mover and sync structure */
#define MSVPD_IDATA_PMOVER_SYNCHRO	2

struct msvpd_pmover_bsr_synchro {
	__be32		flags;
#define MSVPD_PMS_FLAG_HWLOCK_EN	0x80000000
#define MSVPD_PMS_FLAG_PMOVER_EN	0x40000000
#define MSVPD_PMS_FLAG_BSR_EN		0x20000000
#define MSVPD_PMS_FLAG_XSCOMBASE_VALID	0x10000000
	/* P7 values for BSR mode */
#define MSVPD_PMS_FLAG_P7BSR_1M_MODE	0x00000000
#define MSVPD_PMS_FLAG_P7BSR_2M_MODE	0x02000000
#define MSVPD_PMS_FLAG_P7BSR_4M_MODE	0x04000000
#define MSVPD_PMS_FLAG_P7BSR_8M_MODE	0x06000000
	__be32		hwlocks_per_page;
	__be64		hwlock_addr;
	__be64		pmover_addr;
	__be64		bsr_addr;
	__be64		xscom_addr;

};

/* Idata index 3: Memory Trace Array */

/* Idata index 4: UE Address Array */

/* Child index 0: MS area child structure */
#define MSVPD_CHILD_MS_AREAS		0

/*
 * CEC I/O Hub FRU
 *
 * This is an array of CEC Hub FRU HDIF structures
 *
 * Each of these has some idata pointers to generic info about the
 * hub and a possible child pointer for daughter card.
 *
 * Actual ports are in the SLCA and need to be cross referenced
 *
 * Note that slots meant for the addition of GX+ adapters that
 * are currently unpopulated but support hotplug will have a
 * minimum "placeholder" entry, which will be fully populated
 * when the array is rebuild during concurrent maintainance.
 * This "placeholder" is called a "reservation".
 *
 * WARNING: The array rebuild by concurrent maintainance is not
 * guaranteed to be in the same order as the IPL array, not is
 * the order stable between concurrent maintainance operations.
 *
 * There's also a child pointer to daugher card structures but
 * we aren't going to handle that just yet.
 */
#define CECHUB_FRU_HDIF_SIG	"IO HUB"
#define IOKID_FRU_HDIF_SIG	"IO KID"

/* Idata index 0: FRU ID data
 *
 * This is a generic struct spira_fru_id defined above
 */
#define CECHUB_FRU_ID_DATA		0

/* Idata index 1: ASCII Keyword VPD */
#define CECHUB_ASCII_KEYWORD_VPD	1

/* Idata index 2: Hub FRU ID data area */
#define CECHUB_FRU_ID_DATA_AREA		2

struct cechub_hub_fru_id {
	__be32		card_type;
#define CECHUB_FRU_TYPE_IOHUB_RSRV	0
#define CECHUB_FRU_TYPE_IOHUB_CARD	1
#define CECHUB_FRU_TYPE_CPU_CARD	2
#define CECHUB_FRU_TYPE_CEC_BKPLANE	3
#define CECHUB_FRU_TYPE_BKPLANE_EXT	4
	__be32		unused;
	__be16		total_chips;
	uint8_t		flags;
#define CECHUB_FRU_FLAG_HEADLESS	0x80 /* not connected to CPU */
#define CECHUB_FRU_FLAG_PASSTHROUGH	0x40 /* connected to passhtrough
						port of another hub */
	uint8_t		reserved;
	__be16		parent_hub_id;	/* chip instance number of the
					   hub that contains the passthrough
					   port this one is connected to */
	__be16		reserved2;
} __packed;

/* Idata index 3: IO HUB array */

#define CECHUB_FRU_IO_HUBS		3

/* This is an HDIF array of IO Hub structures */
struct cechub_io_hub {
	__be64		fmtc_address;
	__be32		fmtc_tce_size;
	__be16		hub_num;	/* unique hub number (I/O Hub ID) */
	uint8_t		flags;
#define CECHUB_HUB_FLAG_STATE_MASK	0xc0
#define CECHUB_HUB_FLAG_STATE_OK	0x00
#define CECHUB_HUB_FLAG_STATE_FAILURES	0x40
#define CECHUB_HUB_FLAG_STATE_NOT_INST	0x80
#define CECHUB_HUB_FLAG_STATE_UNUSABLE	0xc0
#define CECHUB_HUB_FLAG_MASTER_HUB	0x20 /* HDAT < v9.x only */
#define CECHUB_HUB_FLAG_GARD_MASK_VALID	0x08 /* HDAT < v9.x only */
#define CECHUB_HUB_FLAG_SWITCH_MASK_PDT	0x04 /* HDAT < v9.x only */
#define CECHUB_HUB_FLAG_FAB_BR0_PDT	0x02 /* HDAT < v9.x only */
#define CECHUB_HUB_FLAG_FAB_BR1_PDT	0x01 /* HDAT < v9.x only */
	uint8_t		nr_ports;	     /* HDAT < v9.x only */
	uint8_t		fab_br0_pdt;	/* p5ioc2 PCI-X or P8 PHB3's */
#define CECHUB_HUB_FAB_BR0_PDT_PHB0	0x80
#define CECHUB_HUB_FAB_BR0_PDT_PHB1	0x40
#define CECHUB_HUB_FAB_BR0_PDT_PHB2	0x20
#define CECHUB_HUB_FAB_BR0_PDT_PHB3	0x10
	uint8_t		fab_br1_pdt;	/* p5ioc2 & p7ioc PCI-E */
#define CECHUB_HUB_FAB_BR1_PDT_PHB0	0x80
#define CECHUB_HUB_FAB_BR1_PDT_PHB1	0x40
#define CECHUB_HUB_FAB_BR1_PDT_PHB2	0x20
#define CECHUB_HUB_FAB_BR1_PDT_PHB3	0x10
#define CECHUB_HUB_FAB_BR1_PDT_PHB4	0x08 /* p7ioc only */
#define CECHUB_HUB_FAB_BR1_PDT_PHB5	0x04 /* p7ioc only */
	__be16		iohub_id;	/* the type of hub */
#define CECHUB_HUB_P7IOC	0x60e7	/* from VPL3 */
#define CECHUB_HUB_MURANO	0x20ef	/* Murano from spec */
#define CECHUB_HUB_MURANO_SEGU	0x0001	/* Murano+Seguso from spec */
#define CECHUB_HUB_VENICE_WYATT	0x0010	/* Venice+Wyatt from spec */
	__be32		ec_level;
	__be32		aff_dom2;	/* HDAT < v9.x only */
	__be32		aff_dom3;	/* HDAT < v9.x only */
	__be64		reserved;
	__be32		proc_chip_id;

	union {
		/* HDAT < v9.x */
		struct {
			__be32		gx_index;	/* GX bus index on cpu */
			__be32		buid_ext;	/* BUID Extension */
			__be32		xscom_chip_id;	/* TORRENT ONLY */
		};
		/* HDAT >= v9.x */
		struct {
			__be32		reserved1;
			__be32		reserved2;
			__be16		reserved3;
			__be16		hw_topology;
		};
	};
	__be32		mrid;
	__be32		mem_map_vers;
	union {
		/* HDAT < v9.x */
		struct {
			__be64		gx_ctrl_bar0;
			__be64		gx_ctrl_bar1;
			__be64		gx_ctrl_bar2;
			__be64		gx_ctrl_bar3;
			__be64		gx_ctrl_bar4;
			__be32		sw_mask_pdt;
			__be16		gard_mask;
			__be16		gx_bus_speed;	/* Version 0x58 */
		};

		/* HDAT >= v9.x, HDIF version 0x6A or later */
		struct {
			/* 4 values per PHB, 4 PHBs */
			__be64		phb_lane_eq[4][4];
		};
	};
} __packed;

/* We support structures as small as 0x68 bytes */
#define CECHUB_IOHUB_MIN_SIZE	0x68

/* Child index 0: IO Daugther Card */
#define CECHUB_CHILD_IO_KIDS		0

/*
 * IO KID is a dauther card structure
 */
#define IOKID_FRU_ID_DATA	0
#define IOKID_KW_VPD		1

/*
 * CPU Controls Legacy Structure
 */
struct cpu_ctl_legacy {
	__be64 addr;
	__be64 size;
} __packed;

/*
 * CPU Control Legacy table
 *
 * Format of this table is defined in FIPS PHYP Attn spec.
 */
struct cpu_ctl_legacy_table {
	struct cpu_ctl_legacy spat;
	struct cpu_ctl_legacy sp_attn_area1;
	struct cpu_ctl_legacy sp_attn_area2;
	struct cpu_ctl_legacy hsr_area;
	struct cpu_ctl_legacy reserved[12];
} __packed;

/*
 * CPU Controls Header Structure
 */
#define CPU_CTL_HDIF_SIG	"CPUCTL"
struct cpu_ctl_init_data {
	struct HDIF_common_hdr		hdr;
	struct HDIF_idata_ptr		cpu_ctl;
	uint8_t				reserved[8];
	struct cpu_ctl_legacy_table	cpu_ctl_lt;
} __packed __align(0x10);

/*
 * Slot Location Code Array (aka SLCA)
 *
 * This is a pile of location codes referenced by various other
 * structures such as the IO Hubs for things on the CEC. Not
 * everything in there is a physical port. The SLCA is actually
 * a tree which represent the topology of the system.
 *
 * The tree works as follow: A parent has a pointer to the first
 * child. A child has a pointer to its parent. Siblings are
 * consecutive entries.
 *
 * Note: If we ever support concurrent maintainance... this is
 * completely rebuilt, invalidating all indices, though other
 * structures that may reference SLCA by index will be rebuilt
 * as well.
 *
 * Note that a lot of that stuff is based on VPD documentation
 * such as the identification keywords. I will list the ones
 * I manage to figure out without the doc separately.
 */
#define SLCA_HDIF_SIG	"SLCA  "

/* Idata index 0 : SLCA root pointer
 *
 * The SLCA array is an HDIF array of all the entries. The tree
 * structure is based on indices inside the entries and order of
 * the entries
 */
#define SLCA_IDATA_ARRAY	0

#define SLCA_ROOT_INDEX		0

/* Note: An "index" (or idx) is always an index into the SLCA array
 * and "id" is a reference to some other object.
 */
struct slca_entry {
	__be16		my_index;	/* redundant, useful */
	__be16		rsrc_id;	/* formerly VPD port number */
	uint8_t		fru_id[2];	/* ASCII VPD ID */
#define SLCA_ROOT_VPD_ID	VPD_ID('V','V')
#define SLCA_SYSTEM_VPD_ID	VPD_ID('S','V')
#define SLCA_SAI_INDICATOR_ID	VPD_ID('S','A')
	__be16		parent_index;	/* Parent entry index */
	uint8_t		flags;
#define SLCA_FLAG_NON_FUNCTIONAL	0x02	/* For redundant entries */
#define SLCA_FLAG_IMBEDDED		0x01	/* not set => pluggable */
	uint8_t		old_nr_child;	/* Legacy: Nr of children */
	__be16		child_index;	/* First child index */
	__be16		child_rsrc_id;	/* Resource ID of first child */
	uint8_t		loc_code_allen;	/* Alloc len of loc code */
	uint8_t		loc_code_len;	/* Loc code len */
	uint8_t		loc_code[LOC_CODE_SIZE]; /* NULL terminated (thus max 79 chr) */
	__be16		first_dup_idx;	/* First redundant resource index */
	uint8_t		nr_dups;	/* Number of redundant entries */
	uint8_t		reserved;
	__be16		nr_child;	/* New version */
	uint8_t		install_indic;	/* Installed indicator */
#define SLCA_INSTALL_NO_HW_PDT		1 /* No HW presence detect */
#define SLCA_INSTALL_INSTALLED		2
#define SLCA_INSTALL_NOT_INSTALLED	3
	uint8_t		vpd_collected;
#define SLCA_VPD_COLLECTED		2
#define SLCA_VPD_NOT_COLLECTED		3
} __packed;

/*
 * System VPD
 */
#define SYSVPD_HDIF_SIG	"SYSVPD"

/* Idata index 0 : FRU ID Data */
#define SYSVPD_IDATA_FRU_ID	0

/* Idata index 1 : Keyword VPD */
#define SYSVPD_IDATA_KW_VPD	1

/* Idata index 2 : Operational status */
#define SYSVPD_IDATA_OP_STATUS	2

/*
 * FRU keyword VPD structure
 */
#define FRUVPD_HDIF_SIG	"FRUVPD"

/* Idata index 0 : FRU ID Data */
#define FRUVPD_IDATA_FRU_ID	0

/* Idata index 1 : Keyword VPD */
#define FRUVPD_IDATA_KW_VPD	1

/* Idata index 2 : Operational status */
#define FRUVPD_IDATA_OP_STATUS	2

/*
 * SPPACA structure. The SPIRA contain an array of these, one
 * per processor thread
 */
#define PACA_HDIF_SIG	"SPPACA"

/* Idata index 0 : FRU ID Data */
#define SPPACA_IDATA_FRU_ID	0

/* Idata index 1 : Keyword VPD */
#define SPPACA_IDATA_KW_VPD	1

/* Idata index 2 : CPU ID data area */
#define SPPACA_IDATA_CPU_ID	2

struct sppaca_cpu_id {
	__be32 pir;
	__be32 fru_id;
	__be32 hardware_proc_id;
#define CPU_ID_VERIFY_MASK			0xC0000000
#define CPU_ID_VERIFY_SHIFT			30
#define CPU_ID_VERIFY_USABLE_NO_FAILURES	0
#define CPU_ID_VERIFY_USABLE_FAILURES		1
#define CPU_ID_VERIFY_NOT_INSTALLED		2
#define CPU_ID_VERIFY_UNUSABLE			3
#define CPU_ID_SECONDARY_THREAD			0x20000000
#define CPU_ID_PACA_RESERVED			0x10000000
#define CPU_ID_NUM_SECONDARY_THREAD_MASK	0x00FF0000
#define CPU_ID_NUM_SECONDARY_THREAD_SHIFT	16
	__be32 verify_exists_flags;
	__be32 chip_ec_level;
	__be32 processor_chip_id;
	__be32 logical_processor_id;
	/* This is the resource number, too. */
	__be32 process_interrupt_line;
	__be32 reserved1;
	__be32 hardware_module_id;
	__be64 ibase;
	__be32 deprecated1;
	__be32 physical_thread_id;
	__be32 deprecated2;
	__be32 ccm_node_id;
	/* This fields are not always present, check struct size */
#define SPIRA_CPU_ID_MIN_SIZE	0x40
	__be32 hw_card_id;
	__be32 internal_drawer_node_id;
	__be32 drawer_book_octant_blade_id;
	__be32 memory_interleaving_scope;
	__be32 lco_target;
} __packed;

/* Idata index 3 : Timebase data */
#define SPPACA_IDATA_TIMEBASE	3

struct sppaca_cpu_timebase {
	__be32 cycle_time;
	__be32 time_base;
	__be32 actual_clock_speed;
	__be32 memory_bus_frequency;
} __packed;

/* Idata index 4 : Cache size structure */
#define SPPACA_IDATA_CACHE_SIZE	4

struct sppaca_cpu_cache {
	__be32 icache_size_kb;
	__be32 icache_line_size;
	__be32 l1_dcache_size_kb;
	__be32 l1_dcache_line_size;
	__be32 l2_dcache_size_kb;
	__be32 l2_line_size;
	__be32 l3_dcache_size_kb;
	__be32 l3_line_size;
	__be32 dcache_block_size;
	__be32 icache_block_size;
	__be32 dcache_assoc_sets;
	__be32 icache_assoc_sets;
	__be32 dtlb_entries;
	__be32 dtlb_assoc_sets;
	__be32 itlb_entries;
	__be32 itlb_assoc_sets;
	__be32 reservation_size;
	__be32 l2_cache_assoc_sets;
	__be32 l35_dcache_size_kb;
	__be32 l35_cache_line_size;
};

/* Idata index 6 : CPU Attributes */
#define SPPACA_IDATA_CPU_ATTR	6

#define sppaca_cpu_attr sppcia_cpu_attr

/*
 * SPPCIA structure. The SPIRA contain an array of these, one
 * per processor core
 */
#define SPPCIA_HDIF_SIG	"SPPCIA"

/* Idata index 0 : Core unique data */
#define SPPCIA_IDATA_CORE_UNIQUE	0

/* NOTE: This is the same layout as "struct sppaca_cpu_id",
 *       with essentially some fields removed and a reserved
 *       field added
 */
struct sppcia_core_unique {
	__be32 reserved;
	__be32 proc_fru_id;
	__be32 hw_proc_id;
	__be32 verif_exist_flags;	/* Same as PACA */
	__be32 chip_ec_level;
	__be32 proc_chip_id;
	__be32 reserved2;
	__be32 reserved3;
	__be32 reserved4;
	__be32 hw_module_id;
	__be64 reserved5;
	__be32 reserved6;
	__be32 reserved7;
	__be32 reserved8;
	__be32 ccm_node_id;
	__be32 hw_card_id;
	__be32 internal_drawer_node_id;
	__be32 drawer_book_octant_blade_id;
	__be32 memory_interleaving_scope;
	__be32 lco_target;
	__be32 reserved9;
} __packed;

/* Idata index 1 : CPU Time base structure */
#define SPPCIA_IDATA_TIMEBASE		1

#define sppcia_cpu_timebase sppaca_cpu_timebase

/* Idata index 2 : CPU Cache Size Structure */
#define SPPCIA_IDATA_CPU_CACHE		2

#define sppcia_cpu_cache sppaca_cpu_cache

/* Idata index 3 : Thread Array Data
 *
 * HDIF array of
 */
#define SPPCIA_IDATA_THREAD_ARRAY	3

struct sppcia_cpu_thread {
	__be32 proc_int_line;
	__be32 phys_thread_id;
	__be64 ibase;
	__be32 pir;
} __packed;

/* Idata index 4 : CPU Attributes */
#define SPPCIA_IDATA_CPU_ATTR		4

struct sppcia_cpu_attr {
#define CPU_ATTR_UNIFIED_PL1	0x80
#define CPU_ATTR_SPLIT_TLB	0x40
#define CPU_ATTR_TLBIA		0x20
#define CPU_ATTR_PERF_MONITOR	0x10
#define CPU_ATTR_EXTERN_CONT	0x02
	__be32 attr;
} __packed;

/*
 * Processor Chip Related Data. The SPIRA contain an array of these, one
 * per chip
 */
#define SPPCRD_HDIF_SIG	"SPPCRD"

/* Idata index 0 : Chip info */
#define SPPCRD_IDATA_CHIP_INFO	0

struct sppcrd_chip_info {
	__be32 proc_chip_id;
	__be32 verif_exist_flags;
#define CHIP_VERIFY_MASK			0xC0000000
#define CHIP_VERIFY_SHIFT			30
#define CHIP_VERIFY_USABLE_NO_FAILURES		0
#define CHIP_VERIFY_USABLE_FAILURES		1
#define CHIP_VERIFY_NOT_INSTALLED		2
#define CHIP_VERIFY_UNUSABLE			3
	__be32 nx_state;
	__be32 pore_state;
	__be32 xscom_id;
	/* Version 0xA */
	__be32 reserved;
	__be32 dbob_id;
	__be32 occ_state;
} __packed;

/* Idata index 1 : Chip TOD */
#define SPPCRD_IDATA_CHIP_TOD	1

struct sppcrd_chip_tod {
	__be32 flags;
	/* CHIPTOD_ID_... values */
	__be32 ctrl_reg_internal;
	__be32 tod_ctrl_reg;
} __packed;

/* Idata index 2 : FRU ID */
#define SPPCRD_IDATA_FRU_ID	2

/* Idata index 3 : ASCII Keyword data */
#define SPPCRD_IDATA_KW_VPD	3

/* Idata index 4 : Module VPD */
#define SPPCRD_IDATA_MODULE_VPD	4

/*
 * Host Services Data.
 */
#define HSERV_HDIF_SIG	"HOSTSR"

/* Idata index 0 : System attribute data */
#define HSERV_IDATA_SYS_ATTR	0

static inline const char *cpu_state(u32 flags)
{
	switch ((flags & CPU_ID_VERIFY_MASK) >> CPU_ID_VERIFY_SHIFT) {
	case CPU_ID_VERIFY_USABLE_NO_FAILURES:
		return "OK";
	case CPU_ID_VERIFY_USABLE_FAILURES:
		return "FAILURES";
	case CPU_ID_VERIFY_NOT_INSTALLED:
		return "NOT-INSTALLED";
	case CPU_ID_VERIFY_UNUSABLE:
		return "UNUSABLE";
	}
	return "**UNKNOWN**";
}
#endif /* __SPIRA_H */


text:
package com.moilioncircle.mysql.tokenizer;

import java.util.*;

public class MysqlScanner {
    protected Token token;
    protected Token previousToken;
    private MysqlTokenizer tokenizer;
    public List<Token> tokens = new ArrayList<>();

    public MysqlScanner(char[] chars) {
        tokenizer = new MysqlTokenizer(chars);
        Token token = null;
        while ((token = tokenizer.nextToken()).tag != TokenTag.EOF) {
            List<TokenTag> tag = synonym(token.tag);
            if (tag != null) {
                final Token t = token;
                tag.forEach(e -> tokens.add(new Token(e, t.value, t.startPos, t.endPos)));
            } else {
                tokens.add(token);
            }
        }
        tokens.add(token);
        this.token = tokens.get(0);
    }

    public Token token() {
        token = tokens.get(0);
        return token;
    }

    public boolean hasNext() {
        return tokens.size() >= 0;
    }

    public Token previous() {
        return previousToken;
    }

    public void next() {
        previousToken = token;
        if (tokens.size() > 0) {
            tokens.remove(0);
            token = tokens.get(0);
        }
    }

    public void back(Token token) {
        tokens.add(0, token);
    }

    public boolean lookahead(TokenTag... tags) {
        for (int i = 0; i < tags.length; i++) {
            if ((i + 1) >= tokens.size() || tokens.get(i + 1).tag != tags[i]) {
                return false;
            }
        }
        return true;
    }

    public boolean lookahead1(TokenTag... tags) {
        for (TokenTag tag : tags) {
            if (lookahead(tag)) {
                return true;
            }
        }
        return false;
    }

    public List<TokenTag> synonym(TokenTag tag) {
        Map<TokenTag, List<TokenTag>> map = new HashMap<>();
        map.put(TokenTag.CHARSET, Arrays.asList(TokenTag.CHARACTER, TokenTag.SET));
        if (map.containsKey(tag)) {
            return map.get(tag);
        }
        return null;
    }

}


text:
using System.Threading;

namespace SavannahGame.Forms
{
    public class CounterVisitor : IAnimalVisitor
    {
        private int lions;
        private int rabbits;

        public int Lions
        {
            get { return this.lions; }
        }

        public int Rabbits
        {
            get { return this.rabbits; }
        }

        public void Visit(Lion lion)
        {
            Interlocked.Increment(ref this.lions);
        }

        public void Visit(Rabbit rabbit)
        {
            Interlocked.Increment(ref this.rabbits);
        }
    }
}


text:
import datetime
import os
import unittest

import airflow
from airflow.models import DAG, DagBag
from airflow.operators.bash_operator import BashOperator
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.subdag_operator import SubDagOperator
from airflow.jobs import BackfillJob
from airflow.exceptions import AirflowException

DEFAULT_DATE = datetime.datetime(2016, 1, 1)

default_args = dict(
    owner='airflow',
    start_date=DEFAULT_DATE,
)

class SubDagOperatorTests(unittest.TestCase):

    def test_subdag_name(self):
        """
        Subdag names must be {parent_dag}.{subdag task}
        """
        dag = DAG('parent', default_args=default_args)
        subdag_good = DAG('parent.test', default_args=default_args)
        subdag_bad1 = DAG('parent.bad', default_args=default_args)
        subdag_bad2 = DAG('bad.test', default_args=default_args)
        subdag_bad3 = DAG('bad.bad', default_args=default_args)

        SubDagOperator(task_id='test', dag=dag, subdag=subdag_good)
        self.assertRaises(
            AirflowException,
            SubDagOperator, task_id='test', dag=dag, subdag=subdag_bad1)
        self.assertRaises(
            AirflowException,
            SubDagOperator, task_id='test', dag=dag, subdag=subdag_bad2)
        self.assertRaises(
            AirflowException,
            SubDagOperator, task_id='test', dag=dag, subdag=subdag_bad3)

    def test_subdag_pools(self):
        """
        Subdags and subdag tasks can't both have a pool with 1 slot
        """
        dag = DAG('parent', default_args=default_args)
        subdag = DAG('parent.child', default_args=default_args)

        session = airflow.settings.Session()
        pool_1 = airflow.models.Pool(pool='test_pool_1', slots=1)
        pool_10 = airflow.models.Pool(pool='test_pool_10', slots=10)
        session.add(pool_1)
        session.add(pool_10)
        session.commit()

        dummy_1 = DummyOperator(task_id='dummy', dag=subdag, pool='test_pool_1')

        self.assertRaises(
            AirflowException,
            SubDagOperator,
            task_id='child', dag=dag, subdag=subdag, pool='test_pool_1')

        # recreate dag because failed subdagoperator was already added
        dag = DAG('parent', default_args=default_args)
        SubDagOperator(
            task_id='child', dag=dag, subdag=subdag, pool='test_pool_10')

        session.delete(pool_1)
        session.delete(pool_10)
        session.commit()

    def test_subdag_deadlock(self):
        dagbag = DagBag()
        dag = dagbag.get_dag('test_subdag_deadlock')
        dag.clear()
        subdag = dagbag.get_dag('test_subdag_deadlock.subdag')
        subdag.clear()

        # first make sure subdag is deadlocked
        self.assertRaisesRegexp(AirflowException, 'deadlocked', subdag.run, start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)

        # now make sure dag picks up the subdag error
        self.assertRaises(AirflowException, dag.run, start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)


text:
import { ChangeDetectionStrategy, Component, EventEmitter, Inject, Input, OnInit, Output } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import {
  ContentType,
  CONTENT_TYPES_CONFIG_TOKEN,
  ErrorsExtractor,
  IBaseEntityModalOptions,
  ModalsService,
  translate
} from '@rucken/core';
import { DynamicRepository, IRestProviderOptions } from 'ngx-repository';
import { ContentTypesGridModalComponent } from '../content-types-grid-modal/content-types-grid-modal.component';
import { ContentTypesGridComponent } from '../content-types-grid/content-types-grid.component';
import { BindIoInner } from 'ngx-bind-io';

@BindIoInner()
@Component({
  selector: 'content-type-input',
  templateUrl: './content-type-input.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class ContentTypeInputComponent extends ContentTypesGridComponent implements OnInit {
  @Output()
  select = new EventEmitter<ContentType>();
  @Input()
  modalAppendFromGrid: IBaseEntityModalOptions = {
    component: ContentTypesGridModalComponent,
    initialState: {
      title: translate('Select content type'),
      yesTitle: translate('Select')
    }
  };

  constructor(
    modalsService: ModalsService,
    protected errorsExtractor: ErrorsExtractor,
    protected translateService: TranslateService,
    protected dynamicRepository: DynamicRepository,
    @Inject(CONTENT_TYPES_CONFIG_TOKEN) protected contentTypesConfig: IRestProviderOptions<ContentType>
  ) {
    super(modalsService, errorsExtractor, translateService, dynamicRepository, contentTypesConfig);
  }
  ngOnInit() {
    this.mockedItems = [];
    this.useMock({
      items: this.mockedItems,
      ...this.contentTypesConfig
    });
    this.mockedItemsChange.subscribe(items => this.onSelect(items[0]));
  }
  onSelect(item: ContentType) {
    this.select.emit(item);
  }
}


text:
package com.sandflow.smpte.util;

import java.io.IOException;
import java.io.Reader;
import java.util.AbstractList;
import java.util.ArrayList;

/**
 * Simple Excel CSV parser.
 */
public class ExcelCSVParser {

    Reader reader;

    /**
     * Indicates an error has been encountered when parsing a CSV file
     */
    public static class SyntaxException extends Exception { }

    private enum State {
        IN_QFIELD,
        DQ_IN_QFIELD,
        IN_PFIELD,
        EOL
    }

    /**
     * Instantiates an ExcelCSVParser
     * @param reader Reader from which CSV lines will be read
     */
    public ExcelCSVParser(Reader reader) {
        this.reader = reader;
    }

    /**
     * Reads one line from the CSV file.
     * @return List of the fields found on the line
     * @throws com.sandflow.smpte.util.ExcelCSVParser.SyntaxException
     * @throws IOException
     */
    public AbstractList<String> getLine() throws SyntaxException, IOException {
        State s = State.IN_PFIELD;

        int c;
        StringBuilder field = new StringBuilder();

        ArrayList<String> strs = new ArrayList<>();

        boolean done = false;

        while ((!done) && (c = reader.read()) != -1) {
            switch (s) {

                case EOL:

                    if (c != '\n') {
                        throw new SyntaxException();
                    } else {
                        done = true;
                    }

                case DQ_IN_QFIELD:

                    if (c == '"') {
                        field.append('"');
                        s = State.IN_QFIELD;
                        break;

                    } else {

                        s = State.IN_PFIELD;

                    }

                case IN_PFIELD:

                    switch (c) {

                        case '\r':
                            s = State.EOL;

                        case ',':

                            if (field.length() == 0) {
                                strs.add(null);
                            } else {
                                strs.add(field.toString());
                                field.setLength(0);
                            }
                            break;

                        case '"':

                            s = State.IN_QFIELD;

                            break;

                        default:
                            field.append((char) c);
                            break;
                    }

                    break;

                case IN_QFIELD:

                    if (c == '"') {
                        s = State.DQ_IN_QFIELD;
                    } else {
                        field.append((char) c);
                    }

                    break;

            }

        }

        if (done) {
            return strs;
        } else {
            return null;
        }
    }

}


text:
"use strict";

var _ = require("underscore"),
    path = require("path");

function runTestServer(config) {

    process.env = _.extend(process.env, config);

    var initServer = require("./testApp/app/initServer.js");

    return initServer();
}

module.exports = runTestServer;


text:
<TITLE>Review for Independence Day (1996)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Independence Day (1996)

reviewed by
Michael Redman

                               INDEPENDENCE DAY
                       A film review by Michael Redman
                        Copyright 1996 Michael Redman

***1/2  (out of ****)

First of all, there are several different things going on here, all
separate but connected parts of the whole. There is "ID4: The Movie",
"ID4: The Ride", and lest we forget, "ID4: The Hype And Cash Machine".

Unless you've been in a coma for the past few months or don't have cable
and watch only PBS, you've been exposed to the unprecedented advertising
campaign. When you heard the words "Independence Day", it was a safe bet
they weren't talking about the holiday. Rarely has any film aroused such
pre-release excitement.

So exciting that it generated over $94 million during its first 5 1/2
days of release. So exciting that dozens of theaters around the country
were showing 24 hour screenings for the first few days: shows at 1:30am,
4:00am, 6:30am. So exciting that tickets were sold out hours before the
shows to people camping in line with big coolers and sleeping bags. No
matter how good the movie turned out to be, the hype was a work of art
itself.

Somehow Fox even arranged for a massive power black-out up and down the
west coast on opening night.

"ID4: The Ride"? It's phenomenal! Some films are more like amusement
park thrillers than cinema and this is one of the best of that genre.
Just take your seat, strap in and hold on. Monitor your cola consumption
because the roller coaster doesn't provide many breaks. One of the marks
of audience involvement is their relationship with their bladders: how
casually they take their trips to the restroom. Here, people are
__sprinting__ to and from the john so as not to miss anything.

There's enough stuff blown up and smashed and burned to a crisp to
satisfy any summer action junkie. Jet fighters zooming here and there,
alien death rays trashing all the world's major cities, massive
devastation on a global scale! It's perfect! The best science fiction
ride since the "Star Wars" films.

And then there's that pesky "ID4: The Movie" thing. There are a few
problems. There's nothing new here. The producers have ripped off dozens
of films ("Close Encounters", "Star Wars", "War Of The Worlds", "The
Right Stuff", "Dr. Strangelove", "Jurassic Park", "The Day The Earth
Stood Still" and on and on and on), word for word, scene for scene.
During one dogfight scene with Will Smith being chased through canyons
by an alien ship, I was sure I was about to hear "Use the Force, Will.
Use the Force!"

I believe that kinder reviewers call these scenes "homages", but it's an
odd film that can succeed with nothing but homages.

Fortunately "ID4" is that odd film. All of the pieces are well crafted
into a quilt that, while it isn't original, sure does its job.

The casting is top-notch in most cases. The Fresh Prince is surprisingly
refreshing as the wise-cracking jet pilot who becomes earth's last hope.
Jeff Goldblum as the computer wiz who figures it all out works well with
Judd Hirsch, his kibitzing dad. Randy Quaid, Harvey Fierstein and Harry
Connick, Jr., among dozens of others, are grand. Bill Pullman as the
Clintonesque president is something of a dead fish (or is that lame
duck?), but then, we expect most of our politicians to behave that way.

See it. You'll have to forget about any attempt to look at the film
intellectually, but let it possess your body and take over. You'll love
it!

[This originally appeared in "The Bloomington Voice", Bloomington,
Indiana, 7/11/96. Michael Redman can be reached at mredman@bvoice.com]

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
<?php

$app['controllers']['project/getall'] = function($app) {

    $projects = $app['foler']->getAllProjects();
    Response::responseWithSuccess(array('projects' => $projects));

};


text:
cask 'sqlpro-for-sqlite' do
  version '1.0.101'
  sha256 '2f69c480ad534c3fc1841c87eb53023767c8e3c58404ec2b9a4042de4bcdc45b'

  # d3fwkemdw8spx3.cloudfront.net/sqlite was verified as official when first introduced to the cask
  url "https://d3fwkemdw8spx3.cloudfront.net/sqlite/SQLProSQLite.#{version}.app.zip"
  name 'SQLPro for SQLite'
  homepage 'https://www.sqlitepro.com'

  app 'SQLPro for SQLite.app'

  zap delete: [
                '~/Library/Containers/com.hankinsoft.osx.sqliteprofessional',
                '~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.hankinsoft.osx.sqliteprofessional.sfl',
              ]
end


text:
import { StringMapper } from './string.mapper'

describe('string mapper', () => {
  describe('to db', () => {
    it('should work', () => {
      const attributeValue = StringMapper.toDb('myStringValue')
      expect(attributeValue).toEqual({ S: 'myStringValue' })
    })

    it('should work (empty string)', () => {
      const attributeValue = StringMapper.toDb('')
      expect(attributeValue).toStrictEqual({ S: '' })
    })

    it('should work (null)', () => {
      const attributeValue = StringMapper.toDb(<any>null)
      expect(attributeValue).toBe(null)
    })

    it('should work (undefined)', () => {
      const attributeValue = StringMapper.toDb(<any>undefined)
      expect(attributeValue).toBe(null)
    })
  })

  describe('from db', () => {
    it('should work', () => {
      const stringValue = StringMapper.fromDb({ S: 'myStringValue' })
      expect(stringValue).toBe('myStringValue')
    })
    it('should allow empty string values', () => {
      const stringValue = StringMapper.fromDb({ S: '' })
      expect(stringValue).toBe('')
    })
    it('should throw if not a string attribute', () => {
      expect(() => StringMapper.fromDb(<any>{ N: '8' })).toThrow()
    })
  })
})


text:
using content::WebContents;
using blink::WebFindOptions;

namespace android_webview {

FindHelper::FindHelper(WebContents* web_contents)
    : WebContentsObserver(web_contents),
      listener_(nullptr),
      async_find_started_(false),
      find_request_id_counter_(0),
      current_request_id_(0),
      last_match_count_(-1),
      last_active_ordinal_(-1) {
}

FindHelper::~FindHelper() {
}

void FindHelper::SetListener(Listener* listener) {
  listener_ = listener;
}

void FindHelper::FindAllAsync(const base::string16& search_string) {
  // Stop any ongoing asynchronous request.
  web_contents()->StopFinding(content::STOP_FIND_ACTION_KEEP_SELECTION);

  async_find_started_ = true;

  StartNewRequest(search_string);

  if (MaybeHandleEmptySearch(search_string))
    return;

  WebFindOptions options;
  options.forward = true;
  options.matchCase = false;
  options.findNext = false;

  web_contents()->Find(current_request_id_, search_string, options);
}

void FindHelper::HandleFindReply(int request_id,
                                 int match_count,
                                 int active_ordinal,
                                 bool finished) {
  if (!async_find_started_ || request_id != current_request_id_)
    return;

  NotifyResults(active_ordinal, match_count, finished);
}

void FindHelper::FindNext(bool forward) {
  if (!async_find_started_)
    return;

  if (MaybeHandleEmptySearch(last_search_string_))
    return;

  WebFindOptions options;
  options.forward = forward;
  options.matchCase = false;
  options.findNext = true;

  web_contents()->Find(current_request_id_, last_search_string_, options);
}

void FindHelper::ClearMatches() {
  web_contents()->StopFinding(content::STOP_FIND_ACTION_CLEAR_SELECTION);

  async_find_started_ = false;
  last_search_string_.clear();
  last_match_count_ = -1;
  last_active_ordinal_ = -1;
}

bool FindHelper::MaybeHandleEmptySearch(const base::string16& search_string) {
  if (!search_string.empty())
    return false;

  web_contents()->StopFinding(content::STOP_FIND_ACTION_CLEAR_SELECTION);
  NotifyResults(0, 0, true);
  return true;
}

void FindHelper::StartNewRequest(const base::string16& search_string) {
  current_request_id_ = find_request_id_counter_++;
  last_search_string_ = search_string;
  last_match_count_ = -1;
  last_active_ordinal_ = -1;
}

void FindHelper::NotifyResults(int active_ordinal,
                               int match_count,
                               bool finished) {
  // Match count or ordinal values set to -1 refer to received replies.
  if (match_count == -1)
    match_count = last_match_count_;
  else
    last_match_count_ = match_count;

  if (active_ordinal == -1)
    active_ordinal = last_active_ordinal_;
  else
    last_active_ordinal_ = active_ordinal;

  // Skip the update if we don't still have a valid ordinal.
  // The next update, final or not, should have this information.
  if (!finished && active_ordinal == -1)
    return;

  // Safeguard in case of errors to prevent reporting -1 to the API listeners.
  if (match_count == -1) {
    NOTREACHED();
    match_count = 0;
  }

  if (active_ordinal == -1) {
    NOTREACHED();
    active_ordinal = 0;
  }

  // WebView.FindListener active match ordinals are 0-based while WebKit sends
  // 1-based ordinals. Still we can receive 0 ordinal in case of no results.
  active_ordinal = std::max(active_ordinal - 1, 0);

  if (listener_)
    listener_->OnFindResultReceived(active_ordinal, match_count, finished);
}

}  // namespace android_webview


text:
export {Nav} from './Nav';
export {Body} from './Body';
export {Post} from './Post';


text:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
  <entity name="Position" table="position">
    <id name="id" type="integer" column="id">
      <generator strategy="IDENTITY"/>
    </id>
    <field name="name" type="string" column="name" length="32" nullable="false"/>
    <field name="description" type="string" column="description" length="1024" nullable="true"/>
    <many-to-many field="user" target-entity="User" inversed-by="position">
      <join-table name="position_user">
        <join-columns>
          <join-column name="position_id" referenced-column-name="id"/>
        </join-columns>
        <inverse-join-columns>
          <join-column name="user_id" referenced-column-name="id"/>
        </inverse-join-columns>
      </join-table>
    </many-to-many>
  </entity>
</doctrine-mapping>