text:
Import-export tags and alerts from a Logentries account to an other.

##Features

- export tags and alerts from an account into a file
- import tags and alerts into an account from a file or an other account
- skip the demo tags
- change alert target emails on import
- change alert rate and report settings on import
- attach tags and alerts to a log or to a whole logset
- prevent tag duplication (if there is one with the same name)
- bundled with default alert and log settings for Heroku

## Usage
The migrator requires a working `NodeJS >= 4` environment and an NPM install.

```bash
npm install -g logentries-migrator
```

All migration commands need an account id which you can find in the Logentries UI *Account settings / Profile / Account key*.

To migrate a Logentries account from Heroku you could use [this guide](https://github.com/emartech/logentries-migrator/blob/master/migration-from-heroku.md).

### Export
You can export alerts and tags from an account in `json` format. It could be used as a backup or a source for importing later.

`logentries-migrator export --account_key 11111111-2222-3333-4444-555555555555 --output output.json`

#### Arguments
```bash
--account_key  Account key to get the data from [required]
--output       Filename to export the data      [required]
--help         Show help
```

### Import
You can import alerts and tags from an account directly or from a previously saved `json` file. You can also save the exported settings to a file without using the `export` command explicitly.

`logentries-migrator import --account_key 11111111-2222-3333-4444-555555555555 --target_account_key 91111111-2222-3333-4444-555555555555 --log_set 'Sample logset' --log 'Sample logs' --alert_emails 'sample@sample.com' --alert_rate_count 11 --alert_rate_range 'hour' --alert_limit_count 22 --alert_limit_range 'hour' --output 'backup.json'`

#### Arguments

```bash
--account_key         Account key to get the data from. This or the input
                      argument should be provided!
--output              Filename to dump the exported data to later use
--input               Filename for import the data from. This or the
                      account_key argument should be provided!
--target_account_key  The account key to import the data [required]
--log_set             Add the alerts to the logs of the specified log set
--log                 Add the alerts to a log. The log_set argument should be
                      provided to use this option!
--alert_emails        Set the direct mail alerts to the specified email
                      instead of the exported one. It could contain multiple
                      emails, eg. 'sample@sample.com,sample2@sample.com'
--alert_rate_count    Override the exported alert rate count
--alert_rate_range    Override the exported alert rate range [choices: "day", "hour"]
--alert_limit_count   Override the exported alert limit count
--alert_limit_range   Override the exported alert limit range [choices: "day", "hour"]
```

### Import default Heroku tags & alerts
For a new Heroku app it's good to have predefined alerts and tags for the Heroku error codes. You can find a `heroku-defaults.json` in the repository root which contains default settings for all of these. If you are importing these defaults make sure that you provided an email address otherwise there will be e-mail alerts to a not existing mailbox.

```logentries-migrator import --input heroku-defaults.json --alert_emails "EMAIL_FOR_ALERTS" --log_set "YOUR_LOG_SET" --target_account_key YOUR_ACCOUNT_ID```


text:
require 'rails_helper'

describe 'PUT /services/:service_id/categories' do
  before(:all) do
    create_service
    @food = Category.create!(name: 'Food', oe_id: '101')
  end

  after(:all) do
    Organization.find_each(&:destroy)
    Category.find_each(&:destroy)
  end

  context 'when the passed in oe_id exists' do
    it "updates a service's categories" do
      put(
        api_service_categories_url(@service, subdomain: ENV['API_SUBDOMAIN']),
        oe_ids: ['101']
      )
      expect(response).to be_success
      expect(json['categories'].first['name']).to eq('Food')
    end
  end

  context "when the passed in oe_id doesn't exist" do
    it 'ignores it' do
      put(
        api_service_categories_url(@service, subdomain: ENV['API_SUBDOMAIN']),
        oe_ids: ['102']
      )
      expect(response.status).to eq(200)
      expect(json['categories']).to eq([])
    end
  end

  context 'without a valid token' do
    it 'returns a 401 error' do
      put(
        api_service_categories_url(@service, subdomain: ENV['API_SUBDOMAIN']),
        { oe_ids: ['101'] },
        'HTTP_X_API_TOKEN' => 'foo'
      )
      expect(response.status).to eq(401)
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
import contracts.IBoatSimulatorController;
import contracts.Printer;
import contracts.Reader;
import controllers.BoatSimulatorController;
import core.CommandHandler;
import core.Engine;
import io.TerminalPrinter;
import io.TerminalReader;

public class Main {

	public static void main(String[] args) {

		IBoatSimulatorController controller = new BoatSimulatorController();

		CommandHandler commandHandler = new CommandHandler(controller);

		Reader reader = new TerminalReader();

		Printer printer = new TerminalPrinter();

		Engine engine = new Engine(commandHandler, reader, printer);

		engine.run();

	}

}


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>org.apache.lucene.codecs.idversion (Lucene 6.0.1 API)</title>
<meta name="date" content="2016-05-23">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

org.apache.lucene.codecs.idversion

Classes

IDVersionPostingsFormat

IDVersionSegmentTermsEnum

VersionBlockTreeTermsReader

VersionBlockTreeTermsWriter


text:
package org.itas.core.bytecode;

import javassist.CtClass;
import javassist.CtField;

import org.itas.core.annotation.Size;

/**
 * String数据[field]类型字节码动态生成
 * @author liuzhen(liuxing521a@gmail.com)
 * @crateTime 2015年2月26日下午5:35:21
 */
class FDStringProvider extends AbstractFieldProvider
		implements FieldProvider, TypeProvider {

	private static final String STATEMENT_SET = new StringBuffer()
		.append(next(1, 2)).append("state.setString(%s, get%s());")
		.toString();

	private static final String RESULTSET_GET = new StringBuffer()
		.append(next(1, 2)).append("set%s(result.getString(\"%s\"));")
		.toString();

	public static final FDStringProvider PROVIDER = new FDStringProvider();

	private FDStringProvider() {
	}

	@Override
	public boolean isType(Class<?> clazz) {
		return javaType.string_ == clazz;
	}

	@Override
	public boolean isType(CtClass clazz) {
		return javassistType.string_ == clazz;
	}

	@Override
	public String sqlType(CtField field) throws Exception {
		Object aSize = field.getAnnotation(Size.class);
		int size = (aSize == null) ? 36 : ((Size)aSize).value();
		return String.format("`%s` VARCHAR(%s) NOT NULL DEFAULT ''", field.getName(), size);
	}

	@Override
	public String setStatement(int index, CtField field) {
		return String.format(STATEMENT_SET, index, upCase(field.getName()));
	}

	@Override
	public String getResultSet(CtField field) {
		return String.format(RESULTSET_GET, upCase(field.getName()), field.getName());
	}

}


text:
define(['jquery'], function() {

  function successFn(xhr) {
  		return function() {

			console.log(xhr.readyState, xhr.status);
  		if(xhr.readyState === 4 && xhr.status === 200) {
  			console.log(xhr.responseText);
  		}};
  };

  function myAjax(url) {
  	var xhr = new XMLHttpRequest();
  	xhr.onreadystatechange = successFn(xhr);
  	xhr.open("GET", url);
  	xhr.send();
  };

  myAjax("/api/widgets");

});

/*

define(['jquery'], function() {

	var xhr = new XMLHttpRequest();

	xhr.onreadystatechange = function() {

		console.log(xhr.readyState, xhr.status);

		if(xhr.readyState === 4 && xhr.status === 200) {
			console.log(xhr.responseText);
		}
	};

	xhr.open("GET", "/api/widgets");
	xhr.send();

	$.ajax("/api/widgets").success(function() {
		console.log(arguments);

	//request("/api/widgets").then(function() {
	//		console.log(arguments);
	//	});

	});
});

*/


text:
<title>IM_STRETCH3(3) manual page</title>

Table of Contents

Name

im_stretch3 -  stretch horizontally by 3%, displace sub-pixel mask

Synopsis

#include
<vips/vips.h>

 int im_stretch3( in, out, xdisp, ydisp )

IMAGE *in, *out;

double xdisp, ydisp;

Description

im_stretch3() stretches the input image
by 3% horizontally, and displaces it by xdisp/ydisp. It uses bi-cubic interpolation,
but runs quickly. It works only for unsigned short images.

 This function
is part of the MARC acquisition software, but is generally useful for squaring
up the pixels in images from the Kontron ProgRes camera range.

Return Value

The
function returns 0 on success and -1 on error.

See Also

im_conv(3)
, im_shrink(3)
.

Copyright

The National Gallery, 1997

Table of Contents

Name

Synopsis

Description

Return Value

See Also

Copyright


text:
package br.com.tgoc.tgocmessage;

/**
 * Created by rodrigocavalcante on 9/5/16.
 */
public interface TGOCMessageActivityTypingInterface {
    boolean isTyping();
    TGOCBubbleInterface typingBubble();
    String typingText();
    TGOCAvatarInterface typingAvatar();
}


text:
package org.kie.workbench.drools.backend.server;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Named;

import org.guvnor.common.services.backend.metadata.attribute.OtherMetaView;
import org.guvnor.messageconsole.backend.DefaultIndexEngineObserver;
import org.jboss.errai.security.shared.api.identity.User;
import org.jboss.errai.security.shared.api.identity.UserImpl;
import org.jboss.errai.security.shared.service.AuthenticationService;
import org.uberfire.backend.server.IOWatchServiceNonDotImpl;
import org.uberfire.commons.cluster.ClusterServiceFactory;
import org.uberfire.commons.services.cdi.Startup;
import org.uberfire.commons.services.cdi.StartupType;
import org.uberfire.ext.metadata.backend.lucene.LuceneConfig;
import org.uberfire.ext.metadata.io.IOSearchServiceImpl;
import org.uberfire.ext.metadata.io.IOServiceIndexedImpl;
import org.uberfire.ext.metadata.search.IOSearchService;
import org.uberfire.io.IOService;
import org.uberfire.io.attribute.DublinCoreView;
import org.uberfire.io.impl.cluster.IOServiceClusterImpl;
import org.uberfire.java.nio.base.version.VersionAttributeView;
import org.uberfire.security.authz.AuthorizationManager;
import org.uberfire.security.impl.authz.RuntimeAuthorizationManager;

@Startup(StartupType.BOOTSTRAP)
@ApplicationScoped
public class ApplicationScopedProducer {

    private IOService ioService;
    private IOSearchService ioSearchService;
    private AuthorizationManager authorizationManager = new RuntimeAuthorizationManager();

    @Inject
    @Named("luceneConfig")
    private LuceneConfig config;

    @Inject
    private IOWatchServiceNonDotImpl watchService;

    @Inject
    @Named("clusterServiceFactory")
    private ClusterServiceFactory clusterServiceFactory;

    @Inject
    private AuthenticationService authenticationService;

    @Inject
    private DefaultIndexEngineObserver defaultIndexEngineObserver;

    public ApplicationScopedProducer() {
        if ( System.getProperty( "org.uberfire.watcher.autostart" ) == null ) {
            System.setProperty( "org.uberfire.watcher.autostart", "false" );
        }
        if ( System.getProperty( "org.kie.deployment.desc.location" ) == null ) {
            System.setProperty( "org.kie.deployment.desc.location", "classpath:META-INF/kie-wb-deployment-descriptor.xml" );
        }
    }

    @PostConstruct
    public void setup() {
        final IOService service = new IOServiceIndexedImpl( watchService,
                                                            config.getIndexEngine(),
                                                            defaultIndexEngineObserver,
                                                            DublinCoreView.class,
                                                            VersionAttributeView.class,
                                                            OtherMetaView.class );

        if ( clusterServiceFactory == null ) {
            ioService = service;
        } else {
            ioService = new IOServiceClusterImpl( service,
                                                  clusterServiceFactory,
                                                  false );
        }

        this.ioSearchService = new IOSearchServiceImpl( config.getSearchIndex(),
                                                        ioService );
    }

    @Produces
    @Named("ioStrategy")
    public IOService ioService() {
        return ioService;
    }

    @Produces
    @Named("ioSearchStrategy")
    public IOSearchService ioSearchService() {
        return ioSearchService;
    }

    @Produces
    public AuthorizationManager getAuthManager() {
        return authorizationManager;
    }

    @Produces
    @RequestScoped
    public User getIdentity() {
        try {
            return authenticationService.getUser();
        } catch ( final IllegalStateException ex ) {
            return new UserImpl( "system" );
        }
    }

}


text:
> These files required for grunt installation and basic settings

## Clone This Repo...

```shell
git clone https://github.com/Csharlie/grunt-template.git
```

## and install grunt

```shell
npm install -g grunt-cli@latest
```

```shell
npm install
```


text:
from carepoint import Carepoint
from sqlalchemy import (Column,
                        Integer,
                        String,
                        Boolean,
                        ForeignKey,
                        )

class FdbGcnSeq(Carepoint.BASE):
    __tablename__ = 'fdrgcnseq'
    __dbname__ = 'cph'

    gcn_seqno = Column(
        Integer,
        primary_key=True,
        autoincrement=False,
    )
    hic3 = Column(String)
    hicl_seqno = Column(Integer)
    gcdf = Column(
        String,
        ForeignKey('fdrdosed.gcdf'),
    )
    gcrt = Column(
        String,
        ForeignKey('fdrrouted.gcrt'),
    )
    str = Column(String)
    gtc = Column(Integer)
    tc = Column(Integer)
    dcc = Column(Integer)
    gcnseq_gi = Column(Integer)
    gender = Column(Integer)
    hic3_seqn = Column(Integer)
    str60 = Column(String)
    update_yn = Column(Boolean)


text:
package com.cloudera.testio;

import org.junit.Test;

import com.cloudera.util.Benchmark;

/**
 * There are three formats for handling blobs of data. Which is the most
 * efficient, which are the most convenient and which are the cheapest to
 * translate to and from?
 *
 */

// String --------> 1.3s 1.4 1.3 --------> 7.7Mops/s
// StringBuffer --> 1.2s 1.2 1.2 --------> 8.3Mops/s
// StringBuilder -> .75s 0.77 .78 ------> 13.0Mops/s
// StringFormat --> 13.9s 14.3 15.7 -----> 0.7Mops/s

public class PerfStringAppends {

  int times = 10000000;

  String base = "this is a test";

  @Test
  public void testStringAppend() {
    Benchmark b = new Benchmark("String Append");

    b.mark("begin");
    for (int i = 0; i < times; i++) {
      @SuppressWarnings("unused")
      String temp = base + i;
    }
    b.mark("after " + times);
    b.done();
  }

  @Test
  public void testStringBufferAppend() {
    StringBuffer buf = new StringBuffer(base);
    Benchmark b = new Benchmark("StringBuffer Append");

    b.mark("begin");
    for (int i = 0; i < times; i++) {
      buf.append(i);
    }
    b.mark("after " + times);
    b.done();
  }

  @Test
  public void testStringBuilderAppend() {
    StringBuilder buf = new StringBuilder(base);
    Benchmark b = new Benchmark("StringBuffer Append");

    b.mark("begin");
    for (int i = 0; i < times; i++) {
      buf.append(i);
    }
    b.mark("after " + times);
    b.done();
  }

  @Test
  public void testStringFormat() {
    String format = "%s%d";
    Benchmark b = new Benchmark("StringFormatAppend");

    b.mark("begin");
    for (int i = 0; i < times; i++) {
      String.format(format, base, i);
    }
    b.mark("after " + times);
    b.done();

  }

  @Test
  public void testStringAppend2() {
    Benchmark b = new Benchmark("String Append");

    b.mark("begin");
    for (int i = 0; i < times; i++) {
      @SuppressWarnings("unused")
      String temp = base + i;
    }
    b.mark("after " + times);
    b.done();
  }

  @Test
  public void testStringBufferAppend2() {
    StringBuffer buf = new StringBuffer(base);
    Benchmark b = new Benchmark("StringBuffer Append");

    b.mark("begin");
    for (int i = 0; i < times; i++) {
      buf.append(i);
    }
    b.mark("after " + times);
    b.done();
  }

  @Test
  public void testStringBuilderAppend2() {
    StringBuilder buf = new StringBuilder(base);
    Benchmark b = new Benchmark("StringBuffer Append");

    b.mark("begin");
    for (int i = 0; i < times; i++) {
      buf.append(i);
    }
    b.mark("after " + times);
    b.done();
  }

  @Test
  public void testStringFormat2() {
    String format = "%s%d";
    Benchmark b = new Benchmark("StringFormatAppend");

    b.mark("begin");
    for (int i = 0; i < times; i++) {
      String.format(format, base, i);
    }
    b.mark("after " + times);
    b.done();

  }

}


text:
const locale = {
    placeholder: 'Izaberite vreme',
};
export default locale;


text:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Untangled Component Demo Cards</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<script src="js/guide.js"></script>
</body>
</html>


text:
> GitHub repos cross compare references

[![Travis CI][travis-image]][travis-url] [![Quality][codeclimate-image]][codeclimate-url] [![Coverage][codeclimate-coverage-image]][codeclimate-coverage-url] [![Dependencies][gemnasium-image]][gemnasium-url] [![Gitter][gitter-image]][gitter-url]

## Usage

* [tomchentw's React repos][tomchentws_react_repos]
* [React v.s. Angular v.s. Backbone v.s. Ember][react_vs_angular_vs_backbone_vs_ember]
* [13 Top Flux Implementations][13_top_flux_implementations]
* [Comparison of CSS in JS Libraries][comparasion_of_css_in_js_libraries]

## Development

```shell
git clone ...
npm install
npm start
```

Then open [http://localhost:8080](http://localhost:8080).

Also hosted on [Parse Cloud Code](https://xrossref.parseapp.com).

## Credits

* [flux-implementations-spreadsheet][flux-implementations-spreadsheet] from [social-tables-tech-13-top-flux-implementations][social-tables-tech-13-top-flux-implementations] on Medium
* [Comparison of CSS in JS Libraries for React][comparasion_of_css_in_js_libraries_for_react] from [Radium][Radium]

[flux-implementations-spreadsheet]: https://docs.google.com/spreadsheets/d/1AddJl_vMnCHgdAbabMoIJ087xHuBwJ9jQMfA0mDD_D8/edit#gid=0
[social-tables-tech-13-top-flux-implementations]: https://medium.com/social-tables-tech/we-compared-13-top-flux-implementations-you-won-t-believe-who-came-out-on-top-1063db32fe73
[comparasion_of_css_in_js_libraries_for_react]: https://github.com/FormidableLabs/radium/blob/1dc17336e5d5a1232239c57ff5653a176f330ddd/docs/comparison/README.md
[Radium]: http://projects.formidablelabs.com/radium/

## Contributing

[![devDependency Status][david-dm-image]][david-dm-url]

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

[travis-image]: https://img.shields.io/travis/tomchentw/xrossref.svg?style=flat-square
[travis-url]: https://travis-ci.org/tomchentw/xrossref
[codeclimate-image]: https://img.shields.io/codeclimate/github/tomchentw/xrossref.svg?style=flat-square
[codeclimate-url]: https://codeclimate.com/github/tomchentw/xrossref
[codeclimate-coverage-image]: https://img.shields.io/codeclimate/coverage/github/tomchentw/xrossref.svg?style=flat-square
[codeclimate-coverage-url]: https://codeclimate.com/github/tomchentw/xrossref
[gemnasium-image]: https://img.shields.io/gemnasium/tomchentw/xrossref.svg?style=flat-square
[gemnasium-url]: https://gemnasium.com/tomchentw/xrossref
[gitter-image]: https://badges.gitter.im/Join%20Chat.svg
[gitter-url]: https://gitter.im/tomchentw/xrossref?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[david-dm-image]: https://img.shields.io/david/dev/tomchentw/xrossref.svg?style=flat-square
[david-dm-url]: https://david-dm.org/tomchentw/xrossref#info=devDependencies

[tomchentws_react_repos]: https://tomchentw.github.io/xrossref/#dG9tY2hlbnR3L3JlYWN0LWdvb2dsZS1tYXBzLCB0b21jaGVudHcvcmVhY3QtdG9hc3RyLCB0b21jaGVudHcvcmVhY3QtcHJpc20=
[react_vs_angular_vs_backbone_vs_ember]: https://tomchentw.github.io/xrossref/#ZmFjZWJvb2svcmVhY3QsIGFuZ3VsYXIvYW5ndWxhci5qcywgamFzaGtlbmFzL2JhY2tib25lLCBlbWJlcmpzL2VtYmVyLmpz
[13_top_flux_implementations]: https://tomchentw.github.io/xrossref/#YWNkbGl0ZS9mbHVtbW94LCBnb2F0c2xhY2tlci9hbHQsIEJpbmFyeU11c2UvZmx1eHhvciwgYWRkdGhpcy9mbHV4dGhpcywgbWFydHlqcy9tYXJ0eSwga2Vud2hlZWxlci9tY2ZseSwgeWFob28vZmx1eGlibGUsIGRlbG9yZWFuanMvZGVsb3JlYW4sIExlYW5LaXQtTGFicy9sdXguanMsIHNwb2lrZS9yZWZsdXhqcywgb21uaXNjaWVudGpzL29tbmlzY2llbnQsIGptcmVpZHkvZmx1eHksIGF6dS9tYXRlcmlhbC1mbHV4
[comparasion_of_css_in_js_libraries]: https://tomchentw.github.io/xrossref/#Rm9ybWlkYWJsZUxhYnMvcmFkaXVtLCBqcy1uZXh0L3JlYWN0LXN0eWxlLCBtYXJ0aW5hbmRlcnQvcmVhY3QtaW5saW5lLCBwZXRlaHVudC9qc3hzdHlsZSwganNzdHlsZXMvcmVhY3QtanNzLCBXaWxkaG9uZXkvUmVhY3RTaGFkb3csIHJhcGhhbW9yaW0vbmF0aXZlLWNzcywgZXJpY3dvb2xleS9yZWFjdC1pbi1zdHlsZSwgamh1ZHNvbjgvcmVhY3QtY3NzLWJ1aWxkZXIsIGJsYWtlZW1icmV5L3JlYWN0LWZyZWUtc3R5bGUsIFJpY2tXb25nL3JlYWN0LWlubGluZS1jc3MsIGVsaWVyb3RlbmJlcmcvcmVhY3Qtc3RhdGljcy1zdHlsZXMsIG5pY2svcmVhY3Qtc3R5bCwgaGFja2hhdC9zbWFydC1jc3MsIGtvZHlsL3N0aWxy


text:
package com.flipkart.connekt.busybees.tests.streams.topologies

import java.util.UUID
import java.util.concurrent.atomic.AtomicLong

import akka.http.scaladsl.model._
import akka.http.scaladsl.model.headers.RawHeader
import akka.stream.scaladsl.{Sink, Source}
import com.fasterxml.jackson.databind.node.ObjectNode
import com.flipkart.connekt.busybees.models.GCMRequestTracker
import com.flipkart.connekt.busybees.streams.flows.dispatchers.HttpDispatcher
import com.flipkart.connekt.busybees.tests.streams.TopologyUTSpec
import com.flipkart.connekt.commons.metrics.Instrumented
import com.flipkart.connekt.commons.services.{ConnektConfig, KeyChainManager}
import com.flipkart.connekt.commons.utils.StringUtils._
import org.scalatest.Ignore

import scala.concurrent.Await
import scala.concurrent.duration._

@Ignore
class RepeatSource2GCMBenchmarkTopologyTest extends TopologyUTSpec with Instrumented {

  override def beforeAll() = {
    super.beforeAll()
    HttpDispatcher.init(ConnektConfig.getConfig("react").get)
  }

  val counter: AtomicLong = new AtomicLong(0)
  "RepeatSource2GCMBenchmarkTopologyTest" should "log gcm dispatch rates for a vanilla graph" in {
    val source = Source.repeat({
      val appName = "ConnektSampleApp"
      val deviceId = Seq[String]("b25f2cdce678c67707228818e64fb4a0")
      val messageId = UUID.randomUUID().toString
      val gcmPayload =
        s"""
          |{
          |	"registration_ids": ["dJeq9vJfXaM:APA91bGz7OM8-7r8lhTFfOm8gYAgBnsuzKMYXfpeVFs1-pjLoswR_02GGi3Wjh-Ai_RJ07Dah3G83F7qbVSD4-2BTxkw7VsFRUGCijPgm0SDDi1aIllGySJuMWcjeAC_ODtiNXi0POk1"],
          |	"delay_while_idle": false,
          | "dry_run" : true,
          |	"data": {
          |		"message": "Hello theGhost",
          |		"id": "7a4df25c383d4c7a9438c478ddcadd1f",
          |		"triggerSound ": true,
          |		"notificationType": "Text",
          |		"title": "[Direct] Do not go gentle into that good night",
          |		"messageId": "$messageId"
          |	}
          |}
        """.stripMargin

      val requestEntity = HttpEntity(ContentTypes.`application/json`, gcmPayload)
      val requestHeaders = scala.collection.immutable.Seq[HttpHeader](RawHeader("Authorization", "key=" + KeyChainManager.getGoogleCredential(appName).get.apiKey))
      val httpRequest = HttpRequest(HttpMethods.POST, "/gcm/send", requestHeaders, requestEntity)
      val requestTrace = GCMRequestTracker(messageId, "", deviceId, appName, "test", Map())
      (httpRequest, requestTrace)
    })

    val qps = meter("android.send")

    val requestExecutor = HttpDispatcher.gcmPoolClientFlow.map(rT => {
      qps.mark()
      rT._1.foreach(_.entity.getString.getObj[ObjectNode])
      if(0 == (counter.incrementAndGet() % 1000))
        println(s"RepeatAndroidBenchmarkTopology #Rate: MR[${qps.getMeanRate}}], 1MR[${qps.getOneMinuteRate}}] upto ${counter.get()} messages")
    })

    //Run the benchmark topology
    val rF = source.via(requestExecutor).runWith(Sink.ignore)

    Await.result(rF, 120.seconds)
  }

}


text:
/** User profile API */

"use strict";

var _Q = require('q');
var nopg = require('nor-nopg');
var debug = require('nor-debug');
var is = require('nor-is');
var HTTPError = require('nor-express').HTTPError;
var ref = require('nor-ref');
var crypt = require('crypt3');
var FUNCTION = require('nor-function');
var NR = require('nor-newrelic');

function ref_req_path (path, req/*, res*/) {
	return ref(req, path);
}

function verify_path_ref(path, req, res, secret_uuid) {
	return ref(req, path, secret_uuid);
}

function get_user(req/*, res*/) {
	if(!req.user) { return; }
	return req.user;
}

/** Returns nor-express based profile resource */
module.exports = function validity_builder(opts) {
	opts = opts || {};

	opts.user_type = opts.user_type || 'User';

	// The path where to redirect if user verifies successfully
	opts.success_redirect_target = opts.hasOwnProperty('success_redirect_target') ? opts.success_redirect_target : '/';

	if(is.undef(opts.path)) {
		opts.path = 'api/profile/validity';
	}

	if(is.string(opts.path)) {
		opts.path = FUNCTION(ref_req_path).curry(opts.path);
	}

	if(is.undef(opts.verify_path)) {
		opts.verify_path = 'api/profile/validity/verify';
	}

	if(is.string(opts.verify_path)) {
		opts.verify_path = FUNCTION(verify_path_ref).curry(opts.verify_path);
	}

	opts.messages = opts.messages || {};
	opts.messages.success = opts.messages.success || 'Your email address has been verified successfully.';
	opts.messages.fail = opts.messages.fail || 'Your email address validation failed. Please request validation again.';
	opts.messages.login_first = opts.messages.login_first || 'You must login first';

	if(!is.defined(opts.get_user)) {
		opts.get_user = get_user;
	}

	debug.assert(opts.pg).is('string');
	debug.assert(opts.path).is('function');
	debug.assert(opts.user_type).is('string');
	debug.assert(opts.smtp).is('object');
	debug.assert(opts.mailer).is('object');
	debug.assert(opts.verification_message).is('defined');
	debug.assert(opts.messages).is('object');
	debug.assert(opts.messages.success).is('string');
	debug.assert(opts.messages.fail).is('string');
	debug.assert(opts.get_user).is('function');

	/** Validity support */
	var routes = {};

	/** */
	routes.GET = function validity_get(req, res) {
		return _Q.fcall(function validity_get_() {
			return opts.get_user(req, res);
		}).then(function validity_get_2(user) {
			if(is.undef(user)) { throw new HTTPError(401); }
			if(is.obj(user) && is.uuid(user.$id)) {
				return user.$id;
			}
			if(is.uuid(user)) {
				return user;
			}
			throw new TypeError("Invalid params");
		}).then(function validity_get_3(uuid) {
			return _Q(nopg.start(opts.pg).searchSingle(opts.user_type)({'$id': uuid}).commit().then(function(db) {
				return db.fetch();
			}));
		}).then(function validity_get_4(user) {
			return {
				'status': !!( user.email_valid ),
				'email_sent': !!( user.email_validation_hash ),
				'description': 'When you POST here, an email is sent to validate your email address.',
				'verify': {'$ref': ref(req, 'api/profile/validity/verify/:uuid')}
			};
		});
	};

	/** */
	routes.POST = function validity_post(req, res) {
		return _Q.fcall(function validity_post_() {
			return opts.get_user(req, res);
		}).then(function validity_post_2(user) {
			if(is.undef(user)) { throw new HTTPError(401); }
			if(is.obj(user) && is.uuid(user.$id)) {
				return user.$id;
			}
			if(is.uuid(user)) {
				return user;
			}
			throw new TypeError("Invalid params");
		}).then(function validity_post_3(user_uuid) {

			var secret_uuid = require('node-uuid').v4();
			var crypted_secret_uuid = crypt(secret_uuid, crypt.createSalt('md5'));
			var secret_url = opts.verify_path(req, res, secret_uuid);

			return _Q(nopg.start(opts.pg).searchSingle(opts.user_type)({'$id': user_uuid}).then(function(db) {
				var user = db.fetch();
				return db.update(user, {
					'email_validation_hash': crypted_secret_uuid
				}).commit().then(function validity_post_fetch_user() {
					return user;
				});
			}).then(function validity_post_4(user) {

				// Ignore @example.com emails
				if(user.email.substr(user.email.indexOf('@')) === '@example.com') {
					return;
				}

				var msg_params = {
					'name': user && user.name || undefined,
					'email': user && user.email || undefined,
					'user': user,
					'secret_uuid': secret_uuid,
					'secret_url': secret_url,
					'site_url': ref(req, '/')
				};

				return _Q.fcall(function validity_post_5() {
					if(!is.func(opts.verification_message)) {
						return opts.verification_message;
					}
					return opts.verification_message(msg_params, req, res);
				}).then(function validity_post_6(msg) {
					if(is.array(msg.body)) {
						msg.body = msg.body.join('\n');
					}

					debug.assert(msg).is('object');
					debug.assert(msg.subject).is('string');
					debug.assert(msg.body).is('string');

					// Convert parameters
					msg.subject = msg.subject.replace(/%{([^}]+)}/g, function validity_post_subject_replace(m, key) {
						return msg_params[key];
					});

					msg.body = msg.body.replace(/%{([^}]+)}/g, function validity_post_body_replace(m, key) {
						return msg_params[key];
					});

					/* We intentionally handle the promise here (with optional NewRelic support)
					 * and not chain it with the request since this action might take more time
					 * than the HTTP request has time to wait.
					 */

					NR.wtfcall("/mailer/sending/validity-email", function validity_post_nr_wtfcall_() {
						var from = opts.smtp.from || 'no-reply@example.com';
						debug.log('Sending email to ', user.email, ' (with from:', from, ')');
						return opts.mailer.send({
							from: from,
							to: user.email,
							subject: msg.subject,
							body: msg.body
						}).fail(function validity_post_nr_wtfcall_failed(err) {
							debug.error('Sending email to ' + user.email + ' failed:', err);
							return _Q.reject(err);
						});
					});
				});

			}).then(function validity_post_redirect() {
				res.redirect(303, opts.path(req, res) );
			}));
		});
	};

	routes.verify = {};
	routes.verify[':uuid'] = {};

	/** Add a message
	 * @fixme This code should be from session.js somehow
	 */
	function create_message(req, data) {
		debug.assert(data).is('object');
		if(!is.uuid(data.$id)) {
			data.$id = require('node-uuid').v4();
		}
		req.session.client.messages[data.$id] = data;
	}

	/** */
	routes.verify[':uuid'].GET = function validity_verify_uuid_get(req, res) {
		return _Q.fcall(function() {
			return opts.get_user(req, res);
		}).then(function(req_user) {
			if(!req_user) { throw new HTTPError(401, ''+opts.messages.login_first); }
			var user_uuid = is.uuid(req_user) ? req_user : ( is.obj(req_user) && is.uuid(req_user.$id) ? req_user.$id : undefined );

			debug.assert(req.params).is('object');
			debug.assert(req.params.uuid).is('uuid');
			debug.assert(req.session).is('object');

			if(!req.session.client) {
				req.session.client = {};
			}

			if( (!is.obj(req.session.client.messages)) || is.array(req.session.client.messages) ) {
				req.session.client.messages = {};
			}

			var secret_uuid = req.params.uuid;

			return _Q(nopg.start(opts.pg).searchSingle(opts.user_type)({'$id': user_uuid}).then(function(db) {
				var user = db.fetch();
				debug.assert(user.email_validation_hash).is('string');

				var crypted_secret_uuid = crypt(secret_uuid, user.email_validation_hash);
				if(user.email_validation_hash !== crypted_secret_uuid) {
					throw new HTTPError(403, "Forbidden");
				}

				return db.update(user, {
					'email_valid': true,
					'email_validation_hash': ''
				}).commit().then(function() {
					create_message(req, {
						'type': 'info',
						'message': opts.messages.success
					});
				}).fail(function(err) {
					debug.error(err);
					create_message(req, {
						'type': 'error',
						'message': opts.messages.fail
					});
					return db.rollback();
				});

			}).then(function validity_verify_redirect() {
				if(!opts.success_redirect_target) {
					return {'ok': true};
				}
				res.redirect(303, ref(req, opts.success_redirect_target) );
			}));
		});
	};

	// Returns the resource
	return routes;
}; // End of validity_builder

/* EOF */


text:
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using SimplCommerce.Infrastructure.Data;
using SimplCommerce.Infrastructure.Web.SmartTable;
using SimplCommerce.Module.Pricing.Areas.Pricing.ViewModels;
using SimplCommerce.Module.Pricing.Models;

namespace SimplCommerce.Module.Pricing.Areas.Pricing.Controllers
{
    [Area("Pricing")]
    [Authorize(Roles = "admin")]
    [Route("api/cart-rules")]
    public class CartRuleApiController : Controller
    {
        private readonly IRepository<CartRule> _cartRuleRepository;

        public CartRuleApiController(IRepository<CartRule> cartRuleRepository)
        {
            _cartRuleRepository = cartRuleRepository;
        }

        [HttpPost("grid")]
        public IActionResult List([FromBody] SmartTableParam param)
        {
            IQueryable<CartRule> query = _cartRuleRepository
                .Query();

            var cartRules = query.ToSmartTableResult(
                param,
                cartRule => new
                {
                    cartRule.Id,
                    cartRule.Name,
                    cartRule.StartOn,
                    cartRule.EndOn,
                    cartRule.IsActive
                });

            return Json(cartRules);
        }

        [HttpGet("{id}")]
        public async Task<IActionResult> Get(long id)
        {
            var catrtRule = await _cartRuleRepository.Query()
                .Include(x => x.Coupons)
                .Include(x => x.Products).ThenInclude(p => p.Product)
                .FirstOrDefaultAsync(x => x.Id == id);
            var model = new CartRuleForm
            {
                Id = catrtRule.Id,
                Name = catrtRule.Name,
                Description = catrtRule.Description,
                IsActive = catrtRule.IsActive,
                StartOn = catrtRule.StartOn,
                EndOn = catrtRule.EndOn,
                IsCouponRequired = catrtRule.IsCouponRequired,
                RuleToApply = catrtRule.RuleToApply,
                DiscountAmount = catrtRule.DiscountAmount,
                DiscountStep = catrtRule.DiscountStep,
                MaxDiscountAmount = catrtRule.MaxDiscountAmount,
                UsageLimitPerCoupon = catrtRule.UsageLimitPerCoupon,
                UsageLimitPerCustomer = catrtRule.UsageLimitPerCustomer,
                Products = catrtRule.Products.Select(x => new CartRuleProductVm { Id = x.ProductId, Name = x.Product.Name, IsPublished = x.Product.IsPublished }).ToList()
            };

            if(catrtRule.IsCouponRequired)
            {
                var coupon = catrtRule.Coupons.FirstOrDefault();
                if(coupon != null)
                {
                    model.CouponCode = coupon.Code;
                }
            }

            return Json(model);
        }

        [HttpPost]
        public async Task<IActionResult> Post([FromBody] CartRuleForm model)
        {
            if (ModelState.IsValid)
            {
                var cartRule = new CartRule
                {
                    Name = model.Name,
                    Description = model.Description,
                    IsActive = model.IsActive,
                    StartOn = model.StartOn,
                    EndOn = model.EndOn,
                    IsCouponRequired = model.IsCouponRequired,
                    RuleToApply = model.RuleToApply,
                    DiscountAmount = model.DiscountAmount,
                    DiscountStep = model.DiscountStep,
                    MaxDiscountAmount = model.MaxDiscountAmount,
                    UsageLimitPerCoupon = model.UsageLimitPerCoupon,
                    UsageLimitPerCustomer = model.UsageLimitPerCustomer
                };

                if(model.IsCouponRequired && !string.IsNullOrWhiteSpace(model.CouponCode))
                {
                    var coupon = new Coupon
                    {
                        CartRule = cartRule,
                        Code = model.CouponCode
                    };

                    cartRule.Coupons.Add(coupon);
                }

                foreach(var item in model.Products)
                {
                    var cartRuleProduct = new CartRuleProduct
                    {
                        CartRule = cartRule,
                        ProductId = item.Id
                    };
                    cartRule.Products.Add(cartRuleProduct);
                }

                _cartRuleRepository.Add(cartRule);
                await _cartRuleRepository.SaveChangesAsync();

                return CreatedAtAction(nameof(Get), new { id = cartRule.Id }, null);
            }
            return BadRequest(ModelState);
        }

        [HttpPut("{id}")]
        public async Task<IActionResult> Put(long id, [FromBody] CartRuleForm model)
        {
            if (ModelState.IsValid)
            {
                var cartRule = await _cartRuleRepository.Query()
                    .Include(x => x.Coupons)
                    .Include(x => x.Products)
                    .FirstOrDefaultAsync(x => x.Id == id);
                if(cartRule == null)
                {
                    return NotFound();
                }

                cartRule.Name = model.Name;
                cartRule.Description = model.Description;
                cartRule.StartOn = model.StartOn;
                cartRule.EndOn = model.EndOn;
                cartRule.IsActive = model.IsActive;
                cartRule.IsCouponRequired = model.IsCouponRequired;
                cartRule.RuleToApply = model.RuleToApply;
                cartRule.DiscountAmount = model.DiscountAmount;
                cartRule.DiscountStep = model.DiscountStep;
                cartRule.MaxDiscountAmount = model.MaxDiscountAmount;
                cartRule.UsageLimitPerCoupon = model.UsageLimitPerCoupon;
                cartRule.UsageLimitPerCustomer = model.UsageLimitPerCustomer;

                if (model.IsCouponRequired && !string.IsNullOrWhiteSpace(model.CouponCode))
                {
                    var coupon = cartRule.Coupons.FirstOrDefault();
                    if (coupon == null)
                    {
                        coupon = new Coupon
                        {
                            CartRule = cartRule,
                            Code = model.CouponCode
                        };

                        cartRule.Coupons.Add(coupon);
                    }
                    else
                    {
                        coupon.Code = model.CouponCode;
                    }
                }

                foreach (var item in model.Products)
                {
                    var cartRuleProduct = cartRule.Products.FirstOrDefault(x => x.ProductId == item.Id);
                    if (cartRuleProduct == null)
                    {
                        cartRuleProduct = new CartRuleProduct
                        {
                            CartRule = cartRule,
                            ProductId = item.Id
                        };
                        cartRule.Products.Add(cartRuleProduct);
                    }
                }

                var modelProductIds = model.Products.Select(x => x.Id);
                var deletedProducts = cartRule.Products.Where(x => !modelProductIds.Contains(x.ProductId)).ToList();
                foreach(var item in deletedProducts)
                {
                    item.CartRule = null;
                    cartRule.Products.Remove(item);
                }

                await _cartRuleRepository.SaveChangesAsync();
                return Accepted();
            }
            return BadRequest(ModelState);
        }

        [HttpDelete("{id}")]
        public async Task<IActionResult> Delete(long id)
        {
            var cartRule = await _cartRuleRepository.Query().FirstOrDefaultAsync(x => x.Id == id);
            if (cartRule == null)
            {
                return NotFound();
            }

            try
            {
                _cartRuleRepository.Remove(cartRule);
                await _cartRuleRepository.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                return BadRequest(new { Error = $"The cart rule {cartRule.Name} can't not be deleted because it has been used" });
            }

            return NoContent();
        }
    }
}


text:
require("torch")
require("nn")
require("string.color")

local GenericCriterion = torch.class("GenericCriterion")

function GenericCriterion:__init(task, opts)

   opts = opts or {}

   self.verbose      = opts.verbose or false
   self.noAssertions = opts.noAssertions or false

   local outputsInfo = task:getOutputsInfo()

   self.criterion = nn.ParallelCriterion()

   for k, v in pairs(outputsInfo) do

      if v.type == "regression" then
         self.criterion:add(nn.MSECriterion())
         self:print("MSE Criterion added")
      elseif v.type == "one-hot" then
         self.criterion:add(nn.ClassNLLCriterion())
         self:print("Class NLL Criterion added")
      elseif v.type == "binary" then
         self.criterion:add(nn.BCECriterion())
         self:print("BCE Criterion added")
      else
         assert(false, "Unknown output type")
      end

   end

   self:print("Created generic criterion")
end

function GenericCriterion:forward(Y, T)
   if type(Y) ~= "table" then
      if not self.noAssertions then assert(#T == 1) end
      return self.criterion:forward({Y}, T)
   else
      return self.criterion:forward(Y, T)
   end
end

function GenericCriterion:backward(Y, T)
   if type(Y) ~= "table" then
      if not self.noAssertions then assert(#T == 1) end
      local dY = self.criterion:backward({Y}, T)
      return dY[1]
   else
      return self.criterion:backward(Y, T)
   end
end

function GenericCriterion:cuda()
   self.criterion:cuda()
end

--------------------------------------------------------------------------------
-- Function to be used when being verbose
--------------------------------------------------------------------------------

function GenericCriterion:print(...)
   print("Generic Criterion", ...)
end


text:
OS=`cat /etc/os-release | grep "^ID=" | sed 's/ID=//g' | sed 's/["]//g' | awk '{print $1}'`
echo -e "Operating System: ${OS}\n"

realm="TEST.COREFX.NET"

principal1="TESTHOST/testfqdn.test.corefx.net"
principal2="TESTHTTP"
krb_user="krb_user"
password="password"

kadmin="kadmin.local"
krb5kdc="krb5kdc"
kdb5_util="kdb5_util"

krb_conf="krb5.conf"
krb_conf_location="/etc/krb5.conf"
keytabfile="/etc/krb5.keytab"

PROGNAME=$(basename $0)
usage()
{
    echo "This script must be run with super-user privileges."
    echo "Usage: ${PROGNAME} [-h|--help] [-y|--yes] [-u|--uninstall]";
}

# Cleanup config files and uninstall KDC
clean_up()
{
    echo "Stopping KDC.."
    if pgrep krb5kdc 2> /dev/null; then pkill krb5kdc 2> /dev/null ; fi

    echo "Removing config files"
    if [ -f ${krb_conf_location} ]; then
        rm -f ${krb_conf_location}
    fi

    case ${OS} in
        "ubuntu" | "debian")
            kdc_conf_location="/etc/krb5kdc/kdc.conf"
            dpkg -s krb5-kdc >/dev/null 2>&1
            if [ $? -eq 0 ]; then
                echo "Uninstalling krb5-kdc"
                apt-get -y purge krb5-kdc
            fi
            ;;

        "centos" | "rhel")
            kdc_conf_location="/var/kerberos/krb5kdc/kdc.conf"
            yum list installed krb5-server >/dev/null 2>&1
            if [ $? -eq 0 ]; then
                echo "Uninstalling krb5-server"
                yum -y remove krb5-server
            fi
            ;;

        "opensuse")
            kdc_conf_location="/var/lib/kerberos/krb5kdc/kdc.conf"
            zypper search --installed-only krb5-server >/dev/null 2>&1
            if [ $? -eq 0 ]; then
               echo "Uninstalling krb5-server"
               zypper --non-interactive remove krb5-server >/dev/null 2>&1
            fi
            ;;
        *)
            echo "This is an unsupported operating system"
            ;;
    esac

    if [ -f ${kdc_conf_location} ]; then
        rm -f ${kdc_conf_location}
    fi

    echo "Cleanup completed"
}

error_exit()
{
    echo "${1:-"Unknown Error"}"
    echo "Aborting"
    clean_up
    exit 1
}

# Common function across linux distros to configure KDC post installation
configure_kdc()
{
    echo "Stopping KDC.."
    if pgrep krb5kdc 2> /dev/null; then pkill krb5kdc ; fi

    # Remove database files if exist
    rm -f ${database_files}

    add_principal_cmd="add_principal -pw ${password}"
    # Create/copy krb5.conf and kdc.conf
    echo "Copying krb5.conf and kdc.conf.."
    cp ${krb_conf} ${krb_conf_location} || \
    error_exit "Cannot copy ${krb_conf} to ${krb_conf_location}"

    cp ${kdc_conf} ${kdc_conf_location} || \
    error_exit "Cannot copy ${kdc_conf} to ${kdc_conf_location}"

    echo "Creating KDC database for realm ${realm}.."
    ${kdb5_util} create -r ${realm} -P ${password} -s || \
    error_exit "Cannot create KDC database for realm ${realm}"

    echo "Adding principal ${principal1}.."
    ${kadmin} -q "${add_principal_cmd} ${principal1}@${realm}" || \
    error_exit "Cannot add ${principal1}"

    echo "Adding principal ${principal2}.."
    ${kadmin} -q "${add_principal_cmd} ${principal2}@${realm}" || \
    error_exit "Cannot add ${principal2}"

    echo "Adding user ${krb_user}.."
    ${kadmin} -q "${add_principal_cmd} ${krb_user}@${realm}" || \
    error_exit "Cannot add ${krb_user}"

    echo "Exporting keytab for ${principal1}"
    ${kadmin} -q "ktadd -norandkey ${principal1}@${realm}" || \
    error_exit "Cannot export kytab for ${principal1}"

    echo "Exporting keytab for ${principal2}"
    ${kadmin} -q "ktadd -norandkey ${principal2}@${realm}" || \
    error_exit "Cannot export kytab for ${principal2}"

    echo "Exporting keytab for ${krb_user}"
    ${kadmin} -q "ktadd -norandkey ${krb_user}@${realm}" || \
    error_exit "Cannot export kytab for ${krb_user}"
}

# check the invoker of this script
if [ $EUID -ne 0 ]; then
    usage
    exit 1
fi

# Parse command-line arguments
TEMP=`getopt -o p:hyu --long password:,help,yes,uninstall -n 'test.sh' -- "$@"`
[ $? -eq 0 ] || {
    usage
    exit 1
}
eval set -- "$TEMP"
uninstall=0
force=0
while true; do
    case $1 in
        -h|--help) usage; exit 0;;
        -y|--yes) force=1; shift ;;
        -u|--uninstall) uninstall=1; shift;;
        -p|--password) shift; password=$1; shift;;
        --) shift; break;;
        *) usage; exit 1;;
    esac
done

# Uninstallation
if [ $uninstall -eq 1 ]; then
    if [ $force -eq 0 ]; then
        echo "This will uninstall KDC from your machine and cleanup the related config files."
        read -p "Do you want to continue? ([Y]es/[N]o)? " choice
        case $(echo $choice | tr '[A-Z]' '[a-z]') in
            y|yes) clean_up;;
            *) echo "Skipping uninstallation";;
        esac
    else
        clean_up
    fi
    exit 0
fi

# Installation
if [ $force -eq 0 ]; then
    read -p "This will install KDC on your machine and create KDC principals. Do you want to continue? ([Y]es/[N]o)? " choice
    case $(echo $choice | tr '[A-Z]' '[a-z]') in
        y|yes) ;;
        *) echo "Skipping installation"; exit 0;;
    esac
fi

case ${OS} in
    "ubuntu" | "debian")
        kdc_conf="kdc.conf.ubuntu"
        kdc_conf_location="/etc/krb5kdc/kdc.conf"
        database_files="/var/lib/krb5kdc/principal*"

        dpkg -s krb5-kdc >/dev/null 2>&1
        if [ $? -ne 0 ]; then
            echo "Installing krb5-kdc.."
            export DEBIAN_FRONTEND=noninteractive
            apt-get -y install krb5-kdc krb5-admin-server
            if [ $? -ne 0 ]; then
                echo "Error occurred during installation, aborting"
                exit 1
            fi
        else
            echo "krb5-kdc already installed.."
            exit 2
        fi

        configure_kdc

        echo "Starting KDC.."
        ${krb5kdc}
        ;;

    "centos" | "rhel")
        kdc_conf="kdc.conf.centos"
        kdc_conf_location="/var/kerberos/krb5kdc/kdc.conf"
        database_files="/var/kerberos/krb5kdc/principal*"

        yum list installed krb5-server >/dev/null 2>&1
        if [ $? -ne 0 ]; then
            echo "Installing krb5-server.."
            yum -y install krb5-server krb5-libs krb5-workstation
            if [ $? -ne 0 ]; then
                echo "Error occurred during installation, aborting"
                exit 1
            fi
        else
            echo "krb5-server already installed.."
            exit 2
        fi

        configure_kdc

        echo "Starting KDC.."
        systemctl start krb5kdc.service
        systemctl enable krb5kdc.service
        ;;

    "opensuse")
          # the following is a workaround for opensuse
          # details at https://groups.google.com/forum/#!topic/comp.protocols.kerberos/3itzZQ4fETA
          # and http://lists.opensuse.org/opensuse-factory/2013-10/msg00099.html
          export KRB5CCNAME=$PWD

          krb5kdc="/usr/lib/mit/sbin/krb5kdc"
          kadmin="/usr/lib/mit/sbin/kadmin.local"
          kdb5_util="/usr/lib/mit/sbin/kdb5_util"
          kdc_conf="kdc.conf.opensuse"
          kdc_conf_location="/var/lib/kerberos/krb5kdc/kdc.conf"
          database_files="/var/lib/kerberos/krb5kdc/principal*"

          zypper search --installed-only krb5-mini >/dev/null 2>&1
          if [ $? -eq 0 ]; then
              echo "removing krb5-mini which conflicts with krb5-server and krb5-devel"
              zypper --non-interactive remove krb5-mini
          fi

          zypper search --installed-only krb5-server >/dev/null 2>&1
          if [ $? -ne 0 ]; then
             echo "Installing krb5-server.."
             zypper --non-interactive install krb5-server krb5-client krb5-devel
             if [ $? -ne 0 ]; then
                 echo "Error occurred during installation, aborting"
                 exit 1
             fi
         else
             echo "krb5-server already installed.."
             exit 2
         fi

         configure_kdc

         echo "Starting KDC..${krb5kdc}"
         ${krb5kdc}
         ;;
    *)
        echo "This is an unsupported operating system"
        ;;
esac

chmod +r ${keytabfile}


text:
package org.mycontroller.standalone.gateway.ethernet;

import org.mycontroller.standalone.db.tables.GatewayTable;
import org.mycontroller.standalone.gateway.GatewayException;
import org.mycontroller.standalone.gateway.IGateway;
import org.mycontroller.standalone.gateway.model.GatewayEthernet;
import org.mycontroller.standalone.message.RawMessage;

/**
 * @author Jeeva Kandasamy (jkandasa)
 * @since 0.0.2
 */
public class EthernetGatewayImpl implements IGateway {
    private EthernetGatewayActionThread monitoringThread = null;

    public EthernetGatewayImpl(GatewayTable gatewayTable) {
        if (monitoringThread == null) {
            monitoringThread = new EthernetGatewayActionThread(new GatewayEthernet(gatewayTable));
            new Thread(monitoringThread).start();
        }
    }

    @Override
    public synchronized void close() {
        monitoringThread.close();
    }

    @Override
    public synchronized void write(RawMessage rawMessage) throws GatewayException {
        monitoringThread.write(rawMessage);
    }

    @Override
    public GatewayEthernet getGateway() {
        if (monitoringThread != null) {
            return monitoringThread.getGateway();
        }
        return null;
    }

}


text:
/* ==========================================================================
   PUSHBULLET.COM
   ========================================================================== */
/* ==========================================================================
   COLORS
   ========================================================================== */

:root
{
    --color-accent: rgb(74, 179, 103);
    --color-accent-light: rgb(93, 187, 118);
}

/* ==========================================================================
   SCROLLBAR
   ========================================================================== */

/* -webkit-scrollbar
   ========================================================================== */
/*
::-webkit-scrollbar
{
    width: 0.5rem !important;
    background: transparent !important;
}

::-webkit-scrollbar-corner
{
    background: transparent !important;
}

::-webkit-scrollbar-thumb
{
    background: var(--color-accent-light) !important;
    border-radius: 0 !important;
}

::-webkit-scrollbar-thumb:hover
{
    background: var(--color-accent) !important;
}

::-webkit-scrollbar-thumb:active
{
    background: var(--color-accent) !important;
}
*/
/* ==========================================================================
   ELEMENTS
   ========================================================================== */

/* #body
   ========================================================================== */

body
{
    overflow: hidden !important;
}

.inner.paper
{
    display: block !important;
    overflow: auto !important;
    height: 100% !important;
    position: absolute !important;
}

/* #header
   ========================================================================== */

#header,
#mobile-header
{
    box-shadow: none !important;
}

#header,
#mobile-header
{
    position: sticky !important;
    top: 0 !important;
}

/* #sink
   ========================================================================== */

html.darwin #sink,
html.darwin #sink > div > div > div:nth-child(1)
{
    background-color: transparent !important;
}

html.darwin #mainbar
{
    transform: translateX(-1px) !important;
}

/* :not(.pushfont-*)
   ========================================================================== */

div:not(.pushfont-circle),
div:not(.pushfont-hamburger),
div:not(.pushfont-paperclip),
div:not(.pushfont-close)
{
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Ubuntu, Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !important;
  -webkit-font-smoothing: antialiased !important;
}

/* :focus
   ========================================================================== */

.minitab:focus,
#sidebar div.target.pointer:focus
{
    outline: none !important;
}


text:
// MS compatible compilers support #pragma once

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif

//
//  detail/quick_allocator.hpp
//
//  Copyright (c) 2003 David Abrahams
//  Copyright (c) 2003 Peter Dimov
//
//  Distributed under the Boost Software License, Version 1.0.
//  See accompanying file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt
//

#include <boost/smart_ptr/detail/quick_allocator.hpp>

#endif  // #ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED


text:
using System;
using System.Collections.Generic;
using System.Text;

namespace Selenium.Internal.SeleniumEmulation
{
    /// <summary>
    /// Defines the command for the isChecked keyword.
    /// </summary>
    internal class IsChecked : SeleneseCommand
    {
        private ElementFinder finder;

        /// <summary>
        /// Initializes a new instance of the <see cref="IsChecked"/> class.
        /// </summary>
        /// <param name="finder">An <see cref="ElementFinder"/> used to find the element on which to execute the command.</param>
        public IsChecked(ElementFinder finder)
        {
            this.finder = finder;
        }

        /// <summary>
        /// Handles the command.
        /// </summary>
        /// <param name="driver">The driver used to execute the command.</param>
        /// <param name="locator">The first parameter to the command.</param>
        /// <param name="value">The second parameter to the command.</param>
        /// <returns>The result of the command.</returns>
        protected override object HandleSeleneseCommand(OpenQA.Selenium.IWebDriver driver, string locator, string value)
        {
            return this.finder.FindElement(driver, locator).Selected;
        }
    }
}


text:
package com.dell.isg.smi.wsmanclient.exceptions;

public class LCJobIsAlreadyRunningException extends Exception {

    private static final long serialVersionUID = -6806000114791013007L;

    /**
     * Constructs a new VCenter Connection Exception
     */
    public LCJobIsAlreadyRunningException() {
    }

    /**
     * Constructs a new VCenter Connection Exception
     *
     * @param message The Exception message
     */
    public LCJobIsAlreadyRunningException(String message) {
        super(message);
    }

    /**
     * Constructs a new VCenter Connection Exception
     *
     * @param cause The cause of the Exception
     */
    public LCJobIsAlreadyRunningException(Throwable cause) {
        super(cause);
    }

    /**
     * Constructs a new VCenter Connection Exception
     *
     * @param message The Exception message
     * @param cause The cause of the Exception
     */
    public LCJobIsAlreadyRunningException(String message, Throwable cause) {
        super(message, cause);
    }

}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.orange.web.constants;

/**
 *
 * @author lining
 */
public class NonOverLappingConstant {
    public final static String COMPONENT_NON_OVER_LAPPING = "components can not over lapping,please chick it";
    public final static String SERVICE_DAO_COMPONENT_NON_OVER_LAPPING = "ServiceComponent And DaoComponent can not over lapping in ${target}";
}


text:
from .relationship_manager import RelationshipManager, ZeroOrMore # noqa

class ZeroOrOne(RelationshipManager):
    description = "zero or one relationship"

    def single(self):
        nodes = super(ZeroOrOne, self).all()
        if len(nodes) == 1:
            return nodes[0]
        if len(nodes) > 1:
            raise CardinalityViolation(self, len(nodes))

    def all(self):
        node = self.single()
        return [node] if node else []

    def connect(self, obj, properties=None):
        if len(self):
            raise AttemptedCardinalityViolation(
                    "Node already has {0} can't connect more".format(self))
        else:
            return super(ZeroOrOne, self).connect(obj, properties)

class OneOrMore(RelationshipManager):
    description = "one or more relationships"

    def single(self):
        nodes = super(OneOrMore, self).all()
        if nodes:
            return nodes[0]
        raise CardinalityViolation(self, 'none')

    def all(self):
        nodes = super(OneOrMore, self).all()
        if nodes:
            return nodes
        raise CardinalityViolation(self, 'none')

    def disconnect(self, obj):
        if super(OneOrMore, self).__len__() < 2:
            raise AttemptedCardinalityViolation("One or more expected")
        return super(OneOrMore, self).disconnect(obj)

class One(RelationshipManager):
    description = "one relationship"

    def single(self):
        nodes = super(One, self).all()
        if nodes:
            if len(nodes) == 1:
                return nodes[0]
            else:
                raise CardinalityViolation(self, len(nodes))
        else:
            raise CardinalityViolation(self, 'none')

    def all(self):
        return [self.single()]

    def disconnect(self, obj):
        raise AttemptedCardinalityViolation("Cardinality one, cannot disconnect use reconnect")

    def connect(self, obj, properties=None):
        if not hasattr(self.source, '_id'):
            raise ValueError("Node has not been saved cannot connect!")
        if len(self):
            raise AttemptedCardinalityViolation("Node already has one relationship")
        else:
            return super(One, self).connect(obj, properties)

class AttemptedCardinalityViolation(Exception):
    pass

class CardinalityViolation(Exception):
    def __init__(self, rel_manager, actual):
        self.rel_manager = str(rel_manager)
        self.actual = str(actual)

    def __str__(self):
        return "CardinalityViolation: Expected {0} got {1}".format(self.rel_manager, self.actual)


text:
var Constants = require('../Constants');

function MsgStreamChannelCloseRequest(){
	this.streamNumber = undefined;
};

MsgStreamChannelCloseRequest.prototype.setStreamNumber = function setStreamNumber(value){
	this.streamNumber = value;
};

MsgStreamChannelCloseRequest.prototype.getStreamNumber = function getStreamNumber(){
	return this.streamNumber;
};

MsgStreamChannelCloseRequest.prototype.write = function write(buffer) {
	buffer.writeUInt32(this.streamNumber);
};

MsgStreamChannelCloseRequest.prototype.getSize = function getSize(){
	return 4;
};

MsgStreamChannelCloseRequest.prototype.toString = function toString(){
	var str = "";
	str+="Stream-Number: "+this.streamNumber.toString(16)+"\n";
	return str;
};

MsgStreamChannelCloseRequest.prototype.getResponseTag = function getResponseTag(){
	return Constants.STREAM_CHANNEL_CLOSE_RESPONSE;
};

MsgStreamChannelCloseRequest.parse = function parse(buffer) {
	var message = new MsgStreamChannelCloseRequest();
	message.setStreamNumber(buffer.readUInt32());

	return message;
};

module.exports = MsgStreamChannelCloseRequest;


text:
<?php

namespace Rcm\Factory;

use AssetManager\Cache\ZendCacheAdapter;
use Zend\Cache\Storage\StorageInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

/**
 * Service Factory for the Asset Manager Zend Cache Adapter
 *
 * Factory for the Asset Manager Zend Cache Adapter
 *
 * @category  Reliv
 * @package   Rcm
 * @author    Westin Shafer <wshafer@relivinc.com>
 * @copyright 2012 Reliv International
 * @license   License.txt New BSD License
 * @version   Release: 1.0
 * @link      https://github.com/reliv
 *
 */
class AssetManagerCacheFactory implements FactoryInterface
{

    /**
     * Creates Service
     *
     * @param ServiceLocatorInterface $serviceLocator Zend Service Locator
     *
     * @return StorageInterface
     */
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var \Zend\Cache\Storage\StorageInterface $rcmCache */
        $rcmCache = $serviceLocator->get('Rcm\Service\Cache');

        return new ZendCacheAdapter($rcmCache);
    }
}


text:
#include "stdafx.h"

#include "ext/phonebook/phonebook.h"
#include "NativeAddressBook.h"
#include "OutlookApp.h"
#include <common/RhoStd.h>

#define INITGUID
#include <pimstore.h>
#include <comutil.h>

using namespace rho;
using namespace rho::common;

IMPLEMENT_LOGCLASS(CABRecord,"ABRecord");
IMPLEMENT_LOGCLASS(CABOutlookRecord,"ABOutlookRecord");
IMPLEMENT_LOGCLASS(CABSimRecord,"ABSimRecord");
IMPLEMENT_LOGCLASS(CNativeAddressBook,"NativeAddressBook");

LPFN_SIM_DEINITIALIZE_T lpfn_sim_deinitialize;
LPFN_SIM_INITIALIZE_T lpfn_sim_initialize;
LPFN_SIM_READ_PHONEBOOK_ENTRY_T lpfn_sim_read_phonebook_entry;
LPFN_SIM_GET_DEV_CAPS_T lpfn_sim_get_dev_caps;

// Note that return type is std::string, not LPCSTR!!!
// It is required to get live object even after function exit
// In case if it is LPCSTR we actually get pointer to the
// dead object internal member
std::string bstr2str(BSTR s) {
	_bstr_t bstr(s);
	return (LPCSTR)bstr;
}

std::string& CABRecord::getValue(std::string field) {
	return m_props[field];
}

int CABRecord::setValue(std::string field,std::string value) {
	m_props[field] = value;
	return 1;
}

void CABRecord::enumValues(ab_callback_t proc,void* param) {
	std::map<std::string,std::string>::iterator it;
	for ( it = m_props.begin(); it != m_props.end(); it++ ) {
		(*proc)((*it).first.c_str(),(*it).second.c_str(),param);
	}
}

void CABRecord::dump() {
	LOG(INFO) + "Record dump ================================================";
	std::map<std::string,std::string>::iterator it;
	for ( it = m_props.begin(); it != m_props.end(); it++ ) {
		LOG(INFO) + "[" + (*it).first.c_str() + "] -> [" + (*it).second.c_str() + "]";
	}
	LOG(INFO) + "End of record dump =========================================";
}

//=============================================================================

CABOutlookRecord::CABOutlookRecord(IContact* pContact) :
m_pContact(pContact) {
	m_type = eOutlookContact;
	m_modifyed = false;
}

CABOutlookRecord::~CABOutlookRecord() {
	if (m_pContact) {
		m_pContact->Release();
	}
}

int CABOutlookRecord::load() {
	if (m_pContact) {
		long oid;
		if(SUCCEEDED(m_pContact->get_Oid(&oid) ) ) {
			char buf[128];
			sprintf(buf,"{outlook %ld}",oid);
			setValue(RUBY_PB_ID,buf);
		}

		BSTR pwsz = NULL;
		if(SUCCEEDED(m_pContact->get_MobileTelephoneNumber(&pwsz) ) ) {
			if(pwsz[0]!=0) {
				std::string const &number = bstr2str(pwsz);
				setValue(RUBY_PB_MOBILE_NUMBER,number);
			}
			::SysFreeString( pwsz);
		}

		if(SUCCEEDED(m_pContact->get_HomeTelephoneNumber(&pwsz) ) ) {
			if(pwsz[0]!=0) {
				std::string const &number = bstr2str(pwsz);
				setValue(RUBY_PB_HOME_NUMBER,number);
			}
			::SysFreeString( pwsz);
		}

		if(SUCCEEDED(m_pContact->get_BusinessTelephoneNumber(&pwsz) ) ) {
			if(pwsz[0]!=0) {
				std::string const &number = bstr2str(pwsz);
				setValue(RUBY_PB_BUSINESS_NUMBER,number);
			}
			::SysFreeString( pwsz);
		}

		if(SUCCEEDED(m_pContact->get_FirstName(&pwsz) ) ) {
			if(pwsz[0]!=0) {
				std::string const &name = bstr2str(pwsz);
				setValue(RUBY_PB_FIRST_NAME,name);
			}
			::SysFreeString(pwsz);
		}

		if(SUCCEEDED(m_pContact->get_LastName(&pwsz) ) ) {
			if(pwsz[0]!=0) {
				std::string const &name = bstr2str(pwsz);
				setValue(RUBY_PB_LAST_NAME,name);
			}
			::SysFreeString(pwsz);
		}

		if(SUCCEEDED(m_pContact->get_CompanyName(&pwsz) ) ) {
			if(pwsz[0]!=0) {
				std::string const &name = bstr2str(pwsz);
				setValue(RUBY_PB_COMPANY_NAME,name);
			}
			::SysFreeString(pwsz);
		}

		if(SUCCEEDED(m_pContact->get_Email1Address(&pwsz) ) ) {
			if(pwsz[0]!=0) {
				std::string const &address = bstr2str(pwsz);
				setValue(RUBY_PB_EMAIL_ADDRESS,address);
			}
			::SysFreeString(pwsz);
		}

	}
	return 1;
}

void CABOutlookRecord::saveValues() {
	const char* value = getValue(RUBY_PB_MOBILE_NUMBER).c_str();
	if (value!=NULL) {
		m_pContact->put_MobileTelephoneNumber(_bstr_t(value));
	}
	value = getValue(RUBY_PB_HOME_NUMBER).c_str();
	if (value!=NULL) {
		m_pContact->put_HomeTelephoneNumber(_bstr_t(value));
	}
	value = getValue(RUBY_PB_BUSINESS_NUMBER).c_str();
	if (value!=NULL) {
		m_pContact->put_BusinessTelephoneNumber(_bstr_t(value));
	}

	value = getValue(RUBY_PB_FIRST_NAME).c_str();
	if (value!=NULL) {
		m_pContact->put_FirstName(_bstr_t(value));
	}
	value = getValue(RUBY_PB_LAST_NAME).c_str();
	if (value!=NULL) {
		m_pContact->put_LastName(_bstr_t(value));
	}
	value = getValue(RUBY_PB_COMPANY_NAME).c_str();
	if (value!=NULL) {
		m_pContact->put_CompanyName(_bstr_t(value));
	}
	value = getValue(RUBY_PB_EMAIL_ADDRESS).c_str();
	if (value!=NULL) {
		m_pContact->put_Email1Address(_bstr_t(value));
	}
}

int CABOutlookRecord::save() {
	if (m_pContact) {
		saveValues();
		m_pContact->Save();
	}
	return 1;
}

int CABOutlookRecord::remove() {
	if (m_pContact) {
		m_pContact->Delete();
	}
	return 1;
}

//=============================================================================

CNativeAddressBook::CNativeAddressBook() :
    m_outlookItems(NULL), m_hSim(0)
{
}

CNativeAddressBook::~CNativeAddressBook()
{
	if(m_outlookItems) {
		m_outlookItems->Release();
	}

	if (m_hSim)
		closeSimAB();
}

int CNativeAddressBook::openAB()
{
	initSimAB();

    COutlookApp* pApp = COutlookApp::Create();
	return pApp->getApp() != 0;
}

int CNativeAddressBook::getAllRecords(std::vector<CABRecord*>& records) {
	getAllSimPhonebookRecords(records);

	return getAllOutlookRecords(records);
}

CABRecord* CNativeAddressBook::getRecord(char* id)
{
	char recordType[20];
	long recordId;
	if ( sscanf(id, "{%s %ld}", recordType, &recordId) == 2 ) {
		LOG(INFO) + "get Record " + recordId + " of " + recordType +" type";
		if (strcmp(recordType,"outlook")==0) {
			return getOutlookRecord(recordId);
		} else if (strcmp(recordType,"sim")==0) {
			return getSimRecord(recordId);
		}
	}
	return NULL;
}

int CNativeAddressBook::addRecord(CABRecord* record) {
	return addOutlookRecord((CABOutlookRecord*)record);
}

int CNativeAddressBook::deleteRecord(CABRecord* record) {
	return 1;
}

//=============================================================================

bool CNativeAddressBook::getOutlookItems()
{
    IPOutlookApp* pApp = COutlookApp::getInstance()->getApp();
	if( (pApp!=NULL)&&(m_outlookItems==NULL))
    {
		//
		IFolder* polFolder;
		HRESULT res = pApp->GetDefaultFolder(olFolderContacts, &polFolder);
		if (res != S_OK) {
			// QueryInterface failed.
			LOG(ERROR) + "GetDefaultFolder failed.";
			return false;
		}

		res = polFolder->get_Items(&m_outlookItems);
		if (res != S_OK) {
			// QueryInterface failed.
			polFolder->Release();
			LOG(ERROR) + "get_Items failed.";
			return false;
		}

		polFolder->Release();
	}
	return true;
}

int CNativeAddressBook::getAllOutlookRecords(std::vector<CABRecord*>& records)
{
    IPOutlookApp* pApp = COutlookApp::getInstance()->getApp();

	if(pApp && getOutlookItems())
    {
		int size;
		m_outlookItems->get_Count(&size);

		IContact * pContact;
		CABOutlookRecord *pRecord;
		for(int index = 1; index <= size; ++index) {
			m_outlookItems->Item(index, (IDispatch**)&pContact);
			pRecord = new CABOutlookRecord(pContact);
			if(pRecord) {
				pRecord->load();
				records.push_back(pRecord);
			} else {
				pContact->Release();
			}
		}
	}
	return 1;
}

CABRecord* CNativeAddressBook::getOutlookRecord(long oid)
{
    IPOutlookApp* pApp = COutlookApp::getInstance()->getApp();

	if(pApp && getOutlookItems())
    {
		DWORD index;
		HINSTANCE hPimStore = LoadLibrary(L"PIMSTORE.dll");
		typedef LRESULT (WINAPI* LPFN_GET_ITEM_INDEX_FROM_OID_T) (IPOutlookItemCollection*, CEOID, DWORD*);
		LPFN_GET_ITEM_INDEX_FROM_OID_T lpfn_getItemIndexFromOid = NULL;
		if (hPimStore)
			lpfn_getItemIndexFromOid = (LPFN_GET_ITEM_INDEX_FROM_OID_T)
				GetProcAddress(hPimStore, L"GetItemIndexFromOid");
		if (hPimStore && lpfn_getItemIndexFromOid)
		{
			if(S_OK==lpfn_getItemIndexFromOid(m_outlookItems,oid,&index)) {
				IContact * pContact;
				CABOutlookRecord *pRecord;
				if (SUCCEEDED(m_outlookItems->Item(1+index, (IDispatch**)&pContact))) {
					pRecord = new CABOutlookRecord(pContact);
					if(pRecord) {
						pRecord->load();
						return pRecord;
					} else {
						pContact->Release();
					}
				}
			}
		}
		if (hPimStore)
			FreeLibrary(hPimStore);
	}
	return NULL;
}

int CNativeAddressBook::addOutlookRecord(CABOutlookRecord* record)
{
    IPOutlookApp* pApp = COutlookApp::getInstance()->getApp();

	if(pApp && getOutlookItems())
    {
		if(SUCCEEDED(m_outlookItems->Add((IDispatch**)&record->m_pContact))) {
			record->save();
		}
	}
	return 1;
}

BOOL CNativeAddressBook::LoadSimMgr()
{
	bool bReturnValue = FALSE;
	m_hSimMgrDLL = LoadLibrary(L"cellcore.dll");
	if (!m_hSimMgrDLL)
	{
		//  Error loading CellCore.dll (used for Connection Manager)
		LOG(INFO) + "Failed to load CellCore.dll, Sim functionality will not be available";
	}
	else
	{
		lpfn_sim_deinitialize =
			(LPFN_SIM_DEINITIALIZE_T)GetProcAddress(m_hSimMgrDLL, _T("SimInitialize"));
		lpfn_sim_initialize =
			(LPFN_SIM_INITIALIZE_T)GetProcAddress(m_hSimMgrDLL, _T("SimDeinitialize"));
		lpfn_sim_read_phonebook_entry =
			(LPFN_SIM_READ_PHONEBOOK_ENTRY_T)GetProcAddress(m_hSimMgrDLL, _T("SimReadPhonebookEntry"));
		lpfn_sim_get_dev_caps =
			(LPFN_SIM_GET_DEV_CAPS_T)GetProcAddress(m_hSimMgrDLL, _T("SimGetDevCaps"));

		if (!lpfn_sim_deinitialize)
		{
			LOG(ERROR) + "Unable to load SimDeinitialize";
			bReturnValue = FALSE;
		}
		else if (!lpfn_sim_initialize)
		{
			LOG(ERROR) + "Unable to load SimInitialize";
		}
		else
			bReturnValue = TRUE;
	}
	return bReturnValue;
}

bool CNativeAddressBook::initSimAB()
{
	if(!LoadSimMgr())
	{
		LOG(INFO)  + "SimMgr is not found";
		return false;;
	}

	HRESULT h = lpfn_sim_initialize(0, NULL, 0, &m_hSim);
	if (SUCCEEDED(h))
	{
		if (SUCCEEDED(lpfn_sim_get_dev_caps(m_hSim, SIM_CAPSTYPE_ALL, &m_SimCaps)))
		{
				return true;
		}
		LOG(ERROR) + "Failed to get SIM capabilities.";
		lpfn_sim_deinitialize(m_hSim);
		m_hSim = NULL;
	}
	LOG(ERROR) + "Failed to init SIM. Error=" + (int)h;

	return false;
}

bool CNativeAddressBook::closeSimAB()
{
	lpfn_sim_deinitialize(m_hSim);
	return false;
}

CABRecord* CNativeAddressBook::getSimRecord(int id)
{
	CABSimRecord *pRecord;
	HRESULT hr = 0;

	pRecord = new CABSimRecord(id, m_hSim);

	if(pRecord) {
		if (SUCCEEDED(hr = pRecord->load())) {
			return pRecord;
		} else {
			if (SIM_E_NOTFOUND)
				LOG(ERROR) + "Failed to get SIM entry";
		}
	} else {
		LOG(ERROR) + "No more memory";
	}
	return NULL;
}

int CNativeAddressBook::getAllSimPhonebookRecords(std::vector<CABRecord*>& records)
{
	CABSimRecord *pRecord;
	HRESULT hr = 0;

	for(DWORD i = m_SimCaps.dwMinPBIndex; i <= m_SimCaps.dwMaxPBIndex; i++) {
		pRecord = new CABSimRecord(i, m_hSim);
		if(pRecord) {
			if (SUCCEEDED(hr = pRecord->load()))
				records.push_back(pRecord);
			else {
				if (SIM_E_NOTFOUND)
					break;
				LOG(ERROR) + "Failed to get SIM entry";
			}
		} else {
			LOG(ERROR) + "No more memory";
		}
	}

	return SUCCEEDED(hr) ? 1 : 0;
}

CABSimRecord::CABSimRecord(int index, HSIM hSim)
{
	m_hSim = hSim;
	m_index = index;
}

CABSimRecord::~CABSimRecord()
{
}

int CABSimRecord::load()
{
	SIMPHONEBOOKENTRY entry;

	String name, address;
	HRESULT hr = lpfn_sim_read_phonebook_entry(m_hSim, SIM_PBSTORAGE_SIM, m_index, &entry);
	if (SUCCEEDED(hr))
	{
		char buf[128];
		sprintf(buf,"{sim %ld}", m_index);
		setValue(RUBY_PB_ID,buf);

		setValue(RUBY_PB_FIRST_NAME, convertToStringA(entry.lpszText));
		setValue(RUBY_PB_MAIN_MUMBER, convertToStringA(entry.lpszAddress));
	}

	return hr;
}

int CABSimRecord::save()
{
	return 0;
}

int CABSimRecord::remove()
{
	return 0;
}

void CABSimRecord::saveValues()
{
}


text:
var Requests = function(){};

Requests.searchSpecNames = function(needles, callback) {
    $.ajax({
        url: baseurl+'/search/spec',
        type: 'post',
        dataType: 'json',
        traditional: true,
        success: function (data) {
            callback(data);
        },
        data: {'__FORM_TOKEN':form_token, 'q':needles}
    });
};

Requests.searchSpecDetails = function(spec, callback) {
    $.ajax({
        url: baseurl+'/search/specdetails',
        type: 'post',
        dataType: 'json',
        traditional: true,
        success: function (data) {
            callback(data);
        },
        data: {'__FORM_TOKEN':form_token, 'spec':spec}
    });
};

/*
 * Searches artifacts by attribute value.
 * The "attributes" argument is an object, with each key being the attribute name and
 * each value being an array of values to look for.
 * Eg: {'': ['eeny', 'meeny'], 'name': ['miny', 'curly moe'], }
 * The empty string denotes *any* attribute name.
 * The 'name' attribute would be searched with the pseudo-expression:
 * 'eeny' OR 'meeny' OR 'miny' OR ('curly' AND 'moe')
 * */
Requests.searchArtifacts = function(spec, attributes, callback) {
    $.ajax({
        url: baseurl+'/search/artifact',
        type: 'post',
        dataType: 'json',
        traditional: true,
        success: function (data) {
            callback(data);
        },
        data: {'__FORM_TOKEN':form_token, 'spec':JSON.stringify(spec), 'attributes':JSON.stringify(attributes)}
    });
};

Requests.searchRelatedPages = function(artifacts_by_id, callback) {
    $.ajax({
        url: baseurl+'/search/relatedpages',
        type: 'post',
        dataType: 'json',
        traditional: true,
        success: function (data) {
            callback(data);
        },
        error: function (data){
            error(data);
        },
        data: {'__FORM_TOKEN':form_token, 'attributes':JSON.stringify(artifacts_by_id)}
    });
};

Requests.getArtifactHtml = function(artifact_id, callback){
    $.ajax({
      url: baseurl+"/artifact/"+artifact_id+"?action=view&format=dialog",
      type: 'GET',
      dataType: 'html',
      traditional: true,
      success: function(data, textStatus, jqXHR) {
          callback(data);
      },
      error: undefined
    });
};

Requests.track_it_start = function(resource_type, resource_id, operation, embedded_in_resource_type, embedded_in_resource_id, callback){
    $.ajax({
        url: baseurl+"/tracking/start",
        type: 'POST',
        dataType: 'json',
        traditional: true,
        success: function (data) {
            callback(data);
        },
        data: {'__FORM_TOKEN':form_token, 'resource': JSON.stringify(
            {
                'resource_type': resource_type,
                'resource_id': resource_id,
                'operation': operation,
                'embedded_in_resource_type': embedded_in_resource_type,
                'embedded_in_resource_id': embedded_in_resource_id
            }
        )}
    });
};

Requests.track_it_end = function(id){
    $.ajax({
        url: baseurl+"/tracking/end",
        type: 'POST',
        dataType: 'json',
        traditional: true,
        async: false,
        data: {'__FORM_TOKEN':form_token, 'id': id}
    });
};


text:
namespace gpu {
namespace webgpu {
namespace cmds {

#define GPU_DAWN_RETURN_DATA_ALIGNMENT (8)
struct alignas(GPU_DAWN_RETURN_DATA_ALIGNMENT) DawnReturnDataHeader {
  DawnReturnDataType return_data_type;
};

static_assert(
    sizeof(DawnReturnDataHeader) % GPU_DAWN_RETURN_DATA_ALIGNMENT == 0,
    "DawnReturnDataHeader must align to GPU_DAWN_RETURN_DATA_ALIGNMENT");

struct DawnReturnCommandsInfoHeader {
  DawnReturnDataHeader return_data_header = {DawnReturnDataType::kDawnCommands};
};

static_assert(offsetof(DawnReturnCommandsInfoHeader, return_data_header) == 0,
              "The offset of return_data_header must be 0");

struct DawnReturnCommandsInfo {
  DawnReturnCommandsInfoHeader header;
  alignas(GPU_DAWN_RETURN_DATA_ALIGNMENT) char deserialized_buffer[];
};

static_assert(offsetof(DawnReturnCommandsInfo, header) == 0,
              "The offset of header must be 0");

struct DawnReturnAdapterInfoHeader {
  DawnReturnDataHeader return_data_header = {
      DawnReturnDataType::kRequestedDawnAdapterProperties};
  DawnRequestAdapterSerial request_adapter_serial;
  int32_t adapter_service_id;
};

static_assert(offsetof(DawnReturnAdapterInfoHeader, return_data_header) == 0,
              "The offset of return_data_header must be 0");

struct DawnReturnAdapterInfo {
  DawnReturnAdapterInfoHeader header;
  uint32_t adapter_properties_size;

  // |deserialized_buffer| contains the serialized adapter properties if
  // |adapter_properties_size > 0|. Following it is an optional null-terminated
  // error message.
  alignas(GPU_DAWN_RETURN_DATA_ALIGNMENT) char deserialized_buffer[];
};

static_assert(offsetof(DawnReturnAdapterInfo, header) == 0,
              "The offset of header must be 0");

struct DawnReturnRequestDeviceInfo {
  DawnReturnDataHeader return_data_header = {
      DawnReturnDataType::kRequestedDeviceReturnInfo};
  DawnRequestDeviceSerial request_device_serial;
  bool is_request_device_success;
  uint32_t limits_size;

  // |deserialized_buffer| contains the serialized limits if
  // |limits_size > 0|. Following it is an optional null-terminated
  // error message.
  alignas(GPU_DAWN_RETURN_DATA_ALIGNMENT) char deserialized_buffer[];
};

static_assert(offsetof(DawnReturnRequestDeviceInfo, return_data_header) == 0,
              "The offset of return_data_header must be 0");

// Command buffer is GPU_COMMAND_BUFFER_ENTRY_ALIGNMENT byte aligned.
#pragma pack(push, 4)
static_assert(GPU_COMMAND_BUFFER_ENTRY_ALIGNMENT == 4,
              "pragma pack alignment must be equal to "
              "GPU_COMMAND_BUFFER_ENTRY_ALIGNMENT");

#include "gpu/command_buffer/common/webgpu_cmd_format_autogen.h"

#pragma pack(pop)

}  // namespace cmds
}  // namespace webgpu
}  // namespace gpu
#endif  // GPU_COMMAND_BUFFER_COMMON_WEBGPU_CMD_FORMAT_H_


text:
/*!
 *  Copyright (c) 2014 by Contributors
 * \file tensor_blob.h
 * \brief TBlob class that holds common representation of
 *  arbirary dimension tensor, can be used to transformed
 *  to normal fixed dimenson tensor
 * \author Tianqi Chen
 */
#ifndef MXNET_TENSOR_BLOB_H_
#define MXNET_TENSOR_BLOB_H_

#include <dmlc/logging.h>
#include <dmlc/json.h>
#include <dlpack/dlpack.h>
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include "./base.h"

namespace mxnet {

// redefine DLPack enumeration to be backward compatible.
constexpr const int kCPU = kDLCPU;
constexpr const int kGPU = kDLGPU;
// extension type code under TVM function.
// Currently NNVM reserved 16 to 19 type code from TVM
// 16, 17, 18 is used by NNVM compiler already.
// Pick code 19 for MXNet NDArray
constexpr const int kTVMNDArrayTypeCode = 19;

/* Forward declaration for friend declaration in TBlob */
class NDArray;

/*!
 * \brief tensor blob class that can be used to hold tensor of any dimension,
 *  any device and any data type,
 *  This is a weak type that can be used to transfer data through interface
 *  TBlob itself do not involve any arithmentic operations,
 *  but it can be converted to tensor of fixed dimension for further operations
 *
 *  Like tensor, this data structure is like a pointer class and do not
 *  implicit allocated, de-allocate space.
 *  This data structure can be helpful to hold tensors of different dimensions
 *  and wait for further processing
 */
class TBlob {
  friend class NDArray;
 public:
  /*! \brief pointer to the data */
  void *dptr_;
  /*! \brief shape of the tensor */
  TShape shape_;
  /*! \brief type flag of the tensor blob */
  int type_flag_;

  /*! \brief default constructor, default copy assign will work */
  TBlob(void)
      : dptr_(NULL),
        type_flag_(mshadow::DataType<real_t>::kFlag) {
    SetDLTensor(cpu::kDevMask, 0);
  }
  /*!
   * \brief constructor that construct TBlob from contiguous memory
   * \param dptr the pointer to the memory
   * \param shape the shape of the data
   * \param dev_mask the device mask, can be cpu::kDevMask or gpu::kDevMask
   * \param dev_id the device id
   */
  template<typename DType>
  TBlob(DType *dptr, const TShape &shape, int dev_mask, int dev_id = -1)
      : dptr_(dptr), shape_(shape),
        type_flag_(mshadow::DataType<DType>::kFlag) {
    SetDLTensor(dev_mask, dev_id);
  }
  /*!
   * \brief constructor that construct TBlob from contiguous memory
   * \param dptr the pointer to the memory
   * \param shape the shape of the data
   * \param dev_mask the device mask, can be cpu::kDevMask or gpu::kDevMask
   * \param type_flag the type flag. Can be one of enum mshadow::dtype
   * \param dev_id the device id
   */
  TBlob(void *dptr, const TShape &shape, int dev_mask, int type_flag, int dev_id = -1)
      : dptr_(dptr), shape_(shape), type_flag_(type_flag) {
    SetDLTensor(dev_mask, dev_id);
  }
  /*!
   * \brief constructor from tensor
   * \param src source tensor
   * \tparam Device which device the tensor is on
   * \tparam dim tensor dimension
   * \tparam DType the type of elements in the tensor
   */
  template<typename Device, int dim, typename DType>
  TBlob(const mshadow::Tensor<Device, dim, DType> &src) {  // NOLINT(*)
    *this = src;
  }
  /*!
   * \brief assignment from tensor
   * \param src source tensor
   * \tparam Device which device the tensor is on
   * \tparam dim tensor dimension
   * \tparam DType the type of elements in the tensor
   * \return reference of self
   */
  template<typename Device, int dim, typename DType>
  inline TBlob &operator=(const mshadow::Tensor<Device, dim, DType> &src) {
    dptr_ = src.dptr_;
    shape_ = src.shape_;
    type_flag_ = mshadow::DataType<DType>::kFlag;
    SetDLTensor(Device::kDevMask, -1);
    return *this;
  }
  /*!
   * \return whether the tensor's memory is continuous
   */
  inline bool CheckContiguous(void) const {
    return true;
  }
  /*!
   * \brief reshape to shape
   * \param shape desired shape
   * \return reshaped blob
   */
  inline TBlob reshape(const TShape& shape) const {
    CHECK_EQ(this->shape_.Size(), shape.Size()) << "Shape size mismatch "
    << this->shape_.Size() << " v.s. "  << shape.Size();
    TBlob ret(this->dptr_, shape, this->dev_mask(), this->type_flag_, this->dev_id());
    return ret;
  }
  /*!
   * \brief flatten the tensor to 2 dimension, collapse the higher dimensions together
   * \param stream the possible stream target tensor should reside on
   * \tparam Device which device the tensor is on
   * \tparam DType the type of elements in the tensor
   * \return tensor after flatten
   */
  template<typename Device, typename DType>
  inline mshadow::Tensor<Device, 2, DType> FlatTo2D(
    mshadow::Stream<Device> *stream = NULL) const {
    CHECK(Device::kDevMask == this->dev_mask())
      << "TBlob.get: device type do not match specified type";
    CHECK(mshadow::DataType<DType>::kFlag == type_flag_)
      << "TBlob.get_with_shape: data type do not match specified type."
      << "Expected: " << type_flag_ << " v.s. given " << mshadow::DataType<DType>::kFlag;
    return mshadow::Tensor<Device, 2, DType>(static_cast<DType*>(dptr_),
                                             shape_.FlatTo2D(),
                                             shape_[shape_.ndim() - 1],
                                             stream);
  }
  /*!
   * \brief flatten the tensor to 1 dimension, collapse all the dimensions together.
   * \param stream the possible stream target tensor should reside on
   * \tparam Device which device the tensor is on
   * \tparam DType the type of elements in the tensor
   * \return tensor after flatten
   */
  template<typename Device, typename DType>
  inline mshadow::Tensor<Device, 1, DType> FlatTo1D(
      mshadow::Stream<Device> *stream = NULL) const {
    return this->get_with_shape<Device, 1, DType>(
        mshadow::Shape1(shape_.Size()), stream);
  }
  /*! \brief return number of dimension of the tensor inside */
  inline int ndim(void) const {
    return shape_.ndim();
  }
  /*!
   * \brief return size of i-th dimension, start counting from highest dimension
   * \param idx the dimension count from the highest dimensin
   * \return the size
   */
  inline index_t size(index_t idx) const {
    return shape_[idx];
  }
  /*! \brief total number of elements in the tensor */
  inline index_t Size(void) const {
    return shape_.Size();
  }
  /*! \brief get pointer in dtype */
  template<typename DType>
  inline DType* dptr() const {
    CHECK(mshadow::DataType<DType>::kFlag == type_flag_)
      << "TBlob.get_with_shape: data type do not match specified type."
      << "Expected: " << type_flag_ << " v.s. given " << mshadow::DataType<DType>::kFlag;
    return static_cast<DType*>(dptr_);
  }
  /*! \brief device mask of the corresponding device */
  inline int dev_mask() const {
    return dltensor_.ctx.device_type;
  }
  /*! \brief device index of the corresponding device */
  inline int dev_id() const {
    return dltensor_.ctx.device_id;
  }
  /*!
   * \brief return the corresponding DLTensor
   * \return the address of internal DLTensor
   */
  inline const DLTensor& dltensor() const {
    return dltensor_;
  }

  /*!
   * \brief fetch the tensor, with respect to specific dimension
   * if dim do not match the stored dimension, an error will be issued
   * \return the tensor requested
   * \param stream the possible stream target tensor should reside on
   * \tparam Device which device the tensor is on
   * \tparam dim dimension of the tensor
   * \tparam DType the type of elements in the tensor
   */
  template<typename Device, int dim, typename DType>
  inline mshadow::Tensor<Device, dim, DType> get(mshadow::Stream<Device> *stream = NULL) const {
    CHECK(Device::kDevMask == this->dev_mask())
      << "TBlob.get: device type do not match specified type";
    return mshadow::Tensor<Device, dim, DType>(dptr<DType>(),
        shape_.get<dim>(), shape_[shape_.ndim() - 1], stream);
  }
  /*!
   * \brief fetch a tensor in given shape
   *  If size do not match the stored size, an error will be issued
   * \return the tensor requested
   * \param shape the shape required
   * \param stream the possible stream target tensor should reside on
   * \tparam Device which device the tensor is on
   * \tparam dim dimension of the tensor
   * \tparam DType the type of elements in the tensor
   */
  template<typename Device, int dim, typename DType>
  inline mshadow::Tensor<Device, dim, DType> get_with_shape(
      const mshadow::Shape<dim> &shape,
      mshadow::Stream<Device> *stream = NULL) const {
    CHECK(Device::kDevMask == this->dev_mask())
      << "TBlob.get: device type do not match specified type";
    CHECK_EQ(this->CheckContiguous(), true) << "TBlob.get_reshape: must be contiguous";
    CHECK_EQ(this->shape_.Size(), shape.Size())
      << "TBlob.get_with_shape: new and old shape do not match total elements";
    return mshadow::Tensor<Device, dim, DType>(dptr<DType>(), shape,
                                               shape[dim - 1], stream);
  }
  /*!
   * \brief flatten the tensor to 3 dimension,
   *  collapse the dimension before and after specified axis.
   * \param axis The axis specified.
   * \param stream the possible stream target tensor should reside on
   * \tparam Device which device the tensor is on
   * \tparam DType the type of elements in the tensor
   * \return tensor after flatten
   */
  template<typename Device, typename DType>
  inline mshadow::Tensor<Device, 3, DType> FlatTo3D(
      int axis, mshadow::Stream<Device> *stream = NULL) const {
    return this->get_with_shape<Device, 3, DType>(
        this->shape_.FlatTo3D(axis), stream);
  }
  /*!
   * \brief flatten the tensor to 3 dimension,
   *  collapse the dimension: [0, axis_begin), [axis_begin, axis_end], (axis_end, ndim).
   * \param axis_begin The beginning axis specified.
   * \param axis_end The ending axis specified.
   * \param stream the possible stream target tensor should reside on
   * \tparam Device which device the tensor is on
   * \tparam DType the type of elements in the tensor
   * \return tensor after flatten
   */
  template<typename Device, typename DType>
  inline mshadow::Tensor<Device, 3, DType> FlatTo3D(
      int axis_begin, int axis_end,
      mshadow::Stream<Device> *stream = NULL) const {
    return this->get_with_shape<Device, 3, DType>(
        this->shape_.FlatTo3D(axis_begin, axis_end), stream);
  }
  /*!
   * \brief flatten the tensor to specified number of dimensions,
   *  collapse the highest dimensions or pad with higher dimensions
   * \param stream the possible stream target tensor should reside on
   * \tparam Device which device the tensor is on
   * \tparam dim desired number of dimensions of returned tensor
   * \tparam DType the type of elements in the tensor
   * \return tensor after flatten
   */
  template<typename Device, int dim, typename DType>
  inline mshadow::Tensor<Device, dim, DType> FlatToKD(
     mshadow::Stream<Device> *stream = NULL) const {
    mshadow::Shape<dim> shape;
    shape[0] = 1;
    // Pad higher dimensions in case dim > ndim()
    for (int i = 0; i < dim - ndim(); ++i) {
      shape[i] = 1;
    }
    // Collapse higher dimensions in case dim < ndim()
    for (int i = 0; i < ndim() - dim + 1; ++i) {
      shape[0] *= shape_[i];
    }
    // Preserve lower dimensions.
    for (int i = std::max(0, ndim() - dim + 1); i < ndim(); ++i) {
      shape[i - ndim() + dim] = shape_[i];
    }
    return this->get_with_shape<Device, dim, DType>(shape, stream);
  }

 private:
  static DLDataType DTypeTransform(int type_flag) {
    switch (type_flag) {
      case mshadow::kFloat32: return DLDataType{kDLFloat, 32, 1};
      case mshadow::kFloat64: return DLDataType{kDLFloat, 64, 1};
      case mshadow::kFloat16: return DLDataType{kDLFloat, 16, 1};
      case mshadow::kUint8: return DLDataType{kDLUInt, 8, 1};
      case mshadow::kInt32: return DLDataType{kDLInt, 32, 1};
      case mshadow::kInt8: return DLDataType{kDLInt, 8, 1};
      case mshadow::kInt64: return DLDataType{kDLInt, 64, 1};
      default: {
        LOG(FATAL) << "Unknown type_flag=" << type_flag;
        return DLDataType();
      }
    }
  }

  inline void SetDLTensor(int dev_mask, int dev_id) {
    dltensor_.data = dptr_;
    dltensor_.ctx = DLContext{static_cast<DLDeviceType>(dev_mask), dev_id};
    dltensor_.ndim = shape_.ndim();
    dltensor_.dtype = DTypeTransform(type_flag_);
    dltensor_.shape = shape_.data();
    dltensor_.strides = NULL;
    dltensor_.byte_offset = 0;
  }

 private:
  /*! \brief corresponding DLTensor of this TBlob */
  DLTensor dltensor_;
};
}  // namespace mxnet

namespace dmlc {
// Add a few patches to support TShape in dmlc/parameter.
DMLC_DECLARE_TYPE_NAME(mxnet::TShape, "Shape(tuple)");
DMLC_DECLARE_TYPE_NAME(nnvm::Tuple<int>, "Shape(tuple)");
DMLC_DECLARE_TYPE_NAME(nnvm::Tuple<dmlc::optional<int>>, "Shape(tuple)");

namespace parameter {

template<>
class FieldEntry<mxnet::TShape>
    : public FieldEntryBase<FieldEntry<mxnet::TShape>, mxnet::TShape> {
 public:
  FieldEntry() : enforce_nonzero_(false), expect_ndim_(0) {}
  // parent class
  typedef FieldEntryBase<FieldEntry<mxnet::TShape>, mxnet::TShape> Parent;

  virtual void Check(void *head) const {
    Parent::Check(head);
    mxnet::TShape &v = this->Get(head);
    if (expect_ndim_ != 0 && v.ndim() != expect_ndim_) {
      std::ostringstream os;
        os << "value " << v << "for Parameter " << this->key_
           << " has wrong dimensions, expected dimension=" << expect_ndim_;
        throw dmlc::ParamError(os.str());
    }
    if (enforce_nonzero_) {
      for (mxnet::index_t i = 0; i < v.ndim(); ++i) {
        if (v[i] == 0U) {
          std::ostringstream os;
          os << "value " << v << "for Parameter " << this->key_
             << " is invalid, the input shape must be nonzero in all dimensions";
          throw dmlc::ParamError(os.str());
        }
      }
    }
  }
  inline FieldEntry<mxnet::TShape> &enforce_nonzero() {
    this->enforce_nonzero_ = true;
    return this->self();
  }
  inline FieldEntry<mxnet::TShape> &set_expect_ndim(mxnet::index_t ndim) {
    expect_ndim_ = ndim;
    return this->self();
  }

 private:
  // whether all the entries need to be nonzero
  bool enforce_nonzero_;
  // expected number of dimension, default = 0 means no restriction.
  mxnet::index_t expect_ndim_;
};

}  // namespace parameter
}  // namespace dmlc

#endif  // MXNET_TENSOR_BLOB_H_


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**AssetIdExchange** | **string** | Exchange currency code. | [optional]
**AssetIdCoinapi** | **string** | CoinAPI currency code. | [optional]
**Balance** | **double** | Value of the current total currency balance on the exchange. | [optional]
**Available** | **double** | Value of the current available currency balance on the exchange that can be used as collateral. | [optional]
**Locked** | **double** | Value of the current locked currency balance by the exchange. | [optional]
**LastUpdatedBy** | **string** | Source of the last modification.  | [optional]
**RateUsd** | **double** | Current exchange rate to the USD for the single unit of the currency.  | [optional]
**Traded** | **double** | Value of the current total traded. | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


text:
function(checkPackageInfo_ TYPE FILE REGEX)
  set(whitespaces_ "[\t\n\r ]*")

  getPackageInfo("${FILE}" "FILE_INFO_")
  if(NOT FILE_INFO_ MATCHES "${REGEX}")
    message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'")
  endif()
endfunction()

# check package name
checkPackageInfo_("name" "${FOUND_FILE_1}" ".*Package${whitespaces_}:${whitespaces_}per_component-pkg_1")
checkPackageInfo_("name" "${FOUND_FILE_2}" ".*Package${whitespaces_}:${whitespaces_}second")
checkPackageInfo_("name" "${FOUND_FILE_3}" ".*Package${whitespaces_}:${whitespaces_}per_component-pkg_3")

# check package group
checkPackageInfo_("group" "${FOUND_FILE_1}" ".*Section${whitespaces_}:${whitespaces_}default")
checkPackageInfo_("group" "${FOUND_FILE_2}" ".*Section${whitespaces_}:${whitespaces_}second_group")
checkPackageInfo_("group" "${FOUND_FILE_3}" ".*Section${whitespaces_}:${whitespaces_}default")