text:
// test generated tasks
var chai = require('chai');
chai.should();
var expect = chai.expect;

var sinon = require('sinon');

var tasksMaker = require('../../lib/tasks-maker');

// matchers
var aFunction = sinon.match.instanceOf(Function)

describe('constructor', function () {

  it('should throw an error if no bridge is supplied', function () {
    var testConstructor = function () {
      tasksMaker({
        tizenConfig: {}
      });
    };

    expect(testConstructor).to.throw();
  });

  it('should throw an error if no tizenConfig is supplied', function () {
    var testConstructor = function () {
      tasksMaker({
        bridge: {}
      });
    };

    expect(testConstructor).to.throw();
  });

  it('should return an object with tizenPrepareTask and ' +
     'tizenTask tasks', function () {
    var tasks = tasksMaker({
      bridge: {},
      tizenConfig: {}
    });

    tasks.should.have.property('tizenPrepareTask');
    tasks.should.have.property('tizenTask');
  });

});

describe('tizenPrepareTask', function () {
  var bridge = {
    tizenAppScriptLocal: 'tizen-app.sh',
    tizenAppScriptDir: '/tmp'
  };

  it('should callback with error if push fails', function (done) {
    bridge.push = sinon.stub().callsArgWith(4, new Error('push failed'));

    var tasks = tasksMaker({
      bridge: bridge,
      tizenConfig: {}
    });

    tasks.tizenPrepareTask(function (err) {
      err.should.be.instanceOf(Error);
      done();
    });
  });

  it('should callback with 0 args if push succeeds', function (done) {
    bridge.push = sinon.stub().callsArg(4);

    var tasks = tasksMaker({
      bridge: bridge,
      tizenConfig: {}
    });

    tasks.tizenPrepareTask(function (err) {
      expect(err).to.be.undefined;
      done();
    });
  });
});

describe('tizenTask', function () {
  var tasks = tasksMaker({
    bridge: {},
    tizenConfig: {}
  });

  it('should fail if no action is specified', function (done) {
    tasks.tizenTask({action: null}, function (err) {
      err.should.be.instanceOf(Error);
      done();
    });
  });

  it('should fail if invalid action is specified', function (done) {
    tasks.tizenTask({action: 'blibbyblobbyblobgob'}, function (err) {
      err.should.be.instanceOf(Error);
      done();
    });
  });
});

describe('tizenTask push', function () {

  var bridge = {
    push: function () {}
  };

  var tasks = tasksMaker({
    bridge: bridge,
    tizenConfig: {}
  });

  var localFiles = 'tizen-app.sh';
  var remoteDir = '/tmp';

  it('should fail if localFiles is not defined', function (done) {
    var data = {
      action: 'push'
    };

    tasks.tizenTask(data, function (err) {
      err.should.be.instanceOf(Error);
      done();
    });
  });

  it('should fail if remoteDir is not defined', function (done) {
    var data = {
      action: 'push',
      localFiles: 'tizen-app.sh'
    };

    tasks.tizenTask(data, function (err) {
      err.should.be.instanceOf(Error);

      // extra check that we're getting the error for remoteDir
      err.message.should.match(/needs a remoteDir property/);

      done();
    });
  });

  it('should fail if push fails on the bridge', function (done) {
    var data = {
      action: 'push',
      localFiles: localFiles,
      remoteDir: remoteDir,
      overwrite: false,
      chmod: '+x'
    };

    var mockBridge = sinon.mock(bridge);

    mockBridge.expects('push')
              .withArgs(localFiles, remoteDir, false, '+x', aFunction)
              .callsArgWith(4, new Error())
              .once();

    tasks.tizenTask(data, function (err) {
      err.should.be.instanceOf(Error);
      mockBridge.verify();
      done();
    });
  });

  it('should default to overwrite=true and chmod=null', function (done) {
    var data = {
      action: 'push',
      localFiles: localFiles,
      remoteDir: remoteDir
    };

    var mockBridge = sinon.mock(bridge);

    mockBridge.expects('push')
              .withArgs(
                localFiles,
                remoteDir,
                true,
                null,
                aFunction
              )
              .callsArg(4)
              .once();

    tasks.tizenTask(data, function (err) {
      expect(err).to.be.undefined;
      mockBridge.verify();
      done();
    });
  });

  it('should use overwrite and chmod passed in data', function (done) {
    var data = {
      action: 'push',
      localFiles: localFiles,
      remoteDir: remoteDir,
      overwrite: false,
      chmod: '+x'
    };

    var mockBridge = sinon.mock(bridge);

    mockBridge.expects('push')
              .withArgs(localFiles, remoteDir, false, '+x', aFunction)
              .callsArg(4)
              .once();

    tasks.tizenTask(data, function (err) {
      expect(err).to.be.undefined;
      mockBridge.verify();
      done();
    });
  });

});

describe('tizenTask install', function () {

  var bridge = {
    install: function () {},
    root: function () {}
  };

  var tasks = tasksMaker({
    bridge: bridge,
    tizenConfig: {}
  });

  var remoteFiles = '/tmp/package.wgt';

  it('should fail if remoteFiles not specified', function (done) {
    var data = {
      action: 'install'
    };

    sinon.stub(bridge, 'root').callsArg(1);

    tasks.tizenTask(data, function (err) {
      err.should.be.instanceOf(Error);
      bridge.root.restore();
      done();
    });
  });

  it('should fail if bridge.install fails', function (done) {
    var data = {
      action: 'install',
      remoteFiles: remoteFiles
    };

    sinon.stub(bridge, 'root').callsArg(1);
    sinon.stub(bridge, 'install').callsArgWith(1, new Error());

    tasks.tizenTask(data, function (err) {
      err.should.be.instanceOf(Error);
      bridge.install.restore();
      bridge.root.restore();
      done();
    });
  });

  it('should succeed if bridge.install succeeds', function (done) {
    var data = {
      action: 'install',
      remoteFiles: remoteFiles
    };

    sinon.stub(bridge, 'root').callsArg(1);
    sinon.stub(bridge, 'install').callsArgWith(1);

    tasks.tizenTask(data, function (err) {
      expect(err).to.be.undefined;
      bridge.install.restore();
      bridge.root.restore();
      done();
    });
  });

});

describe('tizenTask uninstall', function () {
  var tizenConfig = {
    getMeta: function () {}
  };

  var bridge = {
    uninstall: function () {}
  };

  var tasks = tasksMaker({
    bridge: bridge,
    tizenConfig: tizenConfig
  });

  var expectedPackageName = 'somePackageName';
  var meta = { packageName: expectedPackageName };

  it('should fail if config.xml metadata cannot be retrieved', function (done) {
    var data = {
      action: 'uninstall'
    };

    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, new Error());

    tasks.tizenTask(data, function (err) {
      err.should.be.instanceOf(Error);
      tizenConfig.getMeta.restore();
      done();
    });
  });

  it('should default to stopOnFailure=false', function (done) {
    var expectedStop = false;

    var data = {
      action: 'uninstall'
    };

    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, null, meta);

    var mockBridge = sinon.mock(bridge)
    mockBridge.expects('uninstall')
              .withArgs(expectedPackageName, expectedStop, aFunction)
              .callsArg(2)
              .once();

    tasks.tizenTask(data, function (err) {
      expect(err).to.be.undefined;
      tizenConfig.getMeta.restore();
      mockBridge.verify();
      done();
    });
  });

  it('should fail if bridge.uninstall fails', function (done) {
    var expectedStop = true;

    var data = {
      action: 'uninstall',
      stopOnFailure: expectedStop
    };

    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, null, meta);

    var mockBridge = sinon.mock(bridge)
    mockBridge.expects('uninstall')
              .withArgs(expectedPackageName, expectedStop, aFunction)
              .callsArgWith(2, new Error())
              .once();

    tasks.tizenTask(data, function (err) {
      err.should.be.instanceOf(Error);
      tizenConfig.getMeta.restore();
      mockBridge.verify();
      done();
    });
  });

  it('should succeed if bridge.uninstall succeeds', function (done) {
    var data = {
      action: 'uninstall'
    };

    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, null, meta);

    var mockBridge = sinon.mock(bridge)
    mockBridge.expects('uninstall')
              .withArgs(expectedPackageName, false, aFunction)
              .callsArgWith(2, new Error())
              .once();

    tasks.tizenTask(data, function (err) {
      err.should.be.instanceOf(Error);
      tizenConfig.getMeta.restore();
      mockBridge.verify();
      done();
    });
  });
});

describe('tizenTask script', function () {
  var tizenConfig = {
    getMeta: function () {}
  };

  var bridge = {
    runScript: function () {}
  };

  var tasks = tasksMaker({
    bridge: bridge,
    tizenConfig: tizenConfig
  });

  var meta = {
    id: 'someid',
    uri: 'someuri',
    packageName: 'somepackagename'
  };

  var remoteScript = '/tmp/tizen-app.sh';

  it('should fail if remoteScript is not specified', function (done) {
    tasks.tizenTask({action: 'script'}, function (err) {
      err.should.be.instanceOf(Error);
      err.message.should.match(/needs a remoteScript property/);
      done();
    });
  });

  it('should fail if tizenConfig.getMeta fails', function (done) {
    var data = {
      action: 'script',
      remoteScript: remoteScript
    };

    var err = new Error('foo');

    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, err);

    tasks.tizenTask(data, function (error) {
      error.should.equal(err);
      error.message.should.match(/foo/);
      tizenConfig.getMeta.restore();
      done();
    });
  });

  it('should fail if bridge.runScript fails', function (done) {
    var data = {
      action: 'script',
      remoteScript: remoteScript
    };

    var err = new Error('bar');

    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, null, meta);
    sinon.stub(bridge, 'runScript')
         .withArgs(remoteScript, [meta.packageName, meta.id], aFunction)
         .callsArgWith(2, err);

    tasks.tizenTask(data, function (error) {
      error.should.equal(err);
      error.message.should.match(/bar/);
      tizenConfig.getMeta.restore();
      bridge.runScript.restore();
      done();
    });
  });

  it('should pass data.args to runScript as arguments', function (done) {
    var data = {
      action: 'script',
      remoteScript: remoteScript,
      args: ['foo', 'bar']
    };

    var expectedArgs = [meta.packageName, meta.id, 'foo', 'bar'];

    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, null, meta);

    var mockBridge = sinon.mock(bridge);
    mockBridge.expects('runScript')
              .withArgs(remoteScript, expectedArgs, aFunction)
              .callsArg(2)
              .once();

    tasks.tizenTask(data, function (err) {
      expect(err).to.be.undefined;
      tizenConfig.getMeta.restore();
      mockBridge.verify();
      done();
    });
  });
});

describe('tizenTask launch', function () {
  var tizenConfig = {
    getMeta: function () {}
  };

  var bridge = {
    launch: function () {},
    portForward: function () {},
    runBrowser: function () {}
  };

  var tasks = tasksMaker({
    bridge: bridge,
    tizenConfig: tizenConfig
  });

  var meta = {
    id: 'someid',
    uri: 'someuri'
  };

  var remoteScript = '/tmp/tizen-app.sh';
  var err = new Error();

  it('should fail if tizenConfig.getMeta fails', function (done) {
    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, err);

    tasks.tizenTask({action: 'start'}, function (error) {
      tizenConfig.getMeta.restore();
      error.should.equal(err);
      done();
    });
  });

  it('should pass subcommand and stopOnFailure to bridge.launch', function (done) {
    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, null, meta);

    var stopOnFailure = true;
    var action = 'start';
    var data = {action: action, stopOnFailure: stopOnFailure};

    var mockBridge = sinon.mock(bridge);
    mockBridge.expects('launch')
              .withArgs(action, meta.id, stopOnFailure, aFunction)
              .callsArg(3)
              .once();

    tasks.tizenTask(data, function () {
      mockBridge.verify();
      tizenConfig.getMeta.restore();
      done();
    });
  });

  it('should fail if bridge.launch fails', function (done) {
    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, null, meta);

    var stopOnFailure = true;
    var action = 'start';
    var data = {action: action, stopOnFailure: stopOnFailure};

    var mockBridge = sinon.mock(bridge);
    mockBridge.expects('launch')
              .withArgs(action, meta.id, stopOnFailure, aFunction)
              .callsArgWith(3, err)
              .once();

    tasks.tizenTask(data, function (error) {
      mockBridge.verify();
      tizenConfig.getMeta.restore();
      error.should.equal(err);
      done();
    });
  });

  it('should continue if bridge.launch succeeds', function (done) {
    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, null, meta);

    var stopOnFailure = false;
    var action = 'start';
    var data = {action: action, stopOnFailure: stopOnFailure};

    var mockBridge = sinon.mock(bridge);
    mockBridge.expects('launch')
              .withArgs(action, meta.id, stopOnFailure, aFunction)
              .callsArg(3)
              .once();

    tasks.tizenTask(data, function (error) {
      mockBridge.verify();
      tizenConfig.getMeta.restore();
      expect(error).to.be.undefined;
      done();
    });
  });

  it('should fail if subcommand=debug but bridge.launch fails', function (done) {
    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, null, meta);

    var stopOnFailure = false;
    var action = 'debug';
    var data = {action: action, stopOnFailure: stopOnFailure};

    var mockBridge = sinon.mock(bridge);

    // bridge.launch fails for debug
    mockBridge.expects('launch')
              .withArgs(action, meta.id, stopOnFailure, aFunction)
              .callsArgWith(3, err)
              .once();

    tasks.tizenTask(data, function (error) {
      mockBridge.verify();
      tizenConfig.getMeta.restore();
      error.should.equal(err);
      done();
    });
  });

  it('should fail if subcommand=debug but no remote port', function (done) {
    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, null, meta);

    var stopOnFailure = false;
    var action = 'debug';
    var data = {action: action, stopOnFailure: stopOnFailure};

    var mockBridge = sinon.mock(bridge);

    // bridge.launch returns no PORT
    mockBridge.expects('launch')
              .withArgs(action, meta.id, stopOnFailure, aFunction)
              .callsArgWith(3, null, '-------GARBAGE-------')
              .once();

    tasks.tizenTask(data, function (error) {
      mockBridge.verify();
      tizenConfig.getMeta.restore();
      error.message.should.match(/no remote port available for debugging/);
      done();
    });
  });

  it('should fail if remote port but port forwarding fails', function (done) {
    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, null, meta);

    var stopOnFailure = false;
    var action = 'debug';
    var data = {action: action, stopOnFailure: stopOnFailure, localPort: 9090};

    var mockBridge = sinon.mock(bridge);

    // bridge.launch returns PORT
    mockBridge.expects('launch')
              .withArgs(action, meta.id, stopOnFailure, aFunction)
              .callsArgWith(3, null, 'PORT 1234')
              .once();

    // port forwarding fails
    mockBridge.expects('portForward')
              .withArgs(9090, 1234, aFunction)
              .callsArgWith(2, err)
              .once();

    tasks.tizenTask(data, function (error) {
      mockBridge.verify();
      tizenConfig.getMeta.restore();
      error.should.equal(err);
      done();
    });
  });

  it('should run browser if port forwarded and browserCmd is set', function (done) {
    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, null, meta);

    var stopOnFailure = false;
    var action = 'debug';
    var browserCmd = 'giggle-crom';
    var localPort = 9090;

    var data = {
      action: action,
      stopOnFailure: stopOnFailure,
      localPort: localPort,
      browserCmd: browserCmd
    };

    var mockBridge = sinon.mock(bridge);

    // bridge.launch returns PORT
    mockBridge.expects('launch')
              .withArgs(action, meta.id, stopOnFailure, aFunction)
              .callsArgWith(3, null, 'PORT 1234')
              .once();

    // port forwarding succeeds
    mockBridge.expects('portForward')
              .withArgs(localPort, 1234, aFunction)
              .callsArg(2)
              .once();

    // run browser should be called
    mockBridge.expects('runBrowser')
              .withArgs(browserCmd, localPort, aFunction)
              .callsArg(2)
              .once();

    tasks.tizenTask(data, function (error) {
      mockBridge.verify();
      tizenConfig.getMeta.restore();
      expect(error).to.be.undefined;
      done();
    });
  });

  it('should succeed if port forwarded but no browserCmd set', function (done) {
    sinon.stub(tizenConfig, 'getMeta').callsArgWith(0, null, meta);

    var stopOnFailure = false;
    var action = 'debug';
    var localPort = 9090;

    var data = {
      action: action,
      stopOnFailure: stopOnFailure,
      localPort: localPort
    };

    var mockBridge = sinon.mock(bridge);

    // bridge.launch returns PORT
    mockBridge.expects('launch')
              .withArgs(action, meta.id, stopOnFailure, aFunction)
              .callsArgWith(3, null, 'PORT 1234')
              .once();

    // port forwarding succeeds
    mockBridge.expects('portForward')
              .withArgs(localPort, 1234, aFunction)
              .callsArg(2)
              .once();

    tasks.tizenTask(data, function (error) {
      mockBridge.verify();
      tizenConfig.getMeta.restore();
      expect(error).to.be.undefined;
      done();
    });
  });
});

describe('tizenTask asRoot', function () {
  var bridge = {
    install: function () {},
    root: function () {}
  };

  var tasks = tasksMaker({
    bridge: bridge,
    tizenConfig: {}
  });

  var err = new Error();

  var data = {
    action: 'install',
    asRoot: true,
    remoteFiles: '/tmp/package.wgt'
  };

  it('should fail task immediately if asRoot:true fails', function (done) {
    var mockBridge = sinon.mock(bridge);

    mockBridge.expects('root')
              .withArgs(true, aFunction)
              .callsArgWith(1, err)
              .once();

    tasks.tizenTask(data, function (error) {
      mockBridge.verify();
      error.should.equal(err);
      done();
    });
  });

  it('should run task if asRoot:true succeeds but fail when ' +
     'asRoot:false fails', function (done) {
    var mockBridge = sinon.mock(bridge);

    mockBridge.expects('root')
              .withArgs(true, aFunction)
              .callsArg(1)
              .once();

    mockBridge.expects('install')
              .withArgs(data.remoteFiles, aFunction)
              .callsArg(1)
              .once();

    mockBridge.expects('root')
              .withArgs(false, aFunction)
              .callsArgWith(1, err)
              .once();

    tasks.tizenTask(data, function (error) {
      mockBridge.verify();
      error.should.equal(err);
      done();
    });
  });

  it('should fail if asRoot:true succeeds but subcommand fails ' +
     'but still run asRoot:false', function (done) {
    var mockBridge = sinon.mock(bridge);

    mockBridge.expects('root')
              .withArgs(true, aFunction)
              .callsArg(1)
              .once();

    mockBridge.expects('install')
              .withArgs(data.remoteFiles, aFunction)
              .callsArgWith(1, err)
              .once();

    mockBridge.expects('root')
              .withArgs(false, aFunction)
              .callsArg(1)
              .once();

    tasks.tizenTask(data, function (error) {
      mockBridge.verify();
      error.should.equal(err);
      done();
    });
  });

  it('should run task successfully if asRoot:true, bridge action ' +
     'and asRoot:false all succeed', function (done) {
    var mockBridge = sinon.mock(bridge);

    mockBridge.expects('root')
              .withArgs(true, aFunction)
              .callsArg(1)
              .once();

    mockBridge.expects('install')
              .withArgs(data.remoteFiles, aFunction)
              .callsArg(1)
              .once();

    mockBridge.expects('root')
              .withArgs(false, aFunction)
              .callsArg(1)
              .once();

    tasks.tizenTask(data, function (error) {
      mockBridge.verify();
      expect(error).to.be.undefined;
      done();
    });
  });
});


text:
//==============================================================================
//         Copyright 2003 - 2011   LASMEA UMR 6602 CNRS/Univ. Clermont II
//         Copyright 2009 - 2011   LRI    UMR 8623 CNRS/Univ Paris Sud XI
//
//          Distributed under the Boost Software License, Version 1.0.
//                 See accompanying file LICENSE.txt or copy at
//                     http://www.boost.org/LICENSE_1_0.txt
//==============================================================================
#ifndef NT2_CONSTANT_CONSTANTS_ONEO_6_HPP_INCLUDED
#define NT2_CONSTANT_CONSTANTS_ONEO_6_HPP_INCLUDED

#include <boost/simd/constant/include/constants/oneo_6.hpp>
#include <nt2/include/functor.hpp>

namespace nt2
{
  namespace tag
  {
    #ifdef DOXYGEN_ONLY
    /*! \brief Same as \classref{boost::simd::tag::Oneo_6_} **/
    struct oneo_6_ {};
    #endif
    using boost::simd::tag::Oneo_6;
  }

  #ifdef DOXYGEN_ONLY
  /*! \brief Same as \funcref{boost::simd::Oneo_6} **/
  template<class... Args>
  details::unspecified oneo_6(Args&&... args);
  #endif
  using boost::simd::Oneo_6;
}

#include <nt2/constant/common.hpp>

#endif

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Text.Json;
using Azure.Core;
using Azure.ResourceManager.Models;

namespace Azure.ResourceManager.Synapse.Models
{
    public partial class ReadOnlyFollowingDatabase : IUtf8JsonSerializable
    {
        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
        {
            writer.WriteStartObject();
            if (Optional.IsDefined(Location))
            {
                writer.WritePropertyName("location");
                writer.WriteStringValue(Location.Value);
            }
            writer.WritePropertyName("kind");
            writer.WriteStringValue(Kind.ToString());
            writer.WritePropertyName("properties");
            writer.WriteStartObject();
            if (Optional.IsDefined(HotCachePeriod))
            {
                writer.WritePropertyName("hotCachePeriod");
                writer.WriteStringValue(HotCachePeriod.Value, "P");
            }
            writer.WriteEndObject();
            writer.WriteEndObject();
        }

        internal static ReadOnlyFollowingDatabase DeserializeReadOnlyFollowingDatabase(JsonElement element)
        {
            Optional<AzureLocation> location = default;
            SynapseKind kind = default;
            ResourceIdentifier id = default;
            string name = default;
            ResourceType type = default;
            Optional<SystemData> systemData = default;
            Optional<ResourceProvisioningState> provisioningState = default;
            Optional<TimeSpan> softDeletePeriod = default;
            Optional<TimeSpan> hotCachePeriod = default;
            Optional<DatabaseStatistics> statistics = default;
            Optional<string> leaderClusterResourceId = default;
            Optional<string> attachedDatabaseConfigurationName = default;
            Optional<PrincipalsModificationKind> principalsModificationKind = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("location"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    location = new AzureLocation(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    kind = new SynapseKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    systemData = JsonSerializer.Deserialize<SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ResourceProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("softDeletePeriod"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            softDeletePeriod = property0.Value.GetTimeSpan("P");
                            continue;
                        }
                        if (property0.NameEquals("hotCachePeriod"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hotCachePeriod = property0.Value.GetTimeSpan("P");
                            continue;
                        }
                        if (property0.NameEquals("statistics"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            statistics = DatabaseStatistics.DeserializeDatabaseStatistics(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("leaderClusterResourceId"))
                        {
                            leaderClusterResourceId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("attachedDatabaseConfigurationName"))
                        {
                            attachedDatabaseConfigurationName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("principalsModificationKind"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            principalsModificationKind = new PrincipalsModificationKind(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return new ReadOnlyFollowingDatabase(id, name, type, systemData.Value, Optional.ToNullable(location), kind, Optional.ToNullable(provisioningState), Optional.ToNullable(softDeletePeriod), Optional.ToNullable(hotCachePeriod), statistics.Value, leaderClusterResourceId.Value, attachedDatabaseConfigurationName.Value, Optional.ToNullable(principalsModificationKind));
        }
    }
}


text:
package io.undertow.util;

import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.URLDecoder;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * NOTE: if you add a new header here you must also add it to {@link io.undertow.server.protocol.http.HttpRequestParser}
 *
 * @author David M. Lloyd
 */
public final class Headers {

    private Headers() {
    }

    // Headers as strings

    public static final String ACCEPT_STRING = "Accept";
    public static final String ACCEPT_CHARSET_STRING = "Accept-Charset";
    public static final String ACCEPT_ENCODING_STRING = "Accept-Encoding";
    public static final String ACCEPT_LANGUAGE_STRING = "Accept-Language";
    public static final String ACCEPT_RANGES_STRING = "Accept-Ranges";
    public static final String AGE_STRING = "Age";
    public static final String ALLOW_STRING = "Allow";
    public static final String AUTHENTICATION_INFO_STRING = "Authentication-Info";
    public static final String AUTHORIZATION_STRING = "Authorization";
    public static final String CACHE_CONTROL_STRING = "Cache-Control";
    public static final String COOKIE_STRING = "Cookie";
    public static final String COOKIE2_STRING = "Cookie2";
    public static final String CONNECTION_STRING = "Connection";
    public static final String CONTENT_DISPOSITION_STRING = "Content-Disposition";
    public static final String CONTENT_ENCODING_STRING = "Content-Encoding";
    public static final String CONTENT_LANGUAGE_STRING = "Content-Language";
    public static final String CONTENT_LENGTH_STRING = "Content-Length";
    public static final String CONTENT_LOCATION_STRING = "Content-Location";
    public static final String CONTENT_MD5_STRING = "Content-MD5";
    public static final String CONTENT_RANGE_STRING = "Content-Range";
    public static final String CONTENT_SECURITY_POLICY_STRING = "Content-Security-Policy";
    public static final String CONTENT_TYPE_STRING = "Content-Type";
    public static final String DATE_STRING = "Date";
    public static final String ETAG_STRING = "ETag";
    public static final String EXPECT_STRING = "Expect";
    public static final String EXPIRES_STRING = "Expires";
    public static final String FORWARDED_STRING = "Forwarded";
    public static final String FROM_STRING = "From";
    public static final String HOST_STRING = "Host";
    public static final String IF_MATCH_STRING = "If-Match";
    public static final String IF_MODIFIED_SINCE_STRING = "If-Modified-Since";
    public static final String IF_NONE_MATCH_STRING = "If-None-Match";
    public static final String IF_RANGE_STRING = "If-Range";
    public static final String IF_UNMODIFIED_SINCE_STRING = "If-Unmodified-Since";
    public static final String LAST_MODIFIED_STRING = "Last-Modified";
    public static final String LOCATION_STRING = "Location";
    public static final String MAX_FORWARDS_STRING = "Max-Forwards";
    public static final String ORIGIN_STRING = "Origin";
    public static final String PRAGMA_STRING = "Pragma";
    public static final String PROXY_AUTHENTICATE_STRING = "Proxy-Authenticate";
    public static final String PROXY_AUTHORIZATION_STRING = "Proxy-Authorization";
    public static final String RANGE_STRING = "Range";
    public static final String REFERER_STRING = "Referer";
    public static final String REFERRER_POLICY_STRING = "Referrer-Policy";
    public static final String REFRESH_STRING = "Refresh";
    public static final String RETRY_AFTER_STRING = "Retry-After";
    public static final String SEC_WEB_SOCKET_ACCEPT_STRING = "Sec-WebSocket-Accept";
    public static final String SEC_WEB_SOCKET_EXTENSIONS_STRING = "Sec-WebSocket-Extensions";
    public static final String SEC_WEB_SOCKET_KEY_STRING = "Sec-WebSocket-Key";
    public static final String SEC_WEB_SOCKET_KEY1_STRING = "Sec-WebSocket-Key1";
    public static final String SEC_WEB_SOCKET_KEY2_STRING = "Sec-WebSocket-Key2";
    public static final String SEC_WEB_SOCKET_LOCATION_STRING = "Sec-WebSocket-Location";
    public static final String SEC_WEB_SOCKET_ORIGIN_STRING = "Sec-WebSocket-Origin";
    public static final String SEC_WEB_SOCKET_PROTOCOL_STRING = "Sec-WebSocket-Protocol";
    public static final String SEC_WEB_SOCKET_VERSION_STRING = "Sec-WebSocket-Version";
    public static final String SERVER_STRING = "Server";
    public static final String SERVLET_ENGINE_STRING = "Servlet-Engine";
    public static final String SET_COOKIE_STRING = "Set-Cookie";
    public static final String SET_COOKIE2_STRING = "Set-Cookie2";
    public static final String SSL_CLIENT_CERT_STRING = "SSL_CLIENT_CERT";
    public static final String SSL_CIPHER_STRING = "SSL_CIPHER";
    public static final String SSL_SESSION_ID_STRING = "SSL_SESSION_ID";
    public static final String SSL_CIPHER_USEKEYSIZE_STRING = "SSL_CIPHER_USEKEYSIZE";
    public static final String STATUS_STRING = "Status";
    public static final String STRICT_TRANSPORT_SECURITY_STRING = "Strict-Transport-Security";
    public static final String TE_STRING = "TE";
    public static final String TRAILER_STRING = "Trailer";
    public static final String TRANSFER_ENCODING_STRING = "Transfer-Encoding";
    public static final String UPGRADE_STRING = "Upgrade";
    public static final String USER_AGENT_STRING = "User-Agent";
    public static final String VARY_STRING = "Vary";
    public static final String VIA_STRING = "Via";
    public static final String WARNING_STRING = "Warning";
    public static final String WWW_AUTHENTICATE_STRING = "WWW-Authenticate";
    public static final String X_CONTENT_TYPE_OPTIONS_STRING = "X-Content-Type-Options";
    public static final String X_DISABLE_PUSH_STRING = "X-Disable-Push";
    public static final String X_FORWARDED_FOR_STRING = "X-Forwarded-For";
    public static final String X_FORWARDED_PROTO_STRING = "X-Forwarded-Proto";
    public static final String X_FORWARDED_HOST_STRING = "X-Forwarded-Host";
    public static final String X_FORWARDED_PORT_STRING = "X-Forwarded-Port";
    public static final String X_FORWARDED_SERVER_STRING = "X-Forwarded-Server";
    public static final String X_FRAME_OPTIONS_STRING = "X-Frame-Options";
    public static final String X_XSS_PROTECTION_STRING = "X-Xss-Protection";

    // Header names

    public static final HttpString ACCEPT = new HttpString(ACCEPT_STRING, 1);
    public static final HttpString ACCEPT_CHARSET = new HttpString(ACCEPT_CHARSET_STRING, 2);
    public static final HttpString ACCEPT_ENCODING = new HttpString(ACCEPT_ENCODING_STRING, 3);
    public static final HttpString ACCEPT_LANGUAGE = new HttpString(ACCEPT_LANGUAGE_STRING, 4);
    public static final HttpString ACCEPT_RANGES = new HttpString(ACCEPT_RANGES_STRING, 5);
    public static final HttpString AGE = new HttpString(AGE_STRING, 6);
    public static final HttpString ALLOW = new HttpString(ALLOW_STRING, 7);
    public static final HttpString AUTHENTICATION_INFO = new HttpString(AUTHENTICATION_INFO_STRING, 8);
    public static final HttpString AUTHORIZATION = new HttpString(AUTHORIZATION_STRING, 9);
    public static final HttpString CACHE_CONTROL = new HttpString(CACHE_CONTROL_STRING, 10);
    public static final HttpString CONNECTION = new HttpString(CONNECTION_STRING, 11);
    public static final HttpString CONTENT_DISPOSITION = new HttpString(CONTENT_DISPOSITION_STRING, 12);
    public static final HttpString CONTENT_ENCODING = new HttpString(CONTENT_ENCODING_STRING, 13);
    public static final HttpString CONTENT_LANGUAGE = new HttpString(CONTENT_LANGUAGE_STRING, 14);
    public static final HttpString CONTENT_LENGTH = new HttpString(CONTENT_LENGTH_STRING, 15);
    public static final HttpString CONTENT_LOCATION = new HttpString(CONTENT_LOCATION_STRING, 16);
    public static final HttpString CONTENT_MD5 = new HttpString(CONTENT_MD5_STRING, 17);
    public static final HttpString CONTENT_RANGE = new HttpString(CONTENT_RANGE_STRING, 18);
    public static final HttpString CONTENT_SECURITY_POLICY = new HttpString(CONTENT_SECURITY_POLICY_STRING, 19);
    public static final HttpString CONTENT_TYPE = new HttpString(CONTENT_TYPE_STRING, 20);
    public static final HttpString COOKIE = new HttpString(COOKIE_STRING, 21);
    public static final HttpString COOKIE2 = new HttpString(COOKIE2_STRING, 22);
    public static final HttpString DATE = new HttpString(DATE_STRING, 23);
    public static final HttpString ETAG = new HttpString(ETAG_STRING, 24);
    public static final HttpString EXPECT = new HttpString(EXPECT_STRING, 25);
    public static final HttpString EXPIRES = new HttpString(EXPIRES_STRING, 26);
    public static final HttpString FORWARDED = new HttpString(FORWARDED_STRING, 27);
    public static final HttpString FROM = new HttpString(FROM_STRING, 28);
    public static final HttpString HOST = new HttpString(HOST_STRING, 29);
    public static final HttpString IF_MATCH = new HttpString(IF_MATCH_STRING, 30);
    public static final HttpString IF_MODIFIED_SINCE = new HttpString(IF_MODIFIED_SINCE_STRING, 31);
    public static final HttpString IF_NONE_MATCH = new HttpString(IF_NONE_MATCH_STRING, 32);
    public static final HttpString IF_RANGE = new HttpString(IF_RANGE_STRING, 33);
    public static final HttpString IF_UNMODIFIED_SINCE = new HttpString(IF_UNMODIFIED_SINCE_STRING, 34);
    public static final HttpString LAST_MODIFIED = new HttpString(LAST_MODIFIED_STRING, 35);
    public static final HttpString LOCATION = new HttpString(LOCATION_STRING, 36);
    public static final HttpString MAX_FORWARDS = new HttpString(MAX_FORWARDS_STRING, 37);
    public static final HttpString ORIGIN = new HttpString(ORIGIN_STRING, 38);
    public static final HttpString PRAGMA = new HttpString(PRAGMA_STRING, 39);
    public static final HttpString PROXY_AUTHENTICATE = new HttpString(PROXY_AUTHENTICATE_STRING, 40);
    public static final HttpString PROXY_AUTHORIZATION = new HttpString(PROXY_AUTHORIZATION_STRING, 41);
    public static final HttpString RANGE = new HttpString(RANGE_STRING, 42);
    public static final HttpString REFERER = new HttpString(REFERER_STRING, 43);
    public static final HttpString REFERRER_POLICY = new HttpString(REFERRER_POLICY_STRING, 44);
    public static final HttpString REFRESH = new HttpString(REFRESH_STRING, 45);
    public static final HttpString RETRY_AFTER = new HttpString(RETRY_AFTER_STRING, 46);
    public static final HttpString SEC_WEB_SOCKET_ACCEPT = new HttpString(SEC_WEB_SOCKET_ACCEPT_STRING, 47);
    public static final HttpString SEC_WEB_SOCKET_EXTENSIONS = new HttpString(SEC_WEB_SOCKET_EXTENSIONS_STRING, 48);
    public static final HttpString SEC_WEB_SOCKET_KEY = new HttpString(SEC_WEB_SOCKET_KEY_STRING, 49);
    public static final HttpString SEC_WEB_SOCKET_KEY1 = new HttpString(SEC_WEB_SOCKET_KEY1_STRING, 50);
    public static final HttpString SEC_WEB_SOCKET_KEY2 = new HttpString(SEC_WEB_SOCKET_KEY2_STRING, 51);
    public static final HttpString SEC_WEB_SOCKET_LOCATION = new HttpString(SEC_WEB_SOCKET_LOCATION_STRING, 52);
    public static final HttpString SEC_WEB_SOCKET_ORIGIN = new HttpString(SEC_WEB_SOCKET_ORIGIN_STRING, 53);
    public static final HttpString SEC_WEB_SOCKET_PROTOCOL = new HttpString(SEC_WEB_SOCKET_PROTOCOL_STRING, 54);
    public static final HttpString SEC_WEB_SOCKET_VERSION = new HttpString(SEC_WEB_SOCKET_VERSION_STRING, 55);
    public static final HttpString SERVER = new HttpString(SERVER_STRING, 56);
    public static final HttpString SERVLET_ENGINE = new HttpString(SERVLET_ENGINE_STRING, 57);
    public static final HttpString SET_COOKIE = new HttpString(SET_COOKIE_STRING, 58);
    public static final HttpString SET_COOKIE2 = new HttpString(SET_COOKIE2_STRING, 59);
    public static final HttpString SSL_CIPHER = new HttpString(SSL_CIPHER_STRING, 60);
    public static final HttpString SSL_CIPHER_USEKEYSIZE = new HttpString(SSL_CIPHER_USEKEYSIZE_STRING, 61);
    public static final HttpString SSL_CLIENT_CERT = new HttpString(SSL_CLIENT_CERT_STRING, 62);
    public static final HttpString SSL_SESSION_ID = new HttpString(SSL_SESSION_ID_STRING, 63);
    public static final HttpString STATUS = new HttpString(STATUS_STRING, 64);
    public static final HttpString STRICT_TRANSPORT_SECURITY = new HttpString(STRICT_TRANSPORT_SECURITY_STRING, 65);
    public static final HttpString TE = new HttpString(TE_STRING, 66);
    public static final HttpString TRAILER = new HttpString(TRAILER_STRING, 67);
    public static final HttpString TRANSFER_ENCODING = new HttpString(TRANSFER_ENCODING_STRING, 68);
    public static final HttpString UPGRADE = new HttpString(UPGRADE_STRING, 69);
    public static final HttpString USER_AGENT = new HttpString(USER_AGENT_STRING, 70);
    public static final HttpString VARY = new HttpString(VARY_STRING, 71);
    public static final HttpString VIA = new HttpString(VIA_STRING, 72);
    public static final HttpString WARNING = new HttpString(WARNING_STRING, 73);
    public static final HttpString WWW_AUTHENTICATE = new HttpString(WWW_AUTHENTICATE_STRING, 74);
    public static final HttpString X_CONTENT_TYPE_OPTIONS = new HttpString(X_CONTENT_TYPE_OPTIONS_STRING, 75);
    public static final HttpString X_DISABLE_PUSH = new HttpString(X_DISABLE_PUSH_STRING, 76);
    public static final HttpString X_FORWARDED_FOR = new HttpString(X_FORWARDED_FOR_STRING, 77);
    public static final HttpString X_FORWARDED_HOST = new HttpString(X_FORWARDED_HOST_STRING, 78);
    public static final HttpString X_FORWARDED_PORT = new HttpString(X_FORWARDED_PORT_STRING, 79);
    public static final HttpString X_FORWARDED_PROTO = new HttpString(X_FORWARDED_PROTO_STRING, 80);
    public static final HttpString X_FORWARDED_SERVER = new HttpString(X_FORWARDED_SERVER_STRING, 81);
    public static final HttpString X_FRAME_OPTIONS = new HttpString(X_FRAME_OPTIONS_STRING, 82);
    public static final HttpString X_XSS_PROTECTION = new HttpString(X_XSS_PROTECTION_STRING, 83);
    // Content codings

    public static final HttpString COMPRESS = new HttpString("compress");
    public static final HttpString X_COMPRESS = new HttpString("x-compress");
    public static final HttpString DEFLATE = new HttpString("deflate");
    public static final HttpString IDENTITY = new HttpString("identity");
    public static final HttpString GZIP = new HttpString("gzip");
    public static final HttpString X_GZIP = new HttpString("x-gzip");

    // Transfer codings

    public static final HttpString CHUNKED = new HttpString("chunked");
    // IDENTITY
    // GZIP
    // COMPRESS
    // DEFLATE

    // Connection values
    public static final HttpString KEEP_ALIVE = new HttpString("keep-alive");
    public static final HttpString CLOSE = new HttpString("close");

    //MIME header used in multipart file uploads
    public static final String CONTENT_TRANSFER_ENCODING_STRING = "Content-Transfer-Encoding";
    public static final HttpString CONTENT_TRANSFER_ENCODING = new HttpString(CONTENT_TRANSFER_ENCODING_STRING);

    // Authentication Schemes
    public static final HttpString BASIC = new HttpString("Basic");
    public static final HttpString DIGEST = new HttpString("Digest");
    public static final HttpString NEGOTIATE = new HttpString("Negotiate");

    // Digest authentication Token Names
    public static final HttpString ALGORITHM = new HttpString("algorithm");
    public static final HttpString AUTH_PARAM = new HttpString("auth-param");
    public static final HttpString CNONCE = new HttpString("cnonce");
    public static final HttpString DOMAIN = new HttpString("domain");
    public static final HttpString NEXT_NONCE = new HttpString("nextnonce");
    public static final HttpString NONCE = new HttpString("nonce");
    public static final HttpString NONCE_COUNT = new HttpString("nc");
    public static final HttpString OPAQUE = new HttpString("opaque");
    public static final HttpString QOP = new HttpString("qop");
    public static final HttpString REALM = new HttpString("realm");
    public static final HttpString RESPONSE = new HttpString("response");
    public static final HttpString RESPONSE_AUTH = new HttpString("rspauth");
    public static final HttpString STALE = new HttpString("stale");
    public static final HttpString URI = new HttpString("uri");
    public static final HttpString USERNAME = new HttpString("username");

    private static final Map<String, HttpString> HTTP_STRING_MAP;

    static {
        Map<String, HttpString> map = AccessController.doPrivileged(new PrivilegedAction<Map<String, HttpString>>() {
            @Override
            public Map<String, HttpString> run() {
                Map<String, HttpString> map = new HashMap<>();
                Field[] fields = Headers.class.getDeclaredFields();
                for(Field field : fields) {
                    if(Modifier.isStatic(field.getModifiers()) && field.getType() == HttpString.class) {
                        field.setAccessible(true);
                        try {
                            HttpString result = (HttpString) field.get(null);
                            map.put(result.toString(), result);
                        } catch (IllegalAccessException e) {
                            throw new RuntimeException(e);
                        }
                    }
                }
                return map;
            }
        });
        HTTP_STRING_MAP = Collections.unmodifiableMap(map);
    }

    public static HttpString fromCache(String string) {
        return HTTP_STRING_MAP.get(string);
    }

    /**
     * Extracts a token from a header that has a given key. For instance if the header is
     *

     * content-type=multipart/form-data boundary=myboundary
     * and the key is boundary the myboundary will be returned.
     *
     * @param header The header
     * @param key    The key that identifies the token to extract
     * @return The token, or null if it was not found
     */
    @Deprecated
    public static String extractTokenFromHeader(final String header, final String key) {
        int pos = header.indexOf(' ' + key + '=');
        if (pos == -1) {
            if(!header.startsWith(key + '=')) {
                return null;
            }
            pos = 0;
        } else {
            pos++;
        }
        int end;
        int start = pos + key.length() + 1;
        for (end = start; end < header.length(); ++end) {
            char c = header.charAt(end);
            if (c == ' ' || c == '\t' || c == ';') {
                break;
            }
        }
        return header.substring(start, end);
    }

    /**
     * Extracts a quoted value from a header that has a given key. For instance if the header is
     *

     * content-disposition=form-data; name="my field"
     * and the key is name then "my field" will be returned without the quotes.
     *
     *
     * @param header The header
     * @param key    The key that identifies the token to extract
     * @return The token, or null if it was not found
     */
    public static String extractQuotedValueFromHeader(final String header, final String key) {

        int keypos = 0;
        int pos = -1;
        boolean whiteSpace = true;
        boolean inQuotes = false;
        for (int i = 0; i  0)) {
                    keypos++;
                    whiteSpace = false;
                } else if (c == '"') {
                    keypos = 0;
                    inQuotes = true;
                    whiteSpace = false;
                } else {
                    keypos = 0;
                    whiteSpace = c == ' ' || c == ';' || c == '\t';
                }
                if (keypos == key.length()) {
                    if (header.charAt(i + 1) == '=') {
                        pos = i + 2;
                        break;
                    } else {
                        keypos = 0;
                    }
                }
            }

        }
        if (pos == -1) {
            return null;
        }

        int end;
        int start = pos;
        if (header.charAt(start) == '"') {
            start++;
            for (end = start; end < header.length(); ++end) {
                char c = header.charAt(end);
                if (c == '"') {
                    break;
                }
            }
            return header.substring(start, end);

        } else {
            //no quotes
            for (end = start; end < header.length(); ++end) {
                char c = header.charAt(end);
                if (c == ' ' || c == '\t' || c == ';') {
                    break;
                }
            }
            return header.substring(start, end);
        }
    }

    /**
     * Extracts a quoted value from a header that has a given key. For instance if the header is
     *

     * content-disposition=form-data; filename*="utf-8''test.txt"
     * and the key is filename* then "test.txt" will be returned after extracting character set and language
     * (following RFC 2231) and performing URL decoding to the value using the specified encoding
     *
     * @param header The header
     * @param key    The key that identifies the token to extract
     * @return The token, or null if it was not found
     */
    public static String extractQuotedValueFromHeaderWithEncoding(final String header, final String key) {
        String value = extractQuotedValueFromHeader(header, key);
        if (value != null) {
            return value;
        }
        value = extractQuotedValueFromHeader(header , key + "*");
        if(value != null) {
            int characterSetDelimiter = value.indexOf('\'');
            int languageDelimiter = value.lastIndexOf('\'', characterSetDelimiter + 1);
            String characterSet = value.substring(0, characterSetDelimiter);
            try {
                String fileNameURLEncoded = value.substring(languageDelimiter + 1);
                return URLDecoder.decode(fileNameURLEncoded, characterSet);
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }
        }
        return null;
    }
}


text:
package org.tmatesoft.sqljet.examples.inventory;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.Map;

import org.tmatesoft.sqljet.core.SqlJetException;
import org.tmatesoft.sqljet.core.SqlJetTransactionMode;
import org.tmatesoft.sqljet.core.table.ISqlJetCursor;
import org.tmatesoft.sqljet.core.table.ISqlJetTable;
import org.tmatesoft.sqljet.core.table.ISqlJetTransaction;
import org.tmatesoft.sqljet.core.table.SqlJetDb;

/**
 * @author Dmitry Stadnik (dtrace@seznam.cz)
 */
public class InventoryDB {

	private static final int VERSION = 2;

	private static final String FILE_NAME = "inventory.db";

	private SqlJetDb db;

	public InventoryDB() throws SqlJetException {
		db = SqlJetDb.open(new File(FILE_NAME), true);
		upgrade(VERSION);
	}

	public void close() throws SqlJetException {
		db.close();
		db = null;
	}

	public void beginTransaction(boolean write) throws SqlJetException {
		db.beginTransaction( write ? SqlJetTransactionMode.WRITE : SqlJetTransactionMode.READ_ONLY);
	}

	public void commit() throws SqlJetException {
		db.commit();
	}

	public int getVersion() throws SqlJetException {
		return db.getOptions().getUserVersion();
	}

	private void upgrade(int targetVersion) throws SqlJetException {
		if (targetVersion < 1) {
			return;
		}
		if (getVersion() < 1) {
			db.runWriteTransaction(new ISqlJetTransaction() {

				public Object run(SqlJetDb db) throws SqlJetException {
					db.createTable("create table items (article integer primary key, name text not null, description blob, "
							+ "room int, shelf int, borrowed_from text, borrowed_to text)");
					db.createIndex("create index items_name on items (name asc)");
					db.createIndex("create index items_name_rev on items (name desc)");
					db.createIndex("create index items_location on items (room, shelf)");
					db.getOptions().setUserVersion(1);
					prefillItems();
					return null;
				}
			});
		}
		if (targetVersion < 2) {
			return;
		}
		if (getVersion() < 2) {
			db.runWriteTransaction(new ISqlJetTransaction() {

				public Object run(SqlJetDb db) throws SqlJetException {
					db.createTable("create table users (name text primary key, info text, rating real)");
					db.getOptions().setUserVersion(2);
					prefillUsers();
					return null;
				}
			});
		}
		if (targetVersion > 2) {
			throw new IllegalArgumentException("Unsupported version: " + targetVersion);
		}
	}

	private void prefillItems() throws SqlJetException {
		addItem(new InventoryItem(-1, "MacBook", "Unibody 2GHz", 7, 23, "Dmitry Stadnik", null));
		addItem(new InventoryItem(-1, "iPhone 3G", "8Mb", 7, 24, "Dmitry Stadnik", null));
		addItem(new InventoryItem(-1, "Cup", "Big & White", 3, 1, null, "MG"));
	}

	private void prefillUsers() throws SqlJetException {
		addUser(new InventoryUser("Dmitry Stadnik", "Prague", 0.99));
		addUser(new InventoryUser("James Bond", "Classified", 0));
		addUser(new InventoryUser("MG", null, 0.11));
	}

	// Items

	public ISqlJetCursor getAllItems() throws SqlJetException {
		return db.getTable("items").open();
	}

	public ISqlJetCursor getAllItemsInRoomOnShelf(long room, long shelf) throws SqlJetException {
		return db.getTable("items").lookup("items_location", room, shelf);
	}

	public ISqlJetCursor getAllItemsSortedByName(boolean asc) throws SqlJetException {
		return db.getTable("items").order(asc ? "items_name" : "items_name_rev");
	}

	public InventoryItem getItem(final long article) throws SqlJetException {
		return (InventoryItem) db.runReadTransaction(new ISqlJetTransaction() {

			public Object run(SqlJetDb db) throws SqlJetException {
				ISqlJetCursor cursor = db.getTable("items").open();
				try {
					if (cursor.goTo(article)) {
						InventoryItem item = new InventoryItem();
						item.read(cursor);
						return item;
					}
				} finally {
					cursor.close();
				}
				return null;
			}
		});
	}

	public long addItem(final InventoryItem item) throws SqlJetException {
		return item.article = (Long) db.runWriteTransaction(new ISqlJetTransaction() {

			public Object run(SqlJetDb db) throws SqlJetException {
				byte[] blob = null;
				if (item.description != null) {
					try {
						blob = item.description.getBytes("UTF-8");
					} catch (UnsupportedEncodingException e) {
						throw new IllegalArgumentException(e);
					}
				}
				return db.getTable("items").insert(null, item.name, blob, item.room, item.shelf, item.borrowedTo,
						item.borrowedFrom);
			}
		});
	}

	public void updateItem(final long article, final Map<String, Object> values) throws SqlJetException {
		db.runWriteTransaction(new ISqlJetTransaction() {

			public Object run(SqlJetDb db) throws SqlJetException {
				ISqlJetCursor cursor = db.getTable("items").open();
				try {
					if (cursor.goTo(article)) {
						cursor.updateByFieldNames(values);
					}
				} finally {
					cursor.close();
				}
				return null;
			}
		});
	}

	public void removeItem(final long article) throws SqlJetException {
		db.runWriteTransaction(new ISqlJetTransaction() {

			public Object run(SqlJetDb db) throws SqlJetException {
				ISqlJetCursor cursor = db.getTable("items").open();
				try {
					if (cursor.goTo(article)) {
						cursor.delete();
					}
				} finally {
					cursor.close();
				}
				return null;
			}
		});
	}

	// Users

	public ISqlJetCursor getAllUsers() throws SqlJetException {
		return db.getTable("users").open();
	}

	public InventoryUser getUser(final String name) throws SqlJetException {
		return (InventoryUser) db.runReadTransaction(new ISqlJetTransaction() {

			public Object run(SqlJetDb db) throws SqlJetException {
				ISqlJetTable users = db.getTable("users");
				ISqlJetCursor cursor = users.lookup(users.getPrimaryKeyIndexName(), name);
				try {
					if (!cursor.eof()) {
						InventoryUser user = new InventoryUser();
						user.read(cursor);
						return user;
					}
				} finally {
					cursor.close();
				}
				return null;
			}
		});
	}

	public void addUser(final InventoryUser user) throws SqlJetException {
		db.runWriteTransaction(new ISqlJetTransaction() {

			public Object run(SqlJetDb db) throws SqlJetException {
				return db.getTable("users").insert(user.name, user.info, user.rating);
			}
		});
	}

	public void updateUser(final String name, final Map<String, Object> values) throws SqlJetException {
		db.runWriteTransaction(new ISqlJetTransaction() {

			public Object run(SqlJetDb db) throws SqlJetException {
				ISqlJetTable users = db.getTable("users");
				ISqlJetCursor cursor = users.lookup(users.getPrimaryKeyIndexName(), name);
				try {
					if (!cursor.eof()) {
						cursor.updateByFieldNames(values);
					}
				} finally {
					cursor.close();
				}
				return null;
			}
		});
	}

	public void removeUser(final String name) throws SqlJetException {
		db.runWriteTransaction(new ISqlJetTransaction() {

			public Object run(SqlJetDb db) throws SqlJetException {
				ISqlJetTable users = db.getTable("users");
				ISqlJetCursor cursor = users.lookup(users.getPrimaryKeyIndexName(), name);
				try {
					if (!cursor.eof()) {
						cursor.delete();
					}
				} finally {
					cursor.close();
				}
				return null;
			}
		});
	}
}


text:
package org.apache.sqoop.job.io;

/**
 * An intermediate layer for passing data from the ETL framework
 * to the MR framework.
 */
public abstract class DataWriter {

  public abstract void writeArrayRecord(Object[] array);

  public abstract void writeCsvRecord(String csv);

  public abstract void writeContent(Object content, int type);

  public abstract void setFieldDelimiter(char fieldDelimiter);

}


text:
<?php

use yii\db\Schema;
use yii\db\Migration;

class m150625_104710_users_log extends Migration
{
	public function safeUp()
	{
		$this->createTable('users_log', [
			'id' => Schema::TYPE_INTEGER . '(11) unsigned NULL AUTO_INCREMENT',
			'user_id' => Schema::TYPE_INTEGER . '(11) unsigned NOT NULL DEFAULT 0',
			'date' => Schema::TYPE_INTEGER . '(11) NOT NULL DEFAULT 0',
			'message' => Schema::TYPE_TEXT,
			'PRIMARY KEY (id)'
		], 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB');
		$this->addForeignKey('FK_users_log_users', 'users_log', 'user_id', 'users', 'id', 'CASCADE', 'RESTRICT');
	}

	public function safeDown()
	{
		$this->dropForeignKey('FK_users_log_users', 'users_log');
		$this->dropTable('users_log');
	}
}


text:
'use strict';

const filterObject = require('filter-object');

module.exports = {

    /**
     *
     */
    hasValidationErrors: error => {
        if (!error.errors) {
            return false;
        }

        return !!filterObject(error.errors, err => {
            return err.name === 'ValidatorError';
        });
    },

    /**
     *
     */
    extractErrors: (error, i18nAlias) => {
        const errors = [];

        if (!error.errors) {
            return [];
        }

        const validationErrors = filerObject(error.errors, err => {
            return err.name === 'ValidatorError';
        });

        for (let err in validationErrors) {
            if ((err = validationErrors[err]).message) {
                errors.push({
                    messageCode: err.message,
                    property: i18nAlias ? `${i18nAlias}.${err.path}` : err.path,
                    value: err.value
                });
            }
        }

        return errors;
    }
};


text:
import { combineReducers } from 'redux';
import routerReducer from './routeReducer'
import { reducer as formReducer } from 'redux-form'
import session from './session';
import modal from './modal';
import comment from './comment'
import profile from './profile'
import posts from './posts'
import toast from './toast'
import notification from './notification'
import follow from './follow'
const rootReducer = combineReducers<any>({
  session,
  profile,
  posts,
  follow,
  modal,
  comment,
  toast,
  notification,
  routing: routerReducer,
  form: formReducer,
} as any);

export default rootReducer;


text:
/*
 * Copyright 1992 Purdue Research Foundation, West Lafayette, Indiana
 * 47907.  All rights reserved.
 *
 * Written by Kevin S Braunsdorf, ksb@cc.purdue.edu, purdue!ksb
 *
 * This software is not subject to any license of the American Telephone
 * and Telegraph Company or the Regents of the University of California.
 *
 * Permission is granted to anyone to use this software for any purpose on
 * any computer system, and to alter it and redistribute it freely, subject
 * to the following restrictions:
 *
 * 1. Neither the authors nor Purdue University are responsible for any
 *    consequences of the use of this software.
 *
 * 2. The origin of this software must not be misrepresented, either by
 *    explicit claim or by omission.  Credit to the authors and Purdue
 *    University must appear in documentation and sources.
 *
 * 3. Altered versions must be plainly marked as such, and must not be
 *    misrepresented as being the original software.
 *
 * 4. This notice may not be removed or altered.
 */
/*
 * keep track of network access and peer console servers		(ksb)
 */

typedef struct access {
    char ctrust;		/* how much do we trust the host        */
    char *pcwho;		/* what is the hosts name/ip number     */
    int isCIDR;			/* is this a CIDR addr (or hostname?)   */
    struct access *pACnext;	/* next access list                     */
} ACCESS;

extern char AccType(INADDR_STYPE *, char **);
extern void SetDefAccess(
#if USE_IPV6
			    void
#else
			    struct in_addr *, char *
#endif
    );
extern void DestroyAccessList(ACCESS *);


text:
%w{ autohide magnification workspaces-swoosh-animation-off }.each do |dock|

  mac_os_x_userdefaults "com.apple.dock #{dock}" do
    domain "com.apple.dock"
    key dock
    value "true"
    type "boolean"
    notifies :run, 'execute[killall Dock]'
  end

end

mac_os_x_userdefaults "com.apple.dock tile size" do
  domain "com.apple.dock"
  key "tilesize"
  value "20"
  type "integer"
  notifies :run, 'execute[killall Dock]'
end

execute "killall Dock" do
  action :nothing
end


text:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();

global $CFG;
require_once(dirname(__FILE__) . '/../lib.php');
require_once(dirname(__FILE__) . '/helpers.php');

/**
 * These tests use a standard fixture of a {@link question_attempt} with three steps.
 *
 * @copyright  2009 The Open University
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class question_attempt_with_steps_test extends advanced_testcase {
    private $question;
    private $qa;

    protected function setUp() {
        $this->question = test_question_maker::make_question('description');
        $this->qa = new testable_question_attempt($this->question, 0, null, 2);
        for ($i = 0; $i < 3; $i++) {
            $step = new question_attempt_step(array('i' => $i));
            $this->qa->add_step($step);
        }
    }

    protected function tearDown() {
        $this->qa = null;
    }

    public function test_get_step_before_start() {
        $this->setExpectedException('moodle_exception');
        $step = $this->qa->get_step(-1);
    }

    public function test_get_step_at_start() {
        $step = $this->qa->get_step(0);
        $this->assertEquals(0, $step->get_qt_var('i'));
    }

    public function test_get_step_at_end() {
        $step = $this->qa->get_step(2);
        $this->assertEquals(2, $step->get_qt_var('i'));
    }

    public function test_get_step_past_end() {
        $this->setExpectedException('moodle_exception');
        $step = $this->qa->get_step(3);
    }

    public function test_get_num_steps() {
        $this->assertEquals(3, $this->qa->get_num_steps());
    }

    public function test_get_last_step() {
        $step = $this->qa->get_last_step();
        $this->assertEquals(2, $step->get_qt_var('i'));
    }

    public function test_get_last_qt_var_there1() {
        $this->assertEquals(2, $this->qa->get_last_qt_var('i'));
    }

    public function test_get_last_qt_var_there2() {
        $this->qa->get_step(0)->set_qt_var('_x', 'a value');
        $this->assertEquals('a value', $this->qa->get_last_qt_var('_x'));
    }

    public function test_get_last_qt_var_missing() {
        $this->assertNull($this->qa->get_last_qt_var('notthere'));
    }

    public function test_get_last_qt_var_missing_default() {
        $this->assertEquals('default', $this->qa->get_last_qt_var('notthere', 'default'));
    }

    public function test_get_last_behaviour_var_missing() {
        $this->assertNull($this->qa->get_last_qt_var('notthere'));
    }

    public function test_get_last_behaviour_var_there() {
        $this->qa->get_step(1)->set_behaviour_var('_x', 'a value');
        $this->assertEquals('a value', '' . $this->qa->get_last_behaviour_var('_x'));
    }

    public function test_get_state_gets_state_of_last() {
        $this->qa->get_step(2)->set_state(question_state::$gradedright);
        $this->qa->get_step(1)->set_state(question_state::$gradedwrong);
        $this->assertEquals(question_state::$gradedright, $this->qa->get_state());
    }

    public function test_get_mark_gets_mark_of_last() {
        $this->assertEquals(2, $this->qa->get_max_mark());
        $this->qa->get_step(2)->set_fraction(0.5);
        $this->qa->get_step(1)->set_fraction(0.1);
        $this->assertEquals(1, $this->qa->get_mark());
    }

    public function test_get_fraction_gets_fraction_of_last() {
        $this->qa->get_step(2)->set_fraction(0.5);
        $this->qa->get_step(1)->set_fraction(0.1);
        $this->assertEquals(0.5, $this->qa->get_fraction());
    }

    public function test_get_fraction_returns_null_if_none() {
        $this->assertNull($this->qa->get_fraction());
    }

    public function test_format_mark() {
        $this->qa->get_step(2)->set_fraction(0.5);
        $this->assertEquals('1.00', $this->qa->format_mark(2));
    }

    public function test_format_max_mark() {
        $this->assertEquals('2.0000000', $this->qa->format_max_mark(7));
    }

    public function test_get_min_fraction() {
        $this->qa->set_min_fraction(-1);
        $this->assertEquals(-1, $this->qa->get_min_fraction(0));
    }

    public function test_cannot_get_min_fraction_before_start() {
        $qa = new question_attempt($this->question, 0);
        $this->setExpectedException('moodle_exception');
        $qa->get_min_fraction();
    }
}


text:
'''
Created on 15 jan. 2013

@author: sander
'''

from pylisp.application.lispd.address_tree.ddt_referral_node import handle_ddt_map_request
from pylisp.application.lispd.address_tree.etr_node import ETRNode
from pylisp.application.lispd.address_tree.map_server_node import MapServerNode, MapServerException
from pylisp.application.lispd.send_message import send_message
from pylisp.application.lispd.utils.prefix import determine_instance_id_and_afi, resolve, resolve_path
from pylisp.packet.lisp.control.encapsulated_control_message import EncapsulatedControlMessage
from pylisp.packet.lisp.control.info_message import InfoMessage
from pylisp.packet.lisp.control.map_notify import MapNotifyMessage
from pylisp.packet.lisp.control.map_referral import MapReferralMessage
from pylisp.packet.lisp.control.map_register import MapRegisterMessage
from pylisp.packet.lisp.control.map_register_record import MapRegisterRecord
from pylisp.packet.lisp.control.map_reply import MapReplyMessage
from pylisp.packet.lisp.control.map_request import MapRequestMessage
import logging

# Get the logger
logger = logging.getLogger(__name__)

def handle_message(received_message, control_plane_sockets, data_plane_sockets):
    """
    Handle a LISP message. The default handle method determines the type
    of message and delegates it to the more specific method
    """
    logger.debug(u"Handling message #{0} ({1}) from {2}".format(received_message.message_nr,
                                                                received_message.message.__class__.__name__,
                                                                received_message.source[0]))

    try:
        if isinstance(received_message.message, MapRequestMessage):
            # A map-request message
            handle_map_request(received_message, control_plane_sockets, data_plane_sockets)

        elif isinstance(received_message.message, MapReplyMessage):
            # A map-reply message
            handle_map_reply(received_message, control_plane_sockets, data_plane_sockets)

        elif isinstance(received_message.message, MapNotifyMessage):
            # A map-notify message (subclass of MapRegisterMessage, so put above it!)
            handle_map_notify(received_message, control_plane_sockets, data_plane_sockets)

        elif isinstance(received_message.message, MapRegisterMessage):
            # A map-register message
            handle_map_register(received_message, control_plane_sockets, data_plane_sockets)

        elif isinstance(received_message.message, MapReferralMessage):
            # A map-referral message
            handle_map_referral(received_message, control_plane_sockets, data_plane_sockets)

        elif isinstance(received_message.message, EncapsulatedControlMessage):
            # Determine the type of ECM
            if isinstance(received_message.inner_message, MapRequestMessage):
                if received_message.message.ddt_originated:
                    # A DDT map-request message
                    handle_ddt_map_request(received_message, control_plane_sockets, data_plane_sockets)
                else:
                    # An encapsulated map-request message
                    handle_enc_map_request(received_message, control_plane_sockets, data_plane_sockets)
            else:
                logger.warning("ECM does not contain a map-request in message %d", received_message.message_nr)
        elif isinstance(received_message.message, InfoMessage):
            handle_info_message(received_message, control_plane_sockets, data_plane_sockets)
        else:
            logger.warning("Unknown content in message %d", received_message.message_nr)
    except:
        logger.exception("Unexpected exception while handling message %d", received_message.message_nr)

def handle_map_reply(received_message, control_plane_sockets, data_plane_sockets):
    pass

def handle_map_register(received_message, control_plane_sockets, data_plane_sockets):
    map_register = received_message.message
    assert isinstance(map_register, MapRegisterMessage)

    processed_records = []
    saved_key = ''
    for record in map_register.records:
        assert isinstance(record, MapRegisterRecord)

        # Look up the address in the tree
        instance_id, afi, prefix = determine_instance_id_and_afi(record.eid_prefix)
        tree_node = resolve(instance_id, afi, prefix)

        if isinstance(tree_node, MapServerNode):
            try:
                tree_node.handle_map_register_record(received_message, record, control_plane_sockets, data_plane_sockets)

                # Record processed: store the record, and keep the authentication key in case we want to send back a notify
                processed_records.append(record)
                saved_key = tree_node.key
            except MapServerException, e:
                logger.error("MapServerNode could not process record {0}: {1}".format(record, e.message))
        else:
            logger.warn(u"Received a Map-Register message for {0}"
                         ", but we are not a MapServer for that EID space".format(prefix))

    if map_register.want_map_notify \
    and processed_records:
        # Notify the sender using the saved key from the MapServerNode
        notify = MapNotifyMessage(nonce=map_register.nonce,
                                  key_id=map_register.key_id,
                                  records=processed_records,
                                  xtr_id=map_register.xtr_id,
                                  site_id=map_register.site_id)
        notify.insert_authentication_data(saved_key)

        # Send the reply over UDP
        send_message(message=notify,
                     my_sockets=[received_message.socket],
                     destinations=[received_message.source[0]],
                     port=4342)

def handle_map_referral(received_message, control_plane_sockets, data_plane_sockets):
    pass

def handle_map_notify(received_message, control_plane_sockets, data_plane_sockets):
    map_notify = received_message.message
    assert isinstance(map_notify, MapNotifyMessage)

    for record in map_notify.records:
        assert isinstance(record, MapRegisterRecord)

        # Look up the address in the tree
        instance_id, afi, prefix = determine_instance_id_and_afi(record.eid_prefix)
        tree_node = resolve(instance_id, afi, prefix)

        if isinstance(tree_node, ETRNode):
            tree_node.handle_map_notify_record(received_message, record, control_plane_sockets, data_plane_sockets)
        else:
            logger.warn(u"Received a Map-Notify message for {0}"
                         ", but we are not a MapServerClient for that EID space".format(prefix))

def handle_info_message(received_message, control_plane_sockets, data_plane_sockets):
    info_message = received_message.message
    assert isinstance(info_message, InfoMessage)

    logger.debug('HANDLING {0!r}'.format(received_message))

    if not received_message.message.is_reply:
        logger.error(u"We are not an RTR, we can only handle InfoMessage replies")
        return

    eid_prefix = info_message.eid_prefix
    instance_id, afi, eid_prefix = determine_instance_id_and_afi(eid_prefix)
    node = resolve(instance_id, afi, eid_prefix)
    if not isinstance(node, ETRNode):
        # Not for us: drop
        logger.warn(u"Ignoring message {0}: Info-Message for prefix {1} in instance {2} "
                     "for which we are not an ETR".format(received_message.message_nr, eid_prefix, instance_id))
        return

    node.handle_info_message_reply(received_message, control_plane_sockets, data_plane_sockets)

def handle_map_request(received_message, control_plane_sockets, data_plane_sockets):
    map_request = received_message.message
    assert isinstance(map_request, MapRequestMessage)

    if len(map_request.eid_prefixes) != 1:
        logger.warn(u"Ignoring message {0}: Map-Request with eid-prefix count != 1".format(received_message.message_nr))
        return

    eid_prefix = map_request.eid_prefixes[0]
    instance_id, afi, eid_prefix = determine_instance_id_and_afi(eid_prefix)
    nodes = resolve_path(instance_id, afi, eid_prefix)
    if not nodes:
        logger.warn(u"Ignoring message {0}: Map-Request for unknown"
                     " instance {1} with AFI {2}".format(received_message.message_nr, instance_id, afi))
        return

    if not isinstance(nodes[0], ETRNode):
        # Not for us: drop
        logger.warn(u"Ignoring message {0}: Map-Request for prefix {1} in instance {2} "
                     "for which we are not an ETR".format(received_message.message_nr, eid_prefix, instance_id))
        return

    nodes[0].handle_map_request(received_message, eid_prefix, control_plane_sockets, data_plane_sockets)

def handle_enc_map_request(received_message, control_plane_sockets, data_plane_sockets):
    pass


text:
@-webkit-keyframes oo-ui-progressBarWidget-slide {
	from {
		margin-left: -40%;
	}
	to {
		margin-left: 100%;
	}
}
@-moz-keyframes oo-ui-progressBarWidget-slide {
	from {
		margin-left: -40%;
	}
	to {
		margin-left: 100%;
	}
}
@keyframes oo-ui-progressBarWidget-slide {
	from {
		margin-left: -40%;
	}
	to {
		margin-left: 100%;
	}
}
.oo-ui-icon-indent {
	background-image: url("themes/mediawiki/images/icons/indent-ltr.png");
	background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/indent-ltr.svg");
	background-image:         linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/indent-ltr.svg");
	background-image:      -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/indent-ltr.png");
}
.oo-ui-image-invert.oo-ui-icon-indent {
	background-image: url("themes/mediawiki/images/icons/indent-ltr-invert.png");
	background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/indent-ltr-invert.svg");
	background-image:         linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/indent-ltr-invert.svg");
	background-image:      -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/indent-ltr-invert.png");
}
.oo-ui-icon-listBullet {
	background-image: url("themes/mediawiki/images/icons/listBullet-ltr.png");
	background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/listBullet-ltr.svg");
	background-image:         linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/listBullet-ltr.svg");
	background-image:      -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/listBullet-ltr.png");
}
.oo-ui-image-invert.oo-ui-icon-listBullet {
	background-image: url("themes/mediawiki/images/icons/listBullet-ltr-invert.png");
	background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/listBullet-ltr-invert.svg");
	background-image:         linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/listBullet-ltr-invert.svg");
	background-image:      -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/listBullet-ltr-invert.png");
}
.oo-ui-icon-listNumbered {
	background-image: url("themes/mediawiki/images/icons/listNumbered-ltr.png");
	background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/listNumbered-ltr.svg");
	background-image:         linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/listNumbered-ltr.svg");
	background-image:      -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/listNumbered-ltr.png");
}
.oo-ui-image-invert.oo-ui-icon-listNumbered {
	background-image: url("themes/mediawiki/images/icons/listNumbered-ltr-invert.png");
	background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/listNumbered-ltr-invert.svg");
	background-image:         linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/listNumbered-ltr-invert.svg");
	background-image:      -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/listNumbered-ltr-invert.png");
}
.oo-ui-icon-outdent {
	background-image: url("themes/mediawiki/images/icons/outdent-ltr.png");
	background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/outdent-ltr.svg");
	background-image:         linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/outdent-ltr.svg");
	background-image:      -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/outdent-ltr.png");
}
.oo-ui-image-invert.oo-ui-icon-outdent {
	background-image: url("themes/mediawiki/images/icons/outdent-ltr-invert.png");
	background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/outdent-ltr-invert.svg");
	background-image:         linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/outdent-ltr-invert.svg");
	background-image:      -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/outdent-ltr-invert.png");
}


text:
class Role < ActiveRecord::Base
  acts_as_authorization_role
end

# == Schema Information
#
# Table name: roles
#
#  id                :integer          not null, primary key
#  name              :string(255)      not null
#  authorizable_type :string(255)
#  authorizable_id   :integer
#  system            :boolean          default(FALSE), not null
#  created_at        :datetime         not null
#  updated_at        :datetime         not null
#
# Indexes
#
#  index_roles_on_authorizable_type_and_authorizable_id  (authorizable_type,authorizable_id)
#  index_roles_on_name                                   (name)
#


text:
package lambdaiface

import (
	"github.com/aws/aws-sdk-go/service/lambda"
)

// LambdaAPI is the interface type for lambda.Lambda.
type LambdaAPI interface {
	AddPermission(*lambda.AddPermissionInput) (*lambda.AddPermissionOutput, error)

	CreateEventSourceMapping(*lambda.CreateEventSourceMappingInput) (*lambda.EventSourceMappingConfiguration, error)

	CreateFunction(*lambda.CreateFunctionInput) (*lambda.FunctionConfiguration, error)

	DeleteEventSourceMapping(*lambda.DeleteEventSourceMappingInput) (*lambda.EventSourceMappingConfiguration, error)

	DeleteFunction(*lambda.DeleteFunctionInput) (*lambda.DeleteFunctionOutput, error)

	GetEventSourceMapping(*lambda.GetEventSourceMappingInput) (*lambda.EventSourceMappingConfiguration, error)

	GetFunction(*lambda.GetFunctionInput) (*lambda.GetFunctionOutput, error)

	GetFunctionConfiguration(*lambda.GetFunctionConfigurationInput) (*lambda.FunctionConfiguration, error)

	GetPolicy(*lambda.GetPolicyInput) (*lambda.GetPolicyOutput, error)

	Invoke(*lambda.InvokeInput) (*lambda.InvokeOutput, error)

	InvokeAsync(*lambda.InvokeAsyncInput) (*lambda.InvokeAsyncOutput, error)

	ListEventSourceMappings(*lambda.ListEventSourceMappingsInput) (*lambda.ListEventSourceMappingsOutput, error)

	ListFunctions(*lambda.ListFunctionsInput) (*lambda.ListFunctionsOutput, error)

	RemovePermission(*lambda.RemovePermissionInput) (*lambda.RemovePermissionOutput, error)

	UpdateEventSourceMapping(*lambda.UpdateEventSourceMappingInput) (*lambda.EventSourceMappingConfiguration, error)

	UpdateFunctionCode(*lambda.UpdateFunctionCodeInput) (*lambda.FunctionConfiguration, error)

	UpdateFunctionConfiguration(*lambda.UpdateFunctionConfigurationInput) (*lambda.FunctionConfiguration, error)
}


text:
import { Device } from './device';
import UdpServer from './udp-server';

export { Device, UdpServer };


text:
import { UxTheme } from '@aurelia-ux/core';

export class UxInputTheme implements UxTheme {
  public themeKey = 'input';

  public foreground?: string;
  public foregroundLabel?: string;
  public background?: string;
  public backgroundHover?: string;
  public activeColor?: string;

  public fontSize?: string;
  public letterSpacing?: string;
  public labelFontSize?: string;
  public labelLetterSpacing?: string;
  public lineHeight?: string;
  public labelLineHeight?: string;

  public borderColor?: string;
  public borderRadius?: string;
  public borderWidth?: string;
  public borderActiveWidth?: string;

  public disabledForeground?: string;
  public disabledBackground?: string;

  public error?: string;
}


text:
<?php
/**
 * $ php -S localhost:8080 index.php
 *
 * you can edit syntax error on the fly.
 *
 */
require __DIR__ . '/bootstrap.php';
require __DIR__ . '/error.php';


text:
cd /data/macho

for x in root/archives/*; do
    b=$(basename $x)
    echo $b
    if [ root/archives/$b/mbox -nt root/archives/$b/index ]; then
        ./macho update $b
    fi
done


text:
layout: default
title: Palestrantes
permalink: /speakers/
image: rockstar-speakers.jpg
modal: all
---

{% include top-section.html %}

{% include speakers-list.html %}

{% include partners.html %}


text:
layout: post
title: "Wie schreibe ich einen 'guten' Konstruktor?"
excerpt: "Hier erkläre ich dir welche Überlegungen du beim schreiben eines Konstruktors beachten solltest."
categories: csharp-tutorial-deutsch
lernmoment: C#
lm-newsletter-group-id: 1
share: false
show-lm-newsletter-subscribe-box: true
tags: [Syntax, Datentypen, Initialisierung]
image:
  feature: banner/lernmoment-csharp.jpg
modified:
date: 2020-06-21T09:13:09+01:00
published: false
---

Mmmmmoin und willkommen zu deinem LernMoment!

Gerade wenn du deine ersten Klassen schreibst, ist der Konstruktor wahrscheinlich erstmal ein Mysterium. Anfänglich solltest du ihm auch erstmal nicht soviel Bedeutung schenken. Hast du dann aber die [Grundlagen der ObjektOrientierung](https://www.youtube.com/playlist?list=PLP2TrPpx5VNl4t9kS2MMWNveEWl41gEKX) verstanden und auch deine ersten kleinen Anwendungen geschrieben, ist es Zeit sich den Konstruktor genauer anzuschauen.

*Tipp für Fortgeschrittene: Neben dem Konstruktor gibt es auch den `Object Initializer`. Die Unterschiede und wie du beide gemeinsam nutzt, erkläre ich dir [in diesen Artikel](/csharp-programmieren/initialisierung-mit-konstruktor-und-object-initializer/).*

Viel Spaß auf deinem Weg vom Einsteiger zum C# Entwickler

Jan von LernMoment.de


text:
{{ define "title" }}Add Card{{ end }}
{{ define "content" }}

<form method="post">

					Front

						Text:
						<textarea class="form-control" rows="5"
							id="frontText" name="front-text" autofocus></textarea>

						Image:
						<input type="file" class="form-control-file"
							id="imageFile" aria-describedby="fileHelp">

					Back

						Text:
						<input class="form-control" type="text" id="backText"
							name="back-text">

						Pronounciation:
						<input type="file" class="form-control-file"
							id="audioFile" aria-describedby="fileHelp">

		<button type="submit" class="btn btn-primary">Add</button>

</form>

{{ end }}


text:
using System;
using Figlotech.Core.I18n;

namespace Figlotech.Core {
    public class BDadosPortugueseStringsProvider : IBDadosStringsProvider {
        public string AUTH_USER_MAX_ATTEMPTS_EXCEEDED => "Tentativas de login excedidas, aguarde {0} minutos(s).";
        public string AUTH_USER_NOT_FOUND => "Usuário e/ou senha incorreto(s)";
        public string AUTH_PASSWORD_INCORRECT => "Usuário e/ou senha incorreto(s)";
        public string AUTH_USER_BLOCKED => "Usuário bloqueado";
        public string AUTH_PASSWORDS_MUST_MATCH => "Senha e confirmação precisam ser idênticas.";
        public string AUTH_USER_ALREADY_EXISTS => "Usuário já existe";
        public string BDIOC_CANNOT_RESOLVE_TYPE => "Não foi possível resolver o tipo '{0}'";
        public string SCOPY_ACCESSORS_CANNOT_BE_SAME => "SmartCopy não pode copiar de um repositório para ele mesmo.";

        public string ERROR_IN_STRUCTURE_CHECK => "Erro ao verificar a estrutura.";

        public string RDBMS_CANNOT_CONNECT => "Não foi possivel conectar ao RDBMS: {0}";
    }
}


text:
package org.projectsample.simplest.s1.security.exception;

/**
 * The password is not correct.
 *
 * @author Jason Xing
 */
@SuppressWarnings("serial")
public class PasswordNotCorrectException extends Exception {

   public PasswordNotCorrectException() {
       super();
   }

   public PasswordNotCorrectException(String message) {
       super(message);
   }

   public PasswordNotCorrectException(Exception e) {
       super(e.toString());
   }

}


text:
/**
 * Set NODE_ENV.
 * @function env
 */
'use strict'

const states = require('./states')

/** @lends env */
function env (NODE_ENV) {
  states.push('NODE_ENV', process.env.NODE_ENV || null)
  process.env.NODE_ENV = NODE_ENV
}

/**
 * Restore NODE_ENV
 * @function env.restore
 */
env.restore = function restore () {
  let popped = states.pop('NODE_ENV')
  if (typeof popped !== 'undefined') {
    process.env.NODE_ENV = popped
  }
}

module.exports = env


text:
import { Dimensions, Platform } from 'react-native'
import { action, observable, runInAction } from 'mobx'
import { getChapter, getChapterByIndex, updateDiscover } from 'service'

import { Toast } from 'antd-mobile'
import settingStore from 'store/settingStore'

const deviceWidth = Dimensions.get('window').width
const deviceHeight = Dimensions.get('window').height - 20

const OFFSET = Platform.OS === 'ios' ? 70 : 15
const LINE_INDENT = '        '
const LINE_WRAP = '\n'

function zhcnCode(s) {
  return /[\u3400-\u4DB5\u4E00-\u9FA5\u9FA6-\u9FBB\uF900-\uFA2D\uFA30-\uFA6A\uFA70-\uFAD9\uFF00-\uFFEF\u2E80-\u2EFF\u3000-\u303F\u31C0-\u31EF\u2F00-\u2FDF\u2FF0-\u2FFF\u3100-\u312F\u31A0-\u31BF\u3040-\u309F\u30A0-\u30FF\u31F0-\u31FF\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F\u4DC0-\u4DFF\uA000-\uA48F\uA490-\uA4CF\u2800-\u28FF\u3200-\u32FF\u3300-\u33FF\u2700-\u27BF\u2600-\u26FF\uFE10-\uFE1F\uFE30-\uFE4F,。?:;!、【】——]/.test(
    s
  )
}

function HalfCode(s) {
  return /[""''~@#$%&*(),.?:;'!"a-z]/.test(s)
}

/**
 * 获取一个字符的大小
 * @param {String} char 要判断的字符
 * @param {Number} fontSize 初始大小,以中文字大小为准
 */
function getCharSize(char, fontSize) {
  return zhcnCode(char) ? fontSize : HalfCode(char) ? fontSize * 0.55 : fontSize * 0.85
}

/**
 *  字符串换行处理
 * @param {string} str 要拆分的字符串
 * @param {number} lineWidth key的数据的前缀
 */
function lineFeed(str, lineWidth) {
  let result = []
  let chars = str.split('')
  let linefeed = 0
  // 第一次转换需要进行首航缩进
  let lineEnd = lineWidth - settingStore.indentWidth
  if (!str && str === '') return result
  let start = 0
  let size = 0
  for (let i = 0, length = chars.length; i < length; i++) {
    size = Math.ceil(getCharSize(chars[i], settingStore.fontSize))
    if (linefeed + size >= lineEnd) {
      if (result.length === 0) {
        result.push(LINE_INDENT + chars.slice(start, i).join('') + LINE_WRAP)
        lineEnd = lineWidth
      } else {
        result.push(chars.slice(start, i).join('') + LINE_WRAP)
      }
      start = i
      linefeed = size
    } else {
      linefeed += size
    }
  }
  result.push(
    result.length === 0
      ? LINE_INDENT + chars.slice(start).join('') + LINE_WRAP
      : chars.slice(start).join('') + LINE_WRAP
  )
  return result
}

class ReadingStore {
  @observable pageloading = false
  /** 时间戳 */
  @observable timestamp = Date.now()
  @observable bookId = ''
  /** 章节Id */
  @observable chapterId = ''
  /** 章节地址 */
  @observable chapterUri = ''
  /** 章节名 */
  @observable chapterName = ''
  /** 页码 */
  @observable pageIndex = 0
  /** 是否是夜间模式 */
  @observable isNightMode = false

  /** 页 */
  @observable pagers = [{ key: 'page0', context: '' }, { key: 'page1', context: '' }]
  /** 总数 */
  @observable total = 1

  @action
  async get(chapterId, pageIndex, jumpIndex) {
    return new Promise(async (resolve, reject) => {
      try {
        const result = await getChapter(chapterId || this.chapterId)
        runInAction(() => {
          if (pageIndex) {
            this.pageIndex = pageIndex
          }
          if (chapterId) {
            this.chapterId = chapterId
          }
          this.chapterName = result.name
          this.bookId = result.bookId
          this.content = result.content.replace(/\r\n/g, '')
          const { total, pagers } = this.genPager(this.content, chapterId)
          this.total = total
          this.pagers.replace(pagers)
          const page = jumpIndex == null ? this.pageIndex : jumpIndex < 0 ? this.total : 1
          this.pageIndex = page
          this.timestamp = Date.now()
          resolve(true)
        })
      } catch (error) {
        Toast.fail('加载失败!!!')
        reject(error)
      }
    })
  }

  @action
  reGenPager() {
    const { total, pagers } = this.genPager(this.content, this.chapterId)
    const page = this.pageIndex ? (this.pageIndex < total ? this.pageIndex : total) : 1
    this.total = total
    this.pagers.replace(pagers)
    this.pageIndex = page
    this.timestamp = Date.now()
  }

  genPager(str, preKey) {
    // 取整
    const lineMax = Math.round((deviceHeight - OFFSET) / settingStore.theme.lineHeight)
    const lineWidth = deviceWidth - settingStore.fontSize * 2.5

    // 处理章节内容
    let content = str.split('    ')
    let lines = []
    let total = 0
    let pagers = [{ key: preKey + '0', context: '' }]
    for (let i = 0; i < content.length; i++) {
      lines = lines.concat(lineFeed(content[i], lineWidth))
    }
    total = Math.ceil(lines.length / lineMax)
    for (var i = 0; i < total; i++) {
      pagers.push({
        key: preKey + i + 1,
        context: lines.slice(lineMax * i, lineMax * (i + 1)).join(''),
        page: i + 1,
        title: this.chapterName,
        total
      })
    }
    pagers.push({ key: preKey + total + 1, context: '' })
    return { total, pagers }
  }

  /**
   * 章节跳转
   * @param {Number} index 章节号,1或者-1
   */
  @action
  async jump(index) {
    return new Promise(async (resolve, reject) => {
      const result = await getChapterByIndex(this.bookId, this.chapterId, index)
      if (result) {
        const chapterId = result.chapterId
        await this.get(chapterId, null, index)
        updateDiscover({
          id: this.bookId,
          discoverPage: this.pageIndex,
          discoverChapterId: result.chapterId,
          discoverChapterIndex: result.index,
          discoverChapterName: result.text
        })
        resolve(true)
      } else {
        Toast.info(index > 0 ? '已经是最后一章了' : '已经是第一章了', 0.7)
      }
    })
  }

  /**
   * 记录当前页码
   * @param {Number} page 页码
   */
  @action
  async discover(page) {
    this.pageIndex = page
    updateDiscover({ id: this.bookId, discoverPage: page })
  }
}

const readingStore = new ReadingStore()

export default readingStore


text:
==========
Bit Trader
==========

About
=====
A Python 3 package that provides standardized APIs to trade on the following exchanges:

`Bitfloor <http://www.bitfloor.com>, (API Documentation <https://bitfloor.com/docs/api>)`
`Mt Gox <http://www.mtgox.com>, (API Documentation <https://mtgox.com/api>)`
`CampBX <http://www.campbx.com>, (API Documentation <https://campbx.com/api.php>)`

Includes a curses interface for trading in addition to packages that allow for use in python scripts to employ automated trading strategies.

Installation
============

``pip install bittrader``

Documentation
=============

Usage
=====

API Keys must be added to the file located at "./keys/keys.json"

Initializing the API::

    import bittrader as bt
    trader = bt.platform(keys, exchange)

Donations
=========
If you find this software useful please donate to: 17GRViZR6kqcTpHJrh1e7eEsZkvngUtaZK