text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = require("react");

var _react2 = _interopRequireDefault(_react);

var _d3Selection = require("d3-selection");

var _propTypes = require("prop-types");

var _propTypes2 = _interopRequireDefault(_propTypes);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

// components

var Brush = function (_React$Component) {
  _inherits(Brush, _React$Component);

  function Brush(props) {
    _classCallCheck(this, Brush);

    var _this = _possibleConstructorReturn(this, (Brush.__proto__ || Object.getPrototypeOf(Brush)).call(this, props));

    _this.createBrush = _this.createBrush.bind(_this);
    return _this;
  }

  _createClass(Brush, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      this.createBrush();
    }
  }, {
    key: "createBrush",
    value: function createBrush() {
      var node = this.node;
      var brush = this.props.svgBrush;
      (0, _d3Selection.select)(node).call(brush);
      if (this.props.selectedExtent) {
        (0, _d3Selection.select)(node).call(brush.move, this.props.selectedExtent);
      }
    }
  }, {
    key: "render",
    value: function render() {
      var _this2 = this;

      return _react2.default.createElement("g", {
        ref: function ref(node) {
          return _this2.node = node;
        },
        transform: "translate(" + (this.props.position || [0, 0]) + ")",
        className: "xybrush"
      });
    }
  }]);

  return Brush;
}(_react2.default.Component);

Brush.propTypes = {
  size: _propTypes2.default.array,
  position: _propTypes2.default.array,
  selectedExtent: _propTypes2.default.array,
  svgBrush: _propTypes2.default.func
};

exports.default = Brush;
module.exports = exports['default'];

redpajama_set_name: RedPajamaGithub


text:
var Demo = Demo || {};

Demo.Scene = function (containerId, dims) {

  this.scene = new THREE.Scene();
  this.projector = new THREE.Projector();
  this.renderer = new THREE.WebGLRenderer({antialias: true});

  this.jqContainer = $('#' + containerId);
  this.container = document.getElementById(containerId);

  // an array of scene elements we're interested in colliding with
  this.collisions = [];

  // rays for casting.
  this.rays = [];

  // arrows visualizing vectors
  this.arrows = [];

  this.cameras = null;
  this.setup = null;
  this.controls = null;

  this.players = [];

  this.rotateCamera = true;

  this.theta = 0;
  this.radius = 100;

  this.init(dims);

};

Demo.Scene.prototype = {

  init: function (dims) {

    var params = {context: this, cubes: dims};
    this.cameras = new Demo.Scene.Cameras(params);
    this.setup = new Demo.Scene.Setup(params);
    this.controls = new THREE.OrbitControls( this.cameras.liveCam, this.container );

    this.listeners();
  },

  listeners: function () {
    var me = this;
    window.addEventListener('resize', me.onWindowResize, false);
  },

  /**
   * Resizes the camera when document is resized.
   * @return {[type]}
   */
  onWindowResize: function () {
    this.liveCam.aspect = this.jqContainer.width() / this.jqContainer.height();
    this.liveCam.updateProjectionMatrix();
    this.renderer.setSize(this.jqContainer.width(), this.jqContainer.height());
  },

  /**
   * Animates the scene
   * @param {Boolean} animate
   */
  animate: function (animate) {
    this.rotateCamera = animate || true;
    // NOTE: using the global variable "demo" instead of "this".
      requestAnimationFrame(demo.scene.animate);
      demo.scene.render();
  },

  /**
   * Renders the WebGL scene
   */
  render: function () {

    this.controls.update();

    if(this.rotateCamera){
      this.theta += 0.3;

      this.cameras.liveCam.position.x = this.radius * Math.sin(THREE.Math.degToRad(this.theta));
      this.cameras.liveCam.position.y = this.radius * Math.sin(THREE.Math.degToRad(this.theta));
      this.cameras.liveCam.position.z = this.radius * Math.cos(THREE.Math.degToRad(this.theta));
      this.cameras.liveCam.lookAt(this.scene.position);
    } else {
      this.controls.update();
    }

    // NOTE: using the global variable "demo" instead of "this".
    this.renderer.render(this.scene, demo.scene.cameras.liveCam);
  }
};


text:
.class public Lcom/htc/opensense/plugin/ItemViewProxy$ViewProxyException;
.super Ljava/lang/RuntimeException;
.source "ItemViewProxy.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/htc/opensense/plugin/ItemViewProxy;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x9
    name = "ViewProxyException"
.end annotation

# static fields
.field private static final serialVersionUID:J = -0x17d284a83cddf77cL

# direct methods
.method public constructor <init>(Ljava/lang/Exception;)V
    .locals 0
    .parameter "ex"

    .prologue
    .line 234
    invoke-direct {p0, p1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/Throwable;)V

    .line 235
    return-void
.end method

.method public constructor <init>(Ljava/lang/String;)V
    .locals 0
    .parameter "message"

    .prologue
    .line 242
    invoke-direct {p0, p1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    .line 243
    return-void
.end method


text:
package com.budiyev.android.wheels;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.net.HttpURLConnection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

/**
 * Request result of {@link HttpRequest}
 */
public final class HttpRequestResult {
    public static final int NONE = -1;
    public static final int SUCCESS = 1;
    public static final int ERROR_HTTP = 2;
    public static final int ERROR_MALFORMED_URL = 3;
    public static final int ERROR_UNSUPPORTED_ENCODING = 4;
    public static final int ERROR_PROTOCOL = 5;
    public static final int ERROR_IO = 6;
    public static final int ERROR_UNEXPECTED = 7;

    /**
     * Type of this result
     *

     * {@link #NONE} - No result
     *

     * {@link #SUCCESS} - Success, see {@link #getHttpCode()} for details
     *

     * {@link #ERROR_HTTP} - HTTP error, see {@link #getHttpCode()}
     * and {@link #getException()} for details
     *

     * {@link #ERROR_MALFORMED_URL} - Malformed URL,
     * see {@link #getException()} for details
     *

     * {@link #ERROR_UNSUPPORTED_ENCODING} - Unsupported text encoding,
     * see {@link #getException()} for details
     *

     * {@link #ERROR_PROTOCOL} - Protocol error,
     * see {@link #getException()} for details
     *

     * {@link #ERROR_IO} - IO error,
     * see {@link #getException()} for details
     *

     * {@link #ERROR_UNEXPECTED} - Unexpected error,
     * see {@link #getException()} for details
     */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({NONE, SUCCESS, ERROR_HTTP, ERROR_MALFORMED_URL, ERROR_UNSUPPORTED_ENCODING, ERROR_PROTOCOL, ERROR_IO,
            ERROR_UNEXPECTED})
    public @interface ResultType {
    }

    public static final int STREAM = 1;
    public static final int STRING = 2;

    /**
     * Result data type
     *

     * {@link #NONE} - No data received
     *

     * {@link #STREAM} - {@link InputStream}
     * via {@link #getDataStream()}
     *

     * {@link #STRING} - {@link String}
     * via {@link #getDataString()}
     */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({NONE, STRING, STREAM})
    public @interface DataType {
    }

    private static final int BUFFER_SIZE = 8192;

    private final Lock mDataLock = new ReentrantLock();
    private volatile String mDataString;
    private volatile InputStream mDataStream;
    private volatile Map<String, List<String>> mHeaderFields;
    private volatile Exception mException;
    private volatile HttpURLConnection mConnection;
    private volatile int mHttpCode = NONE;

    @DataType
    private volatile int mDataType = NONE;

    @ResultType
    private volatile int mResultType = NONE;

    HttpRequestResult() {
    }

    /**
     * Result type
     */
    @ResultType
    public int getResultType() {
        return mResultType;
    }

    /**
     * {@link String} representation of {@link #getResultType()}
     */
    @NonNull
    public String getResultTypeString() {
        switch (getResultType()) {
            case ERROR_HTTP: {
                return "ERROR_HTTP";
            }
            case ERROR_IO: {
                return "ERROR_IO";
            }
            case ERROR_MALFORMED_URL: {
                return "ERROR_MALFORMED_URL";
            }
            case ERROR_PROTOCOL: {
                return "ERROR_PROTOCOL";
            }
            case ERROR_UNEXPECTED: {
                return "ERROR_UNEXPECTED";
            }
            case ERROR_UNSUPPORTED_ENCODING: {
                return "ERROR_UNSUPPORTED_ENCODING";
            }
            case NONE: {
                return "NONE";
            }
            case SUCCESS: {
                return "SUCCESS";
            }
            default: {
                throw new IllegalArgumentException();
            }
        }
    }

    /**
     * Result data type
     */
    @DataType
    public int getDataType() {
        mDataLock.lock();
        try {
            return mDataType;
        } finally {
            mDataLock.unlock();
        }
    }

    /**
     * {@link String} representation of {@link #getDataType()}
     */
    @NonNull
    public String getDataTypeString() {
        switch (getDataType()) {
            case NONE: {
                return "NONE";
            }
            case STREAM: {
                return "STREAM";
            }
            case STRING: {
                return "STRING";
            }
            default: {
                throw new IllegalArgumentException();
            }
        }
    }

    /**
     * HTTP response code, can be {@link #NONE}
     */
    public int getHttpCode() {
        return mHttpCode;
    }

    /**
     * Result data of the request as {@link String}
     *

     * Available if {@link #getDataType()} is {@link #STRING}
     * or {@link #STREAM}.
     *

     * If {@link #getDataType()} is {@link #STREAM}, it can be
     * changed to {@link #STRING} or {@link #NONE} after call
     * of this method. Response stream will be read and closed.
     *
     * @return Result string
     */
    @Nullable
    public String getDataString() {
        return getDataString(HttpRequest.CHARSET_UTF_8);
    }

    /**
     * Result data of the request as {@link String}
     *

     * Available if {@link #getDataType()} is {@link #STRING} or {@link #STREAM}.
     *

     * If {@link #getDataType()} is {@link #STREAM}, it can be
     * changed to {@link #STRING} or {@link #NONE} after call
     * of this method. The response stream will be read and closed.
     *
     * @param charset Response stream charset name
     * @return Result string
     */
    @Nullable
    public String getDataString(@NonNull String charset) {
        mDataLock.lock();
        try {
            if (mDataType == STREAM) {
                InputStream stream = mDataStream;
                if (stream == null) {
                    return null;
                }
                try {
                    InputStreamReader streamReader = new InputStreamReader(stream, charset);
                    StringBuilder responseBuilder = new StringBuilder();
                    char[] buffer = new char[BUFFER_SIZE];
                    for (int read; ; ) {
                        read = streamReader.read(buffer);
                        if (read != -1) {
                            responseBuilder.append(buffer, 0, read);
                        } else {
                            break;
                        }
                    }
                    String response = responseBuilder.toString();
                    mDataString = response;
                    mDataType = STRING;
                    return response;
                } catch (IOException e) {
                    mDataType = NONE;
                    mDataString = null;
                    return null;
                } finally {
                    CommonUtils.close(stream);
                }
            } else if (mDataType == STRING) {
                return mDataString;
            } else {
                return null;
            }
        } finally {
            mDataLock.unlock();
        }
    }

    /**
     * Result data of the request as {@link InputStream}
     *

     * Available if {@link #getDataType()} is {@link #STREAM}
     *
     * @return Result data stream
     */
    @Nullable
    public InputStream getDataStream() {
        mDataLock.lock();
        try {
            return mDataStream;
        } finally {
            mDataLock.unlock();
        }
    }

    /**
     * Unmodifiable map of response header fields and values
     *

     * Available if {@link #getResultType()} is {@link #SUCCESS} or {@link #ERROR_HTTP}
     */
    @Nullable
    public Map<String, List<String>> getHeaderFields() {
        return mHeaderFields;
    }

    /**
     * Exception, if {@link #getResultType()} is one of
     * {@link #ERROR_MALFORMED_URL}, {@link #ERROR_UNSUPPORTED_ENCODING},
     * {@link #ERROR_PROTOCOL}, {@link #ERROR_IO},
     * {@link #ERROR_UNEXPECTED}
     */
    @Nullable
    public Exception getException() {
        return mException;
    }

    /**
     * Releases current connection so that its resources may be either reused or closed
     */
    public void disconnect() {
        HttpURLConnection connection = mConnection;
        if (connection != null) {
            connection.disconnect();
        }
    }

    void setResultType(@ResultType int resultType) {
        mResultType = resultType;
    }

    void setHttpCode(int httpCode) {
        mHttpCode = httpCode;
    }

    void setDataStream(@Nullable InputStream dataStream) {
        mDataLock.lock();
        try {
            mDataStream = dataStream;
            if (dataStream == null) {
                mDataType = NONE;
            } else {
                mDataType = STREAM;
            }
        } finally {
            mDataLock.unlock();
        }
    }

    void setHeaderFields(@Nullable Map<String, List<String>> headerFields) {
        mHeaderFields = headerFields;
    }

    void setException(@Nullable Exception exception) {
        mException = exception;
    }

    void setConnection(@Nullable HttpURLConnection connection) {
        mConnection = connection;
    }

    @Override
    public int hashCode() {
        return CommonUtils.hash(mDataString, mDataType, mDataStream, mHeaderFields, mResultType, mHttpCode);
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        } else if (obj instanceof HttpRequestResult) {
            HttpRequestResult other = (HttpRequestResult) obj;
            return mDataType == other.mDataType && mResultType == other.mResultType && mHttpCode == other.mHttpCode &&
                    CommonUtils.equals(mDataString, other.mDataString) &&
                    CommonUtils.equals(mDataStream, other.mDataStream) &&
                    CommonUtils.equals(mHeaderFields, other.mHeaderFields);
        } else {
            return false;
        }
    }

    @Override
    public String toString() {
        return "HttpRequestResult [result type: " + getResultTypeString() + "; data type: " + getDataTypeString() +
                "; response code: " + (mHttpCode == -1 ? "NONE" : mHttpCode) + "]";
    }
}


text:
package fake

import (
	"path/filepath"
	"strings"

	"github.com/golang/glog"

	"k8s.io/gengo/generator"
	"k8s.io/gengo/types"
	clientgenargs "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/args"
	clientgentypes "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/types"
)

func PackageForGroup(gv clientgentypes.GroupVersion, typeList []*types.Type, clientsetPackage string, inputPackage string, boilerplate []byte, generatedBy string) generator.Package {
	outputPackage := strings.ToLower(filepath.Join(clientsetPackage, "typed", gv.Group.NonEmpty(), gv.Version.NonEmpty(), "fake"))
	// TODO: should make this a function, called by here and in client-generator.go
	realClientPackage := filepath.Join(clientsetPackage, "typed", gv.Group.NonEmpty(), gv.Version.NonEmpty())
	return &generator.DefaultPackage{
		PackageName: "fake",
		PackagePath: outputPackage,
		HeaderText:  boilerplate,
		PackageDocumentation: []byte(
			generatedBy +
				`// Package fake has the automatically generated clients.
`),
		// GeneratorFunc returns a list of generators. Each generator makes a
		// single file.
		GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) {
			generators = []generator.Generator{
				// Always generate a "doc.go" file.
				generator.DefaultGen{OptionalName: "doc"},
			}
			// Since we want a file per type that we generate a client for, we
			// have to provide a function for this.
			for _, t := range typeList {
				generators = append(generators, &genFakeForType{
					DefaultGen: generator.DefaultGen{
						OptionalName: "fake_" + strings.ToLower(c.Namers["private"].Name(t)),
					},
					outputPackage: outputPackage,
					inputPackage:  inputPackage,
					group:         gv.Group.NonEmpty(),
					version:       gv.Version.String(),
					typeToMatch:   t,
					imports:       generator.NewImportTracker(),
				})
			}

			generators = append(generators, &genFakeForGroup{
				DefaultGen: generator.DefaultGen{
					OptionalName: "fake_" + gv.Group.NonEmpty() + "_client",
				},
				outputPackage:     outputPackage,
				realClientPackage: realClientPackage,
				group:             gv.Group.NonEmpty(),
				version:           gv.Version.String(),
				types:             typeList,
				imports:           generator.NewImportTracker(),
			})
			return generators
		},
		FilterFunc: func(c *generator.Context, t *types.Type) bool {
			return extractBoolTagOrDie("genclient", t.SecondClosestCommentLines) == true
		},
	}
}

func extractBoolTagOrDie(key string, lines []string) bool {
	val, err := types.ExtractSingleBoolCommentTag("+", key, false, lines)
	if err != nil {
		glog.Fatalf(err.Error())
	}
	return val
}

func PackageForClientset(customArgs clientgenargs.Args, fakeClientsetPackage string, boilerplate []byte, generatedBy string) generator.Package {
	return &generator.DefaultPackage{
		// TODO: we'll generate fake clientset for different release in the future.
		// Package name and path are hard coded for now.
		PackageName: "fake",
		PackagePath: filepath.Join(fakeClientsetPackage, "fake"),
		HeaderText:  boilerplate,
		PackageDocumentation: []byte(
			generatedBy +
				`// This package has the automatically generated fake clientset.
`),
		// GeneratorFunc returns a list of generators. Each generator generates a
		// single file.
		GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) {
			generators = []generator.Generator{
				// Always generate a "doc.go" file.
				generator.DefaultGen{OptionalName: "doc"},

				&genClientset{
					DefaultGen: generator.DefaultGen{
						OptionalName: "clientset_generated",
					},
					groups:               customArgs.Groups,
					fakeClientsetPackage: fakeClientsetPackage,
					outputPackage:        "fake",
					imports:              generator.NewImportTracker(),
					realClientsetPackage: filepath.Join(customArgs.ClientsetOutputPath, customArgs.ClientsetName),
				},
			}
			return generators
		},
	}
}


text:
<?php

namespace App\Validators;

class StubaEmailValidator
{

    public function validate($attribute, $value, $parameters, $validator)
    {
        if (\Validator::make([ $attribute => $value ], [ $attribute => 'email' ])->passes()) {
            $email_parts = explode('@', $value);
            if ($email_parts[1] == 'stuba.sk' || $email_parts[1] == 'is.stuba.sk') {
                return true;
            }
        }

        return false;
    }
}


text:
package com.kozaxinan.fixoposcreen.iab;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;

import com.kozaxinan.fixoposcreen.AppSettings;
import com.kozaxinan.fixoposcreen.BuildConfig;
import com.kozaxinan.fixoposcreen.R;
import com.kozaxinan.fixoposcreen.iab.utils.IabHelper;
import com.kozaxinan.fixoposcreen.iab.utils.IabResult;
import com.kozaxinan.fixoposcreen.iab.utils.Inventory;
import com.kozaxinan.fixoposcreen.iab.utils.Purchase;
import com.kozaxinan.fixoposcreen.iab.utils.ViewUtils;
import com.splunk.mint.Mint;

import java.util.HashSet;

/**
 * Fragment that represents an ability to donate to me. Be sure to redirect
 * {@link android.app.Activity#onActivityResult(int, int, android.content.Intent)}
 * to this fragment!
 *
 * @author Artem Chepurnoy
 */
public class DonationFragment extends DialogFragment {

	private static final String TAG = "DonationFragment";

	public static final int RC_REQUEST = 10001;

	private GridView mGridView;

	private ProgressBar mProgressBar;

	private TextView mError;

	private IabHelper mHelper;

	private Donation[] mDonationList;

	private final HashSet<String> mInventorySet = new HashSet<String>();

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mDonationList = DonationItems.get(getResources());
    }

    @Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		Activity activity = getActivity();
		assert activity != null;

		View view = new DialogHelper.Builder(activity)
				.setIcon(R.drawable.ic_dialog_donation)
				.setTitle(R.string.donation_title)
				.setView(R.layout.donation_dialog)
				.createSkeletonView();
		AlertDialog.Builder builder = new AlertDialog.Builder(activity)
				.setView(view)
				.setNegativeButton(R.string.close, null);

		TextView info = (TextView) view.findViewById(R.id.info);
		info.setText(getString(R.string.donation_info));
		info.setMovementMethod(new LinkMovementMethod());

		mError = (TextView) view.findViewById(R.id.error);
		mProgressBar = (ProgressBar) view.findViewById(android.R.id.progress);
		mGridView = (GridView) view.findViewById(R.id.grid);
		mGridView.setAdapter(new DonationAdapter(getActivity(), mDonationList, mInventorySet));
		mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				DonationAdapter adapter = (DonationAdapter) parent.getAdapter();
				Donation donation = adapter.getItem(position);

				if (!mInventorySet.contains(donation.sku)) {
					/**
					 * See {@link com.kozaxinan.fixoposcreen.iab.DonationFragment#verifyDeveloperPayload(Purchase)}.
					 */
					String payload = "";
					try {
						mHelper.launchPurchaseFlow(getActivity(), donation.sku, RC_REQUEST, mPurchaseFinishedListener, payload);
					} catch (Exception e) {
						e.printStackTrace();
						Toast.makeText(getActivity(), "Failed to launch a purchase flow.", Toast.LENGTH_SHORT).show();
					}
				} else {
					Toast.makeText(getActivity(), getString(R.string.donation_item_bought), Toast.LENGTH_SHORT).show();
				}

				DonationFragment.this.dismiss();
			}
		});

		final AlertDialog alertDialog;

		alertDialog = builder.create();

		initBilling();

		return alertDialog;
	}

	/**
	 * Shows a warning alert dialog to note, that those methods
	 * may suck hard and nobody will care about it.

	 * Starts an intent if user is agree with it.
	 */
	private void startPaymentIntentWithWarningAlertDialog(final Intent intent) {
		CharSequence messageText = getString(R.string.donation_no_responsibility);
		new DialogHelper.Builder(getActivity())
				.setMessage(messageText)
				.wrap()
				.setNegativeButton(android.R.string.cancel, null)
				.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
					@Override
					public void onClick(DialogInterface dialog, int which) {
						try {
							startActivity(intent);
							dismiss(); // Dismiss main fragment
						} catch (ActivityNotFoundException e) { /* hell no */ }
					}
				})
				.create()
				.show();
	}

	private void setWaitScreen(boolean loading) {
		ViewUtils.setVisible(mProgressBar, loading);
		ViewUtils.setVisible(mGridView, !loading);
		ViewUtils.setVisible(mError, false);
	}

	private void setErrorScreen(String errorMessage, final Runnable runnable) {
		mProgressBar.setVisibility(View.GONE);
		mGridView.setVisibility(View.GONE);
		mError.setVisibility(View.VISIBLE);
		mError.setText(errorMessage);
		mError.setOnClickListener(runnable != null ? new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				runnable.run();
			}
		} : null);
	}

	/**
	 * Updates GUI to display changes.
	 */
	private void updateUi() {
		DonationAdapter adapter = (DonationAdapter) mGridView.getAdapter();
		adapter.notifyDataSetChanged();
	}

	@Override
	public void onDestroy() {
		super.onDestroy();
		disposeBilling();
	}

	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		if (mHelper.handleActivityResult(requestCode, resultCode, data)) {
			return;
		}

		super.onActivityResult(requestCode, resultCode, data);
	}

	private final IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener =
			new IabHelper.OnIabPurchaseFinishedListener() {
				public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
					if (mHelper == null) {
						return;
					}
					if (result.isFailure()) {
						complain("Error purchasing: " + result);
						setWaitScreen(false);
						return;
					}

					if (!verifyDeveloperPayload(purchase)) {
						complain("Error purchasing. Authenticity verification failed.");
						setWaitScreen(false);
						return;
					}

					if (purchase == null) {
						return;
					}

					String sku = purchase.getSku();
					mInventorySet.add(sku);

					if (!sku.equals("donation_1") && getActivity() != null) {
						AppSettings.getInstance().setPro(getActivity(), true);
					}

					if (!BuildConfig.DEBUG) {
						Mint.logEvent("donated");
					}
				}
			};

	private final IabHelper.QueryInventoryFinishedListener mGotInventoryListener =
			new IabHelper.QueryInventoryFinishedListener() {
				public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
					if (mHelper == null) {
						return;
					}
					if (result.isFailure()) {
						complain("Failed to query inventory: " + result);
						return;
					}

					mInventorySet.clear();
					for (Donation donation : mDonationList) {
						Purchase purchase = inventory.getPurchase(donation.sku);
						boolean isBought = (purchase != null && verifyDeveloperPayload(purchase));

						if (isBought) {
							mInventorySet.add(donation.sku);
						}
					}

                    /*
					// Fake items to debug user interface.
                    mInventorySet.add(mDonationList[0].sku);
                    mInventorySet.add(mDonationList[1].sku);
                    mInventorySet.add(mDonationList[2].sku);
                    */

					updateUi();
					setWaitScreen(false);

					if (!mInventorySet.isEmpty()) {
						if (getActivity() != null) {
							AppSettings.getInstance().setPro(getActivity(), true);
						}
					}
				}
			};

	/**
	 * Releases billing service.
	 *
	 * @see #initBilling()
	 */
	private void disposeBilling() {
		try {
			if (mHelper != null) {
				mHelper.dispose();
				mHelper = null;
			}
		} catch (Exception e) {
			Mint.logException(e);
			mHelper = null;
		}
	}

	/**
	 * Make sure you call {@link #disposeBilling()}!
	 *
	 * @see #disposeBilling()
	 */
	private void initBilling() {
		setWaitScreen(true);
		disposeBilling();

		String base64EncodedPublicKey = Build.GOOGLE_PLAY_PUBLIC_KEY;
		mHelper = new IabHelper(getActivity(), base64EncodedPublicKey);
		mHelper.enableDebugLogging(Build.DEBUG);
		mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
			public void onIabSetupFinished(IabResult result) {
				if (mHelper == null) {
					return;
				}
				if (!result.isSuccess()) {
					setErrorScreen(getString(R.string.donation_error_iab_setup), new Runnable() {
						@Override
						public void run() {
							// Try to initialize billings again.
							initBilling();
						}
					});
					return;
				}

				setWaitScreen(false);
				mHelper.queryInventoryAsync(mGotInventoryListener);
			}
		});
	}

	private boolean verifyDeveloperPayload(Purchase purchase) {
		// TODO: This method itself is a big question.
		// Personally, I think that this whole 'best practices' part
		// is confusing and is trying to make you do work that the API
		// should really be doing. Since the purchase is tied to a Google account,
		// and the Play Store obviously saves this information, they should
		// just give you this in the purchase details. Getting a proper user ID
		// requires additional permissions that you shouldn't need to add just
		// to cover for the deficiencies of the IAB API.
		return true;
	}

	private void complain(String message) {
		Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show();
	}

}


text:
require 'spec_helper'

describe Axiom::Adapter::Arango::Visitor::For::Summarization, '#root' do

  let(:object) { described_class.new(relation, context) }
  let(:context) { mock('Context') }

  subject { object.root }

  context 'max' do
    let(:relation) { base.summarize([:foo]) { |r| r.add(:count, r.bar.max) } }

    expect_aql <<-AQL
      FOR `summarization` IN
        (FOR `base` IN `name` RETURN {\"foo\": `base`.`foo`, \"bar\": `base`.`bar`})
        COLLECT `foo` = `summarization`.`foo` INTO `collect`
        RETURN {"foo": `foo`, "count": MAX((FOR `aggregate` IN `collect` FILTER (`aggregate`.`summarization`.`bar` != null) RETURN `aggregate`.`summarization`.`bar`))}
    AQL
  end

  context 'min' do
    let(:relation) { base.summarize([:foo]) { |r| r.add(:count, r.bar.min) } }

    expect_aql <<-AQL
      FOR `summarization` IN
        (FOR `base` IN `name` RETURN {\"foo\": `base`.`foo`, \"bar\": `base`.`bar`})
        COLLECT `foo` = `summarization`.`foo` INTO `collect`
        RETURN {"foo": `foo`, "count": MIN((FOR `aggregate` IN `collect` FILTER (`aggregate`.`summarization`.`bar` != null) RETURN `aggregate`.`summarization`.`bar`))}
    AQL
  end

  context 'sum' do
    let(:relation) { base.summarize([:foo]) { |r| r.add(:count, r.bar.sum) } }

    expect_aql <<-AQL
      FOR `summarization` IN
        (FOR `base` IN `name` RETURN {\"foo\": `base`.`foo`, \"bar\": `base`.`bar`})
        COLLECT `foo` = `summarization`.`foo` INTO `collect`
        RETURN {"foo": `foo`, "count": SUM((FOR `aggregate` IN `collect` FILTER (`aggregate`.`summarization`.`bar` != null) RETURN `aggregate`.`summarization`.`bar`))}
    AQL
  end

  context 'count' do
    let(:relation) { base.summarize([:bar]) { |r| r.add(:count, r.foo.count) } }

    expect_aql <<-AQL
      FOR `summarization` IN
        (FOR `base` IN `name` RETURN {\"foo\": `base`.`foo`, \"bar\": `base`.`bar`})
        COLLECT `bar` = `summarization`.`bar` INTO `collect`
        RETURN {"bar": `bar`, "count": LENGTH((FOR `aggregate` IN `collect` FILTER (`aggregate`.`summarization`.`foo` != null) RETURN `aggregate`.`summarization`.`foo`))}
    AQL
  end
end


text:
<!DOCTYPE html>

<meta charset=utf-8>
<title>343 andrew gelman stats-2010-10-15-?</title>

andrew_gelman_stats andrew_gelman_stats-2010 andrew_gelman_stats-2010-343 knowledge-graph by maker-knowledge-mining

343 andrew gelman stats-2010-10-15-?

meta infos for this blog

Source: html

Introduction: How am I supposed to handle this sort of thing?  (See below.)  I just stuck it one of my email folders without responding, but then I wondered . . . what's it all about?  Is there some sort of Glengarry Glen Ross-like parallel world where down-on-their-luck Jack Lemmons of public relations world send out electronic cold calls?  More than anything else, this sort of thing makes me glad I have a steady job.

Here's the (unsolicited) email, which came with the subject line "Please help a reporter do his job":

Dear Andrew,

As an Editor for the Bulldog Reporter (www.bulldogreporter.com/dailydog), a media relations trade publication, my job is to help ensure that my readers have accurate info about you and send you the best quality pitches. By taking five minutes or less to answer my questions (pasted below), you'll receive targeted PR pitches from our client base that will match your beat and interests. Any help or direction is appreciated. Here are my questions.

We have you listed

Summary: the most important sentenses genereted by tfidf model

sentIndex sentText sentNum sentScore

1 )  I just stuck it one of my email folders without responding, but then I wondered . [sent-3, score-0.177]

2 Is there some sort of Glengarry Glen Ross-like parallel world where down-on-their-luck Jack Lemmons of public relations world send out electronic cold calls? [sent-7, score-0.599]

3 More than anything else, this sort of thing makes me glad I have a steady job. [sent-8, score-0.17]

4 Here's the (unsolicited) email, which came with the subject line "Please help a reporter do his job":    Dear Andrew,   As an Editor for the Bulldog Reporter (www. [sent-9, score-0.334]

5 com/dailydog), a media relations trade publication, my job is to help ensure that my readers have accurate info about you and send you the best quality pitches. [sent-11, score-0.837]

6 By taking five minutes or less to answer my questions (pasted below), you'll receive targeted PR pitches from our client base that will match your beat and interests. [sent-12, score-0.464]

7 We have you listed in our media database as : Andrew Gelman, Editor  with  Chance Magazine covering Gambling. [sent-15, score-0.287]

8 Which specific beats and topic areas do you cover? [sent-17, score-0.096]

9 What do the best PR people do to grab you, to get your attention and make you want to work with them? [sent-19, score-0.083]

10 On the other hand, what are some inappropriate pitches for your type of coverage (i. [sent-21, score-0.342]

11 , material that PR keeps sending you that you don't cover or pet peeves you may have about PR people)? [sent-23, score-0.327]

12 Can you briefly tell me about a PR pitch that resulted in a story? [sent-25, score-0.279]

13 What was it about the pitch or PR pro that sparked your interest? [sent-26, score-0.394]

14 Thanks so much for helping me gather this information. [sent-27, score-0.076]

similar blogs computed by tfidf model

tfidf for this blog:

wordName wordTfidf (topN-words)

[('pr', 0.47), ('bulldog', 0.263), ('reporter', 0.217), ('pitches', 0.192), ('pitch', 0.188), ('relations', 0.152), ('cover', 0.131), ('editor', 0.127), ('linden', 0.12), ('media', 0.119), ('help', 0.117), ('pasted', 0.113), ('oakland', 0.113), ('send', 0.109), ('glen', 0.108), ('glengarry', 0.108), ('peeves', 0.108), ('sparked', 0.108), ('ca', 0.104), ('andrew', 0.103), ('client', 0.101), ('pro', 0.098), ('email', 0.098), ('beats', 0.096), ('resulted', 0.091), ('targeted', 0.091), ('electronic', 0.091), ('jack', 0.089), ('sincerely', 0.088), ('unsolicited', 0.088), ('steady', 0.088), ('cold', 0.088), ('pet', 0.088), ('job', 0.087), ('ensure', 0.087), ('info', 0.087), ('covering', 0.086), ('grab', 0.083), ('database', 0.082), ('sort', 0.082), ('dear', 0.082), ('beat', 0.08), ('wondered', 0.079), ('trade', 0.079), ('responding', 0.078), ('jim', 0.078), ('parallel', 0.077), ('gather', 0.076), ('inappropriate', 0.076), ('coverage', 0.074)]

similar blogs list:

simIndex simValue blogId blogTitle

same-blog 1 1.0000001 343 andrew gelman stats-2010-10-15-?

Introduction: How am I supposed to handle this sort of thing?  (See below.)  I just stuck it one of my email folders without responding, but then I wondered . . . what's it all about?  Is there some sort of Glengarry Glen Ross-like parallel world where down-on-their-luck Jack Lemmons of public relations world send out electronic cold calls?  More than anything else, this sort of thing makes me glad I have a steady job.

Here's the (unsolicited) email, which came with the subject line "Please help a reporter do his job":

Dear Andrew,

As an Editor for the Bulldog Reporter (www.bulldogreporter.com/dailydog), a media relations trade publication, my job is to help ensure that my readers have accurate info about you and send you the best quality pitches. By taking five minutes or less to answer my questions (pasted below), you'll receive targeted PR pitches from our client base that will match your beat and interests. Any help or direction is appreciated. Here are my questions.

We have you listed

2 0.13957612 341 andrew gelman stats-2010-10-14-Confusion about continuous probability densities

Introduction: I had the following email exchange with a reader of Bayesian Data Analysis.

 My correspondent wrote:   Exercise 1(b) involves evaluating the normal pdf at a single point. But p(Y=y|mu,sigma) = 0 (and is not simply N(y|mu,sigma)), since the normal distribution is continuous. So it seems that part (b) of the exercise is inappropriate.

The solution does actually evaluate the probability as the value of the pdf at the single point, which is wrong. The probabilities should all be 0, so the answer to (b) is undefined.

 I replied:   The pdf is the probability density function, which for a continuous distribution is defined as the derivative of the cumulative density function.  The notation in BDA is rigorous but we do not spell out all the details, so I can see how confusion is possible.

 My correspondent:   I agree that the pdf is the derivative of the cdf. But to compute P(a .lt. Y .lt. b) for a continuous distribution (with support in the real line) requires integrating over t

3 0.11592077 2118 andrew gelman stats-2013-11-30-???

Introduction: I received the following unsolicited email, subject line Technology and Engineering Research:

Dear Editor

We have done research in some of the cutting edge technology and engineering field and would like to if you will be able to write about it in your news section.
Our Primarily research focus on building high performance systems that are helping in social networks, web, finding disease, cancer and sports using BIG DATA . Hope to hear from you some time soon.

Thanks,

***, PhD
Chartered Scientist
IBM Corportation
***@us.ibm.com
916 *** ****

I thought IBM was a professional operation—don't they have their own public relations department?

4 0.11047696 503 andrew gelman stats-2011-01-04-Clarity on my email policy

Introduction: I never read email before 4.  That doesnâ€™t mean I never  send  email before 4.

5 0.10498966 1871 andrew gelman stats-2013-05-27-Annals of spam

Introduction: I received the following email, subject line "Want to Buy Text Link from andrewgelman.com":

Dear,

I am Mary Taylor. I have started a link building campaign for my growing websites. For this, I need your cooperation. The campaign is quite diverse and large scale and if you take some time to understand it – it will benefit us.

First I want to clarify that I do not want "blogroll" "footer" or any other type of "site wide links".

Secondly I want links from inner pages of site – with good page rank of course.

Third links should be within text so that Google may not mark them as spam – not for you and not for me.

Hence this link building will cause almost no harm to your site or me. Because content links are fine with Google.

Now I should come to the requirements. I will accept links from Page Rank 3 to as high as you have got. Also kindly note that I can buy 1 to 50 links from one site – so you should understand the scale of the project. If you have multiple sites with co

6 0.096456625 2224 andrew gelman stats-2014-02-25-Basketball Stats:  Don't model the probability of win, model the expected score differential.

7 0.086339854 2157 andrew gelman stats-2014-01-02-2013

8 0.086175174 566 andrew gelman stats-2011-02-09-The boxer, the wrestler, and the coin flip, again

9 0.086017184 2236 andrew gelman stats-2014-03-07-Selection bias in the reporting of shaky research

10 0.085329726 1608 andrew gelman stats-2012-12-06-Confusing headline and capitalization leads to hopes raised, then dashed

11 0.085253641 282 andrew gelman stats-2010-09-17-I can't escape it

12 0.084545776 2081 andrew gelman stats-2013-10-29-My talk in Amsterdam tomorrow (Wed 29 Oct):  Can we use Bayesian methods to resolve the current crisis of statistically-significant research findings that don't hold up?

13 0.079497844 18 andrew gelman stats-2010-05-06-$63,000 worth of abusive research . . . or just a really stupid waste of time?

14 0.075470537 1012 andrew gelman stats-2011-11-16-Blog bribes!

15 0.075448319 828 andrew gelman stats-2011-07-28-Thoughts on Groseclose book on media bias

16 0.074074581 514 andrew gelman stats-2011-01-13-News coverage of statistical issues…how did I do?

17 0.073202237 1074 andrew gelman stats-2011-12-20-Reading a research paper != agreeing with its claims

18 0.06862583 2148 andrew gelman stats-2013-12-25-Spam!

19 0.064603679 605 andrew gelman stats-2011-03-09-Does it feel like cheating when I do this?  Variation in ethical standards and expectations

20 0.063624993 223 andrew gelman stats-2010-08-21-Statoverflow

similar blogs computed by lsi model

lsi for this blog:

topicId topicWeight

[(0, 0.1), (1, -0.056), (2, -0.03), (3, -0.003), (4, 0.006), (5, 0.026), (6, 0.013), (7, -0.038), (8, -0.021), (9, -0.024), (10, 0.005), (11, -0.039), (12, 0.044), (13, 0.003), (14, -0.034), (15, 0.025), (16, 0.031), (17, -0.035), (18, 0.023), (19, 0.031), (20, 0.005), (21, 0.012), (22, 0.067), (23, -0.063), (24, 0.007), (25, 0.016), (26, 0.026), (27, 0.023), (28, 0.008), (29, -0.017), (30, -0.014), (31, -0.0), (32, -0.054), (33, 0.055), (34, 0.007), (35, -0.019), (36, 0.02), (37, -0.005), (38, 0.006), (39, -0.012), (40, 0.068), (41, -0.012), (42, -0.022), (43, -0.029), (44, -0.042), (45, 0.054), (46, 0.029), (47, 0.002), (48, 0.026), (49, -0.046)]

similar blogs list:

simIndex simValue blogId blogTitle

same-blog 1 0.96643436 343 andrew gelman stats-2010-10-15-?

Introduction: How am I supposed to handle this sort of thing?  (See below.)  I just stuck it one of my email folders without responding, but then I wondered . . . what's it all about?  Is there some sort of Glengarry Glen Ross-like parallel world where down-on-their-luck Jack Lemmons of public relations world send out electronic cold calls?  More than anything else, this sort of thing makes me glad I have a steady job.

Here's the (unsolicited) email, which came with the subject line "Please help a reporter do his job":

Dear Andrew,

As an Editor for the Bulldog Reporter (www.bulldogreporter.com/dailydog), a media relations trade publication, my job is to help ensure that my readers have accurate info about you and send you the best quality pitches. By taking five minutes or less to answer my questions (pasted below), you'll receive targeted PR pitches from our client base that will match your beat and interests. Any help or direction is appreciated. Here are my questions.

We have you listed

2 0.78395146 1589 andrew gelman stats-2012-11-25-Life as a blogger:  the emails just get weirder and weirder

Introduction: In the email the other day, subject line "Casting blogger, writer, journalist to host cable series":

Hi there Andrew,

I'm casting a male journalist, writer, blogger, documentary filmmaker or comedian with a certain type personality for a television pilot along with production company, Pipeline39.  See below:

A certain type of character – no cockiness, no ego, a person who is smart, savvy, dry humor, but someone who isn't imposing, who can infiltrate these organizations.   This person will be hosting his own show and covering alternative lifestyles and secret societies around the world.

If you're interested in hearing more or would like to be considered for this project, please email me a photo and a bio of yourself, along with contact information. I'll respond to you ASAP.

I'm looking forward to hearing from you.

***

Casting Producer

(646) ***.****

***@gmail.com

I was with them until I got to the "no ego" part. . . . Also, I don't think I could infiltrate any org

3 0.73371089 2338 andrew gelman stats-2014-05-19-My short career as a Freud expert

Introduction: I received the following email the other day (well, actually it was the other month, as we're still on blog-delay):

Dear Prof. Andrew Gelman,

The ** Broadcasting Authority, together with ** – a well-established production company, are producing a documentary about Freud.

The documentary presents different points of view regarding Freud's personality and theories.
At this stage of the production we are mainly interested in views regarding the influence Freud / Freudism / Psychoanalysis have on our culture – whether positive or negative. We are addressing the effect Freud and/or analysis left on the culture regarding morality, the law system, therapy, art, consumerism, films, etc. We would like to interview you on your point of view regarding Freud's mark on humanity in regard to the Economy.

Once you respond favorably we can proceed and precisely define the topics of the talk.
The shooting in NYC is on May 27th and should not demand more than one hour of your time.
We'll app

4 0.72891527 1434 andrew gelman stats-2012-07-29-FindTheData.org

Introduction: I received the following (unsolicited) email:

Hi Andrew,

I work on the business development team of FindTheData.org, an unbiased comparison engine founded by Kevin O'Connor (founder and former CEO of DoubleClick) and backed by Kleiner Perkins with ~10M unique visitors per month.
 We are working with large online publishers including Golf Digest, Huffington Post, Under30CEO, and offer a variety of options to integrate our highly engaging content with your site.  I believe our un-biased and reliable data resources would be of interest to you and your readers.
 I'd like to set up a quick call to discuss similar partnership ideas with you and would greatly appreciate 10 minutes of your time.
 Please suggest a couple times that work best for you or let me know if you would like me to send some more information before you make time for a call.
 Looking forward to hearing from you,
 Jonny

–

 JONNY KINTZELE

   Business Development,   FindThe Data

 mobile: 619-307-097

5 0.72022283 1192 andrew gelman stats-2012-03-02-These people totally don't know what Chance magazine is all about

Introduction: I received the following unsolicited email, subject line "Chance Magazine – Comedy Showcase":

Hi Andrew,

Hope you're doing well.  I'm writing to let you know that we will be putting on an industry showcase at the brand new Laughing Devil Comedy Club (4738 Vernon Blvd. Long Island City) on Thursday, February 9th at 8:00 PM. If you're unfamiliar, it's one stop on the 7 train from Grand Central.

Following the showcase, the club will stay open for an industry mingle/happy hour with drink specials and all the business card exchanging you can hope for.

This showcase will feature 9 of our best: Steve Hofstetter's latest album hit #1 in the world. He'll be hosting Collin Moulton (Showtime Half Hour Special), Tony Deyo (Aspen Comedy Festival), Tom Simmons (Winner of the SF International Comedy Festival), Marc Ryan (Host of Mudslingers), Mike Trainor (TruTV), Jessi Campbell (CMT), Danny Browning (Bob & Tom), and Joe Zimmerman (Sirius/XM).

I would love for you (and anyone you'd like to

6 0.71800101 2148 andrew gelman stats-2013-12-25-Spam!

7 0.71305031 1618 andrew gelman stats-2012-12-11-The consulting biz

8 0.70942742 282 andrew gelman stats-2010-09-17-I can't escape it

9 0.69298017 1698 andrew gelman stats-2013-01-30-The spam just gets weirder and weirder

10 0.68837172 866 andrew gelman stats-2011-08-23-Participate in a research project on combining information for prediction

11 0.66035181 18 andrew gelman stats-2010-05-06-$63,000 worth of abusive research . . . or just a really stupid waste of time?

12 0.65856862 545 andrew gelman stats-2011-01-30-New innovations in spam

13 0.65487844 1012 andrew gelman stats-2011-11-16-Blog bribes!

14 0.63996673 880 andrew gelman stats-2011-08-30-Annals of spam

15 0.63497078 1573 andrew gelman stats-2012-11-11-Incredibly strange spam

16 0.63088894 1421 andrew gelman stats-2012-07-19-Alexa, Maricel, and Marty:  Three cellular automata who got on my nerves

17 0.62704057 1871 andrew gelman stats-2013-05-27-Annals of spam

18 0.62536484 1922 andrew gelman stats-2013-07-02-They want me to send them free material and pay for the privilege

19 0.62398118 605 andrew gelman stats-2011-03-09-Does it feel like cheating when I do this?  Variation in ethical standards and expectations

20 0.62180686 2111 andrew gelman stats-2013-11-23-Tables > figures yet again

similar blogs computed by lda model

lda for this blog:

topicId topicWeight

[(2, 0.019), (6, 0.02), (9, 0.029), (15, 0.025), (16, 0.045), (18, 0.017), (21, 0.046), (23, 0.012), (24, 0.118), (27, 0.153), (28, 0.012), (29, 0.011), (30, 0.017), (46, 0.04), (47, 0.018), (60, 0.013), (66, 0.011), (78, 0.023), (79, 0.028), (95, 0.014), (97, 0.019), (99, 0.197)]

similar blogs list:

simIndex simValue blogId blogTitle

1 0.94769251 802 andrew gelman stats-2011-07-13-Super Sam Fuld Needs Your Help (with Foul Ball stats)

Introduction: I was pleasantly surprised to have my recreational reading about baseball in the  New Yorker  interrupted by a digression on statistics.   Sam Fuld  of the Tampa Bay Rays, was the subjet of a Ben McGrath profile in the 4 July 2011 issue of the  New Yorker , in an article titled  Super Sam .  After quoting a minor-league trainer who described Fuld as "a bit of a geek" (who isn't these days?), McGrath gets into that lovely  New Yorker  detail:

One could have pointed out the more persuasive and telling examples, such as the fact that in 2005, after his first pro season, with the Class-A Peoria Chiefs, Fuld applied for a fall internship with Stats, Inc., the research firm that supplies broadcasters with much of the data anad analysis that you hear in sports telecasts.

After a description of what they had him doing, reviewing footage of games and cataloguing, he said

"I thought, They have a stat for everything, but they don't have any stats regarding foul balls."

 Fuld's

same-blog 2 0.94259763 343 andrew gelman stats-2010-10-15-?

Introduction: How am I supposed to handle this sort of thing?  (See below.)  I just stuck it one of my email folders without responding, but then I wondered . . . what's it all about?  Is there some sort of Glengarry Glen Ross-like parallel world where down-on-their-luck Jack Lemmons of public relations world send out electronic cold calls?  More than anything else, this sort of thing makes me glad I have a steady job.

Here's the (unsolicited) email, which came with the subject line "Please help a reporter do his job":

Dear Andrew,

As an Editor for the Bulldog Reporter (www.bulldogreporter.com/dailydog), a media relations trade publication, my job is to help ensure that my readers have accurate info about you and send you the best quality pitches. By taking five minutes or less to answer my questions (pasted below), you'll receive targeted PR pitches from our client base that will match your beat and interests. Any help or direction is appreciated. Here are my questions.

We have you listed

3 0.9213742 930 andrew gelman stats-2011-09-28-Wiley Wegman chutzpah update:  Now you too can buy a selection of garbled Wikipedia articles, for a mere $1400-$2800 per year!

Introduction: Someone passed on to a message from his university library announcing that the journal "Wiley Interdisciplinary Reviews:  Computational Statistics" is no longer free.

Librarians have to decide what to do, so I thought I'd offer the following consumer guide:

 Wiley Computational Statistics journal
 Wikipedia

 Frequency
 6 issues per year
 Continuously updated

 Includes articles from Wikipedia?
  Yes
 Yes

 Cites the Wikipedia sources it uses?
  No
 Yes

 Edited by recipient of ASA Founders Award?
 Yes
 No

 Articles are subject to rigorous review?
 No
 Yes

 Errors, when discovered, get fixed?
 No
 Yes

 Number of vertices in n-dimensional hypercube?
 2n
 2  n

 Easy access to Brady Bunch trivia?
 No
 Yes

 Cost (North America)
 $1400-$2800
 $0

 Cost (UK)
 £986-£1972
 £0

 Cost (Europe)
 €1213-€2426
 €0

The choice seems pretty clear to me!

It's funny for the Wiley journal to start charging  now

4 0.91428041 134 andrew gelman stats-2010-07-08-"What do you think about curved lines connecting discrete data-points?"

Introduction: John Keltz writes:

What do you think about curved lines connecting discrete data-points?  (For example,  here .)

The problem with the smoothed graph is it seems to imply that something is going on in between the discrete data points, which is false. However, the straight-line version isn't representing actual events either- it is just helping the eye connect each point. So maybe the curved version is also just helping the eye connect each point, and looks better doing it.

In my own work (value-added modeling of achievement test scores) I use straight lines, but I guess I am not too bothered when people use smoothing. I'd appreciate your input.

Regular readers will be unsurprised that, yes, I have an opinion on this one, and that this opinion is connected to some more general ideas about statistical graphics.

In general I'm not a fan of the curved lines.  They're ok, but I don't really see the point.  I can connect the dots just fine without the curves.

The more general id

5 0.90933192 1472 andrew gelman stats-2012-08-28-Migrating from dot to underscore

Introduction: My C-oriented Stan collaborators have convinced me to use underscore (_) rather than dot (.) as much as possible in expressions in R.  For example, I can name a variable n_years rather than n.years.  This is fine.  But I'm getting annoyed because I need to press the shift key every time I type the underscore.

What do people do about this?  I know that it's easy enough to reassign keys (I could, for example, assign underscore to backslash, which I never use).  I'm just wondering what C programmers actually do.  Do they reassign the key or do they just get used to pressing Shift?

P.S.  In comments, Ben Hyde  points  to Google's R style guide, which recommends that variable names use dots,  not  underscore or camel case, for variable names (for example, "avg.clicks" rather than "avg_Clicks" or "avgClicks").  I think they're recommending this to be consistent with  R coding conventions .

I am switching to underscores in R variable names to be consistent with C.  Otherwise we were run

6 0.90405792 465 andrew gelman stats-2010-12-13-$3M health care prediction challenge

7 0.90267283 347 andrew gelman stats-2010-10-17-Getting arm and lme4 running on the Mac

8 0.90122265 173 andrew gelman stats-2010-07-31-Editing and clutch hitting

9 0.89456028 1238 andrew gelman stats-2012-03-31-Dispute about ethics of data sharing

10 0.89318585 708 andrew gelman stats-2011-05-12-Improvement of 5 MPG: how many more auto deaths?

11 0.88023889 1869 andrew gelman stats-2013-05-24-In which I side with Neyman over Fisher

12 0.87823373 652 andrew gelman stats-2011-04-07-Minor-league Stats Predict Major-league Performance, Sarah Palin, and Some Differences Between Baseball and Politics

13 0.87678993 804 andrew gelman stats-2011-07-15-Static sensitivity analysis

14 0.86512697 66 andrew gelman stats-2010-06-03-How can news reporters avoid making mistakes when reporting on technical issues?  Or, Data used to justify "Data Used to Justify Health Savings Can Be Shaky" can be shaky

15 0.85642296 341 andrew gelman stats-2010-10-14-Confusion about continuous probability densities

16 0.85434675 120 andrew gelman stats-2010-06-30-You can't put Pandora back in the box

17 0.85347009 2132 andrew gelman stats-2013-12-13-And now, here's something that would make Ed Tufte spin in his . . . ummm, Tufte's still around, actually, so let's just say I don't think he'd like it!

18 0.8532545 1982 andrew gelman stats-2013-08-15-Blaming scientific fraud on the Kuhnians

19 0.84947276 1255 andrew gelman stats-2012-04-10-Amtrak sucks

20 0.84566474 1113 andrew gelman stats-2012-01-11-Toshiro Kageyama on professionalism


text:
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Shell library for functions and initialization private to
# build_image, and not specific to any particular kind of image.
#
# TODO(jrbarnette):  There's nothing holding this code together in
# one file aside from its lack of anywhere else to go.  Probably,
# this file should get broken up or otherwise reorganized.

# Use canonical path since some tools (e.g. mount) do not like symlinks.
# Append build attempt to output directory.
if [ -z "${FLAGS_version}" ]; then
  IMAGE_SUBDIR="${FLAGS_group}-${COREOS_VERSION}-a${FLAGS_build_attempt}"
else
  IMAGE_SUBDIR="${FLAGS_group}-${FLAGS_version}"
fi
BUILD_DIR="${FLAGS_output_root}/${BOARD}/${IMAGE_SUBDIR}"
OUTSIDE_OUTPUT_DIR="../build/images/${BOARD}/${IMAGE_SUBDIR}"

set_build_symlinks() {
    local build=$(basename ${BUILD_DIR})
    local link
    for link in "$@"; do
        local path="${FLAGS_output_root}/${BOARD}/${link}"
        ln -sfT "${build}" "${path}"
    done
}

cleanup_mounts() {
  info "Cleaning up mounts"
  "${BUILD_LIBRARY_DIR}/disk_util" umount "$1" || true
}

delete_prompt() {
  echo "An error occurred in your build so your latest output directory" \
    "is invalid."

  # Only prompt if both stdin and stdout are a tty. If either is not a tty,
  # then the user may not be present, so we shouldn't bother prompting.
  if [ -t 0 -a -t 1 ]; then
    read -p "Would you like to delete the output directory (y/N)? " SURE
    SURE="${SURE:0:1}" # Get just the first character.
  else
    SURE="y"
    echo "Running in non-interactive mode so deleting output directory."
  fi
  if [ "${SURE}" == "y" ] ; then
    sudo rm -rf "${BUILD_DIR}"
    echo "Deleted ${BUILD_DIR}"
  else
    echo "Not deleting ${BUILD_DIR}."
  fi
}

extract_update() {
  local image_name="$1"
  local disk_layout="$2"
  local update_path="${BUILD_DIR}/${image_name%_image.bin}_update.bin"

  "${BUILD_LIBRARY_DIR}/disk_util" --disk_layout="${disk_layout}" \
    extract "${BUILD_DIR}/${image_name}" "USR-A" "${update_path}"
  upload_image "${update_path}"
}

zip_update_tools() {
  # There isn't a 'dev' variant of this zip, so always call it production.
  local update_zip="coreos_production_update.zip"

  info "Generating update tools zip"
  # Make sure some vars this script needs are exported
  export REPO_MANIFESTS_DIR SCRIPTS_DIR
  "${BUILD_LIBRARY_DIR}/generate_au_zip.py" \
    --output-dir "${BUILD_DIR}" --zip-name "${update_zip}"

  upload_image "${BUILD_DIR}/${update_zip}"
}

generate_update() {
  local image_name="$1"
  local disk_layout="$2"
  local image_kernel="${BUILD_DIR}/${image_name%.bin}.vmlinuz"
  local update_prefix="${image_name%_image.bin}_update"
  local update="${BUILD_DIR}/${update_prefix}"
  local devkey="/usr/share/update_engine/update-payload-key.key.pem"

  echo "Generating update payload, signed with a dev key"
  "${BUILD_LIBRARY_DIR}/disk_util" --disk_layout="${disk_layout}" \
    extract "${BUILD_DIR}/${image_name}" "USR-A" "${update}.bin"
  delta_generator \
      -private_key "${devkey}" \
      -new_image "${update}.bin" \
      -new_kernel "${image_kernel}" \
      -out_file "${update}.gz"

  upload_image -d "${update}.DIGESTS" "${update}".{bin,gz,zip}
}

# ldconfig cannot generate caches for non-native arches.
# Use qemu & the native ldconfig to work around that.
# http://code.google.com/p/chromium/issues/detail?id=378377
run_ldconfig() {
  local root_fs_dir=$1
  case ${ARCH} in
  x86|amd64)
    sudo ldconfig -r "${root_fs_dir}";;
  *)
    die "Unable to run ldconfig for ARCH ${ARCH}"
  esac
}

run_localedef() {
  local root_fs_dir="$1" loader=()
  case ${ARCH} in
  amd64)
    loader=( "${root_fs_dir}/usr/lib64/ld-linux-x86-64.so.2" \
               --library-path "${root_fs_dir}/usr/lib64" );;
  *)
    die "Unable to run localedev for ARCH ${ARCH}";;
  esac
  info "Generating C.UTF-8 locale..."
  local i18n="${root_fs_dir}/usr/share/i18n"
  # localedef will silently fall back to /usr/share/i18n if missing so
  # check that the paths we want are available first.
  [[ -f "${i18n}/charmaps/UTF-8.gz" ]] || die
  [[ -f "${i18n}/locales/C" ]] || die
  sudo I18NPATH="${i18n}" "${loader[@]}" "${root_fs_dir}/usr/bin/localedef" \
      --prefix="${root_fs_dir}" --charmap=UTF-8 --inputfile=C C.UTF-8
}

# Basic command to emerge binary packages into the target image.
# Arguments to this command are passed as addition options/arguments
# to the basic emerge command.
emerge_to_image() {
  local root_fs_dir="$1"; shift

  if [[ ${FLAGS_getbinpkg} -eq ${FLAGS_TRUE} ]]; then
    set -- --getbinpkg "$@"
  fi

  sudo -E ROOT="${root_fs_dir}" \
      PORTAGE_CONFIGROOT="${BUILD_DIR}"/configroot \
      emerge --root-deps=rdeps --usepkgonly --jobs=$FLAGS_jobs -v "$@"

  # Shortcut if this was just baselayout
  [[ "$*" == *sys-apps/baselayout ]] && return

  # Make sure profile.env has been generated
  sudo -E ROOT="${root_fs_dir}" env-update --no-ldconfig

  # TODO(marineam): just call ${BUILD_LIBRARY_DIR}/check_root directly once
  # all tests are fatal, for now let the old function skip soname errors.
  ROOT="${root_fs_dir}" PORTAGE_CONFIGROOT="${BUILD_DIR}"/configroot \
      test_image_content "${root_fs_dir}"
}

# emerge_to_image without a rootfs check; you should use emerge_to_image unless
# here's a good reason not to.
emerge_to_image_unchecked() {
  local root_fs_dir="$1"; shift

  if [[ ${FLAGS_getbinpkg} -eq ${FLAGS_TRUE} ]]; then
    set -- --getbinpkg "$@"
  fi

  sudo -E ROOT="${root_fs_dir}" \
      PORTAGE_CONFIGROOT="${BUILD_DIR}"/configroot \
      emerge --root-deps=rdeps --usepkgonly --jobs=$FLAGS_jobs -v "$@"

  # Shortcut if this was just baselayout
  [[ "$*" == *sys-apps/baselayout ]] && return

  # Make sure profile.env has been generated
  sudo -E ROOT="${root_fs_dir}" env-update --no-ldconfig
}

# Switch to the dev or prod sub-profile
set_image_profile() {
  local suffix="$1"
  local profile="${BUILD_DIR}/configroot/etc/portage/make.profile"
  if [[ ! -d "${profile}/${suffix}" ]]; then
      die "Not a valid profile: ${profile}/${suffix}"
  fi
  local realpath=$(readlink -f "${profile}/${suffix}")
  ln -snf "${realpath}" "${profile}"
}

# Usage: systemd_enable /root default.target something.service
# Or: systemd_enable /root default.target some@.service some@thing.service
systemd_enable() {
  local root_fs_dir="$1"
  local target="$2"
  local unit_file="$3"
  local unit_alias="${4:-$3}"
  local wants_dir="${root_fs_dir}/usr/lib/systemd/system/${target}.wants"

  sudo mkdir -p "${wants_dir}"
  sudo ln -sf "../${unit_file}" "${wants_dir}/${unit_alias}"
}

# Generate a ls-like listing of a directory tree.
# The ugly printf is used to predictable time format and size in bytes.
write_contents() {
    info "Writing ${2##*/}"
    pushd "$1" >/dev/null
    sudo TZ=UTC find -printf \
        '%M %2n %-7u %-7g %7s %TY-%Tm-%Td %TH:%TM ./%P -> %l\n' \
        | sed -e 's/ -> $//' > "$2"
    popd >/dev/null
}

# "equery list" a potentially uninstalled board package
query_available_package() {
    local pkg="$1"
    local format="${2:-\$cpv::\$repo}"
    # Ignore masked versions. Assumes that sort --version-sort uses the
    # same ordering as Portage.
    equery-${BOARD} --no-color list -po --format "\$mask|$format" "$pkg" | \
            grep -E '^ +\|' | \
            cut -f2- -d\| | \
            sort --version-sort | \
            tail -n 1
}

# Generate a list of packages installed in an image.
# Usage: image_packages /image/root
image_packages() {
    local profile="${BUILD_DIR}/configroot/etc/portage/profile"
    ROOT="$1" PORTAGE_CONFIGROOT="${BUILD_DIR}"/configroot \
        equery --no-color list --format '$cpv::$repo' '*'

    # We also want to list packages that only exist in the initramfs.
    # Approximate this by listing build dependencies of coreos-kernel that
    # are specified with the "=" slot operator, excluding those already
    # reported above.
    local kernel_pkg=$(ROOT="$1" PORTAGE_CONFIGROOT="${BUILD_DIR}"/configroot \
        equery --no-color list --format '$cpv' sys-kernel/coreos-kernel)
    # OEM ACIs have no kernel package.
    if [[ -n "${kernel_pkg}" ]]; then
        local depend_path="$1/var/db/pkg/$kernel_pkg/DEPEND"
        local pkg
        for pkg in $(awk 'BEGIN {RS=" "} /=$/ {print}' "$depend_path"); do
            if ! ROOT="$1" PORTAGE_CONFIGROOT="${BUILD_DIR}"/configroot \
                    equery -q list "$pkg" >/dev/null ; then
                query_available_package "$pkg"
            fi
        done
    fi

    # In production images GCC libraries are extracted manually.
    if [[ -f "${profile}/package.provided" ]]; then
        local pkg
        while read pkg; do
            query_available_package "${pkg}"
        done < "${profile}/package.provided"
    fi

    # Include source packages of all torcx images installed on disk.
    [ -z "${FLAGS_torcx_manifest}" ] ||
    torcx_manifest::sources_on_disk "${FLAGS_torcx_manifest}" |
    while read pkg ; do query_available_package "${pkg}" ; done
}

# Generate a list of installed packages in the format:
#   sys-apps/systemd-212-r8::coreos
write_packages() {
    info "Writing ${2##*/}"
    image_packages "$1" | sort > "$2"
}

# Generate a list of packages w/ their licenses in the format:
#   [
#     {
#       "project": "sys-apps/systemd-212-r8::coreos",
#       "license": ["GPL-2", "LGPL-2.1", "MIT", "public-domain"]
#     }
#   ]
write_licenses() {
    info "Writing ${2##*/}"
    echo -n "[" > "$2"

    local pkg pkg_sep
    for pkg in $(image_packages "$1" | sort); do
        # Ignore virtual packages since they aren't licensed
        if [[ "${pkg%%/*}" == "virtual" ]]; then
            continue
        fi

        local path="$1/var/db/pkg/${pkg%%:*}/LICENSE"
        local lic_str
        if [[ -f "$path" ]]; then
            lic_str="$(< $path)"
        else
            # The package is not installed in $1 so get the license from
            # its ebuild
            lic_str=$(portageq-${BOARD} metadata "${BOARD_ROOT}" ebuild \
                        "${pkg%%:*}" LICENSE 2>/dev/null ||:)
            if [[ -z "$lic_str" ]]; then
                warn "No license found for ${pkg}"
                continue
            fi
        fi

        [[ -n $pkg_sep ]] && echo ","
        [[ -z $pkg_sep ]] && echo
        pkg_sep="true"

        # Build a list of the required licenses vs the one-of licenses
        # For example:
        #   GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ ) FDL-1.3+
        #   required: GPL-3+ LGPL-3+ FDL-1.3+
        #   one-of: GPL-3+ libgcc libstdc++
        local req_lics=($(sed 's/|| ([^)]*)//' <<< $lic_str))
        local opt_lics=($(sed 's/.*|| (\([^)]*\)).*/\1/' <<< $lic_str))

        # Pick one of the one-of licenses, preferring a GPL license. Otherwise,
        # pick the first.
        local opt_lic=""
        local lic
        for lic in ${opt_lics[*]}; do
            if [[ $lic =~ "GPL" ]]; then
                opt_lic=$lic;
                break
            fi;
        done
        if [[ -z $opt_lic ]]; then
            opt_lic=${opt_lics[0]}
        fi

        # Remove duplicate licenses
        local lics=$(tr ' ' '\n' <<< "${req_lics[*]} ${opt_lic}" | sort --unique | tr '\n' ' ')

        echo -n "  {\"project\": \"${pkg}\", \"licenses\": ["

        local lic_sep=""
        for lic in ${lics[*]}; do
            [[ -n $lic_sep ]] && echo -n ", "
            lic_sep="true"

            echo -n "\"${lic}\""
        done

        echo -n "]}"
    done >> "$2"

    echo -e "\n]" >> "$2"
}

# Add an entry to the image's package.provided
package_provided() {
    local p profile="${BUILD_DIR}/configroot/etc/portage/profile"
    for p in "$@"; do
        info "Writing $p to package.provided and soname.provided"
        echo "$p" >> "${profile}/package.provided"
	pkg_provides binary "$p" >> "${profile}/soname.provided"
    done
}

assert_image_size() {
  local disk_img="$1"
  local disk_type="$2"

  local size
  size=$(qemu-img info -f "${disk_type}" --output json "${disk_img}" | \
    jq --raw-output '.["virtual-size"]' ; exit ${PIPESTATUS[0]})
  if [[ $? -ne 0 ]]; then
    die_notrace "assert failed: could not read image size"
  fi

  MiB=$((1024*1024))
  if [[ $(($size % $MiB)) -ne 0 ]]; then
    die_notrace "assert failed: image must be a multiple of 1 MiB ($size B)"
  fi
}

start_image() {
  local image_name="$1"
  local disk_layout="$2"
  local root_fs_dir="$3"
  local update_group="$4"

  local disk_img="${BUILD_DIR}/${image_name}"

  mkdir -p "${BUILD_DIR}"/configroot/etc/portage/profile
  ln -s "${BOARD_ROOT}"/etc/portage/make.* \
      "${BOARD_ROOT}"/etc/portage/package.* \
      "${BOARD_ROOT}"/etc/portage/repos.conf \
      "${BUILD_DIR}"/configroot/etc/portage/

  info "Using image type ${disk_layout}"
  "${BUILD_LIBRARY_DIR}/disk_util" --disk_layout="${disk_layout}" \
      format "${disk_img}"

  assert_image_size "${disk_img}" raw

  "${BUILD_LIBRARY_DIR}/disk_util" --disk_layout="${disk_layout}" \
      mount "${disk_img}" "${root_fs_dir}"
  trap "cleanup_mounts '${root_fs_dir}' && delete_prompt" EXIT

  # First thing first, install baselayout to create a working filesystem.
  emerge_to_image "${root_fs_dir}" --nodeps --oneshot sys-apps/baselayout

  # FIXME(marineam): Work around glibc setting EROOT=$ROOT
  # https://bugs.gentoo.org/show_bug.cgi?id=473728#c12
  sudo mkdir -p "${root_fs_dir}/etc/ld.so.conf.d"

  # Set /etc/lsb-release on the image.
  "${BUILD_LIBRARY_DIR}/set_lsb_release" \
    --root="${root_fs_dir}" \
    --group="${update_group}" \
    --board="${BOARD}"
}

finish_image() {
  local image_name="$1"
  local disk_layout="$2"
  local root_fs_dir="$3"
  local image_contents="$4"
  local image_kernel="$5"
  local pcr_policy="$6"
  local image_grub="$7"
  local image_shim="$8"
  local image_kconfig="$9"

  local install_grub=0
  local disk_img="${BUILD_DIR}/${image_name}"

  # Copy in packages from the torcx store that are marked as being on disk
  if [ -n "${FLAGS_torcx_manifest}" ]; then
    for pkg in $(torcx_manifest::get_pkg_names "${FLAGS_torcx_manifest}"); do
      local default_version="$(torcx_manifest::default_version "${FLAGS_torcx_manifest}" "${pkg}")"
      for version in $(torcx_manifest::get_versions "${FLAGS_torcx_manifest}" "${pkg}"); do
        local on_disk_path="$(torcx_manifest::local_store_path "${FLAGS_torcx_manifest}" "${pkg}" "${version}")"
        if [[ -n "${on_disk_path}" ]]; then
          local casDigest="$(torcx_manifest::get_digest "${FLAGS_torcx_manifest}" "${pkg}" "${version}")"
          sudo cp "${FLAGS_torcx_root}/pkgs/${BOARD}/${pkg}/${casDigest}/${pkg}:${version}.torcx.tgz" \
            "${root_fs_dir}${on_disk_path}"

          if [[ "${version}" == "${default_version}" ]]; then
            # Create the default symlink for this package
            sudo ln -fns "${on_disk_path##*/}" \
              "${root_fs_dir}/${on_disk_path%/*}/${pkg}:com.coreos.cl.torcx.tgz"
          fi
        fi
      done
    done
  fi

  # Only enable rootfs verification on prod builds.
  local disable_read_write="${FLAGS_FALSE}"
  if [[ "${IMAGE_BUILD_TYPE}" == "prod" ]]; then
    disable_read_write="${FLAGS_enable_rootfs_verification}"
  fi

  # Only enable rootfs verification on supported boards.
  case "${FLAGS_board}" in
    amd64-usr) verity_offset=64 ;;
    *) disable_read_write=${FLAGS_FALSE} ;;
  esac

  # Copy kernel to support dm-verity boots
  sudo mkdir -p "${root_fs_dir}/boot/coreos"
  sudo cp "${root_fs_dir}/usr/boot/vmlinuz" \
       "${root_fs_dir}/boot/coreos/vmlinuz-a"

  # Record directories installed to the state partition.
  # Explicitly ignore entries covered by existing configs.
  local tmp_ignore=$(awk '/^[dDfFL]/ {print "--ignore=" $2}' \
      "${root_fs_dir}"/usr/lib/tmpfiles.d/*.conf)
  sudo "${BUILD_LIBRARY_DIR}/gen_tmpfiles.py" --root="${root_fs_dir}" \
      --output="${root_fs_dir}/usr/lib/tmpfiles.d/base_image_var.conf" \
      ${tmp_ignore} "${root_fs_dir}/var"
  sudo "${BUILD_LIBRARY_DIR}/gen_tmpfiles.py" --root="${root_fs_dir}" \
      --output="${root_fs_dir}/usr/lib/tmpfiles.d/base_image_etc.conf" \
      ${tmp_ignore} "${root_fs_dir}/etc"

  # Only configure bootloaders if there is a boot partition
  if mountpoint -q "${root_fs_dir}"/boot; then
    install_grub=1
    ${BUILD_LIBRARY_DIR}/configure_bootloaders.sh \
      --boot_dir="${root_fs_dir}"/usr/boot

    # Create first-boot flag for grub and Ignition
    info "Writing first-boot flag"
    sudo_clobber "${root_fs_dir}/boot/coreos/first_boot" <<EOF
If this file exists, Ignition will run and then delete the file.
EOF
  fi

  if [[ -n "${FLAGS_developer_data}" ]]; then
    local data_path="/usr/share/coreos/developer_data"
    local unit_path="usr-share-coreos-developer_data"
    sudo cp "${FLAGS_developer_data}" "${root_fs_dir}/${data_path}"
    systemd_enable "${root_fs_dir}" system-config.target \
        "system-cloudinit@.service" "system-cloudinit@${unit_path}.service"
  fi

  if [[ -n "${image_kconfig}" ]]; then
    cp "${root_fs_dir}/usr/boot/config" \
        "${BUILD_DIR}/${image_kconfig}"
  fi

  write_contents "${root_fs_dir}" "${BUILD_DIR}/${image_contents}"

  # Zero all fs free space to make it more compressible so auto-update
  # payloads become smaller, not fatal since it won't work on linux < 3.2
  sudo fstrim "${root_fs_dir}" || true
  if mountpoint -q "${root_fs_dir}/usr"; then
    sudo fstrim "${root_fs_dir}/usr" || true
  fi

  # Build the selinux policy
  if pkg_use_enabled coreos-base/coreos selinux; then
      sudo chroot "${root_fs_dir}" bash -c "cd /usr/share/selinux/mcs && semodule -s mcs -i *.pp"
  fi

  # Make the filesystem un-mountable as read-write and setup verity.
  if [[ ${disable_read_write} -eq ${FLAGS_TRUE} ]]; then
    # Unmount /usr partition
    sudo umount --recursive "${root_fs_dir}/usr" || exit 1

    "${BUILD_LIBRARY_DIR}/disk_util" --disk_layout="${disk_layout}" verity \
        --root_hash="${BUILD_DIR}/${image_name%.bin}_verity.txt" \
        "${BUILD_DIR}/${image_name}"

    # Magic alert!  Root hash injection works by writing the hash value to a
    # known unused SHA256-sized location in the kernel image.
    # For amd64 the rdev error message is used.
    # Our modified GRUB extracts the hash and adds it to the cmdline.
    printf %s "$(cat ${BUILD_DIR}/${image_name%.bin}_verity.txt)" | \
        sudo dd of="${root_fs_dir}/boot/coreos/vmlinuz-a" conv=notrunc \
        seek=${verity_offset} count=64 bs=1 status=none
  fi

  # Sign the kernel after /usr is in a consistent state and verity is calculated
  if [[ ${COREOS_OFFICIAL:-0} -ne 1 ]]; then
      sudo sbsign --key /usr/share/sb_keys/DB.key \
	   --cert /usr/share/sb_keys/DB.crt \
	   "${root_fs_dir}/boot/coreos/vmlinuz-a"
      sudo mv "${root_fs_dir}/boot/coreos/vmlinuz-a.signed" \
	   "${root_fs_dir}/boot/coreos/vmlinuz-a"
  fi

  if [[ -n "${image_kernel}" ]]; then
    # copying kernel from vfat so ignore the permissions
    cp --no-preserve=mode \
        "${root_fs_dir}/boot/coreos/vmlinuz-a" \
        "${BUILD_DIR}/${image_kernel}"
  fi

  if [[ -n "${pcr_policy}" ]]; then
    mkdir -p "${BUILD_DIR}/pcrs"
    ${BUILD_LIBRARY_DIR}/generate_kernel_hash.sh \
        "${root_fs_dir}/boot/coreos/vmlinuz-a" ${COREOS_VERSION} \
        >"${BUILD_DIR}/pcrs/kernel.config"
  fi

  rm -rf "${BUILD_DIR}"/configroot
  cleanup_mounts "${root_fs_dir}"
  trap - EXIT

  # This script must mount the ESP partition differently, so run it after unmount
  if [[ "${install_grub}" -eq 1 ]]; then
    local target
    local target_list="i386-pc x86_64-efi x86_64-xen"
    local grub_args=()
    if [[ ${disable_read_write} -eq ${FLAGS_TRUE} ]]; then
      grub_args+=(--verity)
    else
      grub_args+=(--noverity)
    fi
    if [[ -n "${image_grub}" && -n "${image_shim}" ]]; then
      grub_args+=(
        --copy_efi_grub="${BUILD_DIR}/${image_grub}"
        --copy_shim="${BUILD_DIR}/${image_shim}"
      )
    fi
    for target in ${target_list}; do
      ${BUILD_LIBRARY_DIR}/grub_install.sh \
          --board="${BOARD}" \
          --target="${target}" \
          --disk_image="${disk_img}" \
          "${grub_args[@]}"
    done
  fi

  if [[ -n "${pcr_policy}" ]]; then
    ${BUILD_LIBRARY_DIR}/generate_grub_hashes.py \
        "${disk_img}" /usr/lib/grub/ "${BUILD_DIR}/pcrs" ${COREOS_VERSION}

    info "Generating $pcr_policy"
    pushd "${BUILD_DIR}" >/dev/null
    zip --quiet -r -9 "${BUILD_DIR}/${pcr_policy}" pcrs
    popd >/dev/null
  fi
}


text:
module Bosh::Registry
  class << self
    attr_accessor :logger
    attr_accessor :http_port
    attr_accessor :db
    attr_accessor :instance_manager
    attr_accessor :auth

    def configure(config)
      validate_config(config)

      @logger ||= Logger.new(config['logfile'] || STDOUT)
      @logger.level = Logger.const_get(config['loglevel'].upcase) if config['loglevel'].is_a?(String)

      @http_port = config["http"]["port"]

      @auth = []
      @auth << {
          'user' => config['http']['user'],
          'password' => config['http']['password']
      }

      if config['http']['additional_users']
        @auth = @auth + config['http']['additional_users'].map do |user|
          {"user" => user['username'], "password" => user['password']}
        end
      end

      @db = connect_db(config['db'])

      if config.key?('cloud')
        plugin = config['cloud']['plugin']
        begin
          require "bosh/registry/instance_manager/#{plugin}"
        rescue LoadError
          raise ConfigError, "Could not find Provider Plugin: #{plugin}"
        end
        @instance_manager = Bosh::Registry::InstanceManager.const_get(plugin.capitalize).new(config['cloud'])
      else
        @instance_manager = Bosh::Registry::InstanceManager.new
      end
    end

    def connect_db(db_config)
      connection_config = db_config.dup
      custom_connection_options = connection_config.delete('connection_options') do
        {}
      end

      tls_options = connection_config.delete('tls') do
        {}
      end

      if tls_options.fetch('enabled', false)
        certificate_paths = tls_options.fetch('cert')
        db_ca_path = certificate_paths.fetch('ca')
        db_client_cert_path = certificate_paths.fetch('certificate')
        db_client_private_key_path = certificate_paths.fetch('private_key')

        db_ca_provided = tls_options.fetch('bosh_internal').fetch('ca_provided')
        mutual_tls_enabled = tls_options.fetch('bosh_internal').fetch('mutual_tls_enabled')

        case connection_config['adapter']
        when 'mysql2'
          # http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html#label-mysql+
          connection_config['ssl_mode'] = 'verify_identity'
          connection_config['sslverify'] = true
          connection_config['sslca'] = db_ca_path if db_ca_provided
          connection_config['sslcert'] = db_client_cert_path if mutual_tls_enabled
          connection_config['sslkey'] = db_client_private_key_path if mutual_tls_enabled
        when 'postgres'
          # http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html#label-postgres
          connection_config['sslmode'] = 'verify-full'
          connection_config['sslrootcert'] = db_ca_path if db_ca_provided

          postgres_driver_options = {
            'sslcert' => db_client_cert_path,
            'sslkey' => db_client_private_key_path,
          }
          connection_config['driver_options'] = postgres_driver_options if mutual_tls_enabled
        end
      end

      connection_config.delete_if { |_, v| v.to_s.empty? }
      connection_config = connection_config.merge(custom_connection_options)

      Sequel.connect(connection_config)
    end

    def validate_config(config)
      unless config.is_a?(Hash)
        raise ConfigError, 'Invalid config format, Hash expected, ' \
                           "#{config.class} given"
      end

      raise ConfigError, 'HTTP configuration is missing from config file' unless config.key?('http') && config['http'].is_a?(Hash)
      raise ConfigError, 'Database configuration is missing from config file' unless config.key?('db') && config['db'].is_a?(Hash)

      return unless config.key?('cloud')

      raise ConfigError, 'Cloud configuration is missing from config file' unless config['cloud'].is_a?(Hash)
      raise ConfigError, 'Cloud plugin is missing from config file' if config['cloud']['plugin'].nil?
    end
  end
end


text:
package com.vmware.vim25;

/**
 * @author Steve Jin (http://www.doublecloud.org)
 * @version 5.1
 */

@SuppressWarnings("all")
public class VAppPropertyInfo extends DynamicData {
    public int key;
    public String classId;
    public String instanceId;
    public String id;
    public String category;
    public String label;
    public String type;
    public String typeReference;
    public Boolean userConfigurable;
    public String defaultValue;
    public String value;
    public String description;

    public int getKey() {
        return this.key;
    }

    public String getClassId() {
        return this.classId;
    }

    public String getInstanceId() {
        return this.instanceId;
    }

    public String getId() {
        return this.id;
    }

    public String getCategory() {
        return this.category;
    }

    public String getLabel() {
        return this.label;
    }

    public String getType() {
        return this.type;
    }

    public String getTypeReference() {
        return this.typeReference;
    }

    public Boolean getUserConfigurable() {
        return this.userConfigurable;
    }

    public String getDefaultValue() {
        return this.defaultValue;
    }

    public String getValue() {
        return this.value;
    }

    public String getDescription() {
        return this.description;
    }

    public void setKey(int key) {
        this.key = key;
    }

    public void setClassId(String classId) {
        this.classId = classId;
    }

    public void setInstanceId(String instanceId) {
        this.instanceId = instanceId;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setTypeReference(String typeReference) {
        this.typeReference = typeReference;
    }

    public void setUserConfigurable(Boolean userConfigurable) {
        this.userConfigurable = userConfigurable;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}


text:
package org.apache.ignite.snippets.plugin;

import java.io.Serializable;
import java.util.UUID;

import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.plugin.CachePluginContext;
import org.apache.ignite.plugin.CachePluginProvider;
import org.apache.ignite.plugin.ExtensionRegistry;
import org.apache.ignite.plugin.PluginConfiguration;
import org.apache.ignite.plugin.PluginContext;
import org.apache.ignite.plugin.PluginProvider;
import org.apache.ignite.plugin.PluginValidationException;
import org.jetbrains.annotations.Nullable;

public class MyPluginProvider implements PluginProvider<PluginConfiguration> {

    /**
     * The time interval in seconds for printing cache size information.
     */
    private long interval = 10;

    private MyPlugin plugin;

    public MyPluginProvider() {
    }

    /**
     *
     * @param interval Time interval in seconds
     */
    public MyPluginProvider(long interval) {
        this.interval = interval;
    }

    @Override
    public String name() {
        //the name of the plugin
        return "MyPlugin";
    }

    @Override
    public String version() {
        return "1.0";
    }

    @Override
    public String copyright() {
        return "MyCompany";
    }

    @Override
    public MyPlugin plugin() {
        return plugin;
    }

    @Override
    public void initExtensions(PluginContext ctx, ExtensionRegistry registry)
            throws IgniteCheckedException {
        plugin = new MyPlugin(interval, ctx);
    }

    @Override
    public void onIgniteStart() throws IgniteCheckedException {
        //start the plugin when Ignite is started
        plugin.start();
    }

    @Override
    public void onIgniteStop(boolean cancel) {
        //stop the plugin
        plugin.stop();
    }

    /**
     * The time interval (in seconds) for printing cache size information
     * @return
     */
    public long getInterval() {
        return interval;
    }

    /**
     * Sets the time interval (in seconds) for printing cache size information
     * @param interval
     */
    public void setInterval(long interval) {
        this.interval = interval;
    }

    // other no-op methods of PluginProvider
    //tag::no-op-methods[]
    @Override
    public <T> @Nullable T createComponent(PluginContext ctx, Class<T> cls) {
        System.out.println(cls);
        return null;
    }

    @Override
    public CachePluginProvider createCacheProvider(CachePluginContext ctx) {
        return null;
    }

    @Override
    public void start(PluginContext ctx) throws IgniteCheckedException {
    }

    @Override
    public void stop(boolean cancel) throws IgniteCheckedException {
    }

    @Override
    public @Nullable Serializable provideDiscoveryData(UUID nodeId) {
        return null;
    }

    @Override
    public void receiveDiscoveryData(UUID nodeId, Serializable data) {
    }

    @Override
    public void validateNewNode(ClusterNode node) throws PluginValidationException {
    }
    //end::no-op-methods[]
}


text:
@implementation UIScrollView(Ext)
- (NSUInteger)extCurrentPage
{
    return (self.contentOffset.x + (0.5f * self.frame.size.width)) / self.frame.size.width;
}
@end


text:
using System.Collections.Generic;

namespace FullContactDotNet.Name
{
    public class NameDetails
    {
        /// <summary>
        /// Gets or sets the name of the given.
        /// </summary>
        /// <value>
        /// The name of the given.
        /// </value>
        public string GivenName { get; set; }

        /// <summary>
        /// Gets or sets the name of the family.
        /// </summary>
        /// <value>
        /// The name of the family.
        /// </value>
        public string FamilyName { get; set; }

        /// <summary>
        /// Gets or sets the middle names.
        /// </summary>
        /// <value>
        /// The middle names.
        /// </value>
        public List<string> MiddleNames { get; set; }

        /// <summary>
        /// Gets or sets the prefixes.
        /// </summary>
        /// <value>
        /// The prefixes.
        /// </value>
        public List<string> Prefixes { get; set; }

        /// <summary>
        /// Gets or sets the suffixes.
        /// </summary>
        /// <value>
        /// The suffixes.
        /// </value>
        public List<string> Suffixes { get; set; }

        /// <summary>
        /// Gets or sets the nicknames.
        /// </summary>
        /// <value>
        /// The nicknames.
        /// </value>
        public List<string> Nicknames { get; set; }

        /// <summary>
        /// Gets or sets the full name.
        /// </summary>
        /// <value>
        /// The full name.
        /// </value>
        public string FullName { get; set; }
    }
}


text:
<?php defined('BX_DOL') or die('hack attempt');

/**
 * System services related to Comments.
 */
class BxBaseCmtsServices extends BxDol
{
    public function __construct()
    {
        parent::__construct();
    }

    public function serviceGetBlockView($sSystem = '', $iObjectId = 0, $iCommentId = 0)
    {
        if(empty($sSystem) && ($sSystem = bx_get('sys')) !== false)
            $sSystem = bx_process_input($sSystem);

        if(empty($iObjectId) && ($iObjectId = bx_get('id')) !== false)
            $iObjectId = bx_process_input($iObjectId, BX_DATA_INT);

        if(empty($iCommentId) && ($iCommentId = bx_get('cmt_id')) !== false)
            $iCommentId = bx_process_input($iCommentId, BX_DATA_INT);

        $oCmts = BxDolCmts::getObjectInstance($sSystem, $iObjectId, true);
        if(!$oCmts)
            return '';

        return $oCmts->getCommentBlock($iCommentId);
    }

    public function serviceAlertResponseSysCmtsImagesFileDeleted($oAlert)
    {
        $iUniqId = (int)$oAlert->aExtras['ghost']['content_id'];

        $aCmt = BxDolCmts::getGlobalInfo($iUniqId);
        if(empty($aCmt) || !is_array($aCmt))
            return;

        $oCmts = BxDolCmts::getObjectInstance($aCmt['system_name'], 0, false);
        if(!$oCmts)
            return;

        $oCmts->getQueryObject()->deleteImages($aCmt['system_id'], false, $oAlert->iObject);
    }

    public function serviceGetMenuItemAddonVote($sSystem, $iId, $iCmtId)
    {
        $oCmts = BxDolCmts::getObjectInstance($sSystem, $iId);

        $oVote = $oCmts->getVoteObject($iCmtId);
        if($oVote !== false)
            return $oVote->getCounter();

        return '';
    }

    public function serviceGetLiveUpdate($sSystem, $iContentId, $iProfileId, $iCount = 0)
    {
        $oCmts = BxDolCmts::getObjectInstance($sSystem, $iContentId);
        if(!$oCmts || !$oCmts->isEnabled())
            return false;

        $sKey = $oCmts->getNotificationId();

        bx_import('BxDolSession');
        if((int)BxDolSession::getInstance()->getValue($sKey) == 1)
            return false;

        $iCountNew = $oCmts->getCommentsCount($iContentId, -1, BX_CMT_FILTER_OTHERS);
        if($iCountNew == $iCount)
            return false;

        return array(
            'count' => $iCountNew, // required
            'method' => $oCmts->getJsObjectName() . '.showLiveUpdate(oData)', // required
            'data' => array(
                'code' => $oCmts->getLiveUpdate($iCount, $iCountNew)
            ),  // optional, may have some additional data to be passed in JS method provided using 'method' param above.
        );
    }

    public function serviceGetLiveUpdates($sSystem, $iContentId, $iProfileId, $iCount = 0)
    {
        $oCmts = BxDolCmts::getObjectInstance($sSystem, $iContentId);
        if(!$oCmts || !$oCmts->isEnabled())
            return false;

        $sKey = $oCmts->getNotificationId();

        bx_import('BxDolSession');
        if((int)BxDolSession::getInstance()->getValue($sKey) == 1)
            return false;

        $iCountNew = $oCmts->getCommentsCount($iContentId, -1, BX_CMT_FILTER_OTHERS);
        if($iCountNew == $iCount)
            return false;

        return array(
            'count' => $iCountNew, // required
            'method' => $oCmts->getJsObjectName() . '.showLiveUpdates(oData)', // required
            'data' => array(
                'code' => $oCmts->getLiveUpdates($iCount, $iCountNew)
            ),  // optional, may have some additional data to be passed in JS method provided using 'method' param above.
        );
    }

    public function serviceManageTools($sType = 'common')
    {
        $oGrid = BxDolGrid::getObjectInstance('sys_cmts_administration');
        if(!$oGrid)
            return '';

        $oTemplate = BxDolTemplate::getInstance();
        $oTemplate->addJs(array('BxDolCmtsManageTools.js'));
        $oTemplate->addCss(array('cmts_manage_tools.css'));
        $oTemplate->addJsTranslation(array('_sys_grid_search'));
        return array(
            'content' =>  $oGrid->getCode()
        );
    }

    /**
     * Comment vote for Notifications module
     */
    public function serviceGetNotificationsVote($aEvent)
    {
        $iCmtIdUnique = (int)$aEvent['object_id'];

        $aCmtInfo = BxDolCmts::getGlobalInfo($iCmtIdUnique);
        if(empty($aCmtInfo) || !is_array($aCmtInfo))
            return array();

        $oCmts = BxDolCmts::getObjectInstance($aCmtInfo['system_name'], 0, false);
        if(!$oCmts || !$oCmts->isEnabled())
            return array();

        $oVote = $oCmts->getVoteObject($iCmtIdUnique);
        if(!$oVote)
            return array();

        $iCmtId = (int)$aCmtInfo['cmt_id'];
        $sCmtUrl = $oCmts->serviceGetLink($iCmtId);
        $sCmtCaption = strmaxtextlen($oCmts->serviceGetText($iCmtId), 20, '...');

        return array(
            'entry_sample' => $oCmts->getLanguageKey('txt_sample_single'),
            'entry_url' => $sCmtUrl,
            'entry_caption' => $sCmtCaption,
            'entry_author' => $aCmtInfo['author_id'],
            'subentry_sample' => $oCmts->getLanguageKey('txt_sample_vote_single'),
            'lang_key' => '', //may be empty or not specified. In this case the default one from Notification module will be used.
        );
    }

    /**
     * Comment reaction for Notifications module
     */
    public function serviceGetNotificationsReaction($aEvent)
    {
    	$iCmtIdUnique = (int)$aEvent['object_id'];

        $aCmtInfo = BxDolCmts::getGlobalInfo($iCmtIdUnique);
        if(empty($aCmtInfo) || !is_array($aCmtInfo))
            return array();

        $oCmts = BxDolCmts::getObjectInstance($aCmtInfo['system_name'], 0, false);
        if(!$oCmts || !$oCmts->isEnabled())
            return array();

        $oReaction = $oCmts->getReactionObject($iCmtIdUnique);
        if(!$oReaction)
            return array();

        $aSubentry = $oReaction->getTrackBy(array('type' => 'id', 'id' => (int)$aEvent['subobject_id']));
        if(empty($aSubentry) || !is_array($aSubentry))
            return array();

        $aSubentrySampleParams = array();
        $aReaction = $oReaction->getReaction($aSubentry['reaction']);
        if(!empty($aReaction['title']))
            $aSubentrySampleParams[] = $aReaction['title'];
        else
            $aSubentrySampleParams[] = '_undefined';

        $iCmtId = (int)$aCmtInfo['cmt_id'];
        $sCmtUrl = $oCmts->serviceGetLink($iCmtId);
        $sCmtCaption = strmaxtextlen($oCmts->serviceGetText($iCmtId), 20, '...');

        return array(
            'entry_sample' => $oCmts->getLanguageKey('txt_sample_single'),
            'entry_url' => $sCmtUrl,
            'entry_caption' => $sCmtCaption,
            'entry_author' => $aCmtInfo['author_id'],
            'subentry_sample' => $oCmts->getLanguageKey('txt_sample_reaction_single'),
            'subentry_sample_params' => $aSubentrySampleParams,
            'lang_key' => '', //may be empty or not specified. In this case the default one from Notification module will be used.
        );
    }

    /**
     * Comment score -> vote up for Notifications module
     */
    public function serviceGetNotificationsScoreUp($aEvent)
    {
    	return $this->_serviceGetNotificationsScore('up', $aEvent);
    }

    /**
     * Comment score -> vote down for Notifications module
     */
    public function serviceGetNotificationsScoreDown($aEvent)
    {
    	return $this->_serviceGetNotificationsScore('down', $aEvent);
    }

    protected function _serviceGetNotificationsScore($sType, $aEvent)
    {
        $iCmtIdUnique = (int)$aEvent['object_id'];

        $aCmtInfo = BxDolCmts::getGlobalInfo($iCmtIdUnique);
        if(empty($aCmtInfo) || !is_array($aCmtInfo))
            return array();

        $oCmts = BxDolCmts::getObjectInstance($aCmtInfo['system_name'], 0, false);
        if(!$oCmts || !$oCmts->isEnabled())
            return array();

        $oScore = $oCmts->getScoreObject($iCmtIdUnique);
        if(!$oScore)
            return array();

        $iCmtId = (int)$aCmtInfo['cmt_id'];
        $sCmtUrl = $oCmts->serviceGetLink($iCmtId);
        $sCmtCaption = strmaxtextlen($oCmts->serviceGetText($iCmtId), 20, '...');

        return array(
            'entry_sample' => $oCmts->getLanguageKey('txt_sample_single'),
            'entry_url' => $sCmtUrl,
            'entry_caption' => $sCmtCaption,
            'entry_author' => $aCmtInfo['author_id'],
            'subentry_sample' => $oCmts->getLanguageKey('txt_sample_score_' . $sType . '_single'),
            'lang_key' => '', //may be empty or not specified. In this case the default one from Notification module will be used.
        );
    }
}

/** @} */