text:
module Fastlane
  module Actions
    module SharedValues
    end

    class CheckAppStoreMetadataAction < Action
      def self.run(config)
        require 'precheck'
        Precheck.config = config
        Precheck.config[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
        return Precheck::Runner.new.run
      end

      def self.description
        "Check your app's metadata before you submit your app to review (via _precheck_)"
      end

      def self.details
        "More information: https://fastlane.tools/precheck"
      end

      def self.available_options
        require 'precheck/options'
        Precheck::Options.available_options
      end

      def self.return_value
        return "true if precheck passes, else, false"
      end

      def self.authors
        ["taquitos"]
      end

      def self.is_supported?(platform)
        platform == :ios
      end

      def self.example_code
        [
          'check_app_store_metadata(
            negative_apple_sentiment: [level: :skip], # Set to skip to not run the `negative_apple_sentiment` rule
            curse_words: [level: :warn] # Set to warn to only warn on curse word check failures
          )',
          'precheck   # alias for "check_app_store_metadata"'
        ]
      end

      def self.category
        :app_store_connect
      end
    end
  end
end


text:
package com.hp.security.jauth.core.util;

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

import javax.servlet.ServletOutputStream;
import javax.servlet.ServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hp.security.jauth.core.exception.AuthException;

import freemarker.template.TemplateException;

@Service
public class ExceptionUtil {

	private FreemarkerUtil freemarkerUtil;

	@Autowired
	public void setFreemarkerUtil(FreemarkerUtil freemarkerUtil) {
		this.freemarkerUtil = freemarkerUtil;
	}

	public void throwDefaultTemplate(ServletResponse response, Exception ex) {
		Map<String, Object> root = new HashMap<String, Object>();
		String code = "";
		if(null != ex && ex instanceof AuthException) {
			AuthException aex = (AuthException)ex;
			code = aex.getCode();
		}
		root.put("code", code);
		root.put("ex", ex);
		String view;
		ServletOutputStream out = null;
		try {
			view = freemarkerUtil.buildView(root, "exception");
			response.setContentType("text/html");
			out = response.getOutputStream();
			out.write(view.getBytes());
			out.flush();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (TemplateException e) {
			e.printStackTrace();
		} finally {
			if(null != out) {
				try {
					out.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}

	}

}

redpajama_set_name: RedPajamaGithub


text:
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::higher::FormatExpn;
use clippy_utils::source::{snippet_opt, snippet_with_applicability};
use clippy_utils::sugg::Sugg;
use if_chain::if_chain;
use rustc_errors::Applicability;
use rustc_hir::{Expr, ExprKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty;
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::symbol::kw;
use rustc_span::{sym, Span};

declare_clippy_lint! {
    /// ### What it does
    /// Checks for the use of `format!("string literal with no
    /// argument")` and `format!("{}", foo)` where `foo` is a string.
    ///
    /// ### Why is this bad?
    /// There is no point of doing that. `format!("foo")` can
    /// be replaced by `"foo".to_owned()` if you really need a `String`. The even
    /// worse `&format!("foo")` is often encountered in the wild. `format!("{}",
    /// foo)` can be replaced by `foo.clone()` if `foo: String` or `foo.to_owned()`
    /// if `foo: &str`.
    ///
    /// ### Examples
    /// ```rust
    ///
    /// // Bad
    /// let foo = "foo";
    /// format!("{}", foo);
    ///
    /// // Good
    /// foo.to_owned();
    /// ```
    pub USELESS_FORMAT,
    complexity,
    "useless use of `format!`"
}

declare_lint_pass!(UselessFormat => [USELESS_FORMAT]);

impl<'tcx> LateLintPass<'tcx> for UselessFormat {
    fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
        let FormatExpn { call_site, format_args } = match FormatExpn::parse(expr) {
            Some(e) if !e.call_site.from_expansion() => e,
            _ => return,
        };

        let mut applicability = Applicability::MachineApplicable;
        if format_args.value_args.is_empty() {
            if format_args.format_string_parts.is_empty() {
                span_useless_format_empty(cx, call_site, "String::new()".to_owned(), applicability);
            } else {
                if_chain! {
                    if let [e] = &*format_args.format_string_parts;
                    if let ExprKind::Lit(lit) = &e.kind;
                    if let Some(s_src) = snippet_opt(cx, lit.span);
                    then {
                        // Simulate macro expansion, converting {{ and }} to { and }.
                        let s_expand = s_src.replace("{{", "{").replace("}}", "}");
                        let sugg = format!("{}.to_string()", s_expand);
                        span_useless_format(cx, call_site, sugg, applicability);
                    }
                }
            }
        } else if let [value] = *format_args.value_args {
            if_chain! {
                if format_args.format_string_symbols == [kw::Empty];
                if match cx.typeck_results().expr_ty(value).peel_refs().kind() {
                    ty::Adt(adt, _) => cx.tcx.is_diagnostic_item(sym::String, adt.did),
                    ty::Str => true,
                    _ => false,
                };
                if let Some(args) = format_args.args();
                if args.iter().all(|arg| arg.is_display() && !arg.has_string_formatting());
                then {
                    let is_new_string = match value.kind {
                        ExprKind::Binary(..) => true,
                        ExprKind::MethodCall(path, ..) => path.ident.name.as_str() == "to_string",
                        _ => false,
                    };
                    let sugg = if is_new_string {
                        snippet_with_applicability(cx, value.span, "..", &mut applicability).into_owned()
                    } else {
                        let sugg = Sugg::hir_with_applicability(cx, value, "<arg>", &mut applicability);
                        format!("{}.to_string()", sugg.maybe_par())
                    };
                    span_useless_format(cx, call_site, sugg, applicability);
                }
            }
        };
    }
}

fn span_useless_format_empty(cx: &LateContext<'_>, span: Span, sugg: String, applicability: Applicability) {
    span_lint_and_sugg(
        cx,
        USELESS_FORMAT,
        span,
        "useless use of `format!`",
        "consider using `String::new()`",
        sugg,
        applicability,
    );
}

fn span_useless_format(cx: &LateContext<'_>, span: Span, sugg: String, applicability: Applicability) {
    span_lint_and_sugg(
        cx,
        USELESS_FORMAT,
        span,
        "useless use of `format!`",
        "consider using `.to_string()`",
        sugg,
        applicability,
    );
}


text:
package main

import (
	"flag"
	"fmt"
	"io/fs"
	"io/ioutil"
	"os"
	"path"

	"gate.computer/gate/include"
)

var resources = map[string]interface {
	fs.ReadDirFS
	fs.ReadFileFS
}{
	"include": include.FS,
}

func main() {
	flag.Usage = func() {
		out := flag.CommandLine.Output()
		fmt.Fprintf(out, "Usage: %s [options] filename...\n", flag.CommandLine.Name())

		fmt.Fprintf(out, "\nFilenames:\n")

		for resdir, resfs := range resources {
			list, err := resfs.ReadDir(".")
			if err != nil {
				panic(err)
			}

			for _, f := range list {
				fmt.Fprintf(out, "  %s\n", path.Join(resdir, f.Name()))
			}
		}

		fmt.Fprintf(out, "\nOptions:\n")
		flag.PrintDefaults()
	}

	dir := flag.String("d", "", "write files to directory instead of stdout")
	flag.Parse()
	if flag.NArg() == 0 {
		flag.Usage()
		os.Exit(2)
	}

	if err := Main(*dir, flag.Args()); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
}

func Main(outdir string, filenames []string) error {
	for _, filename := range filenames {
		resdir, name := path.Split(filename)
		resdir = path.Join(resdir, ".") // Remove separator at end.

		resfs := resources[resdir]
		if resfs == nil {
			return fmt.Errorf("%s: %w", filename, fs.ErrNotExist)
		}

		data, err := resfs.ReadFile(name)
		if err != nil {
			return fmt.Errorf("%s: %w", resdir, err)
		}

		if outdir != "" {
			os.MkdirAll(outdir, 0o755)

			outname := path.Join(outdir, name)
			if err := ioutil.WriteFile(outname, data, 0o644); err != nil {
				os.Remove(outname)
				return err
			}
		} else {
			if _, err := os.Stdout.Write(data); err != nil {
				return err
			}
		}
	}

	return nil
}


text:
	<!-- Latest jQuery Bootstrap JavaScript -->
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js">
    </script>
    <!-- Latest compiled and minified Bootstrap JavaScript -->
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
	{% if page.title == "Search" %}
	<!-- add lunr JS for search -->
	<script src="/assets/js/lunr.min.js"></script>
	<script src="/assets/js/search.js"></script>
	{% endif %}
	<!--Adobe DTM Footer code-->
	<script type="text/javascript">_satellite.pageBottom();</script>


text:
package org.commcare.utils;

/**
 * Signals the expiration of the session created on login that controls
 * liveness of user database and key pool.
 *
 * @author ctsims
 */
public class SessionUnavailableException extends RuntimeException {
    public SessionUnavailableException() {
        super();
    }

    public SessionUnavailableException(String message) {
        super(message);
    }
}


text:
<?php

namespace Aop\JoinPoint;

/**
 * Provides an abstraction layer of `JoinPoint` of kind
 * `\Aop\KindConstantInterface::KIND_AFTER_METHOD_RETURN` handled by the interceptor.
 *
 * @see \Aop\KindConstantInterface::KIND_AFTER_METHOD_RETURN
 *
 * @author Nicolas Tallefourtane <dev@nicolab.net>
 */
class AfterMethodReturnJoinPoint extends AfterJoinPoint implements
    Support\MethodSupportInterface,
    Support\ClassSupportInterface,
    Support\ArgsGetterSupportInterface,
    Support\ReturnValueGetterSupportInterface,
    Support\ReturnValueSetterSupportInterface
{
    use
        Traits\MethodTrait,
        Traits\ClassTrait,
        Traits\ArgsGetterTrait,
        Traits\ReturnValueGetterTrait,
        Traits\ReturnValueSetterTrait
    ;

    /**
     * @inheritdoc
     * @see \Aop\JoinPoint\Support\KindSupportInterface::getKind()
     */
    public function getKind()
    {
        return \Aop\KindConstantInterface::KIND_AFTER_METHOD_RETURN;
    }
}


text:
var chai = require('chai');
var should = chai.should();

var paymayaSdk = require("./../../../lib/paymaya/PaymayaSDK");
var Customization = require("./../../../lib/paymaya/api/Customization");

describe('Customization', function() {

	var customization;

	var customizationOptions = {
		logoUrl: "https://cdn.paymaya.com/production/checkout_api/customization_example/yourlogo.svg",
		iconUrl: "https://cdn.paymaya.com/production/checkout_api/customization_example/youricon.ico",
		appleTouchIconUrl: "https://cdn.paymaya.com/production/checkout_api/customization_example/youricon_ios.ico",
		customTitle: "Checkout Page Title",
		colorScheme: "#368d5c"
	};

	before(function(done) {
		paymayaSdk.initCheckout("pk-iaioBC2pbY6d3BVRSebsJxghSHeJDW4n6navI7tYdrN", "sk-uh4ZFfx9i0rZpKN6CxJ826nVgJ4saGGVAH9Hk7WrY6Q", paymayaSdk.ENVIRONMENT.SANDBOX);

		customization = new Customization();
		customization.logoUrl = customizationOptions.logoUrl;
		customization.iconUrl = customizationOptions.iconUrl;
		customization.appleTouchIconUrl = customizationOptions.appleTouchIconUrl;
		customization.customTitle = customizationOptions.customTitle;
		customization.colorScheme = customizationOptions.colorScheme;
		done();
	});

	it('should have logoUrl property', function(done) {
		customization.should.have.property('logoUrl');
		done();
	});

	it('should have iconUrl property', function(done) {
		customization.should.have.property('iconUrl');
		done();
	});

	it('should have appleTouchIconUrl property', function(done) {
		customization.should.have.property('appleTouchIconUrl');
		done();
	});

	it('should have customTitle property', function(done) {
		customization.should.have.property('customTitle');
		done();
	});

	it('should have colorScheme property', function(done) {
		customization.should.have.property('colorScheme');
		done();
	});

	it('should return correct logoUrl value', function(done) {
		customization.logoUrl.should.equal(customizationOptions.logoUrl);
		done();
	});

	it('should return correct iconUrl value', function(done) {
		customization.iconUrl.should.equal(customizationOptions.iconUrl);
		done();
	});

	it('should return correct appleTouchIconUrl value', function(done) {
		customization.appleTouchIconUrl.should.equal(customizationOptions.appleTouchIconUrl);
		done();
	});

	it('should return correct customTitle value', function(done) {
		customization.customTitle.should.equal(customizationOptions.customTitle);
		done();
	});

	it('should return correct logocolorSchemeUrl value', function(done) {
		customization.colorScheme.should.equal(customizationOptions.colorScheme);
		done();
	});

	it('should execute set customization successfully', function(done) {
		var callback = function(err, response) {
			should.not.exist(err);
  			should.exist(response);
  			response.should.have.property('logoUrl');
  			response.should.have.property('iconUrl');
  			response.should.have.property('appleTouchIconUrl');
  			response.should.have.property('customTitle');
  			response.should.have.property('colorScheme');
  			done();
		}
		customization.set(callback);
	});

	it('should execute get customization successfully', function(done) {
		var callback = function(err, response) {
			should.not.exist(err);
  			should.exist(response);
  			response.should.have.property('logoUrl');
  			response.should.have.property('iconUrl');
  			response.should.have.property('appleTouchIconUrl');
  			response.should.have.property('customTitle');
  			response.should.have.property('colorScheme');
  			done();
		}
		customization.get(callback);
	});

	it('should execute remove customization successfully', function(done) {
		var callback = function(err, response) {
			should.not.exist(err);
  			should.exist(response);
  			response.should.have.property('message');
  			done();
		}
		customization.remove(callback);
	});
});


text:
package com.kolor.docker

package object api {

  import com.kolor.docker.api.entities._
  import com.kolor.docker.api.json.Formats._

  implicit val dockerJsonFormats = com.kolor.docker.api.json.Formats

  sealed trait DockerAttachable { }

  case object Stdin extends DockerAttachable
  case object Stdout extends DockerAttachable
  case object Stderr extends DockerAttachable
}


text:
"""Script to replicate experiments in https://arxiv.org/abs/1911.06679."""

from absl import app
from absl import flags

from utils import utils_impl

FLAGS = flags.FLAGS

def main(argv):
  if len(argv) > 1:
    raise app.UsageError('Too many command-line arguments.')

  target = 'gans/experiments/emnist:train'
  executable = 'bazel run {} --'.format(target)

  grid_iter = utils_impl.iter_grid({
      'filtering': ['by_user'],
      'invert_imagery_probability': ['0p0', '0p5'],
      'accuracy_threshold': ['lt0p882', 'gt0p939'],
      'num_client_disc_train_steps': [6],
      'num_server_gen_train_steps': [6],
      'num_clients_per_round': [10],
      'num_rounds': [1000],
      'use_dp': [True],
      'dp_l2_norm_clip': [0.1],
      'dp_noise_multiplier': [0.01],
      'num_rounds_per_eval': [10],
      'num_rounds_per_save_images': [10]
  })

  utils_impl.launch_experiment(
      executable,
      grid_iter,
      root_output_dir='/tmp/exp',
      short_names={
          'filtering': 'filt',
          'invert_imagery_probability': 'inv_lik',
          'accuracy_threshold': 'acc',
          'num_client_disc_train_steps': 'n_disc',
          'num_server_gen_train_steps': 'n_gen',
          'dp_l2_norm_clip': 'dp_clip',
          'dp_noise_multiplier': 'dp_noise',
          'num_rounds_per_eval': 'n_rds_eval',
          'num_rounds_per_save_images': 'n_rds_images'
      },
      max_workers=1)
  print('Experiments launched.')

if __name__ == '__main__':
  app.run(main)


text:
"use strict";
var Torrent = (function () {
    function Torrent() {
    }
    return Torrent;
}());
exports.Torrent = Torrent;
//# sourceMappingURL=torrent.js.map


text:
import updateClientMetaInfo from '../client/updateClientMetaInfo'
import { updateAttribute } from '../client/updaters'
import { metaInfoAttributeKeys } from '../shared/constants'
import { getTag, removeElementsByAppId } from '../utils/elements'

let appsMetaInfo

export function addApp (rootVm, appId, options) {
  return {
    set: metaInfo => setMetaInfo(rootVm, appId, options, metaInfo),
    remove: () => removeMetaInfo(rootVm, appId, options)
  }
}

export function setMetaInfo (rootVm, appId, options, metaInfo) {
  // if a vm exists _and_ its mounted then immediately update
  if (rootVm && rootVm.$el) {
    return updateClientMetaInfo(appId, options, metaInfo)
  }

  // store for later, the info
  // will be set on the first refresh
  appsMetaInfo = appsMetaInfo || {}
  appsMetaInfo[appId] = metaInfo
}

export function removeMetaInfo (rootVm, appId, options) {
  if (rootVm && rootVm.$el) {
    const tags = {}
    for (const type of metaInfoAttributeKeys) {
      const tagName = type.substr(0, 4)
      updateAttribute(appId, options, type, {}, getTag(tags, tagName))
    }

    return removeElementsByAppId(options, appId)
  }

  if (appsMetaInfo[appId]) {
    delete appsMetaInfo[appId]
    clearAppsMetaInfo()
  }
}

export function getAppsMetaInfo () {
  return appsMetaInfo
}

export function clearAppsMetaInfo (force) {
  if (force || !Object.keys(appsMetaInfo).length) {
    appsMetaInfo = undefined
  }
}


text:
package com.cin.linyuehlii.nobile;

import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;

import java.io.Serializable;

public class Member implements Serializable, Parcelable { // // 格視為圖片-字串-字串
    private int id;
    private int image;
    private String packageName;
    private int seekBarProgress = 60;
    private String name;
    private String time;

    public Member(Parcel source) {
        id = source.readInt();
        image = source.readInt();
        packageName = source.readString();
        name = source.readString();
        time = source.readString();
    }

    public Member(String name, String score) {
        this(0, 0, name, score, "NoName");
    }

    public Member(int id, int image, String name, String time) {
        this(id, image, name, time, "NoName");
    }

    public Member(int id, int image, String name, String time, String packageName) {
        super();
        this.id = id;
        this.image = image;
        this.name = name;
        this.time = time;
        this.packageName = packageName;
    }

    public int getImage() {
        return image;
    }

    public void setImage(int image) {
        this.image = image;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public int getId() {
        return id;
    }

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

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public void setSeekBarProgress(int progress) {
        seekBarProgress = progress;
    }

    public int getSeekBarProgress() {
        return seekBarProgress;
    }

    public long getTimeInMilliSecond() {
        return (long) seekBarProgress * 60 * 1000;
    }

    /*******************************
     * 實作Parcelabel自動產生的方法
     *********************/
    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        Log.d("writeToParcel", "writeToParcel");
        dest.writeInt(id);
        dest.writeInt(image);
        dest.writeString(name);
        dest.writeString(time);
        dest.writeString(packageName);
    }

    /*******************************
     * 實作Parcelabel自動產生的方法
     *********************/

    public static final Parcelable.Creator<Member> CREATOR = new Parcelable.Creator<Member>() {

        /*******************************
         * 實作Parcelabel的CREATOR
         *********************/

        @Override
        public Member createFromParcel(Parcel source) {
            return new Member(source);
        }

        @Override
        public Member[] newArray(int size) {
            return new Member[size];
        }
    };

    /*******************************實作Parcelabel的CREATOR*********************/
}


text:
using System;
using Azure.Core;

namespace Azure.ResourceManager.ContainerService.Models
{
    /// <summary> Information about a service principal identity for the cluster to use for manipulating Azure APIs. </summary>
    public partial class ManagedClusterServicePrincipalProfile
    {
        /// <summary> Initializes a new instance of ManagedClusterServicePrincipalProfile. </summary>
        /// <param name="clientId"> The ID for the service principal. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="clientId"/> is null. </exception>
        public ManagedClusterServicePrincipalProfile(string clientId)
        {
            Argument.AssertNotNull(clientId, nameof(clientId));

            ClientId = clientId;
        }

        /// <summary> Initializes a new instance of ManagedClusterServicePrincipalProfile. </summary>
        /// <param name="clientId"> The ID for the service principal. </param>
        /// <param name="secret"> The secret password associated with the service principal in plain text. </param>
        internal ManagedClusterServicePrincipalProfile(string clientId, string secret)
        {
            ClientId = clientId;
            Secret = secret;
        }

        /// <summary> The ID for the service principal. </summary>
        public string ClientId { get; set; }
        /// <summary> The secret password associated with the service principal in plain text. </summary>
        public string Secret { get; set; }
    }
}


text:
// Copyright 2014 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.

#include "chrome/browser/chromeos/file_system_provider/notification_manager.h"

#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/app_icon_loader_impl.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
#include "chrome/grit/generated_resources.h"
#include "components/signin/core/account_id/account_id.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/notification.h"
#include "ui/message_center/notification_delegate.h"
#include "ui/message_center/notification_types.h"
#include "ui/message_center/notifier_settings.h"

namespace chromeos {
namespace file_system_provider {
namespace {

// Extension icon size for the notification.
const int kIconSize = 48;

// Forwards notification events to the notification manager.
class ProviderNotificationDelegate
    : public message_center::NotificationDelegate {
 public:
  // Passing a raw pointer is safe here, since the life of each notification is
  // shorter than life of the |notification_manager|.
  explicit ProviderNotificationDelegate(
      NotificationManager* notification_manager)
      : notification_manager_(notification_manager) {}

  void ButtonClick(int button_index) override {
    notification_manager_->OnButtonClick(button_index);
  }

  void Close(bool by_user) override { notification_manager_->OnClose(); }

 private:
  ~ProviderNotificationDelegate() override {}
  NotificationManager* notification_manager_;  // Not owned.

  DISALLOW_COPY_AND_ASSIGN(ProviderNotificationDelegate);
};

}  // namespace

NotificationManager::NotificationManager(
    Profile* profile,
    const ProvidedFileSystemInfo& file_system_info)
    : profile_(profile),
      file_system_info_(file_system_info),
      icon_loader_(
          new extensions::AppIconLoaderImpl(profile, kIconSize, this)) {
}

NotificationManager::~NotificationManager() {
  if (callbacks_.size()) {
    g_browser_process->message_center()->RemoveNotification(
        file_system_info_.mount_path().value(), false /* by_user */);
  }
}

void NotificationManager::ShowUnresponsiveNotification(
    int id,
    const NotificationCallback& callback) {
  callbacks_[id] = callback;

  if (callbacks_.size() == 1) {
    g_browser_process->message_center()->AddNotification(CreateNotification());
  } else {
    g_browser_process->message_center()->UpdateNotification(
        file_system_info_.mount_path().value(), CreateNotification());
  }
}

void NotificationManager::HideUnresponsiveNotification(int id) {
  callbacks_.erase(id);

  if (callbacks_.size()) {
    g_browser_process->message_center()->UpdateNotification(
        file_system_info_.mount_path().value(), CreateNotification());
    return;
  }

  g_browser_process->message_center()->RemoveNotification(
      file_system_info_.mount_path().value(), false /* by_user */);
}

void NotificationManager::OnButtonClick(int button_index) {
  OnNotificationResult(ABORT);
}

void NotificationManager::OnClose() {
  OnNotificationResult(CONTINUE);
}

void NotificationManager::SetAppImage(const std::string& id,
                                      const gfx::ImageSkia& image) {
  extension_icon_.reset(new gfx::Image(image));
  g_browser_process->message_center()->UpdateNotification(
      file_system_info_.mount_path().value(), CreateNotification());
}

scoped_ptr<message_center::Notification>
NotificationManager::CreateNotification() {
  if (!extension_icon_.get())
    icon_loader_->FetchImage(file_system_info_.extension_id());

  message_center::RichNotificationData rich_notification_data;
  rich_notification_data.buttons.push_back(
      message_center::ButtonInfo(l10n_util::GetStringUTF16(
          IDS_FILE_SYSTEM_PROVIDER_UNRESPONSIVE_ABORT_BUTTON)));

  message_center::NotifierId notifier_id(
      message_center::NotifierId::SYSTEM_COMPONENT,
      file_system_info_.mount_path().value());
  notifier_id.profile_id =
      multi_user_util::GetAccountIdFromProfile(profile_).GetUserEmail();

  scoped_ptr<message_center::Notification> notification(
      new message_center::Notification(
          message_center::NOTIFICATION_TYPE_SIMPLE,
          file_system_info_.mount_path().value(),
          base::UTF8ToUTF16(file_system_info_.display_name()),
          l10n_util::GetStringUTF16(
              callbacks_.size() == 1
                  ? IDS_FILE_SYSTEM_PROVIDER_UNRESPONSIVE_WARNING
                  : IDS_FILE_SYSTEM_PROVIDER_MANY_UNRESPONSIVE_WARNING),
          extension_icon_.get() ? *extension_icon_.get() : gfx::Image(),
          base::string16(),  // display_source
          GURL(), notifier_id, rich_notification_data,
          new ProviderNotificationDelegate(this)));

  notification->SetSystemPriority();
  return notification.Pass();
}

void NotificationManager::OnNotificationResult(NotificationResult result) {
  CallbackMap::iterator it = callbacks_.begin();
  while (it != callbacks_.end()) {
    CallbackMap::iterator current_it = it++;
    NotificationCallback callback = current_it->second;
    callbacks_.erase(current_it);
    callback.Run(result);
  }
}

}  // namespace file_system_provider
}  // namespace chromeos


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

<TITLE>
Date (Apache Ant API)
</TITLE>

<META NAME="date" CONTENT="2014-04-29">

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

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.apache.tools.ant.types.resources.selectors

Class Date

java.lang.Object
  org.apache.tools.ant.types.resources.selectors.Date

All Implemented Interfaces:
ResourceSelector

public class Date
extends java.lang.Object
implements ResourceSelector

Date ResourceSelector.  Based on the date FileSelector, with the most
 notable difference being the lack of support for the includedirs attribute.
 It is recommended that the effect of includeDirs = "false" be achieved for
 resources by enclosing a "dir" Type ResourceSelector and a Date
 ResourceSelector in an Or ResourceSelector.

Since:

Ant 1.7

Constructor Summary

Date()

Method Summary

 java.lang.String
getDatetime()

          Get the date & time in String format.

 long
getGranularity()

          Get the timestamp granularity used by this ResourceSelector.

 long
getMillis()

          Get the date/time in ms.

 java.lang.String
getPattern()

          Get the pattern for use with the datetime attribute.

 TimeComparison
getWhen()

          Get the comparison mode.

 boolean
isSelected(Resource r)

          Return true if this Resource is selected.

 void
setDateTime(java.lang.String s)

          Set the date and time as a String.

 void
setGranularity(long g)

          Set the granularity to use for this ResourceSelector.

 void
setMillis(long m)

          Set the date/time in milliseconds since 1970.

 void
setPattern(java.lang.String p)

          Set the optional pattern to use with the datetime attribute.

 void
setWhen(TimeComparison c)

          Set the comparison mode.

Methods inherited from class java.lang.Object

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

Constructor Detail

Date

public Date()

Method Detail

setMillis

public void setMillis(long m)

Set the date/time in milliseconds since 1970.

Parameters:
m - the number of millis.

getMillis

public long getMillis()

Get the date/time in ms.

Returns:
long number of millis since 1970.

setDateTime

public void setDateTime(java.lang.String s)

Set the date and time as a String.

Parameters:
s - the date & time to use.

getDatetime

public java.lang.String getDatetime()

Get the date & time in String format.

Returns:
a String representing a date & time.

setGranularity

public void setGranularity(long g)

Set the granularity to use for this ResourceSelector.

Parameters:
g - the timestamp granularity.

getGranularity

public long getGranularity()

Get the timestamp granularity used by this ResourceSelector.

Returns:
the long granularity.

setPattern

public void setPattern(java.lang.String p)

Set the optional pattern to use with the datetime attribute.

Parameters:
p - the SimpleDateFormat-compatible pattern string.

getPattern

public java.lang.String getPattern()

Get the pattern for use with the datetime attribute.

Returns:
a SimpleDateFormat-compatible pattern string.

setWhen

public void setWhen(TimeComparison c)

Set the comparison mode.

Parameters:
c - a TimeComparison object.

getWhen

public TimeComparison getWhen()

Get the comparison mode.

Returns:
a TimeComparison object.

isSelected

public boolean isSelected(Resource r)

Return true if this Resource is selected.

Specified by:
isSelected in interface ResourceSelector

Parameters:
r - the Resource to check.

Returns:
whether the Resource was selected.

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
int main(int argc, char** argv) {
// Silence death test thread warnings on Linux. We can afford to run our death
// tests a little more slowly (< 10 ms per death test on a Z620).
// On android, we need to run in the default mode, as the threadsafe mode
// relies on execve which is not available.
#if !defined(OS_ANDROID)
  testing::GTEST_FLAG(death_test_style) = "threadsafe";
#endif
  mojo::edk::Init();
  base::TestSuite test_suite(argc, argv);
  // TODO(use_chrome_edk): temporary to force new EDK.
  base::CommandLine::ForCurrentProcess()->AppendSwitch("--use-new-edk");

  return base::LaunchUnitTests(
      argc, argv,
      base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite)));
}


text:
package main

import (
	"context"
	"fmt"

	"github.com/google/go-github/github"
	"github.com/y0k0ta19/go-theta/theta"
)

func main() {
	cc := github.NewClient(nil)
	cc.NewRequest("", "", nil)
	c := theta.NewClient(nil)
	ctx, cancel := context.WithCancel(context.Background())
	err := theta.Begin(ctx, c)
	if err != nil {
		fmt.Println(err)
	}
	cancel()
}


text:
package hyperbahn

// Event describes different events that Client can trigger.
type Event int

const (
	// UnknownEvent should never be used.
	UnknownEvent Event = iota
	// SendAdvertise is triggered when the Hyperbahn client tries to advertise.
	SendAdvertise
	// Advertised is triggered when the initial advertisement for a service is successful.
	Advertised
	// Readvertised is triggered on periodic advertisements.
	Readvertised
)

//go:generate stringer -type=Event

// Handler is the interface for handling Hyperbahn events and errors.
type Handler interface {
	// On is called when events are triggered.
	On(event Event)
	// OnError is called when an error is detected.
	OnError(err error)
}

// nullHandler is the default Handler if nil is passed, so handlers can always be called.
type nullHandler struct{}

func (nullHandler) On(event Event)    {}
func (nullHandler) OnError(err error) {}


text:
<?php

declare(strict_types=1);

namespace WoohooLabs\Yin\Tests\JsonApi\Schema\Pagination;

use PHPUnit\Framework\TestCase;
use WoohooLabs\Yin\Tests\JsonApi\Double\StubFixedCursorBasedPaginationProvider;

class FixedCursorBasedPaginationProviderTraitTest extends TestCase
{
    /**
     * @test
     */
    public function getSelfLinkWhenCurrentItemIsNull(): void
    {
        $provider = $this->createProvider(0, 0, null, 0, 0);

        $link = $provider->getSelfLink("https://example.com/api/users?", "");

        $this->assertNull($link);
    }

    /**
     * @test
     */
    public function getSelfLinkWhenOnlyPathProvided(): void
    {
        $provider = $this->createProvider(0, 0, 2, 0, 0);

        $link = $provider->getSelfLink("https://example.com/api/users", "");
        $href = $link !== null ? $link->getHref() : "";

        $this->assertEquals("https://example.com/api/users?page%5Bcursor%5D=2", $href);
    }

    /**
     * @test
     */
    public function getSelfLinkWhenQueryStringSeparatorIsProvided(): void
    {
        $provider = $this->createProvider(0, 0, 2, 0, 0);

        $link = $provider->getSelfLink("https://example.com/api/users?", "");
        $href = $link !== null ? $link->getHref() : "";

        $this->assertEquals("https://example.com/api/users?page%5Bcursor%5D=2", $href);
    }

    /**
     * @test
     */
    public function getSelfLinkWhenQueryStringIsProvided(): void
    {
        $provider = $this->createProvider(0, 0, 2, 0, 0);

        $link = $provider->getSelfLink("https://example.com/api/users?a=b", "");
        $href = $link !== null ? $link->getHref() : "";

        $this->assertEquals("https://example.com/api/users?a=b&page%5Bcursor%5D=2", $href);
    }

    /**
     * @test
     */
    public function getSelfLinkWhenPathAndAdditionalQueryStringIsProvided(): void
    {
        $provider = $this->createProvider(0, 0, 2, 0, 0);

        $link = $provider->getSelfLink("https://example.com/api/users?a=b", "a=c&b=d");
        $href = $link !== null ? $link->getHref() : "";

        $this->assertEquals("https://example.com/api/users?a=c&b=d&page%5Bcursor%5D=2", $href);
    }

    /**
     * @test
     */
    public function getSelfLinkWhenPathAndAdditionalPaginationQueryStringIsProvided(): void
    {
        $provider = $this->createProvider(0, 0, 2, 0, 0);

        $link = $provider->getSelfLink("https://example.com/api/users", "page[cursor]=0");
        $href = $link !== null ? $link->getHref() : "";

        $this->assertEquals("https://example.com/api/users?page%5Bcursor%5D=2", $href);
    }

    /**
     * @test
     */
    public function getFirstLinkWhenFirstItemIsNull(): void
    {
        $provider = $this->createProvider(null, 0, 0, 0, 0);

        $link = $provider->getFirstLink("https://example.com/api/users?", "");

        $this->assertNull($link);
    }

    /**
     * @test
     */
    public function getFirstLink(): void
    {
        $provider = $this->createProvider(0, 0, 0, 0, 0);

        $link = $provider->getFirstLink("https://example.com/api/users", "");
        $href = $link !== null ? $link->getHref() : "";

        $this->assertEquals("https://example.com/api/users?page%5Bcursor%5D=0", $href);
    }

    /**
     * @test
     */
    public function getLastLinkWhenLastItemIsNull(): void
    {
        $provider = $this->createProvider(0, null, 0, 0, 0);

        $link = $provider->getLastLink("https://example.com/api/users", "");

        $this->assertNull($link);
    }

    /**
     * @test
     */
    public function getLastLink(): void
    {
        $provider = $this->createProvider(0, 4, 0, 0, 0);

        $link = $provider->getLastLink("https://example.com/api/users", "");
        $href = $link !== null ? $link->getHref() : "";

        $this->assertEquals("https://example.com/api/users?page%5Bcursor%5D=4", $href);
    }

    /**
     * @test
     */
    public function getPrevLink(): void
    {
        $provider = $this->createProvider(0, 0, 0, 2, 0);

        $link = $provider->getPrevLink("https://example.com/api/users", "");
        $href = $link !== null ? $link->getHref() : "";

        $this->assertEquals("https://example.com/api/users?page%5Bcursor%5D=2", $href);
    }

    /**
     * @test
     */
    public function getNextLink(): void
    {
        $provider = $this->createProvider(0, 0, 0, 0, 3);

        $link = $provider->getNextLink("https://example.com/api/users", "");
        $href = $link !== null ? $link->getHref() : "";

        $this->assertEquals("https://example.com/api/users?page%5Bcursor%5D=3", $href);
    }

    /**
     * @param mixed $firstItem
     * @param mixed $lastItem
     * @param mixed $currentItem
     * @param mixed $previousItem
     * @param mixed $nextItem
     */
    private function createProvider(
        $firstItem,
        $lastItem,
        $currentItem,
        $previousItem,
        $nextItem
    ): StubFixedCursorBasedPaginationProvider {
        return new StubFixedCursorBasedPaginationProvider($firstItem, $lastItem, $currentItem, $previousItem, $nextItem);
    }
}


text:
<?php
session_start(); // this MUST be called prior to any output including whitespaces and line breaks!

$GLOBALS['ct_recipient']   = 'YOU@EXAMPLE.COM'; // Change to your email address!
$GLOBALS['ct_msg_subject'] = 'Securimage Test Contact Form';

$GLOBALS['DEBUG_MODE'] = 1;
// CHANGE TO 0 TO TURN OFF DEBUG MODE
// IN DEBUG MODE, ONLY THE CAPTCHA CODE IS VALIDATED, AND NO EMAIL IS SENT

// Process the form, if it was submitted
process_si_contact_form();

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

    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    <title>Securimage Example Form</title>

<fieldset>
<legend>Example Form</legend>

  This is an example PHP form that processes user information, checks for errors, and validates the captcha code.

  This example form also demonstrates how to submit a form to itself to display error messages.

Your message has been sent!
We will contact you as soon as possible.

<form method="post" action="" id="contact_form" onsubmit="return processForm()">
  <input type="hidden" name="do" value="contact" />

    Name*:

    <input type="text" name="ct_name" size="35" value="" />

    Email*:

    <input type="text" name="ct_email" size="35" value="" />

    URL:

    <input type="text" name="ct_URL" size="35" value="" />

    Message*:

    <textarea name="ct_message" rows="12" cols="60"></textarea>

    <img id="siimage" style="border: 1px solid #000; margin-right: 15px" src="./securimage_show.php?sid=<?php echo md5(uniqid()) ?>" alt="CAPTCHA Image" align="left" />
    <object type="application/x-shockwave-flash" data="./securimage_play.swf?bgcol=#ffffff&icon_file=./images/audio_icon.png&audio_file=./securimage_play.php" height="32" width="32">
    <param name="movie" value="./securimage_play.swf?bgcol=#ffffff&icon_file=./images/audio_icon.png&audio_file=./securimage_play.php" />
    </object>

    Enter Code*:

    <input type="text" name="ct_captcha" size="12" maxlength="8" />

    <input type="submit" value="Submit Message" />

</form>
</fieldset>

<?php

// The form processor PHP code
function process_si_contact_form()
{
    if ($_SERVER['REQUEST_METHOD'] == 'POST' && @$_POST['do'] == 'contact') {
        // if the form has been submitted

        foreach($_POST as $key => $value) {
            if (!is_array($key)) {
                // sanitize the input data
                if ($key != 'ct_message') $value = strip_tags($value);
                $_POST[$key] = htmlspecialchars(stripslashes(trim($value)));
            }
        }

        $name    = @$_POST['ct_name'];    // name from the form
        $email   = @$_POST['ct_email'];   // email from the form
        $URL     = @$_POST['ct_URL'];     // url from the form
        $message = @$_POST['ct_message']; // the message from the form
        $captcha = @$_POST['ct_captcha']; // the user's entry for the captcha code
        $name    = substr($name, 0, 64);  // limit name to 64 characters

        $errors = array();  // initialize empty error array

        if (isset($GLOBALS['DEBUG_MODE']) && $GLOBALS['DEBUG_MODE'] == false) {
            // only check for errors if the form is not in debug mode

            if (strlen($name) < 3) {
                // name too short, add error
                $errors['name_error'] = 'Your name is required';
            }

            if (strlen($email) == 0) {
                // no email address given
                $errors['email_error'] = 'Email address is required';
            } else if ( !preg_match('/^(?:[\w\d]+\.?)+@(?:(?:[\w\d]\-?)+\.)+\w{2,4}$/i', $email)) {
                // invalid email format
                $errors['email_error'] = 'Email address entered is invalid';
            }

            if (strlen($message) < 20) {
                // message length too short
                $errors['message_error'] = 'Please enter a message';
            }
        }

        // Only try to validate the captcha if the form has no errors
        // This is especially important for ajax calls
        if (sizeof($errors) == 0) {
            require_once dirname(__FILE__) . '/securimage.php';
            $securimage = new Securimage();

            if ($securimage->check($captcha) == false) {
                $errors['captcha_error'] = 'Incorrect security code entered';
            }
        }

        if (sizeof($errors) == 0) {
            // no errors, send the form
            $time       = date('r');
            $message = "A message was submitted from the contact form.  The following information was provided.

"
                     . "Name: $name
"
                     . "Email: $email
"
                     . "URL: $URL
"
                     . "Message:
"
                     . "
$message
"
                     . "

IP Address: {$_SERVER['REMOTE_ADDR']}
"
                     . "Time: $time
"
                     . "Browser: {$_SERVER['HTTP_USER_AGENT']}
";

            if (isset($GLOBALS['DEBUG_MODE']) && $GLOBALS['DEBUG_MODE'] == false) {
                // send the message with mail()
                mail($GLOBALS['ct_recipient'], $GLOBALS['ct_msg_subject'], $message, "From: {$GLOBALS['ct_recipient']}\r\nReply-To: {$email}\r\nContent-type: text/html; charset=ISO-8859-1\r\nMIME-Version: 1.0");
            }

            $return = array('error' => 0, 'message' => 'OK');
            die(json_encode($return));
        } else {
            $errmsg = '';
            foreach($errors as $key => $error) {
                // set up error messages to display with each field
                $errmsg .= " - {$error}\n";
            }

            $return = array('error' => 1, 'message' => $errmsg);
            die(json_encode($return));
        }
    } // POST
} // function process_si_contact_form()


text:
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright 2020 Google LLC
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="@dimen/menu_item_width"
    android:layout_height="@dimen/menu_item_height"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:gravity="center"
    android:background="@color/gray_dark"
    android:textColor="@color/screen_white" />


text:
class InitializeVariables : public TIntermTraverser
{
  public:
    struct InitVariableInfo
    {
        TString name;
        TType type;

        InitVariableInfo(const TString &_name, const TType &_type)
            : name(_name),
              type(_type)
        {
        }
    };
    typedef TVector<InitVariableInfo> InitVariableInfoList;

    InitializeVariables(const InitVariableInfoList &vars)
        : TIntermTraverser(true, false, false),
          mVariables(vars),
          mCodeInserted(false)
    {
    }

  protected:
    bool visitBinary(Visit, TIntermBinary *node) override { return false; }
    bool visitUnary(Visit, TIntermUnary *node) override { return false; }
    bool visitSelection(Visit, TIntermSelection *node) override { return false; }
    bool visitLoop(Visit, TIntermLoop *node) override { return false; }
    bool visitBranch(Visit, TIntermBranch *node) override { return false; }

    bool visitAggregate(Visit visit, TIntermAggregate *node) override;

  private:
    void insertInitCode(TIntermSequence *sequence);

    InitVariableInfoList mVariables;
    bool mCodeInserted;
};

#endif  // COMPILER_TRANSLATOR_INITIALIZEVARIABLES_H_


text:
#ifndef APR_RESLIST_H
#define APR_RESLIST_H

/**
 * @file apr_reslist.h
 * @brief APR-UTIL Resource List Routines
 */

#include "apr.h"
#include "apu.h"
#include "apr_pools.h"
#include "apr_errno.h"
#include "apr_time.h"

#if APR_HAS_THREADS

/**
 * @defgroup APR_Util_RL Resource List Routines
 * @ingroup APR_Util
 * @{
 * @warning
 * Resource list data types and routines are only available when
 * threads are enabled (i.e. APR_HAS_THREADS is not zero).
 */

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/** Opaque resource list object */
typedef struct apr_reslist_t apr_reslist_t;

/* Generic constructor called by resource list when it needs to create a
 * resource.
 * @param resource opaque resource
 * @param param flags
 * @param pool  Pool
 */
typedef apr_status_t (*apr_reslist_constructor)(void **resource, void *params,
                                                apr_pool_t *pool);

/* Generic destructor called by resource list when it needs to destroy a
 * resource.
 * @param resource opaque resource
 * @param param flags
 * @param pool  Pool
 */
typedef apr_status_t (*apr_reslist_destructor)(void *resource, void *params,
                                               apr_pool_t *pool);

/**
 * Create a new resource list with the following parameters:
 * @param reslist An address where the pointer to the new resource
 *                list will be stored.
 * @param min Allowed minimum number of available resources. Zero
 *            creates new resources only when needed.
 * @param smax Resources will be destroyed to meet this maximum
 *             restriction as they expire.
 * @param hmax Absolute maximum limit on the number of total resources.
 * @param ttl If non-zero, sets the maximum amount of time in microseconds a
 *            resource may be available while exceeding the soft limit.
 * @param con Constructor routine that is called to create a new resource.
 * @param de Destructor routine that is called to destroy an expired resource.
 * @param params Passed to constructor and deconstructor
 * @param pool The pool from which to create this resource list. Also the
 *             same pool that is passed to the constructor and destructor
 *             routines.
 * @warning If you're creating a sub-pool of the pool passed into this
 *          function in your constructor, you will need to follow some rules
 *          when it comes to destruction of that sub-pool, as calling
 *          apr_pool_destroy() outright on it in your destructor may create
 *          double free situations. That is because by the time destructor is
 *          called, the sub-pool may have already been destroyed. This also
 *          means that in the destructor, memory from the sub-pool should be
 *          treated as invalid. For examples of how to do this correctly, see
 *          mod_dbd of Apache 2.2 and memcache support in APR Util 1.3.
 */
APU_DECLARE(apr_status_t) apr_reslist_create(apr_reslist_t **reslist,
                                             int min, int smax, int hmax,
                                             apr_interval_time_t ttl,
                                             apr_reslist_constructor con,
                                             apr_reslist_destructor de,
                                             void *params,
                                             apr_pool_t *pool);

/**
 * Destroy the given resource list and all resources controlled by
 * this list.
 * FIXME: Should this block until all resources become available,
 *        or maybe just destroy all the free ones, or maybe destroy
 *        them even though they might be in use by something else?
 *        Currently it will abort if there are resources that haven't
 *        been released, so there is an assumption that all resources
 *        have been released to the list before calling this function.
 * @param reslist The reslist to destroy
 */
APU_DECLARE(apr_status_t) apr_reslist_destroy(apr_reslist_t *reslist);

/**
 * Retrieve a resource from the list, creating a new one if necessary.
 * If we have met our maximum number of resources, we will block
 * until one becomes available.
 */
APU_DECLARE(apr_status_t) apr_reslist_acquire(apr_reslist_t *reslist,
                                              void **resource);

/**
 * Return a resource back to the list of available resources.
 */
APU_DECLARE(apr_status_t) apr_reslist_release(apr_reslist_t *reslist,
                                              void *resource);

/**
 * Set the timeout the acquire will wait for a free resource
 * when the maximum number of resources is exceeded.
 * @param reslist The resource list.
 * @param timeout Timeout to wait. The zero waits forever.
 */
APU_DECLARE(void) apr_reslist_timeout_set(apr_reslist_t *reslist,
                                          apr_interval_time_t timeout);

/**
 * Return the number of outstanding resources.
 * @param reslist The resource list.
 */
APU_DECLARE(apr_uint32_t) apr_reslist_acquired_count(apr_reslist_t *reslist);

/**
 * Invalidate a resource in the pool - e.g. a database connection
 * that returns a "lost connection" error and can't be restored.
 * Use this instead of apr_reslist_release if the resource is bad.
 */
APU_DECLARE(apr_status_t) apr_reslist_invalidate(apr_reslist_t *reslist,
                                                 void *resource);

#ifdef __cplusplus
}
#endif

/** @} */

#endif  /* APR_HAS_THREADS */

#endif  /* ! APR_RESLIST_H */


text:
#ifndef __StringConverter_H__
#define __StringConverter_H__

#include "OgreCommon.h"
#include "OgrePrerequisites.h"
#include "OgreStringVector.h"
#include "OgreColourValue.h"
#include "OgreMatrix4.h"
#include "OgreVector2.h"

namespace Ogre {

    /** \addtogroup Core
    *  @{
    */
    /** \addtogroup General
    *  @{
    */
    /** Class for converting the core Ogre data types to/from Strings.
    @remarks
        The code for converting values to and from strings is here as a separate
        class to avoid coupling String to other datatypes (and vice-versa) which reduces
        compilation dependency: important given how often the core types are used.
    @par
        This class is mainly used for parsing settings in text files. External applications
        can also use it to interface with classes which use the StringInterface template
        class.
    @par
        The String formats of each of the major types is listed with the methods. The basic types
        like int and Real just use the underlying C runtime library atof and atoi family methods,
        however custom types like Vector3, ColourValue and Matrix4 are also supported by this class
        using custom formats.
    @author
        Steve Streeting
    */
    class _OgreExport StringConverter
    {
    public:
        /** Converts a float to a String. */
        static String toString(float val, unsigned short precision = 6,
                               unsigned short width = 0, char fill = ' ',
                               std::ios::fmtflags flags = std::ios::fmtflags(0));

        /** Converts a double to a String. */
        static String toString(double val, unsigned short precision = 6,
                               unsigned short width = 0, char fill = ' ',
                               std::ios::fmtflags flags = std::ios::fmtflags(0));

        /** Converts a Radian to a String. */
        static String toString(Radian val, unsigned short precision = 6,
            unsigned short width = 0, char fill = ' ',
            std::ios::fmtflags flags = std::ios::fmtflags(0))
        {
            return toString(val.valueAngleUnits(), precision, width, fill, flags);
        }
        /** Converts a Degree to a String. */
        static String toString(Degree val, unsigned short precision = 6,
            unsigned short width = 0, char fill = ' ',
            std::ios::fmtflags flags = std::ios::fmtflags(0))
        {
            return toString(val.valueAngleUnits(), precision, width, fill, flags);
        }
        /** Converts an int to a String. */
        static String toString(int val, unsigned short width = 0,
            char fill = ' ',
            std::ios::fmtflags flags = std::ios::fmtflags(0));

#if OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_64 || OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
        /** Converts an unsigned int to a String. */
        static String toString(unsigned int val,
            unsigned short width = 0, char fill = ' ',
            std::ios::fmtflags flags = std::ios::fmtflags(0));

        #if OGRE_COMPILER == OGRE_COMPILER_MSVC || defined(__MINGW32__)
        /** Converts an unsigned long to a String. */
        static String toString(unsigned long val,
            unsigned short width = 0, char fill = ' ',
            std::ios::fmtflags flags = std::ios::fmtflags(0));
        #endif
#else
        /** Converts an unsigned long to a String. */
        static String toString(unsigned long val,
            unsigned short width = 0, char fill = ' ',
            std::ios::fmtflags flags = std::ios::fmtflags(0));
#endif
        /** Converts a size_t to a String. */
        static String toString(size_t val,
            unsigned short width = 0, char fill = ' ',
            std::ios::fmtflags flags = std::ios::fmtflags(0));

        /** Converts a long to a String. */
        static String toString(long val,
            unsigned short width = 0, char fill = ' ',
            std::ios::fmtflags flags = std::ios::fmtflags(0));

        /** Converts a boolean to a String.
        @param yesNo If set to true, result is 'yes' or 'no' instead of 'true' or 'false'
        */
        static String toString(bool val, bool yesNo = false);
        /** Converts a Vector2 to a String.
        @remarks
            Format is "x y" (i.e. 2x Real values, space delimited)
        */
        static String toString(const Vector2& val);
        /** Converts a Vector3 to a String.
        @remarks
            Format is "x y z" (i.e. 3x Real values, space delimited)
        */
        static String toString(const Vector3& val);
        /** Converts a Vector4 to a String.
        @remarks
            Format is "x y z w" (i.e. 4x Real values, space delimited)
        */
        static String toString(const Vector4& val);
        /** Converts a Matrix3 to a String.
        @remarks
            Format is "00 01 02 10 11 12 20 21 22" where '01' means row 0 column 1 etc.
        */
        static String toString(const Matrix3& val);
        /** Converts a Matrix4 to a String.
        @remarks
            Format is "00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33" where
            '01' means row 0 column 1 etc.
        */
        static String toString(const Matrix4& val);
        /** Converts a Quaternion to a String.
        @remarks
            Format is "w x y z" (i.e. 4x Real values, space delimited)
        */
        static String toString(const Quaternion& val);
        /** Converts a ColourValue to a String.
        @remarks
            Format is "r g b a" (i.e. 4x Real values, space delimited).
        */
        static String toString(const ColourValue& val);
        /** Converts a StringVector to a string.
        @remarks
            Strings must not contain spaces since space is used as a delimiter in
            the output.
        */
        static String toString(const StringVector& val);

        /** Converts a String to a Real.
        @return
            0.0 if the value could not be parsed, otherwise the Real version of the String.
        */
        static Real parseReal(const String& val, Real defaultValue = 0);
        /** Converts a String to a Angle.
        @return
            0.0 if the value could not be parsed, otherwise the Angle version of the String.
        */
        static inline Radian parseAngle(const String& val, Radian defaultValue = Radian(0)) {
            return Angle(parseReal(val, defaultValue.valueRadians()));
        }
        /** Converts a String to a whole number.
        @return
            0.0 if the value could not be parsed, otherwise the numeric version of the String.
        */
        static int parseInt(const String& val, int defaultValue = 0);
        /** Converts a String to a whole number.
        @return
            0.0 if the value could not be parsed, otherwise the numeric version of the String.
        */
        static unsigned int parseUnsignedInt(const String& val, unsigned int defaultValue = 0);
        /** Converts a String to a whole number.
        @return
            0.0 if the value could not be parsed, otherwise the numeric version of the String.
        */
        static long parseLong(const String& val, long defaultValue = 0);
        /** Converts a String to a whole number.
        @return
            0.0 if the value could not be parsed, otherwise the numeric version of the String.
        */
        static unsigned long parseUnsignedLong(const String& val, unsigned long defaultValue = 0);
        /** Converts a String to size_t.
        @return
            defaultValue if the value could not be parsed, otherwise the numeric version of the String.
        */
        static size_t parseSizeT(const String& val, size_t defaultValue = 0);
        /** Converts a String to a boolean.
        @remarks
            Returns true if case-insensitive match of the start of the string
            matches "true", "yes", "1", or "on", false if "false", "no", "0"
            or "off".
        */
        static bool parseBool(const String& val, bool defaultValue = 0);
        /** Parses a Vector2 out of a String.
        @remarks
            Format is "x y" ie. 2 Real components, space delimited. Failure to parse returns
            Vector2::ZERO.
        */
        static Vector2 parseVector2(const String& val, const Vector2& defaultValue = Vector2::ZERO);
        /** Parses a Vector3 out of a String.
        @remarks
            Format is "x y z" ie. 3 Real components, space delimited. Failure to parse returns
            Vector3::ZERO.
        */
        static Vector3 parseVector3(const String& val, const Vector3& defaultValue = Vector3::ZERO);
        /** Parses a Vector4 out of a String.
        @remarks
            Format is "x y z w" ie. 4 Real components, space delimited. Failure to parse returns
            Vector4::ZERO.
        */
        static Vector4 parseVector4(const String& val, const Vector4& defaultValue = Vector4::ZERO);
        /** Parses a Matrix3 out of a String.
        @remarks
            Format is "00 01 02 10 11 12 20 21 22" where '01' means row 0 column 1 etc.
            Failure to parse returns Matrix3::IDENTITY.
        */
        static Matrix3 parseMatrix3(const String& val, const Matrix3& defaultValue = Matrix3::IDENTITY);
        /** Parses a Matrix4 out of a String.
        @remarks
            Format is "00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33" where
            '01' means row 0 column 1 etc. Failure to parse returns Matrix4::IDENTITY.
        */
        static Matrix4 parseMatrix4(const String& val, const Matrix4& defaultValue = Matrix4::IDENTITY);
        /** Parses a Quaternion out of a String.
        @remarks
            Format is "w x y z" (i.e. 4x Real values, space delimited).
            Failure to parse returns Quaternion::IDENTITY.
        */
        static Quaternion parseQuaternion(const String& val, const Quaternion& defaultValue = Quaternion::IDENTITY);
        /** Parses a ColourValue out of a String.
        @remarks
            Format is "r g b a" (i.e. 4x Real values, space delimited), or "r g b" which implies
            an alpha value of 1.0 (opaque). Failure to parse returns ColourValue::Black.
        */
        static ColourValue parseColourValue(const String& val, const ColourValue& defaultValue = ColourValue::Black);

        /** Parses a StringVector from a string.
        @remarks
            Strings must not contain spaces since space is used as a delimiter in
            the output.
        */
        static StringVector parseStringVector(const String& val);
        /** Checks the String is a valid number value. */
        static bool isNumber(const String& val);

        /** templated parse call that forwards to StringConverter::parse*(str)
         useful for template metaprogramming */
        template <typename T> static void parse(const String& str, T& v); // no implementation so we get compile time error for unknown types

		/** Converts a ColourBufferType to a String.
		@remarks
			String output format is "Back", "Back Left", "Back Right", etc.
		*/
		static String toString(ColourBufferType val);

		/** Converts a String to a ColourBufferType.
		@remarks
			String input format should be "Back", "Back Left", "Back Right", etc.
		*/
		static ColourBufferType parseColourBuffer(const String& val, ColourBufferType defaultValue = CBT_BACK);

		/** Converts a StereoModeType to a String
		@remarks
			String output format is "None", "Frame Sequential", etc.
		*/
		static String toString(StereoModeType val);

		/** Converts a String to a StereoModeType
		@remarks
			String input format should be "None", "Frame Sequential", etc.
		*/
		static StereoModeType parseStereoMode(const String& val, StereoModeType defaultValue = SMT_NONE);

		static locale_t _numLocale;
    protected:
        template<typename T>
        static String _toString(T val, uint16 width, char fill, std::ios::fmtflags flags);
    };

    template<> inline void StringConverter::parse(const String& str, ColourValue& v) {
        v = Ogre::StringConverter::parseColourValue(str);
    }
    template<> inline void StringConverter::parse(const String& str, Quaternion& v) {
        v = Ogre::StringConverter::parseQuaternion(str);
    }
    template<> inline void StringConverter::parse(const String& str, Matrix4& v) {
        v = Ogre::StringConverter::parseMatrix4(str);
    }
    template<> inline void StringConverter::parse(const String& str, Matrix3& v) {
        v = Ogre::StringConverter::parseMatrix3(str);
    }
    template<> inline void StringConverter::parse(const String& str, Vector4& v) {
        v = Ogre::StringConverter::parseVector4(str);
    }
    template<> inline void StringConverter::parse(const String& str, Vector3& v) {
        v = Ogre::StringConverter::parseVector3(str);
    }
    template<> inline void StringConverter::parse(const String& str, Vector2& v) {
        v = Ogre::StringConverter::parseVector2(str);
    }
    template<> inline void StringConverter::parse(const String& str, size_t& v) {
        v = Ogre::StringConverter::parseSizeT(str);
    }
    /*possibly same as size_t template<> inline void StringConverter::parse(const String& str, unsigned int& v) {
        v = Ogre::StringConverter::parseUnsignedInt(str);
    }*/
    template<> inline void StringConverter::parse(const String& str, long& v) {
        v = Ogre::StringConverter::parseLong(str);
    }
    /*possibly same as size_t template<> inline void StringConverter::parse(const String& str, unsigned long& v) {
        v = Ogre::StringConverter::parseUnsignedLong(str);
    }*/
    template<> inline void StringConverter::parse(const String& str, bool& v) {
        v = Ogre::StringConverter::parseBool(str);
    }
    template<> inline void StringConverter::parse(const String& str, int& v) {
        v = Ogre::StringConverter::parseInt(str);
    }
    template<> inline void StringConverter::parse(const String& str, Real& v) {
        v = Ogre::StringConverter::parseReal(str);
    }

    /** @} */
    /** @} */

}

#endif


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates;

/**
 *
 * @author mattbettinson
 */
public interface Config
{
	/**
	 * Testing Constants
	 */
	static final boolean TESTING = false;

	/**
	 * GenericHID Constants
	 */
	static final int MAIN_JOYSTICK = 1;
	static final int SECONDARY_JOYSTICK = 2;

	/**
	 * PWM Constants
	 */
	static final int[] LDRIVE = { 1, 2 };
	static final int[] RDRIVE = { 3, 4 };
	static final int[] SHOOTER = { 7, 8 };

	static final int RETRIEVE = 5;
	static final int HOCKEY = 6;

	/**
	 * Analog Constants
	 */
	static final int ULTRASONIC = 1;

	/**
	 * Digital Constants
	 */
	static final int[] LENCODER = { 3, 4 };
	static final int[] RENCODER = { 1, 2 };
	static final int[] SENCODER = { 5, 6 };

	static final int TLIMIT_SWITCH = 8;
	static final int BLIMIT_SWITCH = 9;
	static final int RLIMIT_SWITCH = 7;

	/**
	 * Relay Constants
	 */
	static final int LIGHTS = 1;

	/**
	 * Value Constants
	 */
	static final double[] PID = { 0.1, 0.0, 0.0 };
	static final int[] CAM_HSL = { 0, 23, 31, 142, 73, 255 };
	static final int[] CAM_RGB = { 191, 255, 129, 229, 117, 190 };

	static final double LE_DPP = 0.0190;
	static final double RE_DPP = 0.0240;
	static final double SE_DPP = 0.18;
}


text:
import {connect} from 'react-redux';
import {actionCreators as nodeActions} from './actions';
import { bindActionCreators } from 'redux';
import NodeEditor from './components/NodeEditor/';
import {NODE_EDITOR_PADDING, TAB_HEIGHT, PALETTE_WIDTH, TOOLBAR_HEIGHT, WORKSPACE_FOOTER} from './constants/ViewConstants';

export function contextTypes(cType) {
    return function (DecoratedComponent) {
        DecoratedComponent.contextTypes = cType;
        return DecoratedComponent;
    }
}

export function configNode(){

  return function (DecoratedComponent){

      return @connect((state,ownProps)=>{

         return{
            nodes: state.nodes.nodesById,
            links: state.ports.linksById,
            selectedId: state.nodes.selectedId,
            configuringId: state.nodes.configuringId,
            node: state.nodes.nodesById[ownProps.id],
            buffer: state.nodes.buffer,
            local: state[ownProps.id],
            w: state.editor.screen.w,
            h: state.editor.screen.h,  //this is the local reducer provided by a node!
        }
      }, (dispatch) => {
          return{
             actions: bindActionCreators(nodeActions, dispatch),
          }
      })

      class Config extends React.Component {

        render(){

            const {node, id, configuringId, store, buffer, local, store:{dispatch}, nodes, links, w, h} = this.props;

            if (!node){
                return null;
            }

            const NODE_EDITOR_WIDTH       = w - ((2* NODE_EDITOR_PADDING) + PALETTE_WIDTH);
            const NODE_EDITOR_MAX_HEIGHT  = h - (2 * NODE_EDITOR_PADDING);

            const inputs = Object.keys(links).filter((key)=>{
                const link = links[key];
                return link.target.id === id;
            }).map((linkId)=>{

                return nodes[links[linkId].source.id];
            });

            const outputs = Object.keys(links).filter((key)=>{
               const link = links[key];
               return link.source.id === id;
            }).map((linkId)=>{
                return nodes[links[linkId].target.id];
            });

            const props = {
                node,
                values:buffer,
                updateNode:  (property,value)=>{
                    this.props.actions.updateNode(property,value);
                    if (property === node._def.schemakey){
                        this.props.actions.updateSchema(id, node._def.schemafn(value));
                        this.props.actions.updateDescription(id, node._def.descriptionfn(value));
                    }
                },
                inputs,
                outputs,
                local:local,
                dispatch,
                store,
                w,
                h,
                contenth: h - (TOOLBAR_HEIGHT + TAB_HEIGHT + TOOLBAR_HEIGHT +  (2 * NODE_EDITOR_PADDING) + WORKSPACE_FOOTER  + 40),
                contentw: NODE_EDITOR_WIDTH,
            }

            const nodeeditorprops = {
              node,
              store,
              name: node.type,
              inputs,
              outputs,
              updateNode: this.props.actions.updateNode,
              values:buffer,
              w,
              h,
            }

            if (node.id && node.id === configuringId){
                return <NodeEditor {...nodeeditorprops}>
                          <DecoratedComponent {...props}/>
                       </NodeEditor>
            }
            return null;
        }
      }
   }
}


text:
"""
overseer.views
~~~~~~~~~~~~~~

:copyright: (c) 2011 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""

import datetime
import urlparse

from django.core.context_processors import csrf
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.db.models.query import Q
from django.http import HttpResponseRedirect
from django.views.decorators.csrf import csrf_protect

from overseer import context_processors, conf
from overseer.forms import NewSubscriptionForm, UpdateSubscriptionForm
from overseer.models import Service, Event, Subscription, UnverifiedSubscription

def requires(value_or_callable):
    def wrapped(func):
        def call(request, *args, **kwargs):
            if callable(value_or_callable):
                result = value_or_callable(request)
            else:
                result = value_or_callable

            if not result:
                return HttpResponseRedirect(reverse('overseer:index'))

            return func(request, *args, **kwargs)
        return call
    return wrapped

def respond(template, context={}, request=None, **kwargs):
    "Calls render_to_response with a RequestConext"
    from django.http import HttpResponse
    from django.template import RequestContext
    from django.template.loader import render_to_string

    if request:
        default = context_processors.default(request)
        default.update(context)
    else:
        default = context.copy()

    rendered = render_to_string(template, default, context_instance=request and RequestContext(request) or None)
    return HttpResponse(rendered, **kwargs)

def index(request):
    "Displays a list of all services and their current status."

    service_list = Service.objects.all()

    event_list = list(Event.objects\
                             .filter(Q(status__gt=0) | Q(date_updated__gte=datetime.datetime.now()-datetime.timedelta(days=1)))\
                             .order_by('-date_created')[0:6])

    if event_list:
        latest_event, event_list = event_list[0], event_list[1:]
    else:
        latest_event = None

    return respond('overseer/index.html', {
        'service_list': service_list,
        'event_list': event_list,
        'latest_event': latest_event,
    }, request)

def service(request, slug):
    "Displays a list of all services and their current status."

    try:
        service = Service.objects.get(slug=slug)
    except Service.DoesNotExist:
        return HttpResponseRedirect(reverse('overseer:index'))

    event_list = service.event_set.order_by('-date_created')

    return respond('overseer/service.html', {
        'service': service,
        'event_list': event_list,
    }, request)

def event(request, id):
    "Displays a list of all services and their current status."

    try:
        evt = Event.objects.get(pk=id)
    except Event.DoesNotExist:
        return HttpResponseRedirect(reverse('overseer:index'))

    update_list = list(evt.eventupdate_set.order_by('-date_created'))

    return respond('overseer/event.html', {
        'event': evt,
        'update_list': update_list,
    }, request)

def last_event(request, slug):
    "Displays a list of all services and their current status."

    try:
        service = Service.objects.get(slug=slug)
    except Service.DoesNotExist:
        return HttpResponseRedirect(reverse('overseer:index'))

    try:
        evt = service.event_set.order_by('-date_created')[0]
    except IndexError:
        return HttpResponseRedirect(service.get_absolute_url())

    return event(request, evt.pk)

@requires(conf.ALLOW_SUBSCRIPTIONS)
@csrf_protect
def update_subscription(request, ident):
    "Shows subscriptions options for a verified subscriber."

    try:
        subscription = Subscription.objects.get(ident=ident)
    except Subscription.DoesNotExist:
        return respond('overseer/invalid_subscription_token.html', {}, request)

    if request.POST:
        form = UpdateSubscriptionForm(request.POST, instance=subscription)
        if form.is_valid():
            if form.cleaned_data['unsubscribe']:
                subscription.delete()

                return respond('overseer/unsubscribe_confirmed.html', {
                    'email': subscription.email,
                })
            else:
                form.save()

            return HttpResponseRedirect(request.get_full_path())
    else:
        form = UpdateSubscriptionForm(instance=subscription)

    context = csrf(request)
    context.update({
        'form': form,
        'subscription': subscription,
        'service_list': Service.objects.all(),
    })

    return respond('overseer/update_subscription.html', context, request)

@requires(conf.ALLOW_SUBSCRIPTIONS)
@csrf_protect
def create_subscription(request):
    "Shows subscriptions options for a new subscriber."

    if request.POST:
        form = NewSubscriptionForm(request.POST)
        if form.is_valid():
            unverified = form.save()

            body = """Please confirm your email address to subscribe to status updates from %(name)s:\n\n%(link)s""" % dict(
                name=conf.NAME,
                link=urlparse.urljoin(conf.BASE_URL, reverse('overseer:verify_subscription', args=[unverified.ident]))
            )

            # Send verification email
            from_mail = conf.FROM_EMAIL
            if not from_mail:
                from_mail = 'overseer@%s' % request.get_host().split(':', 1)[0]

            send_mail('Confirm Subscription', body, from_mail, [unverified.email],
                      fail_silently=True)

            # Show success page
            return respond('overseer/create_subscription_complete.html', {
                'subscription': unverified,
            }, request)
    else:
        form = NewSubscriptionForm()

    context = csrf(request)
    context.update({
        'form': form,
        'service_list': Service.objects.all(),
    })

    return respond('overseer/create_subscription.html', context, request)

@requires(conf.ALLOW_SUBSCRIPTIONS)
def verify_subscription(request, ident):
    """
    Verifies an unverified subscription and create or appends
    to an existing subscription.
    """

    try:
        unverified = UnverifiedSubscription.objects.get(ident=ident)
    except UnverifiedSubscription.DoesNotExist:
        return respond('overseer/invalid_subscription_token.html', {}, request)

    subscription = Subscription.objects.get_or_create(email=unverified.email, defaults={
        'ident': unverified.ident,
    })[0]

    subscription.services = unverified.services.all()

    unverified.delete()

    return respond('overseer/subscription_confirmed.html', {
        'subscription': subscription,
    }, request)


text:
<?php
namespace account\assets;

use yii\web\AssetBundle;

class AppAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';

    public static $globleCss = [
        '/template/css/bootstrap.css',
        '/template/css/iconfont.css',
        '/template/css/base.css',
        '/template/css/style.css',
    ];

    public static $globleJs = [
        '/template/js/bootstrap.min.js',
        '/template/js/script.js',
        '/template/js/user.js',
    ];

    public static $jquery =  [
        '/template/js/jquery-1.11.1.js',
    ];

    public static function loadCss($view) {
        foreach (self::$globleCss as $val){
            $view->registerCssFile($val, [AppAsset::className(), 'depends' => 'account\assets\AppAsset']);
        }
    }

    public static function loadJs($view) {
        foreach (self::$globleJs as $val){
            $view->registerJsFile($val, [AppAsset::className(), 'depends' => 'account\assets\AppAsset']);
        }
    }
    public static function loadJquery($view) {
        foreach (self::$jquery as $val){
            $view->registerJsFile($val, [AppAsset::className(), 'depends' => 'account\assets\AppAsset']);
        }
    }
}


text:
package com.newtranx.util.mysql.fabric;

import java.lang.reflect.Method;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import javax.annotation.PostConstruct;

import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.mysql.fabric.FabricCommunicationException;
import com.mysql.fabric.proto.xmlrpc.XmlRpcClient;
import com.newtranx.util.aop.AspectJUtils;

import rx.exceptions.Exceptions;

@Component
@Aspect
public class SpringQueryAllShardsAspect {

	private static final Logger log = LogManager.getLogger(SpringQueryAllShardsAspect.class);

	private static Class<?>[] EMPTY_PARAM = new Class<?>[0];

	private static Object[] EMPTY_ARGS = new Object[0];

	@Autowired
	private FabricMySQLDataSourceEx ds;

	@Autowired
	private XmlRpcClient fabricClient;

	@Autowired
	private ApplicationContext applicationContext;

	private LoadingCache<Object, Set<String>> groupsCache;

	private Object cacheKey = new Object();

	@Value("${mysql.fabric.query_all_shards.groups.cache.expire.seconds:600}")
	private int groupsCacheExpireTime;

	@PostConstruct
	public void initGroupsCache() {
		groupsCache = CacheBuilder.newBuilder().expireAfterWrite(groupsCacheExpireTime, TimeUnit.SECONDS)
				.build(new CacheLoader<Object, Set<String>>() {
					public Set<String> load(Object key) throws FabricCommunicationException {
						synchronized (fabricClient) {
							log.info("Loading groups");
							return fabricClient.getGroupNames();
						}
					}
				});
	}

	@Around("@annotation(com.newtranx.util.mysql.fabric.QueryAllShards)")
	public Object union(ProceedingJoinPoint pjp) throws Throwable {
		Method method = AspectJUtils.getMethod(pjp);
		QueryAllShards annotation = method.getAnnotation(QueryAllShards.class);
		String table = annotation.table();
		log.debug("Table=" + table);
		Set<String> groups = groupsCache.get(cacheKey);
		log.debug("ServerGroups=" + groups);
		List<Object> list;
		boolean readOnly = annotation.readOnly();
		Pattern excludePattern;
		String excludeRegex = annotation.excludeShardsPatternRegex();
		if (!StringUtils.isEmpty(excludeRegex)) {
			excludePattern = Pattern.compile(excludeRegex);
		} else {
			excludePattern = null;
		}

		Function<Boolean, List<Object>> computeFunction = (par) -> {
			Stream<String> stream = groups.stream();
			if (par)
				stream = stream.parallel();
			return stream.filter(gp -> {
				boolean exclude = excludePattern != null && excludePattern.matcher(gp).matches();
				if (exclude) {
					log.debug("Skipping group:" + gp);
				}
				return !exclude;
			}).map(gp -> {
				log.debug("Querying group: " + gp);
				ds.whenNewConnection().doInit(conn -> conn.setServerGroupName(gp))
						.doInit(conn -> conn.setReadOnly(readOnly));
				try {
					return pjp.proceed();
				} catch (Throwable t) {
					throw Exceptions.propagate(t);
				} finally {
					ds.clearInitOps();
				}
			}).collect(Collectors.toList());
		};

		if (StringUtils.isEmpty(annotation.parallelPool())) {
			list = computeFunction.apply(false);
		} else {
			ForkJoinPool pool;
			if ("!jdkCommon".equals(annotation.parallelPool()))
				pool = ForkJoinPool.commonPool();
			else
				pool = applicationContext.getBean(annotation.parallelPool(), ForkJoinPool.class);
			log.debug("Executing queries in parallel, pool=" + pool);
			list = pool.submit(() -> {
				return computeFunction.apply(true);
			}).get();
		}
		Aggregator aggregator;
		try {
			aggregator = (Aggregator) annotation.aggregator().getDeclaredMethod("getInstance", EMPTY_PARAM).invoke(null,
					EMPTY_ARGS);
		} catch (Exception e) {
			log.warn(
					"Can not get singleton for class " + annotation.aggregator().getName() + ", creating new instance");
			aggregator = annotation.aggregator().newInstance();
		}
		return aggregator.apply(list);
	}

}


text:
include ../make/bazel.mk

default:
	$(BAZEL) run --config=mayberemote :samplevariance -- > /tmp/yesterday.csv

test:
	$(BAZEL) test --config=mayberemote //perf/samplevariance/...

# An example of how to run over a specific set of JSON files.
example:
	$(BAZEL) run --config=mayberemote :samplevariance -- --prefix=gs://skia-perf/nano-json-v1/2021/05/23/02/


text:
+ document
+ categorie
+ tier
+ file
+ typedocument

### For 'document' Objects

|HTTP
 Method|URI|Others
 Parameters|Description|
|:----------:|:---|:---:|:----:|
|GET|/api/v1/document/|None|Returns an array containing all documents main attributes.|
|GET|/api/v1/document/{id}|{id} : Document UID|Returns data concerning aimed Document.|
|POST|/api/v1/document/|| Create a new document.|
|POST|/api/v1/document/{docid}/file/|{docid} : Document UID
POST Arg : FileToUpload (Form)| Upload a file and link it to the document.|
|POST|/api/v1/document/{docid}/file/{fileid}|{docid} : Document UID
{fileid} : File UID| Link an existing file to the document.|
|DELETE|/api/v1/document/{docid}/file/{fileid}|{docid} : Document UID
{fileid} : File UID| Delete a link between file and document.|

### For ' Type Document ' Objects (i.e: typedocument)

|HTTP
 Method|URI|Others
 Parameters|Description|
|:----------:|:---|:---:|:----:|
|GET|/api/v1/typedocument/{id}|{id} : tdoc UID|Returns Attribute values about type of document.|
|GET|/api/v1/typedocument/{id}/getmeta/|{id} : tdoc UID|Returns Meta definition linked to a type of document.|

### For 'file' Objects

|HTTP
 Method|URI|Others
 Parameters|Description|
|:----------:|:---|:---:|:----:|
|POST|/api/v1/file/|POST Arg : file (Form) |Register a new file into System and return her id.|
|GET|/api/v1/file/{id}|{id} : File UID|Returns a file content.|

### For 'tasks' Objects Management

|HTTP
 Method|URI|Others
 Parameters|Description|
|:----------:|:---|:---:|:----:|
|GET|/api/v1/tasks/{id}|{id} : Task UID|Returns status of the OCR task.|

### For specifics 'OCR tasks' Objects

|HTTP
 Method|URI|Others
 Parameters|Description|
|:----------:|:---|:---:|:----:|
|POST|/api/v1/tasks/ocr/|None |Create a new OCR task and return her unique ID.|
|POST|/api/v1/tasks/ocr/{id}/{fileuid}|{id} : Task UID.
 {fileuid} : File UID targetted by OCR Task.|Launch OCR task on fileuid . |


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (c) 2014 Intel Corporation. All rights reserved.

     Use of this source code is governed by a BSD-style license that can be
     found in the LICENSE file.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/toolbar1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <ImageButton
            android:id="@+id/prev"
            android:layout_width="38dp"
            android:layout_height="38dp"
            android:scaleType="center"
            android:src="@android:drawable/ic_media_previous" />

        <ImageButton
            android:id="@+id/next"
            android:layout_width="38dp"
            android:layout_height="38dp"
            android:scaleType="center"
            android:src="@android:drawable/ic_media_next" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >
                <TextView
                    android:id="@+id/text1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="#FDF5E6" />

                <TextView
                    android:id="@+id/text2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="#FDF5E6" />

                <TextView
                    android:id="@+id/text3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="#FDF5E6" />
    </LinearLayout>

    <org.xwalk.core.XWalkView
        android:id="@+id/xwalkview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </org.xwalk.core.XWalkView>

</LinearLayout>


text:
FILE(REMOVE_RECURSE
  "CMakeFiles/compile_Matrix_setRandom_int_int.dir/compile_Matrix_setRandom_int_int.cpp.o"
  "compile_Matrix_setRandom_int_int.pdb"
  "compile_Matrix_setRandom_int_int"
)

# Per-language clean rules from dependency scanning.
FOREACH(lang CXX)
  INCLUDE(CMakeFiles/compile_Matrix_setRandom_int_int.dir/cmake_clean_${lang}.cmake OPTIONAL)
ENDFOREACH(lang)


text:
import { Directive, HostListener, Input } from "@angular/core";
import { MdlMenuComponent } from "./mdl-menu.component";
import { MdlButtonComponent } from "../button/mdl-button.component";

@Directive({
  // eslint-disable-next-line
  selector: "[mdl-button][mdl-toggle-menu]",
})
export class MdlToggleMenuDirective {
  // eslint-disable-next-line
  @Input("mdl-toggle-menu")
  menu: MdlMenuComponent | undefined;

  constructor(private button: MdlButtonComponent) {}

  @HostListener("click", ["$event"])
  public onClick($event: Event): void {
    this.menu?.toggle($event, this.button);
  }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>R: Merges two data frames</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="R.css">

merge {SparkR}	R Documentation

Merges two data frames

Description

Merges two data frames

Usage

## S4 method for signature 'SparkDataFrame,SparkDataFrame'
merge(x, y, by = intersect(names(x),
  names(y)), by.x = by, by.y = by, all = FALSE, all.x = all,
  all.y = all, sort = TRUE, suffixes = c("_x", "_y"), ...)

merge(x, y, ...)

Arguments

x

the first data frame to be joined

y

the second data frame to be joined

by

a character vector specifying the join columns. If by is not
specified, the common column names in x and y will be used.
If by or both by.x and by.y are explicitly set to NULL or of length 0, the Cartesian
Product of x and y will be returned.

by.x

a character vector specifying the joining columns for x.

by.y

a character vector specifying the joining columns for y.

all

a boolean value setting all.x and all.y
if any of them are unset.

all.x

a boolean value indicating whether all the rows in x should
be including in the join

all.y

a boolean value indicating whether all the rows in y should
be including in the join

sort

a logical argument indicating whether the resulting columns should be sorted

suffixes

a string vector of length 2 used to make colnames of
x and y unique.
The first element is appended to each colname of x.
The second element is appended to each colname of y.

...

additional argument(s) passed to the method.

Details

If all.x and all.y are set to FALSE, a natural join will be returned. If
all.x is set to TRUE and all.y is set to FALSE, a left outer join will
be returned. If all.x is set to FALSE and all.y is set to TRUE, a right
outer join will be returned. If all.x and all.y are set to TRUE, a full
outer join will be returned.

Note

merge since 1.5.0

See Also

join

Other SparkDataFrame functions: $,
$,SparkDataFrame-method, $<-,
$<-,SparkDataFrame-method,
select, select,
select,SparkDataFrame,Column-method,
select,SparkDataFrame,character-method,
select,SparkDataFrame,list-method;
SparkDataFrame-class; [,
[,SparkDataFrame-method, [[,
[[,SparkDataFrame,numericOrcharacter-method,
subset, subset,
subset,SparkDataFrame-method;
agg, agg, agg,
agg,GroupedData-method,
agg,SparkDataFrame-method,
summarize, summarize,
summarize,
summarize,GroupedData-method,
summarize,SparkDataFrame-method;
arrange, arrange,
arrange,
arrange,SparkDataFrame,Column-method,
arrange,SparkDataFrame,character-method,
orderBy,SparkDataFrame,characterOrColumn-method;
as.data.frame,
as.data.frame,SparkDataFrame-method;
attach,
attach,SparkDataFrame-method;
cache, cache,
cache,SparkDataFrame-method;
collect, collect,
collect,SparkDataFrame-method;
colnames, colnames,
colnames,SparkDataFrame-method,
colnames<-, colnames<-,
colnames<-,SparkDataFrame-method,
columns, columns,
columns,SparkDataFrame-method,
names,
names,SparkDataFrame-method,
names<-,
names<-,SparkDataFrame-method;
coltypes, coltypes,
coltypes,SparkDataFrame-method,
coltypes<-, coltypes<-,
coltypes<-,SparkDataFrame,character-method;
count,SparkDataFrame-method,
nrow, nrow,
nrow,SparkDataFrame-method;
createOrReplaceTempView,
createOrReplaceTempView,
createOrReplaceTempView,SparkDataFrame,character-method;
dapplyCollect, dapplyCollect,
dapplyCollect,SparkDataFrame,function-method;
dapply, dapply,
dapply,SparkDataFrame,function,structType-method;
describe, describe,
describe,
describe,SparkDataFrame,ANY-method,
describe,SparkDataFrame,character-method,
describe,SparkDataFrame-method,
summary, summary,
summary,SparkDataFrame-method;
dim,
dim,SparkDataFrame-method;
distinct, distinct,
distinct,SparkDataFrame-method,
unique,
unique,SparkDataFrame-method;
dropDuplicates,
dropDuplicates,
dropDuplicates,SparkDataFrame-method;
dropna, dropna,
dropna,SparkDataFrame-method,
fillna, fillna,
fillna,SparkDataFrame-method,
na.omit, na.omit,
na.omit,SparkDataFrame-method;
drop, drop,
drop, drop,ANY-method,
drop,SparkDataFrame-method;
dtypes, dtypes,
dtypes,SparkDataFrame-method;
except, except,
except,SparkDataFrame,SparkDataFrame-method;
explain, explain,
explain,SparkDataFrame-method;
filter, filter,
filter,SparkDataFrame,characterOrColumn-method,
where, where,
where,SparkDataFrame,characterOrColumn-method;
first, first,
first,
first,SparkDataFrame-method,
first,characterOrColumn-method;
gapplyCollect, gapplyCollect,
gapplyCollect,
gapplyCollect,GroupedData-method,
gapplyCollect,SparkDataFrame-method;
gapply, gapply,
gapply,
gapply,GroupedData-method,
gapply,SparkDataFrame-method;
groupBy, groupBy,
groupBy,SparkDataFrame-method,
group_by, group_by,
group_by,SparkDataFrame-method;
head,
head,SparkDataFrame-method;
histogram,
histogram,SparkDataFrame,characterOrColumn-method;
insertInto, insertInto,
insertInto,SparkDataFrame,character-method;
intersect, intersect,
intersect,SparkDataFrame,SparkDataFrame-method;
isLocal, isLocal,
isLocal,SparkDataFrame-method;
join,
join,SparkDataFrame,SparkDataFrame-method;
limit, limit,
limit,SparkDataFrame,numeric-method;
mutate, mutate,
mutate,SparkDataFrame-method,
transform, transform,
transform,SparkDataFrame-method;
ncol,
ncol,SparkDataFrame-method;
persist, persist,
persist,SparkDataFrame,character-method;
printSchema, printSchema,
printSchema,SparkDataFrame-method;
randomSplit, randomSplit,
randomSplit,SparkDataFrame,numeric-method;
rbind, rbind,
rbind,SparkDataFrame-method;
registerTempTable,
registerTempTable,
registerTempTable,SparkDataFrame,character-method;
rename, rename,
rename,SparkDataFrame-method,
withColumnRenamed,
withColumnRenamed,
withColumnRenamed,SparkDataFrame,character,character-method;
repartition, repartition,
repartition,SparkDataFrame-method;
sample, sample,
sample,SparkDataFrame,logical,numeric-method,
sample_frac, sample_frac,
sample_frac,SparkDataFrame,logical,numeric-method;
saveAsParquetFile,
saveAsParquetFile,
saveAsParquetFile,SparkDataFrame,character-method,
write.parquet, write.parquet,
write.parquet,SparkDataFrame,character-method;
saveAsTable, saveAsTable,
saveAsTable,SparkDataFrame,character-method;
saveDF, saveDF,
saveDF,SparkDataFrame,character-method,
write.df, write.df,
write.df,
write.df,SparkDataFrame,character-method;
schema, schema,
schema,SparkDataFrame-method;
selectExpr, selectExpr,
selectExpr,SparkDataFrame,character-method;
showDF, showDF,
showDF,SparkDataFrame-method;
show, show,
show,Column-method,
show,GroupedData-method,
show,SparkDataFrame-method,
show,WindowSpec-method; str,
str,SparkDataFrame-method;
take, take,
take,SparkDataFrame,numeric-method;
union, union,
union,SparkDataFrame,SparkDataFrame-method,
unionAll, unionAll,
unionAll,SparkDataFrame,SparkDataFrame-method;
unpersist, unpersist,
unpersist,SparkDataFrame-method;
withColumn, withColumn,
withColumn,SparkDataFrame,character,Column-method;
with,
with,SparkDataFrame-method;
write.jdbc, write.jdbc,
write.jdbc,SparkDataFrame,character,character-method;
write.json, write.json,
write.json,SparkDataFrame,character-method;
write.orc, write.orc,
write.orc,SparkDataFrame,character-method;
write.text, write.text,
write.text,SparkDataFrame,character-method

Examples

## Not run:
sparkR.session()
df1 <- read.json(path)
df2 <- read.json(path2)
merge(df1, df2) # Performs an inner join by common columns
merge(df1, df2, by = "col1") # Performs an inner join based on expression
merge(df1, df2, by.x = "col1", by.y = "col2", all.y = TRUE)
merge(df1, df2, by.x = "col1", by.y = "col2", all.x = TRUE)
merge(df1, df2, by.x = "col1", by.y = "col2", all.x = TRUE, all.y = TRUE)
merge(df1, df2, by.x = "col1", by.y = "col2", all = TRUE, sort = FALSE)
merge(df1, df2, by = "col1", all = TRUE, suffixes = c("-X", "-Y"))
merge(df1, df2, by = NULL) # Performs a Cartesian join

## End(Not run)

[Package SparkR version 2.0.2 Index]