text:
package com.deepoove.poi.data;

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

import com.deepoove.poi.data.SeriesRenderData.ComboType;

/**
 * Factory method to create chart
 *
 * @author Sayi
 *
 */
public class Charts {

    public static ChartMultis ofBar(String chartTitle, String[] categories) {
        return ofMultiSeries(chartTitle, categories);
    }

    public static ChartMultis ofLine(String chartTitle, String[] categories) {
        return ofMultiSeries(chartTitle, categories);
    }

    public static ChartMultis ofArea(String chartTitle, String[] categories) {
        return ofMultiSeries(chartTitle, categories);
    }

    public static ChartMultis ofBar3D(String chartTitle, String[] categories) {
        return ofMultiSeries(chartTitle, categories);
    }

    public static ChartMultis ofArea3D(String chartTitle, String[] categories) {
        return ofMultiSeries(chartTitle, categories);
    }

    public static ChartMultis ofLine3D(String chartTitle, String[] categories) {
        return ofMultiSeries(chartTitle, categories);
    }

    public static ChartMultis ofRadar(String chartTitle, String[] categories) {
        return ofMultiSeries(chartTitle, categories);
    }

    public static ChartSingles ofPie(String chartTitle, String[] categories) {
        return ofSingleSeries(chartTitle, categories);
    }

    public static ChartSingles ofPie3D(String chartTitle, String[] categories) {
        return ofSingleSeries(chartTitle, categories);
    }

    public static ChartSingles ofDoughnut(String chartTitle, String[] categories) {
        return ofSingleSeries(chartTitle, categories);
    }

    public static ChartMultis ofMultiSeries(String chartTitle, String[] categories) {
        return new ChartMultis(chartTitle, categories);
    }

    public static ChartCombos ofComboSeries(String chartTitle, String[] categories) {
        return new ChartCombos(chartTitle, categories);
    }

    public static ChartSingles ofSingleSeries(String chartTitle, String[] categories) {
        return new ChartSingles(chartTitle, categories);
    }

    public static interface ChartSetting<T extends RenderData> {
        ChartBuilder<T> setxAsixTitle(String xAxisTitle);

        ChartBuilder<T> setyAsixTitle(String yAxisTitle);
    }

    public static abstract class ChartBuilder<T extends RenderData> implements RenderDataBuilder<T>, ChartSetting<T> {
        protected String chartTitle;
        protected String xAxisTitle;
        protected String yAxisTitle;
        protected String[] categories;

        protected ChartBuilder(String chartTitle, String[] categories) {
            this.chartTitle = chartTitle;
            this.categories = categories;
        }

        protected void checkLengh(int length) {
            if (categories.length != length) {
                throw new IllegalArgumentException(
                        "The length of categories and series values in chart must be the same!");
            }
        }

        public ChartBuilder<T> setxAsixTitle(String xAxisTitle) {
            this.xAxisTitle = xAxisTitle;
            return this;
        }

        public ChartBuilder<T> setyAsixTitle(String yAxisTitle) {
            this.yAxisTitle = yAxisTitle;
            return this;
        }
    }

    /**
     *
     * builder to build multi series chart
     *
     */
    public static class ChartMultis extends ChartBuilder<ChartMultiSeriesRenderData> {
        private List<SeriesRenderData> seriesDatas = new ArrayList<>();

        private ChartMultis(String chartTitle, String[] categories) {
            super(chartTitle, categories);
        }

        public ChartMultis addSeries(String name, Number[] value) {
            checkLengh(value.length);
            seriesDatas.add(new SeriesRenderData(name, value));
            return this;
        }

        @Override
        public ChartMultiSeriesRenderData create() {
            ChartMultiSeriesRenderData data = new ChartMultiSeriesRenderData();
            data.setChartTitle(chartTitle);
            data.setxAxisTitle(xAxisTitle);
            data.setyAxisTitle(yAxisTitle);
            data.setCategories(categories);
            data.setSeriesDatas(seriesDatas);
            return data;
        }
    }

    /**
     * builder to build combo series chart
     *
     */
    public static class ChartCombos extends ChartBuilder<ChartMultiSeriesRenderData> {
        private List<SeriesRenderData> seriesDatas = new ArrayList<>();

        private ChartCombos(String chartTitle, String[] categories) {
            super(chartTitle, categories);
        }

        public ChartCombos addBarSeries(String name, Number[] value) {
            addSeries(ComboType.BAR, name, value);
            return this;
        }

        public ChartCombos addLineSeries(String name, Number[] value) {
            addSeries(ComboType.LINE, name, value);
            return this;
        }

        public ChartCombos addAreaSeries(String name, Number[] value) {
            addSeries(ComboType.AREA, name, value);
            return this;
        }

        private void addSeries(ComboType type, String name, Number[] value) {
            checkLengh(value.length);
            SeriesRenderData seriesRenderData = new SeriesRenderData(name, value);
            seriesRenderData.setComboType(type);
            seriesDatas.add(seriesRenderData);
        }

        @Override
        public ChartMultiSeriesRenderData create() {
            ChartMultiSeriesRenderData data = new ChartMultiSeriesRenderData();
            data.setChartTitle(chartTitle);
            data.setxAxisTitle(xAxisTitle);
            data.setyAxisTitle(yAxisTitle);
            data.setCategories(categories);
            data.setSeriesDatas(seriesDatas);
            return data;
        }
    }

    /**
     * builder to build single series chart
     *
     */
    public static class ChartSingles extends ChartBuilder<ChartSingleSeriesRenderData> {
        private SeriesRenderData series;

        private ChartSingles(String chartTitle, String[] categories) {
            super(chartTitle, categories);
        }

        public ChartSingles series(String name, Number[] value) {
            checkLengh(value.length);
            series = new SeriesRenderData(name, value);
            return this;
        }

        @Override
        public ChartSingleSeriesRenderData create() {
            ChartSingleSeriesRenderData data = new ChartSingleSeriesRenderData();
            data.setChartTitle(chartTitle);
            data.setxAxisTitle(xAxisTitle);
            data.setyAxisTitle(yAxisTitle);
            data.setCategories(categories);
            data.setSeriesData(series);
            return data;
        }
    }

}


text:
RedisLatencyChecker
===================

Simple script that logs Redis latency information for availability checking

Usage
=====

> RedisLatencyChecker "localhost:6379" "another-server.example.com:6379,password=abc"

Uses https://github.com/StackExchange/StackExchange.Redis for Redis connectivity.

redpajama_set_name: RedPajamaGithub


text:
var path = require('path')
var spawn = require('win-spawn')
var test = require('tape')
var concat = require('concat-stream')

var cliPath = path.resolve('./cmd.js')
var expected = require('./package.json')

test('should dry run and get correct package details', function(t) {
  var proc = spawn(cliPath, ['--dry-run'])
  proc.stdout.pipe(concat(function(body) {
    var data = JSON.parse(body.toString())
    t.equal(data.name, expected.name, 'matches name')
    t.equal(data.description, expected.description, 'matches description')
    t.equal(data.homepage, '', 'homepage is the same as repo so ignored')
  }))
  proc.on('exit', function() {
    t.ok(true, 'closed')
  })
  t.plan(4)
})


text: window.foo = 'bar';


text:
export interface IRocketChatRecord {
	_id: string;
	_updatedAt: Date;
}


text:
namespace llvm {

  /// PPC64LinuxTargetObjectFile - This implementation is used for
  /// 64-bit PowerPC Linux.
  class PPC64LinuxTargetObjectFile : public TargetLoweringObjectFileELF {

    void Initialize(MCContext &Ctx, const TargetMachine &TM) override;

    MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
                                      Mangler &Mang,
                                      const TargetMachine &TM) const override;

    /// \brief Describe a TLS variable address within debug info.
    const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
  };

}  // end namespace llvm

#endif


text:
using System.Runtime.InteropServices;

namespace Fonet.Pdf.Gdi {
    /// <summary>
    ///     The TEXTMETRIC structure contains basic information about a physical
    ///     font.  All sizes are specified in logical units; that is, they depend
    ///     on the current mapping mode of the display context.
    /// </summary>
    [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
    internal struct TextMetric {
        public int tmHeight;
        public int tmAscent;
        public int tmDescent;
        public int tmInternalLeading;
        public int tmExternalLeading;
        public int tmAveCharWidth;
        public int tmMaxCharWidth;
        public int tmWeight;
        public int tmOverhang;
        public int tmDigitizedAspectX;
        public int tmDigitizedAspectY;
        public char tmFirschar;
        public char tmLaschar;
        public char tmDefaulchar;
        public char tmBreakChar;
        public byte tmItalic;
        public byte tmUnderlined;
        public byte tmStruckOut;
        public byte tmPitchAndFamily;
        public byte tmCharSet;
    }
}


text:
@interface Project : NSObject

@property (nonatomic) long _id;
@property (strong, nonatomic) NSString *_name;
- (instancetype)initWithDictionary:(NSDictionary*)dictionary;
@end


text:
<?php

namespace CultuurNet\UDB3\StringFilter;

class StripLeadingSpaceStringFilter implements StringFilterInterface
{
    /**
     * @param string $string
     * @return string
     */
    public function filter($string)
    {
        if (!is_string($string)) {
            throw new \InvalidArgumentException('Argument should be string, got ' . gettype($string) . ' instead.');
        }

        return preg_replace('/^[ \t]+/m', "", $string);
    }
}


text:
package org.apache.polygene.library.sql.generator.implementation.grammar.manipulation;

import java.util.Objects;
import org.apache.polygene.library.sql.generator.grammar.manipulation.DropBehaviour;
import org.apache.polygene.library.sql.generator.grammar.manipulation.DropSchemaStatement;
import org.apache.polygene.library.sql.generator.grammar.manipulation.ObjectType;
import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;

/**
 *
 */
public class DropSchemaStatementImpl extends DropStatementImpl<DropSchemaStatement>
    implements DropSchemaStatement
{

    private final String _schemaName;

    public DropSchemaStatementImpl( SQLProcessorAggregator processor, DropBehaviour dropBehaviour, String schemaName )
    {
        this( processor, DropSchemaStatement.class, ObjectType.SCHEMA, dropBehaviour, schemaName );
    }

    protected DropSchemaStatementImpl( SQLProcessorAggregator processor,
                                       Class<? extends DropSchemaStatement> realImplementingType, ObjectType whatToDrop, DropBehaviour dropBehaviour,
                                       String schemaName )
    {
        super( processor, realImplementingType, whatToDrop, dropBehaviour );
        Objects.requireNonNull( schemaName, "Schema name" );
        this._schemaName = schemaName;
    }

    @Override
    protected boolean doesEqual( DropSchemaStatement another )
    {
        return this._schemaName.equals( another.getSchemaName() ) && super.doesEqual( another );
    }

    public String getSchemaName()
    {
        return this._schemaName;
    }
}


text:
Asynchronous flow-control (serial, parallel, repeat, wait, function) module for Node.js, RequireJS, and browser.

## Installation (Node.js)

    $ npm install nestableflow

## Inspired
* [東京Node学園#1「非同期プログラミングの改善」のエッセンス](http://www.slideshare.net/koichik/node1)
* [BetweenAS3/en - Spark project](http://www.libspark.org/wiki/BetweenAS3/en)

## Features
* Nesting flow.
* Group error handlers together in one handler.

## Definition
* **flow** - Instance of `Flow`. The block of process contains some flow or function.
* **actor** - Instance of `Flow` or `Function`. The components making up a flow.

## API Documentation

### Class Methods
* **serial(actor\[, actor, ...\])** - \[static\] Create serial flow with arguments of actor. (suger)
* **serialActors(actors)** - \[static\] Create serial flow with array of actor.
* **parallel(actor\[, actor, ...\])** - \[static\] Create parallel flow with arguments of actor. (suger)
* **parallelActors(actors)** - \[static\] Create parallel flow with array of actor.
* **repeat(actor, repeatCount)** - \[static\] Repeat actor.
* **wait(delay)** - \[static\] Create an actor that contains timer.

### Member Properties
* **currentPhase** - Indicates the number of actor that is running now.
* **totalPhase** - Indicates the total number of actors in the flow.

### Member Methods
* **start()** - Starts the flow, if it is not already running.
* **next()** - Takes the flow into its next actor.
* **stop()** - Stops the flow.
* **reset()** - Stops the flow, if it is running, and sets the currentPhase property back to 0.

### Event Handlers
* **onError** - Calls when arguments of callback have some error object.
* **onComplete** - Calls when the flow is finished.

## Actor's method implement

### Syncronous Actor
Just call `flow.next()` on complete of the action.

    function (flow, [argument, ...]) {
      // do something
      flow.next();
    }

### Asyncronous Actor
Set callback `flow.next`.

    function (next, [argument, ...]) {
      fs.readFile('foo.txt', 'utf8', flow.next);
    }

## Phase Concept

### Serial Flow

    var root = Flow.serial(
      function (flow) {
        console.log(flow.currentPhase, flow.totalPhase);    // 0 3
        setTimeout(function () {
          console.log(flow.currentPhase, flow.totalPhase);  // 0 3
          flow.next();
        }, 300);
      },
      function (flow) {
        console.log(flow.currentPhase, flow.totalPhase);    // 1 3
        setTimeout(function () {
          console.log(flow.currentPhase, flow.totalPhase);  // 1 3
          flow.next();
        }, 100);
      },
      function (flow) {
        console.log(flow.currentPhase, flow.totalPhase);    // 2 3
        setTimeout(function () {
          console.log(flow.currentPhase, flow.totalPhase);  // 2 3
          flow.next();
        }, 200);
      }
    );
    root.onComplete = function () {
      console.log(root.currentPhase, root.totalPhase);      // 3 3
    };
    root.start();

### Parallel Flow

    var root = Flow.parallel(
      function (flow) {
        console.log(flow.currentPhase, flow.totalPhase);    // 0 3
        setTimeout(function () {
          console.log(flow.currentPhase, flow.totalPhase);  // 2 3
          flow.next();
        }, 300);
      },
      function (flow) {
        console.log(flow.currentPhase, flow.totalPhase);    // 0 3
        setTimeout(function () {
          console.log(flow.currentPhase, flow.totalPhase);  // 0 3
          flow.next();
        }, 100);
      },
      function (flow) {
        console.log(flow.currentPhase, flow.totalPhase);    // 0 3
        setTimeout(function () {
          console.log(flow.currentPhase, flow.totalPhase);  // 1 3
          flow.next();
        }, 200);
      }
    );
    root.onComplete = function () {
      console.log(root.currentPhase, root.totalPhase);      // 3 3
    };
    root.start();

### Repeat Flow

    var root = Flow.repeat(
      function (flow) {
        console.log(flow.currentPhase, flow.totalPhase);    // 0 3
                                                            // 1 3
                                                            // 2 3
        flow.next();
      },
      3
    );
    root.onComplete = function () {
      console.log(root.currentPhase, root.totalPhase);      // 3 3
    };
    root.start();

## Usage

### File System: write -> read -> unlink

[file.js](https://github.com/minodisk/flow.js/blob/master/example/file.js)

    var fs = require('fs');
    var Flow = require('nestableflow').Flow;
    var now = (new Date()).toString();
    var file = 'temp/file.txt';

    // Callback style
    fs.writeFile(file, now, function (err) {
      if (err) {
        console.log('error', err);
        return;
      }
      fs.readFile(file, 'utf8', function (err, data) {
        if (err) {
          console.log('error', err);
          return;
        }
        fs.unlink(file, function (err) {
          if (err) {
            console.log('error', err);
            return;
          }
          console.log('complete');
        });
      });
    });

    // Flow style
    var root = Flow.serial(
      function (flow) {
        fs.writeFile(file, now, flow.next);
      },
      function (flow) {
        fs.readFile(file, 'utf8', flow.next);
      },
      function (flow, data) {
        console.log(data);
        fs.unlink(file, flow.next);
      }
    );
    root.onError = function (err) {
      console.log('error', err);
    };
    root.onComplete = function () {
      console.log('complete');
    };
    root.start();

### Mongoose: save -> find

[mongoose.js](https://github.com/minodisk/flow-js/blob/master/example/mongoose.js)

    var mongoose = require('mongoose');
    var Flow = require('nestableflow').Flow;
    var now = new Date();

    mongoose.connect('mongodb://localhost/node_flow');
    mongoose.model(
      'Example',
      new mongoose.Schema({
        date: Date
      })
    );
    var Example = mongoose.model('Example');

    // Callback style
    var example = new Example({
      date: now
    });
    example.save(function (err) {
      if (err) {
        console.log('error', err);
        return;
      }
      Example.find({}, [], function (err, examples) {
        if (err) {
          console.log('error', err);
          return;
        }
        console.log(examples);
        console.log('complete');
      })
    });

    // Flow style
    var root = Flow.serial(
      function (flow) {
        var example = new Example({
          date: now
        });
        example.save(flow.next);
      },
      function (flow) {
        Example.find({}, [], flow.next);
      },
      function (flow, examples) {
        console.log(examples);
        flow.next();
      }
    );
    root.onError = function (err) {
      console.log('error', err);
    };
    root.onComplete = function () {
      console.log('complete');
    };
    root.start();

### RequierJS

[How to load flow.js with RequierJS](https://github.com/minodisk/flow-js/blob/master/example/require)

    <script type="text/javascript" src="require.js"></script>
    <script type="text/javascript">
      require(['../../lib/flow'], function (Flow) {
        console.log(Flow);
      });
    </script>

## License

Licensed under the [MIT license](https://github.com/minodisk/flow-js/raw/master/LICENSE).


text:
namespace AngleSharp.Dom.Css
{
    using AngleSharp.Css;
    using AngleSharp.Css.Values;
    using AngleSharp.Extensions;

    /// <summary>
    /// More information available at:
    /// https://developer.mozilla.org/en-US/docs/CSS/animation-duration
    /// Gets the durations for the animations.
    /// </summary>
    sealed class CssAnimationDurationProperty : CssProperty
    {
        #region Fields

        static readonly IValueConverter ListConverter = Converters.TimeConverter.FromList().OrDefault(Time.Zero);

        #endregion

        #region ctor

        internal CssAnimationDurationProperty()
            : base(PropertyNames.AnimationDuration)
        {
        }

        #endregion

        #region Properties

        internal override IValueConverter Converter
        {
            get { return ListConverter; }
        }

        #endregion

    }
}


text:
<?php

namespace AppBundle\Repository;

/**
 * qvUserRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class qvUserRepository extends \Doctrine\ORM\EntityRepository
{
	public function findLeaser($qvLeaser) {
		return $this->getEntityManager()
		            ->createQuery(
			'SELECT u FROM AppBundle:qvUser u
    			WHERE u.leaser = :id'
		)->setParameter('id', $qvLeaser)->getSingleResult();
	}
}


text:
namespace mate {

template <>
struct Converter<device::mojom::WakeLockType> {
  static bool FromV8(v8::Isolate* isolate,
                     v8::Local<v8::Value> val,
                     device::mojom::WakeLockType* out) {
    std::string type;
    if (!ConvertFromV8(isolate, val, &type))
      return false;
    if (type == "prevent-app-suspension")
      *out = device::mojom::WakeLockType::kPreventAppSuspension;
    else if (type == "prevent-display-sleep")
      *out = device::mojom::WakeLockType::kPreventDisplaySleep;
    else
      return false;
    return true;
  }
};

}  // namespace mate

namespace atom {

namespace api {

PowerSaveBlocker::PowerSaveBlocker(v8::Isolate* isolate)
    : current_blocker_type_(
          device::mojom::WakeLockType::kPreventAppSuspension) {
  Init(isolate);
}

PowerSaveBlocker::~PowerSaveBlocker() {}

void PowerSaveBlocker::UpdatePowerSaveBlocker() {
  if (power_save_blocker_types_.empty()) {
    power_save_blocker_.reset();
    return;
  }

  // |WakeLockType::kPreventAppSuspension| keeps system active, but allows
  // screen to be turned off.
  // |WakeLockType::kPreventDisplaySleep| keeps system and screen active, has a
  // higher precedence level than |WakeLockType::kPreventAppSuspension|.
  //
  // Only the highest-precedence blocker type takes effect.
  device::mojom::WakeLockType new_blocker_type =
      device::mojom::WakeLockType::kPreventAppSuspension;
  for (const auto& element : power_save_blocker_types_) {
    if (element.second ==
        device::mojom::WakeLockType::kPreventDisplaySleep) {
      new_blocker_type =
          device::mojom::WakeLockType::kPreventDisplaySleep;
      break;
    }
  }

  if (!power_save_blocker_ || new_blocker_type != current_blocker_type_) {
    auto new_blocker = std::make_unique<device::PowerSaveBlocker>(
        new_blocker_type, device::mojom::WakeLockReason::kOther,
        ATOM_PRODUCT_NAME, base::ThreadTaskRunnerHandle::Get(),
        // This task runner may be used by some device service
        // implementation bits to interface with dbus client code, which in
        // turn imposes some subtle thread affinity on the clients. We
        // therefore require a single-thread runner.
        base::CreateSingleThreadTaskRunnerWithTraits(
            {base::MayBlock(), base::TaskPriority::BACKGROUND}));
    power_save_blocker_.swap(new_blocker);
    current_blocker_type_ = new_blocker_type;
  }
}

int PowerSaveBlocker::Start(device::mojom::WakeLockType type) {
  static int count = 0;
  power_save_blocker_types_[count] = type;
  UpdatePowerSaveBlocker();
  return count++;
}

bool PowerSaveBlocker::Stop(int id) {
  bool success = power_save_blocker_types_.erase(id) > 0;
  UpdatePowerSaveBlocker();
  return success;
}

bool PowerSaveBlocker::IsStarted(int id) {
  return power_save_blocker_types_.find(id) != power_save_blocker_types_.end();
}

// static
mate::Handle<PowerSaveBlocker> PowerSaveBlocker::Create(v8::Isolate* isolate) {
  return mate::CreateHandle(isolate, new PowerSaveBlocker(isolate));
}

// static
void PowerSaveBlocker::BuildPrototype(
    v8::Isolate* isolate,
    v8::Local<v8::FunctionTemplate> prototype) {
  prototype->SetClassName(mate::StringToV8(isolate, "PowerSaveBlocker"));
  mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
      .SetMethod("start", &PowerSaveBlocker::Start)
      .SetMethod("stop", &PowerSaveBlocker::Stop)
      .SetMethod("isStarted", &PowerSaveBlocker::IsStarted);
}

}  // namespace api

}  // namespace atom

namespace {

void Initialize(v8::Local<v8::Object> exports,
                v8::Local<v8::Value> unused,
                v8::Local<v8::Context> context,
                void* priv) {
  v8::Isolate* isolate = context->GetIsolate();
  mate::Dictionary dict(isolate, exports);
  dict.Set("powerSaveBlocker", atom::api::PowerSaveBlocker::Create(isolate));
}

}  // namespace

NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_power_save_blocker, Initialize);


text:
#include "loop.h"
#include "tcpClient.h"
#include "timer.h"

#include <ncurses.h>
#include "RF24Mesh.h"
#include <RF24.h>
#include <RF24Network.h>

#include <log4cplus/logger.h>
//#include <log4cplus/consoleappender.h>
#include <log4cplus/fileappender.h>
#include <log4cplus/layout.h>
//#include <log4cplus/ndc.h>
//#include <log4cplus/mdc.h>
#include <log4cplus/helpers/loglog.h>
#include <log4cplus/thread/threads.h>
//#include <log4cplus/helpers/sleep.h>
#include <log4cplus/loggingmacros.h>

using namespace std;
using namespace log4cplus;
using namespace log4cplus::helpers;
Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("RF24_client_test: "));

class RF24TcpClient : public translib::TcpClient
{
public:
	RF24TcpClient(const translib::Loop &loop):
		translib::TcpClient(loop)
	{}

protected:
	virtual void onRead()
	{
	}

	virtual void onDisconnected()
	{
		cout << "RF24TcpClient::" << __FUNCTION__ << endl;
	}

	virtual void onConnected(int error)
	{
		cout << "RF24TcpClient::" << __FUNCTION__ << endl;
#if 0
void form_rf_payload(char *buf, rf24_protocol _protocol, protocol_detail _protocol_detail);
void form_socket_message_from_rf_payload(char *buf, char *rf_payload, uint16_t nodeID, char type);
void form_socket_message(char *buf, uint16_t nodeID, char type, rf24_protocol _protocol, protocol_detail _protocol_detail);
#endif

        for (uint16_t nodeID = 0; nodeID < 10; nodeID++)
        {
            char buf[32] = {0};
            pin_detail pin_det= {1,1};
            protocol_detail proto_detail;
            memcpy(&(proto_detail._pin), &pin_det, sizeof(pin_detail));
            protocol_detail* tmp_proto_p = &proto_detail;
            form_socket_message(buf, nodeID, 65, rf24_protocol_pin, tmp_proto_p);
		    send(buf, sizeof(socket_message));
            cout << "send to Node "<<nodeID << endl;
        }

	}
};

class RF24TcpClientManager : public translib::Loop
{
public:
	RF24TcpClientManager():
		_client(*this),
		_timer(*this)
	{
		_timer.startForever(1000, std::bind(&RF24TcpClientManager::tick, this));
	}

protected:
	void tick()
	{
		cout << "round " << _timer.curRound() << endl;
		if (!_client.isConnected())
		{
			_client.connect(RF24_SERVER_IP, RF24_SERVER_PORT);
		}

		if (_timer.curRound() >= 30)
		{
			stop();
		}
	}
private:
	RF24TcpClient _client;
	translib::Timer _timer;
};

int main()
{
    // init log
    log4cplus::initialize();
    try
    {
        SharedObjectPtr<Appender> append_1(new FileAppender("RF24_client_test.log"));
        append_1->setName(LOG4CPLUS_TEXT("First"));

        log4cplus::tstring pattern = LOG4CPLUS_TEXT("[%d{%m/%d/%y %H:%M:%S,%Q}] %c %-5p - %m [%l]%n");
        //  std::tstring pattern = LOG4CPLUS_TEXT("%d{%c} [%t] %-5p [%.15c{3}] %%%x%% - %m [%l]%n");
        append_1->setLayout(std::auto_ptr<Layout>(new PatternLayout(pattern)));
        Logger::getRoot().addAppender(append_1);

        logger.setLogLevel(DEBUG_LOG_LEVEL);
    }
    catch (...)
    {
        Logger::getRoot().log(FATAL_LOG_LEVEL, LOG4CPLUS_TEXT("Exception occured..."));
    }

    LOG4CPLUS_DEBUG(logger, "set logger done!");

	RF24TcpClientManager clientManager;
	clientManager.start(false);
	clientManager.wait();

    return 0;
}
#if 0
    ///....sockfd
    int sock_cli = socket(AF_INET, SOCK_STREAM, 0);

    ///....sockaddr_in
    struct sockaddr_in servaddr;
    memset(&servaddr, 0, sizeof(servaddr));
    servaddr.sin_family = AF_INET;
    servaddr.sin_port = htons(MYPORT);                 ///.........
    servaddr.sin_addr.s_addr = inet_addr("127.0.0.1"); ///......ip

    ///..................0........-1
    if (connect(sock_cli, (struct sockaddr *)&servaddr, sizeof(servaddr)) < 0)
    {
        perror("connect");
        exit(1);
    }

    char sendbuf[BUFFER_SIZE];
    char recvbuf[BUFFER_SIZE];
    one_wire_onoff_s tmp_onoff;
    while (fgets(sendbuf, sizeof(sendbuf), stdin) != NULL)
    {
        switch (sendbuf[0])
        {
        case 'a':
            tmp_onoff.pin = 3;
            form_socket_message(sendbuf, 1, 'G', rf_one_wire_onoff, (char *)(&tmp_onoff));
            break;
        case 'b':
            tmp_onoff.pin = 2;
            tmp_onoff.data = 1;
            form_socket_message(sendbuf, 1, 'P', rf_one_wire_onoff, (char *)(&tmp_onoff));
            break;
        case 'c':
            tmp_onoff.pin = 2;
            tmp_onoff.data = 0;
            form_socket_message(sendbuf, 1, 'P', rf_one_wire_onoff, (char *)(&tmp_onoff));
            break;
        case 'd':
            tmp_onoff.pin = 3;
            tmp_onoff.data = 1;
            form_socket_message(sendbuf, 1, 'S', rf_one_wire_onoff, (char *)(&tmp_onoff));
            break;
        case 'e':
            tmp_onoff.pin = 3;
            tmp_onoff.data = 0;
            form_socket_message(sendbuf, 1, 'S', rf_one_wire_onoff, (char *)(&tmp_onoff));
            break;

        default:
            break;
        }
        send(sock_cli, sendbuf, 32, 0); ///....
        if (strcmp(sendbuf, "exit\n") == 0)
            break;
        int ret = recv(sock_cli, recvbuf, sizeof(recvbuf), 0); ///....
        rf_payload *recvbuf_p = (rf_payload *)recvbuf;
        //one_wire_onoff_s* onoff_p = (one_wire_onoff_s*)(&(recvbuf_p->data));
        printf("got %d byte message form socket\n", ret);
        printf("receive message. protocol is %d, len is %d\n", recvbuf_p->protocol, recvbuf_p->len);
        //printf("int the receive data, pin is %d, data is %d\n", onoff_p->pin, onoff_p->data);
        //fputs(recvbuf, stdout);

        memset(sendbuf, 0, sizeof(sendbuf));
        memset(recvbuf, 0, sizeof(recvbuf));
        memset(&tmp_onoff, 0, sizeof(one_wire_onoff_s));
    }

    close(sock_cli);
    return 0;
}
#endif


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.datapersistence.SharedPreferencesActivity">

    <android.support.design.widget.TextInputLayout
        android:id="@+id/til_sample1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:counterEnabled="true"
        app:counterMaxLength="@integer/phonenumber"
        app:counterOverflowTextAppearance="@style/TextAppearance.Design.Counter.Overflow"
        app:counterTextAppearance="@style/TextAppearance.Design.Counter"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/tiet_sample1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Input number......"
            android:inputType="number"
            android:maxLength="@integer/phonenumber"
            />
    </android.support.design.widget.TextInputLayout>

    <android.support.design.widget.TextInputLayout
        android:id="@+id/til_sample2"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:counterEnabled="true"
        app:counterMaxLength="@integer/phonenumber"
        app:counterOverflowTextAppearance="@style/TextAppearance.Design.Counter.Overflow"
        app:counterTextAppearance="@style/TextAppearance.Design.Counter"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@id/til_sample1">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/tiet_sample2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Input anything......"
            android:inputType="text"
            android:maxLength="@integer/phonenumber"
            />
    </android.support.design.widget.TextInputLayout>

    <Button
        android:id="@+id/btn_save"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="保存"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@id/til_sample2"
        android:onClick="btn_saveClick"
        />
    <Button
        android:id="@+id/btn_load"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="加载"
        app:layout_constraintTop_toTopOf="@id/btn_save"
        app:layout_constraintRight_toLeftOf="@id/btn_save"
        android:onClick="btn_loadClick"
        />
</android.support.constraint.ConstraintLayout>


text:
<?php
return [
	'adminEmail' => 'admin@neowutran.net',
	'supportEmail' => 'admin@neowutran.net',
	'user.passwordResetTokenExpire' => 3600,
];


text:
package org.ovirt.engine.core.bll.host.provider.foreman;

import org.codehaus.jackson.annotate.JsonProperty;

public class ErrataWrapper {
    @JsonProperty("results")
    private ExternalErratum[] results;

    @JsonProperty("total")
    private int totalCount;

    @JsonProperty("subtotal")
    private int subTotalCount;

    public ExternalErratum[] getResults() {
        return results;
    }

    public void setResults(ExternalErratum[] errata) {
        this.results = errata;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getSubTotalCount() {
        return subTotalCount;
    }

    public void setSubTotalCount(int subTotalCount) {
        this.subTotalCount = subTotalCount;
    }
}


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE762_Mismatched_Memory_Management_Routines__delete_array_struct_malloc_82.h
Label Definition File: CWE762_Mismatched_Memory_Management_Routines__delete_array.label.xml
Template File: sources-sinks-82.tmpl.h
*/
/*
 * @description
 * CWE: 762 Mismatched Memory Management Routines
 * BadSource: malloc Allocate data using malloc()
 * GoodSource: Allocate data using new []
 * Sinks:
 *    GoodSink: Deallocate data using free()
 *    BadSink : Deallocate data using delete []
 * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer
 *
 * */

#include "std_testcase.h"

namespace CWE762_Mismatched_Memory_Management_Routines__delete_array_struct_malloc_82
{

class CWE762_Mismatched_Memory_Management_Routines__delete_array_struct_malloc_82_base
{
public:
    /* pure virtual function */
    virtual void action(twoIntsStruct * data) = 0;
};

#ifndef OMITBAD

class CWE762_Mismatched_Memory_Management_Routines__delete_array_struct_malloc_82_bad : public CWE762_Mismatched_Memory_Management_Routines__delete_array_struct_malloc_82_base
{
public:
    void action(twoIntsStruct * data);
};

#endif /* OMITBAD */

#ifndef OMITGOOD

class CWE762_Mismatched_Memory_Management_Routines__delete_array_struct_malloc_82_goodG2B : public CWE762_Mismatched_Memory_Management_Routines__delete_array_struct_malloc_82_base
{
public:
    void action(twoIntsStruct * data);
};

class CWE762_Mismatched_Memory_Management_Routines__delete_array_struct_malloc_82_goodB2G : public CWE762_Mismatched_Memory_Management_Routines__delete_array_struct_malloc_82_base
{
public:
    void action(twoIntsStruct * data);
};

#endif /* OMITGOOD */

}


text:
Putting Repl Driven Development in your hands.

## Installation

Add this line to your application's Gemfile:

    gem 'repl_rake'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install repl_rake

## Usage

Then in gem folder add this to Rakefile

    require 'repl_rake'
    ReplRake.setup

Use the command
    rake console

Any ruby code in `.repl_rake.rb` will be loaded into you pry session after the base gem is required.

## Credits

Credits:
- Origin of Idea: http://erniemiller.org/2014/02/05/7-lines-every-gems-rakefile-should-have/#comment-1232335498
- Rake tasks require solution: https://stackoverflow.com/questions/15446153/ruby-rake-load-tasks-from-a-gem

## Contributing

1. Fork it ( http://github.com/<my-github-username>/repl_rake/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


text:
class MissingTouringPlansRemoteIndex

  def find_all
    [{:name=>"missing index source", :path=>"/"}]
  end
end


text:
package net.catchpole.io;

//   Copyright 2014 catchpole.net
//
//   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.

import java.io.File;
import java.util.Comparator;

public class FileDateComparator implements Comparator<File> {
    public int compare(File file1, File file2) {
        return (int) (file1.lastModified() - file2.lastModified());
    }
}


text:
#include <string>

#include "graphics_interface.h"
#include "copy_element.h"
#include "canvas_interface.h"
#include "view.h"
#include "small_object.h"

namespace ggadget {

class CopyElement::Impl : public SmallObject<> {
 public:
  Impl(CopyElement *owner)
    : owner_(owner),
      snapshot_(NULL),
      source_(NULL),
      refchange_connection_(NULL),
      update_connection_(NULL),
      frozen_(false) {
  }

  ~Impl() {
    // Clear the source.
    SetSrc(Variant());
    DestroyCanvas(snapshot_);
  }

  void OnSourceRefChange(int ref_count, int change) {
    GGL_UNUSED(ref_count);
    if (change == 0) {
      // The source's destructor is being called.
      refchange_connection_->Disconnect();
      refchange_connection_ = NULL;
      source_->Unref(true);
      source_ = NULL;
      UpdateSnapshot();
    }
  }

  void UpdateSnapshot() {
    if (frozen_) return;

    // Don't keep snapshot if there is no source or the source is invisible.
    if (!source_ || !source_->IsVisible()) {
      DestroyCanvas(snapshot_);
      snapshot_ = NULL;
      owner_->QueueDraw();
      return;
    }

    double width = source_->GetPixelWidth();
    double height = source_->GetPixelHeight();
    if (snapshot_ &&
        (snapshot_->GetWidth() != width || snapshot_->GetHeight() != height)) {
      DestroyCanvas(snapshot_);
      snapshot_ = NULL;
    }

    if (!snapshot_) {
      GraphicsInterface *gfx = owner_->GetView()->GetGraphics();
      if (gfx)
        snapshot_ = gfx->NewCanvas(width, height);
    }

    if (snapshot_) {
      snapshot_->ClearCanvas();
      owner_->GetView()->EnableClipRegion(false);
      source_->Draw(snapshot_);
      owner_->GetView()->EnableClipRegion(true);
    }

    owner_->QueueDraw();
  }

  void SetSrc(const Variant &src) {
    if (source_) {
      refchange_connection_->Disconnect();
      refchange_connection_ = NULL;
      update_connection_->Disconnect();
      update_connection_ = NULL;
      source_->Unref();
      source_ = NULL;
    }

    Variant::Type type = src.type();
    if (type == Variant::TYPE_STRING) {
      const char *src_name= VariantValue<const char*>()(src);
      if (src_name && *src_name) {
        source_ = owner_->GetView()->GetElementByName(src_name);
        // The source element is not added yet, save the name and try to load
        // it later.
        if (!source_)
          src_name_ = src_name;
      }
    } else if (type == Variant::TYPE_SCRIPTABLE) {
      ScriptableInterface *obj = VariantValue<ScriptableInterface *>()(src);
      if (obj && obj->IsInstanceOf(BasicElement::CLASS_ID))
        source_ = down_cast<BasicElement *>(obj);
    }

    if (source_) {
      source_->Ref();
      refchange_connection_ = source_->ConnectOnReferenceChange(
          NewSlot(this, &Impl::OnSourceRefChange));
      update_connection_ = source_->ConnectOnContentChanged(
          NewSlot(this, &Impl::UpdateSnapshot));

      UpdateSnapshot();
    } else if (snapshot_ && !frozen_) {
      DestroyCanvas(snapshot_);
      snapshot_ = NULL;
    }
  }

  Variant GetSrc() {
    return source_ ? Variant(source_->GetName()) : Variant();
  }

  CopyElement *owner_;
  CanvasInterface *snapshot_;
  BasicElement *source_;
  Connection *refchange_connection_;
  Connection *update_connection_;
  std::string src_name_;
  bool frozen_;
};

CopyElement::CopyElement(View *view, const char *name)
    : BasicElement(view, "copy", name, false),
      impl_(new Impl(this)) {
}

void CopyElement::DoClassRegister() {
  BasicElement::DoClassRegister();
  RegisterProperty("src",
                   NewSlot(&Impl::GetSrc, &CopyElement::impl_),
                   NewSlot(&Impl::SetSrc, &CopyElement::impl_));
}

CopyElement::~CopyElement() {
  delete impl_;
  impl_ = NULL;
}

bool CopyElement::IsFrozen() const {
  return impl_->frozen_;
}

void CopyElement::SetFrozen(bool frozen) {
  impl_->frozen_ = frozen;
  if (!frozen)
    impl_->UpdateSnapshot();
}

bool CopyElement::IsPointIn(double x, double y) const {
  // Return false directly if the point is outside the element boundary.
  if (!BasicElement::IsPointIn(x, y))
    return false;

  double opacity = 0;
  if (impl_->snapshot_) {
    x = x * impl_->snapshot_->GetWidth() / GetPixelWidth();
    y = y * impl_->snapshot_->GetHeight() / GetPixelHeight();

    if (!impl_->snapshot_->GetPointValue(x, y, NULL, &opacity))
      return true;
  }

  return opacity > 0;
}

void CopyElement::DoDraw(CanvasInterface *canvas) {
  if (impl_->snapshot_) {
    double w = GetPixelWidth();
    double h = GetPixelHeight();
    double sw = impl_->snapshot_->GetWidth();
    double sh = impl_->snapshot_->GetHeight();
    double cx = w / sw;
    double cy = h / sh;
    if (cx != 1 || cy != 1)
      canvas->ScaleCoordinates(cx, cy);
    canvas->DrawCanvas(0, 0, impl_->snapshot_);
  }
}

Variant CopyElement::GetSrc() const {
  return impl_->GetSrc();
}

void CopyElement::SetSrc(const Variant &src) {
  impl_->SetSrc(src);
}

void CopyElement::GetDefaultSize(double *width, double *height) const {
  ASSERT(width && height);

  // Try to set source again.
  if (!impl_->source_ && !impl_->src_name_.empty()) {
    impl_->SetSrc(Variant(impl_->src_name_));
    // Only try once.
    impl_->src_name_.clear();
  }

  if (impl_->frozen_) {
    *width = (impl_->snapshot_ ? impl_->snapshot_->GetWidth() : 0);
    *height = (impl_->snapshot_ ? impl_->snapshot_->GetHeight() : 0);
  } else {
    *width = (impl_->source_ ? impl_->source_->GetPixelWidth() : 0);
    *height = (impl_->source_ ? impl_->source_->GetPixelHeight() : 0);
  }
}

void CopyElement::MarkRedraw() {
  if (impl_->snapshot_) {
    DestroyCanvas(impl_->snapshot_);
    impl_->snapshot_ = NULL;
    impl_->UpdateSnapshot();
  }
}

bool CopyElement::HasOpaqueBackground() const {
  if (!impl_->frozen_ && impl_->source_)
    return impl_->source_->HasOpaqueBackground();
  return false;
}

BasicElement *CopyElement::CreateInstance(View *view, const char *name) {
  return new CopyElement(view, name);
}

double CopyElement::GetSrcWidth() const {
  if (impl_->source_)
    return impl_->source_->GetPixelWidth();
  if (impl_->snapshot_)
    return impl_->snapshot_->GetWidth();
  return 0;
}

double CopyElement::GetSrcHeight() const {
  if (impl_->source_)
    return impl_->source_->GetPixelHeight();
  if (impl_->snapshot_)
    return impl_->snapshot_->GetHeight();
  return 0;
}

} // namespace ggadget


text:
.test {
  width: 400px;
  animation-delay: 0s;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-direction: normal;
  animation-iteration-count: 1;
  animation-name: slideOutLeft;
  animation-play-state: running;
  animation-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
}
@keyframes slideOutLeft {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    visibility: hidden;
    transform: translate3d(-100%, 0, 0);
  }
}
.test {
  width: 400px;
  animation-delay: 0s;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-direction: normal;
  animation-iteration-count: 1;
  animation-name: slideOutLeft;
  animation-play-state: running;
  animation-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
}
@keyframes slideOutLeft {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    visibility: hidden;
    transform: translate3d(-100%, 0, 0);
  }
}


text:
'use strict';

module.exports = function(grunt) {

  // Please see the Grunt documentation for more information regarding task
  // creation: http://gruntjs.com/creating-tasks

  grunt.registerMultiTask('cdn_nobuild', 'Moves cdnified scripts outside build section.', function() {
    // Merge task-specific and/or target-specific options with these defaults.
    var options = this.options({
    });

    var cdnTagsRe = /(<script\ssrc\s*=\s*['"](?:[a-zA-Z]+?:)?\/\/[^<]+<\/script>)|(<link(?:\s+\w*=['"].*?['"])*?\s+href\s*=\s*['"](?:[a-zA-Z]+:)?\/\/[^<>]+?\/?>)/gim;
    var buildSectionBeginRe = /<!--\s*build:/gim;
    var buildSectionEndRe = /<!--\s*endbuild/gim;

    // Iterate over all specified file groups.
    this.files.forEach(function(f) {
      // Concat specified files.
      var src = f.src.filter(function(filepath) {
        // Warn on and remove invalid source files (if nonull was set).
        if (!grunt.file.exists(filepath)) {
          grunt.log.warn('Source file "' + filepath + '" not found.');
          return false;
        } else {
          return true;
        }
      }).map(function(filepath) {
        // Read file source.
        return grunt.file.read(filepath);
      }).join('');

      var beginMatch,
          endMatch,
          buildSection;

      var sectionsData = [];

      buildSectionBeginRe.lastIndex = 0;
      buildSectionEndRe.lastIndex = 0;
      while (beginMatch = buildSectionBeginRe.exec(src)) {
        endMatch = buildSectionEndRe.exec(src);

        if (!endMatch) {
          grunt.fail.fatal('Missing endbuild block!');
        }

        buildSection = src.substring(beginMatch.index, endMatch.index);
        var cdnScriptTags = [];
        var cdnMatch;
        while (cdnMatch = cdnTagsRe.exec(buildSection)) {
          cdnScriptTags.push(cdnMatch[0]);
        }
        var newBuildSection = buildSection.replace(cdnTagsRe, '');
        newBuildSection = cdnScriptTags.join('\n') + '\n' + newBuildSection;

        sectionsData.push({
          begin: beginMatch.index,
          end: endMatch.index,
          newBuildSection: newBuildSection
        });
      }

      for (var i = sectionsData.length -1; i >= 0; i--) {
        var section = sectionsData[i];
        src = src.substring(0, section.begin) + section.newBuildSection + src.substring(section.end);
      }

      grunt.file.write(f.dest, src);
      grunt.log.writeln('Write to file "' + f.dest + '"');
    });
  });

};


text:
package com.goodworkalan.addendum;

import static com.goodworkalan.addendum.Addendum.CANNOT_EXECUTE_SQL;

import java.sql.Connection;
import java.sql.SQLException;

import com.goodworkalan.addendum.dialect.Dialect;

/**
 * An update that will run arbitrary SQL in an {@link Executable}.
 *
 * @author Alan Gutierrez
 */
class Execution implements SchemaUpdate {
    /** The executable to execute. */
    private final Executable executable;

    /**
     * Create a new execution.
     *
     * @param executable
     *            The executable to execute.
     */
    public Execution(Executable executable) {
        this.executable = executable;
    }

    /**
     * Return a database update that will execute arbitrary SQL statements. This
     * method has no effect on tracking schema.
     *
     * @param schema
     *            The tracking schema.
     */
    public DatabaseUpdate execute(Schema schema) {
        return new DatabaseUpdate(CANNOT_EXECUTE_SQL) {
            public void execute(Connection connection, Dialect dialect)
            throws SQLException {
                executable.execute(connection, dialect);
            }
        };
    }
}


text:
---
uid: SolidEdgePart.FEAStudyGeomTypeEnum_Auto
summary:
remarks:
---


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="/css/main.css">

    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">


text:
#include "stdafx.h"
#include "cDHLight.h"

ADTF_FILTER_PLUGIN("DH Light", OID_ADTF_DHLIGHT_FILTER, cDHLight);

cDHLight::cDHLight(const tChar* __info):cFilter(__info), m_hTimer(NULL) {
	/*SetPropertyFloat("Faktor", faktor);
	SetPropertyFloat("Faktor" NSSUBPROP_REQUIRED, tTrue);*/

/* 	m_mrpm = 0;
	m_mrpm_old = 0;
	for(int i = 0; i<10; i++) m_rpm[i] = 0;
	m_rpmRight = 0;
	m_rpmLeft = 0;
	cRPM = 0; */

	// m_bFirstTransmit = tFalse;

	m_cTimer = 0;
	m_hTimer = NULL;

	m_bBrakeLight = tFalse;
	m_bHeadLight = tFalse;
	m_bReverseLight = tFalse;
}

cDHLight::~cDHLight() {}

tResult cDHLight::Init(tInitStage eStage, __exception) {
    RETURN_IF_FAILED(cFilter::Init(eStage, __exception_ptr))

    if (eStage == StageFirst) {
		cObjectPtr<IMediaDescriptionManager> pDescManager;
		RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,IID_ADTF_MEDIA_DESCRIPTION_MANAGER,(tVoid**)&pDescManager,__exception_ptr));

		//input descriptor
 		tChar const * strDescSignalValue = pDescManager->GetMediaDescription("tSignalValue");
		RETURN_IF_POINTER_NULL(strDescSignalValue);
		cObjectPtr<IMediaType> pTypeSignalValue = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
		RETURN_IF_FAILED(pTypeSignalValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescSignalValue));

		tChar const * strDescBoolSignalValue = pDescManager->GetMediaDescription("tBoolSignalValue");
		RETURN_IF_POINTER_NULL(strDescBoolSignalValue);
		cObjectPtr<IMediaType> pTypeBoolSignalValue = new cMediaType(0, 0, 0, "tBoolSignalValue", strDescBoolSignalValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
		RETURN_IF_FAILED(pTypeBoolSignalValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescBoolSignalValue));

		// create and register the input pin
/* 		RETURN_IF_FAILED(iPin_rpmLeft.Create("rpmLeft_in", pTypeSignalValue, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&iPin_rpmLeft));
		RETURN_IF_FAILED(iPin_rpmRight.Create("rpmRight_in", pTypeSignalValue, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&iPin_rpmRight)); */
		RETURN_IF_FAILED(iPin_acc.Create("acc_in", pTypeSignalValue, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&iPin_acc));

		// create and register the output pin
		RETURN_IF_FAILED(oPin_brakeLight.Create("brakelight_out", pTypeBoolSignalValue, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&oPin_brakeLight));
		RETURN_IF_FAILED(oPin_headLight.Create("headLight_out", pTypeBoolSignalValue, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&oPin_headLight));
		RETURN_IF_FAILED(oPin_reverseLight.Create("reverseLight_out", pTypeBoolSignalValue, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&oPin_reverseLight));
    } else if (eStage == StageNormal) {
    } else if (eStage == StageGraphReady) {
    }

    RETURN_NOERROR;
}

tResult cDHLight::Shutdown(tInitStage eStage, __exception) {
    if (eStage == StageGraphReady) {}
    else if (eStage == StageNormal) {}
    else if (eStage == StageFirst) {}

    // call the base class implementation
    return cFilter::Shutdown(eStage, __exception_ptr);
}

tResult cDHLight::TransmitBrakeLight(tBool state) {
    //write values with zero
    tUInt32 timeStamp = 0;

    //create new media sample
    cObjectPtr<IMediaSample> pMediaSample;
    AllocMediaSample((tVoid**)&pMediaSample);

    //allocate memory with the size given by the descriptor
    cObjectPtr<IMediaSerializer> pSerializer;
    m_pCoderDescBoolSignalValue->GetMediaSampleSerializer(&pSerializer);
    tInt nSize = pSerializer->GetDeserializedSize();
    pMediaSample->AllocBuffer(nSize);

    //write date to the media sample with the coder of the descriptor
    {
        __adtf_sample_read_lock_mediadescription(m_pCoderDescBoolSignalValue, pMediaSample, pCoderOutput);

        pCoderOutput->Set("bValue", (tVoid*)&(state));
        pCoderOutput->Set("ui32ArduinoTimestamp", (tVoid*)&timeStamp);
    }

    //transmit media sample over output pin
    pMediaSample->SetTime(_clock->GetStreamTime());
	oPin_brakeLight.Transmit(pMediaSample);

    RETURN_NOERROR;
}

tResult cDHLight::TransmitHeadLight(tBool state) {
    //write values with zero
    tUInt32 timeStamp = 0;

    //create new media sample
    cObjectPtr<IMediaSample> pMediaSample;
    AllocMediaSample((tVoid**)&pMediaSample);

    //allocate memory with the size given by the descriptor
    cObjectPtr<IMediaSerializer> pSerializer;
    m_pCoderDescBoolSignalValue->GetMediaSampleSerializer(&pSerializer);
    tInt nSize = pSerializer->GetDeserializedSize();
    pMediaSample->AllocBuffer(nSize);

    //write date to the media sample with the coder of the descriptor
    {
        __adtf_sample_read_lock_mediadescription(m_pCoderDescBoolSignalValue, pMediaSample, pCoderOutput);

        pCoderOutput->Set("bValue", (tVoid*)&(state));
        pCoderOutput->Set("ui32ArduinoTimestamp", (tVoid*)&timeStamp);
    }

    //transmit media sample over output pin
    pMediaSample->SetTime(_clock->GetStreamTime());
	oPin_headLight.Transmit(pMediaSample);

    RETURN_NOERROR;
}

tResult cDHLight::TransmitReverseLight(tBool state) {
    //write values with zero
    tUInt32 timeStamp = 0;

    //create new media sample
    cObjectPtr<IMediaSample> pMediaSample;
    AllocMediaSample((tVoid**)&pMediaSample);

    //allocate memory with the size given by the descriptor
    cObjectPtr<IMediaSerializer> pSerializer;
    m_pCoderDescBoolSignalValue->GetMediaSampleSerializer(&pSerializer);
    tInt nSize = pSerializer->GetDeserializedSize();
    pMediaSample->AllocBuffer(nSize);

    //write date to the media sample with the coder of the descriptor
    {
        __adtf_sample_read_lock_mediadescription(m_pCoderDescBoolSignalValue, pMediaSample, pCoderOutput);

        pCoderOutput->Set("bValue", (tVoid*)&(state));
        pCoderOutput->Set("ui32ArduinoTimestamp", (tVoid*)&timeStamp);
    }

    //transmit media sample over output pin
    pMediaSample->SetTime(_clock->GetStreamTime());
	oPin_reverseLight.Transmit(pMediaSample);

    RETURN_NOERROR;
}

tResult cDHLight::OnPinEvent(IPin* pSource, tInt nEventCode, tInt nParam1, tInt nParam2, IMediaSample* pMediaSample) {
	RETURN_IF_POINTER_NULL(pMediaSample);
	RETURN_IF_POINTER_NULL(pSource);

	// if (m_bFirstTransmit == tFalse) TransmitHeadLight(m_bHeadLight = m_bFirstTransmit = tTrue);

	if (nEventCode == IPinEventSink::PE_MediaSampleReceived) {
		tUInt32 ui32ArduinoTimestamp = 0;
		tFloat32 f32Value = 0;

		if (m_pCoderDescSignalValue != NULL) {
	        {   // focus for sample read lock
	            __adtf_sample_read_lock_mediadescription(m_pCoderDescSignalValue,pMediaSample,pCoderInput);

				pCoderInput->Get("ui32ArduinoTimestamp", (tVoid*)&ui32ArduinoTimestamp);
	            pCoderInput->Get("f32Value", (tVoid*)&f32Value);
	        }

			if (pSource == &iPin_acc) {
				m_acc_old = m_acc;
				m_acc = f32Value;

				//Brakelight
				if( (m_acc >= 0) && (m_acc_old > 0) ) {
					if (m_acc < (m_acc_old - 5)) {
						if(m_bBrakeLight == tFalse){
							TransmitBrakeLight(tTrue);
							m_bBrakeLight = tTrue;
							createTimer();
						} else {
							m_cTimer = 0;
						}
					}
				} else if( (m_acc <= 0) && (m_acc_old < 0) ) {
					if (m_acc > (m_acc_old + 5)) {
						if(m_bBrakeLight == tFalse){
							TransmitBrakeLight(tTrue);
							m_bBrakeLight = tTrue;
							createTimer();
						} else {
							m_cTimer = 0;
						}
					}
				} else if(((m_acc > 0) && (m_acc_old < 0)) || ((m_acc < 0) && (m_acc_old > 0))) {
					if(m_bBrakeLight == tFalse){
						TransmitBrakeLight(tTrue);
						m_bBrakeLight = tTrue;
						createTimer();
					} else {
						m_cTimer = 0;
					}
				}

				//Reverselight
				if (m_acc < 0) {
					TransmitReverseLight(tTrue);
					m_bReverseLight = tTrue;
				} else if( (m_acc > 0) && (m_bReverseLight == tTrue) ) {
					TransmitReverseLight(tFalse);
					m_bReverseLight = tFalse;
				}

				//HeadLight
				if(m_acc > 0) {
					if(m_bHeadLight != tTrue){
						TransmitHeadLight(tTrue);
						m_bHeadLight = tTrue;
					}
				}

			}

/* 	        if (pSource == &iPin_rpmLeft || pSource == &iPin_rpmRight ) {
				if (pSource == &iPin_rpmLeft) {
					m_rpmLeft = f32Value;
				} else {
					m_rpmRight = f32Value;
			    }

			    ++cRPM %= 10;
				m_rpm[cRPM] = (m_rpmLeft + m_rpmRight)/2;

				tFloat32 g = 0;
				for(int i=0; i<10; i++){
					g = g + m_rpm[i];
					}
				m_mrpm = g/10;

			} */
	    }
    }
	RETURN_NOERROR;
}

tResult cDHLight::Run(tInt nActivationCode, const tVoid* pvUserData, tInt szUserDataSize, ucom::IException** __exception_ptr/* =NULL */)
{
    if (nActivationCode == IRunnable::RUN_TIMER)
    {
		if(m_cTimer < 10)
			m_cTimer++;
		else {
			TransmitBrakeLight(tFalse);
			m_bBrakeLight = tFalse;
			m_cTimer = 0;
			destroyTimer();
		}

/*     	if(m_mrpm < m_mrpm_old)
        	TransmitBrakeLight(tTrue);
    	else
    		TransmitBrakeLight(tFalse);
		m_mrpm_old = m_mrpm; */
    }

    return cFilter::Run(nActivationCode, pvUserData, szUserDataSize, __exception_ptr);
}

tResult cDHLight::createTimer()
{
     // creates timer with 0.5 sec
     __synchronized_obj(m_oCriticalSectionTimerSetup);
     if (m_hTimer == NULL)
     {
            m_hTimer = _kernel->TimerCreate(0.1*1000000, 0, static_cast<IRunnable*>(this),
                                        NULL, NULL, 0, 0, adtf_util::cString::Format("%s.timer", OIGetInstanceName()));
     }
     else
     {
        LOG_ERROR("Timer is already running. Unable to create a new one.");
     }
     RETURN_NOERROR;
}

tResult cDHLight::destroyTimer(__exception)
{
    __synchronized_obj(m_oCriticalSectionTimerSetup);
    //destroy timer
    if (m_hTimer != NULL)
    {
        tResult nResult = _kernel->TimerDestroy(m_hTimer);
        if (IS_FAILED(nResult))
        {
            LOG_ERROR("Unable to destroy the timer.");
            THROW_ERROR(nResult);
        }
        m_hTimer = NULL;
    }
    //check if handle for some unknown reason still exists
    else
    {
        LOG_WARNING("Timer handle not set, but I should destroy the timer. Try to find a timer with my name.");
        tHandle hFoundHandle = _kernel->FindHandle(adtf_util::cString::Format("%s.timer", OIGetInstanceName()));
        if (hFoundHandle)
        {
            tResult nResult = _kernel->TimerDestroy(hFoundHandle);
            if (IS_FAILED(nResult))
            {
                LOG_ERROR("Unable to destroy the found timer.");
                THROW_ERROR(nResult);
            }
        }
    }

    RETURN_NOERROR;
}

tResult cDHLight::Start(__exception)
{
	if(m_bHeadLight != tTrue){
		TransmitHeadLight(tTrue);
		m_bHeadLight = tTrue;
	}

    return cFilter::Start(__exception_ptr);
}

tResult cDHLight::Stop(__exception)
{
	if(m_bBrakeLight)
		TransmitBrakeLight(tFalse);
	if(m_bHeadLight)
		TransmitHeadLight(tFalse);
	if(m_bReverseLight)
		TransmitReverseLight(tFalse);

	m_bBrakeLight = tFalse;
	m_bHeadLight = tFalse;
	m_bReverseLight = tFalse;

    __synchronized_obj(m_oCriticalSectionTimerSetup);

    if(m_hTimer)
    	destroyTimer(__exception_ptr);

    return cFilter::Stop(__exception_ptr);
}


text:
//                           _       _
// __      _____  __ ___   ___  __ _| |_ ___
// \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
//  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
//   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
//
//  Copyright © 2016 - 2020 SeMI Holding B.V. (registered @ Dutch Chamber of Commerce no 75221632). All rights reserved.
//  LICENSE WEAVIATE OPEN SOURCE: https://www.semi.technology/playbook/playbook/contract-weaviate-OSS.html
//  LICENSE WEAVIATE ENTERPRISE: https://www.semi.technology/playbook/contract-weaviate-enterprise.html
//  CONCEPT: Bob van Luijt (@bobvanluijt)
//  CONTACT: hello@semi.technology
//

// Code generated by go-swagger; DO NOT EDIT.

package meta

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"
	"io"

	"github.com/go-openapi/runtime"

	strfmt "github.com/go-openapi/strfmt"

	models "github.com/semi-technologies/weaviate/entities/models"
)

// MetaGetReader is a Reader for the MetaGet structure.
type MetaGetReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *MetaGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewMetaGetOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewMetaGetUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewMetaGetForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewMetaGetInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	default:
		return nil, runtime.NewAPIError("unknown error", response, response.Code())
	}
}

// NewMetaGetOK creates a MetaGetOK with default headers values
func NewMetaGetOK() *MetaGetOK {
	return &MetaGetOK{}
}

/*MetaGetOK handles this case with default header values.

Successful response.
*/
type MetaGetOK struct {
	Payload *models.Meta
}

func (o *MetaGetOK) Error() string {
	return fmt.Sprintf("[GET /meta][%d] metaGetOK  %+v", 200, o.Payload)
}

func (o *MetaGetOK) GetPayload() *models.Meta {
	return o.Payload
}

func (o *MetaGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.Meta)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewMetaGetUnauthorized creates a MetaGetUnauthorized with default headers values
func NewMetaGetUnauthorized() *MetaGetUnauthorized {
	return &MetaGetUnauthorized{}
}

/*MetaGetUnauthorized handles this case with default header values.

Unauthorized or invalid credentials.
*/
type MetaGetUnauthorized struct {
}

func (o *MetaGetUnauthorized) Error() string {
	return fmt.Sprintf("[GET /meta][%d] metaGetUnauthorized ", 401)
}

func (o *MetaGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	return nil
}

// NewMetaGetForbidden creates a MetaGetForbidden with default headers values
func NewMetaGetForbidden() *MetaGetForbidden {
	return &MetaGetForbidden{}
}

/*MetaGetForbidden handles this case with default header values.

Forbidden
*/
type MetaGetForbidden struct {
	Payload *models.ErrorResponse
}

func (o *MetaGetForbidden) Error() string {
	return fmt.Sprintf("[GET /meta][%d] metaGetForbidden  %+v", 403, o.Payload)
}

func (o *MetaGetForbidden) GetPayload() *models.ErrorResponse {
	return o.Payload
}

func (o *MetaGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.ErrorResponse)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewMetaGetInternalServerError creates a MetaGetInternalServerError with default headers values
func NewMetaGetInternalServerError() *MetaGetInternalServerError {
	return &MetaGetInternalServerError{}
}

/*MetaGetInternalServerError handles this case with default header values.

An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error.
*/
type MetaGetInternalServerError struct {
	Payload *models.ErrorResponse
}

func (o *MetaGetInternalServerError) Error() string {
	return fmt.Sprintf("[GET /meta][%d] metaGetInternalServerError  %+v", 500, o.Payload)
}

func (o *MetaGetInternalServerError) GetPayload() *models.ErrorResponse {
	return o.Payload
}

func (o *MetaGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.ErrorResponse)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}


text:
/*
slohr
make sure this CSS is loaded after bootstrap or any library CSS so that overrides and augmentation will work properly.
https://bootstrapbay.com/blog/customize-bootstrap/
*/

/* apply a natural box layout model to all elements */
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }

html, body {
    border: 0; margin: 0; padding: 0; height: 100%;
    font-family: Arial, Verdana, Helvetica, sans-serif;
}

/*
for centering divs while using bootstrap 3
used on login page
*/
/*with grid*/
.col-centered{
    float: none;
    margin: 0 auto;
}

/*no grid*/
.centered{
    margin: 0 auto;
}

.stitched {
   background: #ffffff;
   border: 2px dashed #EEEEEE;
   border-radius: 10px;
   box-shadow: 0 0 0 4px #ffffff, 2px 1px 6px 4px rgba(10, 10, 0, 0.5);
   margin:5px;
   min-height: 219px;
}

.login {
    width: 300px;
}

/*bootstrap 3 overrides*/
.customized-navbar-brand {
    padding: 5px 15px;
}

/*bootstrap additions */
.bs-callout {
    padding: 20px;
    margin: 20px 0;
    border: 1px solid #eee;
    border-left-width: 5px;
    border-radius: 3px;
}
.bs-callout h4 {
    margin-top: 0;
    margin-bottom: 5px;
}
.bs-callout p:last-child {
    margin-bottom: 0;
}
.bs-callout code {
    border-radius: 3px;
}
.bs-callout+.bs-callout {
    margin-top: -5px;
}
.bs-callout-default {
    border-left-color: #777;
}
.bs-callout-default h4 {
    color: #777;
}
.bs-callout-primary {
    border-left-color: #428bca;
}
.bs-callout-primary h4 {
    color: #428bca;
}
.bs-callout-success {
    border-left-color: #5cb85c;
}
.bs-callout-success h4 {
    color: #5cb85c;
}
.bs-callout-danger {
    border-left-color: #d9534f;
}
.bs-callout-danger h4 {
    color: #d9534f;
}
.bs-callout-warning {
    border-left-color: #f0ad4e;
}
.bs-callout-warning h4 {
    color: #f0ad4e;
}
.bs-callout-info {
    border-left-color: #5bc0de;
}
.bs-callout-info h4 {
    color: #5bc0de;
}
/*end bootstrap additions */

/* SimpleMDE overrides */
.editor-preview, .editor-preview-side {
	background: white;
}

/* Dropzone JS overrides */
.dropzone {
    border: 2px dashed #0087F7;
    border-radius: 5px;
    background: white;
}

.dropzone .dz-message {
    font-weight: 400;
}

.dropzone .dz-message .note {
    font-size: 0.8em;
    font-weight: 200;
    display: block;
    margin-top: 1.4rem;
}

/*
TODO(slohr): figure this out
*/

.dropzone,
.dropzone *,
.dropzone-previews,
.dropzone-previews * {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}
.dropzone {
  position: relative;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(0,0,0,0.02);
  padding: 1em;
}
.dropzone.dz-clickable {
  cursor: pointer;
}
.dropzone.dz-clickable .dz-message,
.dropzone.dz-clickable .dz-message span {
  cursor: pointer;
}
.dropzone.dz-clickable * {
  cursor: default;
}
.dropzone .dz-message {
  opacity: 1;
  -ms-filter: none;
  filter: none;
}
.dropzone.dz-drag-hover {
  border-color: rgba(0,0,0,0.15);
  background: rgba(0,0,0,0.04);
}
.dropzone.dz-started .dz-message {
  display: none;
}
.dropzone .dz-preview,
.dropzone-previews .dz-preview {
  background: rgba(255,255,255,0.8);
  position: relative;
  display: inline-block;
  margin: 17px;
  vertical-align: top;
  border: 1px solid #acacac;
  padding: 6px 6px 6px 6px;
}
.dropzone .dz-preview.dz-file-preview [data-dz-thumbnail],
.dropzone-previews .dz-preview.dz-file-preview [data-dz-thumbnail] {
  display: none;
}
.dropzone .dz-preview .dz-details,
.dropzone-previews .dz-preview .dz-details {
  width: 100px;
  height: 100px;
  position: relative;
  background: #ebebeb;
  padding: 5px;
  margin-bottom: 22px;
}
.dropzone .dz-preview .dz-details .dz-filename,
.dropzone-previews .dz-preview .dz-details .dz-filename {
  overflow: hidden;
  height: 100%;
}
.dropzone .dz-preview .dz-details img,
.dropzone-previews .dz-preview .dz-details img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100px;
  height: 100px;
}
.dropzone .dz-preview .dz-details .dz-size,
.dropzone-previews .dz-preview .dz-details .dz-size {
  position: absolute;
  bottom: -28px;
  left: 3px;
  height: 28px;
  line-height: 28px;
}
.dropzone .dz-preview.dz-error .dz-error-mark,
.dropzone-previews .dz-preview.dz-error .dz-error-mark {
  display: block;
}
.dropzone .dz-preview.dz-success .dz-success-mark,
.dropzone-previews .dz-preview.dz-success .dz-success-mark {
  display: block;
}
.dropzone .dz-preview:hover .dz-details img,
.dropzone-previews .dz-preview:hover .dz-details img {
  display: none;
}
.dropzone .dz-preview .dz-success-mark,
.dropzone-previews .dz-preview .dz-success-mark,
.dropzone .dz-preview .dz-error-mark,
.dropzone-previews .dz-preview .dz-error-mark {
  display: none;
  position: absolute;
  width: 40px;
  height: 40px;
  font-size: 30px;
  text-align: center;
  right: -10px;
  top: -10px;
}
.dropzone .dz-preview .dz-success-mark,
.dropzone-previews .dz-preview .dz-success-mark {
  color: #8cc657;
}
.dropzone .dz-preview .dz-error-mark,
.dropzone-previews .dz-preview .dz-error-mark {
  color: #ee162d;
}
.dropzone .dz-preview .dz-progress,
.dropzone-previews .dz-preview .dz-progress {
  position: absolute;
  top: 100px;
  left: 6px;
  right: 6px;
  height: 6px;
  background: #d7d7d7;
  display: none;
}
.dropzone .dz-preview .dz-progress .dz-upload,
.dropzone-previews .dz-preview .dz-progress .dz-upload {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0%;
  background-color: #8cc657;
}
.dropzone .dz-preview.dz-processing .dz-progress,
.dropzone-previews .dz-preview.dz-processing .dz-progress {
  display: block;
}
.dropzone .dz-preview .dz-error-message,
.dropzone-previews .dz-preview .dz-error-message {
  display: none;
  position: absolute;
  top: -5px;
  left: -20px;
  background: rgba(245,245,245,0.8);
  padding: 8px 10px;
  color: #800;
  min-width: 140px;
  max-width: 500px;
  z-index: 500;
}
.dropzone .dz-preview:hover.dz-error .dz-error-message,
.dropzone-previews .dz-preview:hover.dz-error .dz-error-message {
  display: block;
}
.dropzone {
  border: 1px solid rgba(0,0,0,0.03);
  min-height: 360px;
  -webkit-border-radius: 3px;
  border-radius: 3px;
  background: rgba(0,0,0,0.03);
  padding: 23px;
}
.dropzone .dz-default.dz-message {
  opacity: 1;
  -ms-filter: none;
  filter: none;
  -webkit-transition: opacity 0.3s ease-in-out;
  -moz-transition: opacity 0.3s ease-in-out;
  -o-transition: opacity 0.3s ease-in-out;
  -ms-transition: opacity 0.3s ease-in-out;
  transition: opacity 0.3s ease-in-out;
  background-repeat: no-repeat;
  background-position: 0 0;
  position: absolute;
  width: 428px;
  height: 123px;
  margin-left: -214px;
  margin-top: -61.5px;
  top: 50%;
  left: 50%;
}
@media all and (-webkit-min-device-pixel-ratio: 1.5) {
  .dropzone .dz-default.dz-message {
    -webkit-background-size: 428px 406px;
    -moz-background-size: 428px 406px;
    background-size: 428px 406px;
  }
}
.dropzone .dz-default.dz-message span {
  display: none;
}
.dropzone.dz-square .dz-default.dz-message {
  background-position: 0 -123px;
  width: 268px;
  margin-left: -134px;
  height: 174px;
  margin-top: -87px;
}
.dropzone.dz-drag-hover .dz-message {
  opacity: 0.15;
  filter: alpha(opacity=15);
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=15)";
}
.dropzone.dz-started .dz-message {
  display: block;
  opacity: 0;
  filter: alpha(opacity=0);
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
}
.dropzone .dz-preview,
.dropzone-previews .dz-preview {
  -webkit-box-shadow: 1px 1px 4px rgba(0,0,0,0.16);
  box-shadow: 1px 1px 4px rgba(0,0,0,0.16);
  font-size: 14px;
}
.dropzone .dz-preview.dz-image-preview:hover .dz-details img,
.dropzone-previews .dz-preview.dz-image-preview:hover .dz-details img {
  display: block;
  opacity: 0.1;
  filter: alpha(opacity=10);
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=10)";
}
.dropzone .dz-preview.dz-success .dz-success-mark,
.dropzone-previews .dz-preview.dz-success .dz-success-mark {
  opacity: 1;
  -ms-filter: none;
  filter: none;
}
.dropzone .dz-preview.dz-error .dz-error-mark,
.dropzone-previews .dz-preview.dz-error .dz-error-mark {
  opacity: 1;
  -ms-filter: none;
  filter: none;
}
.dropzone .dz-preview.dz-error .dz-progress .dz-upload,
.dropzone-previews .dz-preview.dz-error .dz-progress .dz-upload {
  background: #ee1e2d;
}
.dropzone .dz-preview .dz-error-mark,
.dropzone-previews .dz-preview .dz-error-mark,
.dropzone .dz-preview .dz-success-mark,
.dropzone-previews .dz-preview .dz-success-mark {
  display: block;
  opacity: 0;
  filter: alpha(opacity=0);
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  -webkit-transition: opacity 0.4s ease-in-out;
  -moz-transition: opacity 0.4s ease-in-out;
  -o-transition: opacity 0.4s ease-in-out;
  -ms-transition: opacity 0.4s ease-in-out;
  transition: opacity 0.4s ease-in-out;
  background-repeat: no-repeat;
}
@media all and (-webkit-min-device-pixel-ratio: 1.5) {
  .dropzone .dz-preview .dz-error-mark,
  .dropzone-previews .dz-preview .dz-error-mark,
  .dropzone .dz-preview .dz-success-mark,
  .dropzone-previews .dz-preview .dz-success-mark {
    -webkit-background-size: 428px 406px;
    -moz-background-size: 428px 406px;
    background-size: 428px 406px;
  }
}
.dropzone .dz-preview .dz-error-mark span,
.dropzone-previews .dz-preview .dz-error-mark span,
.dropzone .dz-preview .dz-success-mark span,
.dropzone-previews .dz-preview .dz-success-mark span {
  display: none;
}
.dropzone .dz-preview .dz-error-mark,
.dropzone-previews .dz-preview .dz-error-mark {
  background-position: -268px -123px;
}
.dropzone .dz-preview .dz-success-mark,
.dropzone-previews .dz-preview .dz-success-mark {
  background-position: -258px -153px;
  /*background-position: -268px -163px;*/
}
.dropzone .dz-preview .dz-progress .dz-upload,
.dropzone-previews .dz-preview .dz-progress .dz-upload {
  -webkit-animation: loading 0.4s linear infinite;
  -moz-animation: loading 0.4s linear infinite;
  -o-animation: loading 0.4s linear infinite;
  -ms-animation: loading 0.4s linear infinite;
  animation: loading 0.4s linear infinite;
  -webkit-transition: width 0.3s ease-in-out;
  -moz-transition: width 0.3s ease-in-out;
  -o-transition: width 0.3s ease-in-out;
  -ms-transition: width 0.3s ease-in-out;
  transition: width 0.3s ease-in-out;
  -webkit-border-radius: 2px;
  border-radius: 2px;
  position: absolute;
  top: 0;
  left: 0;
  width: 0%;
  height: 100%;
  background-repeat: repeat-x;
  background-position: 0px -400px;
}
@media all and (-webkit-min-device-pixel-ratio: 1.5) {
  .dropzone .dz-preview .dz-progress .dz-upload,
  .dropzone-previews .dz-preview .dz-progress .dz-upload {
    -webkit-background-size: 428px 406px;
    -moz-background-size: 428px 406px;
    background-size: 428px 406px;
  }
}
.dropzone .dz-preview.dz-success .dz-progress,
.dropzone-previews .dz-preview.dz-success .dz-progress {
  display: block;
  opacity: 0;
  filter: alpha(opacity=0);
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  -webkit-transition: opacity 0.4s ease-in-out;
  -moz-transition: opacity 0.4s ease-in-out;
  -o-transition: opacity 0.4s ease-in-out;
  -ms-transition: opacity 0.4s ease-in-out;
  transition: opacity 0.4s ease-in-out;
}
.dropzone .dz-preview .dz-error-message,
.dropzone-previews .dz-preview .dz-error-message {
  display: block;
  opacity: 0;
  filter: alpha(opacity=0);
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  -webkit-transition: opacity 0.3s ease-in-out;
  -moz-transition: opacity 0.3s ease-in-out;
  -o-transition: opacity 0.3s ease-in-out;
  -ms-transition: opacity 0.3s ease-in-out;
  transition: opacity 0.3s ease-in-out;
}
.dropzone .dz-preview:hover.dz-error .dz-error-message,
.dropzone-previews .dz-preview:hover.dz-error .dz-error-message {
  opacity: 1;
  -ms-filter: none;
  filter: none;
}
.dropzone a.dz-remove,
.dropzone-previews a.dz-remove {
  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fafafa), color-stop(1, #eee));
  background-image: -webkit-linear-gradient(top, #fafafa 0%, #eee 100%);
  background-image: -moz-linear-gradient(top, #fafafa 0%, #eee 100%);
  background-image: -o-linear-gradient(top, #fafafa 0%, #eee 100%);
  background-image: -ms-linear-gradient(top, #fafafa 0%, #eee 100%);
  background-image: linear-gradient(top, #fafafa 0%, #eee 100%);
  -webkit-border-radius: 2px;
  border-radius: 2px;
  border: 1px solid #eee;
  text-decoration: none;
  display: block;
  padding: 4px 5px;
  text-align: center;
  color: #aaa;
  margin-top: 26px;
}
.dropzone a.dz-remove:hover,
.dropzone-previews a.dz-remove:hover {
  color: #666;
}

DIV.nodata-indicator {
    text-align: center;
}