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

<title>RecordParser (Sqoop 1.4.6 API)</title>
<meta name="date" content="2015-04-27">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

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

org.apache.sqoop.lib

Class RecordParser

java.lang.Object

org.apache.sqoop.lib.RecordParser

Direct Known Subclasses:

RecordParser

public class RecordParser
extends java.lang.Object

Parses a record containing one or more fields. Fields are separated
 by some FIELD_DELIMITER character, e.g. a comma or a ^A character.
 Records are terminated by a RECORD_DELIMITER character, e.g., a newline.

 Fields may be (optionally or mandatorily) enclosed by a quoting char
 e.g., '\"'

 Fields may contain escaped characters. An escape character may be, e.g.,
 the '\\' character. Any character following an escape character
 is treated literally. e.g., '\n' is recorded as an 'n' character, not a
 newline.

 Unexpected results may occur if the enclosing character escapes itself.
 e.g., this cannot parse SQL SELECT statements where the single character
 ['] escapes to [''].

 This class is not synchronized. Multiple threads must use separate
 instances of RecordParser.

 The fields parsed by RecordParser are backed by an internal buffer
 which is cleared when the next call to parseRecord() is made. If
 the buffer is required to be preserved, you must copy it yourself.

Nested Class Summary

Nested Classes

Modifier and Type
Class and Description

static class
RecordParser.ParseError

An error thrown when parsing fails.

Field Summary

Fields

Modifier and Type
Field and Description

static org.apache.commons.logging.Log
LOG

Constructor Summary

Constructors

Constructor and Description

RecordParser(DelimiterSet delimitersIn)

Method Summary

Methods

Modifier and Type
Method and Description

int
hashCode()

boolean
isEnclosingRequired()

java.util.List<java.lang.String>
parseRecord(byte[] input)

Return a list of strings representing the fields of the input line.

java.util.List<java.lang.String>
parseRecord(java.nio.ByteBuffer input)

java.util.List<java.lang.String>
parseRecord(char[] input)

Return a list of strings representing the fields of the input line.

java.util.List<java.lang.String>
parseRecord(java.nio.CharBuffer input)

Return a list of strings representing the fields of the input line.

java.util.List<java.lang.String>
parseRecord(java.lang.CharSequence input)

Return a list of strings representing the fields of the input line.

java.util.List<java.lang.String>
parseRecord(org.apache.hadoop.io.Text input)

Return a list of strings representing the fields of the input line.

java.lang.String
toString()

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG

Constructor Detail

RecordParser

public RecordParser(DelimiterSet delimitersIn)

Method Detail

parseRecord

public java.util.List<java.lang.String> parseRecord(java.lang.CharSequence input)
                                             throws RecordParser.ParseError

Return a list of strings representing the fields of the input line.
 This list is backed by an internal buffer which is cleared by the
 next call to parseRecord().

Throws:

RecordParser.ParseError

parseRecord

public java.util.List<java.lang.String> parseRecord(org.apache.hadoop.io.Text input)
                                             throws RecordParser.ParseError

Return a list of strings representing the fields of the input line.
 This list is backed by an internal buffer which is cleared by the
 next call to parseRecord().

Throws:

RecordParser.ParseError

parseRecord

public java.util.List<java.lang.String> parseRecord(byte[] input)
                                             throws RecordParser.ParseError

Return a list of strings representing the fields of the input line.
 This list is backed by an internal buffer which is cleared by the
 next call to parseRecord().

Throws:

RecordParser.ParseError

parseRecord

public java.util.List<java.lang.String> parseRecord(char[] input)
                                             throws RecordParser.ParseError

Return a list of strings representing the fields of the input line.
 This list is backed by an internal buffer which is cleared by the
 next call to parseRecord().

Throws:

RecordParser.ParseError

parseRecord

public java.util.List<java.lang.String> parseRecord(java.nio.ByteBuffer input)
                                             throws RecordParser.ParseError

Throws:

RecordParser.ParseError

parseRecord

public java.util.List<java.lang.String> parseRecord(java.nio.CharBuffer input)
                                             throws RecordParser.ParseError

Return a list of strings representing the fields of the input line.
 This list is backed by an internal buffer which is cleared by the
 next call to parseRecord().

Throws:

RecordParser.ParseError

isEnclosingRequired

public boolean isEnclosingRequired()

toString

public java.lang.String toString()

Overrides:

toString in class java.lang.Object

hashCode

public int hashCode()

Overrides:

hashCode in class java.lang.Object

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 © 2015 The Apache Software Foundation


text:
layout: post
title: SAP Cloud Platform Integration - Overview
excerpt: "SAP HANA Cloud Integration easily exchange data in real-time with SAP HANA Cloud Platform, integration services SCI(HCI). Integrate processes and data between cloud apps, 3rd party applications and on-premises solutions with this open, flexible, on-demand integration system running as a core service on SAP HANA Cloud Platform."
modified: 2018-01-16T17:00:00-00:00
categories: articles
tags: [SAP CPI, iPaaS, SAP Cloud]
image:
  vendor: twitter
  feature: /media/DRBYr3MX0AAsiT8.jpg:large
  credit: Nat Geo Photography
  creditlink: https://twitter.com/NatGeoPhotos
comments: true
share: true
references:
  - title: "SAP Blog - Step by Step Guide to Setup HCI-DS Agent On Premise"
    url: "https://blogs.sap.com/2015/12/11/step-by-step-guide-to-setup-hci-ds-agent/"
  - title: "Youtube - SAP HANA Cloud Integration for Data Services"
    url: "https://www.youtube.com/playlist?list=PLkzo92owKnVyHVtrzyF4KSQomTuKRg0q_"
  - title: "SAP Blog - HCI: Integrate On Premise ERP with HCI IDoc Adapter using HANA Cloud Connector & Client Authentication"
    url: "https://blogs.sap.com/2016/03/30/hci-integrate-on-premise-erp-with-hci-idoc-adapter-using-hana-cloud-connector-client-authentication/"
  - title: "HCP Documents - SAP HANA Cloud Integration for Processes"
    url: "https://proddps.hana.ondemand.com/dps/d/preview/88a767b35adb4dc887ee1d545d301140/1/en-US/f830932fddf6453ebe1fd0c666592017.html"
  - title: "open.sap.com - Application Integration Made Simple with SAP HANA Cloud Integration"
    url: "https://open.sap.com/courses/hci1/overview"
---

* TOC
{:toc}

## Backgrounds
### BPMN
A standard [Business Process Model and Notation (BPMN)](http://www.bpmn.org/) will provide businesses with the capability of understanding their internal business procedures in a graphical notation and will give organizations the ability to communicate these procedures in a standard manner. Furthermore, the graphical notation will facilitate the understanding of the performance collaborations and business transactions between the organizations. This will ensure that businesses will understand themselves and participants in their business and will enable organizations to adjust to new internal and B2B business circumstances quickly.

[BPMN Quick Guide](http://www.bpmnquickguide.com/view-bpmn-quick-guide/)

[BPMN Tutorial: Get started with Process Modeling using BPMN](https://camunda.com/bpmn/)

Wikipedia - [Business Process Model and Notation (BPMN) ](https://en.wikipedia.org/wiki/Business_Process_Model_and_Notation)

#### Catify BPMN Engine

> The catify bpmn engine is based on Akka (http://akka.io/) and Neo4j (http://neo4j.com/) and is fully compatible to BPMN 2.0. It can handle millions of long running processes out of the box. Though not yet feature complete, it is easy to extend via different service provider interfaces.
>
> You can easily integrate the engine into your infrastructure. Via the Integration SPI you can access it by the integration framework of your choice. Out of the box it comes with Apache Camel (http://camel.apache.org/) and therefore all of its strenghts.

#### List of BPMN 2.0 engines

[List of BPMN 2.0 engines](https://en.wikipedia.org/wiki/List_of_BPMN_2.0_engines)

#### BPEL

[BPEL][BPEL] (Business Process Execution Language)

[Service choreography](https://en.wikipedia.org/wiki/Service_choreography#Web_Service_Choreography) and [service orchestration](https://en.wikipedia.org/wiki/Orchestration_(computing))

[Business process modeling (BPM)](https://en.wikipedia.org/wiki/Business_process_modeling)

### Apache Camel
[Apache Camel][Apache-Camel] ™ is a versatile open-source integration framework based on known [Enterprise Integration Patterns][Enterprise-Integration-Patterns].

### Enterprise Integration Patterns
[Camel][Apache-Camel] supports most of the [Enterprise Integration Patterns][Enterprise-Integration-Patterns] from the excellent book by [Gregor Hohpe and Bobby Woolf][amazon-Enterprise-Integration-Patterns].

### Download HCI-DS Agent

[Data Services Agent][1]

## Camel's Message Model

### Message
![Image Camel Message](/images/cloud/hcp/hci/camel-message.jpg)
{: .center.middle}

Fundamental entity **containing the data** being carried and routed in Camel

* Messages have a body (a payload), headers, and optional attachments
* Messages are uniquely identified with an identifier of type `java.lang.String`
* Headers
  * Headers are values associated with the message Sender identifier, hints about content encoding, authentication information,…
  * Headers are name-value-pairs Name is a unique, case-insensitive string Value is of type `java.lang.Object`
* Attachments
  * Optional – typically used for Web service and e-mail components
* Body
  * Type: `java.lang.Object` -> any kind of content is allowed

### Exchange
![Image Camel Message](/images/cloud/hcp/hci/camel-exchange.jpg)
{: .center.middle}

The **message's container** during routing

* Provides support for various interaction types between systems, known as Message Exchange Patterns (MEP)
  * InOnly: a one-way message (e.g. JMS messaging)
  * InOut: a request-response message (e.g. HTTP-based transports)
* Exchange ID: a unique ID that identifies the exchange
* MEP
  * InOnly: exchange contains an "in message" only
  * InOut: exchange contains an "in message" and an "out message" containing the reply message for the caller
* Exception: If an error occurs during runtime, the Exception field will be filled
* Properties: Similar to message headers, but they last for the duration of the entire exchange; they contain global-level information; you can store and retrieve properties at any point during the lifetime of an exchange

### Goals
Store data in the message header and in the properties of the exchange. Retrieve data from header and properties to build the reply message

## iPaaS

[Cloud-based integration](https://en.wikipedia.org/wiki/Cloud-based_integration)

Enterprise Integration Platform as a Service

### What is iPaaS?
什么是 iPaaS ?

MuleSoft 这样说 [What is iPaaS?](https://www.mulesoft.com/resources/cloudhub/what-is-ipaas-gartner-provides-reference-model)

Dell 这样说 [What is iPaaS?](https://boomi.com/integration/what-is-ipaas/)

Informatica 这样说 [What is iPaaS?](https://www.informatica.com/products/integration-platform-as-a-service.html)

### iPaaS vs ESB

[iPaaS vs ESB: Understanding the Difference](https://www.liaison.com/blog/2017/03/31/ipaas-vs-esb-understanding-difference/)

### iPaaS Replace ESB

[When Does iPaaS Finally Get To Replace Enterprise Service Bus?](https://www.elastic.io/when-ipaas-replace-enterprise-service-bus/)

### Products

Gartner 在2017年关于 iPaaS 的魔力象限

![Image: Gartner-Magic-iPaaS-Quadrant-2017](http://ap-verlag.de/clickandbuilds/WordPress/MyCMS4/wp-content/uploads/2017/05/grafik-gartner-ipaas-plattformen.jpg)
{: .center.middle}

[Oracle Integration Cloud Service](https://cloud.oracle.com/integration)

[Dell Boomi](https://boomi.com/)

## My Researches
记录在使用 SAP Cloud Platform Integration 产品过程中总结下来的经验和模式。

### Message Mapping
这一篇介绍 Message Mapping 基本原理和如何应用自定义函数处理复杂的一对多,多对一的映射逻辑。

[SAP Cloud Platform Integration - Message Mapping](/articles/sci-message-mapping/)

### Content Enricher
这一篇总结了使用 MultiCast + Request-Reply + Join + Gather 来构建 Content Enricher 模式,以解决和弥补内置 Content Enricher 功能的不足。

[SAP Cloud Platform Integration - Content Enricher](/articles/sci-content-enricher/)

[Apache-Camel]:http://camel.apache.org/
[Enterprise-Integration-Patterns]:http://camel.apache.org/enterprise-integration-patterns.html
[amazon-Enterprise-Integration-Patterns]:http://www.amazon.com/exec/obidos/search-handle-url/105-9796798-8100401?%5Fencoding=UTF8&search-type=ss&index=books&field-author=Gregor%20Hohpe

[BPEL]:https://en.wikipedia.org/wiki/Business_Process_Execution_Language

[1]:https://launchpad.support.sap.com

redpajama_set_name: RedPajamaGithub


text:
<?php
namespace org\bovigo\vfs\examples\part07;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\visitor\vfsStreamPrintVisitor;

class Inspection extends \PHPUnit_Framework_TestCase {

    /**
     * @test
     */
    public function example() {
        $structure = [
                'examples' => [
                    'test.php'    => 'some text content',
                    'other.php'   => 'Some more text content',
                    'Invalid.csv' => 'Something else',
                ],
                'an_empty_folder' => [],
                'badlocation.php' => 'some bad content',
                '[Foo]'           => 'a block device'
        ];
        vfsStream::setup('root', null, $structure);
        vfsStream::inspect(new vfsStreamPrintVisitor());
    }
}


text:
using System.ComponentModel.DataAnnotations.Schema;

namespace EFCodeFirst.Models
{
    [ComplexType]
    //[Table("Information")]
    public class ArtistInfo
    {
        //[Column("Country")]
        public string Country { get; set; }

        //[Column("Bio")]
        public string Biography { get; set; }

        //[Column("Age", TypeName = "int")]
        public int Age { get; set; }

    }
}


text:
package databasemigrationservice

const (

	// ErrCodeAccessDeniedFault for service response error code
	// "AccessDeniedFault".
	//
	// AWS DMS was denied access to the endpoint.
	ErrCodeAccessDeniedFault = "AccessDeniedFault"

	// ErrCodeInsufficientResourceCapacityFault for service response error code
	// "InsufficientResourceCapacityFault".
	//
	// There are not enough resources allocated to the database migration.
	ErrCodeInsufficientResourceCapacityFault = "InsufficientResourceCapacityFault"

	// ErrCodeInvalidCertificateFault for service response error code
	// "InvalidCertificateFault".
	//
	// The certificate was not valid.
	ErrCodeInvalidCertificateFault = "InvalidCertificateFault"

	// ErrCodeInvalidResourceStateFault for service response error code
	// "InvalidResourceStateFault".
	//
	// The resource is in a state that prevents it from being used for database
	// migration.
	ErrCodeInvalidResourceStateFault = "InvalidResourceStateFault"

	// ErrCodeInvalidSubnet for service response error code
	// "InvalidSubnet".
	//
	// The subnet provided is invalid.
	ErrCodeInvalidSubnet = "InvalidSubnet"

	// ErrCodeKMSKeyNotAccessibleFault for service response error code
	// "KMSKeyNotAccessibleFault".
	//
	// AWS DMS cannot access the KMS key.
	ErrCodeKMSKeyNotAccessibleFault = "KMSKeyNotAccessibleFault"

	// ErrCodeReplicationSubnetGroupDoesNotCoverEnoughAZs for service response error code
	// "ReplicationSubnetGroupDoesNotCoverEnoughAZs".
	//
	// The replication subnet group does not cover enough Availability Zones (AZs).
	// Edit the replication subnet group and add more AZs.
	ErrCodeReplicationSubnetGroupDoesNotCoverEnoughAZs = "ReplicationSubnetGroupDoesNotCoverEnoughAZs"

	// ErrCodeResourceAlreadyExistsFault for service response error code
	// "ResourceAlreadyExistsFault".
	//
	// The resource you are attempting to create already exists.
	ErrCodeResourceAlreadyExistsFault = "ResourceAlreadyExistsFault"

	// ErrCodeResourceNotFoundFault for service response error code
	// "ResourceNotFoundFault".
	//
	// The resource could not be found.
	ErrCodeResourceNotFoundFault = "ResourceNotFoundFault"

	// ErrCodeResourceQuotaExceededFault for service response error code
	// "ResourceQuotaExceededFault".
	//
	// The quota for this resource quota has been exceeded.
	ErrCodeResourceQuotaExceededFault = "ResourceQuotaExceededFault"

	// ErrCodeSNSInvalidTopicFault for service response error code
	// "SNSInvalidTopicFault".
	//
	// The SNS topic is invalid.
	ErrCodeSNSInvalidTopicFault = "SNSInvalidTopicFault"

	// ErrCodeSNSNoAuthorizationFault for service response error code
	// "SNSNoAuthorizationFault".
	//
	// You are not authorized for the SNS subscription.
	ErrCodeSNSNoAuthorizationFault = "SNSNoAuthorizationFault"

	// ErrCodeStorageQuotaExceededFault for service response error code
	// "StorageQuotaExceededFault".
	//
	// The storage quota has been exceeded.
	ErrCodeStorageQuotaExceededFault = "StorageQuotaExceededFault"

	// ErrCodeSubnetAlreadyInUse for service response error code
	// "SubnetAlreadyInUse".
	//
	// The specified subnet is already in use.
	ErrCodeSubnetAlreadyInUse = "SubnetAlreadyInUse"

	// ErrCodeUpgradeDependencyFailureFault for service response error code
	// "UpgradeDependencyFailureFault".
	//
	// An upgrade dependency is preventing the database migration.
	ErrCodeUpgradeDependencyFailureFault = "UpgradeDependencyFailureFault"
)
//Added a line for testing
//Adding another line for Git event testing part 2
//Adding another line for Git event testing part 2.1
//Adding another line for Git event testing part 2.2


text:
package v1beta3

import (
	kapi "k8s.io/kubernetes/pkg/api/v1beta3"
)

type ClusterNetwork struct {
	kapi.TypeMeta   `json:",inline"`
	kapi.ObjectMeta `json:"metadata,omitempty"`

	Network          string `json:"network" description:"CIDR string to specify the global overlay network's L3 space"`
	HostSubnetLength int    `json:"hostsubnetlength" description:"number of bits to allocate to each host's subnet e.g. 8 would mean a /24 network on the host"`
}

type ClusterNetworkList struct {
	kapi.TypeMeta `json:",inline"`
	kapi.ListMeta `json:"metadata,omitempty"`
	Items         []ClusterNetwork `json:"items"`
}

// HostSubnet encapsulates the inputs needed to define the container subnet network on a node
type HostSubnet struct {
	kapi.TypeMeta   `json:",inline"`
	kapi.ObjectMeta `json:"metadata,omitempty"`

	// host may just be an IP address, resolvable hostname or a complete DNS
	Host   string `json:"host" description:"Name of the host that is registered at the master. A lease will be sought after this name."`
	HostIP string `json:"hostIP" description:"IP address to be used as vtep by other hosts in the overlay network"`
	Subnet string `json:"subnet" description:"Actual subnet CIDR lease assigned to the host"`
}

// HostSubnetList is a collection of HostSubnets
type HostSubnetList struct {
	kapi.TypeMeta `json:",inline"`
	kapi.ListMeta `json:"metadata,omitempty"`
	Items         []HostSubnet `json:"items"`
}

// NetNamespace encapsulates the inputs needed to define a unique network namespace on the cluster
type NetNamespace struct {
	kapi.TypeMeta   `json:",inline"`
	kapi.ObjectMeta `json:"metadata,omitempty"`

	NetName string `json:"netname" description:"Name of the network namespace."`
	NetID   uint   `json:"netid" description:"NetID of the network namespace assigned to each overlay network packet."`
}

// NetNamespaceList is a collection of NetNamespaces
type NetNamespaceList struct {
	kapi.TypeMeta `json:",inline"`
	kapi.ListMeta `json:"metadata,omitempty"`
	Items         []NetNamespace `json:"items" description:"list of net namespaces"`
}


text:
class AddArchivedToAssignments < ActiveRecord::Migration
  def change
    add_column(:assignments, :archived, :boolean, null: false, default: false)
  end
end


text:
using PoESkillTree.Utils.UrlProcessing.Encoders;
using PoESkillTree.ViewModels.PassiveTree;
using System.Collections.Generic;

namespace PoESkillTree.Utils.UrlProcessing
{
    public static class SkillTreeUrlEncoders
    {
        private static IEnumerable<ISkillTreeUrlEncoder> _encoders = new List<ISkillTreeUrlEncoder>()
        {
            new PoESkillTreeUrlEncoder(),
        };

        public static string? TryEncode(byte character, byte ascendancy, IEnumerable<PassiveNodeViewModel> nodes)
        {
            foreach (var encoder in _encoders)
            {
                if (encoder.CanEncode(character, ascendancy, nodes))
                {
                    return encoder.Encode(character, ascendancy, nodes);
                }
            }

            return null;
        }
    }
}


text:
namespace media {

// Class that describes how video bitrate, in bps, is allocated across temporal
// and spatial layers. Note that bitrates are NOT cumulative. Depending on if
// layers are dependent or not, it is up to the user to aggregate.
class MEDIA_EXPORT VideoBitrateAllocation {
 public:
  static constexpr size_t kMaxSpatialLayers = 5;
  static constexpr size_t kMaxTemporalLayers = 4;

  VideoBitrateAllocation();
  ~VideoBitrateAllocation() = default;

  // Returns if this bitrate can't be set (sum exceeds int max value).
  bool SetBitrate(size_t spatial_index, size_t temporal_index, int bitrate_bps);

  // Returns the bitrate for specified spatial/temporal index, or 0 if not set.
  int GetBitrateBps(size_t spatial_index, size_t temporal_index) const;

  // Sum of all bitrates.
  int32_t GetSumBps() const;

  bool operator==(const VideoBitrateAllocation& other) const;
  inline bool operator!=(const VideoBitrateAllocation& other) const {
    return !(*this == other);
  }

 private:
  int sum_;  // Cached sum of all elements of |bitrates_|, for performance.
  int bitrates_[kMaxSpatialLayers][kMaxTemporalLayers];
};

}  // namespace media

#endif  // MEDIA_BASE_VIDEO_BITRATE_ALLOCATION_H_


text:
using System;
using System.Runtime.InteropServices;

namespace Noesis
{

internal class ExtendDictionaryIndexer : BaseComponent {
  internal new static ExtendDictionaryIndexer CreateProxy(IntPtr cPtr, bool cMemoryOwn) {
    return new ExtendDictionaryIndexer(cPtr, cMemoryOwn);
  }

  internal ExtendDictionaryIndexer(IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) {
  }

  internal static HandleRef getCPtr(ExtendDictionaryIndexer obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }

  protected ExtendDictionaryIndexer() {
  }

  internal new static IntPtr Extend(string typeName) {
    IntPtr nativeType = NoesisGUI_PINVOKE.Extend_ExtendDictionaryIndexer(Marshal.StringToHGlobalAnsi(typeName));
    if (NoesisGUI_PINVOKE.SWIGPendingException.Pending) throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve();
    return nativeType;
  }
}

}


text:
from setuptools import setup
from os import path

here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md')) as f:
    long_description = f.read()
setup(
    name='django-bnr-exchangerate',
    version='0.1.0',
    packages=['bnr_exchangerate'],
    url='https://github.com/opencbsoft/django-bnr-exchangerate',
    license='MIT',
    author='Cristian Boboc',
    author_email='cristi@pidginhost.com',
    description='A django application to help with exchangerates from bnr.ro',
    long_description=long_description,
    classifiers=[
        # How mature is this project? Common values are
        #   3 - Alpha
        #   4 - Beta
        #   5 - Production/Stable
        'Development Status :: 3 - Alpha',

        # Indicate who your project is intended for
        'Intended Audience :: Developers',
        'Topic :: Software Development :: Libraries :: Python Modules',

        # Pick your license as you wish (should match "license" above)
        'License :: OSI Approved :: MIT License',

        # Specify the Python versions you support here. In particular, ensure
        # that you indicate whether you support Python 2, Python 3 or both.
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.2',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
    ],
    keywords='exchangerate, bnr',
)


text:
<?php
abstract class Notifications_abs {
	public function __construct() {
    }

	/* registreert een service bij een host
	 * Gezocht: betere omschrijving :) */
	abstract function register();

	/* verstuurt het bericht */
	abstract function sendMessage($type, $title, $body, $sourceUrl);
} # SpotNotifyService_abs


text:
@implementation Group

- (instancetype)init
{
    if (self = [super init]) {
        self.typeNum = @0;
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"type"]) {
        self.typeNum = (NSNumber *)value;
    }
    if ([key isEqualToString:@"topics"]) {
        for (NSDictionary *dic in (NSArray *)value) {
            Topic *topic = [[Topic alloc] init];
            [topic setValuesForKeysWithDictionary:dic];
            [self.topicsArray addObject:topic];
        }
    }
    if ([key isEqualToString:@"comics"]) {
        for (NSDictionary *dic in (NSArray *)value) {
            Comic *comic = [[Comic alloc] init];
            [comic setValuesForKeysWithDictionary:dic];
            [self.comicArray addObject:comic];
        }
    }
}

- (NSMutableArray *)topicsArray
{
    if (_topicsArray == nil) {
        self.topicsArray = [NSMutableArray array];
    }
    return _topicsArray;
}

- (NSMutableArray *)comicArray
{
    if (_comicArray == nil) {
        self.comicArray = [NSMutableArray array];
    }
    return _comicArray;
}

@end


text:
#include "annotations/adapter/xcache.h"
#include "annotations/adapter.h"
#include "annotations/adapterinterface.h"

#include "kernel/main.h"
#include "kernel/memory.h"
#include "kernel/concat.h"
#include "kernel/fcall.h"
#include "kernel/string.h"
#include "kernel/variables.h"

/**
 * Phalcon\Annotations\Adapter\Xcache
 *
 * Stores the parsed annotations to XCache. This adapter is suitable for production
 *
 *
 * $annotations = new \Phalcon\Annotations\Adapter\Xcache();
 *
 */
zend_class_entry *phalcon_annotations_adapter_xcache_ce;

PHP_METHOD(Phalcon_Annotations_Adapter_Xcache, read);
PHP_METHOD(Phalcon_Annotations_Adapter_Xcache, write);

ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_annotations_adapter_xcache_read, 0, 0, 1)
	ZEND_ARG_INFO(0, key)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_annotations_adapter_xcache_write, 0, 0, 2)
	ZEND_ARG_INFO(0, key)
	ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO()

static const zend_function_entry phalcon_annotations_adapter_xcache_method_entry[] = {
	PHP_ME(Phalcon_Annotations_Adapter_Xcache, read, arginfo_phalcon_annotations_adapter_xcache_read, ZEND_ACC_PUBLIC)
	PHP_ME(Phalcon_Annotations_Adapter_Xcache, write, arginfo_phalcon_annotations_adapter_xcache_write, ZEND_ACC_PUBLIC)
	PHP_FE_END
};

/**
 * Phalcon\Annotations\Adapter\Xcache initializer
 */
PHALCON_INIT_CLASS(Phalcon_Annotations_Adapter_Xcache){

	PHALCON_REGISTER_CLASS_EX(Phalcon\\Annotations\\Adapter, Xcache, annotations_adapter_xcache, phalcon_annotations_adapter_ce, phalcon_annotations_adapter_xcache_method_entry, 0);

	zend_class_implements(phalcon_annotations_adapter_xcache_ce TSRMLS_CC, 1, phalcon_annotations_adapterinterface_ce);

	return SUCCESS;
}

/**
 * Reads parsed annotations from XCache
 *
 * @param string $key
 * @return Phalcon\Annotations\Reflection
 */
PHP_METHOD(Phalcon_Annotations_Adapter_Xcache, read){

	zval *key, *prefixed_key, *serialized = NULL;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 1, 0, &key);

	PHALCON_INIT_VAR(prefixed_key);
	PHALCON_CONCAT_SV(prefixed_key, "_PHAN", key);

	phalcon_strtolower_inplace(prefixed_key);

	PHALCON_CALL_FUNCTION(&serialized, "xcache_get", prefixed_key);
	if (Z_TYPE_P(serialized) == IS_STRING) {
		phalcon_unserialize(return_value, serialized TSRMLS_CC);
		if (Z_TYPE_P(return_value) != IS_OBJECT) {
			zval_dtor(return_value);
			RETVAL_NULL();
		}
	}

	PHALCON_MM_RESTORE();
}

/**
 * Writes parsed annotations to XCache
 *
 * @param string $key
 * @param Phalcon\Annotations\Reflection $data
 */
PHP_METHOD(Phalcon_Annotations_Adapter_Xcache, write){

	zval *key, *data, *prefixed_key;
	zval *serialized;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 2, 0, &key, &data);

	PHALCON_INIT_VAR(prefixed_key);
	PHALCON_CONCAT_SV(prefixed_key, "_PHAN", key);

	phalcon_strtolower_inplace(prefixed_key);

	PHALCON_INIT_VAR(serialized);
	phalcon_serialize(serialized, &data TSRMLS_CC);
	PHALCON_CALL_FUNCTION(NULL, "xcache_set", prefixed_key, serialized);

	PHALCON_MM_RESTORE();
}


text: powered by Surfing Waves


text:
module Carto
  module Api
    module Public
      class OauthAppPresenter

        PRIVATE_ATTRIBUTES = %i(
          id user_id name created_at updated_at client_id client_secret
          redirect_uris icon_url restricted description website_url
        ).freeze

        PUBLIC_ATTRIBUTES = %i(id name created_at updated_at description website_url icon_url).freeze

        def initialize(oauth_app, user: nil)
          @oauth_app = oauth_app
          @user = user
        end

        def to_hash(private_data: false)
          private_data ? to_private_hash : to_public_hash
        end

        private

        def to_private_hash
          @oauth_app.slice(*PRIVATE_ATTRIBUTES).merge(username: @oauth_app.user.username)
        end

        def to_public_hash
          oauth_app_user = @oauth_app.oauth_app_users.where(user: @user).first
          scopes = Carto::OauthProvider::Scopes.scopes_by_category(oauth_app_user&.all_scopes)
          @oauth_app.slice(*PUBLIC_ATTRIBUTES).merge(scopes: scopes)
        end

      end
    end
  end
end


text:
package com.github.pkunk.pq.ui;

import com.github.pkunk.pq.gameplay.Player;
import com.github.pkunk.pq.gameplay.RaceClass;
import com.github.pkunk.pq.gameplay.Stats;
import com.github.pkunk.pq.gameplay.Traits;
import com.github.pkunk.pq.init.Res;
import com.github.pkunk.pq.util.PqUtils;
import com.github.pkunk.pq.util.Vfs;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

/**
 * User: pkunk
 * Date: 2012-02-07
 */
public class NewPlayerModel {

    private static final int STATS_NUM = Stats.STATS_NUM;
    private static final int BASE_STATS_NUM = Stats.BASE_STATS_NUM;

    public static final int COLOR_MIN = 0;
    public static final int COLOR_LOW = 1;
    public static final int COLOR_NORMAL = 2;
    public static final int COLOR_HIGH = 3;
    public static final int COLOR_MAX = 4;

    private String selectedName = null;
    private RaceClass selectedRace = null;
    private RaceClass selectedRole = null;
    private Stats selectedStats = null;

    private Map<String,RaceClass> raceMap = new HashMap<String, RaceClass>(Res.RACES.size());
    private Map<String,RaceClass> roleMap = new HashMap<String, RaceClass>(Res.KLASSES.size());

    private LinkedList<Stats> rollStack = new LinkedList<Stats>();

    public void addRace(RaceClass race) {
        raceMap.put(race.getName(), race);
    }

    public void addRole(RaceClass role) {
        roleMap.put(role.getName(), role);
    }

    public void setName(String name) {
        selectedName = Vfs.sanitizeString(name);
        if (selectedName.length() == 0) {
            selectedName = "Hero";
        }
    }

    public void setRace(String race) {
        selectedRace = raceMap.get(race);
    }

    public void setRole(String role) {
        selectedRole = roleMap.get(role);
    }

    public void rollStats() {
        if (selectedStats != null) {
            rollStack.addFirst(selectedStats);
        }

        int[] stats = new int[STATS_NUM];
        for (int i=0; i<BASE_STATS_NUM; i++) {
            stats[i] = 3 + PqUtils.random(6) + PqUtils.random(6) + PqUtils.random(6);
        }
//        stats[Stats.HP_MAX] = PqUtils.random(8) + stats[Stats.CON] / 6;
//        stats[Stats.MP_MAX] = PqUtils.random(8) + stats[Stats.INT] / 6;
        selectedStats = Stats.newStats(stats);
    }

    public void unrollStats() {
        selectedStats = rollStack.removeFirst();
    }

    public boolean hasOldRolls() {
        return rollStack.size() > 0;
    }

    public String[] getStats() {
        String[] result = new String[STATS_NUM];
        for (int i=0; i<BASE_STATS_NUM; i++) {
            result[i] = String.valueOf(selectedStats.get(i));
        }
        return result;
    }

    public String totalStats() {
        int total = selectedStats.getTotal();
        return String.valueOf(total);
    }

    public int totalColor() {
        int total = selectedStats.getTotal();

        if (total >= (63+18)) {
            return COLOR_MAX;
        }
        if (total > (4 * 18)) {
            return COLOR_HIGH;
        }
        if (total <= (63-18)) {
            return COLOR_MIN;
        }
        if (total < (3 * 18)) {
            return COLOR_LOW;
        }
        return COLOR_NORMAL;
    }

    public Player generatePlayer() {
        Traits traits = Traits.newTraits(selectedName, selectedRace.getName(), selectedRole.getName());
        Stats stats = applyBonuses(selectedStats, selectedRace.getStats(), selectedRole.getStats());
        return Player.newPlayer(traits, stats);
    }

    private Stats applyBonuses(Stats stats, Stats raceBonuses, Stats roleBonuses) {
        int[] statsArray = new int[STATS_NUM];
        for (int i=0; i<BASE_STATS_NUM; i++) {
            statsArray[i] = stats.get(i) + raceBonuses.get(i) + roleBonuses.get(i);
        }

        statsArray[Stats.HP_MAX] = PqUtils.random(8) + statsArray[Stats.CON] / 6
            + raceBonuses.get(Stats.HP_MAX) + roleBonuses.get(Stats.HP_MAX);

        statsArray[Stats.MP_MAX] = PqUtils.random(8) + statsArray[Stats.INT] / 6
            + raceBonuses.get(Stats.MP_MAX) + roleBonuses.get(Stats.MP_MAX);

        return Stats.newStats(statsArray);
    }
}


text:
title: Photoshop touch and the magic torch
date: 2011-11-22 13:49:46 Z
permalink: "/2011/11/22/photoshop-touch-and-the-magic-torch/"
categories:
- android
- photography
layout: single
author_profile: true
type: pages
---

John Nack posted about this amazing tutorial by Russell Brown.

I've got to be honest, when watching it I was somewhat sceptical, and wondered if the US has another April Fools day in Mid-November.

However, using Photoshop Touch on my Tablet (Asus Transformer) and the torch light on my HTC Desire I was able to recreate the same effect. While the output is quite impressive, there is something about being hands-on with a torch, and illuminating my photograph in real time that just feel ludicrous (in a good way)

Photoshop Touch is available for both iOS tablets and Android Tablets, and it really is surprisingly powerful

Below is a simple example using a photo I took inside the Oxford Pitt Rivers museum (which is mostly poorly lit, and the kids go exploring by torch light – great fun):

Before and then After are below – click for larger images:


text:
package org.apache.hadoop.hdfs.protocol;

import java.util.Date;

import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.DFSUtil;
import org.apache.hadoop.hdfs.server.namenode.CachePool;

import com.google.common.base.Preconditions;
import io.hops.metadata.common.FinderType;
import static com.google.common.base.Preconditions.checkNotNull;
import io.hops.exception.StorageException;
import io.hops.exception.TransactionContextException;
import io.hops.transaction.EntityManager;

/**
 * Namenode class that tracks state related to a cached path.
 *
 * This is an implementation class, not part of the public API.
 */
@InterfaceAudience.Private
public final class CacheDirective {

  public enum Finder implements FinderType<CacheDirective> {
    ById, ByPoolName, ByIdPoolAndPath, All;

    @Override
    public Class getType() {
      return CacheDirective.class;
    }

    @Override
    public FinderType.Annotation getAnnotated() {
      switch (this) {
        case ById:
          return FinderType.Annotation.PrimaryKey;
        case ByPoolName:
          return FinderType.Annotation.IndexScan;
        case ByIdPoolAndPath:
          return FinderType.Annotation.IndexScan;
        case All:
          return FinderType.Annotation.FullTable;
        default:
          throw new IllegalStateException();
      }
    }
  }

  private final long id;
  private final String path;
  private final short replication;
  private String poolName;
  private final long expiryTime;

  private long bytesNeeded;
  private long bytesCached;
  private long filesNeeded;
  private long filesCached;

  public CacheDirective(CacheDirectiveInfo info) {
    this(
        info.getId(),
        info.getPath().toUri().getPath(),
        info.getReplication(),
        info.getExpiration().getAbsoluteMillis());
  }

  public CacheDirective(long id, String path,
      short replication, long expiryTime) {
    Preconditions.checkArgument(id > 0);
    this.id = id;
    this.path = checkNotNull(path);
    Preconditions.checkArgument(replication > 0);
    this.replication = replication;
    this.expiryTime = expiryTime;
  }

  public CacheDirective(long id, String path,
      short replication, long expiryTime, long bytesNeeded, long bytesCached, long filesNeeded, long filesCached,
      String pool) {
    Preconditions.checkArgument(id > 0);
    this.id = id;
    this.path = checkNotNull(path);
    Preconditions.checkArgument(replication > 0);
    this.replication = replication;
    this.expiryTime = expiryTime;
    this.bytesNeeded = bytesNeeded;
    this.bytesCached = bytesCached;
    this.filesNeeded = filesNeeded;
    this.filesCached = filesCached;
    this.poolName = pool;
  }

  public long getId() {
    return id;
  }

  public String getPath() {
    return path;
  }

  public short getReplication() {
    return replication;
  }

  public String getPoolName() {
    return poolName;
  }

  public CachePool getPool() throws TransactionContextException, StorageException {
    return EntityManager.find(CachePool.Finder.ByName, poolName);
  }

  public void setPoolName(String pool) {
    this.poolName = pool;
  }

  /**
   * @return When this directive expires, in milliseconds since Unix epoch
   */
  public long getExpiryTime() {
    return expiryTime;
  }

  /**
   * @return When this directive expires, as an ISO-8601 formatted string.
   */
  public String getExpiryTimeString() {
    return DFSUtil.dateToIso8601String(new Date(expiryTime));
  }

  /**
   * Returns a {@link CacheDirectiveInfo} based on this CacheDirective.
   * <p>
   * This always sets an absolute expiry time, never a relative TTL.
   */
  public CacheDirectiveInfo toInfo() {
    return new CacheDirectiveInfo.Builder().
        setId(id).
        setPath(new Path(path)).
        setReplication(replication).
        setPool(poolName).
        setExpiration(CacheDirectiveInfo.Expiration.newAbsolute(expiryTime)).
        build();
  }

  public CacheDirectiveStats toStats() {
    return new CacheDirectiveStats.Builder().
        setBytesNeeded(bytesNeeded).
        setBytesCached(bytesCached).
        setFilesNeeded(filesNeeded).
        setFilesCached(filesCached).
        setHasExpired(new Date().getTime() > expiryTime).
        build();
  }

  public CacheDirectiveEntry toEntry() {
    return new CacheDirectiveEntry(toInfo(), toStats());
  }

  @Override
  public String toString() {
    StringBuilder builder = new StringBuilder();
    builder.append("{ id:").append(id).
      append(", path:").append(path).
      append(", replication:").append(replication).
      append(", pool:").append(poolName).
      append(", expiryTime: ").append(getExpiryTimeString()).
      append(", bytesNeeded:").append(bytesNeeded).
      append(", bytesCached:").append(bytesCached).
      append(", filesNeeded:").append(filesNeeded).
      append(", filesCached:").append(filesCached).
      append(" }");
    return builder.toString();
  }

  @Override
  public boolean equals(Object o) {
    if (o == null) { return false; }
    if (o == this) { return true; }
    if (o.getClass() != this.getClass()) {
      return false;
    }
    CacheDirective other = (CacheDirective)o;
    return id == other.id;
  }

  @Override
  public int hashCode() {
    return new HashCodeBuilder().append(id).toHashCode();
  }

  //
  // Stats related getters and setters
  //

  /**
   * Resets the byte and file statistics being tracked by this CacheDirective.
   */
  public void resetStatistics() throws TransactionContextException, StorageException {
    bytesNeeded = 0;
    bytesCached = 0;
    filesNeeded = 0;
    filesCached = 0;
    save();
  }

  public long getBytesNeeded() {
    return bytesNeeded;
  }

  public void addBytesNeeded(long bytes) throws TransactionContextException, StorageException {
    this.bytesNeeded += bytes;
    CachePool pool = getPool();
    pool.addBytesNeeded(bytes);
    pool.save();
    save();
  }

  public long getBytesCached() {
    return bytesCached;
  }

  public void addBytesCached(long bytes) throws TransactionContextException, StorageException {
    this.bytesCached += bytes;
    CachePool pool = getPool();
    pool.addBytesCached(bytes);
    pool.save();
    save();
  }

  public long getFilesNeeded() {
    return filesNeeded;
  }

  public void addFilesNeeded(long files) throws TransactionContextException, StorageException {
    this.filesNeeded += files;
    CachePool pool = getPool();
    pool.addFilesNeeded(files);
    pool.save();
    save();
  }

  public long getFilesCached() {
    return filesCached;
  }

  public void addFilesCached(long files) throws TransactionContextException, StorageException {
    this.filesCached += files;
    CachePool pool = getPool();
    pool.addFilesCached(files);
    pool.save();
    save();
  }

  private void save() throws TransactionContextException, StorageException{
    EntityManager.update(this);
  }

};


text:
namespace _08.Military_Elite.Models.Soldiers.Privates.SpecialisedSoldiers
{
    using System.Text;
    using System.Collections.Generic;
    using System;
    using System.Linq;
    using Interfaces;

    public class Engineer : SpecialisedSoldier, IEngineer
    {
        private IList<IRepair> repairs;

        public Engineer(string id, string firstName, string lastName, double salary, string corps, IEnumerable<IRepair> repairs)
            : base(id, firstName, lastName, salary, corps)
        {
            this.repairs = new List<IRepair>(repairs);
        }

        IReadOnlyList<IRepair> IEngineer.Repairs
        {
            get
            {
                return this.repairs as IReadOnlyList<IRepair>;
            }
        }

        public override string ToString()
        {
            var sb = new StringBuilder();
            sb.AppendLine(base.ToString())
                .AppendLine("Repairs:")
                .Append(string.Join($"  {Environment.NewLine}", this.repairs.Select(r => $"  {r.ToString()}")));

            return sb.ToString().Trim();
        }
    }
}


text:
const path = require('path');
const env = require('rear-core/get-rear-env')();
const appPaths = require('./app-paths');
const appPackageJson = require('rear-core/get-package-json')();

const target = env.REAR_SYSTEM_PACKAGE_TARGET || 'node';
const filename = env.REAR_SYSTEM_PACKAGE_FILENAME || `${appPackageJson.name}.js` || '[name].js';
const entry = [appPaths.indexJs];

let node;
let exclude = /node_modules/;
let plugins = [];
if (target !== 'node') {
  entry.unshift(require.resolve('./polyfills'));
  node = {
    fs: 'empty',
    net: 'empty',
    dgram: 'empty',
    dns: 'empty',
    tls: 'empty'
  }
  exclude = undefined;
}

module.exports = {
  // do not attempt to continue if errors are found
  bail: true,
  target,
  entry,
  output: {
    filename,
    path: appPaths.dest,
  },
  resolve: {
    'modules': ['node_modules', appPaths.appNodeModules],
    'extensions': ['.web.js', '.js', '.json'],
    'alias': {
      'babel-runtime': path.dirname(
        require.resolve('babel-runtime/package.json')
      ),
    },
  },
  module: {
    strictExportPresence: true,
    rules: [
      {
        test: /\.(js|jsx)$/,
        enforce: 'pre',
        use: [
          {
            options: {
              eslintPath: require.resolve('eslint'),
              // @remove-on-eject-begin
              baseConfig: {
                extends: [require.resolve('eslint-config-rear')],
              },
              ignore: false,
              useEslintrc: false,
              // @remove-on-eject-end
            },
            loader: require.resolve('eslint-loader'),
          },
        ],
        include: appPaths.root,
      },
      {
        oneOf: [
          // Process JS with Babel.
        {
          test: /\.(js|jsx)$/,
          exclude,
          include: appPaths.root,
          loader: require.resolve('babel-loader'),
          options: {
              babelrc: false,
              presets: [require.resolve('babel-preset-rear')],
              // @remove-on-eject-end
              // This is a feature of `babel-loader` for webpack (not Babel itself).
              // It enables caching results in ./node_modules/.cache/babel-loader/
              // directory for faster rebuilds.
              cacheDirectory: true,
            },
          },
        ]
      }
    ]
  },
  plugins,
  node,
  // Turn off performance hints during development because we don't do any
  // splitting or minification in interest of speed. These warnings become
  // cumbersome.
  performance: {
    hints: false,
  },
};


text:
VirtualCamera::VirtualCamera()
{
}
VirtualCamera::VirtualCamera(MicroDisplayInit& mdi, string imgname)
{
	BufferLength = mdi.MaxPics;
	WIDTH = mdi.width;
	stringstream ss;
	ss << "virtualcameras/" << imgname;
	ss >> imgname;
	if (mdi.colorType == MicroDisplayInit::GRAY)
		buffer = cv::imread(imgname, 0);
	else
		buffer = cv::imread(imgname, 1);
	if (buffer.cols == 0 || buffer.rows == 0)
	{
		ss << "£ºÐéÄâÏà»úµ×Ƭ²»´æÔÚ£¡";
		ExitWithError(ss.str());
	}
	if (buffer.cols != WIDTH || buffer.rows < BufferLength)
	{
		cv::resize(buffer, buffer, cv::Size(WIDTH, BufferLength));
	}
	cv::Mat t = buffer;
}
VirtualCamera::~VirtualCamera()
{
	buffer.release();
}

cv::Mat VirtualCamera::GetNext()
{
	int i = BufferIndex;
	if (!EndFlag && ++BufferIndex >= BufferLength)
	{
		EndFlag = true;
		i = 0;
	}
	cv::Mat ROI = buffer(cv::Rect(0, i, WIDTH, 1));
	cv::Mat ret = ROI.clone();
	return ret;
}
int VirtualCamera::FreeRunning(MicroDisplayInit& mdi, BufferStorage& s)
{
	EndFlag = false;
	BufferIndex = 0;
	cv::Mat OriginalImage;
	do{
		Sleep(0.1);
	} while (!s.AddFrame(GetNext()));
	return 0;
}


text:
package com.mhframework.ui;

import com.mhframework.core.math.MHVector;
import com.mhframework.platform.MHPlatform;
import com.mhframework.platform.event.MHMouseTouchEvent;
import com.mhframework.platform.event.MHMouseTouchListener;
import com.mhframework.platform.graphics.MHBitmapImage;
import com.mhframework.platform.graphics.MHColor;
import com.mhframework.platform.graphics.MHGraphicsCanvas;

public class MHMouseCursor implements MHMouseTouchListener
{
    public enum Type
    {
        CROSSHAIR, CIRCLE, HIDDEN;
    }

    //private Type type = Type.CROSSHAIR;
    protected String imageID;
    protected int x, y;
    private MHMouseCursorRenderer renderer;
    //private MHVector hotspot = new MHVector(0,0);

    public MHMouseCursor(Type type)
    {
        MHPlatform.addMouseTouchListener(this);
        //this.type = type;

        changeCursor(type);
    }

    public void changeCursor(MHBitmapImage image, int hotspotX, int hotspotY)
    {
        renderer = new CustomImage(image, hotspotX, hotspotY);
    }

    public void changeCursor(Type type)
    {
        switch (type)
        {
            case CROSSHAIR:
                renderer = new Crosshair();
                break;
            case CIRCLE:
                break;
            case HIDDEN:
                break;
            default:
                break;
        }
    }

    public void render(MHGraphicsCanvas g)
    {
        renderer.render(g, x, y);
    }

    @Override
    public void onMouseDown(MHMouseTouchEvent e)
    {
        x = e.getX();
        y = e.getY();
    }

    @Override
    public void onMouseUp(MHMouseTouchEvent e)
    {
        x = e.getX();
        y = e.getY();
    }

    @Override
    public void onMouseMoved(MHMouseTouchEvent e)
    {
        x = e.getX();
        y = e.getY();
    }
}

class CustomImage implements MHMouseCursorRenderer
{
	private MHBitmapImage image;
	private MHVector hotspot;

	public CustomImage(MHBitmapImage image, int hotspotX, int hotspotY)
	{
		this.image = image;
		hotspot = new MHVector(hotspotX, hotspotY);
	}

    @Override
    public void render(MHGraphicsCanvas g, int x, int y)
    {
    	int cx = (int)(x - hotspot.x);
    	int cy = (int)(y - hotspot.y);
    	g.drawImage(image, cx, cy);
    }
}

class Crosshair implements MHMouseCursorRenderer
{
    private static final int SIZE = 8;
    @Override
    public void render(MHGraphicsCanvas g, int x, int y)
    {
    	g.setColor(MHColor.BLACK);
        g.drawLine(x+1, y-SIZE+1, x+1, y+SIZE+1);
        g.drawLine(x-SIZE+1, y+1, x+SIZE+1, y+1);

    	g.setColor(MHColor.WHITE);
        g.drawLine(x, y-SIZE, x, y+SIZE);
        g.drawLine(x-SIZE, y, x+SIZE, y);
    }

}


text:
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
/**
 * Created by rohitk on 30-Nov-15.
 */
var angular2_1 = require('angular2/angular2');
var router_1 = require('angular2/router');
var httpService_1 = require('scripts/httpService');
var register = (function () {
    function register(httpService) {
        this.httpService = httpService;
        this.duplicateUsernameFlag = false;
        this.registerForm = new angular2_1.ControlGroup({
            username: new angular2_1.Control(),
            password: new angular2_1.Control(),
            confirmPassword: new angular2_1.Control(),
            agreementFlag: new angular2_1.Control(false)
        });
    }
    register.prototype.checkDuplicate = function () {
        var username = this.registerForm.controls.username.value;
        this.httpService.post('/checkduplicate', JSON.stringify({ username: username }))
            .subscribe(function (data) {
            var response = JSON.parse(data._body);
            this.duplicateUsernameFlag = response.status;
        }.bind(this));
    };
    register.prototype.register = function () {
        this.submitFlag = true;
        var username = this.registerForm.controls.username.value;
        var password = this.registerForm.controls.password.value;
        var confirmPassword = this.registerForm.controls.confirmPassword.value;
        var agreementFlag = this.registerForm.controls.agreementFlag._value;
        // let passwordLengthFlag = this.registerForm.controls.password._value.length < 6;
        if (username && password && confirmPassword && agreementFlag && !this.duplicateUsernameFlag) {
            this.httpService.post('/register', JSON.stringify({
                username: username,
                password: password
            })).subscribe(function (data) {
                var response = JSON.parse(data._body);
                if (response.status)
                    location.hash = "";
                else
                    this.registerMessage = response.message;
            }.bind(this));
        }
    };
    register = __decorate([
        angular2_1.Component({
            selector: "my-register"
        }),
        angular2_1.View({
            directives: [angular2_1.NgClass, router_1.RouterLink, angular2_1.FORM_DIRECTIVES],
            templateUrl: "views/register.html"
        }),
        __metadata('design:paramtypes', [(typeof (_a = typeof httpService_1.HttpService !== 'undefined' && httpService_1.HttpService) === 'function' && _a) || Object])
    ], register);
    return register;
    var _a;
})();
exports.register = register;
//# sourceMappingURL=register.js.map


text:
var smartCitizenApiJson = "http://api.smartcitizen.me/v0.0.1/4d206b1eb3a453aa02ab2f71755c92a67c1bf374/lastpost.json";

// Loop through data and print it to HTML
var jsonData = $.getJSON(smartCitizenApiJson, function(json) {

    //Obtain only the information related to the sensor data
    var allPosts = json.devices[0].posts;
    //Obtain devices.posts length (not really needed, but
    // it was good to find out how to get an object's lenght easilly)
    var objKeys = Object.keys(allPosts).length

    // Create empty list
    var dataList = document.createElement("ul");
    var dataLocation = document.getElementsByClassName("one-half");
    dataLocation[0].appendChild(dataList);

    // Loop through Smart Citizen Data and append to UL
    for (var key in allPosts) {
            if (allPosts.hasOwnProperty(key)) {
                var dataListItem = document.createElement("li");
                dataListItem.innerHTML = key + ": <strong>" + allPosts[key] + "</strong>";
                dataList.appendChild(dataListItem);
            };
    };

});


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Chicken Breast Meals</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="bower_components/html5-boilerplate/css/normalize.css">
    <link rel="stylesheet" href="bower_components/html5-boilerplate/css/main.css">
    <link rel="stylesheet" href="css/app.css"/>

Main

About

Tools

Contact

ADMIN

©2014 Chicken Breast Meals | About | Privacy Policy and Disclosures | Contact | Total meals: {{meals.length}}


text:
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-comp-4041',
  templateUrl: './comp-4041.component.html',
  styleUrls: ['./comp-4041.component.css']
})
export class Comp4041Component implements OnInit {

  constructor() { }

  ngOnInit() {
  }

}


text:
#include <click/config.h>
#include <clicknet/wifi.h>
#include <click/etheraddress.hh>
#include <click/args.hh>
#include <click/error.hh>
#include <click/glue.hh>
#include <clicknet/llc.h>
#include <click/straccum.hh>
#include <click/vector.hh>
#include <click/hashmap.hh>
#include <click/packet_anno.hh>
#include <elements/wifi/availablerates.hh>
#include <elements/wifi/wirelessinfo.hh>
#include "beacontracker.hh"
CLICK_DECLS

BeaconTracker::BeaconTracker()
  : _winfo(0)
{
}

BeaconTracker::~BeaconTracker()
{
}

int
BeaconTracker::configure(Vector<String> &conf, ErrorHandler *errh)
{

  _debug = false;
  if (Args(conf, this, errh)
      .read("DEBUG", _debug)
      .read("WIRELESS_INFO", ElementCastArg("WirelessInfo"), _winfo)
      .read("TRACK", _track)
      .complete() < 0)
    return -1;

  reset();
  return 0;
}

Packet *
BeaconTracker::simple_action(Packet *p)
{
  uint8_t dir;
  uint8_t type;
  uint8_t subtype;

  if (p->length() < sizeof(struct click_wifi)) {
    click_chatter("%p{element}: packet too small: %d vs %d\n",
		  this,
		  p->length(),
		  sizeof(struct click_wifi));

    p->kill();
    return 0;

  }
  struct click_wifi *w = (struct click_wifi *) p->data();

  dir = w->i_fc[1] & WIFI_FC1_DIR_MASK;
  type = w->i_fc[0] & WIFI_FC0_TYPE_MASK;
  subtype = w->i_fc[0] & WIFI_FC0_SUBTYPE_MASK;

  if (type != WIFI_FC0_TYPE_MGT) {
    click_chatter("%p{element}: received non-management packet\n",
		  this);
    p->kill();
    return 0;
  }

  if (subtype != WIFI_FC0_SUBTYPE_BEACON && subtype != WIFI_FC0_SUBTYPE_PROBE_RESP) {
    click_chatter("%p{element}: received subtype %d packet\n",
		  this,
		  subtype);
    p->kill();
    return 0;
  }

  EtherAddress bssid = EtherAddress(w->i_addr3);

  if (_winfo->_bssid != bssid) {
    p->kill();
    return 0;
  }

  uint8_t *ptr;

  ptr = (uint8_t *) p->data() + sizeof(struct click_wifi);

  //uint8_t *ts = ptr;
  ptr += 8;

  uint16_t beacon_int = le16_to_cpu(*(uint16_t *) ptr);
  ptr += 2;

  struct beacon_t b;
  uint16_t seq = le16_to_cpu(w->i_seq) >> WIFI_SEQ_SEQ_SHIFT;

  b.rx = p->timestamp_anno();
  b.seq = seq;

  _beacons.push_back(b);
  _beacon_int = beacon_int;

  trim();
  return p;
}

void
BeaconTracker::trim()
{
  Timestamp earliest = Timestamp::now() - Timestamp::make_msec(_track * _beacon_int);
  while (_beacons.size() && _beacons[0].rx < earliest) {
    _beacons.pop_front();
  }

}

void
BeaconTracker::reset()
{
  _start.assign_now();
  _beacons.clear();
}

enum {H_DEBUG, H_SCAN, H_RESET, H_STATS,
      H_TRACK, H_BEACON_INTERVAL};

static String
read_param(Element *e, void *thunk)
{
  BeaconTracker *td = (BeaconTracker *)e;
    switch ((uintptr_t) thunk) {
    case H_DEBUG:
      return String(td->_debug) + "\n";
    case H_BEACON_INTERVAL:
      return String(td->_beacon_int) + "\n";
    case H_TRACK:
      return String(td->_track) + "\n";
    case H_STATS: {
      Timestamp now = Timestamp::now();
      td->trim();
      Timestamp diff = now - td->_start;
      int expected = WIFI_MIN(diff.msecval(), td->_track);
      int count = td->_beacons.size();
      int p = expected ? count*100/expected : 0;
      return String(p) + "\n";
    }

    default:
      return String();
    }
}
static int
write_param(const String &in_s, Element *e, void *vparam,
		      ErrorHandler *errh)
{
  BeaconTracker *f = (BeaconTracker *)e;
  String s = cp_uncomment(in_s);
  switch((intptr_t)vparam) {
  case H_DEBUG: {    //debug
    bool debug;
    if (!BoolArg().parse(s, debug))
      return errh->error("debug parameter must be boolean");
    f->_debug = debug;
    break;
  }
  case H_RESET: {    //reset
    f->reset();
  }
  }
  return 0;
}

void
BeaconTracker::add_handlers()
{
  add_read_handler("debug", read_param, H_DEBUG);
  add_read_handler("scan", read_param, H_SCAN);
  add_read_handler("stats", read_param, H_STATS);
  add_read_handler("track", read_param, H_TRACK);
  add_read_handler("beacon_interval", read_param, H_BEACON_INTERVAL);

  add_write_handler("debug", write_param, H_DEBUG);
  add_write_handler("reset", write_param, H_RESET, Handler::BUTTON);
}

CLICK_ENDDECLS
EXPORT_ELEMENT(BeaconTracker)


text:
/* global $ */

const X_API_KEY = "uLhcbhACxl86z5J3preLnckCOXhTSZ3hHUZeqxj0";
const SUBSCRIBE_URL =
  "https://wrywguckq5.execute-api.eu-west-1.amazonaws.com/prod/slack";

$(document).ready(function () {

  const slackFormEl = document.querySelector(".slack-form");
  const emailEl = slackFormEl.querySelector(".slack-field");
  const resultsEl = slackFormEl.querySelector(".slack-form__results");

  slackFormEl.addEventListener('submit', function (e){
    e.preventDefault();

    const emailValue = emailEl.value;

    if (!emailValue || !/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(emailValue)) {
      resultsEl.style.color = "red";
      resultsEl.innerHTML = "empty-email";
      return false;
    }

    $.ajax({
      method: "GET",
      url: SUBSCRIBE_URL,
      headers: {
        "x-api-key": X_API_KEY
      },
      data: {
        email: emailValue,
      }
    })
      .done(function(res) {
        if (res.error) {
          resultsEl.style.color = "red";
          if (res.error === "already_in_team") {
            resultsEl.innerHTML = "already_in_team";
          }

          if (res.error === "already_invited") {
            resultsEl.innerHTML = "already_invited";
          }
        } else {
          resultsEl.style.color = "lightgreen";
          resultsEl.innerHTML = "Thank you!";

          if (window.ga) {
            ga('send', 'event', 'Forms', 'Subscribe', 'Slack');
          }
        }
      })
      .fail(function() {
        resultsEl.style.color = "red";
        resultsEl.innerHTML = "Ooops. There is something wrong going on at the moment.";
      });
  })
});


text:
<?php

namespace BlueBayTravel\Tests\Feefo;

class FeefoTest extends AbstractTestCase
{
    public function testFetchReturnsFeefoObject()
    {
        $feedback = $this->app->feefo->fetch();

        $this->assertInstanceOf('BlueBayTravel\Feefo\Feefo', $feedback);
    }

    public function testFetchItemsAreFeefoItem()
    {
        $feedback = $this->app->feefo->fetch();

        $this->assertInstanceOf('BlueBayTravel\Feefo\FeefoItem', $feedback[0]);
    }

    public function testFetchWithParams()
    {
        $feedback = $this->app->feefo->fetch(['limit' => 9999, 'since' => 'year']);

        $this->assertInstanceOf('BlueBayTravel\Feefo\Feefo', $feedback);
        $this->assertInstanceOf('BlueBayTravel\Feefo\FeefoItem', $feedback[0]);
    }
}


text:
package com.intellij.util.xml.impl;

import javax.annotation.Nullable;

/**
 * @author peter
 */
public interface Invocation {
  @Nullable
  Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable;

}


text:
/* Adapted from https://github.com/json-path/JsonPath/blob/master/json-path/src/main/java/com/jayway/jsonpath/internal/path/ArraySliceToken.java */

#import "SMJArraySliceToken.h"

#import "SMJArraySliceOperation.h"

NS_ASSUME_NONNULL_BEGIN

/*
** SMJArraySliceToken
*/
#pragma mark - SMJArraySliceToken

@implementation SMJArraySliceToken
{
	SMJArraySliceOperation *_sliceOperation;
}

/*
** SMJArraySliceToken - Instance
*/
#pragma mark - SMJArraySliceToken - Instance

- (instancetype)initWithSliceOperation:(SMJArraySliceOperation *)sliceOperation
{
	self = [super init];

	if (self)
	{
		_sliceOperation = sliceOperation;
	}

	return self;
}

/*
** SMJArraySliceToken - SMJPathToken
*/
#pragma mark - SMJArraySliceToken - SMJPathToken

- (SMJEvaluationStatus)evaluateWithCurrentPath:(NSString *)currentPath parentPathRef:(SMJPathRef *)parent jsonObject:(id)jsonObject evaluationContext:(SMJEvaluationContextImpl *)context error:(NSError **)error
{
	SMJArrayPathCheck checkResult = [self checkArrayWithCurrentPathString:currentPath jsonObject:jsonObject evaluationContext:context error:error];

	if (checkResult == SMJArrayPathCheckSkip)
		return SMJEvaluationStatusDone;
	else if (checkResult == SMJArrayPathCheckError)
		return SMJEvaluationStatusError;

	switch (_sliceOperation.operation)
	{
		case SMJSliceOperationFrom:
			return [self sliceFromWithOperation:_sliceOperation currentPathString:currentPath parentPathRef:parent jsonObject:jsonObject evaluationContext:context error:error];

		case SMJSliceOperationBetween:
			return [self sliceBetweenWithOperation:_sliceOperation currentPathString:currentPath parentPathRef:parent jsonObject:jsonObject evaluationContext:context error:error];

		case SMJSliceOperationTo:
			return [self sliceToWithOperation:_sliceOperation currentPathString:currentPath parentPathRef:parent jsonObject:jsonObject evaluationContext:context error:error];
	}

	return SMJEvaluationStatusDone;
}

- (BOOL)isTokenDefinite
{
	return NO;
}

- (NSString *)pathFragment
{
	return [_sliceOperation stringValue];
}

/*
** SMJArraySliceToken - Helpers
*/
#pragma mark - SMJArraySliceToken - Helpers

- (SMJEvaluationStatus)sliceFromWithOperation:(SMJArraySliceOperation *)operation currentPathString:(NSString *)currentPath parentPathRef:(SMJPathRef *)parent jsonObject:(id)jsonObject evaluationContext:(SMJEvaluationContextImpl *)context error:(NSError **)error
{
	NSArray *array = jsonObject;
	NSInteger length = array.count;
	NSInteger from = operation.fromIndex;

	//calculate slice start from array length
	if (from < 0)
		from = length + from;

	from = MAX(0, from);

	//logger.debug("Slice from index on array with length: {}. From index: {} to: {}. Input: {}", length, from, length - 1, toString());

	if (length == 0 || from >= length)
		return SMJEvaluationStatusDone;

	for (NSInteger i = from; i < length; i++)
	{
		SMJEvaluationStatus result = [self handleArrayIndex:i currentPathString:currentPath jsonObject:jsonObject evaluationContext:context error:error];

		if (result == SMJEvaluationStatusError)
			return SMJEvaluationStatusError;
		else if (result == SMJEvaluationStatusAborted)
			return SMJEvaluationStatusAborted;
	}

	return SMJEvaluationStatusDone;
}

- (SMJEvaluationStatus)sliceBetweenWithOperation:(SMJArraySliceOperation *)operation currentPathString:(NSString *)currentPath parentPathRef:(SMJPathRef *)parent jsonObject:(id)jsonObject evaluationContext:(SMJEvaluationContextImpl *)context error:(NSError **)error
{
	NSArray *array = jsonObject;
	NSInteger length = array.count;
	NSInteger from = operation.fromIndex;
	NSInteger to = operation.toIndex;

	to = MIN(length, to);

	if (from >= to || length == 0)
	{
		return SMJEvaluationStatusDone;
	}

	//logger.debug("Slice between indexes on array with length: {}. From index: {} to: {}. Input: {}", length, from, to, toString());

	for (NSInteger i = from; i < to; i++)
	{
		SMJEvaluationStatus result = [self handleArrayIndex:i currentPathString:currentPath jsonObject:jsonObject evaluationContext:context error:error];

		if (result == SMJEvaluationStatusError)
			return SMJEvaluationStatusError;
		else if (result == SMJEvaluationStatusAborted)
			return SMJEvaluationStatusAborted;
	}

	return SMJEvaluationStatusDone;
}

- (SMJEvaluationStatus)sliceToWithOperation:(SMJArraySliceOperation *)operation currentPathString:(NSString *)currentPath parentPathRef:(SMJPathRef *)parent jsonObject:(id)jsonObject evaluationContext:(SMJEvaluationContextImpl *)context error:(NSError **)error
{
	NSArray		*array = jsonObject;
	NSInteger	length = array.count;

	if (length == 0)
		return SMJEvaluationStatusDone;

	NSInteger to = operation.toIndex;

	//calculate slice end from array length
	if (to < 0)
		to = length + to;

	to = MIN(length, to);

	//logger.debug("Slice to index on array with length: {}. From index: 0 to: {}. Input: {}", length, to, toString());

	for (NSInteger i = 0; i < to; i++)
	{
		SMJEvaluationStatus result = [self handleArrayIndex:i currentPathString:currentPath jsonObject:jsonObject evaluationContext:context error:error];

		if (result == SMJEvaluationStatusError)
			return SMJEvaluationStatusError;
		else if (result == SMJEvaluationStatusAborted)
			return SMJEvaluationStatusAborted;
	}

	return SMJEvaluationStatusDone;
}

@end

NS_ASSUME_NONNULL_END


text:
from google.cloud import datalabeling_v1beta1

def sample_list_annotation_spec_sets():
    # Create a client
    client = datalabeling_v1beta1.DataLabelingServiceClient()

    # Initialize request argument(s)
    request = datalabeling_v1beta1.ListAnnotationSpecSetsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_annotation_spec_sets(request=request)

    # Handle the response
    for response in page_result:
        print(response)

# [END datalabeling_v1beta1_generated_DataLabelingService_ListAnnotationSpecSets_sync]


text: <button type="submit" class="btn">foo</button>


text:
package com.android.tools.lint.checks;

import static com.android.SdkConstants.ANDROID_URI;
import static com.android.SdkConstants.ATTR_LAYOUT_HEIGHT;
import static com.android.SdkConstants.ATTR_LAYOUT_WIDTH;
import static com.android.SdkConstants.VALUE_WRAP_CONTENT;
import static com.android.SdkConstants.WEB_VIEW;

import com.android.annotations.NonNull;
import com.android.tools.lint.detector.api.Category;
import com.android.tools.lint.detector.api.Implementation;
import com.android.tools.lint.detector.api.Issue;
import com.android.tools.lint.detector.api.LayoutDetector;
import com.android.tools.lint.detector.api.Location;
import com.android.tools.lint.detector.api.Scope;
import com.android.tools.lint.detector.api.Severity;
import com.android.tools.lint.detector.api.Speed;
import com.android.tools.lint.detector.api.XmlContext;

import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

import java.util.Collection;
import java.util.Collections;

public class WebViewDetector extends LayoutDetector {
    private static final Implementation IMPLEMENTATION = new Implementation(
            WebViewDetector.class,
            Scope.RESOURCE_FILE_SCOPE);

    /** The main issue discovered by this detector */
    public static final Issue ISSUE = Issue.create(
            "WebViewLayout", //$NON-NLS-1$
            "WebViews in wrap_content parents",

            "The WebView implementation has certain performance optimizations which will not " +
            "work correctly if the parent view is using `wrap_content` rather than " +
            "`match_parent`. This can lead to subtle UI bugs.",

            Category.CORRECTNESS,
            7,
            Severity.ERROR,
            IMPLEMENTATION);

    /** Constructs a new {@link WebViewDetector} */
    public WebViewDetector() {
    }

    @NonNull
    @Override
    public Speed getSpeed() {
        return Speed.FAST;
    }

    @Override
    public Collection<String> getApplicableElements() {
        return Collections.singletonList(WEB_VIEW);
    }

    @Override
    public void visitElement(@NonNull XmlContext context, @NonNull Element element) {
        Node parentNode = element.getParentNode();
        if (parentNode != null && parentNode.getNodeType() == Node.ELEMENT_NODE) {
            Element parent = (Element)parentNode;
            Attr width = parent.getAttributeNodeNS(ANDROID_URI, ATTR_LAYOUT_WIDTH);
            Attr height = parent.getAttributeNodeNS(ANDROID_URI, ATTR_LAYOUT_HEIGHT);
            Attr attr = null;
            if (width != null && VALUE_WRAP_CONTENT.equals(width.getValue())) {
                attr = width;
            }
            if (height != null && VALUE_WRAP_CONTENT.equals(height.getValue())) {
                attr = height;
            }
            if (attr != null) {
                String message = String.format("Placing a `<WebView>` in a parent element that "
                        + "uses a `wrap_content %1$s` can lead to subtle bugs; use `match_parent` "
                        + "instead", attr.getLocalName());
                Location location = context.getLocation(element);
                Location secondary = context.getLocation(attr);
                secondary.setMessage("`wrap_content` here may not work well with WebView below");
                location.setSecondary(secondary);
                context.report(ISSUE, element, location, message);
            }
        }
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>MNE-CPP: D:/Users/Christoph/GitHub/mne-cpp/MNE/rtInv/rtave.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

MNE-CPP
    beta 1.0

Main Page

Related Pages

Modules

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

File Members

MNE

rtInv

Classes |
Macros |
Functions

rtave.h File Reference

RtAve class declaration.
More...

#include "rtinv_global.h"

#include <fiff/fiff_evoked.h>

#include <fiff/fiff_info.h>

#include <generics/circularmatrixbuffer.h>

#include <QThread>

#include <QMutex>

#include <QSharedPointer>

#include <QSet>

#include <QList>

#include <Eigen/Core>

Go to the source code of this file.

Classes

class  	RTINVLIB::RtAve

 	Real-time averaging helper.  More...

Functions

 	Q_DECLARE_METATYPE (FIFFLIB::FiffEvoked::SPtr)

Detailed Description

RtAve class declaration.

Author

Christoph Dinh chdin.nosp@m.h@nm.nosp@m.r.mgh.nosp@m..har.nosp@m.vard..nosp@m.edu; Matti Hamalainen msh@n.nosp@m.mr.m.nosp@m.gh.ha.nosp@m.rvar.nosp@m.d.edu

Version

1.0

Date

July, 2012

LICENSE

Copyright (C) 2012, Christoph Dinh and Matti Hamalainen. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of MNE-CPP authors nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file rtave.h.

Function Documentation

          Q_DECLARE_METATYPE
          (
          FIFFLIB::FiffEvoked::SPtr
          	)

Provides QT META type declaration of the FIFFLIB::FiffEvoked type. For signal/slot usage.

<address class="footer">
Generated on Fri Mar 27 2015 22:54:36 for MNE-CPP by

 1.8.9.1
</address>


text: CREATE VIEW IF NOT EXISTS v AS SELECT 1


text:
docker build --rm=true -t gchiam/openjdk:8 .
docker build --rm=true -t gchiam/openjdk:latest .


text:
package visualtools.connectors;

import java.io.File;
import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * The SOLR tool is the component to talk to zookeeper and to use the
 * solrctl command on a cluster Gateway-Node.
 *
 * @author kamir
 */
public class SOLRTool extends ClusterGateway {

    static String GWHOST = "training09.mtv.cloudera.com";

    //static String ZK = "172.16.14.228:2181/solr";
    static String ZK = "training01.sjc.cloudera.com:2181,training03.sjc.cloudera.com:2181,training06.sjc.cloudera.com:2181/solr";

    static String SOLR = "127.0.0.1:8983/solr";

    // path on Gateway server in which all files are stored before ZOOKEEPER upload.
    static String HOME = "/home/mirko.kaempf";

    // path of Collections in HDFS
    static String DATAHOME = "/solr";

    /**
     * The default number of shards for collection creation.
     */
    static int SHARDS = 1;

    public static String projectContext = null;

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {

        // We do the core management on the cluster.
        // An SSH login to a GatewayNode is required.

        String collection = "FAQMails02";

        SOLRTool.init( GWHOST , "mirko.kaempf" , null );
//        SOLRTool.init( "127.0.0.1" , "cloudera" , "cloudera" );

        // SOLRTool.prepareCollection( "127.0.0.1:2181/solr", collection );

        SOLRTool.close();

        bw.flush();

        System.exit( 0 );

    }

    public static void listCollection() {
        listCollection( true );
    }

    public static void listCollection(boolean closeAtEnd) {

//        String cmd1 = "solrctl --solr " + SOLR + " --zk " + ZK + " instancedir --list";
        String cmd1 = "solrctl --zk " + ZK + " instancedir --list";

        if ( bw != null ) {
            try {
                bw.write(cmd1 + "\n");
            }
            catch (IOException ex) {
                Logger.getLogger(SOLRTool.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        tool.open();

        tool.executeRemoteCommand( cmd1 );

        if( closeAtEnd ) tool.close();

    }

    /**
     * The current collection has to be optimized and copied to local disc for
     * DOWNLOAD and of data and configuration.
     *
     * @param zk
     * @param coll
     */
    public static void packageCollection(String zk, String coll) {

        tool.open();

        String locationOfCFG =  HOME + "/" + coll + "SearchConfig";

        String locationOfDATA = DATAHOME + "/" + coll + "Collection";

        System.out.println( ">> Instancedir: " + locationOfCFG );
        System.out.println(  ">> Datadir:    " + locationOfDATA );

        String tempDirName = System.currentTimeMillis() + ".stage";

        tool.executeRemoteCommand( "mkdir " + "/data/2/tmp/" + tempDirName );
        tool.executeRemoteCommand( "mkdir " + "/data/2/tmp/" + tempDirName + "/data" );

        tool.executeRemoteCommand( "cp -r " + locationOfCFG + " /data/2/tmp/" + tempDirName + "/cfg/" );
        tool.executeRemoteCommand( "hadoop fs -get " + locationOfDATA + " /data/2/tmp/" + tempDirName + "/data/" );

        tool.executeRemoteCommand( "tar cfzv /data/2/tmp/TTFAQ_package_" + tempDirName + ".tar.gz /data/2/tmp/" + tempDirName );

        tool.executeRemoteCommand( "ls -sh /data/2/tmp/");

        tool.scpTo(zk, zk, coll);

    }

    public static void prepareCollection(String zk, String coll) {

//        String cmd1 = "solrctl --solr " + SOLR + " --zk " + ZK + " instancedir --generate " + HOME + "/" + coll + "SearchConfig";
//       String cmd2 = "solrctl --solr " + SOLR + " --zk " + ZK + " instancedir --create " + coll + "Collection " + HOME + "/" + coll + "SearchConfig";
//        String cmd3 = "solrctl --solr " + SOLR + " --zk " + ZK + " collection --create " + coll + "Collection -s " + SHARDS;
        String cmd1 = "solrctl --zk " + ZK + " instancedir --generate " + HOME + "/" + coll + "SearchConfig";
        String cmd2 = "solrctl --zk " + ZK + " instancedir --create " + coll + "Collection " + HOME + "/" + coll + "SearchConfig";
        String cmd3 = "solrctl --zk " + ZK + " collection --create " + coll + "Collection -s " + SHARDS;

        if ( bw != null ) {
            try {
                bw.write(cmd1 + "\n");
                bw.write(cmd2 + "\n");
                bw.write(cmd3 + "\n");
            }
            catch (IOException ex) {
                Logger.getLogger(SOLRTool.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        tool.open();

        tool.executeRemoteCommand( cmd1 );

        tool.executeRemoteCommand( cmd2 );

        tool.executeRemoteCommand( cmd3 );

        tool.executeRemoteCommand( "ls " + HOME );

        tool.executeRemoteCommand( "solrctl collection --list");

        tool.close();

        downloadSchema( HOME + "/" + coll + "SearchConfig" );

    }

    public static void uploadAndPublish(String coll) {

        // copy the localy changed shema file
        String fnRemote = HOME + "/" + coll + "SearchConfig/conf/schema.xml";
        String fnLocal = projectContext + "/conf/schema.xml";

        System.out.println("Project context : " + projectContext);
        System.out.println("local file      : " + fnLocal);
        System.out.println("remote file     : " + fnRemote);

//        String cmd3 = "solrctl --solr " + SOLR + " --zk " + ZK + " instancedir --update " + coll + "Collection " + HOME + "/" + coll + "SearchConfig"; // -s " + SHARDS;
//        String cmd4 = "solrctl --solr " + SOLR + " --zk " + ZK + " collection --reload " + coll + "Collection"; // -s " + SHARDS;
        String cmd3 = "solrctl --zk " + ZK + " instancedir --update " + coll + "Collection " + HOME + "/" + coll + "SearchConfig"; // -s " + SHARDS;
        String cmd4 = "solrctl --zk " + ZK + " collection --reload " + coll + "Collection"; // -s " + SHARDS;

        tool.open();
        tool.scpTo(fnLocal, fnRemote, cmd3);
        tool.executeRemoteCommand(cmd4);

        if ( bw != null ) {
            try {
                bw.write(cmd3 + "\n");
                bw.write(cmd4 + "\n");
            }
            catch (IOException ex) {
                Logger.getLogger(SOLRTool.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

    }

    public static void downloadSchema(String path) {

        // remote file
        String fnRemote = path + "/conf/schema.xml";
        String fnLocal = projectContext + "/conf/schema.xml";

        javax.swing.JOptionPane.showMessageDialog(
                null, "If not done locally already, than please copy from (remote): \n\t" + fnRemote + "\nto (local):\n\t" + fnLocal);

    }

    public static void setProjectContext(File selectedFile) {
        projectContext = selectedFile.getAbsolutePath();
    }

    /**
     *
     * TODO:
     *
     * All available Collection should be listed, followed by the number
     * of documents in it.
     */
    public static void openCollectionListFrame() {

    }

    public static void flushDebugScript() throws IOException {
        bw.flush();
        bw.close();
        initDebugScripter();
    }

    public static void closeDebugScript() throws IOException {
        bw.flush();
        bw.close();
    }

}