text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/default_bg"
    android:orientation="vertical">

    <include layout="@layout/ly_title_bar" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:background="@color/white"
        android:gravity="center"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center">

            <ImageView
                android:id="@+id/bankIcon"
                android:layout_width="25dp"
                android:layout_height="25dp" />

            <TextView
                android:id="@+id/bankName"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/dp_10"
                android:textColor="@color/font_666"
                android:textSize="@dimen/fontSize_16sp" />
        </LinearLayout>

        <TextView
            android:id="@+id/money"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/dp_35"
            android:textColor="@color/font_333"
            android:textSize="30sp" />

        <TextView
            android:id="@+id/status"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/dp_10"
            android:textColor="@color/default_red"
            android:textSize="@dimen/fontSize_18sp" />
    </LinearLayout>
</LinearLayout>


text:
CXXFLAGS += -fopenmp

simplePrint: simplePrint.cpp

redpajama_set_name: RedPajamaGithub


text:
import {List, Range} from 'immutable';
import tinycolor     from 'tinycolor2';

import {getRandomColour, getBrightness} from 'utils/colour';
import constants                        from 'constants';

const maxLength = 16;

// Ensure that every colour is unique
// Constrain the size of the palette
const addPaletteColour = (state, colour) => {
  // Bail on empty
  if (!colour) return state;

  // Bail on existing
  if (state.find((c) => c.toHex() === tinycolor(colour).toHex())) return state;

  const newState = state.unshift(tinycolor(colour));

  return newState.size > maxLength
    ? newState.setSize(maxLength)
    : newState;
};

const deletePaletteColour = (state, colour) =>
  state.delete(state.indexOf(colour));

// Either fill the remaining slots up to maxLength
// Or replace the entire list if full
const fillPalette = (state) => {
  const rem = maxLength - state.size;

  return rem === 0
    ? Range(0, maxLength).map(getRandomColour)
    : state.concat(Range(0, rem).map(getRandomColour));
};

// Initialise
//-----------------------------------------------
const initialState = List();

const palette = (state = initialState, action) => {
  switch (action.type) {
    case constants.PALETTE_ADD_COLOUR:
      return addPaletteColour(state, action.payload.colour);

    case constants.PALETTE_DELETE_COLOUR:
      return deletePaletteColour(state, action.payload.colour);

    case constants.PALETTE_FILL:
      return fillPalette(state);

    case constants.PALETTE_SORT:
      return state.sortBy(getBrightness).reverse();

    case constants.PALETTE_SHUFFLE:
      return state.sortBy(Math.random);

    case constants.PALETTE_CLEAR:
      return List();

    default:
      return state;
  }
};

export default palette;


text:
package com.hannesdorfmann.mosby.sample.mail.model.account;

import com.hannesdorfmann.mosby.sample.mail.model.mail.MailProvider;

/**
 * This Exception will be thrown if a NOT AUTHENTICATED user tries to access {@link MailProvider}
 *
 * @author Hannes Dorfmann
 */
public class NotAuthenticatedException extends Exception {
}


text:
package com.opengamma.financial.analytics;

import static com.opengamma.engine.value.ValueRequirementNames.DV01;
import static com.opengamma.engine.value.ValueRequirementNames.PV01;

import java.util.Collections;
import java.util.Map;
import java.util.Set;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.collect.Iterables;
import com.opengamma.core.position.Position;
import com.opengamma.engine.ComputationTarget;
import com.opengamma.engine.function.AbstractFunction;
import com.opengamma.engine.function.FunctionCompilationContext;
import com.opengamma.engine.function.FunctionExecutionContext;
import com.opengamma.engine.function.FunctionInputs;
import com.opengamma.engine.target.ComputationTargetType;
import com.opengamma.engine.value.ComputedValue;
import com.opengamma.engine.value.ValueProperties;
import com.opengamma.engine.value.ValuePropertyNames;
import com.opengamma.engine.value.ValueRequirement;
import com.opengamma.engine.value.ValueSpecification;

/**
 * Able to scale values produced by the rest of the OG-Financial package.
 */
public class DV01Function extends AbstractFunction.NonCompiledInvoker {
  /** The logger */
  private static final Logger s_logger = LoggerFactory.getLogger(DV01Function.class);

  @Override
  public String getShortName() {
    return "DV01Function";
  }

  @Override
  public ComputationTargetType getTargetType() {
    return ComputationTargetType.POSITION;
  }

  @Override
  public Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target) {
    return Collections.singleton(new ValueSpecification(DV01, target.toSpecification(), ValueProperties.all()));
  }

  @Override
  public Set<ValueRequirement> getRequirements(final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) {
    final Position position = target.getPosition();
    final ValueRequirement requirement = new ValueRequirement(PV01, ComputationTargetType.POSITION, position.getUniqueId(), desiredValue.getConstraints().withoutAny(
        ValuePropertyNames.FUNCTION).withoutAny(ValuePropertyNames.SHIFT));
    return Collections.singleton(requirement);
  }

  /**
   * Replaces the {@link ValuePropertyNames#FUNCTION} property.
   * @param input The input
   * @return The result properties
   */
  protected ValueProperties getResultProperties(final ValueSpecification input) {
    return input.getProperties().copy().withoutAny(ValuePropertyNames.FUNCTION).with(ValuePropertyNames.FUNCTION, getUniqueId()).withAny(ValuePropertyNames.SHIFT).get();
  }

  @Override
  public Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target, final Map<ValueSpecification, ValueRequirement> inputs) {
    final ValueSpecification input = inputs.keySet().iterator().next();
    final ValueSpecification specification = new ValueSpecification(DV01, target.toSpecification(), getResultProperties(input));
    return Collections.singleton(specification);
  }

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final ComputedValue input = inputs.getAllValues().iterator().next();
    final Object value = input.getValue();
    final ValueSpecification specification = new ValueSpecification(DV01, target.toSpecification(), desiredValue.getConstraints());
    ComputedValue scaledValue = null;
    double shift;
    if (value instanceof Double) {
      Double doubleValue = (Double) value;
      final Set<String> shiftProperties = desiredValue.getConstraints().getValues(ValuePropertyNames.SHIFT);
      if (shiftProperties != null && shiftProperties.size() == 1) {
        final String shiftStr = Iterables.getOnlyElement(shiftProperties);
        try {
          shift = Double.parseDouble(shiftStr);
        } catch (final NumberFormatException nfe) {
          s_logger.error("Constraint Shift on DV01 not a value double, defaulting to 1d");
          shift = 1d;
        }
      } else {
        shift = 1d;
      }
      doubleValue *= shift;
      scaledValue = new ComputedValue(specification, doubleValue);
    } else {
      s_logger.error("DV01 is non numeric type {}, value {}", value.getClass(), value);
    }
    return Collections.singleton(scaledValue);
  }

}


text:
package org.twak.siteplan.junk;

import java.util.Arrays;
import java.util.List;

import javax.vecmath.Point2d;
import javax.vecmath.Point3d;
import javax.vecmath.Vector2d;

import org.twak.camp.Corner;
import org.twak.camp.CornerClone;
import org.twak.camp.Edge;
import org.twak.camp.Tag;
import org.twak.camp.ui.Bar;
import org.twak.camp.ui.Marker;
import org.twak.camp.ui.PointEditor.BarSelected;
import org.twak.siteplan.campskeleton.Global;
import org.twak.siteplan.campskeleton.Plan;
import org.twak.siteplan.campskeleton.PlanSkeleton;
import org.twak.siteplan.campskeleton.PlanUI;
import org.twak.siteplan.campskeleton.Profile;
import org.twak.siteplan.campskeleton.ProfileMachine;
import org.twak.siteplan.campskeleton.StepUI;
import org.twak.utils.LContext;
import org.twak.utils.Mathz;
import org.twak.utils.Pair;
import org.twak.utils.collections.ConsecutiveItPairs;
import org.twak.utils.collections.Loop;
import org.twak.utils.collections.Loopable;
import org.twak.utils.geom.Ray3d;

/**
 *
 * @author twak
 */
public class NaturalStep extends NaturalFeature
{

    public boolean isOurs (Tag feature)
    {
        return feature instanceof NaturalStep;
    }

    public NaturalStep(Plan plan)
    {
        super(plan, "natural square step");

        Loop<Bar> line = new Loop();

        Profile profile1 = new Profile( 50 );
        Profile profile2 = new Profile( 50 );

        Point2d[] coords = new Point2d[] {
            new Point2d (0,0), new Point2d (50,0), new Point2d (50,-20), new Point2d (250,-20), new Point2d (250,0), new Point2d (300, 0) };

        Profile[] profs = new Profile[] {
            profile1, profile2, profile1, profile2, profile1
        };

        int i = 0;
        for ( Pair<Point2d, Point2d> pair : new ConsecutiveItPairs<Point2d>( Arrays.asList( coords ) ) )
        {
            Bar b = new Bar (pair.first(), pair.second());
            line.append( b );

            plan.profiles.put( b, profs[i++] );
        }

        shape.add( line );

//        plan.tags.add( this );
        plan.addLoop( profile1.points.get( 0 ), plan.root, profile1 );
        plan.addLoop( profile2.points.get( 0 ), plan.root, profile2 );
    }

    @Override
    public PlanUI getEditor( BarSelected bs )
    {
        return new StepUI( this, bs );
    }

    @Override
    public double getSize( Bar bar )
    {
        Loop<Bar> loop = shape.get( 0 );

        int count = 0;
        for (Bar b : loop)
            if (b == bar)
                break;
            else count++;

        switch ( count )
        {
            case 1:
            case 3:
            {
                Bar b = loop.start.getNext().getNext().get();
                return b.start.distance( b.end );
            }
            case 2:
                Bar b = loop.start.getNext().get();
                return b.start.y - b.end.y;//distance( b.end );
            default:
                return 0; // start or end bar, value should be ignored...
        }
    }

       public Corner insert(
            PlanSkeleton skel,
            Marker m,
            LContext<Corner> leadingCorner, // the edge we're editing
            Edge old,
            CornerClone cc, // the new data structure
            List<ProfileMachine> machines, // as specified by this NatrualFeature's shape LoopL<Bar>
            List<Bar> bars, // the bars from this NaturalFeature
            double height, // the height of this event
            Global global,
            int valency )
    {
        Corner insertAfter = leadingCorner.get();
        Corner insertBefore = leadingCorner.get().nextC;

        Vector2d perp = new Vector2d( m.bar.end.y - m.bar.start.y, m.bar.start.x - m.bar.end.x );
        perp.normalize();
        Vector2d perpI = new Vector2d( perp );
        perpI.scale( -1 );
        Vector2d tangent = new Vector2d( m.bar.end.x - m.bar.start.x, m.bar.end.y - m.bar.start.y );
        tangent.normalize();

        Bar verticalBar = bars.get( 1 );
        if (verticalBar.start.y - verticalBar.end.y < 0)
        {
            // protrusion should be intrusion!
            perp.scale( -1 );
            perpI.scale( -1 ); // {or just swap...}
        }

        double length = insertAfter.distance( insertAfter.nextC );
//        System.out.println("length is "+length);

        if ( length < 2 )
            return insertAfter;

        Ray3d l3 = Ray3d.fromStartEnd( insertAfter, insertBefore );
        double param = l3.projectParam( new Point3d( m.x, m.y, 0 ) );
        param = Mathz.clamp( param, 2. / length, 1 - 2. / length );

        double pStart = param - 0.5 / length;

        Corner insertStart = new Corner( l3.fromParam( pStart ) );

        Loopable lastLoopable = leadingCorner.loopable;

        Corner pos = insertStart;
        int i = 1; // skip first and last bars as "interface"
        for ( Vector2d v : Arrays.asList( perp, tangent, perpI ) )
        {
            Point2d loc = new Point2d( pos.x, pos.y );
            loc.add( v );
            Corner end = new Corner( loc.x, loc.y, 0 );

            Edge e = new Edge( pos, end );
            pos.nextL = e;
            lastLoopable =leadingCorner.loop.addAfter( lastLoopable, pos );

            ProfileMachine pm = machines.get( i );
            e.machine = pm;
            pm.addEdge( e, skel );

            Bar b = bars.get( i );

            skel.plan.profiles.put( b, pm.profile );
            skel.addingProfile( pm.profile );

            skel.registerEdge( e, global, valency, b );

//            created.add( new BarGlobalValency( b, global, valency, e ) );

            pos = end;
            i++;
        }

        pos.nextL = insertAfter.nextL;
        leadingCorner.loop.addAfter( lastLoopable, pos );
        cc.nOSegments.put( pos, cc.nOSegments.getSetA( insertAfter ).iterator().next() );

        for ( Loopable<Corner> c : leadingCorner.loop.loopableIterator() )
        {
            Corner p = c.get();
            Corner n = c.getNext().get();

            p.nextC = n;
            n.prevC = p;
            n.prevL = p.nextL;
        }
        return insertBefore.prevC;
    }
}


text:
- Update release notes in doc/source/release/
- Update doc/source/new.txt to add new release notes

- Update the version number in:
    - `README.md`
    - `doc/source/_static/docversions.js`
    - `sktracker/version.py` and commit

- Commit

- Pull git submodule to build doc : `make init_submodule`
- Build doc : `make doc`

- Check doc is ok lcoally and then push doc : `make push_doc`

- Add the version number as a tag in git : `git tag v0.X.0`
- Push the new meta-data to github : `git push --tags origin master`

- Create release on Github so zenodo can create and update DOI

- Publish on PyPi :

```sh
   python setup.py register
   python setup.py sdist upload
```

- Increase the version number in `sktracker/version.py` and `dev` suffix.
- Update the development docs for the new version `0.X-dev` just like above
- Push the new dev doc

- Go drink a beer, you deserved it :-)


text:
var models = require('../models')
import {expect} from 'chai'

describe('user model', () => {

    it('hashes password', (done) => {
        models.User.hashPassword('test', (hashedPassword) => {
            expect(hashedPassword).to.exist
            done()
        })
    })

    it('creates', (done) => {
        models.User.create({
            username: 'testuser',
            password: 'testpass',
            scope: 'test'
        })
        .then(user => {
            expect(user.dataValues.id).to.exist
            user.destroy().then(() => { done() })
        })
    })

    it('validates', (done) => {
        models.User.create({
            username: 'test',
            password: 'test',
            scope: 'test'
        })
        .catch(error => {
            expect(error.errors[0].path).to.equal('username')
            expect(error.errors[0].message).to.equal('Validation len failed')
            done()
        })
    })
})


text:
package com.musicbubble.service;

import com.musicbubble.model.SongEntity;
import com.musicbubble.model.TasteEntity;
import com.musicbubble.repository.SongRepository;
import com.musicbubble.repository.TasteRepository;
import com.musicbubble.service.recommend.Languages;
import com.musicbubble.service.base.MyService;
import com.musicbubble.service.recommend.Styles;
import com.musicbubble.tools.ConstUtil;
import com.musicbubble.tools.JsonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

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

/**
 * Created by happyfarmer on 12/22/2016.
 */
@Service
public class RecordService extends MyService {

    @Autowired
    private TasteRepository tasteRepository;
    @Autowired
    private SongRepository songRepository;

    @Transactional
    public boolean recordPlayMusic(int user_id, int song_id) {
        SongEntity entity = songRepository.findOne(song_id);
        if (entity == null) return false;

        String song_language = entity.getLanguage();
        String song_style = entity.getStyles();

        TasteEntity tasteEntity = tasteRepository.findOne(user_id);
        Languages languages = JsonUtil.langFromJson(tasteEntity.getLanguage());
        languages.updateLanguage(song_language);
        Styles styles = JsonUtil.styleFromJson(tasteEntity.getStyle());
        styles.updateStyle(song_style);

        String lang = JsonUtil.jsonFromObject(languages);
        String style = JsonUtil.jsonFromObject(styles);

        tasteRepository.update(user_id, lang, style);

        return true;
    }

    @Transactional
    public boolean CreateTaste(int user_id) {
        TasteEntity entity = new TasteEntity();
        entity.setUserId(user_id);
        entity.setLanguage(ConstUtil.DEFAULT_LANGUAGE);
        entity.setStyle(ConstUtil.DEFAULT_STYLE);
        tasteRepository.save(entity);
        return true;
    }

    public List<Integer> getOneUserStyle(int user_id){
        TasteEntity t=tasteRepository.findOne(user_id);
        String style=t.getStyle();

        return parseStyle(style);
    }

    public List<List<Integer>> getRangeUserStyle(int pre_id,int las_id){
        List<String> style=tasteRepository.findRangeOfUser(pre_id,las_id);
        List<List<Integer>> returnStyle=new ArrayList<>();
        for(String userStyle:style){
            returnStyle.add(parseStyle(userStyle));
        }

        return returnStyle;
    }

    private List<Integer> parseLanguage(int user_id, String language) {
        List<Integer> list = new ArrayList<>();
        Languages languages = JsonUtil.langFromJson(language);

        for (int i = 0; i < ConstUtil.SONG_LANG_LENGTH; ++i) {
            list.add(languages.getLangs()[i]);
        }
        return list;
    }

    private List<Integer> parseStyle(String style) {
        List<Integer> list = new ArrayList<>();
        Styles styles = JsonUtil.styleFromJson(style);

        for (int i = 0; i < ConstUtil.SONG_STYLE_LENGTH; ++i) {
            list.add(styles.getStyles()[i]);
        }

        return list;
    }
}


text:
#ifndef WEBRTC_BASE_FAKENETWORK_H_
#define WEBRTC_BASE_FAKENETWORK_H_

#include <string>
#include <vector>

#include "webrtc/base/network.h"
#include "webrtc/base/messagehandler.h"
#include "webrtc/base/socketaddress.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/base/thread.h"

namespace rtc {

const int kFakeIPv4NetworkPrefixLength = 24;
const int kFakeIPv6NetworkPrefixLength = 64;

// Fake network manager that allows us to manually specify the IPs to use.
class FakeNetworkManager : public NetworkManagerBase,
                           public MessageHandler {
 public:
  FakeNetworkManager() : thread_(Thread::Current()) {}

  typedef std::vector<SocketAddress> IfaceList;

  void AddInterface(const SocketAddress& iface) {
    // Ensure a unique name for the interface if its name is not given.
    AddInterface(iface, "test" + rtc::ToString(next_index_++));
  }

  void AddInterface(const SocketAddress& iface, const std::string& if_name) {
    SocketAddress address(if_name, 0);
    address.SetResolvedIP(iface.ipaddr());
    ifaces_.push_back(address);
    DoUpdateNetworks();
  }

  void RemoveInterface(const SocketAddress& iface) {
    for (IfaceList::iterator it = ifaces_.begin();
         it != ifaces_.end(); ++it) {
      if (it->EqualIPs(iface)) {
        ifaces_.erase(it);
        break;
      }
    }
    DoUpdateNetworks();
  }

  virtual void StartUpdating() {
    ++start_count_;
    if (start_count_ == 1) {
      sent_first_update_ = false;
      thread_->Post(this);
    } else {
      if (sent_first_update_) {
        SignalNetworksChanged();
      }
    }
  }

  virtual void StopUpdating() { --start_count_; }

  // MessageHandler interface.
  virtual void OnMessage(Message* msg) {
    DoUpdateNetworks();
  }

  using NetworkManagerBase::set_enumeration_permission;

 private:
  void DoUpdateNetworks() {
    if (start_count_ == 0)
      return;
    std::vector<Network*> networks;
    for (IfaceList::iterator it = ifaces_.begin();
         it != ifaces_.end(); ++it) {
      int prefix_length = 0;
      if (it->ipaddr().family() == AF_INET) {
        prefix_length = kFakeIPv4NetworkPrefixLength;
      } else if (it->ipaddr().family() == AF_INET6) {
        prefix_length = kFakeIPv6NetworkPrefixLength;
      }
      IPAddress prefix = TruncateIP(it->ipaddr(), prefix_length);
      scoped_ptr<Network> net(new Network(it->hostname(),
                                          it->hostname(),
                                          prefix,
                                          prefix_length));
      net->AddIP(it->ipaddr());
      networks.push_back(net.release());
    }
    bool changed;
    MergeNetworkList(networks, &changed);
    if (changed || !sent_first_update_) {
      SignalNetworksChanged();
      sent_first_update_ = true;
    }
  }

  Thread* thread_;
  IfaceList ifaces_;
  int next_index_ = 0;
  int start_count_ = 0;
  bool sent_first_update_ = false;
};

}  // namespace rtc

#endif  // WEBRTC_BASE_FAKENETWORK_H_


text:
package java.io;

/**
 * Wraps an existing {@link OutputStream} and provides convenience methods for
 * writing common data types in a human readable format. This is not to be
 * confused with DataOutputStream which is used for encoding common data types
 * so that they can be read back in. No {@code IOException} is thrown by this
 * class. Instead, callers should use {@link #checkError()} to see if a problem
 * has occurred in this stream.
 */
public class PrintStream extends FilterOutputStream implements Appendable,
        Closeable {
    /** "null" as bytes. */
    private static final byte[] NULL = "null".getBytes();

    /**
     * Constructs a new {@code PrintStream} with {@code out} as its target
     * stream. By default, the new print stream does not automatically flush its
     * contents to the target stream when a newline is encountered.
     *
     * @param out
     *            the target output stream.
     * @throws NullPointerException
     *             if {@code out} is {@code null}.
     */
    public PrintStream(OutputStream out) {
        super(out);
    }

    /**
     * Closes this print stream. Flushes this stream and then closes the target
     * stream. If an I/O error occurs, this stream's error state is set to
     * {@code true}.
     */
    @Override
    public void close() {
        try {
            super.close();
        } catch (IOException e) {
            // NOP
        }
    }

    /**
     * Ensures that all pending data is sent out to the target stream. It also
     * flushes the target stream. If an I/O error occurs, this stream's error
     * state is set to {@code true}.
     */
    @Override
    public void flush() {
        try {
            super.flush();
        } catch (IOException e) {
            // NOP
        }
    }

    /**
     * Prints a string to the target stream. The string is converted to an array
     * of bytes using the encoding chosen during the construction of this
     * stream. The bytes are then written to the target stream with
     * {@code write(int)}.
     *

     * If an I/O error occurs, this stream's error state is set to {@code true}.
     *
     * @param str
     *            the string to print to the target stream.
     * @see #write(int)
     */
    public void print(String str) {
        try {
            if (str == null) {
                write(NULL);
            } else {
                write(str.getBytes());
            }
        } catch (IOException e) {
            // NOP
        }
    }

    /**
     * Prints the string representation of the specified character array
     * to the target stream.
     *
     * @param charArray
     *            the character array to print to the target stream.
     * @see #print(String)
     */
    public void print(char[] charArray) {
        print(new String(charArray, 0, charArray.length));
    }

    /**
     * Prints the string representation of the specified character to the target
     * stream.
     *
     * @param ch
     *            the character to print to the target stream.
     * @see #print(String)
     */
    public void print(char ch) {
        print(String.valueOf(ch));
    }

    /**
     * Prints the string representation of the specified double to the target
     * stream.
     *
     * @param dnum
     *            the double value to print to the target stream.
     * @see #print(String)
     */
    public void print(double dnum) {
        print(String.valueOf(dnum));
    }

    /**
     * Prints the string representation of the specified float to the target
     * stream.
     *
     * @param fnum
     *            the float value to print to the target stream.
     * @see #print(String)
     */
    public void print(float fnum) {
        print(String.valueOf(fnum));
    }

    /**
     * Prints the string representation of the specified integer to the target
     * stream.
     *
     * @param inum
     *            the integer value to print to the target stream.
     * @see #print(String)
     */
    public void print(int inum) {
        print(String.valueOf(inum));
    }

    /**
     * Prints the string representation of the specified long to the target
     * stream.
     *
     * @param lnum
     *            the long value to print to the target stream.
     * @see #print(String)
     */
    public void print(long lnum) {
        print(String.valueOf(lnum));
    }

    /**
     * Prints the string representation of the specified object to the target
     * stream.
     *
     * @param obj
     *            the object to print to the target stream.
     * @see #print(String)
     */
    public void print(Object obj) {
        print(String.valueOf(obj));
    }

    /**
     * Prints the string representation of the specified boolean to the target
     * stream.
     *
     * @param bool
     *            the boolean value to print the target stream.
     * @see #print(String)
     */
    public void print(boolean bool) {
        print(String.valueOf(bool));
    }

    /**
     * Prints the string representation of the system property
     * {@code "line.separator"} to the target stream.
     */
    public void println() {
        print('\n');
    }

    /**
     * Prints the string representation of the specified character array
     * followed by the system property {@code "line.separator"} to the target
     * stream.
     *
     * @param charArray
     *            the character array to print to the target stream.
     * @see #print(String)
     */
    public void println(char[] charArray) {
        println(new String(charArray, 0, charArray.length));
    }

    /**
     * Prints the string representation of the specified character followed by
     * the system property {@code "line.separator"} to the target stream.
     *
     * @param ch
     *            the character to print to the target stream.
     * @see #print(String)
     */
    public void println(char ch) {
        println(String.valueOf(ch));
    }

    /**
     * Prints the string representation of the specified double followed by the
     * system property {@code "line.separator"} to the target stream.
     *
     * @param dnum
     *            the double value to print to the target stream.
     * @see #print(String)
     */
    public void println(double dnum) {
        println(String.valueOf(dnum));
    }

    /**
     * Prints the string representation of the specified float followed by the
     * system property {@code "line.separator"} to the target stream.
     *
     * @param fnum
     *            the float value to print to the target stream.
     * @see #print(String)
     */
   public void println(float fnum) {
        println(String.valueOf(fnum));
    }

   /**
     * Prints the string representation of the specified integer followed by the
     * system property {@code "line.separator"} to the target stream.
     *
     * @param inum
     *            the integer value to print to the target stream.
     * @see #print(String)
     */
    public void println(int inum) {
        println(String.valueOf(inum));
    }

    /**
     * Prints the string representation of the specified long followed by the
     * system property {@code "line.separator"} to the target stream.
     *
     * @param lnum
     *            the long value to print to the target stream.
     * @see #print(String)
     */
    public void println(long lnum) {
        println(String.valueOf(lnum));
    }

    /**
     * Prints the string representation of the specified object followed by the
     * system property {@code "line.separator"} to the target stream.
     *
     * @param obj
     *            the object to print to the target stream.
     * @see #print(String)
     */
    public void println(Object obj) {
        println(String.valueOf(obj));
    }

    /**
     * Prints a string followed by the system property {@code "line.separator"}
     * to the target stream. The string is converted to an array of bytes using
     * the encoding chosen during the construction of this stream. The bytes are
     * then written to the target stream with {@code write(int)}.
     *

     * If an I/O error occurs, this stream's error state is set to {@code true}.
     *
     * @param str
     *            the string to print to the target stream.
     * @see #write(int)
     */
    public void println(String str) {
        print(str);
        println();
    }

    /**
     * Prints the string representation of the specified boolean followed by the
     * system property {@code "line.separator"} to the target stream.
     *
     * @param bool
     *            the boolean value to print to the target stream.
     * @see #print(String)
     */
    public void println(boolean bool) {
        println(String.valueOf(bool));
    }

    /**
     * Appends the character {@code c} to the target stream. This method works
     * the same way as {@link #print(char)}.
     *
     * @param c
     *            the character to append to the target stream.
     * @return this stream.
     */
    public PrintStream append(char c) {
        print(c);
        return this;
    }

    /**
     * Appends the character sequence {@code csq} to the target stream. This
     * method works the same way as {@code PrintStream.print(csq.toString())}.
     * If {@code csq} is {@code null}, then the string "null" is written to the
     * target stream.
     *
     * @param csq
     *            the character sequence appended to the target stream.
     * @return this stream.
     */
    public PrintStream append(CharSequence csq) {
        if (null == csq) {
            print("null");
        } else {
            print(csq.toString());
        }
        return this;
    }

    /**
     * Appends a subsequence of the character sequence {@code csq} to the target
     * stream. This method works the same way as {@code
     * PrintStream.print(csq.subsequence(start, end).toString())}. If {@code
     * csq} is {@code null}, then the specified subsequence of the string "null"
     * will be written to the target stream.
     *
     * @param csq
     *            the character sequence appended to the target stream.
     * @param start
     *            the index of the first char in the character sequence appended
     *            to the target stream.
     * @param end
     *            the index of the character following the last character of the
     *            subsequence appended to the target stream.
     * @return this stream.
     * @throws IndexOutOfBoundsException
     *             if {@code start > end}, {@code start < 0}, {@code end < 0} or
     *             either {@code start} or {@code end} are greater or equal than
     *             the length of {@code csq}.
     */
    public PrintStream append(CharSequence csq, int start, int end) {
        if (null == csq) {
            print("null");
        } else {
            print(csq.subSequence(start, end).toString());
        }
        return this;
    }
}


text:
const double EPSILON = 0.001;

TEST(Packages_Transformation_newt2, irtkMultiLevelFreeFormTransformation_Inverse)
{
   irtkCifstream iStream;
   iStream.Open("/vol/medic02/users/sp2010/PhD/Tumor/dofs/gradientnreg2-NGP-HG01.dof.gz");
   irtkMultiLevelFreeFormTransformation transformation;
   transformation.Read(iStream);

   double x = 10, y = 10, z = 10;
   transformation.Inverse(x, y, z);

   ASSERT_NEAR(1.16573, x, EPSILON);
   ASSERT_NEAR(23.9054, y, EPSILON);
   ASSERT_NEAR(-17.255, z, EPSILON);
}


text:
package gov.nih.nci.lmp.mimplugin;

import gov.nih.nci.lmp.mimGpml.MIMFormat;

import java.awt.Color;
import java.awt.Desktop;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Shape;
import java.awt.event.ActionEvent;
import java.awt.geom.GeneralPath;
import java.awt.geom.Rectangle2D;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JPopupMenu;

import org.pathvisio.core.ApplicationEvent;
import org.pathvisio.core.Engine;
import org.pathvisio.core.debug.Logger;
import org.pathvisio.core.model.AnchorType;
import org.pathvisio.core.model.GroupStyle;
import org.pathvisio.core.model.ObjectType;
import org.pathvisio.core.model.Pathway;
import org.pathvisio.core.model.PathwayElement;
import org.pathvisio.core.model.Property;
import org.pathvisio.core.model.PropertyManager;
import org.pathvisio.core.model.PropertyType;
import org.pathvisio.core.model.StaticProperty;
import org.pathvisio.core.model.StaticPropertyType;
import org.pathvisio.core.preferences.PreferenceManager;
import org.pathvisio.core.view.Graphics;
import org.pathvisio.core.view.Group;
import org.pathvisio.core.view.GroupPainter;
import org.pathvisio.core.view.GroupPainterRegistry;
import org.pathvisio.core.view.Line;
import org.pathvisio.core.view.SelectionBox;
import org.pathvisio.core.view.SelectionBox.SelectionListener;
import org.pathvisio.core.view.ShapeRegistry;
import org.pathvisio.core.view.Template;
import org.pathvisio.core.view.VPathway;
import org.pathvisio.core.view.VPathwayElement;
import org.pathvisio.desktop.PvDesktop;
import org.pathvisio.desktop.plugin.Plugin;
import org.pathvisio.gui.PathwayElementMenuListener.PathwayElementMenuHook;
import org.pathvisio.gui.handler.PropertyDisplayManager;

/**
 * A MIM plugin supporting the
 *
 * @author Margot Sunshine
 * @author Augustin Luna <augustin@mail.nih.gov>
 *
 * @version 1.0
 * @since 1.0
 */
public class MimPlugin implements Plugin, Engine.ApplicationEventListener
{
//	private PvDesktop desktop;
    private static AnchorType INTRANS_ANCHOR;
    public static final GroupStyle SIMPLE_ENTITY_GROUP = GroupStyle.create("EntityWithFeatures", true);
    private static MimObjectsPane mimObjectsPane;

    public void init(PvDesktop desktop)
	{
        MimObjectsPane.registerShapes();
        MimImplicitComplexGroup.registerGroup();
        Engine e = desktop.getSwingEngine().getEngine();

        // add new anchor;
		INTRANS_ANCHOR = AnchorType.create("Intermolecular", true);
        ShapeRegistry.registerAnchor(INTRANS_ANCHOR.getName(), getIntranAnchorShape());

        GroupPainterRegistry.registerPainter(SIMPLE_ENTITY_GROUP.toString(), featurePainter);

        PropertyDisplayManager.setVisible(StaticProperty.HEIGHT, false);
        PropertyDisplayManager.setVisible(StaticProperty.WIDTH, false);
        Action mimHelpAction = new MimHelpAction();
        desktop.registerMenuAction ("Help", mimHelpAction);

        // register a hook so we can modify the right-click menu
        desktop.addPathwayElementMenuHook(new InTransOption());
        desktop.addPathwayElementMenuHook(new NewFeatureOption());
        desktop.addPathwayElementMenuHook(new MimImplicitComplexGroup(desktop));

        mimObjectsPane = new MimObjectsPane(desktop, e);
		desktop.getSideBarTabbedPane().add("MIM Glyphs", mimObjectsPane);

        if (!PreferenceManager.getCurrent().get(MimPreferencesDlg.MIMPreference.PREFERRED_PANEL).equals("MIM Glyphs")) {
            int panelId = desktop.getSideBarTabbedPane().indexOfTab(PreferenceManager.getCurrent().get(MimPreferencesDlg.MIMPreference.PREFERRED_PANEL));
            Logger.log.info("preference manager preferred panel" + panelId);
            if (panelId > -1) {
                desktop.getSideBarTabbedPane().setSelectedComponent(desktop.getSideBarTabbedPane().getComponentAt(panelId));
            }
        }

        // register a listener so we get notified when a pathway is opened
        desktop.getSwingEngine().getEngine().addApplicationEventListener(this);
		// create MIM format plugin
        MIMFormat format = new MIMFormat();
		desktop.getSwingEngine().getEngine().addPathwayExporter(format);
		desktop.getSwingEngine().getEngine().addPathwayImporter(format);
        // set the initial enabled / disabled state of the action
        updateState();
        new MimPreferencesDlg(desktop);

        // add dynamic property to allow the user to identify the start of
        // of an interaction
        PropertyManager.registerProperty(MIM_INTERACTION_START);
        PropertyDisplayManager.registerProperty(MIM_INTERACTION_START);
        PropertyDisplayManager.setPropertyScope(
        		MIM_INTERACTION_START,
                EnumSet.of(ObjectType.LINE)
        );

        // add dynamic property necessary for validation
        PropertyManager.registerProperty(MIM_DATABASE_RELATIONSHIP);
        PropertyDisplayManager.registerProperty(MIM_DATABASE_RELATIONSHIP);
        PropertyDisplayManager.setPropertyScope(
        		MIM_DATABASE_RELATIONSHIP,
                EnumSet.of(ObjectType.DATANODE)
        );

        // add dynamic property necessary for validation
        PropertyManager.registerProperty(MIM_ENTITY_CONTROLLED_VOCABULARY);
        PropertyDisplayManager.registerProperty(MIM_ENTITY_CONTROLLED_VOCABULARY);
        PropertyDisplayManager.setPropertyScope(
        		MIM_ENTITY_CONTROLLED_VOCABULARY,
                EnumSet.of(ObjectType.DATANODE)
        );
	}
       /**
         * Display a welcome message when this action is triggered.
         */
        private class MimHelpAction extends AbstractAction
        {
                MimHelpAction()
                {
                        // The NAME property of an action is used as
                        // the label of the menu item
                        putValue (NAME, "MIM Help");
                }

                /**
                 *  called when the user selects the menu item
                 */
                public void actionPerformed(ActionEvent arg0)
                {
                    String url = "HTTP://discover.nci.nih.gov/mim/mim_pathvisio.html";
                        try
                        {
                        	Desktop.getDesktop().browse(new URI(url));
                        }
                        catch (Exception ex)
                        {
                            ex.printStackTrace();
                        }
                }
        }
    public void done() {}

    /**
     * Checks if a pathway is open or not. If there is no open pathway,
     * the toolbar button is greyed out.
     */
    public void updateState()
    {
//        toolbarAction.setEnabled(desktop.getSwingEngine().getEngine().hasVPathway());
//        restrictedCopyToolbarAction.setEnabled(desktop.getSwingEngine().getEngine().hasVPathway());
//        degradationToolbarAction.setEnabled(desktop.getSwingEngine().getEngine().hasVPathway());
//        modifierToolbarAction.setEnabled(desktop.getSwingEngine().getEngine().hasVPathway());
//        entityToolbarAction.setEnabled(desktop.getSwingEngine().getEngine().hasVPathway());
//        entityWithFeatureToolbarAction.setEnabled(desktop.getSwingEngine().getEngine().hasVPathway());
    }

    /**
    * This is called when a Pathway is opened or closed.
    */
    public void applicationEvent(ApplicationEvent e)
    {
         updateState();
    }

    /**
     * Add in trans to line menu
     */
    public class InTransOption implements PathwayElementMenuHook {
        VPathway vPathway;
       /**
        * This method is called whenever the user right-clicks
        * on an element in the Pathway.
        * VPathwayElement contains the object that was clicked on.
        */
       public void pathwayElementMenuHook(VPathwayElement e, JPopupMenu menu)
       {
           if (e instanceof Line) {
               vPathway = e.getDrawing();
                // We instantiate an Action
                   ShowInfoAction showInfoAction = new ShowInfoAction();

                   // pass the clicked element to the action object
                   showInfoAction.setElement(e);

                   // Insert action into the menu.
                   // NB: this is optional, we can choose e.g.
                   // to insert only when the clicked element is a certain type.
                   menu.add (showInfoAction);
           }
       }

        class ShowInfoAction extends AbstractAction
        {
                private VPathwayElement elt;

                public ShowInfoAction()
                {
                        // This will be the label of the pop up menu item.
                        putValue (NAME, "Add Intermolecular symbol");
                }

                /**
                 * This should be called before the action is triggered
                 */
                public void setElement (VPathwayElement anElt)
                {
                        elt = anElt;
                }

                public void actionPerformed(ActionEvent arg0)
                {
                	List<Graphics> selection = vPathway.getSelectedGraphics();
                    PathwayElement.MAnchor anchor;

                    if(selection.size() > 0) {
                        vPathway.getUndoManager().newAction("Add Intermolecular symbol");
                        for(Graphics g : selection) {
                            if(g instanceof Line) {
                                anchor = g.getPathwayElement().addMAnchor(0.4);

                                String graphId = anchor.getParent().getParent().getUniqueGraphId();

                                anchor.setGraphId(graphId);
                                anchor.setShape(INTRANS_ANCHOR);
                            }
                        }
                        vPathway.redrawDirtyRect();
                    }

                }
        }
    }

    final static int SEGMENT_SIZE = 5;
    final static int DISTANCE_FROM_CENTER = 4;

    private static Shape getIntranAnchorShape() {
        int[] xpoints = {-2,0,2,0};
        int[] ypoints = {0,2,0,-2};
        GeneralPath rec = new GeneralPath(new Polygon(xpoints, ypoints, 4));
		rec.moveTo(-(SEGMENT_SIZE * 2), SEGMENT_SIZE);
		rec.lineTo(SEGMENT_SIZE, -SEGMENT_SIZE * 2);
		rec.moveTo(-(SEGMENT_SIZE), SEGMENT_SIZE * 2);
        rec.lineTo(SEGMENT_SIZE * 2, -SEGMENT_SIZE);
        return rec;
    }

    /**
     * Add new Feature to group menu
     */
    public class NewFeatureOption implements PathwayElementMenuHook {
        VPathway vPathway;
        Group group;
       /**
        * This method is called whenever the user right-clicks
        * on an element in the Pathway.
        * VPathwayElement contains the object that was clicked on.
        */
       public void pathwayElementMenuHook(VPathwayElement e, JPopupMenu menu)
       {
           if (e instanceof Group) {
               group = (Group)e;
               vPathway = e.getDrawing();
                // We instantiate an Action
               if (group.getPathwayElement().getGroupStyle().equals(SIMPLE_ENTITY_GROUP)) {
                   ShowAddFeatureAction showAddFeatureAction = new ShowAddFeatureAction();

                   // pass the clicked element to the action object
                   showAddFeatureAction.setElement(e);
                   // Insert action into the menu.
                   // NB: this is optional, we can choose e.g.
                   // to insert only when the clicked element is a certain type.

                   menu.add (showAddFeatureAction);
               }
           }
       }

        class ShowAddFeatureAction extends AbstractAction implements SelectionListener {
            private VPathwayElement elt;

            public ShowAddFeatureAction()
            {
//                group.getPathwayElement().addListener();
                vPathway.addSelectionListener(this);
                // This will be the label of the pop up menu item.
                    putValue (NAME, "Add New Feature");
            }

            /**
             * This should be called before the action is triggered
             */
            public void setElement (VPathwayElement anElt)
            {
                    elt = anElt;
            }

            public void selectionEvent(SelectionBox.SelectionEvent e) {
                System.out.println("MimPlugin add feature selection event");
                for (VPathwayElement ve:e.selection) {
                    if (ve instanceof Group) {
                        addFeature((Group)ve);
                    }
                }
                 setEnabled(true);
            }

            public void addFeature(Group group) {
                group.getPathwayElement();
                String groupRef = group.getPathwayElement().getGroupId();
                System.out.println("addFeature " + groupRef);
            }

            public void actionPerformed(ActionEvent arg0)
            {
                System.out.println("MimPlugin add feature action performed");
                if (elt instanceof Group) {
                    Group group = ((Group)elt);
                    String groupRef = group.getPathwayElement().getGroupId();
                    PathwayElement lastFeature = null;
                    for (Graphics gg:group.getGroupGraphics()) {
                        if (gg.getPathwayElement().getDynamicProperty("NextFeature") == null) {
                            lastFeature = gg.getPathwayElement();
                        }
                    }
                    if (lastFeature == null) {
                        System.out.println("!!!!! Problem - last Feature not found !!!!! " + groupRef);
                        return;
                    }
                    double mx = lastFeature.getMCenterX();
                    double my = lastFeature.getMCenterY();
                    FeatureTemplate newFeature = new FeatureTemplate(groupRef, mx, my, lastFeature);
                    System.out.println("Adding new feature " + groupRef + " mx " + mx + " my " + my );
                    ArrayList<PathwayElement> elems = new ArrayList<PathwayElement>();
                    elems.toArray(newFeature.addElements(vPathway.getPathwayModel(), mx, my));
                    vPathway.paste(elems);
                    vPathway.redrawDirtyRect();
                }

            }
        }
    }

    public static class FeatureTemplate implements Template {
//    static Template featureTemplate = new Template() {
        double fmx;
        double fmy;
        String ref;
        PathwayElement lastFeature;

        public FeatureTemplate(String groupRef, double fmx, double fmy, PathwayElement lastFeature) {
            this.fmx = fmx;
            this.fmy = fmy;
            ref = groupRef;
            this.lastFeature = lastFeature;

        }

        public PathwayElement[] addElements(Pathway p, double mx, double my) {
            PathwayElement l = mimObjectsPane.drawFeatureLine(p, fmx, fmy, ref, false);
            p.add(l);
            String nextFeatureId = p.getUniqueGraphId();
            lastFeature.setDynamicProperty("NextFeature", nextFeatureId);
            PathwayElement e = mimObjectsPane.drawFeature(fmx, fmy, ref, nextFeatureId);
            p.add(e);
            l.getMStart().linkTo(lastFeature, 1, 0);
            l.getMEnd().linkTo(e,-1,0);

            return new PathwayElement[] { e, l };
        }
        		public String getName()
		{
			return "EntityFeature";
		}

		public String getDescription()
		{
			return "Draw new Entity feature";
		}

        public VPathwayElement getDragElement(VPathway vp)
		{
			// normally we would return a Handle of the newly
			// created VPathwayElement here.
			//
			// by returning null, we prevent the user from
			// dragging the handle and customizing the
			// size of the new object
			return null;
		}

        private final String IMG_EF = "images/SPE.gif";

        public URL getIconLocation()
        {
            return MimPlugin.class.getClassLoader().getResource(IMG_EF);
        }

        public void postInsert(PathwayElement[] newElements) {

        }
    }

    static final Property MIM_INTERACTION_START = new Property () {
        //A unique id for the property
        public String getId() {
                return "InteractionStart";
        }
        //The description, will be used as tooltip in the property panel
        public String getDescription() {
                return "ID of the entity at the start of an interaction.";
        }
        //The name the user sees in the property panel
        public String getName() {
                return "Interaction Start";
        }
        //The data type of the property
        public PropertyType getType() {
                return StaticPropertyType.STRING;
        }
        public boolean isCollection() {
                return false;
        }
    };

    static final Property MIM_DATABASE_RELATIONSHIP = new Property () {
        //A unique id for the property
        public String getId() {
                return "DatabaseRelationship";
        }
        //The description, will be used as tooltip in the property panel
        public String getDescription() {
                return "Relationship of the database and database identifier to the attached entity.";
        }
        //The name the user sees in the property panel
        public String getName() {
                return "Database Relationship";
        }
        //The data type of the property
        public PropertyType getType() {
                return StaticPropertyType.STRING;
        }
        public boolean isCollection() {
                return false;
        }
    };

    static final Property MIM_ENTITY_CONTROLLED_VOCABULARY = new Property () {
        //A unique id for the property
        public String getId() {
                return "EntityControlledVocabulary";
        }
        //The description, will be used as tooltip in the property panel
        public String getDescription() {
                return "An attribute to relate MIM entities to BioPAX entities.";
        }
        //The name the user sees in the property panel
        public String getName() {
                return "Entity Controlled Vocabulary";
        }
        //The data type of the property
        public PropertyType getType() {
                return StaticPropertyType.STRING;
        }
        public boolean isCollection() {
                return false;
        }
    };

       private static GroupPainter featurePainter = new GroupPainter() {
         public void drawGroup(Graphics2D g, Group group, int flags) {
             boolean mouseover = (flags & Group.FLAG_MOUSEOVER) != 0;
             boolean anchors = false;
             boolean selected = (flags & Group.FLAG_SELECTED) != 0;
             Rectangle2D rect = group.getVBounds();

             int arc = (int)rect.getWidth()/8;
             if (rect.getHeight() > rect.getWidth()) {
                 arc = (int)rect.getHeight()/8;
             }
             //fill
             g.setColor(Color.WHITE);
             g.fillRoundRect((int) rect.getX(), (int) rect.getY(),
                     (int) rect.getWidth(), (int) rect.getHeight(), arc, arc);
             //border
             g.setColor(Color.GRAY);

             //User hint is drawn on mouseover, if it fits within the group bounds
             if(mouseover && !anchors) {
                 //Draw a hint to tell the user that click selects group
                 String hint = selected ? "Drag to move group" : "Click to select group";

                 Rectangle2D tb = g.getFontMetrics().getStringBounds(hint, g);

                 if(tb.getWidth() <= rect.getWidth()) {
                     int yoffset = (int)rect.getY();
                     int xoffset = (int)rect.getX() + (int)(rect.getWidth() / 2) - (int)(tb.getWidth() / 2);
                     yoffset += (int)(rect.getHeight() / 2) + (int)(tb.getHeight() / 2);
                     g.drawString(hint, xoffset, yoffset);
                 }
             }
         }
     };

}


text:
package org.cxio.aspects.datamodels;

import static org.junit.Assert.*;

import org.junit.Test;
import org.ndexbio.cxio.aspects.datamodels.ATTRIBUTE_DATA_TYPE;

public class ATTRIBUTE_DATA_TYPETest {

	@Test
	public void test() {
		ATTRIBUTE_DATA_TYPE t = ATTRIBUTE_DATA_TYPE.LIST_OF_LONG;
		String foo = t.name();
		String foo2 = t.toString();
		assertEquals(foo, "LIST_OF_LONG");
		assertEquals(foo2, "list_of_long");

	}

}


text:
<!DOCTYPE html>

  <meta charset="utf-8">

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

  <title>CRUDlex\SimpleFilesystemFileProcessor — CRUDlex 0.11.0 documentation</title>

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

    <link rel="top" title="CRUDlex 0.11.0 documentation" href="../index.html"/>
        <link rel="up" title="CRUDlex\FileProcessorInterface" href="FileProcessorInterface.html"/>
        <link rel="next" title="CRUDlex\ManyValidator" href="ManyValidator.html"/>
        <link rel="prev" title="CRUDlex\FileProcessorInterface" href="FileProcessorInterface.html"/>

             CRUDlex

                0.11.0

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

Manual

Introduction

Setup

Data Structure Definition

Data Types

Constraints

Overriding Layouts

Overriding Templates

Events

Definition Validation

Extended Features

Addons

CRUD YAML Reference

API

CRUDlex\AbstractData

CRUDlex\ControllerProvider

CRUDlex\DataFactoryInterface

CRUDlex\Entity

CRUDlex\EntityDefinition

CRUDlex\EntityDefinitionFactoryInterface

CRUDlex\EntityDefinitionValidatorInterface

CRUDlex\EntityValidator

CRUDlex\FileProcessorInterface

CRUDlex\SimpleFilesystemFileProcessor

CRUDlex\ManyValidator

CRUDlex\MimeTypes

CRUDlex\ReferenceValidator

CRUDlex\ServiceProvider

CRUDlex\StreamedFileResponse

CRUDlex\TwigExtensions

CRUDlex\UniqueValidator

        CRUDlex

Docs »

CRUDlex\FileProcessorInterface »

CRUDlex\SimpleFilesystemFileProcessor

             View page source

CRUDlex\SimpleFilesystemFileProcessor¶

class SimpleFilesystemFileProcessor¶

An implementation of the {@see FileProcessorInterface} simply using the
file system.

property basePath¶

protected

Holds the base path where all files will be stored into subfolders.

getPath($entityName, Entity $entity, $field)¶

Constructs a file system path for the given parameters for storing the
file of the file field.

<col class="field-name" />
<col class="field-body" />

Parameters:

$entityName (string) – the entity name

$entity (Entity) – the entity

$field (string) – the file field in the entity

Returns:
string the constructed path for storing the file of the file field

__construct($basePath = '')¶

Constructor.

<col class="field-name" />
<col class="field-body" />

Parameters:

$basePath (string) – the base path where all files will be stored into subfolders

createFile(Request $request, Entity $entity, $entityName, $field)¶

{@inheritdoc}

<col class="field-name" />
<col class="field-body" />

Parameters:

$request (Request) –

$entity (Entity) –

$entityName –

$field –

updateFile(Request $request, Entity $entity, $entityName, $field)¶

{@inheritdoc}
For now, this implementation is defensive and doesn’t delete ever.

<col class="field-name" />
<col class="field-body" />

Parameters:

$request (Request) –

$entity (Entity) –

$entityName –

$field –

deleteFile(Entity $entity, $entityName, $field)¶

{@inheritdoc}
For now, this implementation is defensive and doesn’t delete ever.

<col class="field-name" />
<col class="field-body" />

Parameters:

$entity (Entity) –

$entityName –

$field –

renderFile(Entity $entity, $entityName, $field)¶

{@inheritdoc}

<col class="field-name" />
<col class="field-body" />

Parameters:

$entity (Entity) –

$entityName –

$field –

        Next

         Previous

        © Copyright 2017, Philip Lehmann-Böhm.

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


text:
typedef int (*halide_task)(void *user_context, int, uint8_t *);

extern "C" {

typedef long dispatch_once_t;
extern void dispatch_once_f(dispatch_once_t *, void *context, void (*initializer)(void *));

typedef struct dispatch_queue_s *dispatch_queue_t;
typedef long dispatch_queue_priority_t;

extern dispatch_queue_t dispatch_get_global_queue(
    dispatch_queue_priority_t priority, unsigned long flags);

extern void dispatch_apply_f(size_t iterations, dispatch_queue_t queue,
                             void *context, void (*work)(void *, size_t));
extern void dispatch_async_f(dispatch_queue_t queue, void *context, void (*work)(void *));

typedef struct dispatch_semaphore_s *dispatch_semaphore_t;
typedef uint64_t dispatch_time_t;
#define DISPATCH_TIME_FOREVER (~0ull)

extern dispatch_semaphore_t dispatch_semaphore_create(long value);
extern long dispatch_semaphore_wait(dispatch_semaphore_t dsema, dispatch_time_t timeout);
extern long dispatch_semaphore_signal(dispatch_semaphore_t dsema);
extern void dispatch_release(void *object);

WEAK int halide_do_task(void *user_context, halide_task f, int idx,
                        uint8_t *closure);

}

WEAK void halide_spawn_thread(void *user_context, void (*f)(void *), void *closure) {
    dispatch_async_f(dispatch_get_global_queue(0, 0), closure, f);
}

namespace Halide { namespace Runtime { namespace Internal {

struct gcd_mutex {
    dispatch_once_t once;
    dispatch_semaphore_t semaphore;
};

WEAK void init_mutex(void *mutex_arg) {
    gcd_mutex *mutex = (gcd_mutex *)mutex_arg;
    mutex->semaphore = dispatch_semaphore_create(1);
}

WEAK int default_do_task(void *user_context, int (*f)(void *, int, uint8_t *),
                         int idx, uint8_t *closure) {
    return f(user_context, idx, closure);
}

struct halide_gcd_job {
    int (*f)(void *, int, uint8_t *);
    void *user_context;
    uint8_t *closure;
    int min;
    int exit_status;
};

// Take a call from grand-central-dispatch's parallel for loop, and
// make a call to Halide's do task
WEAK void halide_do_gcd_task(void *job, size_t idx) {
    halide_gcd_job *j = (halide_gcd_job *)job;
    j->exit_status = halide_do_task(j->user_context, j->f, j->min + (int)idx,
                                    j->closure);
}

WEAK int default_do_par_for(void *user_context, halide_task f,
                            int min, int size, uint8_t *closure) {
    halide_gcd_job job;
    job.f = f;
    job.user_context = user_context;
    job.closure = closure;
    job.min = min;
    job.exit_status = 0;

    dispatch_apply_f(size, dispatch_get_global_queue(0, 0), &job, &halide_do_gcd_task);
    return job.exit_status;
}

WEAK int (*halide_custom_do_task)(void *user_context, halide_task, int, uint8_t *) = default_do_task;
WEAK int (*halide_custom_do_par_for)(void *, halide_task, int, int, uint8_t *) = default_do_par_for;

}}} // namespace Halide::Runtime::Internal

extern "C" {

WEAK void halide_mutex_cleanup(halide_mutex *mutex_arg) {
    gcd_mutex *mutex = (gcd_mutex *)mutex_arg;
    if (mutex->once != 0) {
        dispatch_release(mutex->semaphore);
        memset(mutex_arg, 0, sizeof(halide_mutex));
    }
}

WEAK void halide_mutex_lock(halide_mutex *mutex_arg) {
    gcd_mutex *mutex = (gcd_mutex *)mutex_arg;
    dispatch_once_f(&mutex->once, mutex, init_mutex);
    dispatch_semaphore_wait(mutex->semaphore, DISPATCH_TIME_FOREVER);
}

WEAK void halide_mutex_unlock(halide_mutex *mutex_arg) {
    gcd_mutex *mutex = (gcd_mutex *)mutex_arg;
    dispatch_semaphore_signal(mutex->semaphore);
}

WEAK void halide_shutdown_thread_pool() {
}

WEAK void halide_set_num_threads(int) {
}

WEAK int (*halide_set_custom_do_task(int (*f)(void *, halide_task, int, uint8_t *)))
          (void *, halide_task, int, uint8_t *) {
    int (*result)(void *, halide_task, int, uint8_t *) = halide_custom_do_task;
    halide_custom_do_task = f;
    return result;
}

WEAK int (*halide_set_custom_do_par_for(int (*f)(void *, halide_task, int, int, uint8_t *)))
          (void *, halide_task, int, int, uint8_t *) {
    int (*result)(void *, halide_task, int, int, uint8_t *) = halide_custom_do_par_for;
    halide_custom_do_par_for = f;
    return result;
}

WEAK int halide_do_task(void *user_context, halide_task f, int idx,
                        uint8_t *closure) {
    return (*halide_custom_do_task)(user_context, f, idx, closure);
}

WEAK int halide_do_par_for(void *user_context, int (*f)(void *, int, uint8_t *),
                           int min, int size, uint8_t *closure) {
    return (*halide_custom_do_par_for)(user_context, f, min, size, closure);
}

}


text:
<?php

namespace vakata\authentication\password;

use vakata\authentication\AuthenticationException;

class PasswordException extends AuthenticationException
{
}


text:
avocado.transporter.module.create('general_ui/table_layout', function(requires) {

requires('reflection/reflection');
requires('core/table');
requires('general_ui/basic_morph_mixins');
requires('general_ui/layout');

}, function(thisModule) {

thisModule.addSlots(avocado.table, function(add) {

  add.creator('layout', {}, {category: ['user interface']});

  add.method('newColumnMorph', function () {
    return avocado.ui.newMorph().useTableLayout(avocado.table.contents.columnPrototype);
  }, {category: ['user interface']});

  add.method('newRowMorph', function () {
    return avocado.ui.newMorph().useTableLayout(avocado.table.contents.rowPrototype);
  }, {category: ['user interface']});

  add.method('newTableMorph', function () {
    return this.newColumnMorph();
  }, {category: ['user interface']});

  add.method('createSpaceFillingRowMorph', function (content, padding) {
    var m = this.newRowMorph().beInvisible();
    var direction = avocado.directions.horizontal;
    if (padding !== undefined) { m.layout().setPadding(padding); }
    direction.setLayoutModeOf(m, avocado.LayoutModes.SpaceFill);

    if (typeof(content) === 'function') {
      m.setPotentialContentMorphsFunction(function() { return avocado.table.contents.create([content()], direction.sideways); });
      m.refreshContent();
    } else {
      // default to left-justifying the contents
      if (content.all(function(c) {return direction.layoutModeOf(c) !== avocado.LayoutModes.SpaceFill;})) {
        content = content.concat([avocado.ui.createSpacer()]);
      }
      m.replaceContentWith(avocado.table.contents.create([content], direction.sideways));
    }

    return m;
  }, {category: ['user interface']});

  add.creator('boxStyle', {}, {category: ['user interface']});

  add.method('createEitherOrMorph', function (morphs, functionReturningTheIndexOfTheOneToShow) {
    // aaa - callers that are TableMorphs already and just need two choices should just use the new enhanced morphToggler, don't need to wrap it in this RowMorph anymore
    var r = avocado.table.newRowMorph().beInvisible();
    r.typeName = 'either-or morph';
    var togglers = morphs.map(function(m) { return avocado.morphToggler.create(null, m); });
    r.layout().setPotentialCells(togglers);
    r.refreshContent = avocado.makeSuperWork(r, "refreshContent", function($super) {
      var i = functionReturningTheIndexOfTheOneToShow();
      var evt = Event.createFake();
      togglers.each(function(t, ti) {
        t.setValue(i === ti, evt);
      });
      return $super();
    });
    return r;
  }, {category: ['shortcuts']});

  add.method('createOptionalMorph', function (m, condition, layoutModes) {
    var om = this.createEitherOrMorph([m, avocado.table.newRowMorph().beInvisible()], function() { return condition() ? 0 : 1; });
    om.typeName = 'optional morph';
    om.horizontalLayoutMode = (layoutModes || m).horizontalLayoutMode;
    om.verticalLayoutMode   = (layoutModes || m).verticalLayoutMode;
    return om;
  }, {category: ['shortcuts']});

  add.method('wrapToTakeUpConstantWidth', function (width, morph) {
    return this.wrapToTakeUpConstantSpace(pt(width, null), morph);
  }, {category: ['shortcuts']});

  add.method('wrapToTakeUpConstantHeight', function (height, morph) {
    return this.wrapToTakeUpConstantSpace(pt(null, height), morph);
  }, {category: ['shortcuts']});

  add.method('wrapToTakeUpConstantSpace', function (space, morph) {
    var wrapper = avocado.table.newRowMorph().beInvisible();
    wrapper.layout().setDesiredSpace(space);
    wrapper.layout().setCells([morph]);
    return wrapper;
  }, {category: ['shortcuts']});

});

thisModule.addSlots(avocado.table.layout, function(add) {

  add.method('initialize', function (tableMorph) {
    this._tableMorph = tableMorph;
  }, {category: ['creating']});

  add.method('getExtent', function () {
    return this._tableMorph.getExtent();
  }, {category: ['accessing the table morph']});

  add.method('getScale', function () {
    return this._tableMorph.getScale();
  }, {category: ['accessing the table morph']});

  add.method('setScale', function (s) {
    this._tableMorph.setScale(s);
  }, {category: ['accessing the table morph']});

  add.method('tableContent', function () {
    return this._tableContent;
  }, {category: ['accessing']});

  add.method('setTableContent', function (c) {
    this._tableContent = c;
    // aaa - several hacks piled on top of each other
    if (!avocado.shouldBreakCreatorSlotsInOrderToImprovePerformance && c !== avocado.table.contents.rowPrototype && c !== avocado.table.contents.columnPrototype && !reflect(c).explicitlySpecifiedCreatorSlot()) {
      reflect(this).slotAt('_tableContent').beCreator();
    }
    return this;
  }, {category: ['accessing']});

  add.method('shouldPrintDebugInfo', function () {
    return this._tableMorph._debugMyLayout;
  }, {category: ['accessing the table morph']});

  add.method('layoutModes', function () {
    // aaa make the TableMorph itself store them as a Point?
    return pt(this._tableMorph.horizontalLayoutMode, this._tableMorph.verticalLayoutMode);
  }, {category: ['accessing the table morph']});

  add.method('replaceContentWith', function (newContent) {
    if (this.tableContent() && this.tableContent().equals(newContent)) { return; }
    this.setTableContent(newContent);
    this.setSubmorphsFromTableContent();
  }, {category: ['adding and removing']});

  add.method('replaceMorph', function (m, newSubmorph) {
		// Gotta make sure to leave the replaced morph at the right scale, so that if we then add it back to the world it'll look right. -- Adam
		var mScale = m.overallScale(this._tableMorph.world());

    this.tableContent().replaceElement(m, newSubmorph);
    this.setSubmorphsFromTableContent();

		m.setScale(mScale);
  }, {category: ['adding and removing']});

  add.method('setCells', function (ms) {
    this.replaceContentWith(this.tableContent().copyWithSoleLine(ms));
  }, {category: ['adding and removing']});

  add.method('setPotentialCells', function (ms) {
    this._tableMorph.setPotentialContentMorphs(this.tableContent().copyWithSoleLine(ms));
  }, {category: ['adding and removing']});

  add.method('addCell', function (m) {
    this.replaceContentWith(this.tableContent().copyAndAddElement(m));
  }, {category: ['adding and removing']});

  add.method('removeCell', function (m) {
    this.replaceContentWith(this.tableContent().copyAndRemoveElement(m));
  }, {category: ['adding and removing']});

  add.method('setSubmorphsFromTableContent', function () {
    if (this._submorphReplacementBatcherUpper && this._submorphReplacementBatcherUpper.isRunning()) {
      this._submorphReplacementBatcherUpper.batchUp();
      return;
    }

    // console.log("Running setSubmorphsFromTableContent on " + (this._tableMorph.toString() || avocado.identityHashFor(this._tableMorph)));
    this._tableMorph.replaceMorphs(this._tableMorph.submorphsParticipatingInLayout(), this.tableContent().elements());
  }, {category: ['adding and removing']});

  add.method('submorphReplacementBatcherUpper', function () {
    if (! this._submorphReplacementBatcherUpper) {
      this._submorphReplacementBatcherUpper = avocado.batcherUpper.create(this, function() {
        this._context.setSubmorphsFromTableContent();
      });
    }
    return this._submorphReplacementBatcherUpper;
  }, {category: ['layout']});

  add.method('getPadding', function () {
    return this._padding;
  }, {category: ['padding']});

  add.method('setPadding', function (p) {
    if (typeof p === 'number') {
      this._padding = {left: p, right: p, top: p, bottom: p, between: {x: p, y: p}};
    } else {
      this._padding = p;
    }
    return this;
  }, {category: ['padding']});

  add.data('_padding', {left: 10, right: 10, top: 10, bottom: 10, between: {x: 10, y: 10}}, {category: ['padding'], initializeTo: '{left: 10, right: 10, top: 10, bottom: 10, between: {x: 10, y: 10}}'});

  add.method('applyStyle', function (spec) {
	  if (typeof(spec.padding) !== 'undefined') { this.setPadding(spec.padding); }
  }, {category: ['styles']});

  add.method('adjustStyleSpec', function (spec) {
    if (typeof(this._padding) !== 'undefined') { spec.padding = this._padding; }
  }, {category: ['styles']});

  add.method('eachDirection', function (f) {
    f(avocado.directions.horizontal);
    f(avocado.directions.vertical);
  }, {category: ['directions']});

  add.method('isAffectedBy', function (operation, morph) {
    return ! morph.shouldNotBePartOfRowOrColumn;
  }, {category: ['layout']});

  add.method('possiblyDoSomethingBecauseASubmorphMinimumExtentHasChanged', function (tableMorph) {
    return tableMorph.minimumExtentMayHaveChanged();
  }, {category: ['layout']});

  add.method('minimumExtent', function () {
    return this.adjustForRigidityAndScale(this.internalMinimumExtent());
  }, {category: ['layout', 'minimum extent']});

  add.method('adjustForRigidityAndScale', function (e) {
    var e2 = this.adjustForRigidity(e);
    return e2.scaleBy(this.currentOrDesiredScaleGivenExtent(e2));
  }, {category: ['layout']});

  add.method('adjustForRigidity', function (e) {
    // Code uglified just a bit to avoid creating unnecessary Point objects; it's turning out to be significant. -- Adam
    var rigidX = this._tableMorph.horizontalLayoutMode === avocado.LayoutModes.Rigid;
    var rigidY = this._tableMorph.  verticalLayoutMode === avocado.LayoutModes.Rigid;
    if (rigidX || rigidY) {
      var currentExtent = this.getExtent();
      return pt(rigidX ? Math.max(e.x, currentExtent.x) : e.x,
                rigidY ? Math.max(e.y, currentExtent.y) : e.y);
    } else {
      return e;
    }
  }, {category: ['layout']});

  add.method('setDesiredSpace', function (space) {
    this._desiredSpaceToScaleTo = space;
    return this;
  }, {category: ['layout']});

  add.method('doNotCenter', function () {
    this._shouldNotCenterSideways = true;
    return this;
  }, {category: ['layout']});

  add.method('currentOrDesiredScaleGivenExtent', function (e) {
    var desiredSpace = this._desiredSpaceToScaleTo;
    if (desiredSpace) {
      var hs = null;
      var vs = null;
      if (desiredSpace.x && e.x) { hs = desiredSpace.x / e.x; }
      if (desiredSpace.y && e.y) { vs = desiredSpace.y / e.y; }
      if (hs !== null && vs !== null) { return Math.min(hs, vs); }
      if (hs === null && vs !== null) { return vs; }
      if (hs !== null && vs === null) { return hs; }
    }
    return this.getScale();
  }, {category: ['layout']});

  add.method('internalMinimumExtent', function () {
    if (! this._tableMorph._cachedMinimumExtent) {
      var layoutInfoForRowsAndColumns = this.calculateMinimumExtentsForRowsAndColumns();
      this._tableMorph._cachedMinimumExtent = this.calculateOverallMinimumExtent(layoutInfoForRowsAndColumns);
    }
    return this._tableMorph._cachedMinimumExtent;
  }, {category: ['layout', 'minimum extent']});

  add.method('calculateMinimumExtentsForRowsAndColumns', function () {
    var layoutInfo = pt([], []);
    this.eachDirection(function(dir) {
      var rs = dir.coord(layoutInfo);
      rs.spaceFillingCount = 0;
      this.tableContent().eachLineInDirection(dir, function(line) {
        var r = this.calculateMinimumExtentFor(line, dir);
        rs.push(r);
        if (r.canFillSpace) { rs.spaceFillingCount += 1; }
      }.bind(this));
    }.bind(this));
    return layoutInfo;
  }, {category: ['layout']});

  add.method('calculateMinimumExtentFor', function (morphs, direction) {
    var r = { biggestSideways: 0, canFillSpace: false };

    if (this.shouldPrintDebugInfo()) { console.log("calculateMinimumExtentFor " + morphs.size() + " morphs in direction " + direction); }
    morphs.each(function(m) {
      if (m) {
        var mMinExt = m.minimumExtent();
        var mMinSideways = direction.sideways.coord(mMinExt);
        if (this.shouldPrintDebugInfo()) { console.log("minimumExtent() for " + m.inspect() + " in direction " + direction.sideways + " is " + mMinSideways); }
        r.biggestSideways = Math.max(r.biggestSideways, mMinSideways);

        // How should we do this? Should the row be space-filling if *any* morph in it
        // is space-filling, or if *all* of them are, or what? Try any for now. -- Adam
        if (direction.sideways.layoutModeOf(m) === avocado.LayoutModes.SpaceFill) { r.canFillSpace = true; }
      }
    }.bind(this));

    return r;
  }, {category: ['layout', 'minimum extent']});

  add.method('calculateOverallMinimumExtent', function (layoutInfoForRowsAndColumns) {
    var overallMinExt = pt(0, 0);

    this.eachDirection(function(dir) {
      var infoForThisDirection = dir.coord(layoutInfoForRowsAndColumns);

      var totalLineSizes = infoForThisDirection.inject(0, function(sum, r) {
        return sum + r.biggestSideways;
      });

      var padding = this.getPadding();
      var totalPadding = dir.sideways.padding1(padding) +
                         dir.sideways.padding2(padding) +
                         (dir.sideways.coord(padding.between) * (infoForThisDirection.length - 1));

      if (this.shouldPrintDebugInfo()) { console.log("In calculateOverallMinimumExtent, direction " + dir + ", totalLineSizes is " + totalLineSizes + " and totalPadding is " + totalPadding + " for a total of " + (totalLineSizes + totalPadding)); }
      dir.sideways.setCoord(overallMinExt, totalLineSizes + totalPadding);
    }.bind(this));

    // keep it around, we'll need it when rejiggering the layout
    overallMinExt.layoutInfoForRowsAndColumns = layoutInfoForRowsAndColumns;
    if (this.shouldPrintDebugInfo()) { console.log("overallMinExt: " + overallMinExt); }

    return overallMinExt;
  }, {category: ['layout', 'minimum extent']});

  add.method('calculateSpaceToUseOutOf', function (availableSpace, thisExtent) {
    var availableSpaceToUse = pt(null, null);

    var layoutModes = this.layoutModes()
    if (layoutModes.x === avocado.LayoutModes.ShrinkWrap) { availableSpaceToUse.x =          this.internalMinimumExtent().x;                }
    if (layoutModes.x === avocado.LayoutModes.Rigid     ) { availableSpaceToUse.x = Math.max(this.internalMinimumExtent().x, thisExtent.x); }
    if (layoutModes.y === avocado.LayoutModes.ShrinkWrap) { availableSpaceToUse.y =          this.internalMinimumExtent().y;                }
    if (layoutModes.y === avocado.LayoutModes.Rigid     ) { availableSpaceToUse.y = Math.max(this.internalMinimumExtent().y, thisExtent.y); }

    var scale = this.currentOrDesiredScaleGivenExtent(availableSpaceToUse);
    if (scale !== this.getScale()) { this.setScale(scale); }

    if (availableSpaceToUse.x === null) { availableSpaceToUse.x = availableSpace.x / scale; }
    if (availableSpaceToUse.y === null) { availableSpaceToUse.y = availableSpace.y / scale; }

    if (this.shouldPrintDebugInfo()) { console.log(this._tableMorph.inspect() + ": availableSpace: " + availableSpace + ", availableSpaceToUse: " + availableSpaceToUse + ", this.getScale(): " + this.getScale() + ", this.internalMinimumExtent(): " + this.internalMinimumExtent() + ", thisExtent: " + thisExtent); }
    return availableSpaceToUse;
  }, {category: ['layout']});

  add.method('rejigger', function (tableMorph, availableSpace) {
    if (this.shouldPrintDebugInfo()) { console.log("About to rejigger the layout, availableSpace is " + availableSpace); }
    var thisExtent = this.getExtent();
    var availableSpaceToUse = this.calculateSpaceToUseOutOf(availableSpace, thisExtent);
    if (this.shouldPrintDebugInfo()) { console.log("availableSpaceToUse is " + availableSpaceToUse); }
    if (this.isAlreadyLaidOutInSpace(availableSpaceToUse)) {
      availableSpaceToUse = thisExtent;
    } else {
      this._tableMorph._spaceUsedLastTime = availableSpaceToUse;

      var extraSpaceUsage = this.decideWhatToDoWithExtraSpace(availableSpaceToUse);
      var actualCoordsAndSizes = this.calculateActualCoordinatesAndSizes(extraSpaceUsage);

      // aaa - Just reversed these two lines, because in 3D-land setMorphPositionsAndSizes needs to have the extent set already. Will that cause grief?
      this._tableMorph.setExtentIfChanged(availableSpaceToUse);
      this.setMorphPositionsAndSizes(actualCoordsAndSizes);

      this._tableMorph._layoutIsStillValid = true;
    }
    return availableSpaceToUse.scaleBy(this.getScale());
  }, {category: ['layout']});

  add.method('isAlreadyLaidOutInSpace', function (s) {
    if (this._tableMorph._layoutIsStillValid && this._tableMorph._spaceUsedLastTime && this._tableMorph._spaceUsedLastTime.eqPt(s)) {
      if (this.shouldPrintDebugInfo()) {
        console.log("No need to lay out " + this._tableMorph.inspect() + ", since it's already laid out in the appropriate amount of space: " + s);
      }
      return true;
    } else {
      if (this.shouldPrintDebugInfo()) {
        console.log("Gonna have to lay out " + this._tableMorph.inspect() + ", since _spaceUsedLastTime is " + this._tableMorph._spaceUsedLastTime + " but s is " + s);
      }
      return false;
    }
  }, {category: ['layout']});

  add.method('decideWhatToDoWithExtraSpace', function (availableSpaceToUse) {
    var r = { padding: this.getPadding(), extraSpacePerSpaceFillingChild: pt(0,0) };
    var extraSpace = availableSpaceToUse.subPt(this._tableMorph._cachedMinimumExtent);
    this.eachDirection(function(dir) {
      var info = dir.coord(this._tableMorph._cachedMinimumExtent.layoutInfoForRowsAndColumns);
      var extra = dir.sideways.coord(extraSpace);
      if (info.spaceFillingCount === 0) {
        // Nobody wants it; just put in extra padding.
        var numberOfBetweenPads = info.size() - 1;
        if (numberOfBetweenPads > 0) {
          if (r.padding === this.getPadding()) { r.padding = Object.clone(r.padding); r.padding.between = Object.clone(r.padding.between); }
          dir.sideways.setCoord(r.padding.between, dir.sideways.coord(r.padding.between) + (extra / numberOfBetweenPads));
        }
      } else {
        // Divvy it up among those who want it.
        dir.sideways.setCoord(r.extraSpacePerSpaceFillingChild, extra / info.spaceFillingCount);
      }
    }.bind(this));
    return r;
  }, {category: ['layout']});

  add.method('calculateActualCoordinatesAndSizes', function (extraSpaceUsage) {
    var actualCoordsAndSizes = pt([], []);
    this.eachDirection(function(dir) {
      var info = dir.coord(this._tableMorph._cachedMinimumExtent.layoutInfoForRowsAndColumns);
      var paddingBeforeNextLine = dir.sideways.padding1(extraSpaceUsage.padding);
      var actuals = dir.coord(actualCoordsAndSizes);
      var f = 0;
      info.each(function(x) {
        f += paddingBeforeNextLine;
        var availableSidewaysSpaceToPassOnToThisLine = x.biggestSideways;
        if (x.canFillSpace) {
          availableSidewaysSpaceToPassOnToThisLine += dir.sideways.coord(extraSpaceUsage.extraSpacePerSpaceFillingChild);
        }
        actuals.push({ coordinate: f, space: availableSidewaysSpaceToPassOnToThisLine });
        f += availableSidewaysSpaceToPassOnToThisLine;
        paddingBeforeNextLine = dir.sideways.coord(extraSpaceUsage.padding.between);
      }.bind(this));
    }.bind(this));
    return actualCoordsAndSizes;
  }, {category: ['layout']});

  add.method('setMorphPositionsAndSizes', function (actualCoordsAndSizes) {
    this._actualCoordsAndSizes = actualCoordsAndSizes;
    var direction = this.tableContent()._direction2;
    var origin = this._tableMorph.getOriginAAAHack(); // necessary because in 3D-land the origin is in the centre, but I don't understand why it's not working in LK-land
    this.tableContent().primaryLines().each(function(line, i) {
      line.each(function(m, j) {
        var actualsForThisMorph = direction.point(direction.sideways.coord(actualCoordsAndSizes)[j], direction.coord(actualCoordsAndSizes)[i]);
        var availableSpaceToPassOnToThisChild = pt(actualsForThisMorph.x.space, actualsForThisMorph.y.space);

        if (this._overrideSubmorphLayoutModes) {
          if (!m._previousLayoutModes) { m._previousLayoutModes = m.layoutModes(); }
          m.setLayoutModes(this._overrideSubmorphLayoutModes);
        }

        var mScaledExtent = m.rejiggerTheLayout(availableSpaceToPassOnToThisChild);
        if (this.shouldPrintDebugInfo()) { console.log("mScaledExtent is " + mScaledExtent); }

        // Uglified slightly to avoid creating the Point object; it's actually getting significant. -- Adam
        var f = direction         .coord(actualsForThisMorph).coordinate;
        var s = direction.sideways.coord(actualsForThisMorph).coordinate;

        if (!this._shouldNotCenterSideways) {
          var unusedSidewaysSpace = direction.sideways.coord(availableSpaceToPassOnToThisChild) - direction.sideways.coord(mScaledExtent);
          s = s + (unusedSidewaysSpace / 2);
        }

        var x, y;
        if (direction === avocado.directions.horizontal) {
          x = f; y = s;
        } else {
          x = s; y = f;
        }
        m.setTopLeftPosition(origin.moveDownAndRightBy(x, y));
        if (this.shouldPrintDebugInfo()) { console.log("Added " + m.inspect() + " at " + x + ", " + y); }
      }.bind(this));
    }.bind(this));
  }, {category: ['layout']});

  add.method('positionOfPrimaryLine', function (i) {
    var direction = this.tableContent()._direction2;
    var actualsForThisMorph = direction.point(direction.sideways.coord(this._actualCoordsAndSizes)[0], direction.coord(this._actualCoordsAndSizes)[i]);
    var p = pt(actualsForThisMorph.x.coordinate, actualsForThisMorph.y.coordinate);
    return p;
  }, {category: ['layout']});

});

thisModule.addSlots(avocado.table.boxStyle, function(add) {

  add.data('padding', {top: 2, bottom: 2, left: 4, right: 4, between: {x: 3, y: 3}}, {initializeTo: '{top: 2, bottom: 2, left: 4, right: 4, between: {x: 3, y: 3}}'});

  add.data('borderRadius', 10);

  add.data('openForDragAndDrop', false);

});

thisModule.addSlots(avocado.directions.vertical, function(add) {

  add.method('externallySpecifiedFreeSpaceSideways', function (m) {return m.externallySpecifiedFreeWidth;});

  add.method('specifyFreeSpaceSideways', function (m, s) {m.externallySpecifiedFreeWidth = s;});

  add.method('dimensionOfRect', function (r) {return r.height;});

  add.method('padding1', function (padding) {return padding.top;});

  add.method('padding2', function (padding) {return padding.bottom;});

  add.method('layoutModeOf', function (m) {return m.verticalLayoutMode;});

  add.method('setLayoutModeOf', function (m, mode) {m.verticalLayoutMode = mode;});

});

thisModule.addSlots(avocado.directions.horizontal, function(add) {

  add.method('externallySpecifiedFreeSpaceSideways', function (m) {return m.externallySpecifiedFreeHeight;});

  add.method('specifyFreeSpaceSideways', function (m, s) {m.externallySpecifiedFreeHeight = s;});

  add.method('dimensionOfRect', function (r) {return r.width;});

  add.method('padding1', function (padding) {return padding.left;});

  add.method('padding2', function (padding) {return padding.right;});

  add.method('layoutModeOf', function (m) {return m.horizontalLayoutMode;});

  add.method('setLayoutModeOf', function (m, mode) {m.horizontalLayoutMode = mode;});

});

thisModule.addSlots(avocado.table.contents, function(add) {

  add.data('rowPrototype', avocado.table.contents.create([], avocado.directions.vertical), {initializeTo: 'avocado.table.contents.create([], avocado.directions.vertical)'});

  add.data('columnPrototype', avocado.table.contents.create([], avocado.directions.horizontal), {initializeTo: 'avocado.table.contents.create([], avocado.directions.horizontal)'});

  add.method('newMorph', function () {
    var world = avocado.ui.currentWorld();
    var morphsTable = this.map(function(model) { return world.morphFor(model); });
    var m = avocado.table.newTableMorph();
    if (this._desiredSpaceToScaleTo) { m.layout().setDesiredSpace(this._desiredSpaceToScaleTo); } // aaa hack, the model shouldn't know about this UI stuff
    m.replaceContentWith(morphsTable);
    m.applyStyle(avocado.table.boxStyle);
    return m;
  }, {category: ['user interface']});

});

thisModule.addSlots(avocado.morphMixins.Morph, function(add) {

  add.method('useTableLayout', function (tableContent) {
    this.horizontalLayoutMode = avocado.LayoutModes.ShrinkWrap;
    this.  verticalLayoutMode = avocado.LayoutModes.ShrinkWrap;
    this.suppressHandles = true; // aaa - handles don't work right with tables yet
    this.setLayout(Object.newChildOf(avocado.table.layout, this).setTableContent(tableContent));
    return this;
  }, {category: ['layout']});

});

});


text:
package io.github.michaelfedora.fedorasmarket.database;

/**
 * Created by Michael on 2/27/2016.
 */
public interface FmSerializable<D extends FmSerializedData> {

    D serialize();
}


text:
var assert = require('chai').assert;

module.exports = {
	'Wait for front page to render': function(client) {
		var frontPage = client.page.front();

		frontPage.navigate()
			.waitForElementVisible('body', 1000)
			.assert.title('Aftenposten', 'title is Aftenposten')
			.getElementSize('@topBanner', function(result) {
				assert.isAbove(result.value.height, 239, 'minimum topBanner height');
			});

		client.elements('css selector', 'article', function(result) {
			assert.isAbove(result.value.length, 50, 'minimum expected num of articles');
		});

		client.end();
	}
}


text:
#ifndef DATE_TIME_DATE_FORMATTING_LOCALES_HPP___
#define DATE_TIME_DATE_FORMATTING_LOCALES_HPP___

#include "boost/date_time/locale_config.hpp" // set BOOST_DATE_TIME_NO_LOCALE

#ifndef BOOST_DATE_TIME_NO_LOCALE

#include "boost/date_time/iso_format.hpp"
#include "boost/date_time/date_names_put.hpp"
#include "boost/date_time/parse_format_base.hpp"
//#include <string>
#include <sstream>
#include <iomanip>

namespace boost {
namespace date_time {

  //! Formats a month as as string into an ostream
  template<class facet_type,
           class charT = char>
  class ostream_month_formatter
  {
  public:
    typedef typename facet_type::month_type month_type;
    typedef std::basic_ostream<charT> ostream_type;

    //! Formats a month as as string into an output iterator
    static void format_month(const month_type& month,
                             ostream_type& os,
                             const facet_type& f)
    {

      switch (f.month_format())
      {
        case month_as_short_string:
        {
          std::ostreambuf_iterator<charT> oitr(os);
          f.put_month_short(oitr, month.as_enum());
          break;
        }
        case month_as_long_string:
        {
          std::ostreambuf_iterator<charT> oitr(os);
          f.put_month_long(oitr, month.as_enum());
          break;
        }
        case month_as_integer:
        {
          charT fill_char = '0';
          os << std::setw(2) << std::setfill(fill_char) << month.as_number();
          break;
        }

      }
    } // format_month

  };

  //! Formats a weekday
  template<class weekday_type,
           class facet_type,
           class charT = char>
  class ostream_weekday_formatter
  {
  public:
    typedef typename facet_type::month_type month_type;
    typedef std::basic_ostream<charT> ostream_type;

    //! Formats a month as as string into an output iterator
    static void format_weekday(const weekday_type& wd,
                               ostream_type& os,
                               const facet_type& f,
                               bool  as_long_string)
    {

      std::ostreambuf_iterator<charT> oitr(os);
      if (as_long_string) {
        f.put_weekday_long(oitr, wd.as_enum());
      }
      else {
        f.put_weekday_short(oitr, wd.as_enum());
      }

    } // format_weekday

  };

  //! Convert ymd to a standard string formatting policies
  template<class ymd_type,
           class facet_type,
           class charT = char>
  class ostream_ymd_formatter
  {
  public:
    typedef typename ymd_type::month_type month_type;
    typedef ostream_month_formatter<facet_type, charT> month_formatter_type;
    typedef std::basic_ostream<charT> ostream_type;
    typedef std::basic_string<charT> foo_type;

    //! Convert ymd to a standard string formatting policies
    /*! This is standard code for handling date formatting with
     *  year-month-day based date information.  This function
     *  uses the format_type to control whether the string will
     *  contain separator characters, and if so what the character
     *  will be.  In addtion, it can format the month as either
     *  an integer or a string as controled by the formatting
     *  policy
     */
    //     static string_type ymd_to_string(ymd_type ymd)
//     {
//       std::ostringstream ss;
//       facet_type dnp;
//       ymd_put(ymd, ss, dnp);
//       return ss.str();
//       }

    // Put ymd to ostream -- part of ostream refactor
    static void ymd_put(ymd_type ymd,
                        ostream_type& os,
                        const facet_type& f)
    {
      std::ostreambuf_iterator<charT> oitr(os);
      charT fill_char = '0';
      switch (f.date_order()) {
        case ymd_order_iso: {
          os << ymd.year;
          if (f.has_date_sep_chars()) {
            f.month_sep_char(oitr);
          }
          month_formatter_type::format_month(ymd.month, os, f);
          if (f.has_date_sep_chars()) {
            f.day_sep_char(oitr);
          }
          os  << std::setw(2) << std::setfill(fill_char)
              << ymd.day;
          break;
        }
        case ymd_order_us: {
          month_formatter_type::format_month(ymd.month, os, f);
          if (f.has_date_sep_chars()) {
          f.day_sep_char(oitr);
          }
          os  << std::setw(2) << std::setfill(fill_char)
            << ymd.day;
          if (f.has_date_sep_chars()) {
            f.month_sep_char(oitr);
          }
          os << ymd.year;
          break;
        }
        case ymd_order_dmy: {
          os  << std::setw(2) << std::setfill(fill_char)
              << ymd.day;
          if (f.has_date_sep_chars()) {
            f.day_sep_char(oitr);
          }
          month_formatter_type::format_month(ymd.month, os, f);
          if (f.has_date_sep_chars()) {
            f.month_sep_char(oitr);
          }
          os << ymd.year;
          break;
        }
      }
    }
  };

  //! Convert a date to string using format policies
  template<class date_type,
           class facet_type,
           class charT = char>
  class ostream_date_formatter
  {
  public:
    typedef std::basic_ostream<charT> ostream_type;
    typedef typename date_type::ymd_type ymd_type;

    //! Put date into an ostream
    static void date_put(const date_type& d,
                         ostream_type& os,
                         const facet_type& f)
    {
      special_values sv = d.as_special();
      if (sv == not_special) {
        ymd_type ymd = d.year_month_day();
        ostream_ymd_formatter<ymd_type, facet_type, charT>::ymd_put(ymd, os, f);
      }
      else { // output a special value
        std::ostreambuf_iterator<charT> coi(os);
        f.put_special_value(coi, sv);
      }
    }

    //! Put date into an ostream
    static void date_put(const date_type& d,
                         ostream_type& os)
    {
      //retrieve the local from the ostream
      std::locale locale = os.getloc();
      if (std::has_facet<facet_type>(locale)) {
        const facet_type& f = std::use_facet<facet_type>(locale);
        date_put(d, os, f);
      }
      else {
        //default to something sensible if no facet installed
        facet_type default_facet;
        date_put(d, os, default_facet);
      }
    } // date_to_ostream
  }; //class date_formatter

} } //namespace date_time

#endif

#endif


text: SELECT a FROM t1 WHERE rowid <= 268435456 ORDER BY x


text:
function arrayRandom(array) {
  const randomizedIndex = Math.round(Math.random() * (array.length - 1));
  return array[randomizedIndex];
}

function generateFirstCheckInMessage(eventName, userName) {
  const praises = [
    `<eventName> is on! <userName> just appeared on scene!`,
    `Clear the decks, <userName> just hit <eventName>!`,
    `Wild <userName> appeared at <eventName>!`,
    `<userName> spotted, <eventName> confirmed!`,
    `Stop the press! <userName> just arrived to <eventName>!`,
  ];

  const praise = arrayRandom(praises);
  return praise.replace('<eventName>', eventName)
    .replace('<userName>', userName);
}

function generateEventCheckInMessage(eventName, checkIns) {
  const praises = [
    '<eventName> is buzzing! <checkIns> people have checked in!',
    `It's getting crowded in <eventName>. <checkIns> people already there!`,
    `<checkIns> people are attending <eventName>. Don't miss out!`,
  ];

  const praise = arrayRandom(praises);
  return praise.replace('<eventName>', eventName)
    .replace('<checkIns>', checkIns);
}

function generateFirstSimaMessage(name) {
  const praises = [
    '<name> is on it. First sima down!',
    '<name> just started wappu with first sima.',
    '<name> starts wappu! Congratulations on the first sima!'
  ];

  const praise = arrayRandom(praises);
  return praise.replace('<name>', name);
}

function generateTeamSimaMessage(team, simas) {
  // jscs:disable maximumLineLength
  const teamPraises = [
    '<team> might have some issues with breathalyzer tests, considering their <simas> simas.',
    '<team> must be really thirsty! They\'ve had <simas> simas.',
    'Keep <team> away from the bar. They\'re at <simas> simas already.',
    '<team> must have received a shipment from Estonia. They\'re chugging at <simas> simas already.',
    '<team> has gone full Sokka irti with <simas> simas.',
  ];
  // jscs:enable maximumLineLength

  const praise = arrayRandom(teamPraises);
  return praise.replace('<team>', team).replace('<simas>', simas);
}

function generateUserSimaMessage(name, simas) {
  const userPraises = [
    'Enjoy that <simas>th sima, <name>!',
    '<name> might have some issues with breathalyzer tests, considering her <simas> simas.',
    '<name> must be really thirsty! She\'s had <simas> simas.',
    'Keep <name> away from the bar. He\'s at <simas> simas already.',
    '<name> must have received a shipment from Estonia. She's chugging at <simas> simas already',
    '<name> has gone full Sokka irti with <simas> simas',
  ];

  const praise = arrayRandom(userPraises);
  return praise.replace('<name>', name).replace('<simas>', simas);
}

function generateTeamScoreMessage(team, points) {
  const teamPraises = [
    'Jeden tag so schnell! <team> is now at <points> points!',
    'Look at <team>! They just crossed <points> points!',
    'Those fine folks at <team> just can\'t stop. <points> points already!'
  ];

  const praise = arrayRandom(teamPraises);
  return praise.replace('<team>', team).replace('<points>', points);
}

function generateUserScoreMessage(name, points) {
  const userPraises = [
    'Jeden tag so schnell! <name> is now at <points> points!',
    'That <name> just keeps on scoring. <points> already!',
    'This fine person <name> just can\'t stop. <points> points already!'
  ];

  const praise = arrayRandom(userPraises);
  return praise.replace('<name>', name).replace('<points>', points);
}

export {
  generateFirstSimaMessage,
  generateTeamSimaMessage,
  generateUserSimaMessage,
  generateTeamScoreMessage,
  generateUserScoreMessage,
  generateFirstCheckInMessage,
  generateEventCheckInMessage
};


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>nd4j</artifactId>
        <groupId>org.nd4j</groupId>
        <version> 0.4-rc3.10-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>nd4j-serde</artifactId>
  <version> 0.4-rc3.10-SNAPSHOT</version>
    <packaging>pom</packaging>
    <modules>
        <module>nd4j-jackson</module>
    </modules>

</project>