text:
A "Library" of Libraries of Sensors. Infrared, Ultrasonic, Compass and many others,
ready to work with [ArduinoThread](https://github.com/ivanseidel/ArduinoThread) and fully object oriented.

This library was made to provide lot's of out-of-the-box features, such as 'Interfaces', 'Threadable' sensors,
and reliability over C++ Objects.

If you are a developer, please consider developing more sensor Libraries following the given pattern. I will be
pleased to incorporate it to the library!

## Installation

1. [Download](https://github.com/ivanseidel/ArduinoSensors/archive/master.zip) the Latest release from gitHub.
2. Unzip and modify the Folder name to "ArduinoSensors" (Remove the '-version')
3. Paste the modified folder on your Library folder (On your `Libraries` folder inside Sketchbooks or Arduino software).
4. Download and Install [ArduinoThread](https://github.com/ivanseidel/ArduinoThread)
5. Restart the Arduino IDE

## Included Generic Classes:

* AnalogIn
* DigitalIn
* DigitalOut
* AnalogVoltage

## Included Sensor Classes:

* MLX90614 Temperature Sensor
* HMC6352 Compass sensor
* EZ Ultrasonic Sensor
* Ping Ultrasonic Sensor
* HC-SR04 Ultrasonic Sensor
* InvenSense IMU MPU9150
* InvenSense IMU MPU6050
* Sharp Infrared Short Distance Sensor (GP2D120XJ00F)
* Sharp Infrared Medium Distance Sensor (GP2Y0A21YK)
* Sharp Infrared Long Distance Sensor (GP2Y0A02YK0F)

# The Concept of this Library

If you are here, you are probably looking for some sensor library. Perhaps an Distance sensor, or a Compass sensor, or even a IMU sensor. What do they all have in common? They are all sensors, and do some measurement. Perhaps an Angle, or a Distance, or a Speed...

Some libraries uses functions and others use Classes witch are better to maitain and even to understand the code. This Library tries to create a patterns that allows others to create better Sensor libraries with it, while keeping method names generic and compatibility across multiple platforms. Also, Sensors extend from it's base the a Thread (from [ArduinoThread](https://github.com/ivanseidel/ArduinoThread) Library), allowing `async` fetch of sensor data pretty easily.

But to do all that, we must have a strong and nice Base to work with. For example: There are many platforms that are 3.3v, 5v and even 1.8V. How can we make it work with multiple ADC values? How can we make it simple to develop and to use? Continue reading and you will understand.

# Base Classes

Consists of a set of classes that helps another classes like `DigitalIn`, `AnalogIn`, `DigitalOut`, `AnalogVoltage`.

Also contains a set of Interfaces such as `AngleInterface`, `DistanceInterface`, `TemperatureInterface`, `VoltageInterface`, used by different sensor types.

Let's say we have a new Temperature sensor, and we want to create a Library for it. What we expect to have:
* **Generic method names.** In this case, it would extend a `TemperatureInterface`, that has the method `getTemperature` and `readTemperature`
* **Caching it's value.** We should be able to both `read` it's value (actually fetch sensor data, read analog, communicate...), or `get` it's current value (basically, return what was read last, like a caching).
* **Work Asynchronously.** Implementing Thread from [ArduinoThread](https://github.com/ivanseidel/ArduinoThread) Library, we can make it read with a fixed timing, and  get it's value latter without further delay.

## Interfaces

Interfaces are a very good way of transforming your usual code into a more generic way. It's basicaly a set of methods and properties (variables), that a Class will inherit. For example, every class that extends `AngleInterface`, will have a method called `readAngle` and `getAngle`. If a new sensor library is created, that reads an angle (perhaps a potentiometer, Compass or even a encoder), it could inherit from this interface, and get those methods.

I will explain why it's good to use with an experience I had:

I was developing a complex robot, that would require multiple Distance Sensor types. That included two types of Infrared distance sensor, and one type of Ultrasonic sensor. I have developed this library thinking that whenever I needed, I could change the sensor in hardware for another, and it would still work. Shure that there are physical differences between them, but what I wanted was to work with multiple sensors without altering more than ONE line of code. I so I did it. We could test with different sensors, without taking so much time on software and also hardware.

We also used a IMU from Invensense, that has a Compass. After a while, we decide to change that for a simple Compass Sensor. Both of the sensors libraries was made by me, implementing it's `AngleInterface`.

## Base Classes

Base Classes are used by other classes, and also by you (if you want), providing a even more High Level approach for IO manipulation.

### DigitalIn Class

Provides a easy approach for manipulating a Digital Input pin:

```
DigitalIn myButton(9);

// Check if Pin is HIGH
if (myButton)...

// Check if Pin is LOW
if (myButton == LOW)...

// Reads it's value
boolean val = myButton.readValue();

// Get last read value
val = myButton.getValue();
```

Also, if you initialize it passing `true` as a seccond param, every read will be inverted:
```
DigitalIn myInvertedButton(10, true);

// Check if Pin is LOW
if(myInvertedButton)

// Read it's value (inverted)
myInvertedButton.readValue();
```

### DigitalOut Class

Used to manipulate Digital Output pins in a easy way.

```
DigitalOut myLed(13);

// Turns LED on
myLed = HIGH;
myLed.turn(HIGH);
myLed.turnOn();

// Turns LED off
myLed = LOW;
myLed.turn(LOW);
myLed.turnOff();
```

Like DigitalIn, if you assign an seccond parameter in it's initialization, it will automatically invert it's output
```
DigitalOut myLedInverted(13, true);

// Turns LED off
myLedInverted = HIGH

// You can also check it's istate like this:
if(myLedInverted == HIGH) ...
```

### AnalogIn Class

We usually need to use Analog Pins as Digital. Or even Read it's value multiple times. I usually consider a lot the timing of things, knowing every milisecond that is happening on my program. Because of that you might consider using this class instead of usual `analogRead` function.

```
AnalogIn myPot(A0);

// Reads it's value
val = myPot.read();

// Get it's cached value (does not reads ADC, only returns last value)
val = myPot.getValue();
```

One usual case, is setting a threshold to compare. We do it for you:

```
// Set threshold for 500
myPot.setThreshold(500);

// Check if below 500
if(myPot.belowThreshold())...

if(myPot == false)...

// Check if above 500
if(myPot.aboveThreshold())...

if(myPot == true)...
```

## AnalogVoltage Class

This is a nice step for next generations of Libraries, because there are many Analog Sensors around, that it's converted value should be mapped to a Voltage, not a ADC value. But that's a problem becoming larger today, since there are platforms that runs with 5v, others with 3.3v... And imagine, every single library thrying to work whit that (or not)?

```
AnalogVoltage myVoltimeter(A0);

// Read the voltage (in Volts)
float pinVoltage = myVoltimeter.readVoltage();
```

Well, you might be wondering: How does it do it's magic? The answer is pretty simple: **Preprocessor macros**.

In compiling time, we detect weather you are using a 3.3v or 5v platform, and set a definition called `ADC_DEFAULT_AREF`. We use it later to scale the ADC to a voltage. But keep calm, you can override that pretty easily, and allows you to create custom `linear` voltage in readers (Like a voltage divider, to read a battery voltage).

```
// 0 in ADC now means -5v. full ADC (1024) means 10v
AnalogVoltage myCustomVoltimeter(A0, -5, 10);

float pinVoltage = myCustomVoltimeter.readVoltage();
```

# Working toguether with ArduinoThread

Read more about [ArduinoThread](https://github.com/ivanseidel/ArduinoThread) here. It's a library I created to simplify complex softwares that requires multiple async tasks. Let's say:
* Read Compass every 50ms
* Read Distance Sensors every 70ms
* Read a button every 5ms
* Get battery voltage every 1 minute
* and so on...

If you want a REAL example of it working, take a look at our [2013 RoboCup Junior Soccer Robot code](https://github.com/ivanseidel/Robot-Soccer-2013/tree/master/Software/Soccer_v02).

The idea is that you can register Threads in ThreadController (a group of Threads), and let the system check if it should be runned. In that way, you just GET sensor values in your main code, without consuming time every time you need something.

```
// Create a new ThreadController that will run always
// (means it will check if it's threads should be runned everytime)
ThreadController threads(0);

// Create some sensors
DistanceInterface *myDist1 = new SharpLong(A0);
DistanceInterface *myDist2 = new SharpShort(A1);
TemperatureInterface *thermometer = new MLX90614(0x32);
AngleInterface *myCompass = new HMC6352();

// Each sensor has it's interval set to minimum possible
// or something good to work with (20ms - 70ms).

// But they ARE Thread objects, so you can make use of
// it's methods:

// Compass should be read every 60ms
myCompass.setInterval(60);

// Add to the thread controller
threads.add(&myDist1);
threads.add(&myDist2);
threads.add(&thermometer);
threads.add(&myCompass);

// Now, just call threads.run(); to automatically run what is needed
// (perhaps in a Timer Callback? or in Loop.. whatever)
loop(){
  threads.run();

  // Get the most recend value WITHOUT reading the sensor
  double currentAngle = myCompass->getAngle();
  float distance = myDist1->getDistance();
  [...]
}

```

## Rest of Documentation under development...


text:
var classorg_1_1onosproject_1_1net_1_1intent_1_1impl_1_1IntentCompilationException =
[
    [ "IntentCompilationException", "classorg_1_1onosproject_1_1net_1_1intent_1_1impl_1_1IntentCompilationException.html#ae14c898b45e7941c82a651f8f6c759a4", null ],
    [ "IntentCompilationException", "classorg_1_1onosproject_1_1net_1_1intent_1_1impl_1_1IntentCompilationException.html#af5a74efae8bae581981c63b8056cc719", null ],
    [ "IntentCompilationException", "classorg_1_1onosproject_1_1net_1_1intent_1_1impl_1_1IntentCompilationException.html#a25a351171178e69307fbdefc96456490", null ]
];

redpajama_set_name: RedPajamaGithub


text:
package org.resthub.rpc.example;

import org.springframework.context.support.GenericXmlApplicationContext;

public class EchoServer {

    public static void main(String[] args) throws Exception {
//        CachingConnectionFactory connectionFactory = new CachingConnectionFactory("localhost", 5672);
//        connectionFactory.setUsername("guest");
//        connectionFactory.setPassword("guest");
//
//        Endpoint endpoint = new Endpoint(new EchoServiceImpl());
//        endpoint.setConnectionFactory(connectionFactory);
//        endpoint.run();
//
//        connectionFactory.destroy();

        new GenericXmlApplicationContext("classpath:/applicationContext-server.xml");
    }
}


text:
package com.facebook.buck.cxx;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

import com.facebook.buck.hashing.FileHashLoader;
import com.facebook.buck.io.BuildCellRelativePath;
import com.facebook.buck.io.file.MorePaths;
import com.facebook.buck.io.filesystem.ProjectFilesystem;
import com.facebook.buck.io.filesystem.TestProjectFilesystems;
import com.facebook.buck.model.BuildTarget;
import com.facebook.buck.model.BuildTargetFactory;
import com.facebook.buck.model.BuildTargets;
import com.facebook.buck.rules.BuildContext;
import com.facebook.buck.rules.BuildRuleResolver;
import com.facebook.buck.rules.DefaultSourcePathResolver;
import com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer;
import com.facebook.buck.rules.FakeBuildContext;
import com.facebook.buck.rules.FakeBuildableContext;
import com.facebook.buck.rules.PathSourcePath;
import com.facebook.buck.rules.RuleKey;
import com.facebook.buck.rules.SingleThreadedBuildRuleResolver;
import com.facebook.buck.rules.SourcePath;
import com.facebook.buck.rules.SourcePathResolver;
import com.facebook.buck.rules.SourcePathRuleFinder;
import com.facebook.buck.rules.TargetGraph;
import com.facebook.buck.rules.keys.DefaultRuleKeyFactory;
import com.facebook.buck.rules.keys.InputBasedRuleKeyFactory;
import com.facebook.buck.step.Step;
import com.facebook.buck.step.fs.MkdirStep;
import com.facebook.buck.step.fs.RmStep;
import com.facebook.buck.testutil.FakeProjectFilesystem;
import com.facebook.buck.testutil.integration.TemporaryPaths;
import com.facebook.buck.util.cache.FileHashCacheMode;
import com.facebook.buck.util.cache.impl.DefaultFileHashCache;
import com.facebook.buck.util.cache.impl.StackedFileHashCache;
import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

public class DirectHeaderMapTest {

  @Rule public final TemporaryPaths tmpDir = new TemporaryPaths();

  private ProjectFilesystem projectFilesystem;
  private BuildTarget buildTarget;
  private DirectHeaderMap buildRule;
  private BuildRuleResolver ruleResolver;
  private SourcePathResolver pathResolver;
  private ImmutableMap<Path, SourcePath> links;
  private Path symlinkTreeRoot;
  private Path headerMapPath;
  private Path file1;
  private Path file2;
  private SourcePathRuleFinder ruleFinder;

  @Before
  public void setUp() throws Exception {
    projectFilesystem = new FakeProjectFilesystem(tmpDir.getRoot());

    // Create a build target to use when building the symlink tree.
    buildTarget = BuildTargetFactory.newInstance("//test:test");

    // Get the first file we're symlinking
    Path link1 = Paths.get("file");
    file1 = tmpDir.newFile();
    Files.write(file1, "hello world".getBytes(Charsets.UTF_8));

    // Get the second file we're symlinking
    Path link2 = Paths.get("directory", "then", "file");
    file2 = tmpDir.newFile();
    Files.write(file2, "hello world".getBytes(Charsets.UTF_8));

    // Setup the map representing the link tree.
    links =
        ImmutableMap.of(
            link1,
            PathSourcePath.of(projectFilesystem, MorePaths.relativize(tmpDir.getRoot(), file1)),
            link2,
            PathSourcePath.of(projectFilesystem, MorePaths.relativize(tmpDir.getRoot(), file2)));

    // The output path used by the buildable for the link tree.
    symlinkTreeRoot =
        BuildTargets.getGenPath(projectFilesystem, buildTarget, "%s/symlink-tree-root");

    // Setup the symlink tree buildable.
    ruleResolver =
        new SingleThreadedBuildRuleResolver(
            TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());

    ruleFinder = new SourcePathRuleFinder(ruleResolver);
    pathResolver = DefaultSourcePathResolver.from(ruleFinder);

    buildRule = new DirectHeaderMap(buildTarget, projectFilesystem, symlinkTreeRoot, links);
    ruleResolver.addToIndex(buildRule);

    headerMapPath = pathResolver.getRelativePath(buildRule.getSourcePathToOutput());
  }

  @Test
  public void testBuildSteps() throws IOException {
    BuildContext buildContext = FakeBuildContext.withSourcePathResolver(pathResolver);
    FakeBuildableContext buildableContext = new FakeBuildableContext();

    ImmutableList<Step> expectedBuildSteps =
        ImmutableList.of(
            MkdirStep.of(
                BuildCellRelativePath.fromCellRelativePath(
                    buildContext.getBuildCellRootPath(),
                    projectFilesystem,
                    headerMapPath.getParent())),
            RmStep.of(
                BuildCellRelativePath.fromCellRelativePath(
                    buildContext.getBuildCellRootPath(), projectFilesystem, headerMapPath)),
            new HeaderMapStep(
                projectFilesystem,
                headerMapPath,
                ImmutableMap.of(
                    Paths.get("file"), file1,
                    Paths.get("directory/then/file"), file2)));
    ImmutableList<Step> actualBuildSteps = buildRule.getBuildSteps(buildContext, buildableContext);
    assertEquals(expectedBuildSteps, actualBuildSteps.subList(1, actualBuildSteps.size()));
  }

  @Test
  public void testSymlinkTreeRuleKeysChangeIfLinkMapChanges() throws Exception {
    Path aFile = tmpDir.newFile();
    Files.write(aFile, "hello world".getBytes(Charsets.UTF_8));
    ImmutableMap.Builder<Path, SourcePath> modifiedLinksBuilder = ImmutableMap.builder();
    for (Path p : links.keySet()) {
      modifiedLinksBuilder.put(tmpDir.getRoot().resolve("modified-" + p.toString()), links.get(p));
    }
    DirectHeaderMap modifiedBuildRule =
        new DirectHeaderMap(
            buildTarget, projectFilesystem, symlinkTreeRoot, modifiedLinksBuilder.build());

    SourcePathRuleFinder ruleFinder =
        new SourcePathRuleFinder(
            new SingleThreadedBuildRuleResolver(
                TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer()));
    SourcePathResolver resolver = DefaultSourcePathResolver.from(ruleFinder);

    // Calculate their rule keys and verify they're different.
    FileHashLoader hashCache =
        new StackedFileHashCache(
            ImmutableList.of(
                DefaultFileHashCache.createDefaultFileHashCache(
                    TestProjectFilesystems.createProjectFilesystem(tmpDir.getRoot()),
                    FileHashCacheMode.DEFAULT)));
    RuleKey key1 = new DefaultRuleKeyFactory(0, hashCache, resolver, ruleFinder).build(buildRule);
    RuleKey key2 =
        new DefaultRuleKeyFactory(0, hashCache, resolver, ruleFinder).build(modifiedBuildRule);
    assertNotEquals(key1, key2);

    key1 = new InputBasedRuleKeyFactory(0, hashCache, resolver, ruleFinder).build(buildRule);
    key2 =
        new InputBasedRuleKeyFactory(0, hashCache, resolver, ruleFinder).build(modifiedBuildRule);
    assertNotEquals(key1, key2);
  }

  @Test
  public void testRuleKeyDoesNotChangeIfLinkTargetsChange()
      throws InterruptedException, IOException {
    BuildRuleResolver ruleResolver =
        new SingleThreadedBuildRuleResolver(
            TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
    ruleResolver.addToIndex(buildRule);
    SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(ruleResolver);
    SourcePathResolver resolver = DefaultSourcePathResolver.from(ruleFinder);
    // Calculate their rule keys and verify they're different.
    DefaultFileHashCache hashCache =
        DefaultFileHashCache.createDefaultFileHashCache(
            TestProjectFilesystems.createProjectFilesystem(tmpDir.getRoot()),
            FileHashCacheMode.DEFAULT);
    FileHashLoader hashLoader = new StackedFileHashCache(ImmutableList.of(hashCache));

    RuleKey defaultKey1 =
        new DefaultRuleKeyFactory(0, hashLoader, resolver, ruleFinder).build(buildRule);
    RuleKey inputKey1 =
        new InputBasedRuleKeyFactory(0, hashLoader, resolver, ruleFinder).build(buildRule);

    Files.write(file1, "hello other world".getBytes());
    hashCache.invalidateAll();

    RuleKey defaultKey2 =
        new DefaultRuleKeyFactory(0, hashLoader, resolver, ruleFinder).build(buildRule);
    RuleKey inputKey2 =
        new InputBasedRuleKeyFactory(0, hashLoader, resolver, ruleFinder).build(buildRule);

    // When the file content changes, the rulekey should change but the input rulekey should be
    // unchanged. This ensures that a dependent's rulekey changes correctly.
    assertNotEquals(defaultKey1, defaultKey2);
    assertEquals(inputKey1, inputKey2);
  }
}


text:
Miscellaneous Tools by 330k

## Unicode Steganography with Zero-Width Characters
http://330k.github.io/misc_tools/unicode_steganography.html

## Show KML Layer on Google Maps Gadget for Google Sites
http://330k.github.io/misc_tools/kmlmap_gadget.xml

Usage:

1. Go to Google Sites
2. Create new page or edit page
3. Insert external gadget from URL
4. Disignate the above URL
5. Input the URL to kml file to show
6. Done!


text:
(function() {
    "use strict";

    var currentTime = new Date();

    var futureOpTime = new Timestamp((currentTime / 1000 + 3600), 0);

    assert.commandFailedWithCode(
        db.runCommand(
            {find: 'user', filter: {x: 1}, readConcern: {afterOpTime: {ts: futureOpTime, t: 0}}}),
        ErrorCodes.NotAReplicaSet);
})();


text:
package timeBench.ui.actions;

import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.ImageIcon;
import javax.swing.KeyStroke;

import timeBench.action.layout.timescale.BasicTimeScale;

/**
 * Zooms a {@link BasicTimeScale}.
 *
 * @author peterw
 *
 */
public class ZoomAction extends AbstractTimeScaleAction {

    private static final long serialVersionUID = 9141377613407077396L;

    private double factor;

	/**
	 *

	 * Create a {@link ZoomAction} that zooms a {@link BasicTimeScale} about the
	 * given factor.
	 *

	 *

	 * Use values smaller than 1 to zoom in and values greater 1 to zoom out.
	 *

	 *
	 * @param factor
	 *            the zoom factor
	 *
	 */
	public ZoomAction(double factor) {
		this(null, factor);
	}

	public ZoomAction(BasicTimeScale timeScale, double factor) {
		super(timeScale);
		this.factor = factor;

		putValue(NAME, "Zoom " + (isZoomIn() ? "In" : "Out"));
		putValue(SMALL_ICON, new ImageIcon(getClass().getClassLoader().getResource(
		        "timeBench/ui/resources/" +
				(isZoomIn() ? "zoomplus_on.gif" : "zoomminus_on.gif"))));
		putValue(ACCELERATOR_KEY, (isZoomIn() ? KeyStroke.getKeyStroke(KeyEvent.VK_UP, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())
				: KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())));
	}

	public boolean isZoomIn() {
		return factor < 1;
	}

	public void actionPerformed(ActionEvent e) {
		if (timeScale != null) {
			timeScale.zoom(factor);
		}
	}
}


text:
class RenameAlternateIdToExternalId < ActiveRecord::Migration[5.0]
  def change
    rename_column :places, :alternate_id, :external_id
  end
end


text:
namespace charm {
namespace mime {

// Returns the MIME type associated with the extension of the given pathname.
std::string getTypeForExtension(const std::experimental::filesystem::path &path);

}  // namespace mime
}  // namespace charm


text:
package com.lenzhao.framework.config;

/**
 *客户端单个服务配置实体
 */
public class ServiceConfig {

	private String name = null;

	private String connectStr = null;

	private String maxConnection = null;

	private boolean async = false;

	public ServiceConfig() {
		super();
	}

	public ServiceConfig(String name, String connectStr, String maxConnection,String async) {
		super();
		this.name = name;
		this.connectStr = connectStr;
		this.maxConnection = maxConnection;
		this.async = "true".equals(async);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getConnectStr() {
		return connectStr;
	}

	public void setConnectStr(String connectStr) {
		this.connectStr = connectStr;
	}

	public String getMaxConnection() {
		return maxConnection;
	}

	public void setMaxConnection(String maxConnection) {
		this.maxConnection = maxConnection;
	}

	public boolean getAsync() {
		return async;
	}

	public void setAsync(boolean async) {
		this.async = async;
	}

}


text:
<?php

namespace AppBundle\Entity\Transaction;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

/**
 * @ORM\Table(name="transaction_purchase_invoice_detail_unit")
 * @ORM\Entity
 */
class PurchaseInvoiceDetailUnit
{
    /**
     * @ORM\Column(type="integer") @ORM\Id @ORM\GeneratedValue
     */
    private $id;
    /**
     * @ORM\Column(type="string", length=20)
     * @Assert\NotBlank()
     */
    private $vehicleChassisNumber;
    /**
     * @ORM\Column(type="string", length=20)
     * @Assert\NotBlank()
     */
    private $vehicleMachineNumber;
    /**
     * @ORM\Column(type="smallint")
     * @Assert\NotNull() @Assert\GreaterThan(0)
     */
    private $quantity;
    /**
     * @ORM\Column(type="decimal", precision=18, scale=2)
     * @Assert\NotNull() @Assert\GreaterThan(0)
     */
    private $unitPrice;
    /**
     * @ORM\Column(type="decimal", precision=18, scale=2)
     * @Assert\NotNull() @Assert\GreaterThanOrEqual(0)
     */
    private $discount;
    /**
     * @ORM\Column(type="decimal", precision=18, scale=2)
     * @Assert\NotNull() @Assert\GreaterThan(0)
     */
    private $total;
    /**
     * @ORM\ManyToOne(targetEntity="PurchaseInvoiceHeader", inversedBy="purchaseInvoiceDetailUnits")
     * @Assert\NotNull()
     */
    private $purchaseInvoiceHeader;
    /**
     * @ORM\OneToOne(targetEntity="PurchaseDeliveryOrder", inversedBy="purchaseInvoiceDetailUnit")
     * @Assert\NotNull()
     */
    private $purchaseDeliveryOrder;

    public function __construct()
    {
    }

    public function getId() { return $this->id; }

    public function getVehicleChassisNumber() { return $this->vehicleChassisNumber; }
    public function setVehicleChassisNumber($vehicleChassisNumber) { $this->vehicleChassisNumber = $vehicleChassisNumber; }

    public function getVehicleMachineNumber() { return $this->vehicleMachineNumber; }
    public function setVehicleMachineNumber($vehicleMachineNumber) { $this->vehicleMachineNumber = $vehicleMachineNumber; }

    public function getQuantity() { return $this->quantity; }
    public function setQuantity($quantity) { $this->quantity = $quantity; }

    public function getUnitPrice() { return $this->unitPrice; }
    public function setUnitPrice($unitPrice) { $this->unitPrice = $unitPrice; }

    public function getDiscount() { return $this->discount; }
    public function setDiscount($discount) { $this->discount = $discount; }

    public function getTotal() { return $this->total; }
    public function setTotal($total) { $this->total = $total; }

    public function getPurchaseInvoiceHeader() { return $this->purchaseInvoiceHeader; }
    public function setPurchaseInvoiceHeader(PurchaseInvoiceHeader $purchaseInvoiceHeader = null) { $this->purchaseInvoiceHeader = $purchaseInvoiceHeader; }

    public function getPurchaseDeliveryOrder() { return $this->purchaseDeliveryOrder; }
    public function setPurchaseDeliveryOrder(PurchaseDeliveryOrder $purchaseDeliveryOrder = null) { $this->purchaseDeliveryOrder = $purchaseDeliveryOrder; }

    public function sync()
    {
        $this->total = $this->quantity * $this->unitPrice - $this->discount;
    }
}


text:
local xmlns_mam     = "urn:xmpp:mam:0";
local xmlns_delay   = "urn:xmpp:delay";
local xmlns_forward = "urn:xmpp:forward:0";

local st = require "util.stanza";
local rsm = module:require "rsm";
local get_prefs = module:require"mamprefs".get;
local set_prefs = module:require"mamprefs".set;
local prefs_to_stanza = module:require"mamprefsxml".tostanza;
local prefs_from_stanza = module:require"mamprefsxml".fromstanza;
local jid_bare = require "util.jid".bare;
local jid_split = require "util.jid".split;
local dataform = require "util.dataforms".new;
local host = module.host;

local rm_load_roster = require "core.rostermanager".load_roster;

local getmetatable = getmetatable;
local function is_stanza(x)
	return getmetatable(x) == st.stanza_mt;
end

local tostring = tostring;
local time_now = os.time;
local m_min = math.min;
local timestamp, timestamp_parse = require "util.datetime".datetime, require "util.datetime".parse;
local default_max_items, max_max_items = 20, module:get_option_number("max_archive_query_results", 50);
local global_default_policy = module:get_option("default_archive_policy", false);
if global_default_policy ~= "roster" then
	global_default_policy = module:get_option_boolean("default_archive_policy", global_default_policy);
end

local archive_store = "archive2";
local archive = module:open_store(archive_store, "archive");
if not archive or archive.name == "null" then
	module:log("error", "Could not open archive storage");
	return;
elseif not archive.find then
	module:log("error", "mod_%s does not support archiving", archive._provided_by);
	return;
end

-- Handle prefs.
module:hook("iq/self/"..xmlns_mam..":prefs", function(event)
	local origin, stanza = event.origin, event.stanza;
	local user = origin.username;
	if stanza.attr.type == "get" then
		local prefs = prefs_to_stanza(get_prefs(user));
		local reply = st.reply(stanza):add_child(prefs);
		origin.send(reply);
	else -- type == "set"
		local new_prefs = stanza:get_child("prefs", xmlns_mam);
		local prefs = prefs_from_stanza(new_prefs);
		local ok, err = set_prefs(user, prefs);
		if not ok then
			origin.send(st.error_reply(stanza, "cancel", "internal-server-error", "Error storing preferences: "..tostring(err)));
		else
			origin.send(st.reply(stanza));
		end
	end
	return true;
end);

local query_form = dataform {
	{ name = "FORM_TYPE"; type = "hidden"; value = xmlns_mam; };
	{ name = "with"; type = "jid-single"; };
	{ name = "start"; type = "text-single" };
	{ name = "end"; type = "text-single"; };
};

-- Serve form
module:hook("iq-get/self/"..xmlns_mam..":query", function(event)
	local origin, stanza = event.origin, event.stanza;
	origin.send(st.reply(stanza):add_child(query_form:form()));
	return true;
end);

-- Handle archive queries
module:hook("iq-set/self/"..xmlns_mam..":query", function(event)
	local origin, stanza = event.origin, event.stanza;
	local query = stanza.tags[1];
	local qid = query.attr.queryid;

	-- Search query parameters
	local qwith, qstart, qend;
	local form = query:get_child("x", "jabber:x:data");
	if form then
		local err;
		form, err = query_form:data(form);
		if err then
			origin.send(st.error_reply(stanza, "modify", "bad-request", select(2, next(err))));
			return true;
		end
		qwith, qstart, qend = form["with"], form["start"], form["end"];
		qwith = qwith and jid_bare(qwith); -- dataforms does jidprep
	end

	if qstart or qend then -- Validate timestamps
		local vstart, vend = (qstart and timestamp_parse(qstart)), (qend and timestamp_parse(qend));
		if (qstart and not vstart) or (qend and not vend) then
			origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid timestamp"))
			return true;
		end
		qstart, qend = vstart, vend;
	end

	module:log("debug", "Archive query, id %s with %s from %s until %s)",
		tostring(qid), qwith or "anyone", qstart or "the dawn of time", qend or "now");

	-- RSM stuff
	local qset = rsm.get(query);
	local qmax = m_min(qset and qset.max or default_max_items, max_max_items);
	local reverse = qset and qset.before or false;
	local before, after = qset and qset.before, qset and qset.after;
	if type(before) ~= "string" then before = nil; end

	-- Load all the data!
	local data, err = archive:find(origin.username, {
		start = qstart; ["end"] = qend; -- Time range
		with = qwith;
		limit = qmax + 1;
		before = before; after = after;
		reverse = reverse;
		total = true;
	});

	if not data then
		origin.send(st.error_reply(stanza, "cancel", "internal-server-error", err));
		return true;
	end
	local total = err;

	origin.send(st.reply(stanza));
	local msg_reply_attr = { to = stanza.attr.from, from = stanza.attr.to };

	local results = {};

	-- Wrap it in stuff and deliver
	local first, last;
	local count = 0;
	local complete = "true";
	for id, item, when in data do
		count = count + 1;
		if count > qmax then
			complete = nil;
			break;
		end
		local fwd_st = st.message(msg_reply_attr)
			:tag("result", { xmlns = xmlns_mam, queryid = qid, id = id })
				:tag("forwarded", { xmlns = xmlns_forward })
					:tag("delay", { xmlns = xmlns_delay, stamp = timestamp(when) }):up();

		if not is_stanza(item) then
			item = st.deserialize(item);
		end
		item.attr.xmlns = "jabber:client";
		fwd_st:add_child(item);

		if not first then first = id; end
		last = id;

		if reverse then
			results[count] = fwd_st;
		else
			origin.send(fwd_st);
		end
	end
	if reverse then
		for i = #results, 1, -1 do
			origin.send(results[i]);
		end
	end

	-- That's all folks!
	module:log("debug", "Archive query %s completed", tostring(qid));

	if reverse then first, last = last, first; end
	origin.send(st.message(msg_reply_attr)
		:tag("fin", { xmlns = xmlns_mam, queryid = qid, complete = complete })
			:add_child(rsm.generate {
				first = first, last = last, count = total }));
	return true;
end);

local function has_in_roster(user, who)
	local roster = rm_load_roster(user, host);
	module:log("debug", "%s has %s in roster? %s", user, who, roster[who] and "yes" or "no");
	return roster[who];
end

local function shall_store(user, who)
	-- TODO Cache this?
	local prefs = get_prefs(user);
	local rule = prefs[who];
	module:log("debug", "%s's rule for %s is %s", user, who, tostring(rule));
	if rule ~= nil then
		return rule;
	else -- Below could be done by a metatable
		local default = prefs[false];
		module:log("debug", "%s's default rule is %s", user, tostring(default));
		if default == nil then
			default = global_default_policy;
			module:log("debug", "Using global default rule, %s", tostring(default));
		end
		if default == "roster" then
			return has_in_roster(user, who);
		end
		return default;
	end
end

-- Handle messages
local function message_handler(event, c2s)
	local origin, stanza = event.origin, event.stanza;
	local orig_type = stanza.attr.type or "normal";
	local orig_from = stanza.attr.from;
	local orig_to = stanza.attr.to or orig_from;
	-- Stanza without 'to' are treated as if it was to their own bare jid

	-- We don't store messages of these types
	if orig_type == "error"
	or orig_type == "headline"
	or orig_type == "groupchat"
	-- or that don't have a <body/>
	or not stanza:get_child("body")
	-- or if hints suggest we shouldn't
	or stanza:get_child("no-permanent-storage", "urn:xmpp:hints") -- The XEP needs to decide on "store" or "storage"
	or stanza:get_child("no-permanent-store", "urn:xmpp:hints")
	or stanza:get_child("no-storage", "urn:xmpp:hints")
	or stanza:get_child("no-store", "urn:xmpp:hints") then
		module:log("debug", "Not archiving stanza: %s (content)", stanza:top_tag());
		return;
	end

	-- Whos storage do we put it in?
	local store_user = c2s and origin.username or jid_split(orig_to);
	-- And who are they chatting with?
	local with = jid_bare(c2s and orig_to or orig_from);

	-- Check with the users preferences
	if shall_store(store_user, with) then
		module:log("debug", "Archiving stanza: %s", stanza:top_tag());

		-- And stash it
		local ok, id = archive:append(store_user, nil, time_now(), with, stanza);
		if ok then
			module:fire_event("archive-message-added", { origin = origin, stanza = stanza, for_user = store_user, id = id });
		end
	else
		module:log("debug", "Not archiving stanza: %s (prefs)", stanza:top_tag());
	end
end

local function c2s_message_handler(event)
	return message_handler(event, true);
end

-- Stanzas sent by local clients
module:hook("pre-message/bare", c2s_message_handler, 2);
module:hook("pre-message/full", c2s_message_handler, 2);
-- Stanszas to local clients
module:hook("message/bare", message_handler, 2);
module:hook("message/full", message_handler, 2);

module:add_feature(xmlns_mam); -- COMPAT with XEP-0313 v 0.1

module:hook("account-disco-info", function(event)
	event.reply:tag("feature", {var=xmlns_mam}):up();
end);


text:
package controlers;

import java.io.File;
import java.io.FileNotFoundException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;

import org.apache.maven.shared.invoker.MavenInvocationException;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;

import Exceptions.UnTestableException;
import models.log;

public class commanderJunit extends abstractCommander{

	public commanderJunit(String COMPILER_PATH) {
		super(COMPILER_PATH);
	}

	private  URLClassLoader classLoader;

	private  List<String> findTestFolder(String path) {
		File[] files = new File(path).listFiles();
		List<String> pathToSources = new ArrayList<String>();
		for (File f : files) {
			if (f.isDirectory())
				pathToSources.addAll(findTestFolder(f.getAbsolutePath()));
			else if (f.getName().endsWith(".java"))
				pathToSources.add(f.getAbsolutePath());
		}

		return pathToSources;
	}

	private  String convertToClassName(String file) {
		String pattern = Pattern.quote(File.separator);
		int ind = file.split(pattern).length;
		return file.split(pattern)[ind-2] + "." + file.split(pattern)[ind -1].replace(".java", "");
	}

	private  List<String> findJavaFiles(String path) throws UnTestableException{
		File[] files = new File(path).listFiles();
		List<String> pathToSources = new ArrayList<String>();
		if(files == null) throw new UnTestableException();
		for(File f : files){
			if(f.isDirectory())
				pathToSources.addAll(findJavaFiles(f.getAbsolutePath()));
			else if(f.getName().endsWith(".java"))
				pathToSources.add(f.getAbsolutePath());
		}
		return pathToSources;
	}

	@Override
	public log cleanCompileTest() throws Exception {

		log mylog = new log();
		JUnitCore junit = new JUnitCore();
		JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();

		List<String> listSourceFiles = findJavaFiles(this.tmpFolder + "src/main/java");
		List<String> listTestFiles = findJavaFiles(this.tmpFolder + "src/test/java");

		for(String file : listSourceFiles){
				System.out.println(file);
				compiler.run(null, null, null, file);
		}
		for(String file : listTestFiles) {
			System.out.println(file);
			compiler.run(null, null, null, "-cp",  this.COMPILER_PATH +":" + this.tmpFolder + "src/main/java", file);
		}

		classLoader = URLClassLoader.newInstance(new URL[] {
				new File(this.tmpFolder + "src/main/java/").toURI().toURL(), new File(this.tmpFolder +"src/test/java/").toURI().toURL()
		});

	      try {
	  		for(String file : listSourceFiles)
	    		  Class.forName(convertToClassName(file), true, classLoader);
	  		for(String file : listTestFiles){

	  			Result results = junit.run(Class.forName(convertToClassName(file), true, classLoader));
	  			mylog.failure += results.getFailures().size();
	  		}
	       }
	       catch(Exception e) {
	    	   e.printStackTrace();
	          System.out.println("Impossible d'instancier la classe");
	       }
	      return mylog;
	}

	@Override
	public log nbFailure(String ProjectPath) throws FileNotFoundException, UnTestableException {
		return null;
	}

}


text:
debug:
	bundle exec jekyll serve --incremental


text:
package net.adswitcher.adapter.imobile;

import android.app.Activity;
import android.os.Handler;
import android.util.Log;
import android.widget.FrameLayout;

import net.adswitcher.adapter.BannerAdAdapter;
import net.adswitcher.adapter.BannerAdListener;
import net.adswitcher.adapter.BannerAdSize;
import net.adswitcher.adapter.InterstitialAdAdapter;
import net.adswitcher.adapter.InterstitialAdListener;

import java.util.Map;

import jp.co.imobile.sdkads.android.FailNotificationReason;
import jp.co.imobile.sdkads.android.ImobileSdkAd;
import jp.co.imobile.sdkads.android.ImobileSdkAdListener;

/**
 * Created by tkyaji on 2016/08/09.
 */
public class IMobileAdapter extends ImobileSdkAdListener implements BannerAdAdapter, InterstitialAdAdapter {

    private static final String TAG = "IMobileAdapter";

    private Activity activity;
    private String spotId;
    private BannerAdListener bannerAdListener;
    private InterstitialAdListener interstitialAdListener;
    private FrameLayout adView;
    private boolean isLoaded;

    @Override
    public void bannerAdInitialize(Activity activity, BannerAdListener bannerAdListener, Map<String, String> parameters, boolean testMode, BannerAdSize adSize) {

        this.activity = activity;
        this.bannerAdListener = bannerAdListener;

        String partnerId = parameters.get("partner_id");
        String mediaId = parameters.get("media_id");
        this.spotId = parameters.get("spot_id");

        ImobileSdkAd.setTestMode(testMode);
        ImobileSdkAd.registerSpotInline(activity, partnerId, mediaId, this.spotId);
        ImobileSdkAd.setImobileSdkAdListener(this.spotId, this);
        ImobileSdkAd.start(this.spotId);
    }

    @Override
    public void bannerAdLoad() {
        Log.d(TAG, "bannerAdLoad");

        this.adView = new FrameLayout(this.activity);
        ImobileSdkAd.showAd(this.activity, this.spotId, this.adView);

        if (this.isLoaded) {
            this.bannerAdListener.bannerAdReceived(this, true);

        } else {
            this.adLoad(1);
        }
    }

    @Override
    public void bannerAdShow(FrameLayout frameLayout) {
        frameLayout.addView(this.adView);
    }

    @Override
    public void bannerAdHide() {
        ((FrameLayout)this.adView.getParent()).removeView(this.adView);
        this.adView = null;
        this.isLoaded = false;
    }

    @Override
    public void interstitialAdInitialize(Activity activity, InterstitialAdListener interstitialAdListener, Map<String, String> parameters, boolean testMode) {

        this.activity = activity;
        this.interstitialAdListener = interstitialAdListener;

        String partnerId = parameters.get("partner_id");
        String mediaId = parameters.get("media_id");
        this.spotId = parameters.get("spot_id");

        Log.d(TAG, "interstitialAdInitialize : partner_id=" + partnerId + ", media_id=" + mediaId + ", spot_id=" + this.spotId);

        ImobileSdkAd.setTestMode(testMode);
        ImobileSdkAd.registerSpotFullScreen(activity, partnerId, mediaId, this.spotId);
        ImobileSdkAd.setImobileSdkAdListener(this.spotId, this);
        ImobileSdkAd.start(this.spotId);
    }

    @Override
    public void interstitialAdLoad() {
        Log.d(TAG, "interstitialAdLoad");

        if (this.isLoaded) {
            this.interstitialAdListener.interstitialAdLoaded(this, true);

        } else {
            this.adLoad(1);
        }
    }

    @Override
    public void interstitialAdShow() {
        Log.d(TAG, "interstitialAdShow");
        ImobileSdkAd.showAd(this.activity, this.spotId);
        this.interstitialAdListener.interstitialAdShown(this);
    }

    @Override
    public void onAdReadyCompleted() {
        super.onAdReadyCompleted();

        if (this.bannerAdListener != null) {
            Log.d(TAG, "banner onAdReadyCompleted");
            this.isLoaded = true;
        }
        if (this.interstitialAdListener != null) {
            Log.d(TAG, "interstitial onAdReadyCompleted");
            this.isLoaded = true;
        }
    }

    @Override
    public void onFailed(FailNotificationReason failNotificationReason) {
        super.onFailed(failNotificationReason);

        if (this.bannerAdListener != null) {
            Log.d(TAG, "banner onFailed : reson=" + failNotificationReason);
        }
        if (this.interstitialAdListener != null) {
            Log.d(TAG, "interstitial onFailed : reson=" + failNotificationReason);
        }
    }

    @Override
    public void onAdCliclkCompleted() {
        super.onAdCliclkCompleted();
        if (this.bannerAdListener != null) {
            Log.d(TAG, "banner onAdCliclkCompleted");
            this.bannerAdListener.bannerAdClicked(this);
        }
        if (this.interstitialAdListener != null) {
            Log.d(TAG, "interstitial onAdCliclkCompleted");
            this.interstitialAdListener.interstitialAdClicked(this);
        }
    }

    @Override
    public void onAdCloseCompleted() {
        super.onAdCloseCompleted();

        this.isLoaded = false;
        if (this.interstitialAdListener != null) {
            Log.d(TAG, "interstitial onAdCloseCompleted");
            this.interstitialAdListener.interstitialAdClosed(this, true, false);
        }
    }

    private void adLoad(final int count) {
        Log.d(TAG, "adLoad : count=" + count);

        (new Handler()).postDelayed(new Runnable() {
            @Override
            public void run() {
                if (IMobileAdapter.this.isLoaded) {
                    IMobileAdapter.this.activity.runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            if (IMobileAdapter.this.bannerAdListener != null) {
                                IMobileAdapter.this.bannerAdListener.bannerAdReceived(IMobileAdapter.this, true);
                            }
                            if (IMobileAdapter.this.interstitialAdListener != null) {
                                IMobileAdapter.this.interstitialAdListener.interstitialAdLoaded(IMobileAdapter.this, true);
                            }
                        }
                    });
                } else if (count == 3) {
                    IMobileAdapter.this.activity.runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            if (IMobileAdapter.this.bannerAdListener != null) {
                                IMobileAdapter.this.bannerAdListener.bannerAdReceived(IMobileAdapter.this, false);
                            }
                            if (IMobileAdapter.this.interstitialAdListener != null) {
                                IMobileAdapter.this.interstitialAdListener.interstitialAdLoaded(IMobileAdapter.this, false);
                            }
                        }
                    });
                } else {
                    IMobileAdapter.this.adLoad(count + 1);
                }
            }
        }, 1000);
    }
}


text:
seedit.ui.layout
================

Common page layout


text:
// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @file LivelinessSubscriber.cpp
 *
 */

#include "LivelinessSubscriber.h"
#include <fastrtps/participant/Participant.h>
#include <fastrtps/attributes/ParticipantAttributes.h>
#include <fastrtps/attributes/SubscriberAttributes.h>
#include <fastrtps/subscriber/Subscriber.h>
#include <fastrtps/Domain.h>

using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::rtps;

LivelinessSubscriber::LivelinessSubscriber()
    : participant_(nullptr)
    , subscriber_(nullptr)
{
}

bool LivelinessSubscriber::init(
        LivelinessQosPolicyKind kind,
        int liveliness_ms)
{
    ParticipantAttributes PParam;
    PParam.rtps.builtin.discovery_config.discoveryProtocol = DiscoveryProtocol::SIMPLE;
    PParam.rtps.builtin.discovery_config.use_SIMPLE_EndpointDiscoveryProtocol = true;
    PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter = true;
    PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationWriterANDSubscriptionReader = true;
    PParam.rtps.builtin.use_WriterLivelinessProtocol = true;
    PParam.rtps.setName("Participant_sub");
    participant_ = Domain::createParticipant(PParam, &part_listener_);
    if (participant_ == nullptr)
    {
        return false;
    }
    Domain::registerType(participant_, &type_);

    SubscriberAttributes Rparam;
    Rparam.topic.topicKind = NO_KEY;
    Rparam.topic.topicDataType = "Topic";
    Rparam.topic.topicName = "Name";
    Rparam.topic.historyQos.depth = 30;
    Rparam.topic.historyQos.kind = KEEP_LAST_HISTORY_QOS;
    Rparam.qos.m_durability.kind = TRANSIENT_LOCAL_DURABILITY_QOS;
    Rparam.qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS;
    Rparam.qos.m_liveliness.lease_duration = Duration_t(liveliness_ms * 1e-3);
    Rparam.qos.m_liveliness.announcement_period = Duration_t(liveliness_ms * 1e-3 * 0.5);
    Rparam.qos.m_liveliness.kind = kind;
    subscriber_ = Domain::createSubscriber(participant_, Rparam, &listener_);
    if (subscriber_ == nullptr)
    {
        return false;
    }
    return true;
}

LivelinessSubscriber::~LivelinessSubscriber()
{
    // TODO Auto-generated destructor stub
    Domain::removeParticipant(participant_);
}

void LivelinessSubscriber::SubListener::onSubscriptionMatched(
        Subscriber* /*sub*/,
        MatchingInfo& info)
{
    if (info.status == MATCHED_MATCHING)
    {
        n_matched++;
        std::cout << "Subscriber matched" << std::endl;
    }
    else
    {
        n_matched--;
        std::cout << "Subscriber unmatched" << std::endl;
    }
}

void LivelinessSubscriber::SubListener::onNewDataMessage(
        Subscriber* sub)
{
    if (sub->takeNextData((void*)&topic, &m_info))
    {
        if (m_info.sampleKind == ALIVE)
        {
            this->n_samples++;

            std::cout << "Message with index " << topic.index() << " RECEIVED" << std::endl;
        }
    }
}

void LivelinessSubscriber::SubListener::on_liveliness_changed(
        Subscriber* sub,
        const LivelinessChangedStatus& status)
{
    (void)sub;

    if (status.alive_count_change == 1)
    {
        std::cout << "Publisher " << status.last_publication_handle << " recovered liveliness" << std::endl;
    }
    else if (status.not_alive_count_change == 1)
    {
        std::cout << "Publisher " << status.last_publication_handle << " lost liveliness" << std::endl;
    }
}

void LivelinessSubscriber::run()
{
    std::cout << "Subscriber running. Please press enter to stop the Subscriber" << std::endl;
    std::cin.ignore();
}

void LivelinessSubscriber::run(
        uint32_t number)
{
    std::cout << "Subscriber running until " << number << "samples have been received" << std::endl;

    while (number > this->listener_.n_samples)
    {
        std::this_thread::sleep_for(std::chrono::milliseconds(500));
    }
}

void LivelinessSubscriber::PartListener::onParticipantDiscovery(
        Participant* participant,
        rtps::ParticipantDiscoveryInfo&& info)
{
    (void)participant;

    if (info.status == rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT)
    {
        std::cout << "Participant discovered" << std::endl;
    }
    else if (info.status == rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT)
    {
        std::cout << "Participant dropped" << std::endl;
    }
    else if (info.status == rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT)
    {
        std::cout << "Participant removed" << std::endl;
    }
}


text:
<?php

namespace Gems\HL7\Segment;

use Gems\HL7\Test\TestAbstract;
use const TEST_DIR;

/**
 * Generated by PHPUnit_SkeletonGenerator on 2016-02-25 at 08:38:48.
 */
class PV1SegmentTest extends TestAbstract
{

    /**
     * @var PV1Segment
     */
    protected $object;

    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     */
    protected function setUp()
    {
        parent::setUp();

        $file         = TEST_DIR . '/resources/orm.txt';
        $message      = $this->_getMessageFromFile($file);
        $pv1s         = $message->getSegmentsByName('PV1');
        $this->object = $pv1s[0];
    }

    /**
     * @covers Gems\HL7\Segment\PV1Segment::getSetId
     */
    public function testGetSetId()
    {
        $this->assertEquals(1, $this->object->getSetId());
    }

    /**
     * @covers Gems\HL7\Segment\PV1Segment::getPatientClass
     */
    public function testGetPatientClass()
    {
        $this->assertEquals('I', $this->object->getPatientClass());
    }

    /**
     * @covers Gems\HL7\Segment\PV1Segment::getPatientLocation()
     */
    public function testGetPatientLocation()
    {
        $location = $this->object->getPatientLocation();
        $expected = "4ZOB^SK4166^01";
        $this->assertEquals($expected, (string) $this->object->getPatientLocation());
    }

    /**
     * @covers Gems\HL7\Segment\PV1Segment::getAdmissionType()
     */
    public function testGetAdmissionType()
    {
        $this->assertEquals('R', $this->object->getAdmissionType());
    }

}


text:
State Machine is a Sketch plugin. Installing it will allow you to use ⌃⌘S to switch an active tab on a tab bar you're designing, an active navigation section in a menu, or a page number in a pagination control.

#### Read more

* [In english]
* [По-русски]

[In english]: https://medium.com/@romanshamin/3337b8776b49
[По-русски]: https://medium.com/@romanshamin/bb453f46a788

### Install

1. Download and unzip [the latest version].
2. Double click `State-Machine.sketchplugin`.
3. Download [Examples.sketch] to understand State Machine better and play with examples a little bit.

[the latest version]: https://github.com/romashamin/statemachine-sketch/archive/master.zip
[Examples.sketch]: https://cdn.rawgit.com/romashamin/statemachine-sketch/master/Examples.sketch

### System Requirements

State Machine has been tested on Sketch 39.1 (31720) on OS X Yosemite. If you have any problems, drop me a line: [@romanshamin].

[@romanshamin]: https://twitter.com/romanshamin

### Satisfied Pro?

If you're a professional web designer or a developer and State Machine saves your time, buy me a cup of pu-erh tea to say 'thanks': [pay $3 by PayPal].

[pay $3 by PayPal]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RRJZJRBE6SS46

### Thanks


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Claims;
using System.Security.Cryptography;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.OAuth;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using WebApplication.Models;
using WebApplication.Providers;
using WebApplication.Results;

namespace WebApplication.Controllers.api
{
	[Authorize]
	[RoutePrefix("api/Account")]
	public class AccountController : ApiController
	{
		private const string LocalLoginProvider = "Local";

		public AccountController()
			: this(Startup.UserManagerFactory(), Startup.OAuthOptions.AccessTokenFormat)
		{
		}

		public AccountController(UserManager<ApplicationUser> userManager,
			ISecureDataFormat<AuthenticationTicket> accessTokenFormat)
		{
			UserManager = userManager;
			AccessTokenFormat = accessTokenFormat;
		}

		public UserManager<ApplicationUser> UserManager { get; private set; }
		public ISecureDataFormat<AuthenticationTicket> AccessTokenFormat { get; private set; }

		// GET api/Account/UserInfo
		[HostAuthentication(DefaultAuthenticationTypes.ExternalBearer)]
		[Route("UserInfo")]
		public UserInfoViewModel GetUserInfo()
		{
			ApplicationUser user = UserManager.FindById(User.Identity.GetUserId());
			ExternalLoginData externalLogin = null;
			if (User.Identity is ClaimsIdentity)
				externalLogin = ExternalLoginData.FromIdentity(User.Identity as ClaimsIdentity);
			return new UserInfoViewModel
			{
				UserName = user.UserName,
				HasRegistered = externalLogin == null,
				LoginProvider = externalLogin != null ? externalLogin.LoginProvider : null,
				Nickname = user.Nickname,
				Level = user.Level,
				TotalItems = user.TotalItems,
				GenerateTime = user.GenerateTime.HasValue ? user.GenerateTime.Value.ToBinary() : 0
			};
		}

		// POST api/Account/Logout
		[Route("Logout")]
		public IHttpActionResult Logout()
		{
			Authentication.SignOut(CookieAuthenticationDefaults.AuthenticationType);
			return Ok();
		}

		// GET api/Account/ManageInfo?returnUrl=%2F&generateState=true
		[Route("ManageInfo")]
		public async Task<ManageInfoViewModel> GetManageInfo(string returnUrl, bool generateState = false)
		{
			ApplicationUser user = await UserManager.FindByIdAsync(User.Identity.GetUserId());

			if (user == null)
			{
				return null;
			}

			List<UserLoginInfoViewModel> logins = new List<UserLoginInfoViewModel>();

			foreach (IdentityUserLogin linkedAccount in user.Logins)
			{
				logins.Add(new UserLoginInfoViewModel
				{
					LoginProvider = linkedAccount.LoginProvider,
					ProviderKey = linkedAccount.ProviderKey
				});
			}

			if (user.PasswordHash != null)
			{
				logins.Add(new UserLoginInfoViewModel
				{
					LoginProvider = LocalLoginProvider,
					ProviderKey = user.UserName,
				});
			}

			return new ManageInfoViewModel
			{
				LocalLoginProvider = LocalLoginProvider,
				UserName = user.UserName,
				Logins = logins,
				ExternalLoginProviders = GetExternalLogins(returnUrl, generateState)
			};
		}

		// POST api/Account/ChangePassword
		[Route("ChangePassword")]
		public async Task<IHttpActionResult> ChangePassword(ChangePasswordBindingModel model)
		{
			if (!ModelState.IsValid)
			{
				return BadRequest(ModelState);
			}

			IdentityResult result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword,
				model.NewPassword);
			IHttpActionResult errorResult = GetErrorResult(result);

			if (errorResult != null)
			{
				return errorResult;
			}

			return Ok();
		}

		// POST api/Account/SetPassword
		[Route("SetPassword")]
		public async Task<IHttpActionResult> SetPassword(SetPasswordBindingModel model)
		{
			if (!ModelState.IsValid)
			{
				return BadRequest(ModelState);
			}

			IdentityResult result = await UserManager.AddPasswordAsync(User.Identity.GetUserId(), model.NewPassword);
			IHttpActionResult errorResult = GetErrorResult(result);

			if (errorResult != null)
			{
				return errorResult;
			}

			return Ok();
		}

		// POST api/Account/AddExternalLogin
		[Route("AddExternalLogin")]
		public async Task<IHttpActionResult> AddExternalLogin(AddExternalLoginBindingModel model)
		{
			if (!ModelState.IsValid)
			{
				return BadRequest(ModelState);
			}

			Authentication.SignOut(DefaultAuthenticationTypes.ExternalCookie);

			AuthenticationTicket ticket = AccessTokenFormat.Unprotect(model.ExternalAccessToken);

			if (ticket == null || ticket.Identity == null || (ticket.Properties != null
				&& ticket.Properties.ExpiresUtc.HasValue
				&& ticket.Properties.ExpiresUtc.Value < DateTimeOffset.UtcNow))
			{
				return BadRequest("External login failure.");
			}

			ExternalLoginData externalData = ExternalLoginData.FromIdentity(ticket.Identity);

			if (externalData == null)
			{
				return BadRequest("The external login is already associated with an account.");
			}

			IdentityResult result = await UserManager.AddLoginAsync(User.Identity.GetUserId(),
				new UserLoginInfo(externalData.LoginProvider, externalData.ProviderKey));

			IHttpActionResult errorResult = GetErrorResult(result);

			if (errorResult != null)
			{
				return errorResult;
			}

			return Ok();
		}

		// POST api/Account/RemoveLogin
		[Route("RemoveLogin")]
		public async Task<IHttpActionResult> RemoveLogin(RemoveLoginBindingModel model)
		{
			if (!ModelState.IsValid)
			{
				return BadRequest(ModelState);
			}

			IdentityResult result;

			if (model.LoginProvider == LocalLoginProvider)
			{
				result = await UserManager.RemovePasswordAsync(User.Identity.GetUserId());
			}
			else
			{
				result = await UserManager.RemoveLoginAsync(User.Identity.GetUserId(),
					new UserLoginInfo(model.LoginProvider, model.ProviderKey));
			}

			IHttpActionResult errorResult = GetErrorResult(result);

			if (errorResult != null)
			{
				return errorResult;
			}

			return Ok();
		}

		// http://stackoverflow.com/a/21358918/361100 참고.
		// GET api/Account/ExternalLogin
		[OverrideAuthentication]
		[HostAuthentication(DefaultAuthenticationTypes.ExternalCookie)]
		[AllowAnonymous]
		[Route("ExternalLogin", Name = "ExternalLogin")]
		public async Task<IHttpActionResult> GetExternalLogin(string provider, string error = null)
		{
			if (error != null)
			{
				return Redirect(Url.Content("~/") + "#error=" + Uri.EscapeDataString(error));
			}

			if (!User.Identity.IsAuthenticated)
			{
				return new ChallengeResult(provider, this);
			}

			ExternalLoginData externalLogin = ExternalLoginData.FromIdentity(User.Identity as ClaimsIdentity);

			if (externalLogin == null)
			{
				return InternalServerError();
			}

			if (externalLogin.LoginProvider != provider)
			{
				Authentication.SignOut(DefaultAuthenticationTypes.ExternalCookie);
				return new ChallengeResult(provider, this);
			}

			ApplicationUser user = await UserManager.FindAsync(new UserLoginInfo(externalLogin.LoginProvider,
				externalLogin.ProviderKey));

			bool hasRegistered = user != null;

			if (hasRegistered)
			{
				Authentication.SignOut(DefaultAuthenticationTypes.ExternalCookie);
				ClaimsIdentity oAuthIdentity = await UserManager.CreateIdentityAsync(user,
					OAuthDefaults.AuthenticationType);
				ClaimsIdentity cookieIdentity = await UserManager.CreateIdentityAsync(user,
					CookieAuthenticationDefaults.AuthenticationType);
				AuthenticationProperties properties = ApplicationOAuthProvider.CreateProperties(user.UserName);
				Authentication.SignIn(properties, oAuthIdentity, cookieIdentity);
			}
			else
			{
				IEnumerable<Claim> claims = externalLogin.GetClaims();
				ClaimsIdentity identity = new ClaimsIdentity(claims, OAuthDefaults.AuthenticationType);
				Authentication.SignIn(identity);
			}

			return Ok();
		}

		// GET api/Account/ExternalLogins?returnUrl=%2F&generateState=true
		[AllowAnonymous]
		[Route("ExternalLogins")]
		public IEnumerable<ExternalLoginViewModel> GetExternalLogins(string returnUrl, bool generateState = false)
		{
			IEnumerable<AuthenticationDescription> descriptions = Authentication.GetExternalAuthenticationTypes();
			List<ExternalLoginViewModel> logins = new List<ExternalLoginViewModel>();

			string state;

			if (generateState)
			{
				const int strengthInBits = 256;
				state = RandomOAuthStateGenerator.Generate(strengthInBits);
			}
			else
			{
				state = null;
			}

			foreach (AuthenticationDescription description in descriptions)
			{
				ExternalLoginViewModel login = new ExternalLoginViewModel
				{
					Name = description.Caption,
					Url = Url.Route("ExternalLogin", new
					{
						provider = description.AuthenticationType,
						response_type = "token",
						client_id = Startup.PublicClientId,
						redirect_uri = new Uri(Request.RequestUri, returnUrl).AbsoluteUri,
						state = state
					}),
					State = state
				};
				logins.Add(login);
			}

			return logins;
		}

		// POST api/Account/Register
		[AllowAnonymous]
		[Route("Register")]
		public async Task<IHttpActionResult> Register(RegisterBindingModel model)
		{
			if (!ModelState.IsValid)
			{
				return BadRequest(ModelState);
			}

			ApplicationUser user = new ApplicationUser
			{
				UserName = model.UserName
			};

			IdentityResult result = await UserManager.CreateAsync(user, model.Password);
			IHttpActionResult errorResult = GetErrorResult(result);

			if (errorResult != null)
			{
				return errorResult;
			}

			return Ok();
		}

		// POST api/Account/RegisterExternal
		[OverrideAuthentication]
		[HostAuthentication(DefaultAuthenticationTypes.ExternalBearer)]
		[Route("RegisterExternal")]
		public async Task<IHttpActionResult> RegisterExternal(RegisterExternalBindingModel model)
		{
			if (!ModelState.IsValid)
			{
				return BadRequest(ModelState);
			}

			ExternalLoginData externalLogin = ExternalLoginData.FromIdentity(User.Identity as ClaimsIdentity);

			if (externalLogin == null)
			{
				return InternalServerError();
			}

			ApplicationUser user = new ApplicationUser
			{
				UserName = model.UserName,
				GenerateTime = DateTime.UtcNow
			};
			user.Logins.Add(new IdentityUserLogin
			{
				LoginProvider = externalLogin.LoginProvider,
				ProviderKey = externalLogin.ProviderKey
			});
			IdentityResult result = await UserManager.CreateAsync(user);
			IHttpActionResult errorResult = GetErrorResult(result);

			if (errorResult != null)
			{
				return errorResult;
			}

			return Ok();
		}

		// POST api/Account/FacebookLogin
		[HttpPost]
		[AllowAnonymous]
		[Route("FacebookLogin")]
		public async Task<IHttpActionResult> FacebookLogin([FromBody] FacebookLoginModel model)
		{
			string log = String.Empty;
			// http://thewayofcode.wordpress.com/2014/03/01/asp-net-webapi-identity-system-how-to-login-with-facebook-access-token/

			if (!ModelState.IsValid)
			{
				return BadRequest(ModelState);
			}

			if (string.IsNullOrEmpty(model.token))
			{
				return BadRequest("No access token");
			}

			var tokenExpirationTimeSpan = Startup.OAuthOptions.AccessTokenExpireTimeSpan;
			ApplicationUser user = null;
			string username;
			// Get the fb access token and make a graph call to the /me endpoint
			var fbUser = await VerifyFacebookAccessToken(model.token);
			if (fbUser == null)
			{
				return BadRequest("Invalid OAuth access token");
			}

			UserLoginInfo loginInfo = new UserLoginInfo("Facebook", model.userid);
			user = await UserManager.FindAsync(loginInfo);

			//var loginInfo = await HttpContext.Current.GetOwinContext().Authentication.GetExternalLoginInfoAsync("XsrfId", userid);
			// If not, register it
			if (user == null)
			{
				if (String.IsNullOrEmpty(model.username))
					return BadRequest("unregistered user");

				log += "  1";
				user = new ApplicationUser
				{
					UserName = model.username,
					GenerateTime = DateTime.UtcNow
				};

				var result = await UserManager.CreateAsync(user);
				if (result.Succeeded)
				{
					result = await UserManager.AddLoginAsync(user.Id, loginInfo);
					username = model.username;
					if (!result.Succeeded)
						return BadRequest("cannot add facebook login");
					log += "  2";
				}
				else
				{
					return BadRequest("cannot create user");
				}

				//var randomPassword = System.Web.Security.Membership.GeneratePassword(10, 5);
				//user = await RegisterUserAsync(fbUser.Username, randomPassword, fbUser.ID);
				//var customer = await RegisterCustomerAsync(fbUser.FirstName, fbUser.LastName, fbUser.Email, user);
			}
			else
			{
				// 이미 있는 유저.
				username = user.UserName;
				log += "  3";
			}

			// 공통 프로세스: 페이스북 클레임 업데이트, 로그인 토큰 생성

			// Check if the user is already registered
			user = await UserManager.FindByNameAsync(username);

			// 자동 이메일 인증.
			user.Email = fbUser.email;
			user.EmailConfirmed = true;
			await UserManager.UpdateAsync(user);

			// Sign-in the user using the OWIN flow
			var identity = await UserManager.CreateIdentityAsync(user, Startup.OAuthBearerOptions.AuthenticationType);

			//identity.AddClaim(new Claim("FacebookAccessToken", model.token));
			//identity.AddClaim(new Claim(ClaimTypes.Name, user.UserName, null, "Facebook"));
			//// This is very important as it will be used to populate the current user id
			//// that is retrieved with the User.Identity.GetUserId() method inside an API Controller
			//identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.Id, null, "LOCAL_AUTHORITY"));

			var claims = await UserManager.GetClaimsAsync(user.Id);
			var newClaim = new Claim("FacebookAccessToken", model.token);
			var oldClaim = claims.FirstOrDefault(c => c.Type.Equals("FacebookAccessToken"));
			if (oldClaim == null)
			{
				var claimResult = await UserManager.AddClaimAsync(user.Id, newClaim);
				if (!claimResult.Succeeded)
					return BadRequest("cannot add claims");
				log += "  4";

			}
			else
			{
				await UserManager.RemoveClaimAsync(user.Id, oldClaim);
				await UserManager.AddClaimAsync(user.Id, newClaim);
				log += "  5";
			}

			AuthenticationProperties properties = ApplicationOAuthProvider.CreateProperties(user.UserName);
			var currentUtc = new Microsoft.Owin.Infrastructure.SystemClock().UtcNow;
			properties.IssuedUtc = currentUtc;
			properties.ExpiresUtc = currentUtc.Add(tokenExpirationTimeSpan);
			AuthenticationTicket ticket = new AuthenticationTicket(identity, properties);

			var accesstoken = Startup.OAuthBearerOptions.AccessTokenFormat.Protect(ticket);
			Request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", accesstoken);
			Authentication.SignIn(identity);

			// Create the response building a JSON object that mimics exactly the one issued by the default /Token endpoint
			JObject blob = new JObject(
				new JProperty("userName", user.UserName),
				new JProperty("access_token", accesstoken),
				new JProperty("token_type", "bearer"),
				new JProperty("expires_in", tokenExpirationTimeSpan.TotalSeconds.ToString()),
				new JProperty(".issued", ticket.Properties.IssuedUtc.ToString()),
				new JProperty(".expires", ticket.Properties.ExpiresUtc.ToString()),
				new JProperty("model.token", model.token),
				new JProperty("log", log)
			);
			// Return OK
			return Ok(blob);
		}

		//private async Task<ClaimsIdentity> StoreFacebookAuthToken(ApplicationUser user)
		//{
		//	var claimsIdentity = await AuthenticationManager.GetExternalIdentityAsync(DefaultAuthenticationTypes.ExternalCookie);
		//	if (claimsIdentity != null)
		//	{
		//		// Retrieve the existing claims for the user and add the FacebookAccessTokenClaim
		//		var currentClaims = await UserManager.GetClaimsAsync(user.Id);
		//		var hasFacebook = claimsIdentity.FindAll("FacebookAccessToken");
		//		if (hasFacebook != null && hasFacebook.Any())
		//		{
		//			var facebookAccessToken = claimsIdentity.FindAll("FacebookAccessToken").First();
		//			if (!currentClaims.Any())
		//			{
		//				await UserManager.AddClaimAsync(user.Id, facebookAccessToken);
		//			}
		//		}
		//	}
		//}

		private async Task<FacebookUserViewModel> VerifyFacebookAccessToken(string accessToken)
		{
			FacebookUserViewModel fbUser = null;
			var path = "https://graph.facebook.com/me?access_token=" + accessToken;
			var client = new HttpClient();
			var uri = new Uri(path);
			var response = await client.GetAsync(uri);
			if (response.IsSuccessStatusCode)
			{
				var content = await response.Content.ReadAsStringAsync();
				fbUser = Newtonsoft.Json.JsonConvert.DeserializeObject<FacebookUserViewModel>(content);
			}
			return fbUser;
		}

		/// <summary>
		/// Facebook 서버와 통신해서 받는 기본 프로필 정보.
		/// </summary>
		public class FacebookUserViewModel
		{
			public string id { get; set; }
			public string first_name { get; set; }
			public string last_name { get; set; }
			public string username { get; set; }
			public string email { get; set; }
		}

		/// <summary>
		/// Facebook 로그인할 때 클라이언트로부터 받는 정보.
		/// </summary>
		public class FacebookLoginModel
		{
			//[JsonProperty("id")]
			public string token { get; set; }
			//[JsonProperty("first_name")]
			public string username { get; set; }
			//[JsonProperty("last_name")]
			public string userid { get; set; }
		}

		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				UserManager.Dispose();
			}

			base.Dispose(disposing);
		}

		#region Helpers

		private IAuthenticationManager Authentication
		{
			get { return Request.GetOwinContext().Authentication; }
		}

		private IHttpActionResult GetErrorResult(IdentityResult result)
		{
			if (result == null)
			{
				return InternalServerError();
			}

			if (!result.Succeeded)
			{
				if (result.Errors != null)
				{
					foreach (string error in result.Errors)
					{
						ModelState.AddModelError("", error);
					}
				}

				if (ModelState.IsValid)
				{
					// No ModelState errors are available to send, so just return an empty BadRequest.
					return BadRequest();
				}

				return BadRequest(ModelState);
			}

			return null;
		}

		private class ExternalLoginData
		{
			public string LoginProvider { get; set; }
			public string ProviderKey { get; set; }
			public string UserName { get; set; }

			public IList<Claim> GetClaims()
			{
				IList<Claim> claims = new List<Claim>();
				claims.Add(new Claim(ClaimTypes.NameIdentifier, ProviderKey, null, LoginProvider));

				if (UserName != null)
				{
					claims.Add(new Claim(ClaimTypes.Name, UserName, null, LoginProvider));
				}

				return claims;
			}

			public static ExternalLoginData FromIdentity(ClaimsIdentity identity)
			{
				if (identity == null)
				{
					return null;
				}

				Claim providerKeyClaim = identity.FindFirst(ClaimTypes.NameIdentifier);

				if (providerKeyClaim == null || String.IsNullOrEmpty(providerKeyClaim.Issuer)
					|| String.IsNullOrEmpty(providerKeyClaim.Value))
				{
					return null;
				}

				if (providerKeyClaim.Issuer == ClaimsIdentity.DefaultIssuer)
				{
					return null;
				}

				return new ExternalLoginData
				{
					LoginProvider = providerKeyClaim.Issuer,
					ProviderKey = providerKeyClaim.Value,
					UserName = identity.FindFirstValue(ClaimTypes.Name)
				};
			}
		}

		private static class RandomOAuthStateGenerator
		{
			private static RandomNumberGenerator _random = new RNGCryptoServiceProvider();

			public static string Generate(int strengthInBits)
			{
				const int bitsPerByte = 8;

				if (strengthInBits % bitsPerByte != 0)
				{
					throw new ArgumentException("strengthInBits must be evenly divisible by 8.", "strengthInBits");
				}

				int strengthInBytes = strengthInBits / bitsPerByte;

				byte[] data = new byte[strengthInBytes];
				_random.GetBytes(data);
				return HttpServerUtility.UrlTokenEncode(data);
			}
		}

		#endregion
	}
}


text:
function print_dcs
{
  print -n -- "\EP$1;\E$2\E\\"
}

function set_cursor_shape
{
  if [ -n "$TMUX" ]; then
    # tmux will only forward escape sequences to the terminal if surrounded by
    # a DCS sequence
    print_dcs tmux "\E]50;CursorShape=$1\C-G"
  else
    print -n -- "\E]50;CursorShape=$1\C-G"
  fi
}

function zle-keymap-select zle-line-init
{
  case $KEYMAP in
    vicmd)
      set_cursor_shape 0 # block cursor
      ;;
    viins|main)
      set_cursor_shape 1 # line cursor
      ;;
  esac
  zle reset-prompt
  zle -R
}

function zle-line-finish
{
  set_cursor_shape 0 # block cursor
}

zle -N zle-line-init
zle -N zle-line-finish
zle -N zle-keymap-select


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:orientation="vertical"
    android:background="#FFFFFF" >

	<TextView
	    android:id="@+id/miandan_status"
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    android:padding="12dp"
	    android:textSize="16sp"
	    android:textColor="#000000"
	    android:text="@string/myresult_searchdate"
	    android:background="@drawable/layoutbottomshadowbackground" />

</LinearLayout>


text:
package com.cloudera.flume.handlers.rpc;

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

import com.cloudera.flume.conf.Context;
import com.cloudera.flume.conf.FlumeConfiguration;
import com.cloudera.flume.conf.SinkFactory.SinkBuilder;
import com.cloudera.flume.core.EventSink;
import com.cloudera.flume.handlers.avro.AvroEventSink;
import com.cloudera.flume.handlers.thrift.ThriftEventSink;

/**
 * This is a sink that is used to send events through an RPC, it either uses
 * Avro or Thrift depending upon the EVENT_RPC_TYPE set in the configuration
 * file.
 */
public class RpcSink extends EventSink.Base {
  public static final Logger LOG = LoggerFactory.getLogger(RpcSink.class);

  /**
   * This class will build an AvroEventSink or ThriftEventSink depending on the
   * value of EVENT_RPC_TYPE set in the configuration file.
   */
  public static SinkBuilder builder() {
    return new SinkBuilder() {
      @Override
      public EventSink build(Context context, String... args) {
        if (args.length > 2) {
          throw new IllegalArgumentException(
              "usage: rpcSink([hostname, [portno]]) ");
        }
        String host = FlumeConfiguration.get().getCollectorHost();
        int port = FlumeConfiguration.get().getCollectorPort();
        if (args.length >= 1) {
          host = args[0];
        }

        if (args.length >= 2) {
          port = Integer.parseInt(args[1]);
        }
        /*
         * I am hoping here that master calls this builder and at that time the
         * FlumeConfiguration is all set.
         */
        if (FlumeConfiguration.get().getEventRPC().equals(
            FlumeConfiguration.RPC_TYPE_THRIFT)) {
          return new ThriftEventSink(host, port);
        }
        if (FlumeConfiguration.get().getEventRPC().equals(
            FlumeConfiguration.RPC_TYPE_AVRO)) {
          return new AvroEventSink(host, port);
        }
        LOG.warn("event.rpc.type not defined.  It should be either"
            + " \"THRIFT\" or \"AVRO\". Defaulting to Thrift");
        return new ThriftEventSink(host, port);
      }
    };
  }
}


text:
package org.onosproject.vpls.api;

import org.onosproject.net.intf.Interface;
import org.onosproject.net.EncapsulationType;

import java.util.Collection;

public interface Vpls {

    /**
     * Creates a new VPLS.
     *
     * @param vplsName the name of the VPLS
     * @param encapsulationType the encapsulation type
     * @return a VPLS instance if the operation is successful; null otherwise
     */
    VplsData createVpls(String vplsName, EncapsulationType encapsulationType);

    /**
     * Removes a VPLS.
     *
     * @param vplsData the VPLS to be removed
     * @return the VPLS removed if the operation is successful; null otherwise
     */
    VplsData removeVpls(VplsData vplsData);

    /**
     * Adds network interfaces to a VPLS.
     *
     * @param vplsData the VPLS to which the interfaces have to be added to
     * @param interfaces the interfaces to add
     */
    void addInterfaces(VplsData vplsData, Collection<Interface> interfaces);

    /**
     * Adds a network interface to a VPLS.
     *
     * @param vplsData the VPLS to which the interface has to be added to
     * @param iface the interface to add
     */
    void addInterface(VplsData vplsData, Interface iface);

    /**
     * Sets an encapsulation type for a VPLS.
     *
     * @param vplsData the VPLS for which the encapsulation has to be set
     * @param encapsulationType the encapsulation type
     */
    void setEncapsulationType(VplsData vplsData, EncapsulationType encapsulationType);

    /**
     * Retrieves a VPLS.
     *
     * @param vplsName the name of the VPLS
     * @return the VPLS instance if the VPLS exists; null otherwise
     */
    VplsData getVpls(String vplsName);

    /**
     * Gets all VPLSs.
     *
     * @return a collection of VPLSs
     */
    Collection<VplsData> getAllVpls();

    /**
     * Removes the interfaces specified from a VPLS.
     *
     * @param vplsData the VPLS from which the interfaces are to be removed
     * @param interfaces the interfaces to remove
     * @return the interfaces removed
     */
    Collection<Interface> removeInterfaces(VplsData vplsData, Collection<Interface> interfaces);

    /**
     * Removes the interface specified from a VPLS.
     *
     * @param vplsData the VPLS from which the interface is to be removed
     * @param iface the interface to remove
     * @return the interface removed
     */
    Interface removeInterface(VplsData vplsData, Interface iface);

    /**
     * Removes all VPLSs and cleans up the VPLS configuration.
     */
    void removeAllVpls();
}


text:
page_type: sample
products:
- office-sp
languages:
- typescript
extensions:
  contentType: samples
  technologies:
  - SharePoint Framework
  createdDate: 8/30/2016 10:21:43 AM
---
# SharePoint Framework Client-Side Web Part Samples & Tutorial Materials

This repository contains community samples that demonstrate different usage patterns for the SharePoint Framework client-side web parts.

> We do welcome community contributions to the samples folder in this repository for demonstrating different use cases with SharePoint Framework. Notice that if you use 3rd party libraries, please make sure that library license allows distributions of it as part of your sample.

SharePoint client-side web parts are controls that appear inside a SharePoint page but run locally in the browser. They're the building blocks of pages that appear on a SharePoint site. You can build client-side web parts using modern script development tools and the SharePoint workbench (a development test surface), and you can deploy your client-side web parts to classic web part pages in Office 365 tenants. In addition to plain JavaScript projects, you can build web parts alongside common scripting frameworks, such as AngularJS and React. For example, you can use React along with components from Office UI Fabric React to quickly create experiences based on the same components used in Office 365.

## Have issues or questions?

Please use following logic on submitting your questions or issues to right location to ensure that they are noticed and addressed as soon as possible.

* You have general question or challenge with SPFx - use [sp-dev-docs repository issue list](https://github.com/SharePoint/sp-dev-docs/issues).
* You have issue on specific web part or sample - use [issue list in this repository](https://github.com/SharePoint/sp-dev-fx-webparts/issues).

## Additional resources

* [Overview of the SharePoint Framework](https://docs.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview)
* [SharePoint Framework development tools and libraries](https://docs.microsoft.com/sharepoint/dev/spfx/tools-and-libraries)
* [Getting Started](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant)

## Using the samples

To build and start using these projects, you'll need to clone and build the projects.

Clone this repository by executing the following command in your console:

```shell
git clone https://github.com/pnp/sp-dev-fx-webparts.git
```

Navigate to the cloned repository folder which should be the same as the repository name:

```shell
cd sp-dev-fx-webparts
```

To access the samples use the following command, where you replace `sample-folder-name` with the name of the sample you want to access.

```shell
cd samples
cd sample-folder-name
```

and for the tutorials, use the following command:

```shell
cd tutorials
```

Now run the following command to install the npm packages:

```shell
npm install
```

This will install the required npm packages and dependencies to build and run the client-side project.

Once the npm packages are installed, run the following command to preview your web parts in SharePoint Workbench:

```shell
gulp serve
```

## Contributions

These samples are direct from the feature teams, SharePoint PnP core team (http://aka.ms/m365pnp) or shared by the community. We welcome your input on issues and suggestions for new samples. We do also welcome community contributions around the client-side web parts. If there's any questions around that, just let us know.

Please have a look on our [Contribution Guidance](./.github/CONTRIBUTING.md) before submitting your pull requests, so that we can get your contribution processed as fast as possible. Thx.

> Sharing is caring!


text:
nuget pack ../NModbus.Serial/NModbus.Serial.nuspec -Properties version="1.0.0"

nuget pack ../NModbus/NModbus.nuspec -Properties version="1.0.0"


text:
package org.apache.ignite.internal.processors.platform.cache.query;

import org.apache.ignite.internal.portable.*;
import org.apache.ignite.internal.processors.cache.query.*;
import org.apache.ignite.internal.processors.platform.*;

import javax.cache.*;

/**
 * Interop cursor for regular queries.
 */
public class PlatformQueryCursor extends PlatformAbstractQueryCursor<Cache.Entry> {
    /**
     * Constructor.
     *
     * @param platformCtx Context.
     * @param cursor Backing cursor.
     * @param batchSize Batch size.
     */
    public PlatformQueryCursor(PlatformContext platformCtx, QueryCursorEx<Cache.Entry> cursor, int batchSize) {
        super(platformCtx, cursor, batchSize);
    }

    /** {@inheritDoc} */
    @Override protected void write(PortableRawWriterEx writer, Cache.Entry val) {
        writer.writeObjectDetached(val.getKey());
        writer.writeObjectDetached(val.getValue());
    }
}


text:
<?php defined('BX_DOL') or die('hack attempt');

/**
 * Create/Edit entry form
 */
class BxGlsrFormEntry extends BxBaseModTextFormEntry
{
    public function __construct($aInfo, $oTemplate = false)
    {
        $this->MODULE = 'bx_glossary';
        parent::__construct($aInfo, $oTemplate);
    }
}

/** @} */


text:
class ScopedCurrentTest
{
public:
   ScopedCurrentTest()
      : m_oldTestResults(UnitTest::CurrentTest::Results())
      , m_oldTestDetails(UnitTest::CurrentTest::Details())
   {}

   explicit ScopedCurrentTest(UnitTest::TestResults& newResults, const UnitTest::TestDetails* newDetails = NULL)
      : m_oldTestResults(UnitTest::CurrentTest::Results())
      , m_oldTestDetails(UnitTest::CurrentTest::Details())
   {
      UnitTest::CurrentTest::Results() = &newResults;

      if (newDetails != NULL)
      {
         UnitTest::CurrentTest::Details() = newDetails;
      }
   }

   ~ScopedCurrentTest()
   {
      UnitTest::CurrentTest::Results() = m_oldTestResults;
      UnitTest::CurrentTest::Details() = m_oldTestDetails;
   }

private:
   UnitTest::TestResults* m_oldTestResults;
   const UnitTest::TestDetails* m_oldTestDetails;
};

#endif


text:
package org.qi4j.library.struts2;

import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.config.ConfigurationManager;
import com.opensymphony.xwork2.config.ContainerProvider;
import com.opensymphony.xwork2.inject.ContainerBuilder;
import com.opensymphony.xwork2.inject.Context;
import com.opensymphony.xwork2.inject.Factory;
import com.opensymphony.xwork2.util.location.LocatableProperties;
import javax.servlet.FilterConfig;
import org.apache.struts2.config.BeanSelectionProvider;
import org.apache.struts2.dispatcher.Dispatcher;
import org.apache.struts2.dispatcher.FilterDispatcher;
import org.qi4j.api.composite.TransientBuilderFactory;
import org.qi4j.api.object.ObjectFactory;
import org.qi4j.api.structure.Module;
import org.qi4j.api.unitofwork.UnitOfWorkFactory;

import static org.qi4j.library.struts2.Constants.SERVLET_ATTRIBUTE;

public class Qi4jFilterDispatcher
    extends FilterDispatcher
{
    @Override
    protected Dispatcher createDispatcher( final FilterConfig filterConfig )
    {
        Dispatcher dispatcher = super.createDispatcher( filterConfig );
        ConfigurationManager configurationManager = createConfigurationManager( filterConfig );
        dispatcher.setConfigurationManager( configurationManager );
        return dispatcher;
    }

    protected ConfigurationManager createConfigurationManager( FilterConfig filterConfig )
    {
        ConfigurationManager configurationManager = new ConfigurationManager( BeanSelectionProvider.DEFAULT_BEAN_NAME );
        configurationManager.addContainerProvider( new Qi4jContainerProvider( module( filterConfig ) ) );
        return configurationManager;
    }

    private Module module( FilterConfig filterConfig )
    {
        return (Module) filterConfig.getServletContext().getAttribute( SERVLET_ATTRIBUTE );
    }

    class Qi4jContainerProvider
        implements ContainerProvider
    {
        private final Module module;
        private boolean registered = false;

        Qi4jContainerProvider( Module aModule )
        {
            module = aModule;
        }

        @Override
        public void register( ContainerBuilder builder, LocatableProperties props )
            throws ConfigurationException
        {
            factory( builder, UnitOfWorkFactory.class, module );
            factory( builder, ObjectFactory.class, module );
            factory( builder, TransientBuilderFactory.class, module );
            factory( builder, ActionConfiguration.class, actionConfiguration() );
            registered = true;
        }

        @Override
        public boolean needsReload()
        {
            return !registered;
        }

        @Override
        public void init( Configuration configuration )
            throws ConfigurationException
        {
        }

        @Override
        public void destroy()
        {
        }

        private <T> void factory( ContainerBuilder builder, Class<T> type, final T value )
        {
            builder.factory( type, new Factory<T>()
            {
                @Override
                public T create( Context context )
                {
                    return value;
                }
            } );
        }

        private ActionConfiguration actionConfiguration()
        {
            return module.findService( ActionService.class ).metaInfo( ActionConfiguration.class );
        }
    }
}


text:
require 'spec_helper'

module SupportEngine
  RSpec.describe Comment, :type => :model do
    context "Validations" do
      it "validates content" do
        comment = Comment.new
        expect(comment).to be_invalid
        expect(comment.errors[:content]).to_not be_blank
      end

      it "validates ticket" do
        comment = Comment.new
        expect(comment).to be_invalid
        expect(comment.errors[:ticket_id]).to_not be_blank

        comment = Comment.new(ticket_id: 1)
        expect(comment).to be_invalid
        expect(comment.errors[:ticket_id]).to be_blank
      end
    end
  end
end


text:
"use strict";

var moment = require('moment');

module.exports = {
	ago: function(parseTime) {
    var postTime = moment.utc(parseTime);
    var now = moment.utc();
    return moment.duration(now.diff(postTime)).humanize();
  }
};


text:
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif

#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif

#include <openssl/sha.h>

#include <string.h>

#include <pcre.h>

#include <errno.h>

#include <sys/stat.h>

#include <stdarg.h>

#include <libguardian/libguardian.h>

GuardianPlugin *
guardian_plugin_init (void)
{
    const char *errors = NULL;
    int err_offset;
    GuardianPlugin *plugin;

    guardian_log_info("Initialise syslog plugin");

    plugin = guardian_new (sizeof (GuardianPlugin), 1);

    return plugin;
}


text:
=head1 LICENSE

Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016-2020] EMBL-European Bioinformatics Institute

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

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

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

=cut

package Xref::Schema::Result::TranscriptDirectXref;

=head1 NAME

Xref::Schema::Result::TranscriptDirectXref

=cut

use strict;
use warnings;
use utf8;

use base 'DBIx::Class::Core';

=head1 TABLE: C<transcript_direct_xref>

=cut

__PACKAGE__->table("transcript_direct_xref");

=head1 ACCESSORS

=head2 general_xref_id

  data_type: 'integer'
  extra: {unsigned => 1}
  is_nullable: 0

=head2 ensembl_stable_id

  data_type: 'varchar'
  is_nullable: 1
  size: 255

=head2 linkage_xref

  data_type: 'varchar'
  is_nullable: 1
  size: 255

=cut

__PACKAGE__->add_columns(
  "general_xref_id",
  { data_type => "integer", extra => { unsigned => 1 }, is_nullable => 0 },
  "ensembl_stable_id",
  { data_type => "varchar", is_nullable => 1, size => 255 },
  "linkage_xref",
  { data_type => "varchar", is_nullable => 1, size => 255 },
);

__PACKAGE__->has_one('xref', 'Xref::Schema::Result::Xref', { 'foreign.xref_id' => 'self.general_xref_id' });
1;


text:
package com.av001.repository;

import com.av001.domain.Product;

import org.springframework.data.jpa.repository.*;

import java.util.List;

/**
 * Spring Data JPA repository for the Product entity.
 */
public interface ProductRepository extends JpaRepository<Product,Long> {

}


text:
package com.brein.util;

import com.brein.api.CheckFunction;
import com.google.gson.JsonObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Helper class for map related functions
 */
public class BreinMapUtil {

    private BreinMapUtil() {
        /*
         * Utility classes, which are a collection of static members,
         * are not meant to be instantiated.
         */
    }

    /**
     * Executes the actions within the map. Checks if the value is valid and if this is
     * the case then the property will be added to the json structure.
     *
     * @param jsonObject  structure that will be added with a property
     * @param functionMap map of actions (aka methods)
     */
    public static void executeMapFunctions(final JsonObject jsonObject,
                                           final Map<String, CheckFunction> functionMap) {

        functionMap.entrySet().forEach(action -> {
            if (BreinUtil.containsValue(action.getValue().invoke())) {
                jsonObject.addProperty(action.getKey(), action.getValue().invoke());
            }
        });
    }

    /**
     * Map Helper method used to copy a hashmap of type String, Object
     *
     * @param source contains the original map
     *
     * @return a copy of the map or null if source is null
     */
    public static Map<String, Object> copyMap(final Map<String, Object> source) {
        if (source == null) {
            return null;
        }

        final Map<String, Object> copy = new HashMap<>();
        source.forEach((key, value) -> copy.put(key, copyValue(value)));

        return copy;
    }

    public static List<Object> copyList(final List<Object> source) {
        if (source == null) {
            return null;
        }

        final List<Object> copy = new ArrayList<>();
        source.forEach(value -> copy.add(copyValue(value)));

        return copy;
    }

    @SuppressWarnings("unchecked")
    public static Object copyValue(final Object value) {
        if (List.class.isInstance(value)) {
            return BreinMapUtil.copyList(List.class.cast(value));
        } else if (Map.class.isInstance(value)) {
            return BreinMapUtil.copyMap(Map.class.cast(value));
        } else {
            return value;
        }
    }

    @SuppressWarnings("unchecked")
    public static <T> T getNestedValue(final Map<String, Object> map, final String... keys) {
        if (map == null) {
            return null;
        }

        Map<String, Object> currentMap = map;

        Object value = null;
        int i = 0;
        for (; i < keys.length; i++) {
            final String k = keys[i];

            value = currentMap.get(k);
            if (value == null) {
                break;
            } else if (Map.class.isInstance(value)) {
                currentMap = Map.class.cast(value);
            } else if (i < keys.length - 1) {
                break;
            }
        }

        if (i == keys.length) {
            return (T) value;
        } else {
            return null;
        }
    }

    @SuppressWarnings("unchecked")
    public static boolean hasNestedValue(final Map<String, Object> map, final String... keys) {
        if (map == null) {
            return false;
        }

        Map<String, Object> currentMap = map;

        int i = 0;
        for (; i < keys.length; i++) {
            final String k = keys[i];

            final Object value = currentMap.get(k);
            if (value == null) {
                break;
            } else if (Map.class.isInstance(value)) {
                currentMap = Map.class.cast(value);
            } else if (i < keys.length - 1) {
                break;
            }
        }

        return i == keys.length;
    }
}


text:
module Zerg::Support::EventMachine

# Adapts generic Protocol modules for easy inclusion in EventMachine connection
# classes / modules.
module ProtocolAdapter
  def self.adapter_module(protocol_module, object_name = nil)
    unless object_name
      object_name = /(^|:)([^:]*)Protocol$/.
          match(protocol_module.name)[2].split(/(?=[A-Z])/).join('_').downcase
    end

    state_class = Class.new StateBase
    state_class.send :include, protocol_module
    state_class.class_eval do
      # Called by the protocol when an entire object is available.
      define_method :"received_#{object_name}" do |object|
        @target.send :"receive_#{object_name}", object
      end
    end

    adapter = Module.new
    adapter.module_eval do
      # Called by Event Machine when TCP stream data is available.
      define_method :receive_data do |data|
        @zerg_protocol_adapter_state ||= state_class.new self
        @zerg_protocol_adapter_state.received_bytes data
      end

      # Called by the Event Machine user to send data.
      define_method :"send_#{object_name}" do |object|
        @zerg_protocol_adapter_state ||= state_class.new self
        @zerg_protocol_adapter_state.send :"send_#{object_name}", object
      end
    end

    adapter
  end

  # Base class for the adapter state.
  class StateBase
    def initialize(target)
      @target = target
    end

    # Called by the protocol when an entire object is available.
    def send_bytes(data)
      @target.send_data data
    end
  end
end

end  # namespace Zerg::Support::EventMachine


text: primeiro repositorio remoto


text:
* fixed insertion bug
* new eDom creation : textarea
* new dom functions `e$(element)insertforAll()` , `e$(element).setAttr(a,v)`, `e$(element).getAttr(a)`
##version 0.2.5
* fixed eDom img creation bug
* fixed dom insertion bug
* new eCon constants
* new eColor colors for CSS styling
* new dom functions `e$(element).move(id)` and `e$(element).moveOut()`
* new eManager function `eManager.onLoad(func)`
* better fixed recursion selection `e$(element).selectChild(num)`

##Version 0.2.3
 * changed eDom.header to **eDom.heading**
 * fixed insertion function bug and seprated it into two functions : **insert and insert all**
 * Recursion selection for child nodes using **selectChild** function


text:
using namespace std;

class MusicalInstrument {
public:
	virtual void play(){ cout << "Playing instrument ..." << endl; }
	virtual void reset(){ cout << "Resetting instrument ..." << endl; }
	virtual ~MusicalInstrument(){};
};

class Machine {
public:
	virtual void start(){ cout << "Starting machine ..." << endl; }
	virtual void reset(){ cout << "Resetting machine ..." << endl; }
	virtual ~Machine(){};
};

class Synthesizer: public Machine, public MusicalInstrument {
public:
	virtual ~Synthesizer(){};
};

int main() {

	Synthesizer *pSynth = new Synthesizer();

	pSynth->play();
	pSynth->start();
	pSynth->Machine::reset();

	delete pSynth;
	return 0;
}