text:
package net.mgsx.game.core.annotations;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

/**
 * Mark field as auto injected.
 *
 * When used in Kit context, systems will be injected in current field based on type.
 *
 * TODO for now only work with tools
 *
 * @author mgsx
 *
 */
@Retention(RUNTIME)
@Target(FIELD)
public @interface Inject {

}

redpajama_set_name: RedPajamaGithub


text:
> The blink of an eye, you know it's me.
> You keep the dagger close at hand.

# Daemon of the Fall

Start, restart and stop multiple instances of daemons that don't support that.

You can specify a command to be run, specify how much instances should be
started. You can then restart them one by one by sending a single USR2 signal
to the master process. Similar to processes like Unicorn.

Example:

    # start 10 workers:
    daemon_of_the_fall --pid /tmp/foo.pid --workers 10 --daemonize /some/daemon

    # restart them one by one:
    kill -USR2 `cat /tmp/foo.pid`

    # shut them all down:
    kill -TERM `cat /tmp/foo.pid`

## Installation

    $ gem install daemon_of_the_fall

## Usage

See `daemon_of_the_fall --help` for a list of options.

These are the signals daemon_of_the_fall responds to:

* `TERM`/`INT` shuts down all workers and then the master
* `HUP` will be simply forwarded to each worker
* `USR2` will restart each worker
* `TTIN` increase the number of workers by one
* `TTOU` decrease the number of workers by one

## Testing

Run `rake` to run the tests.

If the integration test fails, you might need to clean up the orphaned
processes manually.

## Contributing

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


text:
import {
    OPEN_BOARD,
    OPENED_BOARD
} from '../actions/actionTypes'

function getInitialState() {
    return {
        opening: false
    }
}

export default function openBoardReducer(state = getInitialState(), action) {
    switch (action.type) {
        case OPEN_BOARD:
            return Object.assign({}, state, { opening: true })
        case OPENED_BOARD:
            return Object.assign({}, state, { opening: false })
        default:
            return state
    }
}


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

<title>DeletionInfo.InOrderTester (apache-cassandra API)</title>
<meta name="date" content="2015-05-13">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.apache.cassandra.db

Class DeletionInfo.InOrderTester

java.lang.Object

org.apache.cassandra.db.DeletionInfo.InOrderTester

Enclosing class:

DeletionInfo

public class DeletionInfo.InOrderTester
extends java.lang.Object

This object allow testing whether a given column (name/timestamp) is deleted
 or not by this DeletionInfo, assuming that the columns given to this
 object are passed in forward or reversed comparator sorted order.

 This is more efficient that calling DeletionInfo.isDeleted() repeatedly
 in that case.

Method Summary

Methods

Modifier and Type
Method and Description

boolean
isDeleted(java.nio.ByteBuffer name,
         long timestamp)

boolean
isDeleted(Column column)

Methods inherited from class java.lang.Object

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

Method Detail

isDeleted

public boolean isDeleted(Column column)

isDeleted

public boolean isDeleted(java.nio.ByteBuffer name,
                long timestamp)

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2015 The Apache Software Foundation


text:
layout: post
title: Minkowski Sums
modified:
categories: quarantalks
excerpt:
tags: [MnP, summers]
author : Arya Vadnere
comments: true
image:
  feature:
date: 2020-05-19T20:00:00+00:00
---
What are closed convex sets? How do curves and width correlate? What are these to do with Minkowski sums? How does the Barbier theorem unfold the beauty of convex sets?

Arya Vadnere gave a wonderful talk as a brief introduction to convex geometry. He started with an introduction to curves, support lines, width of a curve and Minkowski sums.He later discussed curves of constant width; followed by Barbier's theorem and its proof. It was an amusing topic for those interested in pure mathematics and we had an overwhelming number of participants! At the end, Arya mentioned the applications of Barbier's theorem to solve Buffon's needle problem.
Here is the link to the slides used in the presentation
Arya Vadnere is a student at the Chennai Mathematical Institute


text:
<?php

	namespace phpish\template;

	function render($template, $template_vars=array())
	{
		$template_file = filename($template);

		if (file_exists($template_file))
		{
			if (!empty($template_vars) and is_array($template_vars)) extract($template_vars);
			ob_start();
			require $template_file;
			$buffer = ob_get_contents();
			ob_end_clean();

			return $buffer;
		}
		else
		{
			trigger_error("Eh-oh! Required template $template ($template_file) not found", E_USER_ERROR);
		}

		return false;
	}

		function filename($template)
		{
			if (_has_absolute_path($template))
			{
				$template_dir = '';
			}
			else
			{
				$template_dir = basedir() ?: default_basedir();
			}

			$template_dir = !empty($template_dir) ? rtrim($template_dir, '/\\').DIRECTORY_SEPARATOR : $template_dir;
			$template = rtrim($template, '/\\');
			return _slashes_to_directory_separator("$template_dir$template.php");
		}

			function _has_absolute_path($template)
			{
				$begins_with_directory_separator = (DIRECTORY_SEPARATOR === $template[0]);
				$begins_with_windows_drive_letter = (':\\' === substr($template, 1, 2));
				$begins_with_network_drive = ('\\\\' === substr($template, 0, 2));
				return ($begins_with_directory_separator or $begins_with_windows_drive_letter or $begins_with_network_drive);
			}

			function basedir($dir=NULL)
			{
				static $template_dir;
				if (is_null($dir) and isset($template_dir)) return $template_dir;
				return $template_dir = $dir;
			}

			function default_basedir()
			{
				return _currently_executing_script_dir().'templates'.DIRECTORY_SEPARATOR;
			}

				function _currently_executing_script_dir()
				{
					return dirname($_SERVER['SCRIPT_FILENAME']).DIRECTORY_SEPARATOR;
				}

			function _slashes_to_directory_separator($path)
			{
				return preg_replace('/[\/\\\]/', DIRECTORY_SEPARATOR, $path);
			}

	function compose($template)
	{
		$args = array_slice(func_get_args(), 1);
		$template_vars = (!empty($args) and (is_array($args[0]))) ? array_shift($args) : array();
		$content = render($template, $template_vars);

		while(!empty($args))
		{
			if (is_null($args[0]))
			{
				array_shift($args);
				continue;
			}
			$template = array_shift($args);
			$template_vars = (!empty($args) and (is_array($args[0]))) ? (array_shift($args) + $template_vars) : $template_vars;
			$template_vars['content'] = $content;
			$content = render($template, $template_vars);
		}

		return $content;
	}

?>


text:
namespace MappingEfCore.InheritanceTo.TablePerType
{
  using System;

  using Domain;
  using Domain.Inheritance;

  using Microsoft.EntityFrameworkCore;

  public class TptContextEfCore : DbContext
  {
    public DbSet<Book> Books { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
      optionsBuilder.UseSqlServer(Constants.ConnectionStringEfCore);
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
      modelBuilder.Entity<Book>().ToTable("Books");
      modelBuilder.Entity<EBook>().ToTable("EBooks");
      modelBuilder.Entity<Hardcover>().ToTable("Hardcover");

      throw new NotSupportedException("TPT mapping currently not supported.");

      base.OnModelCreating(modelBuilder);
    }
  }
}


text:
ActiveRecord::Schema.define(version: 20170325115522) do

  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"

  create_table "bus_routes", force: :cascade do |t|
    t.string   "bus_num"
    t.string   "route",      default: [],              array: true
    t.datetime "created_at",              null: false
    t.datetime "updated_at",              null: false
  end

end


text:
body {
  background: url(background.jpg);
}

.radmenu {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.radmenu > a {
  top: calc(50% - 60px);
  left: calc(50% - 60px);
}
.radmenu > a.show {
  display: flex !important;
}
.radmenu li {
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  transition: all 1s ease;
}
.radmenu a {
  position: absolute;
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.9);
  text-align: center;
  align-items: center;
  justify-content: center;
  border-radius: 120px;
  display: none;
  text-decoration: none;
  color: #333;
  transition: all 1s ease;
  box-shadow: 0 0 15px #222;
  font-family: "segoe ui";
  font-weight: 200;
  font-size: 16px;
}
.radmenu .selected {
  background: rgba(51, 51, 51, 0.9);
  display: flex;
  top: calc(50% - 60px);
  left: calc(50% - 60px);
  color: #f1f1f1;
  box-shadow: 0 0 10px #f1f1f1;
}
.radmenu .selected + ul > li:nth-child(1) {
  -webkit-transform: rotate(72deg) translateX(100px);
  transform: rotate(72deg) translateX(100px);
}
.radmenu .selected + ul > li:nth-child(1) > a {
  -webkit-transform: rotate(-72deg);
  transform: rotate(-72deg);
}
.radmenu .selected + ul > li:nth-child(2) {
  -webkit-transform: rotate(144deg) translateX(100px);
  transform: rotate(144deg) translateX(100px);
}
.radmenu .selected + ul > li:nth-child(2) > a {
  -webkit-transform: rotate(-144deg);
  transform: rotate(-144deg);
}
.radmenu .selected + ul > li:nth-child(3) {
  -webkit-transform: rotate(216deg) translateX(100px);
  transform: rotate(216deg) translateX(100px);
}
.radmenu .selected + ul > li:nth-child(3) > a {
  -webkit-transform: rotate(-216deg);
  transform: rotate(-216deg);
}
.radmenu .selected + ul > li:nth-child(4) {
  -webkit-transform: rotate(288deg) translateX(100px);
  transform: rotate(288deg) translateX(100px);
}
.radmenu .selected + ul > li:nth-child(4) > a {
  -webkit-transform: rotate(-288deg);
  transform: rotate(-288deg);
}
.radmenu .selected + ul > li:nth-child(5) {
  -webkit-transform: rotate(360deg) translateX(100px);
  transform: rotate(360deg) translateX(100px);
}
.radmenu .selected + ul > li:nth-child(5) > a {
  -webkit-transform: rotate(-360deg);
  transform: rotate(-360deg);
}
.radmenu .selected + ul > li > a {
  display: flex;
}


text:
package org.apache.spark.metrics

import org.scalatest.{BeforeAndAfter, FunSuite}
import org.apache.spark.deploy.master.MasterSource
import org.apache.spark.SparkConf

class MetricsSystemSuite extends FunSuite with BeforeAndAfter {
  var filePath: String = _
  var conf: SparkConf = null

  before {
    filePath = getClass.getClassLoader.getResource("test_metrics_system.properties").getFile()
    conf = new SparkConf(false).set("spark.metrics.conf", filePath)
  }

  test("MetricsSystem with default config") {
    val metricsSystem = MetricsSystem.createMetricsSystem("default", conf)
    val sources = metricsSystem.sources
    val sinks = metricsSystem.sinks

    assert(sources.length === 0)
    assert(sinks.length === 0)
    assert(!metricsSystem.getServletHandlers.isEmpty)
  }

  test("MetricsSystem with sources add") {
    val metricsSystem = MetricsSystem.createMetricsSystem("test", conf)
    val sources = metricsSystem.sources
    val sinks = metricsSystem.sinks

    assert(sources.length === 0)
    assert(sinks.length === 1)
    assert(!metricsSystem.getServletHandlers.isEmpty)

    val source = new MasterSource(null)
    metricsSystem.registerSource(source)
    assert(sources.length === 1)
  }
}


text:
require_relative '../spec_helper.rb'
require_relative '../../bin/metrics-redis-graphite.rb'

describe 'Redis2Graphite', '#run' do
  before(:all) do
    Redis2Graphite.class_variable_set(:@@autorun, nil)
  end

  it 'accepts config' do
    args = %w[--host 10.0.0.1 --port 3456 --password foobar]
    check = Redis2Graphite.new(args)
    expect(check.default_redis_options[:password]).to eq 'foobar'
    expect(check.default_redis_options[:host]).to eq '10.0.0.1'
    expect(check.default_redis_options[:port]).to eq 3456
  end

  it 'sets socket option accordingly' do
    args = %w[--socket /some/path/redis.sock]
    check = Redis2Graphite.new(args)
    expect(check.default_redis_options[:path]).to eq '/some/path/redis.sock'
    expect(check.default_redis_options[:host]).to be_nil
    expect(check.default_redis_options[:port]).to be_nil
  end

  it 'returns warning' do
    args = %w[--host 1.1.1.1 --port 1234 --conn-failure-status warning --timeout 0.1]
    check = Redis2Graphite.new(args)
    expect(check).to receive(:warning).with('Could not connect to Redis server on 1.1.1.1:1234').and_raise(SystemExit)
    expect { check.run }.to raise_error(SystemExit)
  end
end


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

// Multiply-included message file, so no include guard.

#include <string>
#include <vector>

#include "base/basictypes.h"
#include "base/files/file_path.h"
#include "base/platform_file.h"
#include "base/strings/string16.h"
#include "base/tuple.h"
#include "base/values.h"
#include "chrome/common/extensions/update_manifest.h"
#include "chrome/common/media_galleries/iphoto_library.h"
#include "chrome/common/media_galleries/itunes_library.h"
#include "chrome/common/media_galleries/metadata_types.h"
#include "chrome/common/media_galleries/picasa_types.h"
#include "chrome/common/safe_browsing/zip_analyzer.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_platform_file.h"
#include "third_party/skia/include/core/SkBitmap.h"

#define IPC_MESSAGE_START ChromeUtilityMsgStart

#ifndef CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_
#define CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_

typedef std::vector<Tuple2<SkBitmap, base::FilePath> > DecodedImages;

#endif  // CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_

IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Result)
  IPC_STRUCT_TRAITS_MEMBER(extension_id)
  IPC_STRUCT_TRAITS_MEMBER(version)
  IPC_STRUCT_TRAITS_MEMBER(browser_min_version)
  IPC_STRUCT_TRAITS_MEMBER(package_hash)
  IPC_STRUCT_TRAITS_MEMBER(crx_url)
IPC_STRUCT_TRAITS_END()

IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Results)
  IPC_STRUCT_TRAITS_MEMBER(list)
  IPC_STRUCT_TRAITS_MEMBER(daystart_elapsed_seconds)
IPC_STRUCT_TRAITS_END()

IPC_STRUCT_TRAITS_BEGIN(safe_browsing::zip_analyzer::Results)
  IPC_STRUCT_TRAITS_MEMBER(success)
  IPC_STRUCT_TRAITS_MEMBER(has_executable)
  IPC_STRUCT_TRAITS_MEMBER(has_archive)
IPC_STRUCT_TRAITS_END()

#if defined(OS_MACOSX)
IPC_STRUCT_TRAITS_BEGIN(iphoto::parser::Photo)
  IPC_STRUCT_TRAITS_MEMBER(id)
  IPC_STRUCT_TRAITS_MEMBER(location)
  IPC_STRUCT_TRAITS_MEMBER(original_location)
IPC_STRUCT_TRAITS_END()

IPC_STRUCT_TRAITS_BEGIN(iphoto::parser::Library)
  IPC_STRUCT_TRAITS_MEMBER(albums)
  IPC_STRUCT_TRAITS_MEMBER(all_photos)
IPC_STRUCT_TRAITS_END()
#endif  // defined(OS_MACOSX)

#if defined(OS_WIN) || defined(OS_MACOSX)
IPC_STRUCT_TRAITS_BEGIN(itunes::parser::Track)
  IPC_STRUCT_TRAITS_MEMBER(id)
  IPC_STRUCT_TRAITS_MEMBER(location)
IPC_STRUCT_TRAITS_END()

IPC_STRUCT_TRAITS_BEGIN(picasa::AlbumInfo)
  IPC_STRUCT_TRAITS_MEMBER(name)
  IPC_STRUCT_TRAITS_MEMBER(timestamp)
  IPC_STRUCT_TRAITS_MEMBER(uid)
  IPC_STRUCT_TRAITS_MEMBER(path)
IPC_STRUCT_TRAITS_END()

// These files are opened read-only. Please see the constructor for
// picasa::AlbumTableFiles for details.
IPC_STRUCT_TRAITS_BEGIN(picasa::AlbumTableFilesForTransit)
  IPC_STRUCT_TRAITS_MEMBER(indicator_file)
  IPC_STRUCT_TRAITS_MEMBER(category_file)
  IPC_STRUCT_TRAITS_MEMBER(date_file)
  IPC_STRUCT_TRAITS_MEMBER(filename_file)
  IPC_STRUCT_TRAITS_MEMBER(name_file)
  IPC_STRUCT_TRAITS_MEMBER(token_file)
  IPC_STRUCT_TRAITS_MEMBER(uid_file)
IPC_STRUCT_TRAITS_END()

IPC_STRUCT_TRAITS_BEGIN(picasa::FolderINIContents)
  IPC_STRUCT_TRAITS_MEMBER(folder_path)
  IPC_STRUCT_TRAITS_MEMBER(ini_contents)
IPC_STRUCT_TRAITS_END()
#endif  // defined(OS_WIN) || defined(OS_MACOSX)

#if !defined(OS_ANDROID) && !defined(OS_IOS)
IPC_STRUCT_TRAITS_BEGIN(metadata::AttachedImage)
  IPC_STRUCT_TRAITS_MEMBER(type)
  IPC_STRUCT_TRAITS_MEMBER(data)
IPC_STRUCT_TRAITS_END()
#endif  // !defined(OS_ANDROID) && !defined(OS_IOS)

//------------------------------------------------------------------------------
// Utility process messages:
// These are messages from the browser to the utility process.

// Tells the utility process to unpack the given extension file in its
// directory and verify that it is valid.
IPC_MESSAGE_CONTROL4(ChromeUtilityMsg_UnpackExtension,
                     base::FilePath /* extension_filename */,
                     std::string /* extension_id */,
                     int /* Manifest::Location */,
                     int /* InitFromValue flags */)

// Tell the utility process to parse the given JSON data and verify its
// validity.
IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_UnpackWebResource,
                     std::string /* JSON data */)

// Tell the utility process to parse the given xml document.
IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseUpdateManifest,
                     std::string /* xml document contents */)

// Tell the utility process to decode the given image data.
IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_DecodeImage,
                     std::vector<unsigned char>)  // encoded image contents

// Tell the utility process to decode the given image data, which is base64
// encoded.
IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_DecodeImageBase64,
                     std::string)  // base64 encoded image contents

// Tell the utility process to decode the given JPEG image data with a robust
// libjpeg codec.
IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_RobustJPEGDecodeImage,
                     std::vector<unsigned char>)  // encoded image contents

// Tell the utility process to parse a JSON string into a Value object.
IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseJSON,
                     std::string /* JSON to parse */)

// Tell the utility process to patch the given |input_file| using |patch_file|
// and place the output in |output_file|. The patch should use the bsdiff
// algorithm (Courgette's version).
IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_PatchFileBsdiff,
                     base::FilePath /* input_file */,
                     base::FilePath /* patch_file */,
                     base::FilePath /* output_file */)

// Tell the utility process to patch the given |input_file| using |patch_file|
// and place the output in |output_file|. The patch should use the Courgette
// algorithm.
IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_PatchFileCourgette,
                     base::FilePath /* input_file */,
                     base::FilePath /* patch_file */,
                     base::FilePath /* output_file */)

#if defined(OS_CHROMEOS)
// Tell the utility process to create a zip file on the given list of files.
IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_CreateZipFile,
                     base::FilePath /* src_dir */,
                     std::vector<base::FilePath> /* src_relative_paths */,
                     base::FileDescriptor /* dest_fd */)
#endif  // defined(OS_CHROMEOS)

// Requests the utility process to respond with a
// ChromeUtilityHostMsg_ProcessStarted message once it has started.  This may
// be used if the host process needs a handle to the running utility process.
IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_StartupPing)

// Tells the utility process to analyze a zip file for malicious download
// protection.
IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection,
                     IPC::PlatformFileForTransit /* zip_file */)

#if defined(OS_WIN)
// Tell the utility process to parse the iTunes preference XML file contents
// and return the path to the iTunes directory.
IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseITunesPrefXml,
                     std::string /* XML to parse */)
#endif  // defined(OS_WIN)

#if defined(OS_MACOSX)
// Tell the utility process to parse the iPhoto library XML file and
// return the parse result as well as the iPhoto library as an iphoto::Library.
IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseIPhotoLibraryXmlFile,
                     IPC::PlatformFileForTransit /* XML file to parse */)
#endif  // defined(OS_MACOSX)

#if defined(OS_WIN) || defined(OS_MACOSX)
// Tell the utility process to parse the iTunes library XML file and
// return the parse result as well as the iTunes library as an itunes::Library.
IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseITunesLibraryXmlFile,
                     IPC::PlatformFileForTransit /* XML file to parse */)

// Tells the utility process to parse the Picasa PMP database and return a
// listing of the user's Picasa albums and folders, along with metadata.
IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParsePicasaPMPDatabase,
                     picasa::AlbumTableFilesForTransit /* album_table_files */)

// Tells the utility process to index the Picasa user-created Album contents
// by parsing all the INI files in Picasa Folders.
IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_IndexPicasaAlbumsContents,
                     picasa::AlbumUIDSet /* album_uids */,
                     std::vector<picasa::FolderINIContents> /* folders_inis */)
#endif  // defined(OS_WIN) || defined(OS_MACOSX)

#if !defined(OS_ANDROID) && !defined(OS_IOS)
// Tell the utility process to attempt to validate the passed media file. The
// file will undergo basic sanity checks and will be decoded for up to
// |milliseconds_of_decoding| wall clock time. It is still not safe to decode
// the file in the browser process after this check.
IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_CheckMediaFile,
                     int64 /* milliseconds_of_decoding */,
                     IPC::PlatformFileForTransit /* Media file to parse */)

IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_ParseMediaMetadata,
                     std::string /* mime_type */,
                     int64 /* total_size */,
                     bool /* get_attached_images */)

IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RequestBlobBytes_Finished,
                     int64 /* request_id */,
                     std::string /* bytes */)
#endif  // !defined(OS_ANDROID) && !defined(OS_IOS)

// Requests that the utility process write the contents of the source file to
// the removable drive listed in the target file. The target will be restricted
// to removable drives by the utility process.
IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_ImageWriter_Write,
                     base::FilePath /* source file */,
                     base::FilePath /* target file */)

// Requests that the utility process verify that the contents of the source file
// was written to the target. As above the target will be restricted to
// removable drives by the utility process.
IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_ImageWriter_Verify,
                     base::FilePath /* source file */,
                     base::FilePath /* target file */)

// Cancels a pending write or verify operation.
IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_ImageWriter_Cancel)

//------------------------------------------------------------------------------
// Utility process host messages:
// These are messages from the utility process to the browser.

// Reply when the utility process is done unpacking an extension.  |manifest|
// is the parsed manifest.json file.
// The unpacker should also have written out files containing the decoded
// images and message catalogs from the extension. The data is written into a
// DecodedImages struct into a file named kDecodedImagesFilename in the
// directory that was passed in. This is done because the data is too large to
// pass over IPC.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackExtension_Succeeded,
                     base::DictionaryValue /* manifest */)

// Reply when the utility process has failed while unpacking an extension.
// |error_message| is a user-displayable explanation of what went wrong.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackExtension_Failed,
                     base::string16 /* error_message, if any */)

// Reply when the utility process is done unpacking and parsing JSON data
// from a web resource.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackWebResource_Succeeded,
                     base::DictionaryValue /* json data */)

// Reply when the utility process has failed while unpacking and parsing a
// web resource.  |error_message| is a user-readable explanation of what
// went wrong.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackWebResource_Failed,
                     std::string /* error_message, if any */)

// Reply when the utility process has succeeded in parsing an update manifest
// xml document.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseUpdateManifest_Succeeded,
                     UpdateManifest::Results /* updates */)

// Reply when an error occurred parsing the update manifest. |error_message|
// is a description of what went wrong suitable for logging.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseUpdateManifest_Failed,
                     std::string /* error_message, if any */)

// Reply when the utility process has succeeded in decoding the image.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_DecodeImage_Succeeded,
                     SkBitmap)  // decoded image

// Reply when an error occurred decoding the image.
IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_DecodeImage_Failed)

// Reply when the utility process successfully parsed a JSON string.
//
// WARNING: The result can be of any Value subclass type, but we can't easily
// pass indeterminate value types by const object reference with our IPC macros,
// so we put the result Value into a ListValue. Handlers should examine the
// first (and only) element of the ListValue for the actual result.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseJSON_Succeeded,
                     base::ListValue)

// Reply when the utility process failed in parsing a JSON string.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseJSON_Failed,
                     std::string /* error message, if any*/)

// Reply when a file has been patched successfully.
IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_PatchFile_Succeeded)

// Reply when patching a file failed.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_PatchFile_Failed,
                     int /* error code */)

#if defined(OS_CHROMEOS)
// Reply when the utility process has succeeded in creating the zip file.
IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_CreateZipFile_Succeeded)

// Reply when an error occured in creating the zip file.
IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_CreateZipFile_Failed)
#endif  // defined(OS_CHROMEOS)

// Reply when the utility process has started.
IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_ProcessStarted)

// Reply when a zip file has been analyzed for malicious download protection.
IPC_MESSAGE_CONTROL1(
    ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished,
    safe_browsing::zip_analyzer::Results)

#if defined(OS_WIN)
// Reply after parsing the iTunes preferences XML file contents with either the
// path to the iTunes directory or an empty FilePath.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_GotITunesDirectory,
                     base::FilePath /* Path to iTunes library */)
#endif  // defined(OS_WIN)

#if defined(OS_MACOSX)
// Reply after parsing the iPhoto library XML file with the parser result and
// an iphoto::Library data structure.
IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GotIPhotoLibrary,
                     bool /* Parser result */,
                     iphoto::parser::Library /* iPhoto library */)
#endif  // defined(OS_MACOSX)

#if defined(OS_WIN) || defined(OS_MACOSX)
// Reply after parsing the iTunes library XML file with the parser result and
// an itunes::Library data structure.
IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GotITunesLibrary,
                     bool /* Parser result */,
                     itunes::parser::Library /* iTunes library */)

// Reply after parsing the Picasa PMP Database with the parser result and a
// listing of the user's Picasa albums and folders, along with metadata.
IPC_MESSAGE_CONTROL3(ChromeUtilityHostMsg_ParsePicasaPMPDatabase_Finished,
                     bool /* parse_success */,
                     std::vector<picasa::AlbumInfo> /* albums */,
                     std::vector<picasa::AlbumInfo> /* folders */)

// Reply after indexing the Picasa user-created Album contents by parsing all
// the INI files in Picasa Folders.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished,
                     picasa::AlbumImagesMap /* albums_images */)
#endif  // defined(OS_WIN) || defined(OS_MACOSX)

#if !defined(OS_ANDROID) && !defined(OS_IOS)
// Reply after checking the passed media file. A true result indicates that
// the file appears to be a well formed media file.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_CheckMediaFile_Finished,
                     bool /* passed_checks */)

IPC_MESSAGE_CONTROL3(
    ChromeUtilityHostMsg_ParseMediaMetadata_Finished,
    bool /* parse_success */,
    base::DictionaryValue /* metadata */,
    std::vector<metadata::AttachedImage> /* attached_images */)

IPC_MESSAGE_CONTROL3(ChromeUtilityHostMsg_RequestBlobBytes,
                     int64 /* request_id */,
                     int64 /* start_byte */,
                     int64 /* length */)
#endif  // !defined(OS_ANDROID) && !defined(OS_IOS)

// Reply when a write or verify operation succeeds.
IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_ImageWriter_Succeeded)

// Reply when a write or verify operation has been fully cancelled.
IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_ImageWriter_Cancelled)

// Reply when a write or verify operation fails to complete.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ImageWriter_Failed,
                     std::string /* message */)

// Periodic status update about the progress of an operation.
IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ImageWriter_Progress,
                     int64 /* number of bytes processed */)

#if defined(OS_WIN)
// Get plain-text WiFi credentials from the system (requires UAC privilege
// elevation) and encrypt them with |public_key|.
IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GetAndEncryptWiFiCredentials,
                     std::string /* ssid */,
                     std::vector<uint8> /* public_key */)

// Reply after getting WiFi credentials from the system and encrypting them with
// caller's public key. |success| is false if error occurred.
IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GotEncryptedWiFiCredentials,
                     std::vector<uint8> /* encrypted_key_data */,
                     bool /* success */)
#endif  // defined(OS_WIN)


text:
public class Land {
	/* each lands have own queue*/
	protected Queue landQueue = new Queue();
	protected int noFuelPlane = 0;           // landing successfull but haven't fuel for flying. Not crash
	protected int closedTo = 1;             // land's close time for new plane landing or flying
	protected int stuckOnQueue = 0;        // plane landing time > execution time

	protected void setStatus(int closedTo){        // changes land's close time
		this.closedTo = closedTo;
	}
}


text:
package org.apache.camel.component.box;

import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Map;

import com.box.sdk.BoxAPIConnection;
import com.box.sdk.BoxAPIException;
import com.box.sdk.BoxCollaboration;
import com.box.sdk.BoxFolder;
import com.box.sdk.BoxUser;
import com.box.sdk.CreateUserParams;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.box.api.BoxCollaborationsManager;
import org.apache.camel.component.box.internal.BoxApiCollection;
import org.apache.camel.component.box.internal.BoxCollaborationsManagerApiMethod;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIf;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

/**
 * Test class for {@link BoxCollaborationsManager} APIs.
 */
@EnabledIf(value = "org.apache.camel.component.box.AbstractBoxITSupport#hasCredentials",
           disabledReason = "Box credentials were not provided")
public class BoxCollaborationsManagerIT extends AbstractBoxITSupport {

    private static final Logger LOG = LoggerFactory.getLogger(BoxCollaborationsManagerIT.class);
    private static final String PATH_PREFIX = BoxApiCollection.getCollection()
            .getApiName(BoxCollaborationsManagerApiMethod.class).getName();
    private static final String CAMEL_TEST_FOLDER = "CamelTestFolder";
    private static final String CAMEL_TEST_COLLABORATOR_EMAIL = "cameltest@example.com";
    private static final String CAMEL_TEST_COLLABORATOR_NAME = "cameltest";

    private BoxCollaboration testCollaboration;

    @Test
    public void testAddFolderCollaborationByEmail() throws Exception {
        // delete collaborator created by setupTest
        deleteTestCollaborator();

        final Map<String, Object> headers = new HashMap<>();
        // parameter type is String
        headers.put("CamelBox.folderId", testFolder.getID());
        // parameter type is String
        headers.put("CamelBox.email", CAMEL_TEST_COLLABORATOR_EMAIL);
        // parameter type is com.box.sdk.BoxCollaboration.Role
        headers.put("CamelBox.role", BoxCollaboration.Role.EDITOR);

        final com.box.sdk.BoxCollaboration result = requestBodyAndHeaders("direct://ADDFOLDERCOLLABORATIONBYEMAIL",
                testFolder.getID(), headers);

        assertNotNull(result, "addFolderCollaboration result");
        LOG.debug("addFolderCollaboration: " + result);
    }

    @Disabled //creation of app users could be used only with JWT authentication, which is not possible in this time
    @Test
    public void testAddFolderCollaboration() throws Exception {
        // delete collaborator created by setupTest
        deleteTestCollaborator();
        BoxUser user = null;
        try {
            // create test collaborator
            CreateUserParams params = new CreateUserParams();
            params.setSpaceAmount(1073741824); // 1 GB
            user = BoxUser.createAppUser(getConnection(), CAMEL_TEST_COLLABORATOR_NAME, params).getResource();

            final Map<String, Object> headers = new HashMap<>();
            // parameter type is String
            headers.put("CamelBox.folderId", testFolder.getID());
            // parameter type is String
            headers.put("CamelBox.collaborator", user);
            // parameter type is com.box.sdk.BoxCollaboration.Role
            headers.put("CamelBox.role", BoxCollaboration.Role.EDITOR);

            final com.box.sdk.BoxCollaboration result = requestBodyAndHeaders("direct://ADDFOLDERCOLLABORATION",
                    testFolder.getID(), headers);
            assertNotNull(result, "addFolderCollaboration result");
            LOG.debug("addFolderCollaboration: " + result);
        } catch (BoxAPIException e) {
            throw new RuntimeException(
                    String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
        } finally {
            if (user != null) {
                user.delete(false, true);
            }
        }
    }

    @Test
    public void testGetCollaborationInfo() throws Exception {
        // using String message body for single parameter "collaborationId"
        final com.box.sdk.BoxCollaboration.Info result = requestBody("direct://GETCOLLABORATIONINFO",
                testCollaboration.getID());

        assertNotNull(result, "getCollaborationInfo result");
        LOG.debug("getCollaborationInfo: " + result);
    }

    @Test
    public void testGetFolderCollaborations() throws Exception {
        // using String message body for single parameter "folderId"
        @SuppressWarnings("rawtypes")
        final java.util.Collection result = requestBody("direct://GETFOLDERCOLLABORATIONS", testFolder.getID());

        assertNotNull(result, "getFolderCollaborations result");
        LOG.debug("getFolderCollaborations: " + result);
    }

    @SuppressWarnings("rawtypes")
    @Test
    public void testGetPendingCollaborations() throws Exception {
        final java.util.Collection result = requestBody("direct://GETPENDINGCOLLABORATIONS", null);

        assertNotNull(result, "getPendingCollaborations result");
        LOG.debug("getPendingCollaborations: " + result);
    }

    @Test
    public void testUpdateCollaborationInfo() throws Exception {
        final Map<String, Object> headers = new HashMap<>();
        // parameter type is String
        headers.put("CamelBox.collaborationId", testCollaboration.getID());
        // parameter type is com.box.sdk.BoxCollaboration.Info

        BoxCollaboration.Info info = testCollaboration.getInfo();
        info.setRole(BoxCollaboration.Role.PREVIEWER);
        headers.put("CamelBox.info", info);

        final com.box.sdk.BoxCollaboration result = requestBodyAndHeaders("direct://UPDATECOLLABORATIONINFO", null,
                headers);

        assertNotNull(result, "updateCollaborationInfo result");
        assertNotNull(result.getInfo(), "updateCollaborationInfo info");
        assertEquals(BoxCollaboration.Role.PREVIEWER, result.getInfo().getRole(), "updateCollaborationInfo info");
        LOG.debug("updateCollaborationInfo: " + result);
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() {

                // test route for addFolderCollaboration
                from("direct://ADDFOLDERCOLLABORATIONBYEMAIL")
                        .to("box://" + PATH_PREFIX + "/addFolderCollaborationByEmail");

                // test route for addFolderCollaboration
                from("direct://ADDFOLDERCOLLABORATION").to("box://" + PATH_PREFIX + "/addFolderCollaboration");

                // test route for deleteCollaboration
                from("direct://DELETECOLLABORATION")
                        .to("box://" + PATH_PREFIX + "/deleteCollaboration?inBody=collaborationId");

                // test route for getCollaborationInfo
                from("direct://GETCOLLABORATIONINFO")
                        .to("box://" + PATH_PREFIX + "/getCollaborationInfo?inBody=collaborationId");

                // test route for getFolderCollaborations
                from("direct://GETFOLDERCOLLABORATIONS")
                        .to("box://" + PATH_PREFIX + "/getFolderCollaborations?inBody=folderId");

                // test route for getPendingCollaborations
                from("direct://GETPENDINGCOLLABORATIONS").to("box://" + PATH_PREFIX + "/getPendingCollaborations");

                // test route for updateCollaborationInfo
                from("direct://UPDATECOLLABORATIONINFO").to("box://" + PATH_PREFIX + "/updateCollaborationInfo");

            }
        };
    }

    @BeforeEach
    public void setupTest() throws Exception {
        createTestFolder();
        createTestCollaborator();
    }

    @AfterEach
    public void teardownTest() {
        deleteTestCollaborator();
        deleteTestFolder();
    }

    public BoxAPIConnection getConnection() {
        BoxEndpoint endpoint = (BoxEndpoint) context()
                .getEndpoint("box://" + PATH_PREFIX + "/addFolderCollaboration");
        return endpoint.getBoxConnection();
    }

    private void createTestFolder() throws FileNotFoundException {
        BoxFolder rootFolder = BoxFolder.getRootFolder(getConnection());
        testFolder = rootFolder.createFolder(CAMEL_TEST_FOLDER).getResource();
    }

    private void createTestCollaborator() {
        testCollaboration = testFolder.collaborate(CAMEL_TEST_COLLABORATOR_EMAIL, BoxCollaboration.Role.EDITOR)
                .getResource();
    }

    private void deleteTestCollaborator() {
        if (testCollaboration != null) {
            testCollaboration.delete();
            testCollaboration = null;
        }
    }

}


text:
package org.gufroan.wearwolf.data.pojo;

public class ResponseRoot {

    private ResponseData responseData;

    /**
     * @return The responseData
     */
    public ResponseData getResponseData() {
        return responseData;
    }
}


text:
Imports AjGenesis.Core
Imports AjGenesis.Models.DynamicModel

Class NameNode
    Inherits ExpressionNode

    Private mName As String

    Sub New(ByVal name As String)
        mName = name
    End Sub

    ReadOnly Property Name() As String
        Get
            Return mName
        End Get
    End Property

    Overrides Function Evaluate(ByVal env As Environment) As Object
        Select Case mName.ToLower
            Case "nothing"
                Return Nothing
            Case "true"
                Return True
            Case "false"
                Return False
        End Select

        Return env(mName)
    End Function

    Function EvaluateLeftValue(ByVal env As Environment) As Object
        Select Case mName.ToLower
            Case "nothing"
                Return Nothing
            Case "true"
                Return True
            Case "false"
                Return False
        End Select

        Dim result As Object = env(mName)

        If result Is Nothing Then
            result = New DynamicObject()
            env(mName) = result
        End If

        Return result
    End Function
End Class


text:
package ch.yvu.teststore.idea.plugin.model;

import ch.yvu.teststore.idea.plugin.load.LoadTask;

import javax.swing.*;
import java.awt.event.MouseEvent;

public abstract class Model<T extends Model> {

	private final String baseUrl;

	public Model(String baseUrl) {

		this.baseUrl = baseUrl;
	}

	protected String getBaseUrl() {
		return baseUrl;
	}

	public abstract Icon getIcon();

	public abstract String getText();

	public abstract LoadTask<T> loadChildrenTask();

	public abstract Runnable doubleClickAction();

	public abstract Runnable rightClickAction(MouseEvent e);
}


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

<title>Uses of Class org.deidentifier.arx.DataDefinition (ARX API Documentation)</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
org.deidentifier.arx.DataDefinition

Packages that use DataDefinition

Package
Description

org.deidentifier.arx

This package provides the public API for the ARX anonymization framework.

org.deidentifier.arx.certificate

org.deidentifier.arx.metric

This package implements several metrics for information loss.

Uses of DataDefinition in org.deidentifier.arx

Methods in org.deidentifier.arx that return DataDefinition

Modifier and Type
Method and Description

DataDefinition
DataDefinition.clone()

DataDefinition
DataHandle.getDefinition()

Returns the data definition.

DataDefinition
DataHandleInternal.getDefinition()

Method

DataDefinition
Data.getDefinition()

Returns the data definition.

Methods in org.deidentifier.arx with parameters of type DataDefinition

Modifier and Type
Method and Description

int
DataGeneralizationScheme.getGeneralizationLevel(java.lang.String attribute,
                      DataDefinition definition)

Returns a generalization level as defined by this class

void
DataDefinition.read(DataDefinition other)

Reads all settings from the given definition

Constructors in org.deidentifier.arx with parameters of type DataDefinition

Constructor and Description

ARXResult(DataHandle handle,
         DataDefinition definition,
         ARXLattice lattice,
         int historySize,
         double snapshotSizeSnapshot,
         double snapshotSizeDataset,
         Metric<?> metric,
         ARXConfiguration config,
         ARXLattice.ARXNode optimum,
         long time,
         org.deidentifier.arx.framework.lattice.SolutionSpace solutionSpace)

Internal constructor for deserialization.

Uses of DataDefinition in org.deidentifier.arx.certificate

Methods in org.deidentifier.arx.certificate with parameters of type DataDefinition

Modifier and Type
Method and Description

static ARXCertificate
ARXCertificate.create(DataHandle input,
      DataDefinition definition,
      ARXConfiguration config,
      ARXResult result,
      ARXLattice.ARXNode transformation,
      DataHandle output)

Creates a new instance

static ARXCertificate
ARXCertificate.create(DataHandle input,
      DataDefinition definition,
      ARXConfiguration config,
      ARXResult result,
      ARXLattice.ARXNode transformation,
      DataHandle output,
      CSVSyntax syntax)

Renders the document into the given output stream.

static ARXCertificate
ARXCertificate.create(DataHandle input,
      DataDefinition definition,
      ARXConfiguration config,
      ARXResult result,
      ARXLattice.ARXNode transformation,
      DataHandle output,
      CSVSyntax syntax,
      ElementData metadata)

Renders the document into the given output stream.

Uses of DataDefinition in org.deidentifier.arx.metric

Methods in org.deidentifier.arx.metric with parameters of type DataDefinition

Modifier and Type
Method and Description

void
Metric.initialize(org.deidentifier.arx.framework.data.DataManager manager,
          DataDefinition definition,
          org.deidentifier.arx.framework.data.Data input,
          org.deidentifier.arx.framework.data.GeneralizationHierarchy[] hierarchies,
          ARXConfiguration config)

Initializes the metric.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
================
playlistfromsong
================

.. image:: https://img.shields.io/pypi/v/playlistfromsong.svg
        :target: https://pypi.python.org/pypi/playlistfromsong

.. image:: https://img.shields.io/travis/schollz/playlistfromsong.svg
        :target: https://travis-ci.org/schollz/playlistfromsong

.. image:: https://readthedocs.org/projects/playlistfromsong/badge/?version=latest
        :target: https://playlistfromsong.readthedocs.io/en/latest/?badge=latest
        :alt: Documentation Status

.. image:: https://pyup.io/repos/github/schollz/playlistfromsong/shield.svg
     :target: https://pyup.io/repos/github/schollz/playlistfromsong/
     :alt: Updates

Generate an offline playlist from a single song.

Features
---------

- Similar song matching using last.fm or Spotify
- Automatic downloading of songs
- Builtin music server for webhooks

Quickstart
------------

First install `ffmpeg`_:

::

        sudo apt-get install ffmpeg    (DEBIAN)
        brew install ffmpeg            (MAC)

.. _ffmpeg: https://ffmpeg.org/download.html

Install with ``pip``::

    pip install playlistfromsong

Download a playlist of 5 songs similar to Miles Davis' *Blue In Green*::

    playlistfromsong --song 'Miles Davis Blue In Green' --num 5 -f /path/to/save

.. image:: http://i.imgur.com/ldVHZcc.gif
     :target: http://i.imgur.com/ldVHZcc.gif
     :alt: Demo1

Use a bearer token ``--bearer`` to use Spotify to find suggestions::

    playlistfromsong --song 'Miles Davis Blue In Green' --num 5 -f /path/to/save -b 'BEARER'

.. image:: http://i.imgur.com/uzEEEFh.gif
     :target: http://i.imgur.com/uzEEEFh.gif
     :alt: Demo1

For more complete usage, see the docs.


text:
class CreateSubmissionViewLogs < ActiveRecord::Migration
  def change
    create_table :submission_view_logs do |t|
      t.integer :user_id
      t.integer :submission_id

      t.timestamps
    end
  end
end


text:
package org.apereo.cas.ticket.registry.queue;

import org.apereo.cas.ticket.registry.AMQPTicketRegistry;
import org.apereo.cas.ticket.registry.queue.commands.BaseMessageQueueCommand;
import org.apereo.cas.util.PublisherIdentifier;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * This is {@link BaseTicketRegistryQueueReceiver}.
 *
 * @author Misagh Moayyed
 * @since 6.5.0
 */
@Slf4j
@RequiredArgsConstructor
@Getter
public abstract class BaseTicketRegistryQueueReceiver {
    private final AMQPTicketRegistry ticketRegistry;

    private final PublisherIdentifier ticketRegistryId;

    /**
     * Receive message from queue and execute command.
     *
     * @param command the command
     * @throws Exception the exception
     */
    public void receive(final BaseMessageQueueCommand command) throws Exception {
        LOGGER.debug("[{}] received message [{}]", ticketRegistryId, command);
        if (command.getId().equals(this.ticketRegistryId)) {
            LOGGER.trace("Ignoring inbound command on ticket registry with id [{}]", this.ticketRegistryId);
        } else {
            LOGGER.debug("Accepting message from ticket registry id [{}]. Executing command [{}]", command.getId(), command);
            command.withId(this.ticketRegistryId).execute(this.ticketRegistry);
        }
    }
}


text:
module ActiveRecord
  module Salesforce
    VERSION = "0.0.1"
  end
end


text:
import { TestBed } from '@angular/core/testing';

import { VirtualBackgroundService } from './virtual-background.service';

describe('VirtualBackgroundService', () => {
  let service: VirtualBackgroundService;

  beforeEach(() => {
    TestBed.configureTestingModule({});
    service = TestBed.inject(VirtualBackgroundService);
  });

  it('should be created', () => {
    expect(service).toBeTruthy();
  });
});


text:
var FB = require('fb');
var graph = require('fbgraph');

var User = require('../models/userModel');

var auth = function(req, res, next) {
  console.log("Log In");
  FB.api('me/', {
        fields:         'id,first_name,last_name,email,gender,picture,friends',
        limit:          250,
        access_token:   req.body.access_token
    }, function (result) {
        if(!result || result.error) {
          console.log(!res ? 'error occurred' : res.error);
            return;
        }

        var data = result;

        FB.api("/me/picture", {
                redirect: 0,
                height: 200,
                width: 200,
                type: "normal",
                access_token: req.body.access_token
            },
            function (response) {
              if(!response || response.error) {
                console.log(!res ? 'error occurred' : res.error);
                return res.status("404").send({message: response.error})
              }

                var query = User.where({fb_id: data.id});

                query.findOne(function(err, user) {
                  if(err) return next(err);

                  if(!user) {
                    var newUser = new User({
                      fb_id: data.id,
                      first_name: data.first_name,
                      last_name: data.last_name,
                      email: data.email,
                      gender: data.gender,
                      image : response.data.url
                    });

                    newUser.save(function(err, createdUser) {
                      if(err) {
                        console.log("Error: Could not save User");
                        return res.status("500").send({message: err.message});
                      }

                      return res.status("200").send(createdUser);
                    });
                  }
                  else {
                    return res.status("200").send(user);
                  }
                });
            }
        );
  });
};

var addFriend = function(req, res, next) {
  console.log("Add Friend");
  User.update({access_token: req.body.access_token},
    {
      $addToSet: {friends: req.body.friend_id},
    },
    function(err, result) {
      if(err) return next(err);
      res.status("200").send(result);
    }
  );
};

var getFriends = function(req, res, next) {
  console.log("Get Friends");
  /*FB.api('me/', {
        fields:         'friends',
        limit:          250,
        access_token:   req.params.access_token
    }, function (result) {
        if(!result || result.error) {
          console.log(!result ? 'error occurred' : result.error);
            return res.status("500").send({message : "Facebook API request did not work."});
        }

        var friends = [];

        for (var i = 0; i < result.friends.length; i++) {
          friends.push(result.friends[i].data.id);
        };

        User.find({fb_id : {$in : friends}}, function(err, friends) {
          if(err) return next(err);
          return res.status("200").send(friends);
        });
  });*/

  FB.api('me/', {
        fields:         'id,friends',
        limit:          250,
        access_token:   req.params.access_token
    }, function (facebook) {
        if(!facebook || facebook.error) {
          console.log(!facebook ? 'error occurred' : facebook.error);
            return res.status("500").send({message : "Facebook API request did not work."});
        }

        var friends = [];
        for (var i = 0; i < facebook.friends.data.length; i++) {
          friends.push(facebook.friends.data[i].id);
        };

        User.find({fb_id : {$in : friends}}, function(err, friends) {
          if(err) return next(err);
          return res.status("200").send(friends);
        });
    });
};

var getFriend = function(req, res, next) {
  console.log("Get Friend");
  User.find({access_token: req.params.access_token}, function(err, users) {
    return res.status("200").send(users);
  });
};

var helper = function(access_token) {
    FB.api('me/', {
        fields:         'id,first_name,last_name,email,gender',
        limit:          250,
        access_token:   access_token
    }, function (result) {
        if(!result || result.error) {
          console.log(!res ? 'error occurred' : res.error);
            return;
        }
        return result;
    });
}

module.exports = {'auth' : auth, 'getFriends': getFriends, 'getFriend': getFriend, "addFriend": addFriend};


text:
package com.amazonaws.services.elasticmapreduce.model;

import java.io.Serializable;
import javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;

/**
 *
 * @see AWS API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ListSecurityConfigurationsRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     *

     * The pagination token that indicates the set of results to retrieve.
     *

     */
    private String marker;

    /**
     *

     * The pagination token that indicates the set of results to retrieve.
     *

     *
     * @param marker
     *        The pagination token that indicates the set of results to retrieve.
     */

    public void setMarker(String marker) {
        this.marker = marker;
    }

    /**
     *

     * The pagination token that indicates the set of results to retrieve.
     *

     *
     * @return The pagination token that indicates the set of results to retrieve.
     */

    public String getMarker() {
        return this.marker;
    }

    /**
     *

     * The pagination token that indicates the set of results to retrieve.
     *

     *
     * @param marker
     *        The pagination token that indicates the set of results to retrieve.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ListSecurityConfigurationsRequest withMarker(String marker) {
        setMarker(marker);
        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getMarker() != null)
            sb.append("Marker: ").append(getMarker());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof ListSecurityConfigurationsRequest == false)
            return false;
        ListSecurityConfigurationsRequest other = (ListSecurityConfigurationsRequest) obj;
        if (other.getMarker() == null ^ this.getMarker() == null)
            return false;
        if (other.getMarker() != null && other.getMarker().equals(this.getMarker()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getMarker() == null) ? 0 : getMarker().hashCode());
        return hashCode;
    }

    @Override
    public ListSecurityConfigurationsRequest clone() {
        return (ListSecurityConfigurationsRequest) super.clone();
    }

}


text:
/**
 * This code currently works only for 32 bit jumps.
 *
 * @author Aleksandar Dragojevic aleksandar.dragojevic@epfl.ch
 */

#ifndef WLPDSTM_ICC_JMP_H_
#define WLPDSTM_ICC_JMP_H_

#include <itm.h>
#include <stdint.h>

typedef struct begin_transaction_jmpbuf {
	uint32_t ebx;
	uint32_t esp;
	uint32_t ebp;
	uint32_t esi;
	uint32_t edi;
	uint32_t ret_addr;
} my_jmpbuf;

#ifdef __cplusplus
extern "C" {
#endif
//_ITM_CALL_CONVENTION int _ITM_beginTransaction(begin_transaction_jmpbuf *td, uint32 __properties, const _ITM_srcLocation *__src);
_ITM_CALL_CONVENTION void jmp_to_begin_transaction(begin_transaction_jmpbuf *td);
#ifdef __cplusplus
}
#endif

#endif /* WLPDSTM_ICC_JMP_H_ */


text:
"""Support for Google Assistant Smart Home API."""
from asyncio import gather
from collections.abc import Mapping
from itertools import product
import logging

from homeassistant.util.decorator import Registry

from homeassistant.core import callback
from homeassistant.const import (
    CLOUD_NEVER_EXPOSED_ENTITIES, CONF_NAME, STATE_UNAVAILABLE,
    ATTR_SUPPORTED_FEATURES, ATTR_ENTITY_ID,
)
from homeassistant.components import (
    climate,
    cover,
    fan,
    group,
    input_boolean,
    light,
    lock,
    media_player,
    scene,
    script,
    switch,
    vacuum,
)

from . import trait
from .const import (
    TYPE_LIGHT, TYPE_LOCK, TYPE_SCENE, TYPE_SWITCH, TYPE_VACUUM,
    TYPE_THERMOSTAT, TYPE_FAN,
    CONF_ALIASES, CONF_ROOM_HINT,
    ERR_FUNCTION_NOT_SUPPORTED, ERR_PROTOCOL_ERROR, ERR_DEVICE_OFFLINE,
    ERR_UNKNOWN_ERROR,
    EVENT_COMMAND_RECEIVED, EVENT_SYNC_RECEIVED, EVENT_QUERY_RECEIVED
)
from .helpers import SmartHomeError

HANDLERS = Registry()
_LOGGER = logging.getLogger(__name__)

DOMAIN_TO_GOOGLE_TYPES = {
    climate.DOMAIN: TYPE_THERMOSTAT,
    cover.DOMAIN: TYPE_SWITCH,
    fan.DOMAIN: TYPE_FAN,
    group.DOMAIN: TYPE_SWITCH,
    input_boolean.DOMAIN: TYPE_SWITCH,
    light.DOMAIN: TYPE_LIGHT,
    lock.DOMAIN: TYPE_LOCK,
    media_player.DOMAIN: TYPE_SWITCH,
    scene.DOMAIN: TYPE_SCENE,
    script.DOMAIN: TYPE_SCENE,
    switch.DOMAIN: TYPE_SWITCH,
    vacuum.DOMAIN: TYPE_VACUUM,
}

def deep_update(target, source):
    """Update a nested dictionary with another nested dictionary."""
    for key, value in source.items():
        if isinstance(value, Mapping):
            target[key] = deep_update(target.get(key, {}), value)
        else:
            target[key] = value
    return target

class _GoogleEntity:
    """Adaptation of Entity expressed in Google's terms."""

    def __init__(self, hass, config, state):
        self.hass = hass
        self.config = config
        self.state = state

    @property
    def entity_id(self):
        """Return entity ID."""
        return self.state.entity_id

    @callback
    def traits(self):
        """Return traits for entity."""
        state = self.state
        domain = state.domain
        features = state.attributes.get(ATTR_SUPPORTED_FEATURES, 0)

        return [Trait(self.hass, state, self.config) for Trait in trait.TRAITS
                if Trait.supported(domain, features)]

    async def sync_serialize(self):
        """Serialize entity for a SYNC response.

        https://developers.google.com/actions/smarthome/create-app#actiondevicessync
        """
        state = self.state

        # When a state is unavailable, the attributes that describe
        # capabilities will be stripped. For example, a light entity will miss
        # the min/max mireds. Therefore they will be excluded from a sync.
        if state.state == STATE_UNAVAILABLE:
            return None

        entity_config = self.config.entity_config.get(state.entity_id, {})
        name = (entity_config.get(CONF_NAME) or state.name).strip()

        # If an empty string
        if not name:
            return None

        traits = self.traits()

        # Found no supported traits for this entity
        if not traits:
            return None

        device = {
            'id': state.entity_id,
            'name': {
                'name': name
            },
            'attributes': {},
            'traits': [trait.name for trait in traits],
            'willReportState': False,
            'type': DOMAIN_TO_GOOGLE_TYPES[state.domain],
        }

        # use aliases
        aliases = entity_config.get(CONF_ALIASES)
        if aliases:
            device['name']['nicknames'] = aliases

        for trt in traits:
            device['attributes'].update(trt.sync_attributes())

        room = entity_config.get(CONF_ROOM_HINT)
        if room:
            device['roomHint'] = room
            return device

        dev_reg, ent_reg, area_reg = await gather(
            self.hass.helpers.device_registry.async_get_registry(),
            self.hass.helpers.entity_registry.async_get_registry(),
            self.hass.helpers.area_registry.async_get_registry(),
        )

        entity_entry = ent_reg.async_get(state.entity_id)
        if not (entity_entry and entity_entry.device_id):
            return device

        device_entry = dev_reg.devices.get(entity_entry.device_id)
        if not (device_entry and device_entry.area_id):
            return device

        area_entry = area_reg.areas.get(device_entry.area_id)
        if area_entry and area_entry.name:
            device['roomHint'] = area_entry.name

        return device

    @callback
    def query_serialize(self):
        """Serialize entity for a QUERY response.

        https://developers.google.com/actions/smarthome/create-app#actiondevicesquery
        """
        state = self.state

        if state.state == STATE_UNAVAILABLE:
            return {'online': False}

        attrs = {'online': True}

        for trt in self.traits():
            deep_update(attrs, trt.query_attributes())

        return attrs

    async def execute(self, command, params):
        """Execute a command.

        https://developers.google.com/actions/smarthome/create-app#actiondevicesexecute
        """
        executed = False
        for trt in self.traits():
            if trt.can_execute(command, params):
                await trt.execute(command, params)
                executed = True
                break

        if not executed:
            raise SmartHomeError(
                ERR_FUNCTION_NOT_SUPPORTED,
                'Unable to execute {} for {}'.format(command,
                                                     self.state.entity_id))

    @callback
    def async_update(self):
        """Update the entity with latest info from Home Assistant."""
        self.state = self.hass.states.get(self.entity_id)

async def async_handle_message(hass, config, message):
    """Handle incoming API messages."""
    response = await _process(hass, config, message)

    if response and 'errorCode' in response['payload']:
        _LOGGER.error('Error handling message %s: %s',
                      message, response['payload'])

    return response

async def _process(hass, config, message):
    """Process a message."""
    request_id = message.get('requestId')  # type: str
    inputs = message.get('inputs')  # type: list

    if len(inputs) != 1:
        return {
            'requestId': request_id,
            'payload': {'errorCode': ERR_PROTOCOL_ERROR}
        }

    handler = HANDLERS.get(inputs[0].get('intent'))

    if handler is None:
        return {
            'requestId': request_id,
            'payload': {'errorCode': ERR_PROTOCOL_ERROR}
        }

    try:
        result = await handler(hass, config, request_id,
                               inputs[0].get('payload'))
    except SmartHomeError as err:
        return {
            'requestId': request_id,
            'payload': {'errorCode': err.code}
        }
    except Exception:  # pylint: disable=broad-except
        _LOGGER.exception('Unexpected error')
        return {
            'requestId': request_id,
            'payload': {'errorCode': ERR_UNKNOWN_ERROR}
        }

    if result is None:
        return None
    return {'requestId': request_id, 'payload': result}

@HANDLERS.register('action.devices.SYNC')
async def async_devices_sync(hass, config, request_id, payload):
    """Handle action.devices.SYNC request.

    https://developers.google.com/actions/smarthome/create-app#actiondevicessync
    """
    hass.bus.async_fire(EVENT_SYNC_RECEIVED, {
        'request_id': request_id
    })

    devices = []
    for state in hass.states.async_all():
        if state.entity_id in CLOUD_NEVER_EXPOSED_ENTITIES:
            continue

        if not config.should_expose(state):
            continue

        entity = _GoogleEntity(hass, config, state)
        serialized = await entity.sync_serialize()

        if serialized is None:
            _LOGGER.debug("No mapping for %s domain", entity.state)
            continue

        devices.append(serialized)

    response = {
        'agentUserId': config.agent_user_id,
        'devices': devices,
    }

    return response

@HANDLERS.register('action.devices.QUERY')
async def async_devices_query(hass, config, request_id, payload):
    """Handle action.devices.QUERY request.

    https://developers.google.com/actions/smarthome/create-app#actiondevicesquery
    """
    devices = {}
    for device in payload.get('devices', []):
        devid = device['id']
        state = hass.states.get(devid)

        hass.bus.async_fire(EVENT_QUERY_RECEIVED, {
            'request_id': request_id,
            ATTR_ENTITY_ID: devid,
        })

        if not state:
            # If we can't find a state, the device is offline
            devices[devid] = {'online': False}
            continue

        devices[devid] = _GoogleEntity(hass, config, state).query_serialize()

    return {'devices': devices}

@HANDLERS.register('action.devices.EXECUTE')
async def handle_devices_execute(hass, config, request_id, payload):
    """Handle action.devices.EXECUTE request.

    https://developers.google.com/actions/smarthome/create-app#actiondevicesexecute
    """
    entities = {}
    results = {}

    for command in payload['commands']:
        for device, execution in product(command['devices'],
                                         command['execution']):
            entity_id = device['id']

            hass.bus.async_fire(EVENT_COMMAND_RECEIVED, {
                'request_id': request_id,
                ATTR_ENTITY_ID: entity_id,
                'execution': execution
            })

            # Happens if error occurred. Skip entity for further processing
            if entity_id in results:
                continue

            if entity_id not in entities:
                state = hass.states.get(entity_id)

                if state is None:
                    results[entity_id] = {
                        'ids': [entity_id],
                        'status': 'ERROR',
                        'errorCode': ERR_DEVICE_OFFLINE
                    }
                    continue

                entities[entity_id] = _GoogleEntity(hass, config, state)

            try:
                await entities[entity_id].execute(execution['command'],
                                                  execution.get('params', {}))
            except SmartHomeError as err:
                results[entity_id] = {
                    'ids': [entity_id],
                    'status': 'ERROR',
                    'errorCode': err.code
                }

    final_results = list(results.values())

    for entity in entities.values():
        if entity.entity_id in results:
            continue

        entity.async_update()

        final_results.append({
            'ids': [entity.entity_id],
            'status': 'SUCCESS',
            'states': entity.query_serialize(),
        })

    return {'commands': final_results}

@HANDLERS.register('action.devices.DISCONNECT')
async def async_devices_disconnect(hass, config, request_id, payload):
    """Handle action.devices.DISCONNECT request.

    https://developers.google.com/actions/smarthome/create#actiondevicesdisconnect
    """
    return None

def turned_off_response(message):
    """Return a device turned off response."""
    return {
        'requestId': message.get('requestId'),
        'payload': {'errorCode': 'deviceTurnedOff'}
    }


text:
package com.firebase.ui.storage.images;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;

import com.bumptech.glide.Priority;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.load.Options;
import com.bumptech.glide.load.data.DataFetcher;
import com.bumptech.glide.load.model.ModelLoader;
import com.bumptech.glide.load.model.ModelLoaderFactory;
import com.bumptech.glide.load.model.MultiModelLoaderFactory;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.StreamDownloadTask;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.security.MessageDigest;

/**
 * ModelLoader implementation to download images from FirebaseStorage with Glide.
 *
 *

 * First, register this class in your AppGlideModule:
 *

 *         {@literal @}Override
 *         public void registerComponents(Context context, Registry registry) {
 *             // Register FirebaseImageLoader to handle StorageReference
 *             registry.append(StorageReference.class, InputStream.class,
 *                     new FirebaseImageLoader.Factory());
 *         }
 *

 *
 *

 * Then load a StorageReference into an ImageView.
 *

 *     StorageReference ref = FirebaseStorage.getInstance().getReference().child("myimage");
 *     ImageView iv = (ImageView) findViewById(R.id.my_image_view);
 *
 *     GlideApp.with(this)
 *         .load(ref)
 *         .into(iv);
 *

 */
public class FirebaseImageLoader implements ModelLoader<StorageReference, InputStream> {

    private static final String TAG = "FirebaseImageLoader";

    /**
     * Factory to create {@link FirebaseImageLoader}.
     */
    public static class Factory implements ModelLoaderFactory<StorageReference, InputStream> {

        @Override
        public ModelLoader<StorageReference, InputStream> build(MultiModelLoaderFactory factory) {
            return new FirebaseImageLoader();
        }

        @Override
        public void teardown() {
            // No-op
        }
    }

    @Nullable
    @Override
    public LoadData<InputStream> buildLoadData(StorageReference reference,
                                               int height,
                                               int width,
                                               Options options) {
        return new LoadData<>(
                new FirebaseStorageKey(reference),
                new FirebaseStorageFetcher(reference));
    }

    @Override
    public boolean handles(StorageReference reference) {
        return true;
    }

    private static class FirebaseStorageKey implements Key {

        private StorageReference mRef;

        public FirebaseStorageKey(StorageReference ref) {
            mRef = ref;
        }

        @Override
        public void updateDiskCacheKey(MessageDigest digest) {
            digest.update(mRef.getPath().getBytes(Charset.defaultCharset()));
        }
    }

    private static class FirebaseStorageFetcher implements DataFetcher<InputStream> {

        private StorageReference mRef;
        private StreamDownloadTask mStreamTask;
        private InputStream mInputStream;

        public FirebaseStorageFetcher(StorageReference ref) {
            mRef = ref;
        }

        @Override
        public void loadData(Priority priority,
                             final DataCallback<? super InputStream> callback) {
            mStreamTask = mRef.getStream();
            mStreamTask
                    .addOnSuccessListener(new OnSuccessListener<StreamDownloadTask.TaskSnapshot>() {
                        @Override
                        public void onSuccess(StreamDownloadTask.TaskSnapshot snapshot) {
                            mInputStream = snapshot.getStream();
                            callback.onDataReady(mInputStream);
                        }
                    })
                    .addOnFailureListener(new OnFailureListener() {
                        @Override
                        public void onFailure(@NonNull Exception e) {
                            callback.onLoadFailed(e);
                        }
                    });
        }

        @Override
        public void cleanup() {
            // Close stream if possible
            if (mInputStream != null) {
                try {
                    mInputStream.close();
                    mInputStream = null;
                } catch (IOException e) {
                    Log.w(TAG, "Could not close stream", e);
                }
            }
        }

        @Override
        public void cancel() {
            // Cancel task if possible
            if (mStreamTask != null && mStreamTask.isInProgress()) {
                mStreamTask.cancel();
            }
        }

        @Override
        public Class<InputStream> getDataClass() {
            return InputStream.class;
        }

        @Override
        public DataSource getDataSource() {
            return DataSource.REMOTE;
        }
    }
}


text:
class User < ApplicationRecord
  has_many :posts, dependent: :destroy
  has_many :comments, dependent: :destroy #toggle this?
  validates :username, presence: true, length: { within: 4..20, :too_long => "Username must be between 4 and 20 characters", :too_short => "Username must be between 4 and 20 characters" }
  validates :first_name, :last_name, presence: true, length: { maximum: 100 }
  validates :password, presence: true, length: { within: 6..20 }
  validates :email, presence: true,
                    length: { maximum: 255 },
                    format: { with: /\A[\w+\-.]+@[a-z\d\-.]+(\.[a-z\d\-]+)+\z/i },
                    uniqueness: { case_sensitive: false }

  before_save :downcase_email

  has_secure_password

  private

  def downcase_email
  	self.email = self.email.downcase
  end
end


text:
BackOffice.OfficeTab = {

    description: [],

    init: function (id) {
        var hlp = BackOffice.OfficeHelper;
        var me =  BackOffice.OfficeTab;
        if (null != id) {
            hlp.setOfficeId(id);
        }
        hlp.getOfficeId();
        hlp.getTabEl().click(me._clickTab);
    },

    describe: function (fn) {
        BackOffice.OfficeTab.description.push(fn);
    },
    /**
     * @private
     */
    _clickTab: function () {
        var hlp = BackOffice.OfficeHelper;
        var me =  BackOffice.OfficeTab;
        var officeId = $(this).attr('office-id');
        hlp.setOfficeId(officeId);
        if (me.description.length == 0) {
            return;
        }
        for (var i=0; i<me.description.length; i++) {
            me.description[i](officeId);
        }
    }

};


text:
"""memorised module - container for the memorise python-memcache decorator"""
__author__ = 'Wes Mason <wes [at] 1stvamp [dot] org>'
__docformat__ = 'restructuredtext en'
__version__ = '1.0.1'

import memcache
from hashlib import md5
import inspect

def uncache(fn, mc=None, mc_servers=None, parent_keys=[]):
        if not mc:
                if not mc_servers:
                        mc_servers = ['localhost:11211']
                mc = memcache.Client(mc_servers, debug=0)
        def wrapper(*args, **kwargs):
                argnames = fn.func_code.co_varnames[:fn.func_code.co_argcount]
                method = False
                static = False
                if hasattr(fn, 'im_self'):
                        method = True
                        if inspect.isclass(fn.im_self):
                                static = True

                arg_values_hash = []
                # Grab all the keyworded and non-keyworded arguements so
                # that we can use them in the hashed memcache key
                for i,v in (zip(argnames, args) + kwargs.items()):
                        arg_values_hash.append("%s=%s" % (i,v))

                class_name = None
                if method:
                        keys = []
                        if len(parent_keys) > 0:
                                for key in parent_keys:
                                        keys.append("%s=%s" % (key, getattr(fn.im_self, key)))
                        keys = ','.join(keys)
                        # Get the class name from the self argument
                        if inspect.isclass(fn.im_self):
                                class_name = fn.im_self.__name__
                        else:
                                class_name = fn.im_self.__class__.__name__
                        module_name = inspect.getmodule(fn.im_self).__name__
                        parent_name = "%s.%s[%s]::" % (module_name, class_name, keys)
                else:
                        # Function passed in, use the module name as the
                        # parent
                        parent_name = inspect.getmodule(fn).__name__
                # Create a unique hash of the function/method call
                key = "%s%s(%s)" % (parent_name, fn.__name__, ",".join(arg_values_hash))
                key = md5(key).hexdigest()

                if mc:
                        mc.delete(key)
                        return True
                else:
                        return False
        return wrapper


text:
package org.codehaus.mojo.keytool.requests;

import org.apache.maven.shared.utils.cli.javatool.JavaToolResult;

import java.io.File;

/**
 * Test the {@link org.codehaus.mojo.keytool.requests.KeyToolPrintCRLFileRequest}.
 *
 * @author tchemit
 * @since 1.1
 */
public abstract class AbstractKeyToolPrintCRLFileRequestIT
    extends AbstractKeyToolRequestIT<KeyToolPrintCRLFileRequest>
{

    /**
     *
Constructor for AbstractKeyToolPrintCRLFileRequestIT.

     */
    protected AbstractKeyToolPrintCRLFileRequestIT()
    {
    }

    /**
     *
Constructor for AbstractKeyToolPrintCRLFileRequestIT.

     *
     * @param supportedRequest a boolean
     */
    protected AbstractKeyToolPrintCRLFileRequestIT( boolean supportedRequest )
    {
        super( supportedRequest );
    }

    /** {@inheritDoc} */
    @Override
    public final void testRequest()
        throws Exception
    {

        File file = resourceFixtures.simpleCertificate();

        KeyToolPrintCRLFileRequest request = requestFixtures.createKeyToolPrintCRLFileRequest( file );

        JavaToolResult keyToolResult = consumeRequest( request );

        requestResult( keyToolResult, file );
    }

    /**
     *
requestResult.

     *
     * @param keyToolResult a {@link org.apache.maven.shared.utils.cli.javatool.JavaToolResult} object
     * @param file a {@link java.io.File} object
     */
    protected abstract void requestResult( JavaToolResult keyToolResult, File file );

}


text:
package common.tree;

import java.util.Arrays;

public class FindClosestInBST {

	public static void main(String[] args){

		final int n = 20;
		Integer[] arr = Util.generateRandomArray(n);
		Arrays.sort(arr);
		Node<Integer> treeFromArray = ConvertToBST.array2bst(arr);

		Integer[] resultArr = new Integer[n * 4 + 2];

		System.out.println(Arrays.toString(arr));

		for(int i = 0; i < resultArr.length; i ++){
			System.out.format("Looking for %d, Found: %d\n", i, findClosest(treeFromArray, i));
		}

	}

	public static Integer findClosest(Node<Integer> tree, Integer target){

		assert(tree != null);

		if(tree.data == target){
			return tree.data;
		}

		int result = tree.data;
		int result2 = 0;
		boolean result2Valid = false;

		if(tree.data > target && tree.left != null){

			result2 = findClosest(tree.left, target);
			result2Valid = true;

		} else if(tree.data < target && tree.right != null){

			result2 = findClosest(tree.right, target);
			result2Valid = true;
		}

		if(result2Valid && Math.abs(result2 - target) < Math.abs(result - target)){
			result = result2;
		}

		return result;
	}

}


text:
package com.appdynamics.demo.gasp.utils;

import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Context;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.support.v4.app.FragmentActivity;
import android.util.Log;

import com.appdynamics.demo.gasp.fragment.LocationFragment;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;

public class LocationServices {
    private static final String TAG = LocationServices.class.getName();

    /**
     * Enable location checking (via LocationFragment)
     * @param context the application context
     */
    public static void enableLocationChecking(FragmentActivity context) {
        try {
            if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS) {

                // Check current location
                Location location = LocationFragment.getLocation(context);
                if (location != null) {
                    Log.d(TAG, "Location: " + String.format("%.6f", location.getLatitude())
                            + ", " + String.format("%.6f", location.getLongitude())
                            + " (via " + location.getProvider() + ")" + '\n');
                }

                // Add LocationFragment to enable location updates
                FragmentManager fm = context.getFragmentManager();
                FragmentTransaction ft = fm.beginTransaction();
                LocationFragment locationFragment = new LocationFragment();
                ft.add(locationFragment, "LocationFragment");
                ft.commit();
            }
            else
                Log.e(TAG, "Google Play Services not available");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * Set Location Services and get current location
     */
    public static Location getLocation(Context context) {
        Location location = null;
        try {
            String svcName = Context.LOCATION_SERVICE;
            LocationManager locationManager = (LocationManager) context.getSystemService(svcName);

            Criteria criteria = new Criteria();
            criteria.setAccuracy(Criteria.ACCURACY_FINE);
            criteria.setPowerRequirement(Criteria.POWER_LOW);
            criteria.setAltitudeRequired(false);
            criteria.setBearingRequired(false);
            criteria.setSpeedRequired(false);
            criteria.setCostAllowed(true);
            String provider = locationManager.getBestProvider(criteria, true);
            location = locationManager.getLastKnownLocation(provider);

            Log.i(TAG, "Current Latitude = " + location.getLatitude());
            Log.i(TAG, "Current Longitude = " + location.getLongitude());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return location;
    }
}


text:
#region Using Statements
using System;
using System.Collections.ObjectModel;

using Cake.Core;
using Cake.Core.IO;
using Cake.Core.Annotations;

using System.Management.Automation;
#endregion

namespace Cake.Powershell
{
    /// <summary>
    /// Contains Cake aliases for running Powershell commands.
    /// </summary>
    [CakeAliasCategory("Powershell")]
    [CakeNamespaceImport("System.Management.Automation")]
    public static class PowershellAliases
    {
        #region Methods
        /// <summary>
        /// Starts a powershell script using the specified information.
        /// </summary>
        /// <param name="context">The cake context.</param>
        /// <param name="script">The powershell script to run.</param>
        /// <returns>A collection of powershell objects</returns>
        [CakeMethodAlias]
        public static Collection<PSObject> StartPowershellScript(this ICakeContext context, string script)
        {
            return new PowershellRunner(context).Start(script, new PowershellSettings());
        }

        /// <summary>
        /// Starts a powershell script using the specified information.
        /// </summary>
        /// <param name="context">The cake context.</param>
        /// <param name="script">The powershell script to run.</param>
        /// <param name="arguments">The arguments to append.</param>
        /// <returns>A collection of powershell objects</returns>
        [CakeMethodAlias]
        public static Collection<PSObject> StartPowershellScript(this ICakeContext context, string script, Action<ProcessArgumentBuilder> arguments)
        {
            return new PowershellRunner(context).Start(script, new PowershellSettings().WithArguments(arguments));
        }

        /// <summary>
        /// Starts a powershell script using the specified information.
        /// </summary>
        /// <param name="context">The cake context.</param>
        /// <param name="script">The powershell script to run.</param>
        /// <param name="settings">The information about the script to start.</param>
        /// <returns>A collection of powershell objects</returns>
        [CakeMethodAlias]
        public static Collection<PSObject> StartPowershellScript(this ICakeContext context, string script, PowershellSettings settings)
        {
            return new PowershellRunner(context).Start(script, settings);
        }

        /// <summary>
        /// Starts a powershell script using the specified information.
        /// </summary>
        /// <param name="context">The cake context.</param>
        /// <param name="path">The path of the script file to run.</param>
        /// <returns>A collection of powershell objects</returns>
        [CakeMethodAlias]
        public static Collection<PSObject> StartPowershellFile(this ICakeContext context, FilePath path)
        {
            return new PowershellRunner(context.Environment, context.Log).Start(path, new PowershellSettings());
        }

        /// <summary>
        /// Starts a powershell script using the specified information.
        /// </summary>
        /// <param name="context">The cake context.</param>
        /// <param name="path">The path of the script file to run.</param>
        /// <param name="arguments">The arguments to append.</param>
        /// <returns>A collection of powershell objects</returns>
        [CakeMethodAlias]
        public static Collection<PSObject> StartPowershellFile(this ICakeContext context, FilePath path, Action<ProcessArgumentBuilder> arguments)
        {
            return new PowershellRunner(context.Environment, context.Log).Start(path, new PowershellSettings().WithArguments(arguments));
        }

        /// <summary>
        /// Starts a powershell script using the specified information.
        /// </summary>
        /// <param name="context">The cake context.</param>
        /// <param name="path">The path of the script file to run.</param>
        /// <param name="settings">The information about the script to start.</param>
        /// <returns>A collection of powershell objects</returns>
        [CakeMethodAlias]
        public static Collection<PSObject> StartPowershellFile(this ICakeContext context, FilePath path, PowershellSettings settings)
        {
            return new PowershellRunner(context.Environment, context.Log).Start(path, settings);
        }

        /// <summary>
        /// Starts a powershell script using the specified information.
        /// </summary>
        /// <param name="context">The cake context.</param>
        /// <param name="uri">The location of the script file to download and run.</param>
        /// <param name="path">The temporary path to download the file to.</param>
        /// <returns>A collection of powershell objects</returns>
        [CakeMethodAlias]
        public static Collection<PSObject> StartPowershellDownload(this ICakeContext context, Uri uri, FilePath path)
        {
            return new PowershellRunner(context.Environment, context.Log).Start(uri, path, new PowershellSettings());
        }

        /// <summary>
        /// Starts a powershell script using the specified information.
        /// </summary>
        /// <param name="context">The cake context.</param>
        /// <param name="uri">The location of the script file to download and run.</param>
        /// <param name="path">The temporary path to download the file to.</param>
        /// <param name="arguments">The arguments to append.</param>
        /// <returns>A collection of powershell objects</returns>
        [CakeMethodAlias]
        public static Collection<PSObject> StartPowershellDownload(this ICakeContext context, Uri uri, FilePath path, Action<ProcessArgumentBuilder> arguments)
        {
            return new PowershellRunner(context.Environment, context.Log).Start(uri, path, new PowershellSettings().WithArguments(arguments));
        }

        /// <summary>
        /// Starts a powershell script using the specified information.
        /// </summary>
        /// <param name="context">The cake context.</param>
        /// <param name="uri">The location of the script file to download and run.</param>
        /// <param name="path">The temporary path to download the file to.</param>
        /// <param name="settings">The information about the script to start.</param>
        /// <returns>A collection of powershell objects</returns>
        [CakeMethodAlias]
        public static Collection<PSObject> StartPowershellDownload(this ICakeContext context, Uri uri, FilePath path, PowershellSettings settings)
        {
            return new PowershellRunner(context.Environment, context.Log).Start(uri, path, settings);
        }
        #endregion
    }
}


text:
Version 2.0.16 by Volodymyr Volynets

	<time class="change_log_date_commit" datetime="2019-01-14">2019-01-14</time>

Users

	Enhancement #1172 (Added tags.)

Repository / Git:
	Name: Numbers\Users
	Title: Users Repository
	Version: 2.0.15
	Last Tag: 2.0.15
	User Name: Volodymyr Volynets
	User Email: volodymyr.volynets@gmail.com
Statistics:
	Addition: 558
	Deletion: 0
Modules:
	O/N Organization Management (Numbers\Users\Organizations, 1.0.8)                          |   118    0
		   78    0	 | Organizations/Data/System2.php
		   13    0	 | Organizations/Form/Collection/Location/Collection.php
		   13    0	 | Organizations/Form/Collection/Organization/Collection.php
		    7    0	 | Organizations/Model/Locations.php
		    7    0	 | Organizations/Model/Organizations.php
	U/M User Management (Numbers\Users\Users, 1.0.14)                                         |    59    0
		   39    0	 | Users/Data/System2.php
		   13    0	 | Users/Form/Collection/Users/Collection.php
		    7    0	 | Users/Model/Users.php
	Tags Widget (Numbers\Users\Widgets\Tags, 1.0.0)                                           |   381    0
		  178    0	 | Widgets/Tags/Form/List2/Tags.php
		   51    0	 | Widgets/Tags/Model/Tags.php
		  122    0	 | Widgets/Tags/Model/Virtual/Tags.php
		   12    0	 | Widgets/Tags/Override/ACL/Resources.php
		   18    0	 | Widgets/Tags/module.ini