text:
namespace {

// Salt for Symmetric key derivation.
const char kSalt[] = "saltysalt";

// Key size required for 128 bit AES.
const size_t kDerivedKeySizeInBits = 128;

// Constant for Symmetic key derivation.
const size_t kEncryptionIterations = 1;

// Size of initialization vector for AES 128-bit.
const size_t kIVBlockSizeAES128 = 16;

// Password version. V10 means that the hardcoded password will be used.
// V11 means that a password is/will be stored using an OS-level library (e.g
// Libsecret). V11 will not be used if such a library is not available.
// Used for array indexing.
enum Version {
  V10 = 0,
  V11 = 1,
};

// Prefix for cipher text returned by obfuscation version.  We prefix the
// ciphertext with this string so that future data migration can detect
// this and migrate to full encryption without data loss.
const char kObfuscationPrefix[][4] = {
    "v10", "v11",
};

struct Cache {
  std::unique_ptr<KeyStorageLinux> key_storage_cache;
  std::unique_ptr<std::string> password_v10_cache;
  std::unique_ptr<std::string> password_v11_cache;
  bool is_key_storage_cached;
  bool is_password_v11_cached;
  // Guards access to |g_cache|, making lazy initialization of individual parts
  // thread safe.
  base::Lock lock;
};

base::LazyInstance<Cache>::Leaky g_cache = LAZY_INSTANCE_INITIALIZER;

// Lazy acquisition and caching of a KeyStorage. Will be null if no service is
// found.
KeyStorageLinux* GetKeyStorage() {
  if (!g_cache.Get().is_key_storage_cached) {
    g_cache.Get().is_key_storage_cached = true;
    g_cache.Get().key_storage_cache = KeyStorageLinux::CreateService();
  }
  return g_cache.Get().key_storage_cache.get();
}

// Pointer to a function that creates and returns the |KeyStorage| instance to
// be used. The function maintains ownership of the pointer.
KeyStorageLinux* (*g_key_storage_provider)() = &GetKeyStorage;

// Returns a cached string of "peanuts". Is thread-safe.
std::string* GetPasswordV10() {
  base::AutoLock auto_lock(g_cache.Get().lock);
  if (!g_cache.Get().password_v10_cache.get()) {
    g_cache.Get().password_v10_cache.reset(new std::string("peanuts"));
  }
  return g_cache.Get().password_v10_cache.get();
}

// Caches and returns the password from the KeyStorage or null if there is no
// service. Is thread-safe.
std::string* GetPasswordV11() {
  base::AutoLock auto_lock(g_cache.Get().lock);
  if (!g_cache.Get().is_password_v11_cached) {
    g_cache.Get().password_v11_cache.reset(
        g_key_storage_provider()
            ? new std::string(g_key_storage_provider()->GetKey())
            : nullptr);
    g_cache.Get().is_password_v11_cached = true;
  }
  return g_cache.Get().password_v11_cache.get();
}

// Pointers to functions that return a password for deriving the encryption key.
// One function for each supported password version (see Version enum).
std::string* (*g_get_password[])() = {
    &GetPasswordV10, &GetPasswordV11,
};

// Generates a newly allocated SymmetricKey object based on a password.
// Ownership of the key is passed to the caller. Returns null key if a key
// generation error occurs.
std::unique_ptr<crypto::SymmetricKey> GetEncryptionKey(Version version) {
  std::string salt(kSalt);

  std::string* password = g_get_password[version]();
  if (!password)
    return nullptr;

  // Create an encryption key from our password and salt.
  std::unique_ptr<crypto::SymmetricKey> encryption_key(
      crypto::SymmetricKey::DeriveKeyFromPassword(
          crypto::SymmetricKey::AES, *password, salt, kEncryptionIterations,
          kDerivedKeySizeInBits));
  DCHECK(encryption_key);

  return encryption_key;
}

}  // namespace

// static
bool OSCrypt::EncryptString16(const base::string16& plaintext,
                              std::string* ciphertext) {
  return EncryptString(base::UTF16ToUTF8(plaintext), ciphertext);
}

// static
bool OSCrypt::DecryptString16(const std::string& ciphertext,
                              base::string16* plaintext) {
  std::string utf8;
  if (!DecryptString(ciphertext, &utf8))
    return false;

  *plaintext = base::UTF8ToUTF16(utf8);
  return true;
}

// static
bool OSCrypt::EncryptString(const std::string& plaintext,
                            std::string* ciphertext) {
  if (plaintext.empty()) {
    ciphertext->clear();
    return true;
  }

  // If we are able to create a V11 key (i.e. a KeyStorage was available), then
  // we'll use it. If not, we'll use V10.
  Version version = Version::V11;
  std::unique_ptr<crypto::SymmetricKey> encryption_key(
      GetEncryptionKey(version));
  if (!encryption_key) {
    version = Version::V10;
    encryption_key = GetEncryptionKey(version);
  }

  if (!encryption_key)
    return false;

  std::string iv(kIVBlockSizeAES128, ' ');
  crypto::Encryptor encryptor;
  if (!encryptor.Init(encryption_key.get(), crypto::Encryptor::CBC, iv))
    return false;

  if (!encryptor.Encrypt(plaintext, ciphertext))
    return false;

  // Prefix the cipher text with version information.
  ciphertext->insert(0, kObfuscationPrefix[version]);
  return true;
}

// static
bool OSCrypt::DecryptString(const std::string& ciphertext,
                            std::string* plaintext) {
  if (ciphertext.empty()) {
    plaintext->clear();
    return true;
  }

  // Check that the incoming ciphertext was encrypted and with what version.
  // Credit card numbers are current legacy unencrypted data, so false match
  // with prefix won't happen.
  Version version;
  if (base::StartsWith(ciphertext, kObfuscationPrefix[Version::V10],
                       base::CompareCase::SENSITIVE)) {
    version = Version::V10;
  } else if (base::StartsWith(ciphertext, kObfuscationPrefix[Version::V11],
                              base::CompareCase::SENSITIVE)) {
    version = Version::V11;
  } else {
    // If the prefix is not found then we'll assume we're dealing with
    // old data saved as clear text and we'll return it directly.
    *plaintext = ciphertext;
    return true;
  }

  std::unique_ptr<crypto::SymmetricKey> encryption_key(
      GetEncryptionKey(version));
  if (!encryption_key)
    return false;

  std::string iv(kIVBlockSizeAES128, ' ');
  crypto::Encryptor encryptor;
  if (!encryptor.Init(encryption_key.get(), crypto::Encryptor::CBC, iv))
    return false;

  // Strip off the versioning prefix before decrypting.
  std::string raw_ciphertext =
      ciphertext.substr(strlen(kObfuscationPrefix[version]));

  if (!encryptor.Decrypt(raw_ciphertext, plaintext))
    return false;

  return true;
}

// static
void OSCrypt::SetStore(const std::string& store_type) {
  // Changing the targeted password store makes no sense after initializing.
  DCHECK(!g_cache.Get().is_key_storage_cached);

  KeyStorageLinux::SetStore(store_type);
}

// static
void OSCrypt::SetProductName(const std::string& product_name) {
  // Setting the product name makes no sense after initializing.
  DCHECK(!g_cache.Get().is_key_storage_cached);

  KeyStorageLinux::SetProductName(product_name);
}

// static
void OSCrypt::SetMainThreadRunner(
    scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner) {
  // Setting the task runner makes no sense after initializing.
  DCHECK(!g_cache.Get().is_key_storage_cached);

  KeyStorageLinux::SetMainThreadRunner(main_thread_runner);
}

void UseMockKeyStorageForTesting(KeyStorageLinux* (*get_key_storage_mock)(),
                                 std::string* (*get_password_v11_mock)()) {
  // Save the real implementation to restore it later.
  static bool is_get_password_saved = false;
  static std::string* (*get_password_save[arraysize(g_get_password)])();
  if (!is_get_password_saved) {
    std::copy(std::begin(g_get_password), std::end(g_get_password),
              std::begin(get_password_save));
    is_get_password_saved = true;
  }

  if (get_key_storage_mock && get_password_v11_mock) {
    // Bypass calling KeyStorage::CreateService and caching of the key for V11
    if (get_password_v11_mock)
      g_get_password[Version::V11] = get_password_v11_mock;
    // OSCrypt will determine the encryption version by checking if a
    // |KeyStorage| instance can be created. Enable V11 by returning the mock.
    if (get_key_storage_mock)
      g_key_storage_provider = get_key_storage_mock;
  } else {
    // Restore real implementation
    std::copy(std::begin(get_password_save), std::end(get_password_save),
              std::begin(g_get_password));
    g_key_storage_provider = &GetKeyStorage;
  }
}


text:
<?php

namespace Wirecard\Element;

use Wirecard\Element\Request;
use Wirecard\Element\Response;
use Wirecard\Element\WireCard;

class WireCardTest extends \PHPUnit_Framework_TestCase
{
    public function testWireCardHasRequest()
    {
        $request = $this->getMockBuilder('\Wirecard\Element\Request')
            ->disableOriginalConstructor()
            ->getMock();

        $wireCard = WireCard::createWithRequest($request);
        $this->assertInstanceOf('\Wirecard\Element\Request', $wireCard->request);
    }

    public function testWireCardHasResponse()
    {
        $response = $this->getMockBuilder('\Wirecard\Element\Response')
            ->disableOriginalConstructor()
            ->getMock();

        $wireCard = WireCard::createWithResponse($response);
        $this->assertInstanceOf('\Wirecard\Element\Response', $wireCard->response);
    }
}

redpajama_set_name: RedPajamaGithub


text:
import { RippleInterface } from '../mwc-base/utils.js';
export interface RippleAPI extends RippleInterface {
    startHover: () => void;
    endHover: () => void;
}
/**
 * Class that encapsulates the events handlers for `mwc-ripple`
 *
 *
 * Example:
 * ```
 * class XFoo extends LitElement {
 *   async getRipple() {
 *     this.renderRipple = true;
 *     await this.updateComplete;
 *     return this.renderRoot.querySelector('mwc-ripple');
 *   }
 *   rippleHandlers = new RippleHandlers(() => this.getRipple());
 *
 *   render() {
 *     return html`
 *       <div @mousedown=${this.rippleHandlers.startPress}></div>
 *       ${this.renderRipple ? html`<mwc-ripple></mwc-ripple>` : ''}
 *     `;
 *   }
 * }
 * ```
 */
export declare class RippleHandlers implements RippleAPI {
    startPress: (ev?: Event) => void;
    endPress: () => void;
    startFocus: () => void;
    endFocus: () => void;
    startHover: () => void;
    endHover: () => void;
    constructor(
    /** Function that returns a `mwc-ripple` */
    rippleFn: () => Promise<RippleAPI | null>);
}


text:
Set_Noodle_Foreward::Set_Noodle_Foreward() {
	Requires(Subsystems::pool_noodle);
}

void Set_Noodle_Foreward::Initialize() {
	Subsystems::pool_noodle->move_foreward();
}

// Make sure the servo is finished moving before we finish
bool Set_Noodle_Foreward::IsFinished() {
	return true;
}


text:
namespace ppapi {
namespace proxy {

namespace {

void ProvidePictureBuffers(PP_Instance instance, PP_Resource decoder,
                           uint32_t req_num_of_bufs,
                           const PP_Size* dimensions,
                           uint32_t texture_target) {
  HostResource decoder_resource;
  decoder_resource.SetHostResource(instance, decoder);

  HostDispatcher::GetForInstance(instance)->Send(
      new PpapiMsg_PPPVideoDecoder_ProvidePictureBuffers(
          API_ID_PPP_VIDEO_DECODER_DEV,
          decoder_resource, req_num_of_bufs, *dimensions, texture_target));
}

void DismissPictureBuffer(PP_Instance instance, PP_Resource decoder,
                          int32_t picture_buffer_id) {
  HostResource decoder_resource;
  decoder_resource.SetHostResource(instance, decoder);

  HostDispatcher::GetForInstance(instance)->Send(
      new PpapiMsg_PPPVideoDecoder_DismissPictureBuffer(
          API_ID_PPP_VIDEO_DECODER_DEV,
          decoder_resource, picture_buffer_id));
}

void PictureReady(PP_Instance instance, PP_Resource decoder,
                  const PP_Picture_Dev* picture) {
  HostResource decoder_resource;
  decoder_resource.SetHostResource(instance, decoder);

  HostDispatcher::GetForInstance(instance)->Send(
      new PpapiMsg_PPPVideoDecoder_PictureReady(
          API_ID_PPP_VIDEO_DECODER_DEV, decoder_resource, *picture));
}

void NotifyError(PP_Instance instance, PP_Resource decoder,
                 PP_VideoDecodeError_Dev error) {
  HostResource decoder_resource;
  decoder_resource.SetHostResource(instance, decoder);

  // It's possible that the error we're being notified about is happening
  // because the instance is shutting down. In this case, our instance may
  // already have been removed from the HostDispatcher map.
  HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
  if (dispatcher) {
    dispatcher->Send(
      new PpapiMsg_PPPVideoDecoder_NotifyError(
          API_ID_PPP_VIDEO_DECODER_DEV, decoder_resource, error));
  }
}

static const PPP_VideoDecoder_Dev video_decoder_interface = {
  &ProvidePictureBuffers,
  &DismissPictureBuffer,
  &PictureReady,
  &NotifyError
};

}  // namespace

PPP_VideoDecoder_Proxy::PPP_VideoDecoder_Proxy(Dispatcher* dispatcher)
    : InterfaceProxy(dispatcher),
      ppp_video_decoder_impl_(NULL) {
  if (dispatcher->IsPlugin()) {
    ppp_video_decoder_impl_ = static_cast<const PPP_VideoDecoder_Dev*>(
        dispatcher->local_get_interface()(PPP_VIDEODECODER_DEV_INTERFACE));
  }
}

PPP_VideoDecoder_Proxy::~PPP_VideoDecoder_Proxy() {
}

// static
const PPP_VideoDecoder_Dev* PPP_VideoDecoder_Proxy::GetProxyInterface() {
  return &video_decoder_interface;
}

bool PPP_VideoDecoder_Proxy::OnMessageReceived(const IPC::Message& msg) {
  if (!dispatcher()->IsPlugin())
    return false;

  bool handled = true;
  IPC_BEGIN_MESSAGE_MAP(PPP_VideoDecoder_Proxy, msg)
    IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_ProvidePictureBuffers,
                        OnMsgProvidePictureBuffers)
    IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_DismissPictureBuffer,
                        OnMsgDismissPictureBuffer)
    IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_PictureReady,
                        OnMsgPictureReady)
    IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_NotifyError,
                        OnMsgNotifyError)
    IPC_MESSAGE_UNHANDLED(handled = false)
  IPC_END_MESSAGE_MAP()
  DCHECK(handled);
  return handled;
}

void PPP_VideoDecoder_Proxy::OnMsgProvidePictureBuffers(
    const HostResource& decoder,
    uint32_t req_num_of_bufs,
    const PP_Size& dimensions,
    uint32_t texture_target) {
  PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()->
      PluginResourceForHostResource(decoder);
  if (!plugin_decoder)
    return;
  CallWhileUnlocked(ppp_video_decoder_impl_->ProvidePictureBuffers,
                    decoder.instance(),
                    plugin_decoder,
                    req_num_of_bufs,
                    &dimensions,
                    texture_target);
}

void PPP_VideoDecoder_Proxy::OnMsgDismissPictureBuffer(
    const HostResource& decoder, int32_t picture_id) {
  PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()->
      PluginResourceForHostResource(decoder);
  if (!plugin_decoder)
    return;
  CallWhileUnlocked(ppp_video_decoder_impl_->DismissPictureBuffer,
                    decoder.instance(),
                    plugin_decoder,
                    picture_id);
}

void PPP_VideoDecoder_Proxy::OnMsgPictureReady(
    const HostResource& decoder, const PP_Picture_Dev& picture) {
  PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()->
      PluginResourceForHostResource(decoder);
  if (!plugin_decoder)
    return;
  CallWhileUnlocked(ppp_video_decoder_impl_->PictureReady,
                    decoder.instance(),
                    plugin_decoder,
                    &picture);
}

void PPP_VideoDecoder_Proxy::OnMsgNotifyError(
    const HostResource& decoder, PP_VideoDecodeError_Dev error) {
  PP_Resource plugin_decoder = PluginGlobals::Get()->plugin_resource_tracker()->
      PluginResourceForHostResource(decoder);
  if (!plugin_decoder)
    return;
  CallWhileUnlocked(ppp_video_decoder_impl_->NotifyError,
                    decoder.instance(),
                    plugin_decoder,
                    error);
}

}  // namespace proxy
}  // namespace ppapi


text:
[![Latest Stable Version](https://poser.pugx.org/league/oauth2-server/v/stable.png)](https://packagist.org/packages/league/oauth2-server) [![Coverage Status](https://coveralls.io/repos/thephpleague/oauth2-server/badge.png?branch=master)](https://coveralls.io/r/thephpleague/oauth2-server?branch=master) [![Total Downloads](https://poser.pugx.org/league/oauth2-server/downloads.png)](https://packagist.org/packages/league/oauth2-server) [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/thephpleague/oauth2-server/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

A standards compliant [OAuth 2.0](http://tools.ietf.org/wg/oauth/draft-ietf-oauth-v2/) authorization server and resource server written in PHP.

## Package Installation

The framework is provided as a Composer package which can be installed by adding the package to your `composer.json` file:

```javascript
{
	"require": {
		"league/oauth2-server": "3.*"
	}
}
```

### Framework Integrations

* [Laravel Service Provider](https://packagist.org/packages/lucadegasperi/oauth2-server-laravel) by @lucadegasperi
* [Laravel Eloquent implementation](https://github.com/ScubaClick/scubaclick-oauth2) by @ScubaClick (under development)

---

The library features 100% unit test code coverage. To run the tests yourself run `phpunit` from the project root.

[![Build Status](https://travis-ci.org/thephpleague/oauth2-server.png?branch=master)](https://travis-ci.org/thephpleague/oauth2-server) [master]

[![Build Status](https://travis-ci.org/thephpleague/oauth2-server.png?branch=develop)](https://travis-ci.org/thephpleague/oauth2-server) [develop]

## Current Features

### Authorization Server

The authorization server is a flexible class and the following core specification grants are implemented:

* authorization code ([section 4.1](http://tools.ietf.org/html/rfc6749#section-4.1))
* refresh token ([section 6](http://tools.ietf.org/html/rfc6749#section-6))
* client credentials ([section 2.3.1](http://tools.ietf.org/html/rfc6749#section-2.3.1))
* password (user credentials) ([section 4.3](http://tools.ietf.org/html/rfc6749#section-4.3))

An [overview of the different OAuth 2.0 grants](https://github.com/thephpleague/oauth2-server/wiki/Which-OAuth-2.0-grant-should-I-use%3F) can be found in the [wiki].

### Resource Server

The resource server allows you to secure your API endpoints by checking for a valid OAuth access token in the request and ensuring the token has the correct scope(s) (i.e. permissions) to access resources.

### Custom grants

Custom grants can be created easily by implementing an interface. Check out the [custom grant guide](https://github.com/thephpleague/oauth2-server/wiki/Creating-custom-grants).

## Tutorials and Documentation

* **[Wiki]** - The wiki has lots of guides on how to use this library.

* **[Developing an OAuth-2.0 Authorization Server]** - A simple tutorial on how to use the authorization server.

* **[Securing your API with OAuth 2.0]** - A simple tutorial on how to use the resource server to secure an API server.

[Wiki]: https://github.com/thephpleague/oauth2-server/wiki
[Securing your API with OAuth 2.0]: https://github.com/thephpleague/oauth2-server/wiki/Securing-your-API-with-OAuth-2.0
[Developing an OAuth-2.0 Authorization Server]: https://github.com/thephpleague/oauth2-server/wiki/Developing-an-OAuth-2.0-authorization-server

## Changelog

[See the project releases page](https://github.com/thephpleague/oauth2-server/releases)

## Contributing

Please see [CONTRIBUTING](https://github.com/thephpleague/oauth2-server/blob/master/CONTRIBUTING.md) for details.

## Support

Bugs and feature request are tracked on [GitHub](https://github.com/thephpleague/oauth2-server/issues)

## License

This package is released under the MIT License. See the bundled [LICENSE](https://github.com/thephpleague/oauth2-server/blob/master/LICENSE) file for details.

## Credits

This code is principally developed and maintained by [Alex Bilbie](https://twitter.com/alexbilbie).

Special thanks to:

* [Dan Horrigan](https://github.com/dandoescode)
* [Nick Jackson](https://github.com/jacksonj04)
* [Michael Gooden](https://github.com/MichaelGooden)
* [Phil Sturgeon](https://github.com/philsturgeon)
* [and all the other contributors](https://github.com/thephpleague/oauth2-server/contributors)

The initial code was developed as part of the [Linkey](http://linkey.blogs.lincoln.ac.uk) project which was funded by [JISC](http://jisc.ac.uk) under the Access and Identity Management programme.

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/thephpleague/oauth2-server/trend.png)](https://bitdeli.com/free "Bitdeli Badge")


text:
.class Lcom/android/settings/dashboard/DashboardAdapter$IconCache;
.super Ljava/lang/Object;
.source "DashboardAdapter.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/settings/dashboard/DashboardAdapter;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "IconCache"
.end annotation

# instance fields
.field private final mContext:Landroid/content/Context;

.field private final mMap:Landroid/util/ArrayMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/util/ArrayMap",
            "<",
            "Landroid/graphics/drawable/Icon;",
            "Landroid/graphics/drawable/Drawable;",
            ">;"
        }
    .end annotation
.end field

# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    new-instance v0, Landroid/util/ArrayMap;

    invoke-direct {v0}, Landroid/util/ArrayMap;-><init>()V

    iput-object v0, p0, Lcom/android/settings/dashboard/DashboardAdapter$IconCache;->mMap:Landroid/util/ArrayMap;

    iput-object p1, p0, Lcom/android/settings/dashboard/DashboardAdapter$IconCache;->mContext:Landroid/content/Context;

    return-void
.end method

# virtual methods
.method public getIcon(Landroid/graphics/drawable/Icon;)Landroid/graphics/drawable/Drawable;
    .locals 2

    iget-object v1, p0, Lcom/android/settings/dashboard/DashboardAdapter$IconCache;->mMap:Landroid/util/ArrayMap;

    invoke-virtual {v1, p1}, Landroid/util/ArrayMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/graphics/drawable/Drawable;

    if-nez v0, :cond_0

    iget-object v1, p0, Lcom/android/settings/dashboard/DashboardAdapter$IconCache;->mContext:Landroid/content/Context;

    invoke-virtual {p1, v1}, Landroid/graphics/drawable/Icon;->loadDrawable(Landroid/content/Context;)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    iget-object v1, p0, Lcom/android/settings/dashboard/DashboardAdapter$IconCache;->mMap:Landroid/util/ArrayMap;

    invoke-virtual {v1, p1, v0}, Landroid/util/ArrayMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    :cond_0
    return-object v0
.end method


text:
.class final Landroid/support/v4/app/FragmentTabHost$ˊ;
.super Ljava/lang/Object;
.source ""

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/support/v4/app/FragmentTabHost;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x18
    name = "\u02ca"
.end annotation

# instance fields
.field private final ˊ:Ljava/lang/String;

.field private final ˋ:Ljava/lang/Class;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/Class<*>;"
        }
    .end annotation
.end field

.field private final ˎ:Landroid/os/Bundle;

.field private ˏ:Landroid/support/v4/app/Fragment;

# direct methods
.method constructor <init>(Ljava/lang/String;Ljava/lang/Class;Landroid/os/Bundle;)V
    .locals 0
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(Ljava/lang/String;Ljava/lang/Class<*>;Landroid/os/Bundle;)V"
        }
    .end annotation

    .line 67
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 68
    iput-object p1, p0, Landroid/support/v4/app/FragmentTabHost$ˊ;->ˊ:Ljava/lang/String;

    .line 69
    iput-object p2, p0, Landroid/support/v4/app/FragmentTabHost$ˊ;->ˋ:Ljava/lang/Class;

    .line 70
    iput-object p3, p0, Landroid/support/v4/app/FragmentTabHost$ˊ;->ˎ:Landroid/os/Bundle;

    .line 71
    return-void
.end method

.method static synthetic ˊ(Landroid/support/v4/app/FragmentTabHost$ˊ;)Landroid/support/v4/app/Fragment;
    .locals 1

    .line 61
    iget-object v0, p0, Landroid/support/v4/app/FragmentTabHost$ˊ;->ˏ:Landroid/support/v4/app/Fragment;

    return-object v0
.end method

.method static synthetic ˊ(Landroid/support/v4/app/FragmentTabHost$ˊ;Landroid/support/v4/app/Fragment;)Landroid/support/v4/app/Fragment;
    .locals 0

    .line 61
    iput-object p1, p0, Landroid/support/v4/app/FragmentTabHost$ˊ;->ˏ:Landroid/support/v4/app/Fragment;

    return-object p1
.end method

.method static synthetic ˋ(Landroid/support/v4/app/FragmentTabHost$ˊ;)Ljava/lang/String;
    .locals 1

    .line 61
    iget-object v0, p0, Landroid/support/v4/app/FragmentTabHost$ˊ;->ˊ:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic ˎ(Landroid/support/v4/app/FragmentTabHost$ˊ;)Ljava/lang/Class;
    .locals 1

    .line 61
    iget-object v0, p0, Landroid/support/v4/app/FragmentTabHost$ˊ;->ˋ:Ljava/lang/Class;

    return-object v0
.end method

.method static synthetic ˏ(Landroid/support/v4/app/FragmentTabHost$ˊ;)Landroid/os/Bundle;
    .locals 1

    .line 61
    iget-object v0, p0, Landroid/support/v4/app/FragmentTabHost$ˊ;->ˎ:Landroid/os/Bundle;

    return-object v0
.end method


text:
namespace std {
    template<> struct hash<bloom::HashParams<std::string>> {
        size_t operator()(bloom::HashParams<std::string> const& s) const {
            bloom::FnvHash32 h;
            h.Update(&s.b, sizeof(uint8_t));
            h.Update((const uint8_t *) s.a.data(), s.a.length());
            return h.Digest();
        }
    };
}

int main(int argc, char *argv[]){

    std::string t1 = "Hello world!";
    std::string t2 = "foo bar baz";

    bloom::CountingBloomFilter<std::string> bf(4, 32);

    bf.Insert(t1);

    if(!bf.Query(t1)){
        std::cout << "Error: Query for first inserted element was false." << std::endl;
        return 1;
    }

    if(bf.Query(t2)){
        std::cout << "Error: Query for non-inserted element was true." << std::endl;
        return 1;
    }

    bf.Insert(t2);

    if(!bf.Query(t2)){
        std::cout << "Error: Query for second inserted element was false." << std::endl;
        return 1;
    }

    if(!bf.Delete(t2)){
        std::cout << "Error: Failed to delete second inserted object." << std::endl;
        return 1;
    }

    if(bf.Query(t2)){
        std::cout << "Error: Query for deleted object was true." << std::endl;
        return 1;
    }

    if(!bf.Query(t1)){
        std::cout << "Error: Query for non-deleted object was false." << std::endl;
        return 1;
    }

    std::cout << "Tests passed." << std::endl;

    return 0;
}


text:
var apiUtils = require("../util");

var runtimeAPI;

module.exports = {
    init: function(_runtimeAPI) {
        runtimeAPI = _runtimeAPI;
    },
    getAll: function(req,res) {
        var opts = {
            user: req.user,
            req: apiUtils.getRequestLogObject(req)
        }
        if (req.get("accept") == "application/json") {
            runtimeAPI.nodes.getNodeList(opts).then(function(list) {
                res.json(list);
            })
        } else {
            opts.lang = apiUtils.determineLangFromHeaders(req.acceptsLanguages());
            runtimeAPI.nodes.getNodeConfigs(opts).then(function(configs) {
                res.send(configs);
            })
        }
    },

    post: function(req,res) {
        var opts = {
            user: req.user,
            module: req.body.module,
            version: req.body.version,
            req: apiUtils.getRequestLogObject(req)
        }
        runtimeAPI.nodes.addModule(opts).then(function(info) {
            res.json(info);
        }).catch(function(err) {
            apiUtils.rejectHandler(req,res,err);
        })
    },

    delete: function(req,res) {
        var opts = {
            user: req.user,
            module: req.params[0],
            req: apiUtils.getRequestLogObject(req)
        }
        runtimeAPI.nodes.removeModule(opts).then(function() {
            res.status(204).end();
        }).catch(function(err) {
            apiUtils.rejectHandler(req,res,err);
        })
    },

    getSet: function(req,res) {
        var opts = {
            user: req.user,
            id: req.params[0] + "/" + req.params[2],
            req: apiUtils.getRequestLogObject(req)
        }
        if (req.get("accept") === "application/json") {
            runtimeAPI.nodes.getNodeInfo(opts).then(function(result) {
                res.send(result);
            }).catch(function(err) {
                apiUtils.rejectHandler(req,res,err);
            })
        } else {
            opts.lang = apiUtils.determineLangFromHeaders(req.acceptsLanguages());
            runtimeAPI.nodes.getNodeConfig(opts).then(function(result) {
                return res.send(result);
            }).catch(function(err) {
                apiUtils.rejectHandler(req,res,err);
            })
        }
    },

    getModule: function(req,res) {
        var opts = {
            user: req.user,
            module: req.params[0],
            req: apiUtils.getRequestLogObject(req)
        }
        runtimeAPI.nodes.getModuleInfo(opts).then(function(result) {
            res.send(result);
        }).catch(function(err) {
            apiUtils.rejectHandler(req,res,err);
        })
    },

    putSet: function(req,res) {
        var body = req.body;
        if (!body.hasOwnProperty("enabled")) {
            // log.audit({event: "nodes.module.set",error:"invalid_request"},req);
            res.status(400).json({code:"invalid_request", message:"Invalid request"});
            return;
        }
        var opts = {
            user: req.user,
            id: req.params[0] + "/" + req.params[2],
            enabled: body.enabled,
            req: apiUtils.getRequestLogObject(req)
        }
        runtimeAPI.nodes.setNodeSetState(opts).then(function(result) {
            res.send(result);
        }).catch(function(err) {
            apiUtils.rejectHandler(req,res,err);
        })
    },

    putModule: function(req,res) {
        var body = req.body;
        if (!body.hasOwnProperty("enabled")) {
            // log.audit({event: "nodes.module.set",error:"invalid_request"},req);
            res.status(400).json({code:"invalid_request", message:"Invalid request"});
            return;
        }
        var opts = {
            user: req.user,
            module: req.params[0],
            enabled: body.enabled,
            req: apiUtils.getRequestLogObject(req)
        }
        runtimeAPI.nodes.setModuleState(opts).then(function(result) {
            res.send(result);
        }).catch(function(err) {
            apiUtils.rejectHandler(req,res,err);
        })

    },

    getModuleCatalog: function(req,res) {
        var opts = {
            user: req.user,
            module: req.params[0],
            lang: req.query.lng,
            req: apiUtils.getRequestLogObject(req)
        }
        runtimeAPI.nodes.getModuleCatalog(opts).then(function(result) {
            res.json(result);
        }).catch(function(err) {
            console.log(err.stack);
            apiUtils.rejectHandler(req,res,err);
        })
    },

    getModuleCatalogs: function(req,res) {
        var opts = {
            user: req.user,
            lang: req.query.lng,
            req: apiUtils.getRequestLogObject(req)
        }
        runtimeAPI.nodes.getModuleCatalogs(opts).then(function(result) {
            res.json(result);
        }).catch(function(err) {
            console.log(err.stack);
            apiUtils.rejectHandler(req,res,err);
        })
    },

    getIcons: function(req,res) {
        var opts = {
            user: req.user,
            req: apiUtils.getRequestLogObject(req)
        }
        runtimeAPI.nodes.getIconList(opts).then(function(list) {
            res.json(list);
        });
    }
};


text:
package com.thebluealliance.androidclient.test.notifications;

import com.thebluealliance.androidclient.gcm.notifications.BaseNotification;
import com.thebluealliance.androidclient.gcm.notifications.UpcomingMatchNotification;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;

/**
 * Created by phil on 2/7/15.
 */
@RunWith(RobolectricTestRunner.class)
public class UpcomingMatchNotificationTest {
    BaseNotification notification;
    String messageData = "{ \"event_name\" : \"New England FRC Region Championship\",\n" +
            "  \"match_key\" : \"2014necmp_f1m1\",\n" +
            "  \"predicted_time\" : 1397330280,\n" +
            "  \"scheduled_time\" : 1397330280,\n" +
            "  \"team_keys\" : [ \"frc195\",\n" +
            "      \"frc558\",\n" +
            "      \"frc5122\",\n" +
            "      \"frc177\",\n" +
            "      \"frc230\",\n" +
            "      \"frc4055\"\n" +
            "    ]\n" +
            "}";

    @Before
    public void setupNotification(){
        notification = new UpcomingMatchNotification(messageData);
    }

    @Test
    public void testParseJson(){
        notification.parseMessageData();
    }
}


text:
package org.elasticsearch.hadoop.serialization.json;

import java.io.ByteArrayOutputStream;

import org.elasticsearch.hadoop.serialization.Generator;
import org.junit.Test;

import static org.junit.Assert.*;

public class JacksonJsonGeneratorTest {

    @Test
    public void getParentPath() throws Exception {
        ByteArrayOutputStream bos = new ByteArrayOutputStream(256);
        Generator generator = new JacksonJsonGenerator(bos);

        // root level, no parents here
        generator.writeBeginObject();
        assertEquals("", generator.getParentPath());

        // We're still in the root level. "test" is just current field.
        generator.writeFieldName("test");
        assertEquals("", generator.getParentPath());

        // Nest into an object. "test" is the parent to all following fields.
        generator.writeBeginObject();
        assertEquals("test", generator.getParentPath());

        // "test" still parent. "subfield" is just current field
        generator.writeFieldName("subfield");
        assertEquals("test", generator.getParentPath());

        // Nest into another object. "test.subfield" is now parent to following fields.
        generator.writeBeginObject();
        assertEquals("test.subfield", generator.getParentPath());

        // Still same parent, "subsubfield" is just current field
        generator.writeFieldName("subsubfield");
        assertEquals("test.subfield", generator.getParentPath());

        // Still same parent
        generator.writeString("value");
        assertEquals("test.subfield", generator.getParentPath());

        // End second nesting, so we're done with the "subfield" object. "test" is back to being parent
        generator.writeEndObject();
        assertEquals("test", generator.getParentPath());

        // End first nesting. Back at root. No parents.
        generator.writeEndObject();
        assertEquals("", generator.getParentPath());

        // End root object. No parents
        generator.writeEndObject();
        assertEquals("", generator.getParentPath());

        generator.flush();
        assertEquals("{\"test\":{\"subfield\":{\"subsubfield\":\"value\"}}}", new String(bos.toByteArray()));
    }
}


text:
package com.sonymobile.tools.gerrit.gerritevents.watchdog;

import com.sonymobile.tools.gerrit.gerritevents.Connector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.TimeUnit;

/**
 * Monitors the last time something came in on the stream-events connection (via signal from the controller/handler).
 * And restarts the connection if the timeout has passed.
 *
 * @author Robert Sandell <robert.sandell@sonymobile.com>
 */
public class StreamWatchdog extends TimerTask {

    /**
     * Default millis until first timeout check.
     *
     * @see Timer#schedule(java.util.TimerTask, long, long)
     */
    public static final long DEFAULT_CHECK_START_DELAY = TimeUnit.MINUTES.toMillis(1);
    /**
     * Default millis between timeout checks.
     *
     * @see Timer#schedule(java.util.TimerTask, long, long)
     */
    public static final long DEFAULT_CHECK_PERIOD = TimeUnit.SECONDS.toMillis(20);

    private static final Logger logger = LoggerFactory.getLogger(StreamWatchdog.class);

    private long lastSignal;
    private Timer timer;
    private Connector connector;
    private int timeoutSeconds;
    private WatchTimeExceptionData exceptionData;

    /**
     * Standard Constructor. Same as calling <code> StreamWatchdog(connector, timeoutSeconds, exceptionData,
     * DEFAULT_CHECK_START_DELAY, DEFAULT_CHECK_PERIOD) </code>
     *
     * @param connector    the connector who can do the actual restart of the connection.
     * @param timeoutSeconds number of seconds before a timeout should occur.
     * @param exceptionData  time spans and days when the timeout trigger should not be in effect.
     * @see #StreamWatchdog(Connector, int, WatchTimeExceptionData, long, long)
     */
    public StreamWatchdog(Connector connector, int timeoutSeconds, WatchTimeExceptionData exceptionData) {
        this(connector, timeoutSeconds, exceptionData, DEFAULT_CHECK_START_DELAY, DEFAULT_CHECK_PERIOD);
    }

    /**
     * Standard Constructor.
     *
     * @param connector     the connector who can do the actual restart of the connection.
     * @param timeoutSeconds  number of seconds before a timeout should occur.
     * @param exceptionData   time spans and days when the timeout trigger should not be in effect.
     * @param checkStartDelay millis until the first timeout check should be performed
     * @param checkPeriod     millis between timeout checks
     */
    public StreamWatchdog(Connector connector, int timeoutSeconds, WatchTimeExceptionData exceptionData,
                          long checkStartDelay, long checkPeriod) {
        this.connector = connector;
        this.timeoutSeconds = timeoutSeconds;
        this.exceptionData = exceptionData;
        lastSignal = System.currentTimeMillis();
        timer = new Timer(StreamWatchdog.class.getName());
        timer.schedule(this, checkStartDelay, checkPeriod);
    }

    @Override
    public void run() {
        if (!exceptionData.isExceptionNow()) {
            long quietTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - getLastSignal());
            logger.debug("Quiet time: {}", quietTime);
            if (quietTime >= timeoutSeconds) {
                logger.info("Last lively connection with Gerrit was {} seconds ago; reconnecting.", quietTime);
                connector.reconnect();
            }
        }
    }

    /**
     * The current time millis since last we got a signal.
     *
     * @return ms since the last epoch.
     *
     * @see System#currentTimeMillis()
     * @see #signal()
     */
    public synchronized long getLastSignal() {
        return lastSignal;
    }

    /**
     * Signals that something has come through the wire. Resetting the countdown to an eventual connection restart.
     */
    public synchronized void signal() {
        lastSignal = System.currentTimeMillis();
    }

    /**
     * Shuts down the watchdog timer. A new StreamWatchdog will need to be created to continue watching it.
     */
    public void shutdown() {
        if (timer != null) {
            timer.cancel();
        }
    }
}


text:
<!doctype html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Archive for posts dated '13 February 2008' | Lee Kelleher - Umbraco Consultant</title>
	<meta name="description" content="The personal website of Lee Kelleher; Umbraco Consultant">
	<meta name="keywords" content="leekelleher,kelleher,umbraco,asp.net,c#,csharp,xslt,mvc,mvp">
	<meta name="generator" content="Wyam">
	<meta name="twitter:card" content="summary">
	<meta name="twitter:site" content="@leekelleher">
	<meta name="twitter:url" property="og:url" content="https://leekelleher.com/2008/02/13/">
	<meta name="twitter:title" property="og:title" content="Archive for posts dated '13 February 2008'">
	<meta name="twitter:description" property="og:description" content="The personal website of Lee Kelleher; Umbraco Consultant">
	<meta name="twitter:image" property="og:image" content="https://leekelleher.com/assets/img/nxnw_300x300.jpg">
	<link rel="alternate" href="https://leekelleher.com/feed/" type="application/rss+xml">
	<link rel="canonical" href="https://leekelleher.com/2008/02/13/">
	<link rel="pingback" href="https://webmention.io/leekelleher.com/xmlrpc">
	<link rel="webmention" href="https://webmention.io/leekelleher.com/webmention">
	<link rel="stylesheet" href="/assets/css/style.css">

Lee Kelleher

About

Now

Contact

Archive for posts dated '13 February 2008'

February 2008

WordPress: “post.php” is blank after publishing

				Posted on <time datetime="2008-02-13T19:31+00:00">13/02/2008</time>.
				Estimated read time:  under a minute (127 words)

Whilst I was helping out Bookninja earlier this week, I came across a strange problem in WordPress. Every time we tried to publish a new blog post (or page), there would be a pause, then the page would go blank. (This was on the "post.php" page) I spent a long time trying to figure out what the issue was… even longer googling it! Several pages into the Google results, I found the answer! Thank you…

Tags: bookninja, google, php, ping, trouble-shooting, WordPress

All hail “The Bookninja Messiah”!

				Posted on <time datetime="2008-02-13T20:50+00:00">13/02/2008</time>.
				Estimated read time:  2 minutes (333 words)

Earlier this week I'd heard that Bookninja had been hijacked, they needed some help to get their WordPress back in working order. Mark suggested that I offered my services, so I did. George explained what the problems since the hijack: Unable to publish blog posts and pages; (a blank page appeared when he tried to publish) All the pages had been delete, or disappeared. Akismet was turned off… opening the floodgates to lots of unwanted…

Tags: akismet, bookninja, google, messiah, pages, posts, readysteadybook, spam, sql, WordPress

Year archive

				2020

							January

				2019

							January

							February

							April

							August

				2018

							January

							August

							November

							December

				2016

							March

							May

							June

							July

							August

							September

							October

				2014

							March

							May

							November

				2013

							September

							October

							November

							December

				2012

							February

				2011

							January

							June

							July

							September

							October

				2010

							January

							April

							May

							August

				2009

							January

							February

							April

							June

							July

							September

							October

							November

				2008

							January

							February

							March

							April

							May

							June

							July

							August

							November

							December

				2007

							January

							February

							March

							April

							May

							June

							November

							December

				2006

							March

							April

							June

							October

							November

							December

Tag archive

View a weighted tag cloud and a listing of all tags.

For any feedback, comments or questions, feel free to ask me via my contact page, on Twitter, or on GitHub.

Be notified of new posts, subscribe to my RSS feed.

All content by Lee Kelleher (© 2006-2021) and licensed under Creative Commons. All code snippets are licensed under the MIT license.

This website is statically generated using Wyam. All code and content for this blog is available as open source on GitHub.


text:
package com.cloudera.sa.apptrans.server.kudu

import org.kududb.client.KuduClient

object KuduGlobalValues {

  var appEventTableName = "app_event_kudu"
  var accountMartTableName = "account_mart_kudu"

  var kuduClient:KuduClient = null

  def init(kuduMaster:String,
           appEventTableName:String,
           accountMartTableName:String): Unit = {

    println("kuduMaster:" + kuduMaster)
    println("appEventTableName:" + appEventTableName)
    println("accountMartTableName:" + accountMartTableName)

    kuduClient = new KuduClient.KuduClientBuilder(kuduMaster).build()
    this.appEventTableName = appEventTableName
    this.accountMartTableName = accountMartTableName
  }

}


text:
//
//  SFBrandCollectionViewCell.m
//  SFE
//
//  Created by ma c on 16/9/1.
//  Copyright © 2016年 shifei. All rights reserved.
//

#import "SFBrandCollectionViewCell.h"

@interface SFBrandCollectionViewCell ()

/**商品图片*/
@property (strong, nonatomic) UIImageView *iconImage;

@end

@implementation SFBrandCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self.contentView addSubview:self.iconImage];
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];

    __weak typeof(self) weakSelf = self;
    [self.iconImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(weakSelf);
    }];
}

#pragma mark - setter and getter
- (void)setBrandItem:(SFClassBrandItem *)brandItem {
//    _brandItem = brandItem;
    [self.iconImage sd_setImageWithURL:[NSURL URLWithString:brandItem.ImgView]];
}

- (UIImageView *)iconImageView{
    if (!_iconImage) {
        _iconImage = [[UIImageView alloc]init];
    }
    return _iconImage;
}

@end


text:
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {str, util} from '../../../common/js/util.js';

import {ConfirmDialog} from './dialogs.js';

/**
 * ImportCrostiniImageDialog is used as the handler for .tini files.
 */
  /**
   * Creates dialog in DOM.
   */
export class ImportCrostiniImageDialog extends ConfirmDialog {
  /**
   * @param {HTMLElement} parentNode Node to be parent for this dialog.
   */
  constructor(parentNode) {
    super(parentNode);
    super.setOkLabel(str('IMPORT_CROSTINI_IMAGE_DIALOG_OK_LABEL'));

    this.container.classList.add('files-ng');
  }

  /**
   * Shows the dialog.
   *
   * @param {!Entry} entry
   */
  showImportCrostiniImageDialog(entry) {
    super.showWithTitle(
        str('IMPORT_CROSTINI_IMAGE_DIALOG_TITLE'),
        str('IMPORT_CROSTINI_IMAGE_DIALOG_DESCRIPTION'),
        chrome.fileManagerPrivate.importCrostiniImage.bind(null, entry));
  }
}


text:
"""This module contains Google Dataplex operators."""
from __future__ import annotations

from time import sleep
from typing import TYPE_CHECKING, Any, Sequence

if TYPE_CHECKING:
    from airflow.utils.context import Context

from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
from google.api_core.retry import Retry, exponential_sleep_generator
from google.cloud.dataplex_v1.types import Task
from googleapiclient.errors import HttpError

from airflow.models import BaseOperator
from airflow.providers.google.cloud.hooks.dataplex import DataplexHook
from airflow.providers.google.cloud.links.dataplex import DataplexTaskLink, DataplexTasksLink

class DataplexCreateTaskOperator(BaseOperator):
    """
    Creates a task resource within a lake.

    :param project_id: Required. The ID of the Google Cloud project that the task belongs to.
    :param region: Required. The ID of the Google Cloud region that the task belongs to.
    :param lake_id: Required. The ID of the Google Cloud lake that the task belongs to.
    :param body:  Required. The Request body contains an instance of Task.
    :param dataplex_task_id: Required. Task identifier.
    :param validate_only: Optional. Only validate the request, but do not perform mutations. The default is
        false.
    :param api_version: The version of the api that will be requested for example 'v3'.
    :param retry: A retry object used  to retry requests. If `None` is specified, requests
        will not be retried.
    :param timeout: The amount of time, in seconds, to wait for the request to complete.
        Note that if `retry` is specified, the timeout applies to each individual attempt.
    :param metadata: Additional metadata that is provided to the method.
    :param gcp_conn_id: The connection ID to use when fetching connection info.
    :param delegate_to: The account to impersonate, if any. For this to work, the service accountmaking the
        request must have  domain-wide delegation enabled.
    :param impersonation_chain: Optional service account to impersonate using short-term
        credentials, or chained list of accounts required to get the access_token
        of the last account in the list, which will be impersonated in the request.
        If set as a string, the account must grant the originating account
        the Service Account Token Creator IAM role.
        If set as a sequence, the identities from the list must grant
        Service Account Token Creator IAM role to the directly preceding identity, with first
        account from the list granting this role to the originating account (templated).
    :param asynchronous: Flag informing should the Dataplex task be created asynchronously.
        This is useful for long running creating tasks and
        waiting on them asynchronously using the DataplexTaskSensor
    """

    template_fields = (
        "project_id",
        "dataplex_task_id",
        "body",
        "validate_only",
        "delegate_to",
        "impersonation_chain",
    )
    template_fields_renderers = {"body": "json"}
    operator_extra_links = (DataplexTaskLink(),)

    def __init__(
        self,
        project_id: str,
        region: str,
        lake_id: str,
        body: dict[str, Any],
        dataplex_task_id: str,
        validate_only: bool | None = None,
        api_version: str = "v1",
        retry: Retry | _MethodDefault = DEFAULT,
        timeout: float | None = None,
        metadata: Sequence[tuple[str, str]] = (),
        gcp_conn_id: str = "google_cloud_default",
        delegate_to: str | None = None,
        impersonation_chain: str | Sequence[str] | None = None,
        asynchronous: bool = False,
        *args,
        **kwargs,
    ) -> None:
        super().__init__(*args, **kwargs)
        self.project_id = project_id
        self.region = region
        self.lake_id = lake_id
        self.body = body
        self.dataplex_task_id = dataplex_task_id
        self.validate_only = validate_only
        self.api_version = api_version
        self.retry = retry
        self.timeout = timeout
        self.metadata = metadata
        self.gcp_conn_id = gcp_conn_id
        self.delegate_to = delegate_to
        self.impersonation_chain = impersonation_chain
        self.asynchronous = asynchronous

    def execute(self, context: Context) -> dict:
        hook = DataplexHook(
            gcp_conn_id=self.gcp_conn_id,
            delegate_to=self.delegate_to,
            api_version=self.api_version,
            impersonation_chain=self.impersonation_chain,
        )
        self.log.info("Creating Dataplex task %s", self.dataplex_task_id)
        DataplexTaskLink.persist(context=context, task_instance=self)

        try:
            operation = hook.create_task(
                project_id=self.project_id,
                region=self.region,
                lake_id=self.lake_id,
                body=self.body,
                dataplex_task_id=self.dataplex_task_id,
                validate_only=self.validate_only,
                retry=self.retry,
                timeout=self.timeout,
                metadata=self.metadata,
            )
            if not self.asynchronous:
                self.log.info("Waiting for Dataplex task %s to be created", self.dataplex_task_id)
                task = hook.wait_for_operation(timeout=self.timeout, operation=operation)
                self.log.info("Task %s created successfully", self.dataplex_task_id)
            else:
                is_done = operation.done()
                self.log.info("Is operation done already? %s", is_done)
                return is_done
        except HttpError as err:
            if err.resp.status not in (409, "409"):
                raise
            self.log.info("Task %s already exists", self.dataplex_task_id)
            # Wait for task to be ready
            for time_to_wait in exponential_sleep_generator(initial=10, maximum=120):
                task = hook.get_task(
                    project_id=self.project_id,
                    region=self.region,
                    lake_id=self.lake_id,
                    dataplex_task_id=self.dataplex_task_id,
                    retry=self.retry,
                    timeout=self.timeout,
                    metadata=self.metadata,
                )
                if task["state"] != "CREATING":
                    break
                sleep(time_to_wait)

        return Task.to_dict(task)

class DataplexDeleteTaskOperator(BaseOperator):
    """
    Delete the task resource.

    :param project_id: Required. The ID of the Google Cloud project that the task belongs to.
    :param region: Required. The ID of the Google Cloud region that the task belongs to.
    :param lake_id: Required. The ID of the Google Cloud lake that the task belongs to.
    :param dataplex_task_id: Required. Task identifier.
    :param api_version: The version of the api that will be requested for example 'v3'.
    :param retry: A retry object used  to retry requests. If `None` is specified, requests
        will not be retried.
    :param timeout: The amount of time, in seconds, to wait for the request to complete.
        Note that if `retry` is specified, the timeout applies to each individual attempt.
    :param metadata: Additional metadata that is provided to the method.
    :param gcp_conn_id: The connection ID to use when fetching connection info.
    :param delegate_to: The account to impersonate, if any. For this to work, the service accountmaking the
        request must have  domain-wide delegation enabled.
    :param impersonation_chain: Optional service account to impersonate using short-term
        credentials, or chained list of accounts required to get the access_token
        of the last account in the list, which will be impersonated in the request.
        If set as a string, the account must grant the originating account
        the Service Account Token Creator IAM role.
        If set as a sequence, the identities from the list must grant
        Service Account Token Creator IAM role to the directly preceding identity, with first
        account from the list granting this role to the originating account (templated).
    """

    template_fields = ("project_id", "dataplex_task_id", "delegate_to", "impersonation_chain")

    def __init__(
        self,
        project_id: str,
        region: str,
        lake_id: str,
        dataplex_task_id: str,
        api_version: str = "v1",
        retry: Retry | _MethodDefault = DEFAULT,
        timeout: float | None = None,
        metadata: Sequence[tuple[str, str]] = (),
        gcp_conn_id: str = "google_cloud_default",
        delegate_to: str | None = None,
        impersonation_chain: str | Sequence[str] | None = None,
        *args,
        **kwargs,
    ) -> None:
        super().__init__(*args, **kwargs)
        self.project_id = project_id
        self.region = region
        self.lake_id = lake_id
        self.dataplex_task_id = dataplex_task_id
        self.api_version = api_version
        self.retry = retry
        self.timeout = timeout
        self.metadata = metadata
        self.gcp_conn_id = gcp_conn_id
        self.delegate_to = delegate_to
        self.impersonation_chain = impersonation_chain

    def execute(self, context: Context) -> None:
        hook = DataplexHook(
            gcp_conn_id=self.gcp_conn_id,
            delegate_to=self.delegate_to,
            api_version=self.api_version,
            impersonation_chain=self.impersonation_chain,
        )
        self.log.info("Deleting Dataplex task %s", self.dataplex_task_id)

        operation = hook.delete_task(
            project_id=self.project_id,
            region=self.region,
            lake_id=self.lake_id,
            dataplex_task_id=self.dataplex_task_id,
            retry=self.retry,
            timeout=self.timeout,
            metadata=self.metadata,
        )
        hook.wait_for_operation(timeout=self.timeout, operation=operation)
        self.log.info("Dataplex task %s deleted successfully!", self.dataplex_task_id)

class DataplexListTasksOperator(BaseOperator):
    """
    Lists tasks under the given lake.

    :param project_id: Required. The ID of the Google Cloud project that the task belongs to.
    :param region: Required. The ID of the Google Cloud region that the task belongs to.
    :param lake_id: Required. The ID of the Google Cloud lake that the task belongs to.
    :param page_size: Optional. Maximum number of tasks to return. The service may return fewer than this
        value. If unspecified, at most 10 tasks will be returned. The maximum value is 1000; values above 1000
        will be coerced to 1000.
    :param page_token: Optional. Page token received from a previous ListZones call. Provide this to retrieve
        the subsequent page. When paginating, all other parameters provided to ListZones must match the call
        that provided the page token.
    :param filter: Optional. Filter request.
    :param order_by: Optional. Order by fields for the result.
    :param api_version: The version of the api that will be requested for example 'v3'.
    :param retry: A retry object used  to retry requests. If `None` is specified, requests
        will not be retried.
    :param timeout: The amount of time, in seconds, to wait for the request to complete.
        Note that if `retry` is specified, the timeout applies to each individual attempt.
    :param metadata: Additional metadata that is provided to the method.
    :param gcp_conn_id: The connection ID to use when fetching connection info.
    :param delegate_to: The account to impersonate, if any. For this to work, the service accountmaking the
        request must have  domain-wide delegation enabled.
    :param impersonation_chain: Optional service account to impersonate using short-term
        credentials, or chained list of accounts required to get the access_token
        of the last account in the list, which will be impersonated in the request.
        If set as a string, the account must grant the originating account
        the Service Account Token Creator IAM role.
        If set as a sequence, the identities from the list must grant
        Service Account Token Creator IAM role to the directly preceding identity, with first
        account from the list granting this role to the originating account (templated).
    """

    template_fields = (
        "project_id",
        "page_size",
        "page_token",
        "filter",
        "order_by",
        "delegate_to",
        "impersonation_chain",
    )
    operator_extra_links = (DataplexTasksLink(),)

    def __init__(
        self,
        project_id: str,
        region: str,
        lake_id: str,
        page_size: int | None = None,
        page_token: str | None = None,
        filter: str | None = None,
        order_by: str | None = None,
        api_version: str = "v1",
        retry: Retry | _MethodDefault = DEFAULT,
        timeout: float | None = None,
        metadata: Sequence[tuple[str, str]] = (),
        gcp_conn_id: str = "google_cloud_default",
        delegate_to: str | None = None,
        impersonation_chain: str | Sequence[str] | None = None,
        *args,
        **kwargs,
    ) -> None:
        super().__init__(*args, **kwargs)
        self.project_id = project_id
        self.region = region
        self.lake_id = lake_id
        self.page_size = page_size
        self.page_token = page_token
        self.filter = filter
        self.order_by = order_by
        self.api_version = api_version
        self.retry = retry
        self.timeout = timeout
        self.metadata = metadata
        self.gcp_conn_id = gcp_conn_id
        self.delegate_to = delegate_to
        self.impersonation_chain = impersonation_chain

    def execute(self, context: Context) -> list[dict]:
        hook = DataplexHook(
            gcp_conn_id=self.gcp_conn_id,
            delegate_to=self.delegate_to,
            api_version=self.api_version,
            impersonation_chain=self.impersonation_chain,
        )
        self.log.info("Listing Dataplex tasks from lake %s", self.lake_id)
        DataplexTasksLink.persist(context=context, task_instance=self)

        tasks = hook.list_tasks(
            project_id=self.project_id,
            region=self.region,
            lake_id=self.lake_id,
            page_size=self.page_size,
            page_token=self.page_token,
            filter=self.filter,
            order_by=self.order_by,
            retry=self.retry,
            timeout=self.timeout,
            metadata=self.metadata,
        )
        return [Task.to_dict(task) for task in tasks]

class DataplexGetTaskOperator(BaseOperator):
    """
    Get task resource.

    :param project_id: Required. The ID of the Google Cloud project that the task belongs to.
    :param region: Required. The ID of the Google Cloud region that the task belongs to.
    :param lake_id: Required. The ID of the Google Cloud lake that the task belongs to.
    :param dataplex_task_id: Required. Task identifier.
    :param api_version: The version of the api that will be requested for example 'v3'.
    :param retry: A retry object used  to retry requests. If `None` is specified, requests
        will not be retried.
    :param timeout: The amount of time, in seconds, to wait for the request to complete.
        Note that if `retry` is specified, the timeout applies to each individual attempt.
    :param metadata: Additional metadata that is provided to the method.
    :param gcp_conn_id: The connection ID to use when fetching connection info.
    :param delegate_to: The account to impersonate, if any. For this to work, the service accountmaking the
        request must have  domain-wide delegation enabled.
    :param impersonation_chain: Optional service account to impersonate using short-term
        credentials, or chained list of accounts required to get the access_token
        of the last account in the list, which will be impersonated in the request.
        If set as a string, the account must grant the originating account
        the Service Account Token Creator IAM role.
        If set as a sequence, the identities from the list must grant
        Service Account Token Creator IAM role to the directly preceding identity, with first
        account from the list granting this role to the originating account (templated).
    """

    template_fields = ("project_id", "dataplex_task_id", "delegate_to", "impersonation_chain")
    operator_extra_links = (DataplexTaskLink(),)

    def __init__(
        self,
        project_id: str,
        region: str,
        lake_id: str,
        dataplex_task_id: str,
        api_version: str = "v1",
        retry: Retry | _MethodDefault = DEFAULT,
        timeout: float | None = None,
        metadata: Sequence[tuple[str, str]] = (),
        gcp_conn_id: str = "google_cloud_default",
        delegate_to: str | None = None,
        impersonation_chain: str | Sequence[str] | None = None,
        *args,
        **kwargs,
    ) -> None:
        super().__init__(*args, **kwargs)
        self.project_id = project_id
        self.region = region
        self.lake_id = lake_id
        self.dataplex_task_id = dataplex_task_id
        self.api_version = api_version
        self.retry = retry
        self.timeout = timeout
        self.metadata = metadata
        self.gcp_conn_id = gcp_conn_id
        self.delegate_to = delegate_to
        self.impersonation_chain = impersonation_chain

    def execute(self, context: Context) -> dict:
        hook = DataplexHook(
            gcp_conn_id=self.gcp_conn_id,
            delegate_to=self.delegate_to,
            api_version=self.api_version,
            impersonation_chain=self.impersonation_chain,
        )
        self.log.info("Retrieving Dataplex task %s", self.dataplex_task_id)
        DataplexTaskLink.persist(context=context, task_instance=self)

        task = hook.get_task(
            project_id=self.project_id,
            region=self.region,
            lake_id=self.lake_id,
            dataplex_task_id=self.dataplex_task_id,
            retry=self.retry,
            timeout=self.timeout,
            metadata=self.metadata,
        )
        return Task.to_dict(task)


text:
CERTHOME=/srv/kubernetes
SERVKEY=${CERTHOME}/server.key
SERVCERT=${CERTHOME}/server.cert
CA=${CERTHOME}/${CACERT}
NEWNAME=tcotav

openssl genrsa -out ${NEWNAME}.pem 2048
openssl req -new -key ${NEWNAME}.pem -out ${NEWNAME}.csr -subj "/CN=${NEWNAME},O=admin"
openssl x509 -req -in ${NEWNAME}.csr -CA ${SERVCERT} -CAkey ${SERVKEY} -CAcreateserial -out ${NEWNAME}.crt -days 365


text:
WP Angular
==========

## Warning: This is a BETA

Use this code under your responsability.

## Demo

You can see a demo here http://wpangular.bdunk.com

## Design based on this template

http://startbootstrap.com/template-overviews/clean-blog/

## Quick Test

Clone repository and then:

```
bower install

npm install

grunt serve
```

## Why this?

1) My first reason is progressing with Angular JS.

2) I have been working for years with WP and I don't like the structure of the themes.

3) There is an excellent job here: https://wordpress.org/plugins/angularjs-for-wp/ but it's a theme which includes PHP.

4) Page goes faster.

## In your own WordPress

1) We start from a clean install of WordPress :

http://codex.wordpress.org/Installing_WordPress

2) Install the following plugins:

a) JSON API: https://wordpress.org/plugins/json-api/

There are other plugins, some more famous even, but this has the advantage that it's very easy to add new options as discussed below.

Copy this file (https://raw.githubusercontent.com/monchopena/wp-angular/master/wordpress/wp-content/plugins/json-api/controllers/angular.php) into 'controllers' folder.

Let 'Settings> JSON API "and activate the following controls. Widgets, Core, Respond and Angular. The screen would look like this:

![alt json_api_settings](https://raw.githubusercontent.com/monchopena/wp-angular/master/captures/json_api_settings.png)

Activate permalinks (not mandatory but is nicer).

Now if you go to the following url https://yourdomain.com/api/get_post/?slug=hello-world should display a JSON. If not, is that something has gone seriously wrong.

If we want to access the API from a different URL tha WP, we have several options. For example, if Apache is used you can add to .htaccess

```
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
```

b) Social Icons Widget: https://wordpress.org/plugins/social-icons-widget/

With this widget we'll learn how to access to a widget information from the API.

This widget has github wishlist (OMG!). No problem. Let's add in a copy of this file (https://raw.githubusercontent.com/monchopena/wp-angular/master/wordpress/wp-content/plugins/social-icons-widget/social-icons-widget.php).

From 'Appearance> Widgets' we add the widget to Footer and fill any of the fields, eg Twitter, Facebook and Github.

You can change this easily in the file app/index.html.

3) Header Image: from Appearance> Header add a background image.

4) Add a menu to wordpress with the name "main". Sample:

![alt menu_main](https://raw.githubusercontent.com/monchopena/wp-angular/master/captures/menu_main.png)

5) Contact: create a page called "contact". In the comments of this page you will see requests from the form.

6) Show the description in page: this requires creating one custom field called description

![alt custom_field_description](https://raw.githubusercontent.com/monchopena/wp-angular/master/captures/custom_field_description.png)

7) In posts fill excerp field and you'll see like a description.

8) Change in app/scripts/app.js the URL of the API. for example

```js
api_url var = 'https://puchi-cuchi.rhcloud.com/api';
```

## License

[The MIT License (MIT)](https://raw.githubusercontent.com/monchopena/wp-angular/master/LICENSE).


text:
""""
README
======
This is a Python code.
======
"""

""" Linear regression with SciPy """
from scipy import stats

stock_returns = [0.065, 0.0265, -0.0593, -0.001, 0.0346]
mkt_returns = [0.055, -0.09, -0.041, 0.045, 0.022]

beta, alpha, r_value, p_value, std_err = \
    stats.linregress(stock_returns, mkt_returns)
print beta, alpha

""" Calculating the SML """
rf = 0.05
mrisk_prem = 0.085
risk_prem = mrisk_prem * beta
print "Risk premium:", risk_prem

expected_stock_return = rf + risk_prem
print "Expected stock return:", expected_stock_return


text:
require 'active_model'

module AUB
  module Payroll
    class EPFFile::Footer
      include ActiveModel::Model

      attr_accessor :number_of_records, :total_amount

      validates :number_of_records, numericality: { greater_than: 0, less_than_or_equal_to: 999_999 }
      validates :total_amount, numericality: { greater_than: 0, less_than_or_equal_to: 999_999_999_999.99 }

      # @param [Integer] number_of_records:
      # @param [BigDecimal] total_amount:
      def initialize(*)
        super
        raise Errors::Invalid, errors.full_messages.to_sentence unless valid?
      end

      def to_s
        [
          'EF', # marks the end of file
          formatted_number_of_records,
          formatted_total_amount,
          '0' * 27,
        ].join
      end

      private

      def formatted_number_of_records
        format '%06d', number_of_records
      end

      def formatted_total_amount
        format '%015.2f', total_amount
      end
    end
  end
end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Lasiosphaeria caryophylli T.S. Ramakr. & Sundaram

### Remarks
null