text:
require 'spec_helper'
require 'capistrano/fleet_captain'

describe Capistrano::FleetCaptain do

  # mimic capistranos rake context setup
  def fetch(key)
    {
      fleet_endpoint: 'http://127.0.0.1:4001'
    }[key]
  end

  let(:cap_object) { Capistrano::FleetCaptain.new(self, Capistrano::FleetCaptain::DefaultStrategy) }
  subject { cap_object }

  before do
    FleetCaptain.fleetfile(File.expand_path(File.join(__dir__, '../fixtures/Fleetfile')))
  end

  after { FleetCaptain.services.clear }

  describe '#docker', :vcr do
    it 'should be a fleetcaptain client' do
      expect(subject.docker_client).to be_a ::FleetCaptain::DockerClient
    end
  end

  describe '#fleet_client', :vcr do
    subject { cap_object.fleet_client }
    it { is_expected.to be_a FleetCaptain::FleetClient }
  end

  describe '#cluster' do
    subject { cap_object.cluster(:list) }

    it "passes the fleet operation to the client" do
      expect(cap_object.fleet_client).to receive(:list)
      subject
    end
  end

  describe '#new_locally', :vcr do
    include_context 'ssh connection established'

    before do
      subject.fleet_client = fleet_client
    end

    it 'should include units in the fleet file not on the cluster' do
      expect(subject.new_locally).to include FleetCaptain::Service['hello_world']
    end
  end

  describe '#identical_services', :vcr do
    include_context 'ssh connection established'
    include_context 'clear cluster'

    before do
      fleet_client.submit(truebox)
    end

    let(:truebox) { FleetCaptain::Service['truebox'] }

    it 'returns services present in both fleetfile and cluster' do
      expect(subject.identical_services.to_a).to eq [truebox]
    end
  end

  describe '#changed_locally', :live do
    include_context 'ssh connection established'

    before do
      fleet_client.submit(truebox)
    end

    let(:truebox) { FleetCaptain::Service['truebox'] }

    it 'should list changed units' do
      expect { truebox.start = [run: '/bin/bash false'] }
        .to change { subject.changed_locally.to_a }
        .from([])
        .to([truebox])
    end
  end

  describe '#removed_locally', :vcr do
    include_context 'ssh connection established'

    let(:removed_unit) { <<-UNIT.strip_heredoc
       [Unit]
       Description=Hello World
       Name=Unnamed

       [Service]
       ExecStart=/bin/bash -c "while true; do echo \\"Hello, world\\"; sleep 1; done"
    UNIT
    }

    it 'shows locally removed units' do
      expect(subject.removed_locally.to_a.first.to_unit).to eq removed_unit
    end
  end

  describe '#register', :vcr do
    include_context 'ssh connection established'
    include_context 'units'

    it 'uploads the systemd unit file to the cluster' do
      expect(subject.register(falsebox)).to eq true
    end
  end

  describe '#start', :vcr do
    include_context 'ssh connection established'
    include_context 'units'

    context 'starting a registered box' do
      before do
        subject.register(runbox)
        loop until subject.loaded?(runbox)
      end

      it 'starts the runbox file on the cluster' do
        expect(subject.start(runbox)).to eq true
      end
    end

    context 'starting an unregistered serviced', :vcr do
      it 'do not do that' do
        expect { subject.start(runbox) }
          .to raise_error FleetCaptain::ServiceNotRegistered
      end
    end
  end

  describe '#stop' do
    #include_context 'ssh connection established'
    #include_context 'runbox'

    #it 'stops the service on the cluster' do
    #  subject.start(runbox)
    #  expect(subject.stop(runbox)).to eq true
    #end
  end

  describe '#remove'
  describe '#restart'

  describe '#local_services' do
    subject { cap_object.local_services }
    it "contains only FleetCaptain::Service objects" do
      subject.each do |service|
        expect(service).to be_instance_of FleetCaptain::Service
      end
    end

    it 'contains objects defined only in the Fleetfile' do
      expect(subject.length).to eq 2
    end
  end
end


text:
package org.apache.camel.component.aws.sqs;

import java.util.Collection;

import com.amazonaws.services.sqs.AmazonSQS;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriParams;
import org.apache.camel.spi.UriPath;

@UriParams
public class SqsConfiguration {

    // common properties
    @UriPath @Metadata(required = "true")
    private String queueName;
    @UriParam
    private AmazonSQS amazonSQSClient;
    @UriParam
    private String accessKey;
    @UriParam
    private String secretKey;
    @UriParam
    private String amazonSQSEndpoint;
    @UriParam
    private String queueOwnerAWSAccountId;
    @UriParam
    private String region;
    // consumer properties
    @UriParam(defaultValue = "true")
    private Boolean deleteAfterRead = Boolean.TRUE;
    @UriParam(defaultValue = "true")
    private Boolean deleteIfFiltered = Boolean.TRUE;
    @UriParam
    private Integer visibilityTimeout;
    @UriParam
    private Collection<String> attributeNames;
    @UriParam
    private Collection<String> messageAttributeNames;
    @UriParam
    private Integer waitTimeSeconds;
    @UriParam
    private Integer defaultVisibilityTimeout;
    @UriParam(defaultValue = "false")
    private Boolean extendMessageVisibility = Boolean.FALSE;
    @UriParam(defaultValue = "1")
    private Integer concurrentConsumers = 1;

    // producer properties
    @UriParam
    private Integer delaySeconds;

    // queue properties
    @UriParam
    private Integer maximumMessageSize;
    @UriParam
    private Integer messageRetentionPeriod;
    @UriParam
    private Integer receiveMessageWaitTimeSeconds;
    @UriParam
    private String policy;

    // dead letter queue properties
    @UriParam
    private String redrivePolicy;

    public void setAmazonSQSEndpoint(String amazonSQSEndpoint) {
        this.amazonSQSEndpoint = amazonSQSEndpoint;
    }

    public String getAmazonSQSEndpoint() {
        return amazonSQSEndpoint;
    }

    public String getQueueName() {
        return queueName;
    }

    public void setQueueName(String queueName) {
        this.queueName = queueName;
    }

    public String getAccessKey() {
        return accessKey;
    }

    public void setAccessKey(String accessKey) {
        this.accessKey = accessKey;
    }

    public String getSecretKey() {
        return secretKey;
    }

    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }

    public Boolean isDeleteAfterRead() {
        return deleteAfterRead;
    }

    public void setDeleteAfterRead(Boolean deleteAfterRead) {
        this.deleteAfterRead = deleteAfterRead;
    }

    public AmazonSQS getAmazonSQSClient() {
        return amazonSQSClient;
    }

    public void setAmazonSQSClient(AmazonSQS amazonSQSClient) {
        this.amazonSQSClient = amazonSQSClient;
    }

    public Integer getVisibilityTimeout() {
        return visibilityTimeout;
    }

    public void setVisibilityTimeout(Integer visibilityTimeout) {
        this.visibilityTimeout = visibilityTimeout;
    }

    public Collection<String> getAttributeNames() {
        return attributeNames;
    }

    public void setAttributeNames(Collection<String> attributeNames) {
        this.attributeNames = attributeNames;
    }

    public Collection<String> getMessageAttributeNames() {
        return messageAttributeNames;
    }

    public void setMessageAttributeNames(Collection<String> messageAttributeNames) {
        this.messageAttributeNames = messageAttributeNames;
    }

    public Integer getDefaultVisibilityTimeout() {
        return defaultVisibilityTimeout;
    }

    public void setDefaultVisibilityTimeout(Integer defaultVisibilityTimeout) {
        this.defaultVisibilityTimeout = defaultVisibilityTimeout;
    }

    public Integer getDelaySeconds() {
        return delaySeconds;
    }

    public void setDelaySeconds(Integer delaySeconds) {
        this.delaySeconds = delaySeconds;
    }

    public Integer getMaximumMessageSize() {
        return maximumMessageSize;
    }

    public void setMaximumMessageSize(Integer maximumMessageSize) {
        this.maximumMessageSize = maximumMessageSize;
    }

    public Integer getMessageRetentionPeriod() {
        return messageRetentionPeriod;
    }

    public void setMessageRetentionPeriod(Integer messageRetentionPeriod) {
        this.messageRetentionPeriod = messageRetentionPeriod;
    }

    public String getPolicy() {
        return policy;
    }

    public void setPolicy(String policy) {
        this.policy = policy;
    }

    public String getRedrivePolicy() {
        return redrivePolicy;
    }

    public void setRedrivePolicy(String redrivePolicy) {
        this.redrivePolicy = redrivePolicy;
    }

    public boolean isExtendMessageVisibility() {
        return this.extendMessageVisibility;
    }

    public void setExtendMessageVisibility(Boolean extendMessageVisibility) {
        this.extendMessageVisibility = extendMessageVisibility;
    }

    public Integer getReceiveMessageWaitTimeSeconds() {
        return receiveMessageWaitTimeSeconds;
    }

    public void setReceiveMessageWaitTimeSeconds(Integer receiveMessageWaitTimeSeconds) {
        this.receiveMessageWaitTimeSeconds = receiveMessageWaitTimeSeconds;
    }

    public Integer getWaitTimeSeconds() {
        return waitTimeSeconds;
    }

    public void setWaitTimeSeconds(Integer waitTimeSeconds) {
        this.waitTimeSeconds = waitTimeSeconds;
    }

    public String getQueueOwnerAWSAccountId() {
        return queueOwnerAWSAccountId;
    }

    public void setQueueOwnerAWSAccountId(String queueOwnerAWSAccountId) {
        this.queueOwnerAWSAccountId = queueOwnerAWSAccountId;
    }

    public Boolean isDeleteIfFiltered() {
        return deleteIfFiltered;
    }

    public void setDeleteIfFiltered(Boolean deleteIfFiltered) {
        this.deleteIfFiltered = deleteIfFiltered;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public Integer getConcurrentConsumers() {
        return concurrentConsumers;
    }

    public void setConcurrentConsumers(Integer concurrentConsumers) {
        this.concurrentConsumers = concurrentConsumers;
    }

    @Override
    public String toString() {
        return "SqsConfiguration[queueName=" + queueName
            + ", amazonSQSClient=" + amazonSQSClient
            + ", accessKey=" + accessKey
            + ", secretKey=xxxxxxxxxxxxxxx"
            + ", deleteAfterRead=" + deleteAfterRead
            + ", deleteIfFiltered=" + deleteIfFiltered
            + ", visibilityTimeout=" + visibilityTimeout
            + ", attributeNames=" + attributeNames
            + ", messageAttributeNames=" + messageAttributeNames
            + ", waitTimeSeconds=" + waitTimeSeconds
            + ", defaultVisibilityTimeout=" + defaultVisibilityTimeout
            + ", maximumMessageSize=" + maximumMessageSize
            + ", messageRetentionPeriod=" + messageRetentionPeriod
            + ", receiveMessageWaitTimeSeconds=" + receiveMessageWaitTimeSeconds
            + ", delaySeconds=" + delaySeconds
            + ", policy=" + policy
            + ", redrivePolicy=" + redrivePolicy
            + ", extendMessageVisibility=" + extendMessageVisibility
            + ", queueOwnerAWSAccountId=" + queueOwnerAWSAccountId
            + ", concurrentConsumers=" + concurrentConsumers
            + ", region=" + region
            + "]";
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.ivyde.test;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;

public class HelloWorldServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("text/plain");
        resp.getWriter().write(StringUtils.join(new String[] { "Hello ", "world ", "!" }));
    }
}


text:
namespace {

int GetWebResourceCount(const TaskManagerModel* model) {
  int count = 0;
  for (int i = 0; i < model->ResourceCount(); i++) {
    task_manager::Resource::Type type = model->GetResourceType(i);
    // Skip system infrastructure resources.
    if (type == task_manager::Resource::BROWSER ||
        type == task_manager::Resource::NACL ||
        type == task_manager::Resource::GPU ||
        type == task_manager::Resource::UTILITY ||
        type == task_manager::Resource::ZYGOTE ||
        type == task_manager::Resource::SANDBOX_HELPER) {
      continue;
    }

    count++;
  }
  return count;
}

class ResourceChangeObserver : public TaskManagerModelObserver {
 public:
  ResourceChangeObserver(const TaskManagerModel* model,
                         int target_resource_count)
      : model_(model),
        target_resource_count_(target_resource_count) {
  }

  virtual void OnModelChanged() OVERRIDE {
    OnResourceChange();
  }

  virtual void OnItemsChanged(int start, int length) OVERRIDE {
    OnResourceChange();
  }

  virtual void OnItemsAdded(int start, int length) OVERRIDE {
    OnResourceChange();
  }

  virtual void OnItemsRemoved(int start, int length) OVERRIDE {
    OnResourceChange();
  }

 private:
  void OnResourceChange() {
    if (GetWebResourceCount(model_) == target_resource_count_)
      base::MessageLoopForUI::current()->Quit();
  }

  const TaskManagerModel* model_;
  const int target_resource_count_;
};

}  // namespace

// static
void TaskManagerBrowserTestUtil::WaitForWebResourceChange(int target_count) {
  TaskManagerModel* model = TaskManager::GetInstance()->model();

  ResourceChangeObserver observer(model, target_count);
  model->AddObserver(&observer);

  // Checks that the condition has not been satisfied yet.
  // This check has to be placed after the installation of the observer,
  // because resources may change before that.
  if (GetWebResourceCount(model) == target_count) {
    model->RemoveObserver(&observer);
    return;
  }

  content::RunMessageLoop();
  model->RemoveObserver(&observer);
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
SimpleFileSet
</TITLE>

<META NAME="date" CONTENT="2016-12-25">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

tablesaw

Class SimpleFileSet

java.lang.Object
  tablesaw.AbstractFileSet<SimpleFileSet>
      tablesaw.SimpleFileSet

public class SimpleFileSet
extends AbstractFileSet<SimpleFileSet>

Nested Class Summary

Nested classes/interfaces inherited from class tablesaw.AbstractFileSet

AbstractFileSet.File

Constructor Summary

SimpleFileSet()

Method Summary

Methods inherited from class tablesaw.AbstractFileSet

addFile, addFileFilter, getFileNames, getFilePaths, getFiles, getFullFilePaths

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

SimpleFileSet

public SimpleFileSet()

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
#ifndef TENSORFLOW_JS_OPS_TS_OP_GEN_H_
#define TENSORFLOW_JS_OPS_TS_OP_GEN_H_

#include "tensorflow/core/framework/op_def.pb.h"
#include "tensorflow/core/framework/op_gen_lib.h"
#include "tensorflow/core/platform/types.h"

namespace tensorflow {

// Generated code is written to the file ts_filename:
void WriteTSOps(const OpList& ops, const ApiDefMap& api_def_map,
                const string& ts_filename);

}  // namespace tensorflow

#endif  // TENSORFLOW_JS_OPS_TS_OP_GEN_H_


text:
layout: paper
year: 1997
title: Green Card - a foreign-language interface for Haskell
png: green-card.png
month: June
location: Amsterdam, Netherlands
file: green-card.pdf
booktitle: Proceedings of the Haskell Workshop
author: Simon Peyton Jones, Thomas Nordin, Alastair Reid
ar_shortname: Haskell 97
ar_file: Haskell_97
affiliation: Yale University and Oregon Graduate Institute
ENTRYTYPE: inproceedings
ID: greencard1997
bibtex: |
    @inproceedings{greencard1997
        , affiliation = {Yale University and Oregon Graduate Institute}
        , ar_file = {Haskell_97}
        , ar_shortname = {Haskell 97}
        , author = {Simon Peyton Jones and Thomas Nordin and Alastair Reid}
        , booktitle = {Proceedings of the Haskell Workshop}
        , file = {green-card.pdf}
        , location = {Amsterdam, Netherlands}
        , month = {June}
        , png = {green-card.png}
        , title = {{G}reen {C}ard: a foreign-language interface for {H}askell}
        , year = {1997}
    }
---


text:
#include "config.h"
#include "Icon.h"

#include "GraphicsContext.h"
#include "IntRect.h"
#include "NotImplemented.h"
#include <wtf/text/WTFString.h>

namespace WebCore {

Icon::~Icon()
{
    notImplemented();
}

void Icon::paint(GraphicsContext*, IntRect const&)
{
    notImplemented();
}

PassRefPtr<Icon> Icon::createIconForFiles(const Vector<String>&)
{
    // FIXME: remove 0 template param when this is implemented
    notImplemented();
    return 0;
}

} // namespace WebCore


text:
/**
 * This test sets moveParanoia flag and then check that the directory is created with the moved data
 */
var st = new ShardingTest({
    shards: 2,
    mongos: 1,
    other: {chunkSize: 1, enableAutoSplit: true, shardOptions: {noMoveParanoia: ""}}
});

load("jstests/sharding/movechunk_include.js");
setupMoveChunkTest(st);

var shards = [st.shard0, st.shard1];
for (i in shards) {
    var dbpath = shards[i].adminCommand("getCmdLineOpts").parsed.storage.dbPath;
    var hasMoveChunkDir = 0 !=
        ls(dbpath)
            .filter(function(a) {
                return null != a.match("moveChunk");
            })
            .length;
    assert(!hasMoveChunkDir, dbpath + ": has MoveChunk directory + " + ls(dbpath));
}
st.stop();


text:
#pragma once

/// \file : hdf5.hpp
/// This file introduces a set of routines to save/load grids, containers and grid_objects from hdf5 files
/// using ALPSCore routines (http://www.alpscore.org)

#include <string>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
    #include <alps/hdf5.hpp>
    //#include "multi_array.hpp"
#pragma GCC diagnostic pop

#include <gftools.hpp>
#include "multi_array.hpp"

namespace alps{
    namespace hdf5 {
        inline void save(alps::hdf5::archive & ar, std::string const & path, const gftools::enum_grid& x );
        inline void save(alps::hdf5::archive & ar, std::string const & path, const gftools::real_grid& x );
    }
}

namespace gftools {
// expand alps::hdf5::load to bold_hyb objects

// loader of various objects
template <typename> struct hdf5_loader;
// load objects from hdf5 archive
template <typename T>
T load(alps::hdf5::archive & ar, std::string const & path) { return hdf5_loader<T>::load(ar,path); }
//template <typename T>
//void save(alps::hdf5::archive & ar, std::string const & path, const T& o) { return hdf5_loader<T>::save(ar,path,o); }

//
// gftools - related
//
// load gftools::container
template <typename T, size_t D>
struct hdf5_loader<container<T,D>> {
    typedef container<T,D> type;
    typedef typename container<T,D>::boost_t boost_type;
    static type load (alps::hdf5::archive & ar, std::string const & path) {
        boost_type c1; ar >> alps::make_pvp(path,c1); return container_ref<T,D>(c1); }
    static void save (alps::hdf5::archive & ar, std::string const & path, const container<T,D>& c) {
        ar << alps::make_pvp(path, c.boost_container_()); }
};

// grid
template <typename Grid, typename R = Grid>
using isGrid = typename std::enable_if<
    (sizeof(typename Grid::point) > 0 &&
    sizeof(decltype(std::declval<Grid>()[0]))>0), R>::type;

/*
template <class Grid>
inline isGrid<Grid, void> save(alps::hdf5::archive & ar, std::string const & path, const Grid& c)
{
    ar << alps::make_pvp(path+"/values", c.values());
}
*/

namespace extra {
template <typename G>
inline G load_grid (alps::hdf5::archive & ar, std::string const & path)
{
    std::vector<typename G::point::value_type> g;
    ar[path+"/values"] >> g;
    return G(g);
}
}

#define GRID_HDF5_LOADER(T,R)                                                                           \
    template <> struct hdf5_loader<T> {                                                                 \
        static void save(alps::hdf5::archive & ar, std::string const & path, const T& x) {              \
            std::vector<R> y(x.size()); for (int i=0; i<y.size(); ++i) y[i] = x[i].value();             \
            ar << alps::make_pvp(path+"/values",y); }                                                   \
        static T load(alps::hdf5::archive & ar, std::string const & path) {                             \
            std::vector<R> g; ar[path+"/values"] >> g; return T(g); }                                   \
        };
GRID_HDF5_LOADER(real_grid, typename real_grid::value_type);
GRID_HDF5_LOADER(enum_grid, int);
GRID_HDF5_LOADER(matsubara_grid<true>, typename matsubara_grid<true>::value_type);
GRID_HDF5_LOADER(matsubara_grid<false>, typename matsubara_grid<false>::value_type);
GRID_HDF5_LOADER(kmesh, typename kmesh::value_type);
#undef GRID_HDF5_LOADER

// tuple of grids
template <typename, int N=0> struct hdf5_grid_tuple;
template <typename G1, typename ... Grids, int N>
struct hdf5_grid_tuple<std::tuple<G1, Grids...>,N>
{
    typedef std::tuple<G1, Grids...> grid_tuple;
    static void save(alps::hdf5::archive & ar, std::string const & path, const grid_tuple& t) {
        std::string index_str = std::to_string(N);
        hdf5_loader<G1>::save(ar, path + "/"+index_str, std::get<0>(t));
        hdf5_grid_tuple<std::tuple<Grids...>,N+1>::save(ar,path,tuple_tools::tuple_tail(t));
        }

    static grid_tuple load(alps::hdf5::archive & ar, std::string const & path) {
        std::string index_str = std::to_string(N);
        G1 grid = gftools::load<G1>(ar, path + "/"+index_str);
        return std::tuple_cat(std::make_tuple(grid), hdf5_grid_tuple<std::tuple<Grids...>,N+1>::load(ar,path));
        }
};

template <typename Grid, int N>
struct hdf5_grid_tuple<std::tuple<Grid>,N>
{
    typedef std::tuple<Grid> grid_tuple;
    static void save(alps::hdf5::archive & ar, std::string const & path, const std::tuple<Grid>& t) {
        std::string index_str = std::to_string(N);
        hdf5_loader<Grid>::save(ar, path + "/"+index_str, std::get<0>(t));
    }
    static grid_tuple load(alps::hdf5::archive & ar, std::string const & path) {
        std::string index_str = std::to_string(N);
        return std::make_tuple(gftools::load<Grid>(ar, path + "/"+index_str));
    }
};

// gridobject
template <typename T>
inline void save_grid_object(alps::hdf5::archive & ar, std::string const & path, const T& c, bool plaintext = false, std::string extra_name_to_plaintext = "")
{
    std::cout << "hdf5 : saving " << demangled_name(typeid(T)) << " to " << path << std::endl;
    hdf5_grid_tuple<typename T::grid_tuple>::save(ar,path+"/grids",c.grids());
    save(ar,path+"/data", c.data());
    std::string p2(path);
    std::vector<std::string> split_vec;
    boost::algorithm::split(split_vec, path, boost::is_any_of("/"), boost::token_compress_on );
    if (plaintext) {
        std::string fname = split_vec[split_vec.size()-1]+".dat";
        if (extra_name_to_plaintext.size()) fname = extra_name_to_plaintext + "_" + fname;
        c.savetxt(fname);
        }
}

template <typename T>
inline T load_grid_object(alps::hdf5::archive & ar, std::string const & path) {
    std::cout << "hdf5 : loading " << demangled_name(typeid(T)) << " from " << path << std::endl;
    auto grids = hdf5_grid_tuple<typename T::grid_tuple>::load(ar,path+"/grids");
    auto data = hdf5_loader<typename T::container_type>::load(ar,path+"/data");
    return T(grids,data);
}
} // end of namespace bold_hyb

namespace alps{
    namespace hdf5 {
        template <typename T, size_t D>
        inline void save(alps::hdf5::archive & ar, std::string const & path, const gftools::container<T,D>& c) {
            gftools::hdf5_loader<gftools::container<T,D>>::save(ar, path, c); }
        inline void save(alps::hdf5::archive & ar, std::string const & path, const gftools::enum_grid& x ) {
            gftools::hdf5_loader<gftools::enum_grid>::save(ar, path, x); }
        inline void save(alps::hdf5::archive & ar, std::string const & path, const gftools::real_grid& x ) {
            gftools::hdf5_loader<gftools::real_grid>::save(ar, path, x); }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="true" android:drawable="@drawable/yes_op"
        />
    <!-- Default State -->
    <item android:drawable="@drawable/nope_op" />
</selector>


text: from utilities import *


text:
using System;
using System.Globalization;

namespace _01_Day_of_Week
{
    class DayOfWeek
    {
        static void Main()
        {
            DateTime date = DateTime.ParseExact(Console.ReadLine(), "d-M-yyyy", CultureInfo.InvariantCulture);
            Console.WriteLine(date.DayOfWeek);
        }
    }
}


text:
package org.PrimeSoft.MCPainter;

import org.PrimeSoft.MCPainter.Configuration.ConfigProvider;
import org.PrimeSoft.MCPainter.utils.BaseBlock;
import org.PrimeSoft.MCPainter.utils.Vector;
import org.PrimeSoft.blocksHub.BlocksHub;
import org.PrimeSoft.blocksHub.IBlocksHubApi;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;

/**
 *
 * @author SBPrime
 */
public class BlocksHubIntegration {

    private final boolean m_isInitialized;
    private final IBlocksHubApi m_blocksApi;

    /**
     * Get instance of the core blocks hub plugin
     *
     * @param plugin
     * @return
     */
    public static BlocksHub getBlocksHub(JavaPlugin plugin) {
        try {
            Plugin cPlugin = plugin.getServer().getPluginManager().getPlugin("BlocksHub");

            if ((cPlugin == null) || (!(cPlugin instanceof BlocksHub))) {
                return null;
            }

            return (BlocksHub) cPlugin;
        } catch (NoClassDefFoundError ex) {
            return null;
        }
    }

    public BlocksHubIntegration(JavaPlugin plugin) {
        BlocksHub bh = getBlocksHub(plugin);
        m_blocksApi = bh != null ? bh.getApi() : null;
        m_isInitialized = m_blocksApi != null && m_blocksApi.getVersion() >= 1.0;
    }

    public void logBlock(String player, World world, Location location,
            int oldBlockType, byte oldBlockData,
            int newBlockType, byte newBlockData) {
        if (!m_isInitialized || !ConfigProvider.getLogBlocks()) {
            return;
        }

        m_blocksApi.logBlock(player, world, location, oldBlockType, oldBlockData, newBlockType, newBlockData);
    }

    public boolean canPlace(String player, World world, Location location) {
        if (!m_isInitialized || !ConfigProvider.getCheckAccess()) {
            return true;
        }

        return m_blocksApi.canPlace(player, world, location);
    }

    public boolean canPlace(String name, World world, Vector location) {
        if (location == null)
        {
            return false;
        }
        if (!ConfigProvider.getCheckAccess())
        {
            return true;
        }
        Location l = new Location(world, location.getX(), location.getY(), location.getZ());
        return canPlace(name, world, l);
    }

    public void logBlock(String name, World world, Vector location, BaseBlock oldBlock, BaseBlock newBlock) {
        if (location == null || !ConfigProvider.getLogBlocks())
        {
            return;
        }

        if (oldBlock == null)
        {
            oldBlock = new BaseBlock(Material.AIR);
        }
        if (newBlock == null)
        {
            newBlock = new BaseBlock(Material.AIR);
        }

        Location l = new Location(world, location.getX(), location.getY(), location.getZ());
        logBlock(name, world, l, oldBlock.getType(), (byte) oldBlock.getData(),
                newBlock.getType(), (byte) newBlock.getData());
    }
}


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-558
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.05.22 at 08:33:37 PM COT
//

package clientedemows.wsdl;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for anonymous complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "name"
})
@XmlRootElement(name = "getCountryRequest")
public class GetCountryRequest {

    @XmlElement(required = true)
    protected String name;

    /**
     * Gets the value of the name property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setName(String value) {
        this.name = value;
    }

}


text:
title: 'Deer & Turkey Expo 2013'
date: '2013'
layout: portfolio
path: '/deer-turkey-expo-2013/'
tags:
  - Drupal
  - CSS built using Sass with Compass
  - Photoshop
  - Responsive web design
  - Google Web Fonts
featuredImage: 2.jpg
description: Our team was approached to build the site out to replace an existing, poorly designed and highly cluttered web site with a more modern one.
employer: Bonnier
---

Field & Stream and Outdoor Life magazines sponsor an annual convention highlighting the latest products and techniques to improve the results for hunters. Our team was approached to build the site out to replace an existing, poorly designed and highly cluttered web site with a more modern one. When we received the PSDs, the build out began. The developer set things up in Drupal matching up with the clients requests. Midway through development, we were asked to make it responsive as well. This required a good amount of refactoring to achieve a quality experience on different devices as well as maintaining the desktop usability. The end result was a quality site that is light on resources and responds to the users environment.


text:
package com.borqs.server.market.controllers;

import com.borqs.server.market.sfs.FileContent;
import com.borqs.server.market.sfs.FileStorage;
import com.borqs.server.market.utils.MimeTypeUtils;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;

@Controller
@RequestMapping("/")
public class ProductFilesController {
    private FileStorage imageStorage;
    private FileStorage productStorage;
    private FileStorage sharesStorage;

    public ProductFilesController() {
    }

    public FileStorage getImageStorage() {
        return imageStorage;
    }

    @Autowired
    @Qualifier("storage.image")
    public void setImageStorage(FileStorage imageStorage) {
        this.imageStorage = imageStorage;
    }

    public FileStorage getProductStorage() {
        return productStorage;
    }

    @Autowired
    @Qualifier("storage.product")
    public void setProductStorage(FileStorage productStorage) {
        this.productStorage = productStorage;
    }

    @Autowired
    @Qualifier("storage.shares")
    public void setSharesStorage(FileStorage sharesStorage) {
        this.sharesStorage = sharesStorage;
    }

    private static void writeError(HttpServletResponse resp, int code, String msg) throws IOException {
        resp.setStatus(code);
        resp.setContentType("text/plain");
        resp.getWriter().print(msg);
    }

    private static void writeFileToResponse(FileStorage fs, String fileId, HttpServletResponse resp) throws IOException {
        FileContent content;
        try {
            content = fs.read(fileId);
        } catch (IOException e) {
            content = null;
        }

        OutputStream out = null;
        if (content == null) {
            writeError(resp, 404, "File not found");
        } else {
            try {
                resp.setStatus(200);
                if (content.size >= 0) {
                    resp.setContentLength((int) content.size);
                }
                String fileName = content.filename != null ? content.filename : fileId;
                String contentType = content.contentType != null ? content.contentType : MimeTypeUtils.getMimeTypeByFilename(fileName);
                resp.setContentType(contentType);
                if (!contentType.startsWith("text/") && !contentType.startsWith("image/")) {
                    resp.setHeader("Content-Disposition", "attachment; filename=" + fileName);
                }

                out = resp.getOutputStream();
                IOUtils.copy(content.stream, out);
                out.flush();
            } finally {
                IOUtils.closeQuietly(content.stream);
                IOUtils.closeQuietly(out);
            }
        }
    }

    @RequestMapping(value = "/static/products/{fileId:.+}", method = RequestMethod.GET)
    public void writeProductFile(@PathVariable("fileId") String fileId, HttpServletResponse resp) throws IOException {
        writeFileToResponse(productStorage, fileId, resp);
    }

    @RequestMapping(value = "/static/products/images/{fileId:.+}", method = RequestMethod.GET)
    public void writeProductImagesFile(@PathVariable("fileId") String fileId, HttpServletResponse resp) throws IOException {
        writeFileToResponse(imageStorage, fileId, resp);
    }

    @RequestMapping(value = "/static/shares/{fileId:.+}", method = RequestMethod.GET)
    public void writeSharesFile(@PathVariable("fileId") String fileId, HttpServletResponse resp) throws IOException {
        writeFileToResponse(sharesStorage, fileId, resp);
    }
}


text:
poisson-disk-sampler-js
=======================

An Poisson Disk sampler JavaScript implementation inspired by http://devmag.org.za/2009/05/03/poisson-disk-sampling/

Additional features:
Distance map image
Exclude map image

Simple Example: http://rawgithub.com/kimchristiansen/poisson-disk-sampler-js/master/simple-example.html


text:
package com.linkedin.thirdeye.dashboard.views;

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

import org.apache.commons.math3.util.Pair;

import com.linkedin.thirdeye.dashboard.api.MetricTable;

import io.dropwizard.views.View;

public class DimensionViewContributors extends View {

  private final List<String> metrics;
  private final List<String> dimensions;
  private final Map<String, MetricTable> metricTotalTable;
  private final Map<Pair<String, String>, Map<String, MetricTable>> dimensionValueTables;

  public DimensionViewContributors(List<String> metrics, List<String> dimensions,
      Map<String, MetricTable> metricTotalTable,
      Map<Pair<String, String>, Map<String, MetricTable>> tables) {
    super("dimensions/breakdown.ftl");
    this.metrics = new ArrayList<>(metrics);
    Collections.sort(this.metrics);
    this.metricTotalTable = metricTotalTable;
    this.dimensions = new ArrayList<>(dimensions);
    Collections.sort(this.dimensions);
    this.dimensionValueTables = tables;
  }

  public List<String> getMetrics() {
    return metrics;
  }

  public Map<String, MetricTable> getMetricTotalTable() {
    return metricTotalTable;
  }

  public List<String> getDimensions() {
    // TODO equivalent to unselectedDimensions in DashboardView/DashboardConfigResource.
    return dimensions;
  }

  /*
   * Recommended not to use this. Key = (metric, dimension)
   */
  public Map<Pair<String, String>, Map<String, MetricTable>> getDimensionValueTables() {
    return dimensionValueTables;
  }

  public Map<String, MetricTable> getDimensionValueTable(String metric, String dimension) {
    Map<String, MetricTable> result =
        dimensionValueTables.get(new Pair<String, String>(metric, dimension));
    return (result == null ? Collections.<String, MetricTable> emptyMap() : result);
  }

}


text:
package org.yapp;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import org.yapp.db.Config;
import org.yapp.db.Selector;
import org.yapp.db.sqlite.SqlInfo;
import org.yapp.db.sqlite.WhereBuilder;
import org.yapp.db.table.DbModel;
import org.yapp.db.table.TableEntity;
import org.yapp.ex.DbException;
import org.yapp.utils.KeyValue;

import java.io.Closeable;
import java.io.IOException;
import java.util.List;

/**
 * ClassName: DbManager

 * Description: 数据库访问接口.

 * Date: 2015-12-3 上午10:30:03

 */
public interface DbManager extends Closeable {

    Config getDaoConfig();

    SQLiteDatabase getDatabase();

    /**
     * 保存实体类或实体类的List到数据库,
     * 如果该类型的id是自动生成的, 则保存完后会给id赋值.
     *
     * @param entity
     * @return
     * @throws DbException
     */
    boolean saveBindingId(Object entity) throws DbException;

    /**
     * 保存或更新实体类或实体类的List到数据库, 根据id对应的数据是否存在.
     *
     * @param entity
     * @throws DbException
     */
    void saveOrUpdate(Object entity) throws DbException;

    /**
     * 保存实体类或实体类的List到数据库
     *
     * @param entity
     * @throws DbException
     */
    void save(Object entity) throws DbException;

    /**
     * 保存或更新实体类或实体类的List到数据库, 根据id和其他唯一索引判断数据是否存在.
     *
     * @param entity
     * @throws DbException
     */
    void replace(Object entity) throws DbException;

    ///////////// delete
    void deleteById(Class<?> entityType, Object idValue) throws DbException;

    void delete(Object entity) throws DbException;

    void delete(Class<?> entityType) throws DbException;

    int delete(Class<?> entityType, WhereBuilder whereBuilder) throws DbException;

    ///////////// update
    void update(Object entity, String... updateColumnNames) throws DbException;

    int update(Class<?> entityType, WhereBuilder whereBuilder, KeyValue... nameValuePairs) throws DbException;

    ///////////// find
    <T> T findById(Class<T> entityType, Object idValue) throws DbException;

    <T> T findFirst(Class<T> entityType) throws DbException;

    <T> List<T> findAll(Class<T> entityType) throws DbException;

    <T> Selector<T> selector(Class<T> entityType) throws DbException;

    DbModel findDbModelFirst(SqlInfo sqlInfo) throws DbException;

    List<DbModel> findDbModelAll(SqlInfo sqlInfo) throws DbException;

    ///////////// table

    /**
     * 获取表信息
     *
     * @param entityType
     * @param <T>
     * @return
     * @throws DbException
     */
    <T> TableEntity<T> getTable(Class<T> entityType) throws DbException;

    /**
     * 删除表
     *
     * @param entityType
     * @throws DbException
     */
    void dropTable(Class<?> entityType) throws DbException;

    /**
     * 添加一列,
     * 新的entityType中必须定义了这个列的属性.
     *
     * @param entityType
     * @param column
     * @throws DbException
     */
    void addColumn(Class<?> entityType, String column) throws DbException;

    ///////////// db

    /**
     * 删除库
     *
     * @throws DbException
     */
    void dropDb() throws DbException;

    /**
     * 关闭数据库,
     * xUtils对同一个库的链接是单实例的, 一般不需要关闭它.
     *
     * @throws IOException
     */
    void close() throws IOException;

    ///////////// custom
    int executeUpdateDelete(SqlInfo sqlInfo) throws DbException;

    int executeUpdateDelete(String sql) throws DbException;
    void execNonQuery(SqlInfo sqlInfo) throws DbException;

    void execNonQuery(String sql) throws DbException;

    Cursor execQuery(SqlInfo sqlInfo) throws DbException;

    Cursor execQuery(String sql) throws DbException;

    public interface DbOpenListener {
        void onDbOpened(DbManager db);
    }

    public interface DbUpgradeListener {
        void onUpgrade(DbManager db, int oldVersion, int newVersion);
    }

    public interface TableCreateListener {
        void onTableCreated(DbManager db, TableEntity<?> table);
    }
}


text:
<package>
	<logconfig>
        <!-- <file>path/to/config/file</file> -->
        <levels>0 1 2 3 4</levels>
        <outfile>log2.txt</outfile>
        <types>debug err log</types>
    </logconfig>
    <resourcespaths>
        <!-- <librariespath>path/to/component/libraries</librariespath> -->
        <librariespath>buildnew/lib</librariespath>
        <!-- <path>path/to/resources</path> -->
    </resourcespaths>
    <activities>
    	<activity>
    		<schedulepolicy activity="parallel" type="periodic" value="1000" exclusive_affinity="2" />
			<components>
				<component>
					<task>EzTask1</task>
					<library>component_1</library>
					<attributes>
						<attribute name="a" value="0" />
						<attribute name="b" value="1.3" />
						<attribute name="vec" value="1, 2,3,  5" />
					</attributes>
					<components>
						<component>
							<task>EzTask3</task>
							<library>component_1</library>
							<attributes>
							</attributes>
						</component>
					</components>
				</component>
				<component>
					<task>EzTask4</task>
					<library>component_1</library>
				</component>
			</components>
		</activity>
		<activity>
			<schedulepolicy activity="parallel" type="triggered" value="" exclusive_affinity="1" />
			<components>
				<component>
					<task>EzTask2</task>
					<library>component_2</library>

					<attributes>
						<attribute name="c" value="2" />
						<attribute name="d" value="3.3" />
					</attributes>
				</component>
			</components>
		</activity>
	</activities>
	<connections>
		<connection data="BUFFER" policy="LOCKED" transport="LOCAL" buffersize="10">
			<src task="EzTask1" port="OUT"/>
			<dest task="EzTask2" port="IN"/>
		</connection>
	</connections>
</package>


text:
<!DOCTYPE html>

<TITLE>Manpage of MMAP</TITLE>
<meta charset="utf-8">
<link rel="stylesheet" href="/css/main.css" type="text/css">

linux manpages

{"type":"documentation"}

MMAP

Section: Linux Programmer's Manual (2)
Updated: 2009-09-26
Index
Return to Main Contents

NAME

mmap, mmap64, munmap - map or unmap files or devices into memory

SYNOPSIS

#include <sys/mman.h>

void *mmap(void *addr, size_t length, int prot, int flags,
           int fd, off_t offset);
void *mmap64(void *addr, size_t length, int prot, int flags,
           int fd, off64_t offset);
int munmap(void *addr, size_t length);

DESCRIPTION

mmap()

creates a new mapping in the virtual address space of
the calling process.
The starting address for the new mapping is specified in
addr.

The
length

argument specifies the length of the mapping.

If
addr

is NULL,
then the kernel chooses the address at which to create the mapping;
this is the most portable method of creating a new mapping.
If
addr

is not NULL,
then the kernel takes it as a hint about where to place the mapping;
on Linux, the mapping will be created at a nearby page boundary.

The address of the new mapping is returned as the result of the call.

The contents of a file mapping (as opposed to an anonymous mapping; see
MAP_ANONYMOUS

below), are initialized using
length

bytes starting at offset
offset

in the file (or other object) referred to by the file descriptor
fd.

offset

must be a multiple of the page size as returned by
sysconf(_SC_PAGE_SIZE).

The
prot

argument describes the desired memory protection of the mapping
(and must not conflict with the open mode of the file).
It is either
PROT_NONE

or the bitwise OR of one or more of the following flags:

PROT_EXEC

Pages may be executed.

PROT_READ

Pages may be read.

PROT_WRITE

Pages may be written.

PROT_NONE

Pages may not be accessed.

The
flags

argument determines whether updates to the mapping
are visible to other processes mapping the same region,
and whether updates are carried through to the underlying file.
This behavior is determined by including exactly one
of the following values in
flags:

MAP_SHARED

Share this mapping.
Updates to the mapping are visible to other processes that map this file,
and are carried through to the underlying file.
The file may not actually be updated until
msync(2)

or
munmap()

is called.

MAP_PRIVATE

Create a private copy-on-write mapping.
Updates to the mapping are not visible to other processes
mapping the same file, and are not carried through to
the underlying file.
It is unspecified whether changes made to the file after the
mmap()

call are visible in the mapped region.

Both of these flags are described in POSIX.1-2001.

In addition, zero or more of the following values can be ORed in
flags:

MAP_32BIT (since Linux 2.4.20, 2.6)

Put the mapping into the first 2 Gigabytes of the process address space.
This flag is only supported on x86-64, for 64-bit programs.
It was added to allow thread stacks to be allocated somewhere
in the first 2GB of memory,
so as to improve context-switch performance on some early
64-bit processors.

Modern x86-64 processors no longer have this performance problem,
so use of this flag is not required on those systems.
The
MAP_32BIT

flag is ignored when
MAP_FIXED

is set.

MAP_ANON

Synonym for
MAP_ANONYMOUS.

Deprecated.

MAP_ANONYMOUS

The mapping is not backed by any file;
its contents are initialized to zero.
The
fd

and
offset

arguments are ignored;
however, some implementations require
fd

to be -1 if
MAP_ANONYMOUS

(or
MAP_ANON)

is specified,
and portable applications should ensure this.
The use of
MAP_ANONYMOUS

in conjunction with
MAP_SHARED

is only supported on Linux since kernel 2.4.

MAP_DENYWRITE

This flag is ignored.

(Long ago, it signaled that attempts to write to the underlying file
should fail with
ETXTBUSY.

But this was a source of denial-of-service attacks.)

MAP_EXECUTABLE

This flag is ignored.

MAP_FILE

Compatibility flag.
Ignored.

MAP_FIXED

Don't interpret
addr

as a hint: place the mapping at exactly that address.
addr

must be a multiple of the page size.
If the memory region specified by
addr

and
len

overlaps pages of any existing mapping(s), then the overlapped
part of the existing mapping(s) will be discarded.
If the specified address cannot be used,
mmap()

will fail.
Because requiring a fixed address for a mapping is less portable,
the use of this option is discouraged.

MAP_GROWSDOWN

Used for stacks.
Indicates to the kernel virtual memory system that the mapping
should extend downwards in memory.

MAP_HUGETLB (since Linux 2.6.32)

Allocate the mapping using "huge pages."
See the kernel source file
Documentation/vm/hugetlbpage.txt

for further information.

MAP_LOCKED (since Linux 2.5.37)

Lock the pages of the mapped region into memory in the manner of
mlock(2).

This flag is ignored in older kernels.

MAP_NONBLOCK (since Linux 2.5.46)

Only meaningful in conjunction with
MAP_POPULATE.

Don't perform read-ahead:
only create page tables entries for pages
that are already present in RAM.
Since Linux 2.6.23, this flag causes
MAP_POPULATE

to do nothing.
One day the combination of
MAP_POPULATE

and
MAP_NONBLOCK

may be reimplemented.

MAP_NORESERVE

Do not reserve swap space for this mapping.
When swap space is reserved, one has the guarantee
that it is possible to modify the mapping.
When swap space is not reserved one might get
SIGSEGV

upon a write
if no physical memory is available.
See also the discussion of the file
/proc/sys/vm/overcommit_memory

in
proc(5).

In kernels before 2.6, this flag only had effect for
private writable mappings.

MAP_POPULATE (since Linux 2.5.46)

Populate (prefault) page tables for a mapping.
For a file mapping, this causes read-ahead on the file.
Later accesses to the mapping will not be blocked by page faults.
MAP_POPULATE

is only supported for private mappings since Linux 2.6.23.

Of the above flags, only
MAP_FIXED

is specified in POSIX.1-2001.
However, most systems also support
MAP_ANONYMOUS

(or its synonym
MAP_ANON).

MAP_STACK (since Linux 2.6.27)

Allocate the mapping at an address suitable for a process
or thread stack.
This flag is currently a no-op,
but is used in the glibc threading implementation so that
if some architectures require special treatment for stack allocations,
support can later be transparently implemented for glibc.

Some systems document the additional flags
MAP_AUTOGROW,

MAP_AUTORESRV,

MAP_COPY,

and
MAP_LOCAL.

Memory mapped by
mmap()

is preserved across
fork(2),

with the same attributes.

A file is mapped in multiples of the page size.
For a file that is not
a multiple of the page size, the remaining memory is zeroed when mapped,
and writes to that region are not written out to the file.
The effect of
changing the size of the underlying file of a mapping on the pages that
correspond to added or removed regions of the file is unspecified.

mmap64()

The
mmap64()

system call operates in exactly the same way as
mmap(),

except that the final argument specifies the offset as
a 64-bit off64_t. This  enables  applications to aceess the large
files.

munmap()

The
munmap()

system call deletes the mappings for the specified address range, and
causes further references to addresses within the range to generate
invalid memory references.
The region is also automatically unmapped
when the process is terminated.
On the other hand, closing the file
descriptor does not unmap the region.

The address
addr

must be a multiple of the page size.
All pages containing a part
of the indicated range are unmapped, and subsequent references
to these pages will generate
SIGSEGV.

It is not an error if the
indicated range does not contain any mapped pages.

Timestamps changes for file-backed mappings

For file-backed mappings, the
st_atime

field for the mapped file may be updated at any time between the
mmap()

and the corresponding unmapping; the first reference to a mapped
page will update the field if it has not been already.

The
st_ctime

and
st_mtime

field for a file mapped with
PROT_WRITE

and
MAP_SHARED

will be updated after
a write to the mapped region, and before a subsequent
msync(2)

with the
MS_SYNC

or
MS_ASYNC

flag, if one occurs.

RETURN VALUE

On success,
mmap()

returns a pointer to the mapped area.
On error, the value
MAP_FAILED

(that is,
(void *) -1)

is returned, and
errno

is set appropriately.
On success,
munmap()

returns 0, on failure -1, and
errno

is set (probably to
EINVAL).

ERRORS

EACCES

A file descriptor refers to a non-regular file.
Or
MAP_PRIVATE

was requested, but
fd

is not open for reading.
Or
MAP_SHARED

was requested and
PROT_WRITE

is set, but
fd

is not open in read/write
(O_RDWR)

mode.
Or
PROT_WRITE

is set, but the file is append-only.

EAGAIN

The file has been locked, or too much memory has been locked (see
setrlimit(2)).

EBADF

fd

is not a valid file descriptor (and
MAP_ANONYMOUS

was not set).

EINVAL

We don't like
addr,

length,

or
offset

(e.g., they are too large, or not aligned on a page boundary).

EINVAL

(since Linux 2.6.12)
length

was 0.

EINVAL

flags

contained neither
MAP_PRIVATE

or
MAP_SHARED,

or contained both of these values.

ENFILE

The system limit on the total number of open files has been reached.

ENODEV

The underlying file system of the specified file does not support
memory mapping.

ENOMEM

No memory is available, or the process's maximum number of mappings would
have been exceeded.

EPERM

The
prot

argument asks for
PROT_EXEC

but the mapped area belongs to a file on a file system that
was mounted no-exec.

ETXTBSY

MAP_DENYWRITE

was set but the object specified by
fd

is open for writing.

Use of a mapped region can result in these signals:

SIGSEGV

Attempted write into a region mapped as read-only.

SIGBUS

Attempted access to a portion of the buffer that does not correspond
to the file (for example, beyond the end of the file, including the
case where another process has truncated the file).

CONFORMING TO

SVr4, 4.4BSD, POSIX.1-2001.

AVAILABILITY

On POSIX systems on which
mmap(),

msync(2)

and
munmap()

are available,
_POSIX_MAPPED_FILES

is defined in <unistd.h> to a value greater than 0.
(See also
sysconf(3).)

NOTES

Since kernel 2.4, this system call has been superseded by
mmap2(2).

Nowadays,

the glibc
mmap()

wrapper function invokes
mmap2(2)

with a suitably adjusted value for
offset.

On some hardware architectures (e.g., i386),
PROT_WRITE

implies
PROT_READ.

It is architecture dependent whether
PROT_READ

implies
PROT_EXEC

or not.
Portable programs should always set
PROT_EXEC

if they intend to execute code in the new mapping.

The portable way to create a mapping is to specify
addr

as 0 (NULL), and omit
MAP_FIXED

from
flags.

In this case, the system chooses the address for the mapping;
the address is chosen so as not to conflict with any existing mapping,
and will not be 0.
If the
MAP_FIXED

flag is specified, and
addr

is 0 (NULL), then the mapped address will be 0 (NULL).

BUGS

On Linux there are no guarantees like those suggested above under
MAP_NORESERVE.

By default, any process can be killed
at any moment when the system runs out of memory.

In kernels before 2.6.7, the
MAP_POPULATE

flag only has effect if
prot

is specified as
PROT_NONE.

SUSv3 specifies that
mmap()

should fail if
length

is 0.
However, in kernels before 2.6.12,
mmap()

succeeded in this case: no mapping was created and the call returned
addr.

Since kernel 2.6.12,
mmap()

fails with the error
EINVAL

for this case.

EXAMPLE

The following program prints part of the file specified in
its first command-line argument to standard output.
The range of bytes to be printed is specified via offset and length
values in the second and third command-line arguments.
The program creates a memory mapping of the required
pages of the file and then uses
write(2)

to output the desired bytes.

#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define handle_error(msg) \
    do { perror(msg); exit(EXIT_FAILURE); } while (0)

int
main(int argc, char *argv[])
{
    char *addr;
    int fd;
    struct stat sb;
    off_t offset, pa_offset;
    size_t length;
    ssize_t s;

    if (argc < 3 || argc > 4) {
        fprintf(stderr, "%s file offset [length]\n", argv[0]);
        exit(EXIT_FAILURE);
    }

    fd = open(argv[1], O_RDONLY);
    if (fd == -1)
        handle_error("open");

    if (fstat(fd, &sb) == -1)           /* To obtain file size */
        handle_error("fstat");

    offset = atoi(argv[2]);
    pa_offset = offset & ~(sysconf(_SC_PAGE_SIZE) - 1);
        /* offset for mmap() must be page aligned */

    if (offset >= sb.st_size) {
        fprintf(stderr, "offset is past end of file\n");
        exit(EXIT_FAILURE);
    }

    if (argc == 4) {
        length = atoi(argv[3]);
        if (offset + length > sb.st_size)
            length = sb.st_size - offset;
                /* Canaqt display bytes past end of file */

    } else {    /* No length arg ==> display to end of file */
        length = sb.st_size - offset;
    }

    addr = mmap(NULL, length + offset - pa_offset, PROT_READ,
                MAP_PRIVATE, fd, pa_offset);
    if (addr == MAP_FAILED)
        handle_error("mmap");

    s = write(STDOUT_FILENO, addr + offset - pa_offset, length);
    if (s != length) {
        if (s == -1)
            handle_error("write");

        fprintf(stderr, "partial write");
        exit(EXIT_FAILURE);
    }

    exit(EXIT_SUCCESS);
} /* main */

SEE ALSO

getpagesize(2),

mincore(2),

mlock(2),

mmap2(2),

mprotect(2),

mremap(2),

msync(2),

remap_file_pages(2),

setrlimit(2),

shmat(2),

shm_open(3),

shm_overview(7)

B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391.

COLOPHON

This page is part of release 3.24 of the Linux
man-pages

project.
A description of the project,
and information about reporting bugs,
can be found at
http://www.kernel.org/doc/man-pages/.

Index

NAME

SYNOPSIS

DESCRIPTION

mmap64()

munmap()

Timestamps changes for file-backed mappings

RETURN VALUE

ERRORS

CONFORMING TO

AVAILABILITY

NOTES

BUGS

EXAMPLE

SEE ALSO

COLOPHON

This document was created by
man2html,
using the manual pages.

Time: 05:33:04 GMT, December 24, 2015


text:
package storage

import (
	// load the packages
	_ "github.com/thecodeteam/rexray/libstorage/drivers/storage/s3fs/storage"
)


text:
layout: post
title: 'JHipster: A great way for Java developers to learn about AngularJS'
date: 2014-09-22 16:58:36.000000000 -04:00
categories:
- software
tags:
- angularjs
- java
- jhipster
status: publish
type: post
published: true
meta:
  _publicize_pending: '1'
  _edit_last: '9432974'
  _wp_old_slug: '31'
  original_post_id: '31'
author:
  login: willmitchell777
  email: will.mitchell@gmail.com
  display_name: Will Mitchell
  first_name: ''
  last_name: ''
excerpt: !ruby/object:Hpricot::Doc
  options: {}
---

I have been spending some time with JHipster.  I like it.

Java developers looking to adopt AngularJS should check consider JHipster as a great way to get started.

Below is a snapshot of the Google Trend chart showing JHipster's impact.

If you have not heard of AngularJS, consider the following chart that shows how even JHipster's spike pales in comparison to the wave of interest in AngularJS.  JHipster is in blue.

Finally, consider how both of the above spikes seem small compared to Java's relatively steady and huge mindshare.  I think these charts offer some clues as to where things are headed in Java-land.


text:
using FPS.InventorySystem;
using UnityEditor;
using UnityEngine;

namespace FPS
{
    [CustomEditor(typeof(Inventory))]
    public class InventoryEditor : Editor
	{
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            Inventory inv = (Inventory)target;

            for (int i = 0; i < inv.ItemsCount; i++)
            {
                EditorGUILayout.LabelField("Item Name", inv.Items[i].Data.Name + " SlotID: " + inv.Items[i].Data.SlotId.ToString());
            }

            Repaint();
        }
    }
}


text:
namespace Kafka.Client.Network
{
    using System;

    public class InvalidRequestException : Exception
    {
        public InvalidRequestException()
        {
        }

        public InvalidRequestException(string message)
            : base(message)
        {
        }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Syll. fung. (Abellini) 6: 118 (1888)

#### Original name
Poria saloisensis P. Karst.

### Remarks
null


text:
<?php
$loader = include __DIR__ . '/../vendor/autoload.php';
$loader->add('EvaFileParser', __DIR__ . '/../src');


text:
<!DOCTYPE html>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="generator" content="Nette Framework Apigen" />
	<title>Class Stupid\Registry</title>

	<link rel="stylesheet" type="text/css" media="all" href="media/style.css?v=2011010705" />
	<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

	All Classes

Namespaces

PHP

Stupid

Classes

Controller

Framework

Identity

Loader

Registry

Router

Session

SessionNamespace

Stupid

Tools

User

Interfaces

	<form action="http://www.google.com/cse" id="search" onsubmit="if(this.q.value.indexOf('more:')==-1)this.q.value+=' more:api'">
		<input type="hidden" name="cx" value="011549293477758430224:vxofa9ufnhc" /><input type="hidden" name="ie" value="UTF-8" /><input type="text" name="q" class="text" /><input type="submit" value="Search" />
	</form>

Overview

Namespace

Class

Elements

namespace Stupid

Class Registry

Registry is global storage for data used by controllers

Stupid\Registry				 implements ArrayAccess

				Copyright: Copyright (c) 2010 Cifro.

			Located at /Registry.php

Method Summary

				 public

			#

				set(
					string
					<var>$key</var>,
					mixed
					<var>$value</var>
			)

Stores value into registry under specified key

Stores value into registry under specified key

Parameters

						$key string $key

						$value mixed $value

				 public
				mixed

			#

				get(
					string
					<var>$key</var>
			)

Gets value from registry under specified key

Gets value from registry under specified key

Parameters

						$key string $key

				 public

			#

				remove(
					string
					<var>$key</var>
			)

Removes value under specified key

Removes value under specified key

Parameters

						$key string $key

				 public

			#

				offsetExists(

					<var>$offset</var>
			)

Implementation of

ArrayAccess::offsetExists

				 public

			#

				offsetGet(

					<var>$offset</var>
			)

Implementation of

ArrayAccess::offsetGet

				 public

			#

				offsetSet(

					<var>$offset</var>,

					<var>$value</var>
			)

Implementation of

ArrayAccess::offsetSet

				 public

			#

				offsetUnset(

					<var>$offset</var>
			)

Implementation of

ArrayAccess::offsetUnset

		Stupid Framework API generated by Apigen


text:
package com.legendshop.test.freemarker;

public class IntegerTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

	}

}


text:
<title>pcre2unicode specification</title>

pcre2unicode man page

Return to the PCRE2 index page.

This page is part of the PCRE2 HTML documentation. It was generated
automatically from the original man page. If there is any nonsense in it,
please consult the man page, in case the conversion went wrong.

UNICODE AND UTF SUPPORT

When PCRE2 is built with Unicode support (which is the default), it has
knowledge of Unicode character properties and can process text strings in
UTF-8, UTF-16, or UTF-32 format (depending on the code unit width). However, by
default, PCRE2 assumes that one code unit is one character. To process a
pattern as a UTF string, where a character may require more than one code unit,
you must call
pcre2_compile()
with the PCRE2_UTF option flag, or the pattern must start with the sequence
(*UTF). When either of these is the case, both the pattern and any subject
strings that are matched against it are treated as UTF strings instead of
strings of individual one-code-unit characters. There are also some other
changes to the way characters are handled, as documented below.

If you do not need Unicode support you can build PCRE2 without it, in which
case the library will be smaller.

UNICODE PROPERTY SUPPORT

When PCRE2 is built with Unicode support, the escape sequences \p{..},
\P{..}, and \X can be used. This is not dependent on the PCRE2_UTF setting.
The Unicode properties that can be tested are limited to the general category
properties such as Lu for an upper case letter or Nd for a decimal number, the
Unicode script names such as Arabic or Han, and the derived properties Any and
L&. Full lists are given in the
pcre2pattern
and
pcre2syntax
documentation. Only the short names for properties are supported. For example,
\p{L} matches a letter. Its Perl synonym, \p{Letter}, is not supported.
Furthermore, in Perl, many properties may optionally be prefixed by "Is", for
compatibility with Perl 5.6. PCRE2 does not support this.

WIDE CHARACTERS AND UTF MODES

Code points less than 256 can be specified in patterns by either braced or
unbraced hexadecimal escape sequences (for example, \x{b3} or \xb3). Larger
values have to use braced sequences. Unbraced octal code points up to \777 are
also recognized; larger ones can be coded using \o{...}.

The escape sequence \N{U+<hex digits>} is recognized as another way of
specifying a Unicode character by code point in a UTF mode. It is not allowed
in non-UTF modes.

In UTF modes, repeat quantifiers apply to complete UTF characters, not to
individual code units.

In UTF modes, the dot metacharacter matches one UTF character instead of a
single code unit.

In UTF modes, capture group names are not restricted to ASCII, and may contain
any Unicode letters and decimal digits, as well as underscore.

The escape sequence \C can be used to match a single code unit in a UTF mode,
but its use can lead to some strange effects because it breaks up multi-unit
characters (see the description of \C in the
pcre2pattern
documentation). For this reason, there is a build-time option that disables
support for \C completely. There is also a less draconian compile-time option
for locking out the use of \C when a pattern is compiled.

The use of \C is not supported by the alternative matching function
pcre2_dfa_match() when in UTF-8 or UTF-16 mode, that is, when a character
may consist of more than one code unit. The use of \C in these modes provokes
a match-time error. Also, the JIT optimization does not support \C in these
modes. If JIT optimization is requested for a UTF-8 or UTF-16 pattern that
contains \C, it will not succeed, and so when pcre2_match() is called,
the matching will be carried out by the normal interpretive function.

The character escapes \b, \B, \d, \D, \s, \S, \w, and \W correctly test
characters of any code value, but, by default, the characters that PCRE2
recognizes as digits, spaces, or word characters remain the same set as in
non-UTF mode, all with code points less than 256. This remains true even when
PCRE2 is built to include Unicode support, because to do otherwise would slow
down matching in many common cases. Note that this also applies to \b
and \B, because they are defined in terms of \w and \W. If you want
to test for a wider sense of, say, "digit", you can use explicit Unicode
property tests such as \p{Nd}. Alternatively, if you set the PCRE2_UCP option,
the way that the character escapes work is changed so that Unicode properties
are used to determine which characters match. There are more details in the
section on
generic character types
in the
pcre2pattern
documentation.

Similarly, characters that match the POSIX named character classes are all
low-valued characters, unless the PCRE2_UCP option is set.

However, the special horizontal and vertical white space matching escapes (\h,
\H, \v, and \V) do match all the appropriate Unicode characters, whether or
not PCRE2_UCP is set.

CASE-EQUIVALENCE IN UTF MODES

Case-insensitive matching in a UTF mode makes use of Unicode properties except
for characters whose code points are less than 128 and that have at most two
case-equivalent values. For these, a direct table lookup is used for speed. A
few Unicode characters such as Greek sigma have more than two code points that
are case-equivalent, and these are treated as such.

SCRIPT RUNS

The pattern constructs (*script_run:...) and (*atomic_script_run:...), with
synonyms (*sr:...) and (*asr:...), verify that the string matched within the
parentheses is a script run. In concept, a script run is a sequence of
characters that are all from the same Unicode script. However, because some
scripts are commonly used together, and because some diacritical and other
marks are used with multiple scripts, it is not that simple.

Every Unicode character has a Script property, mostly with a value
corresponding to the name of a script, such as Latin, Greek, or Cyrillic. There
are also three special values:

"Unknown" is used for code points that have not been assigned, and also for the
surrogate code points. In the PCRE2 32-bit library, characters whose code
points are greater than the Unicode maximum (U+10FFFF), which are accessible
only in non-UTF mode, are assigned the Unknown script.

"Common" is used for characters that are used with many scripts. These include
punctuation, emoji, mathematical, musical, and currency symbols, and the ASCII
digits 0 to 9.

"Inherited" is used for characters such as diacritical marks that modify a
previous character. These are considered to take on the script of the character
that they modify.

Some Inherited characters are used with many scripts, but many of them are only
normally used with a small number of scripts. For example, U+102E0 (Coptic
Epact thousands mark) is used only with Arabic and Coptic. In order to make it
possible to check this, a Unicode property called Script Extension exists. Its
value is a list of scripts that apply to the character. For the majority of
characters, the list contains just one script, the same one as the Script
property. However, for characters such as U+102E0 more than one Script is
listed. There are also some Common characters that have a single, non-Common
script in their Script Extension list.

The next section describes the basic rules for deciding whether a given string
of characters is a script run. Note, however, that there are some special cases
involving the Chinese Han script, and an additional constraint for decimal
digits. These are covered in subsequent sections.

Basic script run rules

A string that is less than two characters long is a script run. This is the
only case in which an Unknown character can be part of a script run. Longer
strings are checked using only the Script Extensions property, not the basic
Script property.

If a character's Script Extension property is the single value "Inherited", it
is always accepted as part of a script run. This is also true for the property
"Common", subject to the checking of decimal digits described below. All the
remaining characters in a script run must have at least one script in common in
their Script Extension lists. In set-theoretic terminology, the intersection of
all the sets of scripts must not be empty.

A simple example is an Internet name such as "google.com". The letters are all
in the Latin script, and the dot is Common, so this string is a script run.
However, the Cyrillic letter "o" looks exactly the same as the Latin "o"; a
string that looks the same, but with Cyrillic "o"s is not a script run.

More interesting examples involve characters with more than one script in their
Script Extension. Consider the following characters:

  U+060C  Arabic comma
  U+06D4  Arabic full stop

The first has the Script Extension list Arabic, Hanifi Rohingya, Syriac, and
Thaana; the second has just Arabic and Hanifi Rohingya. Both of them could
appear in script runs of either Arabic or Hanifi Rohingya. The first could also
appear in Syriac or Thaana script runs, but the second could not.

The Chinese Han script

The Chinese Han script is commonly used in conjunction with other scripts for
writing certain languages. Japanese uses the Hiragana and Katakana scripts
together with Han; Korean uses Hangul and Han; Taiwanese Mandarin uses Bopomofo
and Han. These three combinations are treated as special cases when checking
script runs and are, in effect, "virtual scripts". Thus, a script run may
contain a mixture of Hiragana, Katakana, and Han, or a mixture of Hangul and
Han, or a mixture of Bopomofo and Han, but not, for example, a mixture of
Hangul and Bopomofo and Han. PCRE2 (like Perl) follows Unicode's Technical
Standard 39 ("Unicode Security Mechanisms", http://unicode.org/reports/tr39/)
in allowing such mixtures.

Decimal digits

Unicode contains many sets of 10 decimal digits in different scripts, and some
scripts (including the Common script) contain more than one set. Some of these
decimal digits them are visually indistinguishable from the common ASCII
digits. In addition to the script checking described above, if a script run
contains any decimal digits, they must all come from the same set of 10
adjacent characters.

VALIDITY OF UTF STRINGS

When the PCRE2_UTF option is set, the strings passed as patterns and subjects
are (by default) checked for validity on entry to the relevant functions. If an
invalid UTF string is passed, an negative error code is returned. The code unit
offset to the offending character can be extracted from the match data block by
calling pcre2_get_startchar(), which is used for this purpose after a UTF
error.

In some situations, you may already know that your strings are valid, and
therefore want to skip these checks in order to improve performance, for
example in the case of a long subject string that is being scanned repeatedly.
If you set the PCRE2_NO_UTF_CHECK option at compile time or at match time,
PCRE2 assumes that the pattern or subject it is given (respectively) contains
only valid UTF code unit sequences.

If you pass an invalid UTF string when PCRE2_NO_UTF_CHECK is set, the result
is usually undefined and your program may crash or loop indefinitely. There is,
however, one mode of matching that can handle invalid UTF subject strings. This
is matching via the JIT optimization using the PCRE2_JIT_INVALID_UTF option
when calling pcre2_jit_compile(). For details, see the
pcre2jit
documentation.

Passing PCRE2_NO_UTF_CHECK to pcre2_compile() just disables the check for
the pattern; it does not also apply to subject strings. If you want to disable
the check for a subject string you must pass this same option to
pcre2_match() or pcre2_dfa_match().

UTF-16 and UTF-32 strings can indicate their endianness by special code knows
as a byte-order mark (BOM). The PCRE2 functions do not handle this, expecting
strings to be in host byte order.

Unless PCRE2_NO_UTF_CHECK is set, a UTF string is checked before any other
processing takes place. In the case of pcre2_match() and
pcre2_dfa_match() calls with a non-zero starting offset, the check is
applied only to that part of the subject that could be inspected during
matching, and there is a check that the starting offset points to the first
code unit of a character or to the end of the subject. If there are no
lookbehind assertions in the pattern, the check starts at the starting offset.
Otherwise, it starts at the length of the longest lookbehind before the
starting offset, or at the start of the subject if there are not that many
characters before the starting offset. Note that the sequences \b and \B are
one-character lookbehinds.

In addition to checking the format of the string, there is a check to ensure
that all code points lie in the range U+0 to U+10FFFF, excluding the surrogate
area. The so-called "non-character" code points are not excluded because
Unicode corrigendum #9 makes it clear that they should not be.

Characters in the "Surrogate Area" of Unicode are reserved for use by UTF-16,
where they are used in pairs to encode code points with values greater than
0xFFFF. The code points that are encoded by UTF-16 pairs are available
independently in the UTF-8 and UTF-32 encodings. (In other words, the whole
surrogate thing is a fudge for UTF-16 which unfortunately messes up UTF-8 and
UTF-32.)

Setting PCRE2_NO_UTF_CHECK at compile time does not disable the error that is
given if an escape sequence for an invalid Unicode code point is encountered in
the pattern. If you want to allow escape sequences such as \x{d800} (a
surrogate code point) you can set the PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES extra
option. However, this is possible only in UTF-8 and UTF-32 modes, because these
values are not representable in UTF-16.

Errors in UTF-8 strings

The following negative error codes are given for invalid UTF-8 strings:

  PCRE2_ERROR_UTF8_ERR1
  PCRE2_ERROR_UTF8_ERR2
  PCRE2_ERROR_UTF8_ERR3
  PCRE2_ERROR_UTF8_ERR4
  PCRE2_ERROR_UTF8_ERR5

The string ends with a truncated UTF-8 character; the code specifies how many
bytes are missing (1 to 5). Although RFC 3629 restricts UTF-8 characters to be
no longer than 4 bytes, the encoding scheme (originally defined by RFC 2279)
allows for up to 6 bytes, and this is checked first; hence the possibility of
4 or 5 missing bytes.

  PCRE2_ERROR_UTF8_ERR6
  PCRE2_ERROR_UTF8_ERR7
  PCRE2_ERROR_UTF8_ERR8
  PCRE2_ERROR_UTF8_ERR9
  PCRE2_ERROR_UTF8_ERR10

The two most significant bits of the 2nd, 3rd, 4th, 5th, or 6th byte of the
character do not have the binary value 0b10 (that is, either the most
significant bit is 0, or the next bit is 1).

  PCRE2_ERROR_UTF8_ERR11
  PCRE2_ERROR_UTF8_ERR12

A character that is valid by the RFC 2279 rules is either 5 or 6 bytes long;
these code points are excluded by RFC 3629.

  PCRE2_ERROR_UTF8_ERR13

A 4-byte character has a value greater than 0x10fff; these code points are
excluded by RFC 3629.

  PCRE2_ERROR_UTF8_ERR14

A 3-byte character has a value in the range 0xd800 to 0xdfff; this range of
code points are reserved by RFC 3629 for use with UTF-16, and so are excluded
from UTF-8.

  PCRE2_ERROR_UTF8_ERR15
  PCRE2_ERROR_UTF8_ERR16
  PCRE2_ERROR_UTF8_ERR17
  PCRE2_ERROR_UTF8_ERR18
  PCRE2_ERROR_UTF8_ERR19

A 2-, 3-, 4-, 5-, or 6-byte character is "overlong", that is, it codes for a
value that can be represented by fewer bytes, which is invalid. For example,
the two bytes 0xc0, 0xae give the value 0x2e, whose correct coding uses just
one byte.

  PCRE2_ERROR_UTF8_ERR20

The two most significant bits of the first byte of a character have the binary
value 0b10 (that is, the most significant bit is 1 and the second is 0). Such a
byte can only validly occur as the second or subsequent byte of a multi-byte
character.

  PCRE2_ERROR_UTF8_ERR21

The first byte of a character has the value 0xfe or 0xff. These values can
never occur in a valid UTF-8 string.

Errors in UTF-16 strings

The following negative error codes are given for invalid UTF-16 strings:

  PCRE2_ERROR_UTF16_ERR1  Missing low surrogate at end of string
  PCRE2_ERROR_UTF16_ERR2  Invalid low surrogate follows high surrogate
  PCRE2_ERROR_UTF16_ERR3  Isolated low surrogate

Errors in UTF-32 strings

The following negative error codes are given for invalid UTF-32 strings:

  PCRE2_ERROR_UTF32_ERR1  Surrogate character (0xd800 to 0xdfff)
  PCRE2_ERROR_UTF32_ERR2  Code point is greater than 0x10ffff

AUTHOR

Philip Hazel

University Computing Service

Cambridge, England.

REVISION

Last updated: 06 March 2019

Copyright © 1997-2019 University of Cambridge.

Return to the PCRE2 index page.


text:
namespace RhIO
{
class GnuPlot;
class NodePool;
class PlotCommand : public Command
{
public:
  virtual std::string getName();
  virtual std::string getDesc();
  virtual void process(std::vector<std::string> args);

  void update(GnuPlot* plot, NodePool* pool);

protected:
  bool paused;
};
}  // namespace RhIO


text:
"""security converge reports

Revision ID: 40f16acf1ba7
Revises: e38177dbf641
Create Date: 2020-11-30 15:25:47.489419

"""

# revision identifiers, used by Alembic.
revision = "40f16acf1ba7"
down_revision = "5daced1f0e76"

from alembic import op
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.orm import Session

from superset.migrations.shared.security_converge import (
    add_pvms,
    get_reversed_new_pvms,
    get_reversed_pvm_map,
    migrate_roles,
    Pvm,
)

NEW_PVMS = {
    "ReportSchedule": (
        "can_read",
        "can_write",
    )
}
PVM_MAP = {
    Pvm("ReportSchedule", "can_list"): (Pvm("ReportSchedule", "can_read"),),
    Pvm("ReportSchedule", "can_show"): (Pvm("ReportSchedule", "can_read"),),
    Pvm(
        "ReportSchedule",
        "can_add",
    ): (Pvm("ReportSchedule", "can_write"),),
    Pvm(
        "ReportSchedule",
        "can_edit",
    ): (Pvm("ReportSchedule", "can_write"),),
    Pvm(
        "ReportSchedule",
        "can_delete",
    ): (Pvm("ReportSchedule", "can_write"),),
}

def upgrade():
    bind = op.get_bind()
    session = Session(bind=bind)

    # Add the new permissions on the migration itself
    add_pvms(session, NEW_PVMS)
    migrate_roles(session, PVM_MAP)
    try:
        session.commit()
    except SQLAlchemyError as ex:
        print(f"An error occurred while upgrading permissions: {ex}")
        session.rollback()

def downgrade():
    bind = op.get_bind()
    session = Session(bind=bind)

    # Add the old permissions on the migration itself
    add_pvms(session, get_reversed_new_pvms(PVM_MAP))
    migrate_roles(session, get_reversed_pvm_map(PVM_MAP))
    try:
        session.commit()
    except SQLAlchemyError as ex:
        print(f"An error occurred while downgrading permissions: {ex}")
        session.rollback()
    pass