text:
<!DOCTYPE html>
<html>
  <head>
    <title>{% block title %}{% endblock %}</title>
    <link rel="stylesheet" href="/static/fullPage.js-master/jquery.fullPage.css" type="text/css" />
    <link rel="stylesheet" href="/static/global.css" type="text/css" />
    {% block css %}{% endblock css %}
  </head>
  <body>

    <!-- content -->
    {% block content %}
    {% endblock %}
    <!-- /content -->

    <!-- jQuery -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" type="text/javascript"></script>

    <!-- This following line is only necessary in the case of using the plugin option `scrollOverflow:true` -->
    <script src="/static/fullPage.js-master/vendors/jquery.slimscroll.min.js" type="text/javascript"></script>
    <script src="/static/fullPage.js-master/jquery.fullPage.js" type="text/javascript"></script>

    {% block js %}{% endblock js %}
  </body>
</html>


text:
.NET - Errors
*************

Breakpoint
==========

Every time I try to set a breakpoint I get the message:

*No breakpoint will currently be hit.  No symbols have been loaded for this
document*.

I had a *rogue* DLL in another folder.

Copy the ``dll`` and the ``pdb`` file to the application folder.

Checking the Visual Studio, Modules Window,
:doc:`../microsoft/visual-studio-debug` might help you see what is going on.

Repair
======

I had .NET 2 installed on my workstation.  Then installed Visual Studio 2003.
When I run *Microsoft SQL Server Management Studio* I get an error:

::

  The file... mscorlib.tlb could not be loaded.  An attempt to repair this condition

To repair:

`How to troubleshoot Microsoft .NET Framework 2.0 installation issues`_
`SQL Server Management Studio - mscorlib.tlb could not be loaded`_

.. _`How to troubleshoot Microsoft .NET Framework 2.0 installation issues`: http://support.microsoft.com/kb/908077
.. _`SQL Server Management Studio - mscorlib.tlb could not be loaded`: http://www.devnewsgroups.net/group/microsoft.public.sqlserver.tools/topic34748.aspx

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace ForkCMS\Modules\Internationalisation\DependencyInjection;

use ForkCMS\Core\Domain\DependencyInjection\ForkModuleExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
 * This is the class that loads and manages your module configuration.
 *
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
 */
class InternationalisationExtension extends ForkModuleExtension
{
    public function load(array $configs, ContainerBuilder $container): void
    {
        $this->getLoader($container)->load('services.yaml');

        if ($container->getParameter('fork.is_installed')) {
            $this->getLoader($container)->load('controllers.yaml');
        }
    }

    public function prepend(ContainerBuilder $container): void
    {
        $this->getLoader($container)->load('doctrine.yaml');
    }
}


text:
chorus.dialogs.VerifyChorusView = chorus.dialogs.SqlPreview.extend({
    constructorName: "VerifyChorusView",

    templateName: "verify_chorus_view",
    title: t("dataset.verify_chorus_view.title"),
    additionalClass: "sql_preview dialog_wide",

    persistent: true,

    events: {
        "click button.edit": "makeEditable"
    },

    setup: function() {
        this._super("setup");
        this.events = _.clone(this.events);
        _.extend(this.events, {
            "submit form": "nameChorusView"
        });
    },

    nameChorusView: function(e) {
        e.preventDefault();

        this.model.set({ query: this.sql() });

        var assignNameDialog = new chorus.dialogs.NameChorusView({
            model: this.model
        });
        this.launchSubModal(assignNameDialog);
    },

    sql: function() {
        return this.editor.getValue();
    },

    makeEditable: function(e) {
        e && e.preventDefault();

        this.editor.setOption("readOnly", false);
        this.editor.setOption("theme", "default editable");

        $(e.target).addClass("disabled");
    }
});


text:
package de.ehex.foss.gematik.specifications;

import static java.util.Arrays.stream;
import static java.util.stream.Collectors.toList;

import org.j8unit.runners.J8Parameterized;
import org.j8unit.runners.parameterized.J8BlockJUnit4ClassRunnerWithParametersFactory;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
import org.junit.runners.Parameterized.UseParametersRunnerFactory;

@RunWith(J8Parameterized.class)
@UseParametersRunnerFactory(J8BlockJUnit4ClassRunnerWithParametersFactory.class)
public final class AFOTypeTest implements AFOTypeTests<AFOType> {

    @Parameters(name = "{0}")
    public final static Iterable<Object[]> data() {
        return stream(AFOType.values()).map(l -> new Object[] { l }).collect(toList());
    }

    @Parameter(0)
    public AFOType sut;

    @Override
    public final AFOType createNewSUT() {
        return this.sut;
    }

}


text:
export function integer(val) {
  return Number.isInteger(parseInt(val, 10));
}

export function double(val) {
  return !Number.isNaN(Number(val));
}

export function string(val) {
  return typeof val === 'string' || val instanceof String;
}

export function boolean(val) {
  return typeof val === 'boolean';
}

export default {
  integer,
  int: integer,

  double,
  dbl: double,
  float: double,

  string,
  str: string,

  boolean,
  bool: boolean,
};


text:
from google.protobuf import descriptor
from google.protobuf import message
from google.protobuf import reflection
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)

DESCRIPTOR = descriptor.FileDescriptor(
  name='rpc.proto',
  package='protobuf.socketrpc',
  serialized_pb='\n\trpc.proto\x12\x12protobuf.socketrpc\"K\n\x07Request\x12\x14\n\x0cservice_name\x18\x01 \x02(\t\x12\x13\n\x0bmethod_name\x18\x02 \x02(\t\x12\x15\n\rrequest_proto\x18\x03 \x02(\x0c\"\x81\x01\n\x08Response\x12\x16\n\x0eresponse_proto\x18\x01 \x01(\x0c\x12\r\n\x05\x65rror\x18\x02 \x01(\t\x12\x17\n\x08\x63\x61llback\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x35\n\x0c\x65rror_reason\x18\x04 \x01(\x0e\x32\x1f.protobuf.socketrpc.ErrorReason*\xd9\x01\n\x0b\x45rrorReason\x12\x14\n\x10\x42\x41\x44_REQUEST_DATA\x10\x00\x12\x15\n\x11\x42\x41\x44_REQUEST_PROTO\x10\x01\x12\x15\n\x11SERVICE_NOT_FOUND\x10\x02\x12\x14\n\x10METHOD_NOT_FOUND\x10\x03\x12\r\n\tRPC_ERROR\x10\x04\x12\x0e\n\nRPC_FAILED\x10\x05\x12\x19\n\x15INVALID_REQUEST_PROTO\x10\x06\x12\x16\n\x12\x42\x41\x44_RESPONSE_PROTO\x10\x07\x12\x10\n\x0cUNKNOWN_HOST\x10\x08\x12\x0c\n\x08IO_ERROR\x10\tB4\n!com.googlecode.protobuf.socketrpcB\x0fSocketRpcProtos')

_ERRORREASON = descriptor.EnumDescriptor(
  name='ErrorReason',
  full_name='protobuf.socketrpc.ErrorReason',
  filename=None,
  file=DESCRIPTOR,
  values=[
    descriptor.EnumValueDescriptor(
      name='BAD_REQUEST_DATA', index=0, number=0,
      options=None,
      type=None),
    descriptor.EnumValueDescriptor(
      name='BAD_REQUEST_PROTO', index=1, number=1,
      options=None,
      type=None),
    descriptor.EnumValueDescriptor(
      name='SERVICE_NOT_FOUND', index=2, number=2,
      options=None,
      type=None),
    descriptor.EnumValueDescriptor(
      name='METHOD_NOT_FOUND', index=3, number=3,
      options=None,
      type=None),
    descriptor.EnumValueDescriptor(
      name='RPC_ERROR', index=4, number=4,
      options=None,
      type=None),
    descriptor.EnumValueDescriptor(
      name='RPC_FAILED', index=5, number=5,
      options=None,
      type=None),
    descriptor.EnumValueDescriptor(
      name='INVALID_REQUEST_PROTO', index=6, number=6,
      options=None,
      type=None),
    descriptor.EnumValueDescriptor(
      name='BAD_RESPONSE_PROTO', index=7, number=7,
      options=None,
      type=None),
    descriptor.EnumValueDescriptor(
      name='UNKNOWN_HOST', index=8, number=8,
      options=None,
      type=None),
    descriptor.EnumValueDescriptor(
      name='IO_ERROR', index=9, number=9,
      options=None,
      type=None),
  ],
  containing_type=None,
  options=None,
  serialized_start=243,
  serialized_end=460,
)

BAD_REQUEST_DATA = 0
BAD_REQUEST_PROTO = 1
SERVICE_NOT_FOUND = 2
METHOD_NOT_FOUND = 3
RPC_ERROR = 4
RPC_FAILED = 5
INVALID_REQUEST_PROTO = 6
BAD_RESPONSE_PROTO = 7
UNKNOWN_HOST = 8
IO_ERROR = 9

_REQUEST = descriptor.Descriptor(
  name='Request',
  full_name='protobuf.socketrpc.Request',
  filename=None,
  file=DESCRIPTOR,
  containing_type=None,
  fields=[
    descriptor.FieldDescriptor(
      name='service_name', full_name='protobuf.socketrpc.Request.service_name', index=0,
      number=1, type=9, cpp_type=9, label=2,
      has_default_value=False, default_value=unicode("", "utf-8"),
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      options=None),
    descriptor.FieldDescriptor(
      name='method_name', full_name='protobuf.socketrpc.Request.method_name', index=1,
      number=2, type=9, cpp_type=9, label=2,
      has_default_value=False, default_value=unicode("", "utf-8"),
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      options=None),
    descriptor.FieldDescriptor(
      name='request_proto', full_name='protobuf.socketrpc.Request.request_proto', index=2,
      number=3, type=12, cpp_type=9, label=2,
      has_default_value=False, default_value="",
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      options=None),
  ],
  extensions=[
  ],
  nested_types=[],
  enum_types=[
  ],
  options=None,
  is_extendable=False,
  extension_ranges=[],
  serialized_start=33,
  serialized_end=108,
)

_RESPONSE = descriptor.Descriptor(
  name='Response',
  full_name='protobuf.socketrpc.Response',
  filename=None,
  file=DESCRIPTOR,
  containing_type=None,
  fields=[
    descriptor.FieldDescriptor(
      name='response_proto', full_name='protobuf.socketrpc.Response.response_proto', index=0,
      number=1, type=12, cpp_type=9, label=1,
      has_default_value=False, default_value="",
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      options=None),
    descriptor.FieldDescriptor(
      name='error', full_name='protobuf.socketrpc.Response.error', index=1,
      number=2, type=9, cpp_type=9, label=1,
      has_default_value=False, default_value=unicode("", "utf-8"),
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      options=None),
    descriptor.FieldDescriptor(
      name='callback', full_name='protobuf.socketrpc.Response.callback', index=2,
      number=3, type=8, cpp_type=7, label=1,
      has_default_value=True, default_value=False,
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      options=None),
    descriptor.FieldDescriptor(
      name='error_reason', full_name='protobuf.socketrpc.Response.error_reason', index=3,
      number=4, type=14, cpp_type=8, label=1,
      has_default_value=False, default_value=0,
      message_type=None, enum_type=None, containing_type=None,
      is_extension=False, extension_scope=None,
      options=None),
  ],
  extensions=[
  ],
  nested_types=[],
  enum_types=[
  ],
  options=None,
  is_extendable=False,
  extension_ranges=[],
  serialized_start=111,
  serialized_end=240,
)

_RESPONSE.fields_by_name['error_reason'].enum_type = _ERRORREASON

class Request(message.Message):
  __metaclass__ = reflection.GeneratedProtocolMessageType
  DESCRIPTOR = _REQUEST

  # @@protoc_insertion_point(class_scope:protobuf.socketrpc.Request)

class Response(message.Message):
  __metaclass__ = reflection.GeneratedProtocolMessageType
  DESCRIPTOR = _RESPONSE

  # @@protoc_insertion_point(class_scope:protobuf.socketrpc.Response)

# @@protoc_insertion_point(module_scope)


text:
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

#include "parquet/arrow/writer.h"

#include <algorithm>
#include <deque>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>

#include "arrow/array.h"
#include "arrow/buffer_builder.h"
#include "arrow/extension_type.h"
#include "arrow/ipc/writer.h"
#include "arrow/table.h"
#include "arrow/type.h"
#include "arrow/util/base64.h"
#include "arrow/util/checked_cast.h"
#include "arrow/util/logging.h"
#include "arrow/util/make_unique.h"
#include "arrow/visitor_inline.h"

#include "parquet/arrow/path_internal.h"
#include "parquet/arrow/reader_internal.h"
#include "parquet/arrow/schema.h"
#include "parquet/column_writer.h"
#include "parquet/exception.h"
#include "parquet/file_writer.h"
#include "parquet/platform.h"
#include "parquet/schema.h"

using arrow::Array;
using arrow::BinaryArray;
using arrow::BooleanArray;
using arrow::ChunkedArray;
using arrow::DataType;
using arrow::DictionaryArray;
using arrow::ExtensionArray;
using arrow::ExtensionType;
using arrow::Field;
using arrow::FixedSizeBinaryArray;
using Int16BufferBuilder = arrow::TypedBufferBuilder<int16_t>;
using arrow::ListArray;
using arrow::MemoryPool;
using arrow::NumericArray;
using arrow::PrimitiveArray;
using arrow::ResizableBuffer;
using arrow::Status;
using arrow::Table;
using arrow::TimeUnit;

using arrow::internal::checked_cast;

using parquet::ParquetFileWriter;
using parquet::ParquetVersion;
using parquet::schema::GroupNode;

namespace parquet {
namespace arrow {

namespace {

int CalculateLeafCount(const DataType* type) {
  if (type->id() == ::arrow::Type::EXTENSION) {
    type = checked_cast<const ExtensionType&>(*type).storage_type().get();
  }
  if (type->num_fields() == 0) {
    // Primitive type.
    return 1;
  }

  int num_leaves = 0;
  for (const auto& field : type->fields()) {
    num_leaves += CalculateLeafCount(field->type().get());
  }
  return num_leaves;
}

// Determines if the |schema_field|'s root ancestor is nullable.
bool HasNullableRoot(const SchemaManifest& schema_manifest,
                     const SchemaField* schema_field) {
  DCHECK(schema_field != nullptr);
  const SchemaField* current_field = schema_field;
  bool nullable = schema_field->field->nullable();
  while (current_field != nullptr) {
    nullable = current_field->field->nullable();
    current_field = schema_manifest.GetParent(current_field);
  }
  return nullable;
}

// Manages writing nested parquet columns with support for all nested types
// supported by parquet.
class ArrowColumnWriterV2 {
 public:
  // Constructs a new object (use Make() method below to construct from
  // A ChunkedArray).
  // level_builders should contain one MultipathLevelBuilder per chunk of the
  // Arrow-column to write.
  ArrowColumnWriterV2(std::vector<std::unique_ptr<MultipathLevelBuilder>> level_builders,
                      int leaf_count, RowGroupWriter* row_group_writer)
      : level_builders_(std::move(level_builders)),
        leaf_count_(leaf_count),
        row_group_writer_(row_group_writer) {}

  // Writes out all leaf parquet columns to the RowGroupWriter that this
  // object was constructed with.  Each leaf column is written fully before
  // the next column is written (i.e. no buffering is assumed).
  //
  // Columns are written in DFS order.
  Status Write(ArrowWriteContext* ctx) {
    for (int leaf_idx = 0; leaf_idx < leaf_count_; leaf_idx++) {
      ColumnWriter* column_writer;
      PARQUET_CATCH_NOT_OK(column_writer = row_group_writer_->NextColumn());
      for (auto& level_builder : level_builders_) {
        RETURN_NOT_OK(level_builder->Write(
            leaf_idx, ctx, [&](const MultipathLevelBuilderResult& result) {
              size_t visited_component_size = result.post_list_visited_elements.size();
              DCHECK_GT(visited_component_size, 0);
              if (visited_component_size != 1) {
                return Status::NotImplemented(
                    "Lists with non-zero length null components are not supported");
              }
              const ElementRange& range = result.post_list_visited_elements[0];
              std::shared_ptr<Array> values_array =
                  result.leaf_array->Slice(range.start, range.Size());

              return column_writer->WriteArrow(result.def_levels, result.rep_levels,
                                               result.def_rep_level_count, *values_array,
                                               ctx, result.leaf_is_nullable);
            }));
      }

      PARQUET_CATCH_NOT_OK(column_writer->Close());
    }
    return Status::OK();
  }

  // Make a new object by converting each chunk in |data| to a MultipathLevelBuilder.
  //
  // It is necessary to create a new builder per array because the MultipathlevelBuilder
  // extracts the data necessary for writing each leaf column at construction time.
  // (it optimizes based on null count) and with slicing via |offset| ephemeral
  // chunks are created which need to be tracked across each leaf column-write.
  // This decision could potentially be revisited if we wanted to use "buffered"
  // RowGroupWriters (we could construct each builder on demand in that case).
  static ::arrow::Result<std::unique_ptr<ArrowColumnWriterV2>> Make(
      const ChunkedArray& data, int64_t offset, const int64_t size,
      const SchemaManifest& schema_manifest, RowGroupWriter* row_group_writer) {
    int64_t absolute_position = 0;
    int chunk_index = 0;
    int64_t chunk_offset = 0;
    if (data.length() == 0) {
      return ::arrow::internal::make_unique<ArrowColumnWriterV2>(
          std::vector<std::unique_ptr<MultipathLevelBuilder>>{},
          CalculateLeafCount(data.type().get()), row_group_writer);
    }
    while (chunk_index < data.num_chunks() && absolute_position < offset) {
      const int64_t chunk_length = data.chunk(chunk_index)->length();
      if (absolute_position + chunk_length > offset) {
        // Relative offset into the chunk to reach the desired start offset for
        // writing
        chunk_offset = offset - absolute_position;
        break;
      } else {
        ++chunk_index;
        absolute_position += chunk_length;
      }
    }

    if (absolute_position >= data.length()) {
      return Status::Invalid("Cannot write data at offset past end of chunked array");
    }

    int64_t values_written = 0;
    std::vector<std::unique_ptr<MultipathLevelBuilder>> builders;
    const int leaf_count = CalculateLeafCount(data.type().get());
    bool is_nullable = false;
    // The row_group_writer hasn't been advanced yet so add 1 to the current
    // which is the one this instance will start writing for.
    int column_index = row_group_writer->current_column() + 1;
    for (int leaf_offset = 0; leaf_offset < leaf_count; ++leaf_offset) {
      const SchemaField* schema_field = nullptr;
      RETURN_NOT_OK(
          schema_manifest.GetColumnField(column_index + leaf_offset, &schema_field));
      bool nullable_root = HasNullableRoot(schema_manifest, schema_field);
      if (leaf_offset == 0) {
        is_nullable = nullable_root;
      }

// Don't validate common ancestry for all leafs if not in debug.
#ifndef NDEBUG
      break;
#else
      if (is_nullable != nullable_root) {
        return Status::UnknownError(
            "Unexpected mismatched nullability between column index",
            column_index + leaf_offset, " and ", column_index);
      }
#endif
    }
    while (values_written < size) {
      const Array& chunk = *data.chunk(chunk_index);
      const int64_t available_values = chunk.length() - chunk_offset;
      const int64_t chunk_write_size = std::min(size - values_written, available_values);

      // The chunk offset here will be 0 except for possibly the first chunk
      // because of the advancing logic above
      std::shared_ptr<Array> array_to_write = chunk.Slice(chunk_offset, chunk_write_size);

      if (array_to_write->length() > 0) {
        ARROW_ASSIGN_OR_RAISE(std::unique_ptr<MultipathLevelBuilder> builder,
                              MultipathLevelBuilder::Make(*array_to_write, is_nullable));
        if (leaf_count != builder->GetLeafCount()) {
          return Status::UnknownError("data type leaf_count != builder_leaf_count",
                                      leaf_count, " ", builder->GetLeafCount());
        }
        builders.emplace_back(std::move(builder));
      }

      if (chunk_write_size == available_values) {
        chunk_offset = 0;
        ++chunk_index;
      }
      values_written += chunk_write_size;
    }
    return ::arrow::internal::make_unique<ArrowColumnWriterV2>(
        std::move(builders), leaf_count, row_group_writer);
  }

 private:
  // One builder per column-chunk.
  std::vector<std::unique_ptr<MultipathLevelBuilder>> level_builders_;
  int leaf_count_;
  RowGroupWriter* row_group_writer_;
};

}  // namespace

// ----------------------------------------------------------------------
// FileWriter implementation

class FileWriterImpl : public FileWriter {
 public:
  FileWriterImpl(std::shared_ptr<::arrow::Schema> schema, MemoryPool* pool,
                 std::unique_ptr<ParquetFileWriter> writer,
                 std::shared_ptr<ArrowWriterProperties> arrow_properties)
      : schema_(std::move(schema)),
        writer_(std::move(writer)),
        row_group_writer_(nullptr),
        column_write_context_(pool, arrow_properties.get()),
        arrow_properties_(std::move(arrow_properties)),
        closed_(false) {}

  Status Init() {
    return SchemaManifest::Make(writer_->schema(), /*schema_metadata=*/nullptr,
                                default_arrow_reader_properties(), &schema_manifest_);
  }

  Status NewRowGroup(int64_t chunk_size) override {
    if (row_group_writer_ != nullptr) {
      PARQUET_CATCH_NOT_OK(row_group_writer_->Close());
    }
    PARQUET_CATCH_NOT_OK(row_group_writer_ = writer_->AppendRowGroup());
    return Status::OK();
  }

  Status Close() override {
    if (!closed_) {
      // Make idempotent
      closed_ = true;
      if (row_group_writer_ != nullptr) {
        PARQUET_CATCH_NOT_OK(row_group_writer_->Close());
      }
      PARQUET_CATCH_NOT_OK(writer_->Close());
    }
    return Status::OK();
  }

  Status WriteColumnChunk(const Array& data) override {
    // A bit awkward here since cannot instantiate ChunkedArray from const Array&
    auto chunk = ::arrow::MakeArray(data.data());
    auto chunked_array = std::make_shared<::arrow::ChunkedArray>(chunk);
    return WriteColumnChunk(chunked_array, 0, data.length());
  }

  Status WriteColumnChunk(const std::shared_ptr<ChunkedArray>& data, int64_t offset,
                          int64_t size) override {
    if (arrow_properties_->engine_version() == ArrowWriterProperties::V2 ||
        arrow_properties_->engine_version() == ArrowWriterProperties::V1) {
      ARROW_ASSIGN_OR_RAISE(
          std::unique_ptr<ArrowColumnWriterV2> writer,
          ArrowColumnWriterV2::Make(*data, offset, size, schema_manifest_,
                                    row_group_writer_));
      return writer->Write(&column_write_context_);
    }
    return Status::NotImplemented("Unknown engine version.");
  }

  Status WriteColumnChunk(const std::shared_ptr<::arrow::ChunkedArray>& data) override {
    return WriteColumnChunk(data, 0, data->length());
  }

  std::shared_ptr<::arrow::Schema> schema() const override { return schema_; }

  Status WriteTable(const Table& table, int64_t chunk_size) override {
    RETURN_NOT_OK(table.Validate());

    if (chunk_size <= 0 && table.num_rows() > 0) {
      return Status::Invalid("chunk size per row_group must be greater than 0");
    } else if (!table.schema()->Equals(*schema_, false)) {
      return Status::Invalid("table schema does not match this writer's. table:'",
                             table.schema()->ToString(), "' this:'", schema_->ToString(),
                             "'");
    } else if (chunk_size > this->properties().max_row_group_length()) {
      chunk_size = this->properties().max_row_group_length();
    }

    auto WriteRowGroup = [&](int64_t offset, int64_t size) {
      RETURN_NOT_OK(NewRowGroup(size));
      for (int i = 0; i < table.num_columns(); i++) {
        RETURN_NOT_OK(WriteColumnChunk(table.column(i), offset, size));
      }
      return Status::OK();
    };

    if (table.num_rows() == 0) {
      // Append a row group with 0 rows
      RETURN_NOT_OK_ELSE(WriteRowGroup(0, 0), PARQUET_IGNORE_NOT_OK(Close()));
      return Status::OK();
    }

    for (int chunk = 0; chunk * chunk_size < table.num_rows(); chunk++) {
      int64_t offset = chunk * chunk_size;
      RETURN_NOT_OK_ELSE(
          WriteRowGroup(offset, std::min(chunk_size, table.num_rows() - offset)),
          PARQUET_IGNORE_NOT_OK(Close()));
    }
    return Status::OK();
  }

  const WriterProperties& properties() const { return *writer_->properties(); }

  ::arrow::MemoryPool* memory_pool() const override {
    return column_write_context_.memory_pool;
  }

  const std::shared_ptr<FileMetaData> metadata() const override {
    return writer_->metadata();
  }

 private:
  friend class FileWriter;

  std::shared_ptr<::arrow::Schema> schema_;

  SchemaManifest schema_manifest_;

  std::unique_ptr<ParquetFileWriter> writer_;
  RowGroupWriter* row_group_writer_;
  ArrowWriteContext column_write_context_;
  std::shared_ptr<ArrowWriterProperties> arrow_properties_;
  bool closed_;
};

FileWriter::~FileWriter() {}

Status FileWriter::Make(::arrow::MemoryPool* pool,
                        std::unique_ptr<ParquetFileWriter> writer,
                        std::shared_ptr<::arrow::Schema> schema,
                        std::shared_ptr<ArrowWriterProperties> arrow_properties,
                        std::unique_ptr<FileWriter>* out) {
  std::unique_ptr<FileWriterImpl> impl(new FileWriterImpl(
      std::move(schema), pool, std::move(writer), std::move(arrow_properties)));
  RETURN_NOT_OK(impl->Init());
  *out = std::move(impl);
  return Status::OK();
}

Status FileWriter::Open(const ::arrow::Schema& schema, ::arrow::MemoryPool* pool,
                        std::shared_ptr<::arrow::io::OutputStream> sink,
                        std::shared_ptr<WriterProperties> properties,
                        std::unique_ptr<FileWriter>* writer) {
  return Open(std::move(schema), pool, std::move(sink), std::move(properties),
              default_arrow_writer_properties(), writer);
}

Status GetSchemaMetadata(const ::arrow::Schema& schema, ::arrow::MemoryPool* pool,
                         const ArrowWriterProperties& properties,
                         std::shared_ptr<const KeyValueMetadata>* out) {
  if (!properties.store_schema()) {
    *out = nullptr;
    return Status::OK();
  }

  static const std::string kArrowSchemaKey = "ARROW:schema";
  std::shared_ptr<KeyValueMetadata> result;
  if (schema.metadata()) {
    result = schema.metadata()->Copy();
  } else {
    result = ::arrow::key_value_metadata({}, {});
  }

  ARROW_ASSIGN_OR_RAISE(std::shared_ptr<Buffer> serialized,
                        ::arrow::ipc::SerializeSchema(schema, pool));

  // The serialized schema is not UTF-8, which is required for Thrift
  std::string schema_as_string = serialized->ToString();
  std::string schema_base64 = ::arrow::util::base64_encode(
      reinterpret_cast<const unsigned char*>(schema_as_string.data()),
      static_cast<unsigned int>(schema_as_string.size()));
  result->Append(kArrowSchemaKey, schema_base64);
  *out = result;
  return Status::OK();
}

Status FileWriter::Open(const ::arrow::Schema& schema, ::arrow::MemoryPool* pool,
                        std::shared_ptr<::arrow::io::OutputStream> sink,
                        std::shared_ptr<WriterProperties> properties,
                        std::shared_ptr<ArrowWriterProperties> arrow_properties,
                        std::unique_ptr<FileWriter>* writer) {
  std::shared_ptr<SchemaDescriptor> parquet_schema;
  RETURN_NOT_OK(
      ToParquetSchema(&schema, *properties, *arrow_properties, &parquet_schema));

  auto schema_node = std::static_pointer_cast<GroupNode>(parquet_schema->schema_root());

  std::shared_ptr<const KeyValueMetadata> metadata;
  RETURN_NOT_OK(GetSchemaMetadata(schema, pool, *arrow_properties, &metadata));

  std::unique_ptr<ParquetFileWriter> base_writer;
  PARQUET_CATCH_NOT_OK(base_writer = ParquetFileWriter::Open(std::move(sink), schema_node,
                                                             std::move(properties),
                                                             std::move(metadata)));

  auto schema_ptr = std::make_shared<::arrow::Schema>(schema);
  return Make(pool, std::move(base_writer), std::move(schema_ptr),
              std::move(arrow_properties), writer);
}

Status WriteFileMetaData(const FileMetaData& file_metadata,
                         ::arrow::io::OutputStream* sink) {
  PARQUET_CATCH_NOT_OK(::parquet::WriteFileMetaData(file_metadata, sink));
  return Status::OK();
}

Status WriteMetaDataFile(const FileMetaData& file_metadata,
                         ::arrow::io::OutputStream* sink) {
  PARQUET_CATCH_NOT_OK(::parquet::WriteMetaDataFile(file_metadata, sink));
  return Status::OK();
}

Status WriteTable(const ::arrow::Table& table, ::arrow::MemoryPool* pool,
                  std::shared_ptr<::arrow::io::OutputStream> sink, int64_t chunk_size,
                  std::shared_ptr<WriterProperties> properties,
                  std::shared_ptr<ArrowWriterProperties> arrow_properties) {
  std::unique_ptr<FileWriter> writer;
  RETURN_NOT_OK(FileWriter::Open(*table.schema(), pool, std::move(sink),
                                 std::move(properties), std::move(arrow_properties),
                                 &writer));
  RETURN_NOT_OK(writer->WriteTable(table, chunk_size));
  return writer->Close();
}

}  // namespace arrow
}  // namespace parquet


text:
 package acre.ui;

 import java.awt.Color;
 import java.awt.Dimension;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.Point;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseMotionAdapter;
 import java.awt.geom.Line2D;
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
 import java.util.ArrayList;
 import java.util.HashMap;
 import javax.swing.JComponent;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;

 import acre.sbml.ModelNode;
 import acre.ui.externalFrames.ConstraintsFrameTree;
 import acre.ui.externalFrames.GlobalConstraints;

 public class GraphPanel extends JComponent implements java.io.Serializable
 {
   private Graph graph;
   private ToolBar toolBar;
   private Point2D lastMousePoint;
   private Point2D rubberBandStart;
   private Point2D dragStartPoint;
   private Rectangle2D dragStartBounds;
   private Object selected;

   public GraphPanel(ToolBar aToolBar, Graph aGraph, JLabel statusBar)
   {
     this.toolBar = aToolBar;
     this.graph = aGraph;
     this.statusBar = statusBar;
     setBackground(Color.WHITE);

     addMouseListener(
       new java.awt.event.MouseAdapter()
       {
         public void mousePressed(MouseEvent event)
         {
           Point2D mousePoint = event.getPoint();
           Node n = GraphPanel.this.graph.findNode(mousePoint);
           Object tool = GraphPanel.this.toolBar.getSelectedTool();
           if (tool == null)
           {
             if (n != null)
             {
               GraphPanel.this.selected = n;
               GraphPanel.this.dragStartPoint = mousePoint;
               GraphPanel.this.dragStartBounds = n.getBounds();
               if (event.getClickCount() == 2)
               {
                 GraphPanel.this.editConstraints();
               }
             }
             else
             {
               GraphPanel.this.selected = null;
             }
           }
           else if ((tool instanceof Node))
           {
             Node prototype = (Node)tool;
             ModuleNode newNode = (ModuleNode)prototype.clone();

             ModelNode modelNode = GraphPanel.this.graph.modelMgr.createNode(newNode.model);
             newNode.setName(modelNode.getID());
             newNode.modelNode = modelNode;
             GraphPanel.this.ModeltoModule.put(modelNode, newNode);

             boolean added = GraphPanel.this.graph.add(newNode, mousePoint);
             if (added)
             {
               GraphPanel.this.selected = newNode;
               GraphPanel.this.dragStartPoint = mousePoint;
               GraphPanel.this.dragStartBounds = newNode.getBounds();
             }
             else if (n != null)
             {
               GraphPanel.this.selected = n;
               GraphPanel.this.dragStartPoint = mousePoint;
               GraphPanel.this.dragStartBounds = n.getBounds();
             }
           }

           GraphPanel.this.lastMousePoint = mousePoint;
           GraphPanel.this.updateStatusBar();
           GraphPanel.this.revalidate();
           GraphPanel.this.repaint();
         }

         public void mouseReleased(MouseEvent event)
         {
           Object tool = GraphPanel.this.toolBar.getSelectedTool();
           if (GraphPanel.this.rubberBandStart != null)
           {
             Point localPoint = event.getPoint();
           }

           GraphPanel.this.revalidate();
           GraphPanel.this.repaint();

           GraphPanel.this.lastMousePoint = null;
           GraphPanel.this.dragStartBounds = null;
           GraphPanel.this.rubberBandStart = null;
         }

       });
     addMouseMotionListener(
       new MouseMotionAdapter()
       {
         public void mouseDragged(MouseEvent event)
         {
           Point2D mousePoint = event.getPoint();
           if (GraphPanel.this.dragStartBounds != null)
           {
             if ((GraphPanel.this.selected instanceof Node))
             {
               Node n = (Node)GraphPanel.this.selected;
               Rectangle2D bounds = n.getBounds();
               n.translate(
                 GraphPanel.this.dragStartBounds.getX() - bounds.getX() +
                 mousePoint.getX() - GraphPanel.this.dragStartPoint.getX(),
                 GraphPanel.this.dragStartBounds.getY() - bounds.getY() +
                 mousePoint.getY() - GraphPanel.this.dragStartPoint.getY());
             }
           }
           GraphPanel.this.lastMousePoint = mousePoint;
           GraphPanel.this.revalidate();
           GraphPanel.this.repaint();
         }
       });
   }

   public void updateStatusBar()
   {
     if ((this.selected instanceof Node))
       this.statusBar.setText(((ModuleNode)this.selected).model.getPrintedReactions());
   }

   public void paintComponent(Graphics g) {
     Graphics2D g2 = (Graphics2D)g;
     Rectangle2D bounds = getBounds();
     Rectangle2D graphBounds = this.graph.getBounds(g2);
     this.graph.draw(g2);

     if ((this.selected instanceof Node))
     {
       Rectangle2D grabberBounds = ((Node)this.selected).getBounds();
       drawGrabber(g2, grabberBounds.getMinX(), grabberBounds.getMinY());
       drawGrabber(g2, grabberBounds.getMinX(), grabberBounds.getMaxY());
       drawGrabber(g2, grabberBounds.getMaxX(), grabberBounds.getMinY());
       drawGrabber(g2, grabberBounds.getMaxX(), grabberBounds.getMaxY());
     }

     if (this.rubberBandStart != null)
     {
       Color oldColor = g2.getColor();
       g2.setColor(PURPLE);
       g2.draw(new Line2D.Double(this.rubberBandStart, this.lastMousePoint));
       g2.setColor(oldColor);
     }
   }

   public void removeSelected()
   {
     if ((this.selected instanceof Node))
     {
       this.graph.modelMgr.deleteNode(((ModuleNode)this.selected).modelNode);
       this.graph.removeNode((Node)this.selected);
     }

     this.selected = null;
     revalidate();
     repaint();
   }

   public void removeAllNodes(ModuleNode n) {
     ArrayList<ModelNode> deletes = this.graph.modelMgr.deleteAllNodes(n.model.getAutoID());
     for (int i = 0; i < deletes.size(); i++)
     {
       this.graph.removeNode((Node)this.ModeltoModule.get(deletes.get(i)));
     }
     this.selected = null;
     revalidate();
     repaint();
   }

   public void removeAllNodes() {
     this.graph.modelMgr.deleteAllNodes();
     this.graph.removeAllNodes();
     revalidate();
     repaint();
   }

   public void SaveState(WorkSpace s)
   {
     s.nodes = new ArrayList();
     for (Node n : this.graph.nodes)
     {
       s.nodes.add((ModuleNode)((ModuleNode)n).clone());
     }
     s.minEdges = this.minEdges.intValue();
     s.maxEdges = this.maxEdges.intValue();
   }

   public void LoadState(WorkSpace s)
   {
     this.minEdges = Integer.valueOf(s.minEdges);
     this.maxEdges = Integer.valueOf(s.maxEdges);
     for (Object n : s.nodes)
     {
       ModuleNode newNode = (ModuleNode)n;
       this.graph.modelMgr.addNode(newNode.modelNode);
       ModelNode modelNode = newNode.modelNode;
       newNode.setName(modelNode.getID());
       newNode.modelNode = modelNode;
       this.ModeltoModule.put(modelNode, newNode);
       Point2D p = new Point2D.Double(newNode.getBounds().getMinX(), newNode.getBounds().getMinY());
       boolean added = this.graph.add(newNode, p);
       if (added)
       {
         this.selected = newNode;
         this.dragStartPoint = p;
         this.dragStartBounds = newNode.getBounds();
       }
     }

     revalidate();
     repaint();
   }

   public void editConstraints()
   {
     if ((this.selected instanceof Node)) {
       ModuleNode selectedNode = (ModuleNode)this.selected;
       ModelNode modelNode = selectedNode.modelNode;

       ConstraintsFrameTree demo = new ConstraintsFrameTree("Node Constrains Selection", modelNode, modelNode.getModel().getInputs(),
         this.graph.modelMgr.getOutputsExceptNode(modelNode), modelNode.getID(), modelNode.getModel().getPrintedReactions());

       demo.setDefaultCloseOperation(3);
       Object[] options = { "Done", "Cancel" };

       JOptionPane.showOptionDialog(null, demo.getContentPane(), "Node Constrains Selection",
         0, -1, null, options, options[0]);
       demo.updateConstraints(modelNode);
     }
   }

   public void editgConstraints()
   {
     GlobalConstraints demo = new GlobalConstraints(this.minEdges.intValue(), this.maxEdges.intValue());

     demo.setDefaultCloseOperation(3);
     Object[] options = { "Done", "Cancel" };

     JOptionPane.showOptionDialog(null, demo.getContentPane(), "Node Constrains Selection",
       0, -1, null, options, options[0]);
     this.minEdges = Integer.valueOf(demo.getMin());
     this.maxEdges = Integer.valueOf(demo.getMax());
   }

   public static void drawGrabber(Graphics2D g2, double x, double y)
   {
     int SIZE = 5;
     Color oldColor = g2.getColor();
     g2.setColor(PURPLE);
     g2.fill(new Rectangle2D.Double(x - 2.0D,
       y - 2.0D, 5.0D, 5.0D));
     g2.setColor(oldColor);
   }

   public Dimension getPreferredSize()
   {
     Rectangle2D bounds =
       this.graph.getBounds((Graphics2D)getGraphics());
     return new Dimension(
       (int)bounds.getMaxX(),
       (int)bounds.getMaxY());
   }

   private static final Color PURPLE = new Color(0.7F, 0.4F, 0.7F);
   private HashMap<ModelNode, ModuleNode> ModeltoModule = new HashMap();
   private JLabel statusBar;
   private Integer minEdges = Integer.valueOf(0); private Integer maxEdges = Integer.valueOf(Integer.MAX_VALUE);
 }


text:
<?php
/**
 * Created by PhpStorm.
 * User: Max
 * Date: 11/17/2014
 * Time: 6:05 PM
 */

class RideController extends BaseController {

    protected function getRides() {
        // Advanced Search
        if (Input::has('searchTo') || Input::has('searchFrom')){
            $rides = Ride::where(function($query)
            {
                // Try to add to
                if (Input::has('searchTo')) {
                    $query->where('destination', 'LIKE', '%' . Input::get('searchTo') . '%');
                }
                // Try to add from
                if (Input::has('searchFrom')) {
                    $query->where('origin', 'LIKE', '%' . Input::get('searchFrom') . '%');
                }
                // If advanced is checked
                if (Input::has('advanced')) {
                    // Try to add price
                    if (Input::has('price')) {
                        $query->where('price', 'LIKE', '%' . Input::get('price') . '%');
                    }
                    // Try to add date
                    if (Input::has('date')) {
                        $query->where('date', 'LIKE', '%' . Input::get('date') . '%');
                    }
                    // Try to add available seats
                    if (Input::has('seats')) {
                        $query->where('seats', 'LIKE', '%' . Input::get('seats') . '%');
                    }
                }
            })->where('date', '>', new DateTime('now'))->orderBy('date', 'asc')->get();
        } else {
            // Simple Search
            if (Input::has('search')){
                $rides = Ride::where(function($query){
                                        $query->where('destination', 'LIKE', '%' . Input::get('search') . '%')
                                              ->orwhere('origin', 'LIKE', '%' . Input::get('search') . '%');
                                    })->where('date', '>', new DateTime('now'))->orderBy('date', 'asc')->get();
            }
            // Empty Simple Search Form
            else {
                $rides = Ride::where('date', '>', new DateTime('now'))->orderBy('date', 'asc')->get();
            }
        }
        return $rides;
    }

    public function index() {
        return View::make('rides.index')->with('rides', $this->getRides());
    }

    public function create() {

    }

    public function store() {
        // validate
        // read more on validation at http://laravel.com/docs/validation
        $rules = array(
            'destination' => 'required',
            'origin'      => 'required',
            'date'        => 'required|date',
            'price'       => 'required|numeric',
            'seats'       => 'required|integer'
        );
        $validator = Validator::make(Input::all(), $rules);

        // process the login
        if ($validator->fails()) {
            Session::flash('message', 'Failed ride creation!');
            return Redirect::to('rides')
                ->withErrors($validator)
                ->withInput();
        } else {
            // store
            $ride = new Ride;
            $ride->user_id = Input::get('user_id');
            $ride->destination = Input::get('destination');
            $ride->origin = Input::get('origin');
            $ride->date = Input::get('date');
            $ride->seat_price = Input::get('price');
            $ride->seats = Input::get('seats');
            $ride->save();

            // redirect
            Session::flash('message', 'Successfully created ride!');
            return Redirect::to('rides');
        }
    }

    public function show($id) {
        $ride = Ride::find($id);

        if ($ride == null){
            return Redirect::to('rides');
        }

        $driver = User::find($ride->user_id);
        $passengers = $ride->passengers;
        $comments = $ride->comments;
        $requests = $ride->requests;

        return View::make('rides.show', array(
            'ride' => $ride,
            'driver' => $driver,
            'passengers' => $passengers,
            'comments' => $comments,
            'requests' => $requests));
    }

    public function edit($id) {

    }

    public function update($id) {

    }

    public function destroy($id) {
    }

    public function deleteRide(){
        $ride = Ride::find(Input::get('rideId'))->delete();
        return Redirect::route('users.show', Input::get('userId'));
    }

    public function addRequest() {
        $ride = Ride::find(Input::get('rideId'));
        $rideRequest = RideRequest::create(array('ride_id' => Input::get('rideId'), 'user_id' => Input::get('userId')));

        $ride->requests()->save($rideRequest);
        $ride->save();

        return Redirect::route('rides.show', $ride->id);
    }

    public function confirmRequest() {
        $user = User::find(Input::get('requesterId'));
        Ride::find(Input::get('rideId'))->passengers()->save($user);
        RideRequest::destroy(Input::get('requestId'));

        return Redirect::route('rides.show', Input::get('rideId'));
    }

    public function addComment() {
        $ride = Ride::find(Input::get('rideId'));
        $rideComment = RideComment::create(array(
            'ride_id' => Input::get('rideId'),
            'user_id' => Input::get('userId'),
            'message_body' => Input::get('messageBody')));

        $ride->comments()->save($rideComment);

        return Redirect::route('rides.show', $ride->id);
    }
}


text:
define(['dojo/_base/declare',
    'dojo/_base/lang',
    'dojo/_base/html',
    'dojo/keys',
    'dojo/on',
    'jimu/dijit/Popup'
  ],
  function(declare, lang, html, keys, on, Popup) {
    var count = 0;
    return declare(Popup, {
      //summary:
      //  show a popup message

      baseClass: 'jimu-popup jimu-message',
      declaredClass: 'jimu.dijit.Message',

      //type: String
      //  the popup messge type, can be: message/question/error
      type: 'message',

      //type:String
      message: '',

      autoHeight: true,

      maxWidth: 350,
      maxHeight: 180,

      postMixInProperties: function() {
        this.content = this.message;
      },

      _createTitleNode: function(){
        if (this.titleLabel) {
          this.titleNode = html.create('div', {
            'class': 'title'
          }, this.domNode);
          this.titleLabeNode = html.create('span', {
            'class': 'title-label jimu-float-leading',
            innerHTML: this.titleLabel || '&nbsp'
          }, this.titleNode);
          this.closeBtnNode = html.create('div', {
            'class': 'close-btn jimu-float-trailing'
          }, this.titleNode);
          this.own(on(this.closeBtnNode, 'click', lang.hitch(this, this.close)));
        }
      },

      _preProcessing: function() {
        if (this.buttons.length === 0) {
          this.buttons.push({
            label: 'OK',
            key: keys.ENTER,
            onClick: lang.hitch(this, this.close)
          });
        }
      },

      _increaseZIndex: function() {
        var baseIndex = 500;
        html.setStyle(this.domNode, 'zIndex', count + baseIndex + 1);
        html.setStyle(this.overlayNode, 'zIndex', count + baseIndex);
      }
    });
  });


text:
.cms-subsites {
	display: none ! important;
}


text:
typedef void (* addHorizontalSliderFun) (void* ui_interface, const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step);
typedef void (* addVerticalSliderFun) (void* ui_interface, const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step);
typedef void (* addCheckButtonFun) (void* ui_interface, const char* label, FAUSTFLOAT* zone);

typedef struct {
    void* uiInterface;
    addHorizontalSliderFun addHorizontalSlider;
    addVerticalSliderFun addVerticalSlider;
    addCheckButtonFun addCheckButton;
} UIGlue;


text:
/**
@name Api.js
@description A RESTful APIs library, with cache layer and multiple calls threading.
@author Roberto Lonardi <lonardi.r@gmail.com>
@tags API REST Promise Promises
@version 1.0.0
*/

/** Helpers object */
var Help = {

    /** Return a fake Promise always resolving immediately */
    fakePromise: function(success, callback){

        /** Generate a fake xhr Promise */
        var xhr = new Promise(function(resolve, reject){

                /** If a callback is passed call it */
                if(callback){ callback(); }

                if(success === true){ resolve(); } else if(success === false){ reject(); }

            });

        /** Return it */
        return xhr;

    },

    /** Populate a string that contains placeholders */
    populateString: function(string, data){

        if (!data) {
            console.error('No data passed, can\'t populate string.');
            return string;
        }

        /** Search each placeholder and replace it with the corresponding value */
        for(key in data){
            var placeholder = '{{' + key + '}}';
            var matcher     = new RegExp(placeholder, 'g');

            /** Search for it in the string */
            if(matcher.test(string)){
                string = string.replace(placeholder, data[key]);
            }
        }

        return string;
    },

    /** Check for a "{{text}}" type placeholder in certain string, returns false or true */
    checkPlaceholder: function(string, text){

        /** Populate the RegExp object with the passed string */
        var filter = '{{' + string + '}}';
        var regexp = new RegExp(filter, 'g');

        /** Return the result of the match */
        return regexp.test(text);

    },

    /** Return a placeholder representation of a string */
    placeholder: function(string){
        var placeholder = '{{' + string + '}}';

        /** Returns the palceholder */
        return placeholder;

    },

    /** Returns the passed JSON in query string object */
    toQueryString: function(object){
        var query = $.param(object) ? '?' + $.param(object) : '';

        /** Return the query */
        return query;
    }

};

/** Dependency constructor */
function api(){

    /** IMPORTS
    Import dependencies.
    ========================================================== */
    var $   = require('jquery');
    var md5 = require('js-md5');

    /** PRIVATE METHODS
    Private methods are available only from within the dependency.
    ========================================================== */

    /** TO MD5
    Parse the passed string in md5 and return the result. */
    function generateKey(request){
        var string = request.url + JSON.stringify(request.params);

        /** Check if md5 extension is loaded */
        if(md5){
            return md5(string);
        } else {
            return string;
        };

    }

    /** LOAD CACHE
    Load call from cache if present, otherwise return false. */
    function loadCache(request){
        var key = generateKey(request);

        return Api.cache[key];
    };

    /** SAVE CACHE
    Save the call response in memory cache. */
    function saveCache(request, response){
        var key = generateKey(request);

        if(Api.config.dev){ console.info(Api.config.info.name + ': Saving call in cache with key "' + key + '"'); }

        /** Save data in cache */
        Api.cache[key] = response;
    };

    /** GENERATE AJAX OBJECT
    Starting from the request, parse it and returns the
    correct ajax object request. */
    function generateAjaxObject(request){

        /** Generate arguments with fixed values */
        var data = {};

        data['url']    = request.url;
        data['method'] = request.method;

        if(request.accept !== false)         data['accept']        = request.accept || Api.config.settings.accept;
        if(request.contentType !== false)    data['contentType']   = request.contentType || Api.config.settings.contentType;

        if(request.body){ data['data'] = Api.config.settings.bodyParser(request.body); };

        /** Parse headers */
        if(request.headers){
            data['headers'] = request.headers;
        };

        /** Parse settings */
        if(request.settings){
            $.extend(data, request.settings);
        };

        return data;
    };

    /** CALL
    Actual ajax call with passed parameters. */
    function call(request){

        /** Parse request to generate an ajax compatible object */
        var data = generateAjaxObject(request);

        /** Wehre the magic is done :) */
        var xhr = new Promise(function(resolve, reject){

            $.ajax(data).done(function(response, status, xhr){

                /** Resolve the promise */
                resolve(response, status, xhr);

            }).fail(function(response, status, xhr){

                /** Reject the promise */
                reject(response, status, xhr);

            });

        });

        return xhr;
    };

    /** PARSE REQUEST
    Parse the requests and return the call itself. */
    function parseRequest(request){

        /** If there are params left put them in query string */
        if(request.params){

            /** Add them to the url */
            request.url += Help.toQueryString(request.params);

            /** Delete the params */
            delete request.params;
        };

        /** If url has no http add api base url */
        if(request.url.indexOf('http') < 0){
            request.url = Api.config.paths.api + request.url;
        };

        /** retrive cache if present */
        var cache = loadCache(request);

        /** If there is already cache for the call, return directly the cached response */
        if(Api.config.settings.cache.enabled){
            var cache = new Promise(function(resolve){

                /** Resolve the promise with the cached response */
                resolve(cache);

            });

            /** Return the actual call */
            var response = call(request);

            /** Save the response in cache */
            response.then(function(data){
                saveCache(request, data);
            });

            return cache;

        } else {

            /** Return the actual call */
            var response = call(request);

            /** Save the response in cache */
            response.then(function(data){
                saveCache(request, data);
            });

            return response;
        };
    }

    /** CHECK REQUESTS INTEGRITY
    Check if requests are in a correct format and if not return a boolean false. */
    function checkRequestsIntegrity(requests){

        if(!requests){ return false; }

        /** If request is not an array wrap it in one */
        if(!(requests instanceof Array)){
            requests = [requests];
        }

        /** For each request check for essential parameters */
        for(index in requests){
            var request = requests[index];

            if(!request.url){

                console.error(Api.config.info.name + ': No url passed, request aborted.');

                return false;
            }
        }

        return requests;
    };

    /** CALLBACK WRAPPER
    Wraps the final promises from call method in a promise. */
    function callbackWrapper (promises, success, error) {

        if (!promises || !promises.length) {
            console.error(Api.config.info.name + ': No promises passed, aborted callback wrapping.');
            return Help.fakePromise(true);
        }

        /** Parse the Promises to launch the callbacks */
        var callback = new Promise(function(resolve, reject){
            Promise.all(promises).then(function(response, status, xhr){

                if(success){ success(response, status, xhr); }

                /** Resolve the promise */
                resolve(response, status, xhr);

            }).catch(function(response, status, xhr){

                if(error){ error(response, status, xhr); }

                /** Resolve the promise */
                reject(response, status, xhr);

            });
        });

        return callback;

    }

    /** EXTENSIONS
    Initialize extensions of this dependency.
    (extensions are reachable for children of this dependency) */
    function initializeExtensions(){

        /** Get extensions */
        var exts = Api.config.ext;

        /** Initialize promises */
        var promises = [];

        /** If the are no extensions return a fake Promise */
        if(exts.length === 0){

            /** Fake promise */
            return Help.fakePromise(true);

        }

        /** For each extension create a promise */
        for(index in exts){
            var ext = exts[index];

            /** Create the promise */
            var xhr = new Promise(function(resolve, reject){
                $.getScript(ext, function(extension){
                    resolve(extension);
                }).fail(function(){
                    reject();
                });
            });

            promises.push(xhr);
        }

        return Promise.all(promises);
    };

    /** Dependency prototype */
    var Api = {

        /** CONFIG
        Dependency configuration. */
        config  : {

            /** Base paths settings */
            paths: {
                base    : '',
                api     : ''
            },

            dev: true,

            /** Extensions */
            ext: [
                'ext/helpers.js',
                'ext/md5.js'
                 ],

            /** Dependency general infos */
            info: {
                name: 'Api'
            },

            /** Methods */
            methods: {

                get     : 'GET',
                post    : 'POST',
                put     : 'PUT',
                delete  : 'DELETE'

            },

            /** Default configuration */
            settings: {

                /** Default Accept and contentType for AJAX calls */
                contentType : 'application/json',
                accept      : 'json',

                /** The function used by default for parsing the body */
                bodyParser: JSON.stringify,

                /** Caching settings */
                cache: {
                    enabled: true
                }

            }
        },

        /** CACHE
        Call cache for faster response. */
        cache   : {},

        /** BUILD
        Object constructors. */
        build   : {

            /** Request object constructor */
            Request: function(url, params, body){

                if(!url){
                    console.error(Api.config.info.name + ': At least url must be passed to create Request object.');
                    return false;
                }

                /** If url has no http add api base url */
                if(url.indexOf('http') < 0){
                    url = Api.config.paths.api + url;
                };

                /** Set params */
                if(params)  {

                    /** Populate the string where possible */
                    url = Help.populateString(url, params);

                    /** Assign remaining params */
                    this['params'] = params;

                };

                /** Set url, after path parameters have been added */
                this['url'] = url;

                /** Set body */
                if(body) this['body'] = body;

            }

        },

        /** PUBLIC METHODS
        Public methods can be called from outside the dependency.
        ===================================================== */

        /** INIT
        Dependency initialization. */
        init: function(config, callback){

            /** Extend configuration with the passed one */
            $.extend(true, Api.config, config);

            /** Initialize extensions */
            initializeExtensions().then(function(){

                /** If init callback is present call it at the init very end */
                if(callback) callback();

            });

        },

        /** GET
        Get calls method. */
        get: function(requests, success, error){

            /** Check integrity */
            requests = checkRequestsIntegrity(requests);

            if(!requests){

                console.error(Api.config.info.name + ': No valid requests passes on GET method, aborted.');

                return false;
            }

            /** Initialize promises */
            var promises = [];

            /** Parse each request */
            for(index in requests){
                var request = requests[index];

                /** If the method is already present and different from "GET", the call is skipped */
                if(request.method && request.method !== Api.config.methods.get){

                    console.error(Api.config.info.name + ': Passed method different from GET, request skipped.', request);

                    continue;
                }

                /** Set the request method */
                request['method'] = Api.config.methods.get;

                /** Parse the requests then make the actual call */
                var xhr = parseRequest(request);

                /** Push xhr call in promises array */
                promises.push(xhr);
            }

            /** Return the call promise wrapped in another promise */
            return callbackWrapper(promises, success, error);

        },

        /** POST
        Post calls method. */
        post: function(requests, success, error){

            /** Check integrity */
            requests = checkRequestsIntegrity(requests);

            if(!requests){

                console.error(Api.config.info.name + ': No valid requests passes on POST method, aborted.');

                return false;
            }

            /** Initialize promises */
            var promises = [];

            /** Parse each request */
            for(index in requests){
                var request = requests[index];

                /** If the method is already present and different from "POST", the call is skipped */
                if(request.method && request.method !== Api.config.methods.post){

                    console.error(Api.config.info.name + ': Passed method different from POST, request skipped.', request);

                    continue;
                }

                /** Set the request method */
                request['method'] = Api.config.methods.post;

                /** Parse the requests then make the actual call */
                var xhr = parseRequest(request);

                /** Push xhr call in promises array */
                promises.push(xhr);

            }

            /** Return the call promise wrapped in another promise */
            return callbackWrapper(promises, success, error);

        },

        /** PUT
        Put calls method. */
        put: function(requests, success, error){

            /** Check integrity */
            requests = checkRequestsIntegrity(requests);

            if(!requests){

                console.error(Api.config.info.name + ': No valid requests passes on PUT method, aborted.');

                return false;
            }

            /** Initialize promises */
            var promises = [];

            /** Parse each request */
            for(index in requests){
                var request = requests[index];

                /** If the method is already present and different from "PUT", the call is skipped */
                if(request.method && request.method !== Api.config.methods.put){

                    console.error(Api.config.info.name + ': Passed method different from PUT, request skipped.', request);

                    continue;
                }

                /** Set the request method */
                request['method'] = Api.config.methods.put;

                /** Parse the requests then make the actual call */
                var xhr = parseRequest(request);

                /** Push xhr call in promises array */
                promises.push(xhr);

            }

            /** Return the call promise wrapped in another promise */
            return callbackWrapper(promises, success, error);

        },

        /** DELETE
        Delete calls method. */
        delete: function(requests, success, error){

            /** Check integrity */
            requests = checkRequestsIntegrity(requests);

            if(!requests){

                console.error(Api.config.info.name + ': No valid requests passes on DELETE method, aborted.');

                return false;
            }

            /** Initialize promises */
            var promises = [];

            /** Parse each request */
            for(index in requests){
                var request = requests[index];

                /** Ifa  method is already present and different from "DELETE", the call is skipped */
                if(request.method && request.method !== Api.config.methods.delete){

                    console.error(Api.config.info.name + ': Passed method different from DELETE, request skipped.', request);

                    continue;
                }

                /** Set the request method */
                request['method'] = Api.config.methods.delete;

                /** Parse the requests then make the actual call */
                var xhr = parseRequest(request);

                /** Push xhr call in promises array */
                promises.push(xhr);

            }

            /** Return the call promise wrapped in another promise */
            return callbackWrapper(promises, success, error);

        },

        /** CALL
        Calls with different methods. */
        call: function(requests, success, error){

            /** Check integrity */
            requests = checkRequestsIntegrity(requests);

            if(!requests){

                console.error(Api.config.info.name + ': No valid requests passes on CALL method, aborted.');

                return false;
            }

            /** Initialize promises */
            var promises = [];

            /** Parse each request */
            for(index in requests){
                var request = requests[index];

                /** If the method is not present, request is skipped */
                if(!request.method){

                    console.error(Api.config.info.name + ': No method found, request skipped.', request);

                    continue;
                }

                /** Parse the requests then make the actual call */
                var xhr = parseRequest(request);

                /** Push xhr call in promises array */
                promises.push(xhr);

            }

            /** Return the call promise wrapped in another promise */
            return callbackWrapper(promises, success, error);
        }

    };

    /** Return dependency prototype. */
    return Api;
}

/** NPM export */
module.exports = new api();


text:
using System.Runtime.InteropServices;
using System.IO;
using System.Drawing.Internal;
using Gdip = System.Drawing.SafeNativeMethods.Gdip;
using System.Runtime.Serialization;

namespace System.Drawing.Imaging
{
    /// <summary>
    /// Defines a graphic metafile. A metafile contains records that describe a sequence of graphics operations that
    /// can be recorded and played back.
    /// </summary>
    public sealed partial class Metafile : Image
    {
        /// <summary>
        /// Initializes a new instance of the <see cref='Metafile'/> class from the specified handle and
        /// <see cref='WmfPlaceableFileHeader'/>.
        /// </summary>
        public Metafile(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader) :
            this(hmetafile, wmfHeader, false)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref='Metafile'/> class from the specified stream.
        /// </summary>
        public Metafile(Stream stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            Gdip.CheckStatus(Gdip.GdipCreateMetafileFromStream(new GPStream(stream), out IntPtr metafile));
            SetNativeImage(metafile);
        }

        /// <summary>
        /// Initializes a new instance of the <see cref='Metafile'/> class from the specified handle to a device context.
        /// </summary>
        public Metafile(IntPtr referenceHdc, EmfType emfType, string description)
        {
            Gdip.CheckStatus(Gdip.GdipRecordMetafile(
                referenceHdc,
                emfType,
                IntPtr.Zero,
                MetafileFrameUnit.GdiCompatible,
                description,
                out IntPtr metafile));

            SetNativeImage(metafile);
        }

        /// <summary>
        /// Initializes a new instance of the <see cref='Metafile'/> class from the specified device context, bounded
        /// by the specified rectangle.
        /// </summary>
        public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string desc)
        {
            IntPtr metafile = IntPtr.Zero;

            if (frameRect.IsEmpty)
            {
                Gdip.CheckStatus(Gdip.GdipRecordMetafile(
                    referenceHdc,
                    type,
                    IntPtr.Zero,
                    MetafileFrameUnit.GdiCompatible,
                    desc,
                    out metafile));
            }
            else
            {
                Gdip.CheckStatus(Gdip.GdipRecordMetafileI(
                    referenceHdc,
                    type,
                    ref frameRect,
                    frameUnit,
                    desc,
                    out metafile));
            }

            SetNativeImage(metafile);
        }

        /// <summary>
        /// Initializes a new instance of the <see cref='Metafile'/> class with the specified filename.
        /// </summary>
        public Metafile(string fileName, IntPtr referenceHdc, EmfType type, string description)
        {
            // Called in order to emulate exception behavior from netfx related to invalid file paths.
            Path.GetFullPath(fileName);

            Gdip.CheckStatus(Gdip.GdipRecordMetafileFileName(
                fileName,
                referenceHdc,
                type,
                IntPtr.Zero,
                MetafileFrameUnit.GdiCompatible,
                description,
                out IntPtr metafile));

            SetNativeImage(metafile);
        }

        /// <summary>
        /// Initializes a new instance of the <see cref='Metafile'/> class with the specified filename.
        /// </summary>
        public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string description)
        {
            // Called in order to emulate exception behavior from netfx related to invalid file paths.
            Path.GetFullPath(fileName);

            IntPtr metafile = IntPtr.Zero;

            if (frameRect.IsEmpty)
            {
                Gdip.CheckStatus(Gdip.GdipRecordMetafileFileName(
                    fileName,
                    referenceHdc,
                    type,
                    IntPtr.Zero,
                    frameUnit,
                    description,
                    out metafile));
            }
            else
            {
                Gdip.CheckStatus(Gdip.GdipRecordMetafileFileNameI(
                    fileName,
                    referenceHdc,
                    type,
                    ref frameRect,
                    frameUnit,
                    description,
                    out metafile));
            }

            SetNativeImage(metafile);
        }

        /// <summary>
        /// Initializes a new instance of the <see cref='Metafile'/> class from the specified data stream.
        /// </summary>
        public Metafile(Stream stream, IntPtr referenceHdc, EmfType type, string description)
        {
            Gdip.CheckStatus(Gdip.GdipRecordMetafileStream(
                new GPStream(stream),
                referenceHdc,
                type,
                IntPtr.Zero,
                MetafileFrameUnit.GdiCompatible,
                description,
                out IntPtr metafile));

            SetNativeImage(metafile);
        }

        /// <summary>
        /// Initializes a new instance of the <see cref='Metafile'/> class with the specified filename.
        /// </summary>
        public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, string description)
        {
            Gdip.CheckStatus(Gdip.GdipRecordMetafileStream(
                new GPStream(stream),
                referenceHdc,
                type,
                ref frameRect,
                frameUnit,
                description,
                out IntPtr metafile));

            SetNativeImage(metafile);
        }

        /// <summary>
        /// Initializes a new instance of the <see cref='Metafile'/> class with the specified filename.
        /// </summary>
        public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string description)
        {
            IntPtr metafile = IntPtr.Zero;

            if (frameRect.IsEmpty)
            {
                Gdip.CheckStatus(Gdip.GdipRecordMetafileStream(
                    new GPStream(stream),
                    referenceHdc,
                    type,
                    IntPtr.Zero,
                    frameUnit,
                    description,
                    out metafile));
            }
            else
            {
                Gdip.CheckStatus(Gdip.GdipRecordMetafileStreamI(
                    new GPStream(stream),
                    referenceHdc,
                    type,
                    ref frameRect,
                    frameUnit,
                    description,
                    out metafile));
            }

            SetNativeImage(metafile);
        }

        /// <summary>
        /// Returns the <see cref='MetafileHeader'/> associated with the specified <see cref='Metafile'/>.
        /// </summary>
        public static MetafileHeader GetMetafileHeader(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader)
        {
            MetafileHeader header = new MetafileHeader
            {
                wmf = new MetafileHeaderWmf()
            };

            Gdip.CheckStatus(Gdip.GdipGetMetafileHeaderFromWmf(hmetafile, wmfHeader, header.wmf));
            return header;
        }

        /// <summary>
        /// Returns the <see cref='MetafileHeader'/> associated with the specified <see cref='Metafile'/>.
        /// </summary>
        public static MetafileHeader GetMetafileHeader(IntPtr henhmetafile)
        {
            MetafileHeader header = new MetafileHeader
            {
                emf = new MetafileHeaderEmf()
            };

            Gdip.CheckStatus(Gdip.GdipGetMetafileHeaderFromEmf(henhmetafile, header.emf));
            return header;
        }

        /// <summary>
        /// Returns the <see cref='MetafileHeader'/> associated with the specified <see cref='Metafile'/>.
        /// </summary>
        public static MetafileHeader GetMetafileHeader(string fileName)
        {
            // Called in order to emulate exception behavior from netfx related to invalid file paths.
            Path.GetFullPath(fileName);

            MetafileHeader header = new MetafileHeader();

            IntPtr memory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeaderEmf)));

            try
            {
                Gdip.CheckStatus(Gdip.GdipGetMetafileHeaderFromFile(fileName, memory));

                int[] type = new int[] { 0 };

                Marshal.Copy(memory, type, 0, 1);

                MetafileType metafileType = (MetafileType)type[0];

                if (metafileType == MetafileType.Wmf ||
                    metafileType == MetafileType.WmfPlaceable)
                {
                    // WMF header
                    header.wmf = (MetafileHeaderWmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderWmf));
                    header.emf = null;
                }
                else
                {
                    // EMF header
                    header.wmf = null;
                    header.emf = (MetafileHeaderEmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderEmf));
                }
            }
            finally
            {
                Marshal.FreeHGlobal(memory);
            }

            return header;
        }

        /// <summary>
        /// Returns the <see cref='MetafileHeader'/> associated with the specified <see cref='Metafile'/>.
        /// </summary>
        public static MetafileHeader GetMetafileHeader(Stream stream)
        {
            MetafileHeader header;

            IntPtr memory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeaderEmf)));

            try
            {
                Gdip.CheckStatus(Gdip.GdipGetMetafileHeaderFromStream(new GPStream(stream), memory));

                int[] type = new int[] { 0 };

                Marshal.Copy(memory, type, 0, 1);

                MetafileType metafileType = (MetafileType)type[0];

                header = new MetafileHeader();

                if (metafileType == MetafileType.Wmf ||
                    metafileType == MetafileType.WmfPlaceable)
                {
                    // WMF header
                    header.wmf = (MetafileHeaderWmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderWmf));
                    header.emf = null;
                }
                else
                {
                    // EMF header
                    header.wmf = null;
                    header.emf = (MetafileHeaderEmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderEmf));
                }
            }
            finally
            {
                Marshal.FreeHGlobal(memory);
            }

            return header;
        }

        /// <summary>
        /// Returns the <see cref='MetafileHeader'/> associated with this <see cref='Metafile'/>.
        /// </summary>
        public MetafileHeader GetMetafileHeader()
        {
            MetafileHeader header;

            IntPtr memory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeaderEmf)));

            try
            {
                Gdip.CheckStatus(Gdip.GdipGetMetafileHeaderFromMetafile(new HandleRef(this, nativeImage), memory));

                int[] type = new int[] { 0 };

                Marshal.Copy(memory, type, 0, 1);

                MetafileType metafileType = (MetafileType)type[0];

                header = new MetafileHeader();

                if (metafileType == MetafileType.Wmf ||
                    metafileType == MetafileType.WmfPlaceable)
                {
                    // WMF header
                    header.wmf = (MetafileHeaderWmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderWmf));
                    header.emf = null;
                }
                else
                {
                    // EMF header
                    header.wmf = null;
                    header.emf = (MetafileHeaderEmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderEmf));
                }
            }
            finally
            {
                Marshal.FreeHGlobal(memory);
            }

            return header;
        }

        /// <summary>
        /// Returns a Windows handle to an enhanced <see cref='Metafile'/>.
        /// </summary>
        public IntPtr GetHenhmetafile()
        {
            Gdip.CheckStatus(Gdip.GdipGetHemfFromMetafile(new HandleRef(this, nativeImage), out IntPtr hEmf));
            return hEmf;
        }
    }
}


text:
using namespace std;

bool PassType_ShadowMap_OpGL::Process( GLSLProgram * glsl_program, list< RenderEntity *> entities, RenderLight * light, RenderCamera * camera, RenderContext * context ){
    bool bRet = true;
    if( !glsl_program ){
	assert( 0 && "GLSLProgram invalid in GLRenderPassShadowMap::Process()");
	return false;
    }
    if( !light ||
    	!camera ||
    	!context ){
    	return false;
    }

    //retrieve render context data
    RenderContextData::WindowSize::Type data_windowsize;
    RenderContextData::TextureSizeShadowMap::Type data_texturesize_shadowmap;
    RenderContextData::Title::Type data_title;
    if( !context->Compute( data_windowsize, data_texturesize_shadowmap, data_title ) ){
	assert( 0 && "RenderContext Compute() failed." );
	return false;
    }
    //first pass render for light POV starts
    //bind shadow map texture prior to rendering with light's POV
    GLTexture * ShadowTexture;
    if( glsl_program->GetMapTexture("ShadowTexture", ShadowTexture ) ) {
	ShadowTexture->BindFbo();
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
	int iActiveTexture;
	ShadowTexture->GetActiveTexture( iActiveTexture );
	bRet = glsl_program->SetUniform( "ShadowMap", iActiveTexture );
    } else {
	assert( 0 && "Can't find ShadowTexture." );
	return false;
    }

    //set render window with rendering context data: view port size
    int width = data_texturesize_shadowmap[0];
    int height = data_texturesize_shadowmap[1];
    glViewport( 0, 0, width, height );

    bRet = glsl_program->SetUniform( "bShadeShadow", false );
    glCullFace(GL_BACK);

    bRet = ProcessPassCommon( PassType::DEPTH, glsl_program, entities, light, camera, context );
    if( !bRet ){
	assert( 0 && "GLRenderPassShadowMap::ProcessPassCommon() for Depth Render failed");
    }
    //first pass ends

    //2nd pass render starts
    //unbind shadow map texture prior to rendering from light's POV
    // GLTexture * ShadowTexture;
    if( glsl_program->GetMapTexture("ShadowTexture", ShadowTexture ) ) {
	ShadowTexture->UnbindFbo();
    } else {
	assert( 0 && "Can't find ShadowTexture." );
	return false;
    }
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

    //set render window with rendering context data: view port size
    width = data_windowsize[0];
    height = data_windowsize[1];
    glViewport( 0, 0, width, height );

    bRet = glsl_program->SetUniform( "bShadeShadow", true );
    glCullFace(GL_BACK);
    bRet = ProcessPassCommon( PassType::NORMAL, glsl_program, entities, light, camera, context );
    if( !bRet ){
	assert( 0 && "GLRenderPassShadowMap::ProcessPassCommon() for Normal Render failed");
    }
    //2nd pass render ends

    return true;
}

bool PassType_ShadowMap_OpGL::ProcessPassCommon( PassType pass_type, GLSLProgram * glsl_program, list< RenderEntity * > entities, RenderLight * light, RenderCamera * camera, RenderContext * context ){
    bool bRet = true;

    if( !glsl_program ){
	assert( 0 && "GLSLProgram invalid in GLRenderPassShadowMap::ProcessPassDepth()");
	return false;
    }

    /// light --------------------------------------------------------------
    //retrieve the above attributes
    RenderLightData::Ambient::Type light_data_ambient;
    RenderLightData::Diffuse::Type light_data_diffuse;
    RenderLightData::Specular::Type light_data_specular;
    RenderLightData::Coordinate::Type light_data_coordinate;
    Mat light_perspective_frust_matrix;
    Mat light_view_matrix;
    if( !light->Compute( light_data_ambient, light_data_diffuse, light_data_specular, light_data_coordinate,
			 light_perspective_frust_matrix,
			 light_view_matrix ) ){
	assert( 0 && "RenderLight Compute() failed." );
	return false;
    }
    //retrieve light data
    Vec Light_Position;
    Light_Position.SetFromArray( 4, &light_data_coordinate[0] ); //4x1
    Vec Light_Ambient;
    Light_Ambient.SetFromArray( 3, &light_data_ambient[0] ); //3x1
    Vec Light_Diffuse;
    Light_Diffuse.SetFromArray( 3, &light_data_diffuse[0] ); //3x1
    Vec Light_Specular;
    Light_Specular.SetFromArray( 3, &light_data_specular[0] ); //3x1
    //set light data
    bRet = glsl_program->SetUniformVec4( "Light.Position", Light_Position );
    bRet = glsl_program->SetUniformVec3( "Light.La", Light_Ambient );
    bRet = glsl_program->SetUniformVec3( "Light.Ld", Light_Diffuse );
    bRet = glsl_program->SetUniformVec3( "Light.Ls", Light_Specular );

    /// camera -------------------------------------------------------------
    RenderCameraData::Ambient::Type camera_data_ambient;
    RenderCameraData::Diffuse::Type camera_data_diffuse;
    RenderCameraData::Specular::Type camera_data_specular;
    RenderCameraData::Coordinate::Type camera_data_coordinate;
    Mat camera_perspective_frust_matrix;
    Mat camera_view_matrix;
    if( !camera->Compute( camera_data_ambient, camera_data_diffuse,
			  camera_data_specular, camera_data_coordinate,
			  camera_perspective_frust_matrix,
			  camera_view_matrix ) ){
	assert( 0 && "RenderCamera Compute() failed." );
	return false;
    }

    /// per entity ---------------------------------------------------------
    for( auto * entity : entities ){
	if( !entity ){
	    assert( 0 && "entity data invalid." );
	    return false;
	}
	GLAttribData<float> * attrib_PositionData;
	GLAttribData<float> * attrib_NormalData;
	if( !glsl_program->GetMapAttrib( "VertexPosition", attrib_PositionData ) ){
	    assert( 0 && "VertexPosition attribute not found in PassType_ShadowMap_OpGL::ProcessNow" );
	    return false;
	}
	if( !glsl_program->GetMapAttrib( "VertexNormal", attrib_NormalData ) ){
	    assert( 0 && "VertexNormal attribute not found in PassType_ShadowMap_OpGL::ProcessNow" );
	    return false;
	}

	/// retrieve polygon vertex and normal data --------------------------
	RenderVertexData::Vertices::Type vertices;
	RenderVertexData::Normals::Type normals;
	if( !entity->Compute( RenderVertexData(), vertices, normals ) ){
	    assert( 0 && "RenderVertex Compute() failed." );
	    return false;
	}

	int iSizeVertexData = vertices.size();
	float * vertex_coord = new float[ iSizeVertexData ];
	float * vertex_normal = new float[ iSizeVertexData ];
	float * vertex_coord_iter = vertex_coord;
	float * vertex_normal_iter = vertex_normal;
	auto it_vertices = vertices.begin();
	auto it_normals = normals.begin();
	for( int i = 0; i < iSizeVertexData; ++i ){
	    *vertex_coord_iter = (float)*it_vertices;
	    *vertex_normal_iter = (float)*it_normals;
	    ++vertex_coord_iter;
	    ++vertex_normal_iter;
	    ++it_vertices;
	    ++it_normals;
	}
	//generate VBO, populate and bind data to vertex attribute arrays
	attrib_PositionData->SetData( vertex_coord, 3, iSizeVertexData );
	attrib_NormalData->SetData( vertex_normal, 3, iSizeVertexData );

	delete [] vertex_coord;
	delete [] vertex_normal;

	glsl_program->BindVertexArray();

	/// retrive entity orientation data ----------------------------------
	RenderPolyData::Coordinate::Type entity_coordinate;
	RenderPolyData::RotationAxis::Type entity_rotation_axis;
	RenderPolyData::RotationAngle::Type entity_rotation_angle;
	Mat entity_orientation_matrix;
	if( !entity->Compute( RenderPolyData(), entity_coordinate, entity_rotation_axis, entity_rotation_angle, entity_orientation_matrix ) ){
	    assert( 0 && "RenderPoly Compute() failed." );
	    return false;
	}

	//retrieve matrices needed for rendering, TODO
	float bias[16] = { 0.5, 0.0, 0.0, 0.0,
			   0.0, 0.5, 0.0, 0.0,
			   0.0, 0.0, 0.5, 0.0,
			   0.5, 0.5, 0.5, 1.0 };
	Mat Bias;
	size_t col = 4, row = 4;
	Bias.SetFromArray( bias, col, row );

	Mat view_matrix_light_or_camera;
	Mat perspective_matrix_light_or_camera;
	//use light or camera view depending on pass_type
	//use light or camera perspective depending on pass_type
	switch( pass_type ){
	case PassType::DEPTH:
	{
	    view_matrix_light_or_camera = light_view_matrix;
	    perspective_matrix_light_or_camera = light_perspective_frust_matrix;
	}
	    break;
	case PassType::NORMAL:
	{
	    view_matrix_light_or_camera = camera_view_matrix;
	    perspective_matrix_light_or_camera = camera_perspective_frust_matrix;
	}
	    break;
	default:
	    assert( 0 && "PassType invalid." );
	    return false;
	}

	Mat attrib_model_view_matrix = view_matrix_light_or_camera * entity_orientation_matrix;
	Mat attrib_model_view_perspective_matrix = perspective_matrix_light_or_camera * view_matrix_light_or_camera * entity_orientation_matrix; //4x4
	// MVPB matrix's view and perspective matrices are from light's POV
	Mat attrib_model_view_perspective_bias_matrix = Bias * light_perspective_frust_matrix * light_view_matrix * entity_orientation_matrix; //4x4

        // attrib_normal_matrix <- inverse( transpose( mat3( attrib_model_view_matrix ) ) )//3x3
	Mat attrib_model_view_matrix_3x3;
	assert( attrib_model_view_matrix.GetSubMat( attrib_model_view_matrix_3x3, 0, 0, 3, 3 ) && "obtaining submatrix failed." );
	Mat attrib_model_view_matrix_3x3_transpose = attrib_model_view_matrix_3x3.Transpose();
	size_t actual_num;
	float attrib_model_view_matrix_3x3_transpose_raw[9];
	assert( attrib_model_view_matrix_3x3_transpose.GetArray( attrib_model_view_matrix_3x3_transpose_raw, 9, actual_num ) && "get array failed." );
	float attrib_model_view_matrix_3x3_transpose_inverse_raw[9];
	assert( MatrixMath::InvertMatrix3x3( attrib_model_view_matrix_3x3_transpose_raw, attrib_model_view_matrix_3x3_transpose_inverse_raw ) && "inversing matrix failed." );
	Mat attrib_normal_matrix; //3x3
	attrib_normal_matrix.SetFromArray( attrib_model_view_matrix_3x3_transpose_inverse_raw, 3, 3 );

	Mat attrib_light_view_matrix = light_view_matrix; //4x4

	/// retrieve material data ------------------------------------------
	RenderMaterialData::Ambient::Type data_ambient;
	RenderMaterialData::Diffuse::Type data_diffuse;
	RenderMaterialData::Specular::Type data_specular;
	RenderMaterialData::Shininess::Type data_shininess;
	if( !entity->Compute( RenderMaterialData(), data_ambient, data_diffuse, data_specular, data_shininess ) ){
	    assert( 0 && "RenderVertex Compute() failed." );
	    return false;
	}
	Vec Material_Ambient;
	Material_Ambient.SetFromArray( 3, &data_ambient[0] ); //3x1
	Vec Material_Diffuse;
	Material_Diffuse.SetFromArray( 3, &data_diffuse[0] ); //3x1
	Vec Material_Specular;
	Material_Specular.SetFromArray( 3, &data_specular[0] ); //3x1
	float Material_Shininess = data_shininess[0];
	//set material data
	bRet = glsl_program->SetUniformVec3( "Material.Ka", Material_Ambient );
	bRet = glsl_program->SetUniformVec3( "Material.Kd", Material_Diffuse );
	bRet = glsl_program->SetUniformVec3( "Material.Ks", Material_Specular );
	bRet = glsl_program->SetUniform( "Material.Shininess", Material_Shininess );

	bRet = glsl_program->SetUniformMat4( "ShadowMatrix", attrib_model_view_perspective_bias_matrix );
	bRet = glsl_program->SetUniformMat4( "MVP", attrib_model_view_perspective_matrix );
	bRet = glsl_program->SetUniformMat4( "ModelViewMatrix", attrib_model_view_matrix );
	bRet = glsl_program->SetUniformMat3( "NormalMatrix", attrib_normal_matrix );
	bRet = glsl_program->SetUniformMat4( "LightViewMatrix", attrib_light_view_matrix );

	//render everything in the buffer for now
	GLBufferInfo render_buffer_info;
	render_buffer_info._Name = "Default_Render_Buffer";
	render_buffer_info._Offset = 0;
	render_buffer_info._Length = iSizeVertexData;
	glsl_program->SetBufferInfo( &render_buffer_info );
	glsl_program->SetCurrentBufferInfo( "Default_Render_Buffer" );
	glsl_program->DrawCurrentBufferSegment();

	glsl_program->UnBindVertexArray();
    }
    return bRet;
}


text:
package swift.pubsub;

import swift.crdt.core.CRDTIdentifier;
import sys.pubsub.PubSub.Subscriber;
import sys.pubsub.PubSubNotification;

public interface SwiftSubscriber extends Subscriber<CRDTIdentifier> {
    void onNotification(UpdateNotification evt);

    void onNotification(BatchUpdatesNotification evt);

    void onNotification(PubSubNotification<CRDTIdentifier> evt);
}


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

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
TypeIdResolver (jackson-databind 2.1.0 API)
</TITLE>

<META NAME="date" CONTENT="2012-10-09">

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

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

com.fasterxml.jackson.databind.jsontype

Interface TypeIdResolver

All Known Implementing Classes:
ClassNameIdResolver, MinimalClassNameIdResolver, TypeIdResolverBase, TypeNameIdResolver

public interface TypeIdResolver

Interface that defines standard API for converting types
 to type identifiers and vice versa. Used by type resolvers
 (TypeSerializer,
 TypeDeserializer) for converting
 between type and matching id; id is stored in JSON and needed for
 creating instances of proper subtypes when deserializing values.

Method Summary

 JsonTypeInfo.Id
getMechanism()

          Accessor for mechanism that this resolver uses for determining
 type id from type.

 String
idFromBaseType()

          Method that can be called to figure out type id to use for instances
 of base type (declared type of property).

 String
idFromValue(Object value)

          Method called to serialize type of the type of given value
 as a String to include in serialized JSON content.

 String
idFromValueAndType(Object value,
                   Class<?> suggestedType)

          Alternative method used for determining type from combination of
 value and type, using suggested type (that serializer provides)
 and possibly value of that type.

 void
init(JavaType baseType)

          Method that will be called once before any type resolution calls;
 used to initialize instance with configuration.

 JavaType
typeFromId(String id)

          Method called to resolve type from given type identifier.

Method Detail

init

void init(JavaType baseType)

Method that will be called once before any type resolution calls;
 used to initialize instance with configuration. This is necessary
 since instances may be created via reflection, without ability to
 call specific constructor to pass in configuration settings.

Parameters:
baseType - Base type for which this id resolver instance is
   used

idFromValue

String idFromValue(Object value)

Method called to serialize type of the type of given value
 as a String to include in serialized JSON content.

idFromValueAndType

String idFromValueAndType(Object value,
                          Class<?> suggestedType)

Alternative method used for determining type from combination of
 value and type, using suggested type (that serializer provides)
 and possibly value of that type. Most common implementation will
 use suggested type as is.

idFromBaseType

String idFromBaseType()

Method that can be called to figure out type id to use for instances
 of base type (declared type of property). This is usually only used
 for fallback handling, for cases where real type information is not
 available for some reason.

typeFromId

JavaType typeFromId(String id)

Method called to resolve type from given type identifier.

getMechanism

JsonTypeInfo.Id getMechanism()

Accessor for mechanism that this resolver uses for determining
 type id from type. Mostly informational; not required to be called
 or used.

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 FasterXML. All Rights Reserved.


text:
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

typedef void(^VCHActionBlock)(void);

@interface VCHButton : UIButton

@property (copy, nonatomic) VCHActionBlock actionBlock;

- (instancetype)initWithWindowWidth:(CGFloat)windowWidth;

@end


text:
package org.zmlx.hg4idea.branch;

import com.intellij.dvcs.branch.BranchType;
import com.intellij.dvcs.branch.DvcsBranchManager;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.zmlx.hg4idea.HgProjectSettings;
import org.zmlx.hg4idea.log.HgRefManager;

public final class HgBranchManager extends DvcsBranchManager {
  public HgBranchManager(@NotNull Project project) {
    super(project, HgProjectSettings.getInstance(project).getBranchSettings(), HgBranchType.values());
  }

  @Nullable
  @Override
  protected String getDefaultBranchName(@NotNull BranchType type) {
    return type == HgBranchType.BRANCH ? HgRefManager.DEFAULT : null;
  }
}


text:
echo "Creating symlinks..."
CURR_DIR=$(pwd)
cd ~
ln -s $CURR_DIR/vim/vimrc .vimrc
ln -s $CURR_DIR/tmux/tmux.conf .tmux.conf
ln -s $CURR_DIR/bash/bash.bashrc .bashrc

echo "Done!"

echo "Cloning Vundle"
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim