text:
class TableView

  class ColumnRenderer

    attr_reader :params, :controller

    def initialize(params, controller)
      @params     = params
      @controller = controller
    end

    def header(column)
      label = column.human_name
      if column.not_sortable?
        field = label
      else
        field = link_to(label, url_hash_for(column))
      end
      helpers.content_tag(:th, "#{field} #{render_sort_order(column)}", column.options[:th])
    end

    def render_sort_order(column)
      if column.active?
        '%s' % (column.ascending? ? '↓' : '↑')
      end
    end

    def url_hash_for(column)
      {
        params.sort_by_field_name => column,
        params.sort_order_name    => column.reverse_sort_order
      }
    end

    def helpers
      ActionController::Base.helpers
    end

    def link_to(label, url_hash)
      controller.instance_variable_get(:@template).link_to(label, :overwrite_params => url_hash)
    end

  end

end


text:
package org.assertj.core.internal.maps;

import static org.assertj.core.api.Assertions.assertThatNullPointerException;
import static org.assertj.core.api.BDDAssertions.then;
import static org.assertj.core.data.MapEntry.entry;
import static org.assertj.core.error.ShouldBeEmpty.shouldBeEmpty;
import static org.assertj.core.error.ShouldContainAnyOf.shouldContainAnyOf;
import static org.assertj.core.internal.ErrorMessages.entriesToLookForIsNull;
import static org.assertj.core.internal.ErrorMessages.entryToLookForIsNull;
import static org.assertj.core.test.TestData.someInfo;
import static org.assertj.core.util.Arrays.array;
import static org.assertj.core.util.AssertionsUtil.expectAssertionError;
import static org.assertj.core.util.FailureMessages.actualIsNull;
import static org.mockito.Mockito.verify;

import java.util.HashMap;

import org.assertj.core.api.AssertionInfo;
import org.assertj.core.data.MapEntry;
import org.assertj.core.internal.MapsBaseTest;
import org.junit.jupiter.api.Test;

class Maps_assertContainsAnyOf_Test extends MapsBaseTest {

  @Test
  void should_pass_if_actual_contains_one_of_the_given_entries_but_not_the_others() {
    maps.assertContainsAnyOf(someInfo(), actual, array(entry("name", "Yoda"), entry("name", "Vador")));
  }

  @Test
  void should_pass_if_actual_contains_one_of_the_given_entries() {
    maps.assertContainsAnyOf(someInfo(), actual, array(entry("name", "Yoda")));
  }

  @Test
  void should_pass_if_actual_contains_all_given_entries() {
    maps.assertContainsAnyOf(someInfo(), actual, array(entry("name", "Yoda"), entry("color", "green")));
  }

  @SuppressWarnings("unchecked")
  @Test
  void should_pass_if_actual_and_given_entries_are_empty() {
    actual = new HashMap<>();
    maps.assertContainsAnyOf(someInfo(), actual, new MapEntry[0]);
  }

  @Test
  void should_fail_if_array_of_entries_to_look_for_is_empty_and_the_map_under_test_is_not() {
    // GIVEN
    AssertionInfo info = someInfo();
    MapEntry<String, String>[] expected = emptyEntries();
    // WHEN
    expectAssertionError(() -> maps.assertContainsAnyOf(info, actual, expected));
    // THEN
    verify(failures).failure(info, shouldBeEmpty(actual));
  }

  @Test
  void should_throw_error_if_array_of_entries_to_look_for_is_null() {
    // GIVEN
    MapEntry<String, String>[] entries = null;
    // WHEN/THEN
    assertThatNullPointerException().isThrownBy(() -> maps.assertContainsAnyOf(someInfo(), actual, entries))
                                    .withMessage(entriesToLookForIsNull());
  }

  @Test
  void should_throw_error_if_entry_is_null() {
    // GIVEN
    MapEntry<String, String> nullEntry = null;
    MapEntry<String, String>[] entries = array(nullEntry);
    // WHEN/THEN
    assertThatNullPointerException().isThrownBy(() -> maps.assertContainsAnyOf(someInfo(), actual, entries))
                                    .withMessage(entryToLookForIsNull());
  }

  @Test
  void should_fail_if_actual_is_null() {
    // GIVEN
    actual = null;
    MapEntry<String, String>[] expected = array(entry("name", "Yoda"));
    // WHEN
    AssertionError assertionError = expectAssertionError(() -> maps.assertContainsAnyOf(someInfo(), actual, expected));
    // THEN
    then(assertionError).hasMessage(actualIsNull());
  }

  @Test
  void should_fail_if_actual_does_not_contain_any_of_the_given_entries() {
    // GIVEN
    AssertionInfo info = someInfo();
    MapEntry<String, String>[] expected = array(entry("name", "Vador"), entry("job", "Jedi"));
    // WHEN
    expectAssertionError(() -> maps.assertContainsAnyOf(info, actual, expected));
    // THEN
    verify(failures).failure(info, shouldContainAnyOf(actual, expected));
  }
}

redpajama_set_name: RedPajamaGithub


text:
package com.hazelcast.simulator.tests.executor;

import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.HazelcastInstanceAware;
import com.hazelcast.core.IAtomicLong;
import com.hazelcast.core.IExecutorService;
import com.hazelcast.simulator.test.AbstractTest;
import com.hazelcast.simulator.test.BaseThreadState;
import com.hazelcast.simulator.test.annotations.AfterRun;
import com.hazelcast.simulator.test.annotations.Setup;
import com.hazelcast.simulator.test.annotations.Teardown;
import com.hazelcast.simulator.test.annotations.TimeStep;
import com.hazelcast.simulator.test.annotations.Verify;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

import static com.hazelcast.simulator.utils.TestUtils.getUserContextKeyFromTestId;
import static org.junit.Assert.assertEquals;

public class ExecutorTest extends AbstractTest {

    // properties
    public int executorCount = 1;
    // the number of outstanding submits, before doing get. A count of 1 means that you wait for every task to complete,
    // before sending in the next
    public int submitCount = 5;

    private IExecutorService[] executors;
    private IAtomicLong executedCounter;
    private IAtomicLong expectedExecutedCounter;

    @Setup
    public void setup() {
        executors = new IExecutorService[executorCount];
        for (int i = 0; i < executors.length; i++) {
            executors[i] = targetInstance.getExecutorService(name + '-' + i);
        }

        executedCounter = targetInstance.getAtomicLong(name + ":ExecutedCounter");
        expectedExecutedCounter = targetInstance.getAtomicLong(name + ":ExpectedExecutedCounter");
    }

    @TimeStep
    public void timeStep(ThreadState state) throws Exception {
        int index = state.randomInt(executors.length);
        IExecutorService executorService = executors[index];
        state.futureList.clear();

        for (int i = 0; i < submitCount; i++) {
            Future future = executorService.submit(new Task(testContext.getTestId()));
            state.futureList.add(future);
            state.iteration++;
        }

        for (Future future : state.futureList) {
            future.get();
        }
    }

    @AfterRun
    public void afterRun(ThreadState state) {
        expectedExecutedCounter.addAndGet(state.iteration);
    }

    public class ThreadState extends BaseThreadState {
        private List<Future> futureList = new LinkedList<Future>();
        private int iteration;
    }

    private static final class Task implements Runnable, Serializable, HazelcastInstanceAware {

        private static final long serialVersionUID = 8301151618785236415L;

        private transient HazelcastInstance hz;
        private final String testId;

        private Task(String testId) {
            this.testId = testId;
        }

        @Override
        public void run() {
            ExecutorTest test = (ExecutorTest) hz.getUserContext().get(getUserContextKeyFromTestId(testId));
            test.executedCounter.incrementAndGet();
        }

        @Override
        public void setHazelcastInstance(HazelcastInstance hz) {
            this.hz = hz;
        }
    }

    @Verify
    public void verify() {
        long actual = executedCounter.get();
        long expected = expectedExecutedCounter.get();
        assertEquals(expected, actual);
    }

    @Teardown(global = true)
    public void teardown() throws Exception {
        executedCounter.destroy();
        expectedExecutedCounter.destroy();
        for (IExecutorService executor : executors) {
            executor.shutdownNow();
            if (!executor.awaitTermination(120, TimeUnit.SECONDS)) {
                logger.severe("Time out while waiting for shutdown of executor: " + executor.getName());
            }
            executor.destroy();
        }
    }
}


text:
com-networknt-light-c-forum

Steps for integrating into light framework:

1. ...
2. ...

TODO (Init: Mar 16, 2015)


text:
CC = g++

CFLAGS =

.PHONY : all clean init

all : chrono time_budget_loop timer time_string_conversion

chrono : chrono.cc
	$(CC) -o $@ $(CFLAGS) $<

time_budget_loop : time_budget_loop.cc
	$(CC) -o $@ $(CFLAGS) $<

timer : timer.cc
	$(CC) -o $@ $(CFLAGS) $<

time_string_conversion : time_string_conversion.cc
	$(CC) -o $@ $(CFLAGS) $< -lboost_date_time

clean :
	rm chrono time_budget_loop timer time_string_conversion 2> /dev/null

init : clean


text:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item>
        <shape android:shape="rectangle" >
            <solid android:color="#70000000" />
        </shape>
    </item>
    <item android:top="28dp">
        <shape android:shape="line" >
            <stroke
                android:width="6dp"
                android:color="#CDE400" />

            <solid android:color="@android:color/transparent" />
        </shape>
    </item>

</layer-list>


text:
uglify:
  enabled: false
---

// This file will not be manipulated.
var Hello = "World!";


text:
require 'spec_helper'
require_relative '../../lib/cartodb/metrics'

describe CartoDB::Metrics do
  describe "Import metrics" do
    before(:all) do
      @metrics = CartoDB::Metrics.new
      Cartodb.config[:ducksboard] = {
        "import" => {
          "formats" => { "csv" => {"failed" => 1, "total" => 2 } },
          "totals" => { "failed" => 3, "success" => 4 }
        },
        "geocoding" => {
          "kinds" => { "high_resolution" => { "success" =>  5, "failed" => 6, "nokia_hits" => 7, "cache_hits" => 8 } },
          "totals" => { "success" => 9, "failed" => 10, "revenue" => 11, "cost" => 12, "timeline" => 13 }
        }
      }
    end
    it "should prefix all hash keys with import_ except username, distinct_id and account_Type for Mixpanel" do
      metrics = CartoDB::Metrics.new
      metrics.mixpanel_payload(:import, {username: "asdf", account_type: "Godzilla", error: 3, extension: 34, distinct_id: "aasdf"})
        .should == {username: "asdf", account_type: "Godzilla", import_error: 3, import_extension: 34, distinct_id: "aasdf"}

    end

    describe "imports" do
      it "should increase total and failed counters for a failed CSV file" do
        metrics = CartoDB::Metrics.new
        metrics.expects(:ducksboard_increment)
          .with(Cartodb.config[:ducksboard]['import']['totals']['failed'], 1).returns(true)
        metrics.expects(:ducksboard_increment)
          .with(Cartodb.config[:ducksboard]['import']['formats']['csv']['total'], 1).returns(true)
        metrics.expects(:ducksboard_increment)
          .with(Cartodb.config[:ducksboard]['import']['formats']['csv']['failed'], 1).returns(true)
        metrics.ducksboard_report_failed_import("csv")
      end

      it "should increase total and success counters for a successful CSV file" do
        metrics = CartoDB::Metrics.new
        metrics.expects(:ducksboard_increment)
          .with(Cartodb.config[:ducksboard]['import']['totals']['success'], 1).returns(true)
        metrics.expects(:ducksboard_increment)
          .with(Cartodb.config[:ducksboard]['import']['formats']['csv']['total'], 1).returns(true)
        metrics.ducksboard_report_successful_import("csv")
      end
    end

    describe "geocodings" do
      it "should increase counters for a high_resolution geocoding" do
        metrics = CartoDB::Metrics.new
        metrics.expects(:ducksboard_increment)
          .with(Cartodb.config[:ducksboard]['geocoding']['totals']['success'], 100).returns(true)
        metrics.expects(:ducksboard_increment)
          .with(Cartodb.config[:ducksboard]['geocoding']['totals']['failed'], 50).returns(true)
        metrics.expects(:ducksboard_increment)
          .with(Cartodb.config[:ducksboard]['geocoding']['kinds']['high_resolution']['success'], 100).returns(true)
        metrics.expects(:ducksboard_increment)
          .with(Cartodb.config[:ducksboard]['geocoding']['kinds']['high_resolution']['failed'], 50).returns(true)
        metrics.expects(:ducksboard_increment)
          .with(Cartodb.config[:ducksboard]['geocoding']['kinds']['high_resolution']['nokia_hits'], 100).returns(true)
        metrics.expects(:ducksboard_increment)
          .with(Cartodb.config[:ducksboard]['geocoding']['kinds']['high_resolution']['cache_hits'], 50).returns(true)
        metrics.expects(:ducksboard_increment)
          .with(Cartodb.config[:ducksboard]['geocoding']['totals']['cost'], 5).returns(true)
        metrics.expects(:ducksboard_increment)
          .with(Cartodb.config[:ducksboard]['geocoding']['totals']['revenue'], 10).returns(true)

        metrics.ducksboard_report_geocoding({
          kind: 'high-resolution',
          successful_rows: 100,
          failed_rows: 50,
          cache_hits: 50,
          processed_rows: 100,
          cost: 5,
          price: 10
        })
      end
    end
  end
end


text:
<?xml version="1.0"?>
<!--

  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

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

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

-->
<apiPackage id="mx.containers.dividedBoxClasses"><apiName>mx.containers.dividedBoxClasses</apiName><apiDetail/><apiClassifier id="mx.containers.dividedBoxClasses:BoxDivider"><apiName>BoxDivider</apiName><shortdesc>
  Класс BoxDivider представляет делитель между нижестоящими элементами контейнера DividedBox.</shortdesc><prolog><asMetadata><apiVersion><apiLanguage version="3.0"/><apiPlatform description="" name="Flash" version="9"/><apiPlatform description="" name="AIR" version="1.1"/><apiTool name="Flex" version="3"/></apiVersion><styles><style format="Length" inherit="no" name="dividerThickness" owner="mx.containers.dividedBoxClasses:BoxDivider" playerVersion="Flash9" type="Number">
<description conref="mx.containers.DividedBox#style:dividerThickness">
  </description>

<playerversion>AIR 1.1
  </playerversion>
	<prolog><asCustoms><langversion>3.0
  </langversion><productversion>Flex 3
 </productversion></asCustoms></prolog></style><style format="Color" inherit="yes" name="dividerColor" owner="mx.containers.dividedBoxClasses:BoxDivider" playerVersion="Flash9" type="uint">
<description conref="mx.containers.DividedBox#style:dividerColor">
  </description>

<playerversion>AIR 1.1
  </playerversion>
	<prolog><asCustoms><langversion>3.0
  </langversion><productversion>Flex 3
 </productversion></asCustoms></prolog></style><style inherit="no" name="dividerAlpha" owner="mx.containers.dividedBoxClasses:BoxDivider" playerVersion="Flash9" type="Number">
<description conref="mx.containers.DividedBox#style:dividerAlpha">
  </description>

<playerversion>AIR 1.1
  </playerversion>
	<prolog><asCustoms><langversion>3.0
  </langversion><productversion>Flex 3
 </productversion></asCustoms></prolog></style><style format="Length" inherit="no" name="dividerAffordance" owner="mx.containers.dividedBoxClasses:BoxDivider" playerVersion="Flash9" type="Number">
<description conref="mx.containers.DividedBox#style:dividerAffordance">
  </description>

<playerversion>AIR 1.1
  </playerversion>
	<prolog><asCustoms><langversion>3.0
  </langversion><productversion>Flex 3
 </productversion></asCustoms></prolog></style><style format="Length" inherit="no" name="verticalGap" owner="mx.containers.dividedBoxClasses:BoxDivider" playerVersion="Flash9" type="Number">
<description>
  Число пикселей между нижестоящими элементами по вертикали. Значение по умолчанию зависит от класса компонента; если оно не переопределено для класса, значением по умолчанию является 6.

  </description>

<playerversion>AIR 1.1
  </playerversion>
	<prolog><asCustoms><langversion>3.0
  </langversion><productversion>Flex 3
 </productversion></asCustoms></prolog></style><style format="Length" inherit="no" name="horizontalGap" owner="mx.containers.dividedBoxClasses:BoxDivider" playerVersion="Flash9" type="Number">
<description>
  Число пикселей между нижестоящими элементами по горизонтали. Значение по умолчанию зависит от класса компонента; если оно не переопределено для класса, значением по умолчанию является 8.

  </description>

<playerversion>AIR 1.1
  </playerversion>
	<prolog><asCustoms><langversion>3.0
  </langversion><productversion>Flex 3
 </productversion></asCustoms></prolog></style></styles></asMetadata></prolog><apiClassifierDetail><apiClassifierDef><apiAccess value="public"/><apiStatic/><apiBaseClassifier>mx.core:UIComponent</apiBaseClassifier></apiClassifierDef><apiDesc>
  Класс BoxDivider представляет делитель между нижестоящими элементами контейнера DividedBox.

  </apiDesc></apiClassifierDetail><related-links><link href="mx.containers.xml#DividedBox"><linktext>mx.containers.DividedBox</linktext></link></related-links><apiConstructor id="mx.containers.dividedBoxClasses:BoxDivider:BoxDivider"><apiName>BoxDivider</apiName><shortdesc>
      Конструктор.</shortdesc><prolog><asMetadata><apiVersion><apiLanguage version="3.0"/><apiPlatform description="" name="Flash" version="9"/><apiPlatform description="" name="AIR" version="1.1"/><apiTool name="Flex" version="3"/></apiVersion></asMetadata></prolog><apiConstructorDetail><apiConstructorDef><apiAccess value="public"/></apiConstructorDef><apiDesc>
      Конструктор.

      </apiDesc></apiConstructorDetail></apiConstructor></apiClassifier></apiPackage>


text:
using Affecto.IdentityManagement.Interfaces.Model;
using Affecto.Mapping;
using OrganizationRegister.UserManagement.Model;

namespace OrganizationRegister.UserManagement.Mapping
{
    internal class MapperFactory
    {
        public virtual IMapper<IRole, Role> CreateRoleMapper()
        {
            return new RoleMapper();
        }

        public virtual IMapper<IUser, UserListItem> CreateUserMapper()
        {
            return new UserListItemMapper(CreateRoleMapper());
        }

        public virtual IMapper<IUser, User> CreateInternalUserMapper()
        {
            return new UserMapper();
        }
    }
}


text:
AMP Demo
========

To compile this example you need rebar in your PATH.

Type the following command:
```
$ rebar get-deps compile
```

You can then start the Erlang node with the following command:
```
./start.sh
```

To send questions in the erlang shell:

Client = demo:connect(1234).

demo:sum(Client, 1, 2).
demo:divide(Client, 6, 3).


text:
var Crafty = require('../core/core.js');

/**@
 * #WebGL
 * @category Graphics
 * @kind Component
 *
 * @trigger Draw - when the entity is ready to be drawn to the stage - {type: "canvas", pos, co, ctx}
 * @trigger NoCanvas - if the browser does not support canvas
 *
 * When this component is added to an entity it will be drawn to the global webgl canvas element. Its canvas element (and hence any WebGL entity) is always rendered below any DOM entities.
 *
 * Sprite, Image, SpriteAnimation, and Color all support WebGL rendering.  Text entities will need to use DOM or Canvas for now.
 *
 * If a webgl context does not yet exist, a WebGL entity will automatically create one.
 *
 * @note For better performance, minimize the number of spritesheets used, and try to arrange it so that entities with different spritesheets are on different z-levels.  This is because entities are rendered in z order, and only entities sharing the same texture can be efficiently batched.
 *
 * Create a webgl entity like this
 * ~~~
 * var myEntity = Crafty.e("2D, WebGL, Color")
 *      .color(1, 1, 0, 0.5)
 *      .attr({x: 13, y: 37, w: 42, h: 42});
 *~~~
 */

Crafty.extend({
    /**@
     * #Crafty.WebGLShader
     * @category Graphics
     * @kind Method
     *
     * @sign public Crafty.WebGLShader Crafty.WebGLShader(String vertexShaderCode, String fragmentShaderCode, Array attributeList, Function drawCallback(e, entity))
     * @param vertexShaderCode - GLSL code for the vertex shader
     * @param fragmentShaderCode - GLSL code for the fragment shader
     * @param attributeList - List of variable names with their vertex length
     * @param drawCallback - Function that pushes all attribute values to WebGL.
     *
     * Assigns or fetches a default shader for a component.
     *
     * This allows the default shader for a component to be overridden, and therefor allows
     * developers to override the default shader behaviour with more complex shaders.
     *
     * @example
     * Let's say we want to extend sprite to draw the images in grayscale when we
     * set a `grayscale: true` attribute.
     * ~~~
     * var recoloredSprite = new Crafty.WebGLShader(
     *   // The vertex shader
     *   "attribute vec2 aPosition;\n" +
     *   "attribute vec3 aOrientation;\n" +
     *   "attribute vec2 aLayer;\n" +
     *   "attribute vec2 aTextureCoord;\n" +
     *   "attribute vec2 aGrayscale;\n" + // Addition of our grayscale
     *   "varying mediump vec3 vTextureCoord;\n" +
     *   "varying mediump vec2 vGrayscale;\n" + // passing attribute to fragment shader
     *   "uniform vec4 uViewport;\n" +
     *   "uniform mediump vec2 uTextureDimensions;\n" +
     *   "mat4 viewportScale = mat4(2.0 / uViewport.z, 0, 0, 0,    0, -2.0 / uViewport.w, 0,0,    0, 0,1,0,    -1,+1,0,1);\n" +
     *   "vec4 viewportTranslation = vec4(uViewport.xy, 0, 0);\n" +
     *   "void main() {\n" +
     *   "  vec2 pos = aPosition;\n" +
     *   "  vec2 entityOrigin = aOrientation.xy;\n" +
     *   "  mat2 entityRotationMatrix = mat2(cos(aOrientation.z), sin(aOrientation.z), -sin(aOrientation.z), cos(aOrientation.z));\n" +
     *   "  pos = entityRotationMatrix * (pos - entityOrigin) + entityOrigin ;\n" +
     *   "  gl_Position = viewportScale * (viewportTranslation + vec4(pos, 1.0/(1.0+exp(aLayer.x) ), 1) );\n" +
     *   "  vTextureCoord = vec3(aTextureCoord, aLayer.y);\n" +
     *   "  vGrayscale = aGrayscale;\n" + // Assigning the grayscale for fragment shader
     *   "}",
     *   // The fragment shader
     *   "precision mediump float;\n" +
     *   "varying mediump vec3 vTextureCoord;\n" +
     *   "varying mediump vec2 vGrayscale;\n" +
     *   "uniform sampler2D uSampler;\n " +
     *   "uniform mediump vec2 uTextureDimensions;\n" +
     *   "void main() {\n" +
     *   "  highp vec2 coord =   vTextureCoord.xy / uTextureDimensions;\n" +
     *   "  mediump vec4 base_color = texture2D(uSampler, coord);\n" +
     *   "  if (vGrayscale.x == 1.0) {\n" +
     *   "    mediump float lightness = (0.2126*base_color.r + 0.7152*base_color.g + 0.0722*base_color.b);\n" +
     *   "    lightness *= base_color.a * vTextureCoord.z; // Premultiply alpha\n" +
     *   "    gl_FragColor = vec4(lightness, lightness, lightness, base_color.a*vTextureCoord.z);\n" +
     *   "  } else {\n" +
     *   "    gl_FragColor = vec4(base_color.rgb*base_color.a*vTextureCoord.z, base_color.a*vTextureCoord.z);\n" +
     *   "  }\n" +
     *   "}",
     *   [
     *     { name: "aPosition",     width: 2 },
     *     { name: "aOrientation",  width: 3 },
     *     { name: "aLayer",        width: 2 },
     *     { name: "aTextureCoord", width: 2 },
     *     { name: "aGrayscale",    width: 2 }
     *   ],
     *   function(e, entity) {
     *     var co = e.co;
     *     // Write texture coordinates
     *     e.program.writeVector("aTextureCoord",
     *       co.x, co.y,
     *       co.x, co.y + co.h,
     *       co.x + co.w, co.y,
     *       co.x + co.w, co.y + co.h
     *     );
     *     // Write our grayscale attribute
     *     e.program.writeVector("aGrayscale",
     *       entity.grayscale ? 1.0 : 0.0,
     *       0.0
     *     );
     *   }
     * );
     * ~~~
     *
     * It seems like a lot of work, but most of the above code is the default Crafty shader code.
     * When you get the hang of it, it is really easy to extend for your own effects. And remember
     * you only need to write it once, and suddenly all sprite entities have extra effects available.
     *
     * @see Crafty.defaultShader
     * @see Sprite
     * @see Image
     * @see Color
     * @see WebGL
     */
    WebGLShader: function(vertexCode, fragmentCode, attributeList, drawCallback){
        this.vertexCode = vertexCode;
        this.fragmentCode = fragmentCode;
        this.attributeList = attributeList;
        this.drawCallback = drawCallback;
    },
    /**@
     * #Crafty.defaultShader
     * @category Graphics
     * @kind Method
     *
     * @sign public Crafty.WebGLShader Crafty.defaultShader(String component[, Crafty.WebGLShader shader])
     * @param component - Name of the component to assign a default shader to
     * @param shader - New default shader to assign to a component
     *
     * Assigns or fetches a default shader for a component.
     *
     * This allows the default shader for a component to be overridden, and therefor allows
     * developers to override the default shader behaviour with more complex shaders.
     *
     * @example
     * Let's say we want to set the grayscale enabled shader from the example of the WebGLShader
     * as default for sprites:
     * ~~~
     * Crafty.defaultShader("Sprite", recoloredSprite);
     * ~~~
     *
     * @see Crafty.WebGLShader
     * @see Sprite
     * @see Image
     * @see Color
     * @see WebGL
     */
    defaultShader: function(component, shader) {
        this._defaultShaders = (this._defaultShaders || {});
        if (arguments.length === 1 ){
            return this._defaultShaders[component];
        }
        this._defaultShaders[component] = shader;
    },

});

Crafty.c("WebGL", {
    /**@
     * #.context
     * @comp WebGL
     * @kind Property
     *
     * The webgl context this entity will be rendered to.
     */
    init: function () {
        this.requires("Renderable");
        // Attach to webgl layer
        if (!this._customLayer){
            this._attachToLayer( Crafty.s("DefaultWebGLLayer") );
        }
    },

    remove: function(){
        this._detachFromLayer();
    },

    // Cache the various objects and arrays used in draw
    drawVars: {
        type: "webgl",
        pos: {},
        ctx: null,
        coord: [0, 0, 0, 0],
        co: {
            x: 0,
            y: 0,
            w: 0,
            h: 0
        }
    },

    /**@
     * #.draw
     * @comp WebGL
     * @kind Method
     * @private
     *
     * @sign public this .draw([[Context ctx, ]Number x, Number y, Number w, Number h])
     * @param ctx - Optionally supply a different r 2D context if drawing on another canvas is required
     * @param x - X offset for drawing a segment
     * @param y - Y offset for drawing a segment
     * @param w - Width of the segment to draw
     * @param h - Height of the segment to draw
     *
     * An internal method to draw the entity on the webgl canvas element. Rather then rendering directly, it writes relevent information into a buffer to allow batch rendering.
     */
    draw: function (ctx, x, y, w, h) {

        if (!this.ready) return;

        if (arguments.length === 4) {
            h = w;
            w = y;
            y = x;
            x = ctx;
            ctx = this._drawLayer.context;
        }

        var pos = this.drawVars.pos;
        pos._x = (this._x + (x || 0));
        pos._y = (this._y + (y || 0));
        pos._w = (w || this._w);
        pos._h = (h || this._h);

        var coord = this.__coord || [0, 0, 0, 0];
        var co = this.drawVars.co;
        co.x = coord[0] + (x || 0);
        co.y = coord[1] + (y || 0);
        co.w = w || coord[2];
        co.h = h || coord[3];

        // Handle flipX, flipY
        // (Just swap the positions of e.g. x and x+w)
        if (this._flipX ) {
           co.x = co.x + co.w;
           co.w = - co.w;
        }
        if (this._flipY ) {
           co.y = co.y + co.h;
           co.h = - co.h;
        }

        //Draw entity
        var gl = this._drawContext;
        this.drawVars.gl = gl;
        var prog = this.drawVars.program = this.program;

        // The program might need to refer to the current element's index
        prog.setCurrentEntity(this);

        // Write position; x, y, w, h
        prog.writeVector("aPosition",
            this._x, this._y,
            this._x , this._y + this._h,
            this._x + this._w, this._y,
            this._x + this._w, this._y + this._h
        );

        // Write orientation
        prog.writeVector("aOrientation",
            this._origin.x + this._x,
            this._origin.y + this._y,
            this._rotation * Math.PI / 180
        );

        // Write z, alpha
        prog.writeVector("aLayer",
            this._globalZ,
            this._alpha
        );

        // This should only need to handle *specific* attributes!
        this.trigger("Draw", this.drawVars);

        // Register the vertex groups to be drawn, referring to this entities position in the big buffer
        prog.addIndices(prog.ent_offset);

        return this;
    },

    // v_src is optional, there's a default vertex shader that works for regular rectangular entities
    _establishShader: function(compName, shader){
        this.program = this._drawLayer.getProgramWrapper(compName, shader);

        // Needs to know where in the big array we are!
        this.program.registerEntity(this);
        // Shader program means ready
        this.ready = true;
    }
});


text:
package blasd.apex.core.util;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.OptionalLong;
import java.util.stream.Collectors;

import org.junit.Assert;
import org.junit.Test;

import blasd.apex.core.agent.ApexAgentHelper;
import blasd.apex.core.memory.IApexMemoryConstants;

public class TestApexProcessHelper {
	@Test
	public void testMemoryOnMac() throws IOException {
		String macMemoryOutput = Arrays.asList("mapped file 32.9M 10.7M 32K 0K 0K 0K 0K 139",
				"shared memory 44K 44K 44K 0K 0K 0K 0K 6",
				"=========== ======= ======== ===== ======= ======== ====== ===== =======",
				"TOTAL 2.2G 538.2M 377.3M 0K 0K 16K 0K 845",
				"TOTAL, minus reserved VM space 2.2G 538.2M 377.3M 0K 0K 16K 0K 845",
				"",
				"VIRTUAL RESIDENT DIRTY SWAPPED ALLOCATION BYTES DIRTY+SWAP REGION",
				"MALLOC ZONE SIZE SIZE SIZE SIZE COUNT ALLOCATED FRAG SIZE % FRAG COUNT",
				"=========== ======= ========= ========= ========= ========= ========= ========= ======",
				"DefaultMallocZone_0x10b7b6000 203.0M 148.4M 87.4M 0K 167902 64.5M 22.9M 27% 19",
				"GFXMallocZone_0x10b7e7000 0K 0K 0K 0K 0 0K 0K 0% 0",
				"=========== ======= ========= ========= ========= ========= ========= ========= ======",
				"TOTAL 203.0M 148.4M 87.4M 0K 167902 64.5M 22.9M 27% 19").stream().collect(Collectors.joining("\r"));

		long nbBytes = ApexProcessHelper
				.extractMemory(ApexProcessHelper.OS_MARKER_MAC, new ByteArrayInputStream(macMemoryOutput.getBytes()))
				.getAsLong();
		Assert.assertEquals((long) (538.2D * IApexMemoryConstants.MB), nbBytes);
	}

	@Test
	public void testMemory_mac_multiplespaces() throws IOException {
		String macMemoryOutput =
				"TOTAL                                1.5G   113.3M    7208K      52K       0K      20K       0K      485 ";

		long nbBytes = ApexProcessHelper
				.extractMemory(ApexProcessHelper.OS_MARKER_MAC, new ByteArrayInputStream(macMemoryOutput.getBytes()))
				.getAsLong();
		Assert.assertEquals((long) (113.3D * IApexMemoryConstants.MB), nbBytes);
	}

	// Without -X on pmap, we receive only the 'whole' memory, whatever it means
	@Test
	public void testMemoryOnLinux_MissingDashX() throws IOException {
		String macMemoryOutput = Arrays.asList(" total 65512K").stream().collect(Collectors.joining("\n"));

		long nbBytes = ApexProcessHelper
				.extractMemory(ApexProcessHelper.OS_MARKER_LINUX, new ByteArrayInputStream(macMemoryOutput.getBytes()))
				.getAsLong();
		Assert.assertEquals(65512 * IApexMemoryConstants.KB, nbBytes);
	}

	@Test
	public void testMemoryOnLinux_WithDashX() throws IOException {
		// RSS is generally the second figure
		String macMemoryOutput =
				Arrays.asList("total kB         4824728  390544  377152").stream().collect(Collectors.joining("\n"));

		long nbBytes = ApexProcessHelper
				.extractMemory(ApexProcessHelper.OS_MARKER_LINUX, new ByteArrayInputStream(macMemoryOutput.getBytes()))
				.getAsLong();
		Assert.assertEquals(390544 * IApexMemoryConstants.KB, nbBytes);
	}

	@Test
	public void testMemoryOnWindows() throws IOException {
		// "/fo csv"
		String windowsMemoryOutput = "\"chrome.exe\",\"6740\",\"Console\",\"1\",\"107,940 K\"";

		// "/fo table"
		// String windowsMemoryOutput = "chrome.exe 6740 Console 1 108,760 K";

		long nbBytes =
				ApexProcessHelper
						.extractMemory(ApexProcessHelper.OS_MARKER_WINDOWS,
								new ByteArrayInputStream(windowsMemoryOutput.getBytes()))
						.getAsLong();
		Assert.assertEquals(107940 * IApexMemoryConstants.KB, nbBytes);
	}

	// French has no comma as thousands separator
	@Test
	public void testMemoryOnWindows_FrenchLocal() throws IOException {
		// "/fo csv"
		String windowsMemoryOutput = "\"chrome.exe\",\"6740\",\"Console\",\"1\",\"78 332 K\"";

		// "/fo table"
		// String windowsMemoryOutput = "chrome.exe 6740 Console 1 108,760 K";

		long nbBytes =
				ApexProcessHelper
						.extractMemory(ApexProcessHelper.OS_MARKER_WINDOWS,
								new ByteArrayInputStream(windowsMemoryOutput.getBytes()))
						.getAsLong();
		Assert.assertEquals(78332 * IApexMemoryConstants.KB, nbBytes);
	}

	@Test
	public void testMemoryOnWindows_pid_does_not_match() throws IOException {
		String macMemoryOutput = "INFO: No tasks are running which match the specified criteria.";

		OptionalLong nbBytes = ApexProcessHelper.extractMemory(ApexProcessHelper.OS_MARKER_WINDOWS,
				new ByteArrayInputStream(macMemoryOutput.getBytes()));
		Assert.assertFalse(nbBytes.isPresent());
	}

	/**
	 * Enable to check the behavior on any system
	 *
	 * @throws IOException
	 */
	@Test
	public void testMemoryOnCurrentSystem() throws IOException {
		long currentProcessPID = Long.parseLong(ApexAgentHelper.getPIDForAgent());
		long nbBytes = ApexProcessHelper.getProcessResidentMemory(currentProcessPID).getAsLong();
		Assert.assertTrue(nbBytes > 0);
	}
}


text:
package net.teamfruit.factorioforge.factorioapi.data.impl.modportal;

import net.teamfruit.factorioforge.factorioapi.data.modportal.IPaginationLink;

public class PaginationLink implements IPaginationLink {

	private String first;
	private String prev;
	private String next;
	private String last;

	@Override
	public String getFirst() {
		return this.first;
	}

	@Override
	public String getPrev() {
		return this.prev;
	}

	@Override
	public String getNext() {
		return this.next;
	}

	@Override
	public String getLast() {
		return this.last;
	}

	@Override
	public boolean hasNext() {
		return getNext()!=null;
	}

}


text:
#ifdef USE_GASPI
/*
 * This file is part of a small exa2ct benchmark kernel
 * The kernel aims at a dataflow implementation for
 * hybrid solvers which make use of unstructured meshes.
 *
 * Contact point for exa2ct:
 *                 https://projects.imec.be/exa2ct
 *
 * Contact point for this kernel:
 *                 christian.simmendinger@t-systems.com
 */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <GASPI.h>

#include "exchange_data_gaspi.h"
#include "solver_data.h"
#include "comm_data.h"
#include "rangelist.h"
#include "threads.h"
#include "waitsome.h"
#include "queue.h"
#include "util.h"

#include "error_handling.h"

#ifdef USE_GASPI_TEST
#ifndef USE_GASPI
#error GASPI_TEST requires GASPI
#endif
int *testsome_local = NULL;
#pragma omp threadprivate(testsome_local)
#endif

void init_gaspi_segments(comm_data *cd
			 , int dim2
			 )
{

  int i, j;
  const int max_elem_sz = NGRAD * 3;
  const size_t szd = sizeof(double);
  ASSERT(dim2 == max_elem_sz);

  gaspi_number_t snum = 0;
  SUCCESS_OR_DIE(gaspi_segment_num(&snum));
  ASSERT(snum == 0);

  gaspi_size_t rsz = 0, ssz = 0;
  for(i = 0; i < cd->ncommdomains; i++)
    {
      int k = cd->commpartner[i];
      ssz +=  cd->sendcount[k] * max_elem_sz * szd;
      rsz +=  cd->recvcount[k] * max_elem_sz * szd;
    }

#ifdef DEBUG
  printf("GASPI segment size rsz: %lu ssz: %lu\n",rsz,ssz);
  fflush(stdout);
#endif

  for(j = 0; j < 2; j++)
    {
      /* create gaspi send segments for gradients */
      SUCCESS_OR_DIE(gaspi_segment_create(j
			   , ssz
			   , GASPI_GROUP_ALL
			   , GASPI_BLOCK
			   , GASPI_ALLOC_DEFAULT
					  ));

      /* create gaspi recv segments for gradients */
      SUCCESS_OR_DIE(gaspi_segment_create(2+j
			   , rsz
			   , GASPI_GROUP_ALL
			   , GASPI_BLOCK
			   , GASPI_ALLOC_DEFAULT
					  ));
    }

#ifdef DEBUG
  printf("GASPI segment creation complete.\n");
  fflush(stdout);
#endif

#ifdef USE_GASPI_TEST
#pragma omp parallel default (none) shared(cd)
  {
    if (testsome_local == NULL)
      {
	testsome_local = check_malloc(cd->ncommdomains * sizeof(int));
      }
  }
#endif

}

void exchange_dbl_gaspi_write(comm_data *cd
			      , double *data
			      , int dim2
			      , int buffer_id
			      , int i)
{
  int *commpartner  = cd->commpartner;
  int *sendcount    = cd->sendcount;

  gaspi_queue_id_t queue_id = 0;
  gaspi_offset_t *local_send_offset     = cd->local_send_offset;
  gaspi_offset_t *remote_recv_offset    = cd->remote_recv_offset;
  gaspi_notification_id_t *notification = cd->notification;

  int count;
  size_t szd = sizeof(double);

  int k = commpartner[i];
  count = sendcount[k];

  ASSERT(data != NULL);

  if(count > 0)
    {

      gaspi_size_t size = count * dim2 * szd;

      // issue write
      wait_for_queue_max_half (&queue_id);
      SUCCESS_OR_DIE ( gaspi_write_notify
		       ( buffer_id
			 , local_send_offset[k]
			 , k
			 , 2+buffer_id
			 , remote_recv_offset[k]
			 , size
			 , notification[k]
			 , 1
			 , queue_id
			 , GASPI_BLOCK
			 ));
      /* inc send flag */
      cd->send_flag[i].global++;

    }

}

static void exchange_dbl_gaspi_scatter(comm_data *cd
				       , double *data
				       , int dim2
				       )
{
  int ncommdomains  = cd->ncommdomains;
  int *commpartner  = cd->commpartner;
  int *recvcount    = cd->recvcount;
  gaspi_offset_t *local_recv_offset = cd->local_recv_offset;

  int i;
  for (i = 0; i < ncommdomains; ++i)
    {
      int nrecv = get_recvcount_local(i);
      if (nrecv > 0)
	{
	  volatile int flag;
	  while ((flag = cd->recv_flag[i].global) == cd->recv_stage)
	    {
	      _mm_pause();
	    }
	  /* sanity check */
	  ASSERT(flag == (cd->recv_stage + 1));

	  int k = commpartner[i];
	  ASSERT(recvcount[k] > 0);

	  /* copy the data from the recvbuf into out data field */
	  int buffer_id = cd->recv_stage % 2;
	  gaspi_pointer_t ptr;
	  SUCCESS_OR_DIE(gaspi_segment_ptr(2+buffer_id, &ptr));
	  double *rbuf = (double *) ((char *) ptr + local_recv_offset[k]);
	  exchange_dbl_copy_out_local(rbuf, data, dim2, i);
	}
    }
}

void exchange_dbl_gaspi_bulk_sync(comm_data *cd
				  , double *data
				  , int dim2
				  , int final
				  )
{
  int ncommdomains  = cd->ncommdomains;
  int *commpartner  = cd->commpartner;
  int *recvcount    = cd->recvcount;
  int *sendcount    = cd->sendcount;

  gaspi_offset_t *remote_recv_offset    = cd->remote_recv_offset;
  gaspi_offset_t *local_recv_offset     = cd->local_recv_offset;
  gaspi_offset_t *local_send_offset     = cd->local_send_offset;

  int i;

  ASSERT(dim2 > 0);
  ASSERT(ncommdomains != 0);

  ASSERT(recvcount != NULL);
  ASSERT(sendcount != NULL);

  ASSERT(remote_recv_offset != NULL);
  ASSERT(local_recv_offset != NULL);
  ASSERT(local_send_offset != NULL);
  ASSERT((final == 0 || final == 1));

  gaspi_number_t snum = 0;
  SUCCESS_OR_DIE(gaspi_segment_num(&snum));
  ASSERT(snum == 4);

  /* wait for completed computation before send */
  if (this_is_the_last_thread())
    {
      for(i = 0; i < ncommdomains; i++)
	{
	  int k = commpartner[i];
	  if (sendcount[k] > 0)
	    {
	      int buffer_id = cd->send_stage % 2;
#if !defined(USE_PACK_IN_BULK_SYNC) && !defined(USE_PARALLEL_GATHER)
	      gaspi_pointer_t ptr;
	      SUCCESS_OR_DIE(gaspi_segment_ptr(buffer_id, &ptr));
	      double *sbuf = (double *) ((char *) ptr + local_send_offset[k]);
	      exchange_dbl_copy_in(cd
				   , sbuf
				   , data
				   , dim2
				   , i
				   );
#endif
	      exchange_dbl_gaspi_write(cd, data, dim2, buffer_id, i);
	    }
	}

      /* wait for all notify */
      for(i = 0; i < ncommdomains; i++)
	{
	  gaspi_notification_id_t id;
	  gaspi_notification_t value = 0;
	  int buffer_id = cd->recv_stage % 2;
	  SUCCESS_OR_DIE(gaspi_notify_waitsome (2+buffer_id
						, 0
						, ncommdomains
						, &id
						, GASPI_BLOCK
						));
          SUCCESS_OR_DIE (gaspi_notify_reset (2+buffer_id
                                              , id
                                              , &value
                                              ));
          ASSERT(value != 0);

	  int k = commpartner[id];
	  ASSERT(recvcount[k] > 0);

	  // flag received buffer
	  cd->recv_flag[id].global++;

#ifndef USE_PARALLEL_SCATTER
	  /* copy the data from the recvbuffer into out data field */
	  gaspi_pointer_t ptr;
	  SUCCESS_OR_DIE(gaspi_segment_ptr(2+buffer_id, &ptr));
	  double *rbuf = (double *) ((char *) ptr + local_recv_offset[k]);
	  exchange_dbl_copy_out(cd
				, rbuf
				, data
				, dim2
				, id
				);
#endif
	}
    }

#ifdef USE_PARALLEL_SCATTER
  exchange_dbl_gaspi_scatter(cd, data, dim2);
#endif

  if (this_is_the_last_thread())
    {
      // inc stage counter
      cd->send_stage++;
      cd->recv_stage++;
    }

#ifndef USE_PARALLEL_SCATTER
/* wait for recv/unpack */
#pragma omp barrier
#else
/* no barrier -- in parallel scatter all threads unpack
   the specifically required parts of recv */
#endif

}

void exchange_dbl_gaspi_async(comm_data *cd
			      , double *data
			      , int dim2
			      , int final
			      )
{

  int ncommdomains  = cd->ncommdomains;
  int *commpartner  = cd->commpartner;
  int *recvcount    = cd->recvcount;

  gaspi_offset_t *local_recv_offset = cd->local_recv_offset;

  ASSERT(dim2 > 0);
  ASSERT(ncommdomains != 0);

  ASSERT(recvcount != NULL);
  ASSERT(local_recv_offset != NULL);
  ASSERT((final == 0 || final == 1));

  gaspi_number_t snum = 0;
  SUCCESS_OR_DIE(gaspi_segment_num(&snum));
  ASSERT(snum == 4);

  int i;

  /*----------------------------------------------------------------------
  |   Note: GASPI leverages parallel scatter by default. The GASPI API
  |   uses a multithreaded evaluation of notifications. No flags for
  |   the received data hence are required, instead notifications are
  |   actually are flags for received data.
  ----------------------------------------------------------------------*/

#ifdef USE_PARALLEL_SCATTER
#ifdef USE_GASPI_TEST

  ASSERT(testsome_local != NULL);
  for (i = 0; i < ncommdomains; ++i)
    {
      testsome_local[i] = 0;
    }

  int count = 0;
  int nrecvcount = get_nrecvcount_local();
  while (count < nrecvcount)
    {
      for (i = 0; i < ncommdomains; ++i)
	{
	  gaspi_notification_id_t nid, id = i;
	  int nrecv = get_recvcount_local(i);
	  if (nrecv > 0 && testsome_local[i] == 0)
	    {
	      gaspi_return_t ret;
	      int buffer_id = cd->recv_stage % 2;
	      if ((ret = gaspi_notify_waitsome (2+buffer_id
						, id
						, 1
						, &nid
						, GASPI_TEST
						)) == GASPI_SUCCESS
		  )
		{
		  ASSERT (id == nid);
		  int k = commpartner[i];
		  ASSERT(recvcount[k] > 0);

		  /* copy the data from the recvbuffer into out data field */
		  gaspi_pointer_t ptr;
		  SUCCESS_OR_DIE(gaspi_segment_ptr(2+buffer_id, &ptr));
		  double *rbuf = (double *) ((char *) ptr + local_recv_offset[k]);
		  exchange_dbl_copy_out_local(rbuf
					      , data
					      , dim2
					      , i
					      );
		  testsome_local[i] = 1;
		  count++;
		}
	    }
	}
    }
#else /* USE_PARALLEL_SCATTER && USE_GASPI_TEST */
  for (i = 0; i < ncommdomains; ++i)
    {
      gaspi_notification_id_t nid, id = i;
      int nrecv = get_recvcount_local(i);
      if (nrecv > 0)
	{
	  int buffer_id = cd->recv_stage % 2;
	  SUCCESS_OR_DIE(gaspi_notify_waitsome (2+buffer_id
						, id
						, 1
						, &nid
						, GASPI_BLOCK
						));

	  int k = commpartner[i];
	  ASSERT(recvcount[k] > 0);

	  /* copy the data from the recvbuffer into out data field */
	  gaspi_pointer_t ptr;
	  SUCCESS_OR_DIE(gaspi_segment_ptr(2+buffer_id, &ptr));
	  double *rbuf = (double *) ((char *) ptr + local_recv_offset[k]);
	  exchange_dbl_copy_out_local(rbuf
				      , data
				      , dim2
				      , i
				      );
	}
    }
#endif /* USE_PARALLEL_SCATTER && !USE_GASPI_TEST */

  if (this_is_the_last_thread())
    {
      for (i = 0; i < ncommdomains; ++i)
	{
	  gaspi_notification_id_t id = i;
	  gaspi_notification_t value = 0;
	  int buffer_id = cd->recv_stage % 2;

	  // flag received buffer
	  cd->recv_flag[id].global++;

	  /* .. and reset */
	  SUCCESS_OR_DIE (gaspi_notify_reset (2+buffer_id
					      , id
					      , &value
					      ));
	  ASSERT(value != 0);

	}

      // inc stage counter
      cd->send_stage++;
      cd->recv_stage++;
    }

/* no barrier -- in parallel scatter all threads unpack
   the specifically required parts of recv */

#else /* USE_PARALLEL_SCATTER */

  if (this_is_the_first_thread())
    {
      /* buffer_id */
      int buffer_id = cd->recv_stage % 2;
      for (i = 0; i < ncommdomains; ++i)
	{
	  gaspi_notification_id_t id;
	  gaspi_notification_t value = 0;
	  /* test .. */
	  SUCCESS_OR_DIE(gaspi_notify_waitsome (2+buffer_id
						, 0
						, ncommdomains
						, &id
						, GASPI_BLOCK
						));

          SUCCESS_OR_DIE (gaspi_notify_reset (2+buffer_id
                                              , id
                                              , &value
                                              ));
          ASSERT(value != 0);

	  int k = commpartner[id];
	  ASSERT(recvcount[k] > 0);

	  // flag received buffer
	  cd->recv_flag[id].global++;

	  /* copy the data from the recvbuffer into out data field */
	  gaspi_pointer_t ptr;
	  SUCCESS_OR_DIE(gaspi_segment_ptr(2+buffer_id, &ptr));
	  double *rbuf = (double *) ((char *) ptr + local_recv_offset[k]);
	  exchange_dbl_copy_out(cd
				, rbuf
				, data
				, dim2
				, id
				);
	}
    }

  if (this_is_the_last_thread())
    {
      // inc stage counter
      cd->send_stage++;
      cd->recv_stage++;
    }

#pragma omp barrier

#endif /* !USE_PARALLEL_SCATTER */

}

#endif


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

namespace Task03CameraView
{
    class Task03CameraView
    {
        static void Main(string[] args)
        {

            int[] nums = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();

            var toSkip = nums[0];

            var toTake = nums[1];

            Regex reg = new Regex(@"(?<=\|<).+?(?=\|<|\b)");

            var text = Console.ReadLine();

            var matches = reg.Matches(text).Cast<Match>().Select(n => n.Value).ToList();

            var output = new List<string>();

            foreach (var word in matches)
            {
                output.Add(string.Join("",word.ToCharArray().Skip(toSkip).Take(toTake)));
            }

            Console.WriteLine(string.Join(", ",output));
        }
    }
}


text:
layout: post
date: '2016-02-08'
title: "House of Wu Christina Wu Occasions Style 22626 Sleeveless Floor-Length Mermaid/Trumpet"
category: House of Wu
tags: [House of Wu,Mermaid/Trumpet,Sweetheart,Floor-Length,Sleeveless]
---
### House of Wu Christina Wu Occasions Style 22626
Just **$349.99**
###   Sleeveless Floor-Length Mermaid/Trumpet

BRANDS	House of Wu

Silhouette	Mermaid/Trumpet

Neckline	Sweetheart

Hemline/Train	Floor-Length

Sleeve	Sleeveless

Buy it: [https://www.readybrides.com/en/house-of-wu/18497-house-of-wu-christina-wu-occasions-style-22626.html](https://www.readybrides.com/en/house-of-wu/18497-house-of-wu-christina-wu-occasions-style-22626.html)