text:
<Type Name="ExtTextureSwizzle" FullName="MonoMac.OpenGL.ExtTextureSwizzle">
  <TypeSignature Language="C#" Value="public enum ExtTextureSwizzle" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed ExtTextureSwizzle extends System.Enum" />
  <AssemblyInfo>
    <AssemblyName>MonoMac</AssemblyName>
    <AssemblyVersion>0.0.0.0</AssemblyVersion>
  </AssemblyInfo>
  <Base>
    <BaseTypeName>System.Enum</BaseTypeName>
  </Base>
  <Docs>
    To be added.
    <remarks>To be added.</remarks>
  </Docs>
  <Members>
    <Member MemberName="TextureSwizzleAExt">
      <MemberSignature Language="C#" Value="TextureSwizzleAExt" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.ExtTextureSwizzle TextureSwizzleAExt = int32(36421)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.ExtTextureSwizzle</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="TextureSwizzleBExt">
      <MemberSignature Language="C#" Value="TextureSwizzleBExt" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.ExtTextureSwizzle TextureSwizzleBExt = int32(36420)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.ExtTextureSwizzle</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="TextureSwizzleGExt">
      <MemberSignature Language="C#" Value="TextureSwizzleGExt" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.ExtTextureSwizzle TextureSwizzleGExt = int32(36419)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.ExtTextureSwizzle</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="TextureSwizzleRExt">
      <MemberSignature Language="C#" Value="TextureSwizzleRExt" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.ExtTextureSwizzle TextureSwizzleRExt = int32(36418)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.ExtTextureSwizzle</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="TextureSwizzleRgbaExt">
      <MemberSignature Language="C#" Value="TextureSwizzleRgbaExt" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.OpenGL.ExtTextureSwizzle TextureSwizzleRgbaExt = int32(36422)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.OpenGL.ExtTextureSwizzle</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
  </Members>
</Type>


text:
package com.zxsong.mymall.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.cjj.MaterialRefreshLayout;
import com.cjj.MaterialRefreshListener;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import com.zxsong.mymall.Contants;
import com.zxsong.mymall.R;
import com.zxsong.mymall.adapter.HWAdapter;
import com.zxsong.mymall.adapter.decoration.DividerItemDecoration;
import com.zxsong.mymall.bean.Page;
import com.zxsong.mymall.bean.Wares;
import com.zxsong.mymall.http.BaseCallback;
import com.zxsong.mymall.http.OkHttpHelper;
import com.zxsong.mymall.widget.MyToolBar;

import java.util.List;

/**
 * Created by zxsong on 2016/1/5.
 */
public class HotFragment extends Fragment {

    private OkHttpHelper httpHelper = OkHttpHelper.getInstance();
    private int currPage = 1;
    private int pageSize = 10;
    private int totalPage = 1;

    private List<Wares> datas;
    private RecyclerView mRecyclerView;
    private MaterialRefreshLayout mRefreshLayout;
    private MyToolBar toolBar;
//    private HotWaresAdapter mAdapter;
    private HWAdapter mAdapter;

    private static final int STATE_NORMAL = 0;
    private static final int STATE_REFREH = 1;
    private static final int STATE_MORE = 2;

    private int state = STATE_NORMAL;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment_hot, container, false);

        toolBar = (MyToolBar) view.findViewById(R.id.toolbar);
        mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
        mRefreshLayout = (MaterialRefreshLayout) view.findViewById(R.id.refresh_view);

        initToolBar();
        initRefreshLayout();
        getData();

        return view;
    }

    private void initToolBar() {

        toolBar.hideSearchView();
        toolBar.showTitleView();
        toolBar.setTitle(R.string.hot);
    }

    private void initRefreshLayout() {

        mRefreshLayout.setLoadMore(true);
        mRefreshLayout.setMaterialRefreshListener(new MaterialRefreshListener() {
            @Override
            public void onRefresh(MaterialRefreshLayout materialRefreshLayout) {
                refreshData();
            }

            @Override
            public void onRefreshLoadMore(MaterialRefreshLayout materialRefreshLayout) {
                if (currPage < totalPage) {
                    loadMoreData();
                } else {
                    Toast.makeText(getActivity(), "已经没有数据了", Toast.LENGTH_LONG).show();
                    mRefreshLayout.finishRefreshLoadMore();
                }
            }
        });
    }

    private void loadMoreData() {

        currPage = ++currPage;
        state = STATE_MORE;
        getData();
    }

    private void refreshData() {

        currPage = 1;
        state = STATE_REFREH;
        getData();
    }

    private void getData() {

        String url = Contants.API.WARES_HOT + "?curPage=" + currPage + "&pageSize=" + pageSize;

        httpHelper.get(url, new BaseCallback<Page<Wares>>() {
            @Override
            public void onBeforeRequest(Request request) {

            }

            @Override
            public void onFailure(Request request, Exception e) {

            }

            @Override
            public void onResponse(Response response) {

            }

            @Override
            public void onSuccess(Response response, Page<Wares> waresPage) {
                datas = waresPage.getList();
                currPage = waresPage.getCurrentPage();
                pageSize = waresPage.getPageSize();
                totalPage = waresPage.getTotalPage();
                showData();
            }

            @Override
            public void onError(Response response, int code, Exception e) {

            }
        });

//        httpHelper.get(url, new SpotsCallBack<Page<Wares>>(getActivity()) {
//
//            @Override
//            public void onSuccess(Response response, Page<Wares> waresPage) {
//
//                datas = waresPage.getList();
//                currPage = waresPage.getCurrentPage();
//                pageSize = waresPage.getPageSize();
//                totalPage = waresPage.getTotalPage();
//                showData();
//            }
//
//            @Override
//            public void onError(Response response, int code, Exception e) {
//
//            }
//        });
    }

    private void showData() {

        switch (state) {
            case STATE_NORMAL:
                mAdapter = new HWAdapter(getActivity(),datas);
                mRecyclerView.setAdapter(mAdapter);
                mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
                mRecyclerView.setItemAnimator(new DefaultItemAnimator());
                mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration
                        .VERTICAL_LIST));
                break;
            case STATE_REFREH:
                mAdapter.addData(datas);
                mRecyclerView.scrollToPosition(0);
                mRefreshLayout.finishRefresh();
                break;
            case STATE_MORE:
                mAdapter.addData(mAdapter.getDatas().size(), datas);
                mRecyclerView.scrollToPosition(mAdapter.getDatas().size()-datas.size());
                mRefreshLayout.finishRefreshLoadMore();
                break;
        }

    }
}

redpajama_set_name: RedPajamaGithub


text:
//
//  UIImage+Orientaion.h
//  ComicFans-iOS
//
//  Created by EggmanQi on 14/10/11.
//  Copyright (c) 2014年 FabriQate Ltd. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIImage (Orientaion)

/*
 * 调整图片方向
 */
- (UIImage *)fixOrientation;

/*
 * 根据 ALAsset 的 ALAssetPropertyOrientation 方向来调整
 */
- (UIImage *)scaleAndRotateImage:(UIImage *)image
               originalOriention:(NSNumber*)oriention;
@end


text:
/**
 * @constructor
 * @extends {WebInspector.Object}
 */
WebInspector.FileManager = function()
{
}

WebInspector.FileManager.EventTypes = {
    SavedURL: "SavedURL",
    AppendedToURL: "AppendedToURL"
}

WebInspector.FileManager.prototype = {
    /**
     * @return {boolean}
     */
    canSave: function()
    {
        return true;
    },

    /**
     * @param {string} url
     * @param {string} content
     * @param {boolean} forceSaveAs
     */
    save: function(url, content, forceSaveAs)
    {
        // Remove this url from the saved URLs while it is being saved.
        var savedURLs = WebInspector.settings.savedURLs.get();
        delete savedURLs[url];
        WebInspector.settings.savedURLs.set(savedURLs);
        InspectorFrontendHost.save(url, content, forceSaveAs);
    },

    /**
     * @param {string} url
     */
    savedURL: function(url)
    {
        var savedURLs = WebInspector.settings.savedURLs.get();
        savedURLs[url] = true;
        WebInspector.settings.savedURLs.set(savedURLs);
        this.dispatchEventToListeners(WebInspector.FileManager.EventTypes.SavedURL, url);
    },

    /**
     * @param {string} url
     * @return {boolean}
     */
    isURLSaved: function(url)
    {
        var savedURLs = WebInspector.settings.savedURLs.get();
        return savedURLs[url];
    },

    /**
     * @param {string} url
     * @param {string} content
     */
    append: function(url, content)
    {
        InspectorFrontendHost.append(url, content);
    },

    /**
     * @param {string} url
     */
    close: function(url)
    {
        InspectorFrontendHost.close(url);
    },

    /**
     * @param {string} url
     */
    appendedToURL: function(url)
    {
        this.dispatchEventToListeners(WebInspector.FileManager.EventTypes.AppendedToURL, url);
    },

    __proto__: WebInspector.Object.prototype
}

WebInspector.fileManager = new WebInspector.FileManager();


text:
Returns the object data converted as an array.

```php
public array toArray ( void )
```

## Returns

      The object data converted as an array.

## Details

Class: [BearFramework\Addon](bearframework.addon.class.md)

Location: ~/src/Addon.php

---

[back to index](index.md)


text:
namespace tzw {
struct Particle;
class ParticleInitVelocityModule: public ParticleEmitterModule
{
public:
	virtual ~ParticleInitVelocityModule() = default;
	ParticleInitVelocityModule(vec3 lowerBound, vec3 higherBound);
	virtual void process(Particle * particle, ParticleEmitter * emitter);
private:
	vec3 m_lowerBound;
	vec3 m_higherBound;
};

} // namespace tzw


text:
package org.squiddev.luaj.luajc.utils;

import org.objectweb.asm.ClassReader;
import org.objectweb.asm.util.TraceClassVisitor;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * An exception when validating a class
 */
public class ValidationException extends RuntimeException {
	private final ClassReader reader;
	private final String trace;

	public ValidationException(ClassReader reader, String trace) {
		super("Generation error for " + reader.getClassName());
		this.reader = reader;
		this.trace = trace;
	}

	public ValidationException(ClassReader reader, String trace, Throwable cause) {
		super("Generation error for " + reader.getClassName(), cause);
		this.reader = reader;
		this.trace = trace;
	}

	public final String getTrace() {
		return trace;
	}

	public final ClassReader getReader() {
		return reader;
	}

	public final String getClassDump() {
		StringWriter writer = new StringWriter();
		PrintWriter printWriter = new PrintWriter(writer);
		reader.accept(new TraceClassVisitor(printWriter), 0);

		return writer.toString();
	}
}


text:
.. -*- coding: utf-8 -*-
.. URL: https://docs.docker.com/engine/swarm/swarm-tutorial/rolling-update/
.. SOURCE: https://github.com/docker/docker.github.io/blob/master/engine/swarm/swarm-tutorial/rolling-update.md
   doc version: 20.10
.. check date: 2022/04/29
.. Commits on Apr 12, 2022 461c6935c4745e50d2ca9f479b225157897c0f45
.. -----------------------------------------------------------------------------

.. Apply rolling updates to a service

.. _apply-rolling-updates-to-a-service:

========================================
サービスにローリング・アップデートを適用
========================================

.. sidebar:: 目次

   .. contents::
       :depth: 3
       :local:

.. In a previous step of the tutorial, you scaled the number of instances of a service. In this part of the tutorial, you deploy a service based on the Redis 3.0.6 container image. Then you upgrade the service to use the Redis 3.0.7 container image using rolling updates.

チュートリアルの前のステップでは、サービスのインスタンス数を :doc:`スケール <scale-service>` しました。次のチュートリアルは Redis 3.0.6 コンテナ・イメージをベースとしたサービスをデプロイします。そして、ローリング・アップデートで Redis 3.0.7 コンテナ・イメージを使うサービスに更新します。

..    If you haven't already, open a terminal and ssh into the machine where you run your manager node. For example, the tutorial uses a machine named manager1.

1. 準備がまだであれば、ターミナルを開き、manager ノードを実行しているマシンに SSH で入ります。たとえば、このチュートリアルでは ``manager1`` という名前のマシンを使います。

.. Deploy your Redis tag to the swarm and configure the swarm with a 10 second update delay. Note that the following example shows an older Redis tag:

..    Deploy Redis 3.0.6 to all nodes in the swarm and configure the swarm to update one node every 10 seconds:

2. Redis のタグを swarm にデプロイし、swarm 上での更新遅延(update delay)を 10 秒に設定します。以下の例では古い Redis タグを使っているので注意してください。

   .. code-block:: bash

      $ docker service create \
        --replicas 3 \
        --name redis \
        --update-delay 10s \
        redis:3.0.6

      0u6a4s31ybk7yw2wyvtikmu50

   ..    You configure the rolling update policy at service deployment time.

   これはサービスのデプロイ時のローリング・アップデート・ポリシーを設定しました。

   ..    The --update-delay flag configures the time delay between updates to a service task or sets of tasks. You can describe the time T as a combination of the number of seconds Ts, minutes Tm, or hours Th. So 10m30s indicates a 10 minute 30 second delay.

   ``--update-delay`` フラグは、サービス・タスクやタスク・セットを更新する遅延時間を指定します。時間 ``T`` を、秒数 ``Ts``  、分 ``Tm``  、時 ``Th`` の組み合わせで記述できます。たとえば ``10m30s`` は 10 分 30 秒の遅延です。

   .. By default the scheduler updates 1 task at a time. You can pass the --update-parallelism flag to configure the maximum number of service tasks that the scheduler updates simultaneously.

   デフォルトでは、スケジューラは1度に1つのタスクを更新します。 ``--update-parallelism`` フラグを指定することで、スケジューラが同時に更新するサービス・タスクの最大数を調整できます。

   .. By default, when an update to an individual task returns a state of RUNNING, the scheduler schedules another task to update until all tasks are updated. If, at any time during an update a task returns FAILED, the scheduler pauses the update. You can control the behavior using the --update-failure-action flag for docker service create or docker service update

   デフォルトでは、アップデート時に個々のタスクが ``RUNNING`` (実行中)の状態を返したら、スケジューラは他の全てのタスク更新が完了するまでスケジュールします。もしもタスクの更新中に ``FAILED``  の応答があれば、スケジューラは更新を中止します。この挙動は ``docker service create`` や ``docker service update`` で ``--update-failure-action`` のフラグを使って制御できます。

..    Inspect the redis service:

3. ``redis`` サービスを調べます。

   .. code-block:: bash

      $ docker service inspect --pretty redis

      ID:             0u6a4s31ybk7yw2wyvtikmu50
      Name:           redis
      Service Mode:   Replicated
       Replicas:      3
      Placement:
       Strategy:	    Spread
      UpdateConfig:
       Parallelism:   1
       Delay:         10s
      ContainerSpec:
       Image:         redis:3.0.6
      Resources:

.. Now you can update the container image for redis. The swarm manager applies the update to nodes according to the UpdateConfig policy:

4. ``redis`` 用のコンテナ・イメージを更新します。 swarm マネージャ は ``UpdateConfig`` ポリシーに基づいてノード更新を適用します。

   .. code-block:: bash

      $ docker service update --image redis:3.0.7 redis
      redis

   .. The scheduler applies rolling updates as follows by default:

   スケジューラが適用するローリング・アップデートは、以下がデフォルトです。

   ..  Stop the first task.
       Schedule update for the stopped task.
       Start the container for the updated task.
       If the update to a task returns RUNNING, wait for the specified delay period then start the next task.
       If, at any time during the update, a task returns FAILED, pause the update.

   * 1つめのタスクを停止
   * 停止したタスクの更新をスケジュール
   * 更新したタスク用コンテナの起動
   * 更新したタスクが ``RUNNING`` を返したら、指定した遅延期間を待機した後、次のタスクを開始
   * 更新中のあらゆる期間で ``FAILED`` が帰ってきたら、更新を停止

..    Run docker service inspect --pretty redis to see the new image in the desired state:

5. ``docker service inspect --pretty redis`` を実行し、新しいイメージの期待状態を確認します。

   .. code-block:: bash

      $ docker service inspect --pretty redis

      ID:             0u6a4s31ybk7yw2wyvtikmu50
      Name:           redis
      Service Mode:   Replicated
       Replicas:      3
      Placement:
       Strategy:	    Spread
      UpdateConfig:
       Parallelism:   1
       Delay:         10s
      ContainerSpec:
       Image:         redis:3.0.7
      Resources:
      Endpoint Mode:  vip

   .. The output of service inspect shows if your update paused due to failure:

   ``service inspect`` の出力から、更新の失敗によって一時停止しているのが分かります。

   .. code-block:: bash

      $ docker service inspect --pretty redis

      ID:             0u6a4s31ybk7yw2wyvtikmu50
      Name:           redis
      ...snip...
      Update status:
       State:      paused
       Started:    11 seconds ago
       Message:    update paused due to failure or early termination of task 9p7ith557h8ndf0ui9s0q951b
      ...snip...

   .. To restart a paused update run docker service update <SERVICE-ID>. For example:

   一時停止した更新を再開するには、 ``docker service update <サービス ID>`` を実行します。実行例:

   .. code-block:: bash

      docker service update redis

   .. To avoid repeating certain update failures, you may need to reconfigure the service by passing flags to docker service update.

   更新失敗が続く状態を停止するには、 ``docker service update`` にフラグを追加し、サービスの状態を調整する必要があるでしょう。

.. Run docker service ps <SERVICE-ID> to watch the rolling update:

6. ``docker service ps <タスクID>`` を実行し、ローリング・アップデートを監視します。

   .. code-block:: bash

      $ docker service ps redis

      NAME                                   IMAGE        NODE       DESIRED STATE  CURRENT STATE            ERROR
      redis.1.dos1zffgeofhagnve8w864fco      redis:3.0.7  worker1    Running        Running 37 seconds
       \_ redis.1.88rdo6pa52ki8oqx6dogf04fh  redis:3.0.6  worker2    Shutdown       Shutdown 56 seconds ago
      redis.2.9l3i4j85517skba5o7tn5m8g0      redis:3.0.7  worker2    Running        Running About a minute
       \_ redis.2.66k185wilg8ele7ntu8f6nj6i  redis:3.0.6  worker1    Shutdown       Shutdown 2 minutes ago
      redis.3.egiuiqpzrdbxks3wxgn8qib1g      redis:3.0.7  worker1    Running        Running 48 seconds
       \_ redis.3.ctzktfddb2tepkr45qcmqln04  redis:3.0.6  mmanager1  Shutdown       Shutdown 2 minutes ago

.. Before Swarm updates all of the tasks, you can see that some are running redis:3.0.6 while others are running redis:3.0.7. The output above shows the state once the rolling updates are done.

Swarm が全てのタスクを更新するまで、 ``redis:3.0.6`` として実行中のイメージが ``redis:3.0.7`` に切り替わるのが見えるでしょう。先ほどの出力はローリング・アップデートが完了した状態です。

.. Next, learn about how to drain a node in the swarm.

次は swarm から :doc:`ノードを解放 <drain-node>` する方法を学びます。

.. seealso::

   Apply rolling updates to a service
      https://docs.docker.com/engine/swarm/swarm-tutorial/rolling-update/


text:
This Starboard sub-project contains libraries and headers that can be used to
make porting client software on top of Starboard a little easier.

# "Poem" - Lightweight POSIX Emulation

Before Starboard, we had tried to build a POSIX emulation layer for every
platform we wanted to support. This meant replacing link symbols in some cases,
and a wielding global preprocessor macros in others. It was impossible to keep
inclusion of platform headers (e.g. `winsock.h`) from transitively leaking out
into common code.

`poem`, for POsix EMulation, is somewhat similar, but a surgical tool for
targeted porting, rather than a blunt instrument. Because we have Starboard as a
well-defined barrier, we can use the preprocessor to selectively redirect
standard functions like malloc to Starboard without making lots of changes to
the code.

The rule we use is that these headers must ONLY be included in implementation
files, not headers, so that the preprocessor replacements don't spread
uncontrollably.

For each `poem`, we try to name files in a consistent, formulaic manner.  With
this scheme, we can easily determine the correct poem header while porting.
This can also come handy if one were to write a script to assist in porting
third party libraries.  In theory, the script would just look for includes
in .cc files, where we have available poems and then wrap unprotected includes
in #if !defined(STARBOARD), and include the poems if STARBOARD is defined.

# "eztime" - Easy Time Functions

Starboard does not contain functions that do much in the way of time
conversion. This is because system-provided time manipulation is often buggy,
broken, and/or limited. `eztime` is a simplified Straight-C wrapper on top of
ICU and Starboard that makes it easy to replace calls to functions like mktime
and gmtime in older C libraries with more robust ICU calls.

EzTime can be used directly by including
`starboard/client_porting/eztime/eztime.h`, or you can include
`starboard/client_porting/poem/eztime_poem.h` in your implementation file to
automatically simulate POSIXy time functions.


text:
package xop.hello_handler.client;

import junit.framework.TestSuite;
import junit.framework.Test;
import junit.framework.TestCase;

public class AllTests extends TestCase {

    public AllTests(String name) {
        super(name);
    }

    public static Test suite() {
        TestSuite suite = new TestSuite();
        suite.addTestSuite(xop.hello_handler.client.TestApp.class);
        return suite;
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
    android:insetLeft="8dp"
    android:insetRight="8dp">

    <bitmap android:src="@android:drawable/divider_horizontal_dim_dark" />

</inset>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Special Publication College of Agriculture, National Taiwan University 11: 215 (1959)

#### Original name
Cercospora pruni-persicae Sawada

### Remarks
null


text:
from asposewords import Settings
from com.aspose.words import Document
from com.aspose.words import NodeType
from com.aspose.words import ControlChar

class RemoveBreaks:

    def __init__(self):
        dataDir = Settings.dataDir + 'programming_documents/'

        # Open the document.
        doc = Document(dataDir + "TestRemoveBreaks.doc")

        # Remove the page and section breaks from the document.
        # In Aspose.Words section breaks are represented as separate Section nodes in the document.
        # To remove these separate sections the sections are combined.
        self.remove_page_breaks(doc)
        self.remove_section_breaks(doc)

        # Save the document.
        doc.save(dataDir + "TestRemoveBreaks Out.doc")

    def remove_page_breaks(self, doc):
        # Retrieve all paragraphs in the document.
        paragraphs = doc.getChildNodes(NodeType.PARAGRAPH, True)

        paragraphs_count = paragraphs.getCount()

        i = 0
        while(i < paragraphs_count) :
            para = paragraphs.get(i)
            if (para.getParagraphFormat().getPageBreakBefore()):
                para.getParagraphFormat().setPageBreakBefore(False)

            runs = para.getRuns().toArray()

            for run in runs:
                if (run.getText() in ControlChar.PAGE_BREAK):
                    run.setText(run.getText().replace(ControlChar.PAGE_BREAK, ""))

            i = i + 1

    def remove_section_breaks(self, doc):
        # Loop through all sections starting from the section that precedes the last one
        # and moving to the first section.
        i = doc.getSections().getCount() - 2
        while ( i >= 0 ):
            # Copy the content of the current section to the beginning of the last section.
            doc.getLastSection().prependContent(doc.getSections().get(i))
            # Remove the copied section.
            doc.getSections().get(i).remove()
            i = i - 1

if __name__ == '__main__':
    RemoveBreaks()


text:
URL Shortener
================

##### Version: Url Shortener BETA 0.1

# Overview

A Flask RESTful web application for creating and tracking shortened URL's.

# Requirements

Aptitude Packages:

- python-dev
- build-essentials
- python-setuptools
- python-virtualenv

Required PIP packages, also in the requirements.txt

- Flask==0.10.1
- Flask-RESTful==0.3.0
- Flask-Actions==0.6.6
- requests==2.5.0

# Installation

```bash
apt-get update && apt-get install python-dev build-essential python-setuptools python-virtualenv
```

```bash
git clone -b part-1 https://github.com/configuresystems/url-shortener.git application
cd application
virtualenv flask
source flask/bin/activate
python run.py runserver -h [HOSTNAME] -p [PORT]
```

# Usage

|  HTTP Method | Response|  URI |  Action |
| :-----------:|:--:| :--- | :------ |
| GET | JSON | http://[hostname]/api/v1.0/tni | Retrieve a list of shortened URLs |
| GET | JSON | http://[hostname]/api/v1.0/tni/[tni_url] | Retrieve single shortened URL |
| GET | HTML | http://[hostname]/[tni_url] | URL Redirect|

Publically exposed data fields:

##### Fields

- **id:** ID of the shortened URL
- **tni_url:** Our key for the target URL
- **actual_url:** Target URL to redirect to
- **created:** Date shortened URL was created


text:
package util

import (
	"fmt"

	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
)

func UpdateGroupVersionKindWithScheme(obj runtime.Object, gv schema.GroupVersion, scheme *runtime.Scheme) error {
	gvk, err := GetGroupVersionKind(obj, gv, scheme)
	if err != nil {
		return err
	}
	obj.GetObjectKind().SetGroupVersionKind(*gvk)
	return nil
}

func GetGroupVersionKind(obj runtime.Object, gv schema.GroupVersion, scheme *runtime.Scheme) (*schema.GroupVersionKind, error) {
	gvks, _, err := scheme.ObjectKinds(obj)
	if err != nil {
		return nil, err
	}
	for _, gvk := range gvks {
		if gvk.GroupVersion() == gv {
			return &gvk, nil
		}
	}
	return nil, fmt.Errorf("no group version %s registered in %s", gv, scheme.Name())
}


text:
#include <ShellRenderInterfaceExtensions.h>
#include <ShellRenderInterfaceOpenGL.h>
#include <windows.h>
#include <Rocket/Core.h>
#include <Rocket/Core/Platform.h>
#include <Shell.h>

void ShellRenderInterfaceOpenGL::SetContext(void *context)
{
	m_rocket_context = context;
}

void ShellRenderInterfaceOpenGL::SetViewport(int width, int height)
{
	if(m_width != width || m_height != height) {
		m_width = width;
		m_height = height;

		glViewport(0, 0, width, height);
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		glOrtho(0, width, height, 0, -1, 1);
		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();
	}
	if(m_rocket_context != NULL)
	{
		((Rocket::Core::Context*)m_rocket_context)->SetDimensions(Rocket::Core::Vector2i(width, height));
	}
}

bool ShellRenderInterfaceOpenGL::AttachToNative(void *nativeWindow)
{
	this->render_context = NULL;
	this->window_handle = (HWND)nativeWindow;
	this->device_context = GetDC(this->window_handle);
	if (this->device_context == NULL)
	{
		Shell::DisplayError("Could not get device context.");
		return false;
	}

	PIXELFORMATDESCRIPTOR pixel_format_descriptor;
	memset(&pixel_format_descriptor, 0, sizeof(pixel_format_descriptor));
	pixel_format_descriptor.nSize = sizeof(PIXELFORMATDESCRIPTOR);
	pixel_format_descriptor.nVersion = 1;
	pixel_format_descriptor.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
	pixel_format_descriptor.iPixelType = PFD_TYPE_RGBA;
	pixel_format_descriptor.cColorBits = 32;
	pixel_format_descriptor.cRedBits = 8;
	pixel_format_descriptor.cGreenBits = 8;
	pixel_format_descriptor.cBlueBits = 8;
	pixel_format_descriptor.cAlphaBits = 8;
	pixel_format_descriptor.cDepthBits = 24;
	pixel_format_descriptor.cStencilBits = 8;

	int pixel_format = ChoosePixelFormat(this->device_context, &pixel_format_descriptor);
	if (pixel_format == 0)
	{
		Shell::DisplayError("Could not choose 32-bit pixel format.");
		return false;
	}

	if (SetPixelFormat(this->device_context, pixel_format, &pixel_format_descriptor) == FALSE)
	{
		Shell::DisplayError("Could not set pixel format.");
		return false;
	}

	this->render_context = wglCreateContext(this->device_context);
	if (this->render_context == NULL)
	{
		Shell::DisplayError("Could not create OpenGL rendering context.");
		return false;
	}

	// Activate the rendering context.
	if (wglMakeCurrent(this->device_context, this->render_context) == FALSE)
	{
		Shell::DisplayError("Unable to make rendering context current.");
		return false;
	}

	// Set up the GL state.
	glClearColor(0, 0, 0, 1);
	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_COLOR_ARRAY);

	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	RECT crect;
	GetClientRect(this->window_handle, &crect)
	glOrtho(0, (crect.right - crect.left), (crect.bottom - crect.top), 0, -1, 1);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	return true;
}

void ShellRenderInterfaceOpenGL::DetachFromNative()
{
	// Shutdown OpenGL
	if (this->render_context != NULL)
	{
		wglMakeCurrent(NULL, NULL);
		wglDeleteContext(this->render_context);
		this->render_context = NULL;
	}

	if (this->device_context != NULL)
	{
		ReleaseDC(this->window_handle, this->device_context);
		this->device_context = NULL;
	}
}

void ShellRenderInterfaceOpenGL::PrepareRenderBuffer()
{
	glClear(GL_COLOR_BUFFER_BIT);
}

void ShellRenderInterfaceOpenGL::PresentRenderBuffer()
{
	// Flips the OpenGL buffers.
	SwapBuffers(this->device_context);
}


text:
/*
 * 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.
 */
package org.jdbi.v3.sqlobject.config;

import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.jdbi.v3.core.argument.ArgumentFactory;
import org.jdbi.v3.sqlobject.config.internal.RegisterArgumentFactoryImpl;

/**
 * Used to register an argument factory with either a sql object type or for a specific method.
 * This annotation may be repeated to register multiple argument factories.
 */
@ConfiguringAnnotation(RegisterArgumentFactoryImpl.class)
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(RegisterArgumentFactories.class)
public @interface RegisterArgumentFactory {
    /**
     * The argument factory classes to register
     * @return one or more argument factory classes.
     */
    Class<? extends ArgumentFactory> value();
}


text:
function close_pop() {
    $('.backdrop, .box').animate({
        'opacity': '0'
    }, 300, 'linear', function () {
        $('.cookies').css('display', 'none');
    });

    setCookie('hide', true, 365);
    return false;
}

function getCookie(c_name) {
    var c_value = document.cookie;
    var c_start = c_value.indexOf(" " + c_name + "=");
    if (c_start == -1) {
        c_start = c_value.indexOf(c_name + "=");
    }
    if (c_start == -1) {
        c_value = null;
    } else {
        c_start = c_value.indexOf("=", c_start) + 1;
        var c_end = c_value.indexOf(";", c_start);
        if (c_end == -1) {
            c_end = c_value.length;
        }
        c_value = unescape(c_value.substring(c_start, c_end));
    }
    return c_value;
}

function setCookie(c_name, value, exdays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
    document.cookie = c_name + "=" + c_value;
}

jQuery.ready(function(){

});

jQuery(function($) {'use strict';

	  //Window Loaded Handler

  $(window).load(function(){
		 $(".loader").fadeOut("slow");

  });

	if (!getCookie('hide')) {
	    window.setTimeout(function () {
	        $('.cookies').show();
	        $('.cookies').ready(function () {
	            $('.backdrop, .box').animate({
	                'opacity': '.50'
	            }, 300, 'linear');
	            $('.box').animate({
	                'opacity': '1.00'
	            }, 300, 'linear');
	            $('.backdrop, .box').css('display', 'block');
	        });

	        $('.close-btn').click(function () {
	            close_pop();
	        });

	        // $('.backdrop').click(function () {
	        //     close_pop();
	        // });
	        //change 1000 to 20000 for 20 seconds
	    }, 1000);
	}
	else{
		$('.cookies').hide();
	}

  // =========================================================================
	//	Back to Top
	// =========================================================================

	if ($('.go-top').length) {
    var scrollTrigger = 100, // px
        backToTop = function () {
            var scrollTop = $(window).scrollTop();
            if (scrollTop > scrollTrigger) {
                $('.go-top').addClass('show');
            } else {
                $('.go-top').removeClass('show');
            }
        };
    backToTop();
    $(window).on('scroll', function () {
        backToTop();
    });
    $('.go-top').on('click', function (e) {
        e.preventDefault();
        $('html,body').animate({
            scrollTop: 0
        }, 700);
    });
}

//Contact Us
  $("#btn_submit").click(function() {
        //get input field values
        var user_name       = $('input[name=name]').val(),
       		user_email      = $('input[name=email]').val(),
			user_message    = $('textarea[name=message]').val(),
        	proceed = true,//simple validation at client's end
        	output = '';

        if(user_name===""){
            proceed = false;
        }
        if(user_email===""){
            proceed = false;
        }
		if(user_message==="") {
            proceed = false;
        }

        //everything looks good! proceed...
        if(proceed)
        {
            //data to be sent to server
            var post_data = {'userName':user_name, 'userEmail':user_email, 'userMessage':user_message};

            //Ajax post data to server
            $.post('/php/contact_me.php', post_data, function(response){

                //load json data from server and output message
				if(response.type == 'error')
				{
					output = '
'+response.text+'
';
				}else{
				    output = '
'+response.text+'
';

					//reset values in all input fields
					$('.form-inline input').val('');
					$('.form-inline textarea').val('');
				}

				$("#result").hide().html(output).slideDown();
            }, 'json');
        }
        else{
        	var output = '
Aby wysłać do nas wiadomość wypełnij wszystkie pola formularza!
';
        	$("#result").hide().html(output).slideDown();
        }

    });

    //reset previously set border colors and hide all message on .keyup()
    $(".form-inline input, .form-inline textarea").keyup(function() {
        $("#result").slideUp();
    });

 //Slider Main
  jQuery('.fullscreenbanner').revolution({
			delay:15000,
			startwidth:1170,
			startheight:500,
			hideThumbs:10,
			fullWidth:"off",
			fullScreen:"on",
			shadow:0,
			dottedOverlay:"none",
			fullScreenOffsetContainer: ""
	 });

//Change Diffrent Logos on Nav
  jQuery(window).scroll(function() {

	 if (jQuery(window).scrollTop() >= 25) {
		jQuery(".logo > img").attr("src", "img/logo.png");
	 }
	  else {
		jQuery(".logo > img").attr("src", "img/logo-white.png");
	 }

  });

// Scroll One Page Menu
  $('a.page-scroll, .cbp-spmenu a').on('click', function(event){
        //var $nav_height = $('#navigation.affix').outerHeight();
		var $anchor = $(this),
			hash = $anchor.attr('href').replace('#', ''),
			url = window.location.href;
        $('html, body').stop().animate({
            scrollTop: $($anchor.attr('href')).offset().top
        }, 1200, 'easeInOutExpo');
  //       if(history.pushState) {
		//     history.pushState(null, null, hash);
		// }
		// else {
		//     location.hash = hash;
		// }
       	// event.preventDefault();

		$('#navigation').affix({offset: {top: 50} });

   });

//Facts Counters Home Page
	 $(".number-counters").appear(function () {
		$(".number-counters [data-to]").each(function () {
		  var e = $(this).attr("data-to");
		  $(this).delay(6e3).countTo({
			 from: 50,
			 to: e,
			 speed: 3e3,
			 refreshInterval: 50
		  });
		});
	 });

 //FOr Circular Progress show
	 $('.some').appear(function () {
		 $('.myStat2').circliful();
	 });

//For Testinomial
	$("#testinomial-slider").owlCarousel({
		  autoPlay : true,
		  navigation : true,
		  slideSpeed : 250,
		  pagination : false,
		  navigationText :["",""],
		  singleItem:true

	 });

//For Publication Section(Home Page)
    $("#publication-slider").owlCarousel({
		  autoPlay: true,
		  pagination : false,
		  navigationText :["",""],
		  navigation : true,
		  items : 3,
		  itemsDesktop : [1199,3],
		  itemsDesktopSmall : [979,3]

  });
  //Paralax Page Slider
	var owl = $("#paralax-slider");
  owl.owlCarousel({
    autoPlay: 3000,
	 navigation : false,
    singleItem : true,
    transitionStyle : "fade"
  });

	  // portfolio filtering
    $(".project-wrapper").mixItUp();

 // Popup
   $(".fancybox").fancybox({
		openEffect : 'fade',
		closeClick : true,

    });
	 //Video Popup
	 $('.fancybox-media').fancybox({
		openEffect  : 'fade',
		closeEffect : 'none',
		helpers : {
			media : {}
		}
	});

	//Push Menu on click
	$('.toggle-menu').jPushMenu();
	  $(document).on('click', function () {
        $('.cbp-spmenu-right').removeClass('menu-open');
    });
    $('#menu-toggle').on('click', function (e) {
        e.stopPropagation();
        $('.cbp-spmenu-right').toggleClass('menu-open');
    });
    $('.cbp-spmenu-right').on('click', function (e) {
        e.stopPropagation();
    });

//Parallax effects
$('#bg-paralax ').parallax("50%", 0.3);
// $('#testinomial').parallax("50%", 0.2);
$('.text-rotator').parallax("50%", 0.2);

		  //Initiat WOW JS
		 new WOW().init();

  });
 if(screen.width <720 ){
 $('div, img, input, textarea, button, a').removeClass('wow'); // to remove transition
 }


text:
<?php

declare(strict_types=1);

namespace Sonata\MediaBundle\Client;

use Buzz\Browser;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;

/**
 * NEXT_MAJOR: Remove this class.
 *
 * @deprecated since sonata-project/media-bundle 3.28, to be removed in version 4.0.
 */
final class BuzzClient implements ClientInterface
{
    /**
     * @var Browser
     */
    private $browser;

    public function __construct(Browser $browser)
    {
        $this->browser = $browser;
    }

    public function sendRequest(RequestInterface $request): ResponseInterface
    {
        return $this->browser->sendRequest($request);
    }
}


text:
To reference this package in publications, please cite:

    @inproceedings{zimmerman2017monolithic,
      title={Monolithic Simulation of Convection-Coupled Phase-Change: Verification and Reproducibility},
      author={Zimmerman, Alexander G and Kowalski, Julia},
      editor={Schäfer, Michael and Behr, Marek and Mehl, Miriam and Wohlmuth, Barbara},
      booktitle={Recent Advances in Computational Engineering},
      volume={124},
      series={Lectures Notes in Computational Science and Engineering (LNCSE)},
      pages={177--197},
      year={2017},
      publisher={Springer}
    }

Furthermore, consider citing [the FEniCS Project](https://fenicsproject.org/citing/).


text:
<?xml version="1.0" encoding="utf-8"?>
<doc>
  <assembly>
    <name>System.Diagnostics.Tools</name>
  </assembly>
  <members>
    <member name="T:System.CodeDom.Compiler.GeneratedCodeAttribute">
      ツールで生成されたコードを識別します。このクラスは継承できません。
    </member>
    <member name="M:System.CodeDom.Compiler.GeneratedCodeAttribute.#ctor(System.String,System.String)">
      コードを生成したツールの名前とバージョンを指定して、<see cref="T:System.CodeDom.Compiler.GeneratedCodeAttribute" /> クラスの新しいインスタンスを初期化します。
      <param name="tool">コードを生成したツールの名前。</param>
      <param name="version">コードを生成したツールのバージョン。</param>
    </member>
    <member name="P:System.CodeDom.Compiler.GeneratedCodeAttribute.Tool">
      コードを生成したツールの名前を取得します。
      <returns>コードを生成したツールの名前。</returns>
    </member>
    <member name="P:System.CodeDom.Compiler.GeneratedCodeAttribute.Version">
      コードを生成したツールのバージョンを取得します。
      <returns>コードを生成したツールのバージョン。</returns>
    </member>
    <member name="T:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute">
      特定の静的分析ツール規則違反の報告を抑制します。1 つのコードで複数の抑制を実行できます。
    </member>
    <member name="M:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute.#ctor(System.String,System.String)">
      静的分析ツールのカテゴリおよび分析規則の識別子を指定して、<see cref="T:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute" /> クラスの新しいインスタンスを初期化します。
      <param name="category">属性のカテゴリ。</param>
      <param name="checkId">属性が適用される分析ツール規則の識別子。</param>
    </member>
    <member name="P:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute.Category">
      属性の分類を識別するカテゴリを取得します。
      <returns>属性を識別するカテゴリ。</returns>
    </member>
    <member name="P:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute.CheckId">
      抑制する静的分析ツール規則の識別子を取得します。
      <returns>抑制する静的分析ツール規則の識別子。</returns>
    </member>
    <member name="P:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute.Justification">
      コード分析メッセージの抑制に関する位置合わせを取得または設定します。
      <returns>メッセージの抑制に対する位置合わせ。</returns>
    </member>
    <member name="P:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute.MessageId">
      除外条件を拡張するオプション引数を取得または設定します。
      <returns>拡張された除外条件を格納する文字列。</returns>
    </member>
    <member name="P:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute.Scope">
      属性に関係するコードのスコープを取得または設定します。
      <returns>属性に関係するコードのスコープ。</returns>
    </member>
    <member name="P:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute.Target">
      属性のターゲットを表す絶対パスを取得または設定します。
      <returns>属性のターゲットを表す絶対パス。</returns>
    </member>
  </members>
</doc>


text:
Imports System.Collections.Generic
Imports System.Net
Imports Aspose.Email.Exchange
Imports Aspose.Email.Mail
Imports Aspose.Email.Outlook

'
'This project uses Automatic Package Restore feature of NuGet to resolve Aspose.Email for .NET API reference
'when the project is build. Please check https://Docs.nuget.org/consume/nuget-faq for more information.
'If you do not wish to use NuGet, you can manually download Aspose.Email for .NET API from http://www.aspose.com/downloads,
'install it and then add its reference to this project. For any issues, questions or suggestions
'please feel free to contact us using http://www.aspose.com/community/forums/default.aspx
'

Namespace Aspose.Email.Examples.VisualBasic.Email.Exchange
	Class SynchronizeFolderItems
		Public Shared Sub Run()
			' ExStart:SynchronizeFolderItems
			Dim client As IEWSClient = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "testUser", "pwd", "domain")

			Dim message1 As New MailMessage("user@domain.com", "user@domain.com", "EMAILNET-34738 - " + Guid.NewGuid().ToString(), "EMAILNET-34738 Sync Folder Items")
			client.Send(message1)

			Dim message2 As New MailMessage("user@domain.com", "user@domain.com", "EMAILNET-34738 - " + Guid.NewGuid().ToString(), "EMAILNET-34738 Sync Folder Items")
			client.Send(message2)

			Dim messageInfoCol As ExchangeMessageInfoCollection = client.ListMessages(client.MailboxInfo.InboxUri)

            Dim result As SyncFolderResult = client.SyncFolder(client.MailboxInfo.InboxUri, CType(Nothing, SyncFolderType))
			Console.WriteLine(result.NewItems.Count)
			Console.WriteLine(result.ChangedItems.Count)
			Console.WriteLine(result.ReadFlagChanged.Count)
			Console.WriteLine(result.DeletedItems.Length)
			' ExEnd:SynchronizeFolderItems
		End Sub
	End Class
End Namespace


text:
package org.apache.jackrabbit.oak.plugins.blob;

import org.apache.jackrabbit.oak.plugins.blob.datastore.BlobTracker;

/**
 * Interface to be implemented by a data store which can support local blob id tracking.
 */
public interface BlobTrackingStore extends SharedDataStore {
    /**
     * Registers a tracker in the data store.
     * @param tracker
     */
    void addTracker(BlobTracker tracker);

    /**
     * Gets the traker registered in the data store.
     *
     * @return tracker
     */
    BlobTracker getTracker();
}


text:
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using WebsitePanel.WebDav.Core.Config.WebConfigSections;

namespace WebsitePanel.WebDav.Core.Config.Entities
{
    public class FileIconsDictionary : AbstractConfigCollection, IReadOnlyDictionary<string, string>
    {
        private readonly IDictionary<string, string> _fileIcons;

        public FileIconsDictionary()
        {
            DefaultPath = ConfigSection.FileIcons.DefaultPath;
            FolderPath = ConfigSection.FileIcons.FolderPath;
            _fileIcons = ConfigSection.FileIcons.Cast<FileIconsElement>().ToDictionary(x => x.Extension, y => y.Path);
        }

        public string DefaultPath { get; private set; }
        public string FolderPath { get; private set; }

        public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
        {
            return _fileIcons.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }

        public int Count
        {
            get { return _fileIcons.Count; }
        }

        public bool ContainsKey(string extension)
        {
            return _fileIcons.ContainsKey(extension);
        }

        public bool TryGetValue(string extension, out string path)
        {
            return _fileIcons.TryGetValue(extension, out path);
        }

        public string this[string extension]
        {
            get { return ContainsKey(extension) ? _fileIcons[extension] : DefaultPath; }
        }

        public IEnumerable<string> Keys
        {
            get { return _fileIcons.Keys; }
        }

        public IEnumerable<string> Values
        {
            get { return _fileIcons.Values; }
        }
    }
}


text:
[instagram-private-api](../../README.md) / [responses](../../modules/responses.md) / MediaUpdatedMediaResponseCaption

# Interface: MediaUpdatedMediaResponseCaption

[responses](../../modules/responses.md).MediaUpdatedMediaResponseCaption

## Table of contents

### Properties

- [bit\_flags](MediaUpdatedMediaResponseCaption.md#bit_flags)
- [content\_type](MediaUpdatedMediaResponseCaption.md#content_type)
- [created\_at](MediaUpdatedMediaResponseCaption.md#created_at)
- [created\_at\_utc](MediaUpdatedMediaResponseCaption.md#created_at_utc)
- [did\_report\_as\_spam](MediaUpdatedMediaResponseCaption.md#did_report_as_spam)
- [media\_id](MediaUpdatedMediaResponseCaption.md#media_id)
- [pk](MediaUpdatedMediaResponseCaption.md#pk)
- [share\_enabled](MediaUpdatedMediaResponseCaption.md#share_enabled)
- [status](MediaUpdatedMediaResponseCaption.md#status)
- [text](MediaUpdatedMediaResponseCaption.md#text)
- [type](MediaUpdatedMediaResponseCaption.md#type)
- [user](MediaUpdatedMediaResponseCaption.md#user)
- [user\_id](MediaUpdatedMediaResponseCaption.md#user_id)

## Properties

### bit\_flags

• **bit\_flags**: `number`

#### Defined in

[src/responses/media.updated-media.response.ts:83](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L83)

___

### content\_type

• **content\_type**: `string`

#### Defined in

[src/responses/media.updated-media.response.ts:81](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L81)

___

### created\_at

• **created\_at**: `number`

#### Defined in

[src/responses/media.updated-media.response.ts:79](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L79)

___

### created\_at\_utc

• **created\_at\_utc**: `number`

#### Defined in

[src/responses/media.updated-media.response.ts:80](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L80)

___

### did\_report\_as\_spam

• **did\_report\_as\_spam**: `boolean`

#### Defined in

[src/responses/media.updated-media.response.ts:85](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L85)

___

### media\_id

• **media\_id**: `string`

#### Defined in

[src/responses/media.updated-media.response.ts:87](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L87)

___

### pk

• **pk**: `string`

#### Defined in

[src/responses/media.updated-media.response.ts:75](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L75)

___

### share\_enabled

• **share\_enabled**: `boolean`

#### Defined in

[src/responses/media.updated-media.response.ts:86](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L86)

___

### status

• **status**: `string`

#### Defined in

[src/responses/media.updated-media.response.ts:82](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L82)

___

### text

• **text**: `string`

#### Defined in

[src/responses/media.updated-media.response.ts:77](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L77)

___

### type

• **type**: `number`

#### Defined in

[src/responses/media.updated-media.response.ts:78](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L78)

___

### user

• **user**: [`MediaUpdatedMediaResponseUser`](MediaUpdatedMediaResponseUser.md)

#### Defined in

[src/responses/media.updated-media.response.ts:84](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L84)

___

### user\_id

• **user\_id**: `number`

#### Defined in

[src/responses/media.updated-media.response.ts:76](https://github.com/Nerixyz/instagram-private-api/blob/b3351b9/src/responses/media.updated-media.response.ts#L76)


text:
/**
 * Stack based Towers of Hanoi
 */

import java.util.ArrayList;
import java.util.Stack;
import java.util.LinkedList;
import java.util.Enumeration;

public class TowersOfHanoi
{
  protected Stack<Integer> A, B, C;
  protected int discs;

  public TowersOfHanoi(int discs)
  {
    this.discs = discs;
    A = new Stack<Integer>();
    B = new Stack<Integer>();
    C = new Stack<Integer>();

    for (int i = discs; i > 0; i--)
      A.push(i);
  }

  public void solve()
  {

    System.out.println("Initial Set Up:");
    state();
    System.out.println("Now Solving...");
    move(discs, A, C, B);
  }

  public void move(int discs, Stack<Integer> start, Stack<Integer> end, Stack<Integer> via)
  {
    if (discs == 0)
      return;
    else {
      move(discs - 1, start, via, end);
      place(discs, start, end);
      state();
      System.out.println("Moved: " + discs + "\n");
      move(discs - 1, via, end, start);
    }
  }

  public void place(int discs, Stack<Integer> start, Stack<Integer> end)
  {
    int element = start.pop();
    end.push(element);
  }

  public void state()
  {
    ArrayList<LinkedList<String>> stacks = new ArrayList<LinkedList<String>>();
    stacks.add(explain(A));
    stacks.add(explain(B));
    stacks.add(explain(C));

    String s = "";
    for (int i = 1; i <= discs; i++)
    {
      for (int j = 0; j < stacks.size(); j++)
      {
        try {
          s += stacks.get(j).removeLast();
        } catch (Exception nse)
        {
          s += "|   |";
        }
        if (j < 2)
          s += "\t";
      }
      System.out.println(s);
      s = "";
    }
    System.out.println("-----\t-----\t-----");
    System.out.println("  A  \t  B  \t  C  ");
  }

  public LinkedList<String> explain(Stack<Integer> stack)
  {
    LinkedList<String> elements = new LinkedList<String>();
    for (Enumeration<Integer> e = stack.elements(); e.hasMoreElements(); )
      elements.add(paddedElement(e.nextElement()));
    return elements;
  }

  public String paddedElement(Integer i)
  {
    return "| " + i.toString() + " |";
  }

  public static void main(String[] args)
  {
    TowersOfHanoi towers = new TowersOfHanoi(4);
    towers.solve();
  }
}// end TowersOfHanoi


text:
package net.firejack.platform.service.registry.broker.install;

import net.firejack.platform.api.OPFEngine;
import net.firejack.platform.api.registry.model.PackageFileType;
import net.firejack.platform.core.broker.ServiceBroker;
import net.firejack.platform.core.config.export.IPackageExporter;
import net.firejack.platform.core.config.export.PackageExportResult;
import net.firejack.platform.core.config.meta.IPackageDescriptor;
import net.firejack.platform.core.config.translate.StatusProviderTranslationResult;
import net.firejack.platform.core.domain.NamedValues;
import net.firejack.platform.core.exception.BusinessFunctionException;
import net.firejack.platform.core.model.registry.domain.PackageModel;
import net.firejack.platform.core.request.ServiceRequest;
import net.firejack.platform.core.response.ServiceResponse;
import net.firejack.platform.core.store.registry.IPackageStore;
import net.firejack.platform.core.utils.OpenFlame;
import net.firejack.platform.core.utils.StringUtils;
import net.firejack.platform.core.utils.VersionUtils;
import net.firejack.platform.model.helper.FileHelper;
import net.firejack.platform.model.service.PackageInstallationService;
import net.firejack.platform.service.registry.helper.PackageVersionHelper;
import net.firejack.platform.web.mina.annotations.ProgressComponent;
import net.firejack.platform.web.statistics.annotation.TrackDetails;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.io.InputStream;

@TrackDetails
@Component("performPackageArchiveBroker")
@ProgressComponent(weight = 40)
public class PerformPackageArchiveBroker extends ServiceBroker<ServiceRequest<NamedValues>, ServiceResponse> {

	@Autowired
	private FileHelper helper;

	@Autowired
	private IPackageStore packageStore;

	@Autowired
	@Qualifier("basicPackageExporter")
	private IPackageExporter packageExporter;

	@Autowired
	private PackageVersionHelper packageVersionHelper;

	@Autowired
	private PackageInstallationService packageInstallationService;

	@Override
	protected ServiceResponse perform(ServiceRequest<NamedValues> request) throws Exception {
		String uploadedFilename = (String) request.getData().get("uploadedFilename");
		String versionName = (String) request.getData().get("versionName");
		Boolean doAsCurrent = (Boolean) request.getData().get("doAsCurrent");
		Boolean doArchive = (Boolean) request.getData().get("doArchive");

		Integer version = VersionUtils.convertToNumber(versionName);

		InputStream stream = OPFEngine.FileStoreService.download(OpenFlame.FILESTORE_BASE, PackageFileType.PACKAGE_XML.getOfrFileName() + "." + uploadedFilename, helper.getTemp());
		PackageModel packageRN;
		IPackageDescriptor patchProcessor;
		if (StringUtils.isBlank(uploadedFilename) || stream == null) {
			throw new BusinessFunctionException(null, "file.is.not.exist", PackageFileType.PACKAGE_XML.name());
		} else {
			patchProcessor = packageInstallationService.getPackageDescriptor(stream);
			IOUtils.closeQuietly(stream);
			String packageLookup = patchProcessor.getPath() + "." + StringUtils.normalize(patchProcessor.getName());
			packageRN = packageStore.findByLookup(packageLookup);
			if (packageRN == null) {
				throw new BusinessFunctionException(null, "package.not.found.by.lookup", packageLookup);
			}
		}

		try {
			InputStream resourceStream = OPFEngine.FileStoreService.download(OpenFlame.FILESTORE_BASE, PackageFileType.RESOURCE_ZIP.getOfrFileName() + "." + uploadedFilename,helper.getTemp());
			InputStream warStream= OPFEngine.FileStoreService.download(OpenFlame.FILESTORE_BASE, PackageFileType.APP_WAR.getOfrFileName() + "." + uploadedFilename,helper.getTemp());

			String packageXmlFile = packageRN.getName() + PackageFileType.PACKAGE_XML.getDotExtension();

			if (doArchive) {
				IPackageDescriptor descriptor = packageExporter.exportPackageDescriptor(packageRN.getId());
				PackageExportResult result = packageExporter.exportPackageDescriptor(descriptor);
				packageVersionHelper.archiveVersion(packageRN, packageRN.getVersion(), result.getPackageXml());
			}

			Integer packageXmlVersion = VersionUtils.convertToNumber(patchProcessor.getVersion());
			if (!packageXmlVersion.equals(version)) {
				stream = OPFEngine.FileStoreService.download(OpenFlame.FILESTORE_BASE, PackageFileType.PACKAGE_XML.getOfrFileName() + "." + uploadedFilename, helper.getTemp());
				InputStream inputStream = packageVersionHelper.changeVersionNumber(stream, version);
				OPFEngine.FileStoreService.upload(OpenFlame.FILESTORE_BASE, PackageFileType.PACKAGE_XML.name() + uploadedFilename, inputStream, helper.getTemp());
				IOUtils.closeQuietly(stream);
				IOUtils.closeQuietly(inputStream);
			}

			stream = OPFEngine.FileStoreService.download(OpenFlame.FILESTORE_BASE, PackageFileType.PACKAGE_XML.getOfrFileName() + "." + uploadedFilename,helper.getTemp());
			OPFEngine.FileStoreService.upload(OpenFlame.FILESTORE_BASE, packageXmlFile, stream, helper.getVersion(), String.valueOf(packageRN.getId()), version.toString());
			IOUtils.closeQuietly(stream);

			String  resourceZipFile = packageRN.getName() + PackageFileType.RESOURCE_ZIP.getDotExtension();
			if (resourceStream != null) {
				OPFEngine.FileStoreService.upload(OpenFlame.FILESTORE_BASE,resourceZipFile,resourceStream, helper.getVersion(), String.valueOf(packageRN.getId()), version.toString());
				IOUtils.closeQuietly(resourceStream);
			}

			if (warStream != null) {
				String war = packageRN.getName() + PackageFileType.APP_WAR.getDotExtension();
				OPFEngine.FileStoreService.upload(OpenFlame.FILESTORE_BASE,war,warStream, helper.getVersion(), String.valueOf(packageRN.getId()), version.toString());
				IOUtils.closeQuietly(warStream);
			}

			if (doAsCurrent) {
				InputStream packageXml = OPFEngine.FileStoreService.download(OpenFlame.FILESTORE_BASE, packageXmlFile,helper.getVersion(), String.valueOf(packageRN.getId()), version.toString());
				InputStream resourceZip = OPFEngine.FileStoreService.download(OpenFlame.FILESTORE_BASE, resourceZipFile,helper.getVersion(), String.valueOf(packageRN.getId()), version.toString());
				StatusProviderTranslationResult result = packageInstallationService.activatePackage(packageXml, resourceZip);
				IOUtils.closeQuietly(packageXml);
				IOUtils.closeQuietly(resourceZip);
				if (result.getResult()) {
					packageRN = packageStore.updatePackageVersion(packageRN.getId(), version);
				}
			}
		} catch (IOException e) {
			logger.error(e.getMessage(), e);
		}

		return new ServiceResponse("Activate successfully", true);
	}
}


text:
<?php

namespace App;

use App\Photo;
use Illuminate\Database\Eloquent\Model;

class Flyer extends Model
{
    protected $guarded = [];

    /**
     * A flyer is composed of many photos
     * @return photos
     */
    public function photos()
    {
        return $this->hasMany('App\Photo');
    }

    /**
     * scope query to those located at a given address
     *
     * @param  Builder $query
     * @param  string $zip
     * @param  string $street
     * @return Builder
     */
    public static function locatedAt($zip, $street)
    {
        $street = str_replace('-', ' ', $street);

        return static::where(compact('zip','street'))->firstOrFail();
    }

    public function getPriceAttribute($price)
    {
        return '$'.number_format($price);
    }

    public function addPhoto(Photo $photo)
    {
        return $this->photos()->save($photo);
    }

    public function owner()
    {
        return $this->belongsTo('App\User','user_id');
    }

    public function ownedBy(User $user)
    {
        return $this->user_id == $user->id;
    }
}


text:
""" Contains the logic for `aq update building preference`. """

from aquilon.aqdb.model import BuildingPreference, Building
from aquilon.worker.broker import BrokerCommand
from aquilon.worker.dbwrappers.change_management import ChangeManagement
from aquilon.worker.dbwrappers.cluster import get_clusters_by_locations

class CommandUpdateBuildingPreference(BrokerCommand):

    requires_plenaries = True
    required_parameters = ["building_pair", "archetype"]

    def render(self, session, logger, plenaries, building_pair, archetype,
               prefer, justification, reason, user, **arguments):
        db_pref = BuildingPreference.get_unique(session,
                                                building_pair=building_pair,
                                                archetype=archetype,
                                                compel=True)
        db_pref.lock_row()

        cm = ChangeManagement(session, user, justification, reason, logger, self.command, **arguments)
        cm.consider(db_pref.archetype)
        cm.validate()

        for db_clus in get_clusters_by_locations(session, (db_pref.a, db_pref.b),
                                                 db_pref.archetype):
            plenaries.add(db_clus)

        if prefer:
            dbbuilding = Building.get_unique(session, prefer, compel=True)
            db_pref.prefer = dbbuilding

        session.flush()

        # FIXME: for large numbers of affected clusters, this may take a little
        # while -- refactor some feedback into the plenaries.write() where
        # verbose=True.

        plenaries.write(verbose=True)

        return


text:
<?php

Route::post(
    config('auto-deploy.route'), [
        'as' => 'autodeployroute',
        'uses' => 'Morphatic\AutoDeploy\Controllers\DeployController@index',
    ]
);


text:
print('string' == 'string')
print('string' != 'string')


text:
package edu.harvard.canvas_data.cli.dataset;

import java.io.IOException;
import java.io.PrintStream;

import org.kohsuke.args4j.Argument;

import edu.harvard.canvas_data.DataSetUtils;
import edu.harvard.canvas_data.cli.Command;
import edu.harvard.canvas_data.cli.ReturnStatus;
import edu.harvard.canvas_data.parser.Configuration;
import edu.harvard.data.client.DataSetInfo;

public class DataSetInfoCommand implements Command {

  @Argument(index = 0, usage = "Input Data Set (either a directory or LATEST). This argument is required", metaVar = "/path/to/directory", required = true)
  private String input;

  @Override
  public ReturnStatus execute(final Configuration config, final PrintStream out) throws IOException {
    final DataSetUtils utils = new DataSetUtils(config);
    final DataSetInfo info = utils.getDataSetInfo(input);
    if (info == null) {
      return ReturnStatus.BAD_DATA_SET;
    }
    out.println(info);
    return ReturnStatus.OK;
  }

  @Override
  public String getDescription() {
    return "Summarize the tables in a data set.";
  }

}


text:
#include "ch32v30x_wwdg.h"
#include "ch32v30x_rcc.h"

/* CTLR register bit mask */
#define CTLR_WDGA_Set      ((uint32_t)0x00000080)

/* CFGR register bit mask */
#define CFGR_WDGTB_Mask    ((uint32_t)0xFFFFFE7F)
#define CFGR_W_Mask        ((uint32_t)0xFFFFFF80)
#define BIT_Mask           ((uint8_t)0x7F)

/*********************************************************************
 * @fn      WWDG_DeInit
 *
 * @brief   Deinitializes the WWDG peripheral registers to their default reset values
 *
 * @return  none
 */
void WWDG_DeInit(void)
{
    RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, ENABLE);
    RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, DISABLE);
}

/*********************************************************************
 * @fn      WWDG_SetPrescaler
 *
 * @brief   Sets the WWDG Prescaler
 *
 * @param   WWDG_Prescaler - specifies the WWDG Prescaler
 *            WWDG_Prescaler_1 - WWDG counter clock = (PCLK1/4096)/1
 *            WWDG_Prescaler_2 - WWDG counter clock = (PCLK1/4096)/2
 *            WWDG_Prescaler_4 - WWDG counter clock = (PCLK1/4096)/4
 *            WWDG_Prescaler_8 - WWDG counter clock = (PCLK1/4096)/8
 *
 * @return  none
 */
void WWDG_SetPrescaler(uint32_t WWDG_Prescaler)
{
    uint32_t tmpreg = 0;
    tmpreg = WWDG->CFGR & CFGR_WDGTB_Mask;
    tmpreg |= WWDG_Prescaler;
    WWDG->CFGR = tmpreg;
}

/*********************************************************************
 * @fn      WWDG_SetWindowValue
 *
 * @brief   Sets the WWDG window value
 *
 * @param   WindowValue - specifies the window value to be compared to the
 *        downcounter,which must be lower than 0x80
 *
 * @return  none
 */
void WWDG_SetWindowValue(uint8_t WindowValue)
{
    __IO uint32_t tmpreg = 0;

    tmpreg = WWDG->CFGR & CFGR_W_Mask;

    tmpreg |= WindowValue & (uint32_t)BIT_Mask;

    WWDG->CFGR = tmpreg;
}

/*********************************************************************
 * @fn      WWDG_EnableIT
 *
 * @brief   Enables the WWDG Early Wakeup interrupt(EWI)
 *
 * @return  none
 */
void WWDG_EnableIT(void)
{
    WWDG->CFGR |= (1 << 9);
}

/*********************************************************************
 * @fn      WWDG_SetCounter
 *
 * @brief   Sets the WWDG counter value
 *
 * @param   Counter - specifies the watchdog counter value,which must be a
 *        number between 0x40 and 0x7F
 *
 * @return  none
 */
void WWDG_SetCounter(uint8_t Counter)
{
    WWDG->CTLR = Counter & BIT_Mask;
}

/*********************************************************************
 * @fn      WWDG_Enable
 *
 * @brief   Enables WWDG and load the counter value
 *
 * @param   Counter - specifies the watchdog counter value,which must be a
 *        number between 0x40 and 0x7F
 * @return  none
 */
void WWDG_Enable(uint8_t Counter)
{
    WWDG->CTLR = CTLR_WDGA_Set | Counter;
}

/*********************************************************************
 * @fn      WWDG_GetFlagStatus
 *
 * @brief   Checks whether the Early Wakeup interrupt flag is set or not
 *
 * @return  The new state of the Early Wakeup interrupt flag (SET or RESET)
 */
FlagStatus WWDG_GetFlagStatus(void)
{
    return (FlagStatus)(WWDG->STATR);
}

/*********************************************************************
 * @fn      WWDG_ClearFlag
 *
 * @brief   Clears Early Wakeup interrupt flag
 *
 * @return  none
 */
void WWDG_ClearFlag(void)
{
    WWDG->STATR = (uint32_t)RESET;
}


text:
<?php

namespace FOS\ElasticaBundle\Index;

use FOS\ElasticaBundle\Elastica\Index;

class IndexManager
{
    /**
     * @var array
     */
    private $indexes;

    /**
     * @param array $indexes
     * @param Index $defaultIndex
     */
    public function __construct(array $indexes, Index $defaultIndex)
    {
        $this->defaultIndex = $defaultIndex;
        $this->indexes = $indexes;
    }

    /**
     * Gets all registered indexes
     *
     * @return array
     */
    public function getAllIndexes()
    {
        return $this->indexes;
    }

    /**
     * Gets an index by its name
     *
     * @param string $name Index to return, or the default index if null
     * @return Index
     * @throws \InvalidArgumentException if no index exists for the given name
     */
    public function getIndex($name = null)
    {
        if (null === $name) {
            return $this->defaultIndex;
        }

        if (!isset($this->indexes[$name])) {
            throw new \InvalidArgumentException(sprintf('The index "%s" does not exist', $name));
        }

        return $this->indexes[$name];
    }

    /**
     * Gets the default index
     *
     * @return Index
     */
    public function getDefaultIndex()
    {
        return $this->defaultIndex;
    }
}


text:
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <getopt.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <errno.h>

#include "closeout.h"
#include "error.h"
#include "progname.h"
#include "relocatable.h"
#include "basename.h"
#include "xalloc.h"
#include "exit.h"

#include "gettext.h"

#define _(str) gettext (str)

/* If true, expand escape sequences in strings before looking in the
   message catalog.  */
static int do_expand;

/* Long options.  */
static const struct option long_options[] =
{
  { "domain", required_argument, NULL, 'd' },
  { "help", no_argument, NULL, 'h' },
  { "version", no_argument, NULL, 'V' },
  { NULL, 0, NULL, 0 }
};

/* Forward declaration of local functions.  */
static void usage (int status)
#if defined __GNUC__ && ((__GNUC__ == 2 && __GNUC_MINOR__ >= 5) || __GNUC__ > 2)
     __attribute__ ((noreturn))
#endif
;
static const char *expand_escape (const char *str);

int
main (int argc, char *argv[])
{
  int optchar;
  const char *msgid;
  const char *msgid_plural;
  const char *count;
  unsigned long n;

  /* Default values for command line options.  */
  bool do_help = false;
  bool do_version = false;
  const char *domain = getenv ("TEXTDOMAIN");
  const char *domaindir = getenv ("TEXTDOMAINDIR");
  do_expand = false;

  /* Set program name for message texts.  */
  set_program_name (argv[0]);

#ifdef HAVE_SETLOCALE
  /* Set locale via LC_ALL.  */
  setlocale (LC_ALL, "");
#endif

  /* Set the text message domain.  */
  bindtextdomain (PACKAGE, relocate (LOCALEDIR));
  textdomain (PACKAGE);

  /* Ensure that write errors on stdout are detected.  */
  atexit (close_stdout);

  /* Parse command line options.  */
  while ((optchar = getopt_long (argc, argv, "+d:eEhV", long_options, NULL))
	 != EOF)
    switch (optchar)
    {
    case '\0':		/* Long option.  */
      break;
    case 'd':
      domain = optarg;
      break;
    case 'e':
      do_expand = true;
      break;
    case 'E':
      /* Ignore.  Just for compatibility.  */
      break;
    case 'h':
      do_help = true;
      break;
    case 'V':
      do_version = true;
      break;
    default:
      usage (EXIT_FAILURE);
    }

  /* Version information is requested.  */
  if (do_version)
    {
      printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION);
      /* xgettext: no-wrap */
      printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions.  There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
"),
	      "1995-1997, 2000-2004");
      printf (_("Written by %s.\n"), "Ulrich Drepper");
      exit (EXIT_SUCCESS);
    }

  /* Help is requested.  */
  if (do_help)
    usage (EXIT_SUCCESS);

  /* More optional command line options.  */
  switch (argc - optind)
    {
    default:
      error (EXIT_FAILURE, 0, _("too many arguments"));

    case 4:
      domain = argv[optind++];
      /* FALLTHROUGH */

    case 3:
      break;

    case 2:
    case 1:
    case 0:
      error (EXIT_FAILURE, 0, _("missing arguments"));
    }

  /* Now the mandatory command line options.  */
  msgid = argv[optind++];
  msgid_plural = argv[optind++];
  count = argv[optind++];

  if (optind != argc)
    abort ();

  {
    char *endp;
    unsigned long tmp_val;

    errno = 0;
    tmp_val = strtoul (count, &endp, 10);
    if (errno == 0 && count[0] != '\0' && endp[0] == '\0')
      n = tmp_val;
    else
      /* When COUNT is not valid, use plural.  */
      n = 99;
  }

  /* Expand escape sequences if enabled.  */
  if (do_expand)
    {
      msgid = expand_escape (msgid);
      msgid_plural = expand_escape (msgid_plural);
    }

  /* If no domain name is given we don't translate, and we use English
     plural form handling.  */
  if (domain == NULL || domain[0] == '\0')
    fputs (n == 1 ? msgid : msgid_plural, stdout);
  else
    {
      /* Bind domain to appropriate directory.  */
      if (domaindir != NULL && domaindir[0] != '\0')
	bindtextdomain (domain, domaindir);

      /* Write out the result.  */
      fputs (dngettext (domain, msgid, msgid_plural, n), stdout);
    }

  exit (EXIT_SUCCESS);
}

/* Display usage information and exit.  */
static void
usage (int status)
{
  if (status != EXIT_SUCCESS)
    fprintf (stderr, _("Try `%s --help' for more information.\n"),
	     program_name);
  else
    {
      /* xgettext: no-wrap */
      printf (_("\
Usage: %s [OPTION] [TEXTDOMAIN] MSGID MSGID-PLURAL COUNT\n\
"), program_name);
      printf ("\n");
      /* xgettext: no-wrap */
      printf (_("\
Display native language translation of a textual message whose grammatical\n\
form depends on a number.\n"));
      printf ("\n");
      /* xgettext: no-wrap */
      printf (_("\
  -d, --domain=TEXTDOMAIN   retrieve translated message from TEXTDOMAIN\n\
  -e                        enable expansion of some escape sequences\n\
  -E                        (ignored for compatibility)\n\
  -h, --help                display this help and exit\n\
  -V, --version             display version information and exit\n\
  [TEXTDOMAIN]              retrieve translated message from TEXTDOMAIN\n\
  MSGID MSGID-PLURAL        translate MSGID (singular) / MSGID-PLURAL (plural)\n\
  COUNT                     choose singular/plural form based on this value\n"));
      printf ("\n");
      /* xgettext: no-wrap */
      printf (_("\
If the TEXTDOMAIN parameter is not given, the domain is determined from the\n\
environment variable TEXTDOMAIN.  If the message catalog is not found in the\n\
regular directory, another location can be specified with the environment\n\
variable TEXTDOMAINDIR.\n\
Standard search directory: %s\n"),
	      getenv ("IN_HELP2MAN") == NULL ? LOCALEDIR : "@localedir@");
      printf ("\n");
      fputs (_("Report bugs to <bug-gnu-gettext@gnu.org>.\n"), stdout);
    }

  exit (status);
}

/* Expand some escape sequences found in the argument string.  */
static const char *
expand_escape (const char *str)
{
  char *retval, *rp;
  const char *cp = str;

  do
    {
      while (cp[0] != '\0' && cp[0] != '\\')
	++cp;
    }
  while (cp[0] != '\0' && cp[1] != '\0'
	 && strchr ("bfnrt\\01234567", cp[1]) == NULL);

  if (cp[0] == '\0')
    return str;

  retval = (char *) xmalloc (strlen (str));

  rp = retval + (cp - str);
  memcpy (retval, str, cp - str);

  do
    {
      switch (*++cp)
	{
	case 'b':		/* backspace */
	  *rp++ = '\b';
	  ++cp;
	  break;
	case 'f':		/* form feed */
	  *rp++ = '\f';
	  ++cp;
	  break;
	case 'n':		/* new line */
	  *rp++ = '\n';
	  ++cp;
	  break;
	case 'r':		/* carriage return */
	  *rp++ = '\r';
	  ++cp;
	  break;
	case 't':		/* horizontal tab */
	  *rp++ = '\t';
	  ++cp;
	  break;
	case '\\':
	  *rp = '\\';
	  ++cp;
	  break;
	case '0': case '1': case '2': case '3':
	case '4': case '5': case '6': case '7':
	  {
	    int ch = *cp++ - '0';

	    if (*cp >= '0' && *cp <= '7')
	      {
		ch *= 8;
		ch += *cp++ - '0';

		if (*cp >= '0' && *cp <= '7')
		  {
		    ch *= 8;
		    ch += *cp++ - '0';
		  }
	      }
	    *rp = ch;
	  }
	  break;
	default:
	  *rp = '\\';
	  break;
	}

      while (cp[0] != '\0' && cp[0] != '\\')
	*rp++ = *cp++;
    }
  while (cp[0] != '\0');

  /* Terminate string.  */
  *rp = '\0';

  return (const char *) retval;
}


text:
require 'spec_helper'

describe Macmillan::Utils::Logger::Factory do
  describe '#build_logger' do
    context 'for a syslog logger' do
      subject { Macmillan::Utils::Logger::Factory.build_logger(:syslog, tag: 'myapp', facility: 2) }

      it 'returns a Logger::Syslog object' do
        expect(subject).to be_an_instance_of(Logger::Syslog)
      end

      it 'allows you to configure the syslog tag and facility' do
        expect(Logger::Syslog).to receive(:new).with('myapp', Syslog::LOG_LOCAL2).and_call_original
        subject
      end

      it 'aliases logger#write to logger#info' do
        expect(subject).to respond_to(:write)
      end
    end

    context 'for a standard Logger' do
      subject { Macmillan::Utils::Logger::Factory.build_logger(:logger) }

      it 'returns a Logger object' do
        expect(subject).to be_an_instance_of(Logger)
      end

      it 'logs to STDOUT by default' do
        expect(Logger).to receive(:new).with($stdout).and_call_original
        subject
      end

      it 'allows you to configure the log target' do
        logger = double('logger').as_null_object
        expect(Logger).to receive(:new).with('foo.log').and_return(logger)

        Macmillan::Utils::Logger::Factory.build_logger(:logger, target: 'foo.log')
      end
    end

    context 'for a null logger' do
      subject { Macmillan::Utils::Logger::Factory.build_logger(:null) }

      it 'returns a Logger object' do
        expect(subject).to be_an_instance_of(Logger)
      end

      it 'builds a logger object that points to /dev/null' do
        expect(Logger).to receive(:new).with('/dev/null').and_call_original
        subject
      end
    end
  end
end


text:
package('Date | Spanish', function () {

  var now = new Date();
  testSetLocale('es');

  method('create', function() {
    dateEqual(testCreateDate('la semana pasada'), getRelativeDate(null, null, -7), 'Last week');

    dateEqual(testCreateDate('15 de mayo 2011'), new Date(2011, 4, 15), 'Date#create | basic Spanish date');
    dateEqual(testCreateDate('5 de enero de 2012'), new Date(2012, 0, 5), '2012-01-05');
    dateEqual(testCreateDate('mayo de 2011'), new Date(2011, 4), 'year and month');
    dateEqual(testCreateDate('15 de mayo'), new Date(now.getFullYear(), 4, 15), 'month and date');
    dateEqual(testCreateDate('2011'), new Date(2011, 0), 'year');
    dateEqual(testCreateDate('mayo'), new Date(now.getFullYear(), 4), 'month');
    dateEqual(testCreateDate('lunes'), getDateWithWeekdayAndOffset(1), 'Monday');

    dateEqual(testCreateDate('5 de enero de 2012 3:45'), new Date(2012, 0, 5, 3, 45), '2012-01-05 3:45');
    dateEqual(testCreateDate('5 de enero de 2012 3:45pm'), new Date(2012, 0, 5, 15, 45), '2012-01-05 3:45pm');

    dateEqual(testCreateDate('hace 1 milisegundo'), getRelativeDate(null, null, null, null, null, null,-1), 'one millisecond ago');
    dateEqual(testCreateDate('hace 1 segundo'), getRelativeDate(null, null, null, null, null, -1), 'one second ago');
    dateEqual(testCreateDate('hace 1 minuto'), getRelativeDate(null, null, null, null, -1), 'one minute ago');
    dateEqual(testCreateDate('hace 1 hora'), getRelativeDate(null, null, null, -1), 'one hour ago');
    dateEqual(testCreateDate('hace 1 día'), getRelativeDate(null, null, -1), 'one day ago');
    dateEqual(testCreateDate('hace 1 semana'), getRelativeDate(null, null, -7), 'one week');
    dateEqual(testCreateDate('hace 1 mes'), getRelativeDate(null, -1), 'one month ago');
    dateEqual(testCreateDate('hace 1 año'), getRelativeDate(-1), 'one year ago');

    dateEqual(testCreateDate('dentro de 5 milisegundos'), getRelativeDate(null, null, null, null, null, null,5), 'five milliseconds from now');
    dateEqual(testCreateDate('dentro de 5 segundos'), getRelativeDate(null, null, null, null, null, 5), 'five second from now');
    dateEqual(testCreateDate('dentro de 5 minutos'), getRelativeDate(null, null, null, null, 5), 'five minute from now');
    dateEqual(testCreateDate('dentro de 5 horas'), getRelativeDate(null, null, null, 5), 'five hour from now');
    dateEqual(testCreateDate('dentro de 5 días'), getRelativeDate(null, null, 5), 'five day from now');
    dateEqual(testCreateDate('dentro de 5 semanas'), getRelativeDate(null, null, 35), 'five weeks from now');
    dateEqual(testCreateDate('dentro de 5 meses'), getRelativeDate(null, 5), 'five months from now');
    dateEqual(testCreateDate('dentro de 5 años'), getRelativeDate(5), 'five years from now');

    dateEqual(testCreateDate('anteayer'), run(getRelativeDate(null, null, -2), 'reset'), '一昨日');
    dateEqual(testCreateDate('ayer'), run(getRelativeDate(null, null, -1), 'reset'), 'yesterday');
    dateEqual(testCreateDate('hoy'), run(getRelativeDate(null, null, 0), 'reset'), 'today');
    dateEqual(testCreateDate('mañana'), run(getRelativeDate(null, null, 1), 'reset'), 'tomorrow');

    dateEqual(testCreateDate('la semana pasada'), getRelativeDate(null, null, -7), 'Last week');
    dateEqual(testCreateDate('la próxima semana'), getRelativeDate(null, null, 7), 'Next week');

    dateEqual(testCreateDate('el mes pasado'), getRelativeDate(null, -1), 'last month');
    dateEqual(testCreateDate('el próximo mes'), getRelativeDate(null, 1), 'Next month');

    dateEqual(testCreateDate('proximo lunes'), testCreateDate('next monday', 'en'), 'next monday no accent');
    dateEqual(testCreateDate('próximo lunes'), testCreateDate('next monday', 'en'), 'next monday accent');
    dateEqual(testCreateDate('pasado lunes'), testCreateDate('last monday', 'en'), 'last monday front');
    dateEqual(testCreateDate('lunes pasado'), testCreateDate('last monday', 'en'), 'last monday back');

    dateEqual(testCreateDate('lunes pasado 3:45'), run(testCreateDate('last monday', 'en'), 'set', [{ hour: 3, minute: 45 }, true]), 'last monday back 3:45');
    dateEqual(testCreateDate('proximo lunes 3:45'), run(testCreateDate('next monday', 'en'), 'set', [{ hour: 3, minute: 45 }, true]), 'next monday no accent 3:45');

    dateEqual(testCreateDate('el año pasado'), getRelativeDate(-1), 'Last year');
    dateEqual(testCreateDate('el próximo año'), getRelativeDate(1), 'Next year');

    // no accents
    dateEqual(testCreateDate('hace 1 dia'), getRelativeDate(null, null, -1), 'one day ago');
    dateEqual(testCreateDate('proximo mes'), getRelativeDate(null, 1), 'Next month');
    dateEqual(testCreateDate('proxima semana'), getRelativeDate(null, null, 7), 'Next week');
    dateEqual(testCreateDate('manana'), run(getRelativeDate(null, null, 1), 'reset'), 'tomorrow');
    dateEqual(testCreateDate('hace 1 ano'), getRelativeDate(-1), 'one year ago');

    dateEqual(testCreateDate('mañana a las 3:30'), run(getRelativeDate(null, null, 1), 'set', [{hours:3,minutes:30}, true]), 'tomorrow at 3:30');

  });

  method('format', function() {
    var then = new Date(2011, 7, 25, 15, 45, 50);
    test(then, '25 agosto 2011 15:45', 'standard format');
    test(then, ['{dd} de {month} de {yyyy}'], '25 de agosto de 2011', 'format');

    // Format shortcuts
    equal(run(then, 'format', ['long']), '25 agosto 2011 15:45', 'long format');
    equal(run(then, 'long'), '25 agosto 2011 15:45', 'long shortcut');
    equal(run(then, 'format', ['full']), 'Jueves 25 agosto 2011 15:45:50', 'full format');
    equal(run(then, 'full'), 'Jueves 25 agosto 2011 15:45:50', 'full shortcut');
    equal(run(then, 'format', ['short']), '25 agosto 2011', 'short format');
    equal(run(then, 'short'), '25 agosto 2011', 'short shortcut');
  });

  method('relative', function() {
    test(testCreateDate('1 second ago', 'en'), 'hace 1 segundo');
    test(testCreateDate('1 minute ago', 'en'), 'hace 1 minuto');
    test(testCreateDate('1 hour ago', 'en'),   'hace 1 hora');
    test(testCreateDate('1 day ago', 'en'),    'hace 1 día');
    test(testCreateDate('1 week ago', 'en'),   'hace 1 semana');
    test(testCreateDate('1 month ago', 'en'),  'hace 1 mes');
    test(testCreateDate('1 year ago', 'en'),   'hace 1 año');

    test(testCreateDate('2 seconds ago', 'en'), 'hace 2 segundos');
    test(testCreateDate('2 minutes ago', 'en'), 'hace 2 minutos');
    test(testCreateDate('2 hours ago', 'en'),   'hace 2 horas');
    test(testCreateDate('2 days ago', 'en'),    'hace 2 días');
    test(testCreateDate('2 weeks ago', 'en'),   'hace 2 semanas');
    test(testCreateDate('2 months ago', 'en'),  'hace 2 meses');
    test(testCreateDate('2 years ago', 'en'),   'hace 2 años');

    test(testCreateDate('1 second from now', 'en'), 'dentro de 1 segundo');
    test(testCreateDate('1 minute from now', 'en'), 'dentro de 1 minuto');
    test(testCreateDate('1 hour from now', 'en'),   'dentro de 1 hora');
    test(testCreateDate('1 day from now', 'en'),    'dentro de 1 día');
    test(testCreateDate('1 week from now', 'en'),   'dentro de 1 semana');
    test(testCreateDate('1 month from now', 'en'),  'dentro de 1 mes');
    test(testCreateDate('1 year from now', 'en'),   'dentro de 1 año');

    test(testCreateDate('5 second from now', 'en'), 'dentro de 5 segundos');
    test(testCreateDate('5 minute from now', 'en'), 'dentro de 5 minutos');
    test(testCreateDate('5 hour from now', 'en'),   'dentro de 5 horas');
    test(testCreateDate('5 day from now', 'en'),    'dentro de 5 días');
    test(testCreateDate('5 week from now', 'en'),   'dentro de 1 mes');
    test(testCreateDate('5 month from now', 'en'),  'dentro de 5 meses');
    test(testCreateDate('5 year from now', 'en'),   'dentro de 5 años');
  });

});

package('Number | Spanish Dates', function () {

  method('duration', function() {
    test(run(5, 'hours'), ['es'], '5 horas', 'Date#create | Spanish | simple duration');
  });

});


text:
namespace differential_privacy {

namespace testing {

// Runs the Stochastic Tester on three algorithm types, each of which has been
// deliberately constructed to violate differential privacy. Measures the
// Stochastic Tester's ability to detect the differential privacy violations
// over a continuous range of ratio values.

template <typename T>
class CountWithInsufficientNoise : public differential_privacy::Count<T> {
 public:
  CountWithInsufficientNoise(double epsilon,
    std::unique_ptr<LaplaceMechanism::Builder> builder, double ratio)
    : Count<T>(epsilon,
    builder->SetEpsilon(epsilon)
    .Build()
    .ValueOrDie()),
    ratio_(ratio) {}
// Overrides epsilon such that amount of noise applied is only a fraction of
// what privacy protection claimed
  double GetEpsilon() const override { return Algorithm<T>::GetEpsilon()
    * ratio_; }
  double ratio_;
};

template <typename T, typename std::enable_if<std::is_integral<T>::value ||
	std::is_floating_point<T>::value>::type* = nullptr>
class SumWithInsufficientNoise : public differential_privacy::BoundedSum<T> {
 public:
  SumWithInsufficientNoise(double epsilon, T lower, T upper,
    const double l0_sensitivity, const double max_contributions_per_partition,
    std::unique_ptr<LaplaceMechanism::Builder> builder, double ratio)
    : BoundedSum<T>(epsilon, lower, upper, l0_sensitivity,
    max_contributions_per_partition, std::move(builder),
    builder->SetEpsilon(epsilon)
    .SetL0Sensitivity(l0_sensitivity)
    .SetLInfSensitivity(max_contributions_per_partition * std::max(std::abs(lower),std::abs(upper)))
    .Build()
    .ValueOrDie(),nullptr),
    ratio_(ratio) {}
// Overrides epsilon such that amount of noise applied is only a fraction of
// what privacy protection claimed
  double GetEpsilon() const override { return Algorithm<T>::GetEpsilon()
    * ratio_; }
  double ratio_;
};

template <typename T, typename std::enable_if<std::is_integral<T>::value ||
std::is_floating_point<T>::value>::type* = nullptr>
class MeanWithInsufficientNoise : public differential_privacy::BoundedMean<T> {
 public:
  MeanWithInsufficientNoise(double epsilon, T lower, T upper,
    const double l0_sensitivity, const double max_contributions_per_partition,
    std::unique_ptr<LaplaceMechanism::Builder> builder, double ratio)
    : BoundedMean<T>(epsilon, lower, upper, l0_sensitivity,
    max_contributions_per_partition, std::move(builder),
    builder->SetEpsilon(epsilon)
    .SetL0Sensitivity(l0_sensitivity)
    .SetLInfSensitivity(max_contributions_per_partition * (std::abs(upper - lower) / 2))
    .Build()
    .ValueOrDie(),
    builder->SetEpsilon(epsilon)
    .Build()
    .ValueOrDie(),nullptr),
    ratio_(ratio) {}
// Overrides epsilon such that amount of noise applied is only a fraction of
// what privacy protection claimed
  double GetEpsilon() const override { return Algorithm<T>::GetEpsilon()
    * ratio_; }
 private:
  double ratio_;
};

bool RunStochasticTesterOnCount(double ratio, int num_datasets,
  int num_samples_per_histogram);

bool RunStochasticTesterOnSum(double ratio, int num_datasets,
  int num_samples_per_histogram);

bool RunStochasticTesterOnMean(double ratio, int num_datasets,
  int num_samples_per_histogram);

struct SummaryResults {
      int num_tests;
      int num_tests_passed;
      double maximum_ratio;
      std::chrono::duration<double> total_time;
};

base::StatusOr<SummaryResults> GetTestResultsForCount(int num_datasets,
  int num_samples_per_histogram, double ratio_min, double ratio_max,
  double increment, std::ofstream& datafile);

base::StatusOr<SummaryResults> GetTestResultsForSum(int num_datasets,
  int num_samples_per_histogram, double ratio_min, double ratio_max,
  double increment, std::ofstream& datafile);

base::StatusOr<SummaryResults> GetTestResultsForMean(int num_datasets,
  int num_samples_per_histogram, double ratio_min, double ratio_max,
  double increment, std::ofstream& datafile);

} // namespace testing
} // namespace differential_privacy

#endif  // INSUFFICIENT_NOISE_ALGORITHMS_H_


text:
package org.apache.tinkerpop.gremlin.process.traversal.strategy.verification;

import org.apache.tinkerpop.gremlin.process.traversal.Step;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.step.Mutating;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;

/**
 * Detects steps marked with {@link Mutating} and throws an {@link IllegalStateException} if one is found.
 *
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 * @example <pre>
 * __.out().addE()                 // throws an VerificationException
 * __.addV()                       // throws an VerificationException
 * __.property(key,value)          // throws an VerificationException
 * __.out().drop()                 // throws an VerificationException
 * </pre>
 */
public final class ReadOnlyStrategy extends AbstractTraversalStrategy<TraversalStrategy.VerificationStrategy> implements TraversalStrategy.VerificationStrategy {

    private static final ReadOnlyStrategy INSTANCE = new ReadOnlyStrategy();

    private ReadOnlyStrategy() {
    }

    @Override
    public void apply(final Traversal.Admin<?, ?> traversal) {
        for (final Step step : traversal.getSteps()) {
            if (step instanceof Mutating)
                throw new VerificationException("The provided traversal has a mutating step and thus is not read only: " + step, traversal);
        }
    }

    public static ReadOnlyStrategy instance() {
        return INSTANCE;
    }
}


text:
require 'mattock/cascading-definition'
require 'calibrate'
require 'singleton' #Rake fails to require this properly
require 'rake/task'
require 'rake/file_task'
require 'rake/file_creation_task'
require 'rake/multi_task'

module Mattock
  # A configurable subclass of Rake::Task, such that you can use a
  # configuration block to change how a common task behaves, while still
  # overriding Rake API methods like Task#needed? and Task#timestamp
  module ConfigurableTask
    include Calibrate::Configurable
    include CascadingDefinition
    include DeferredDefinition
    include Calibrate::Configurable::DirectoryStructure

    module ClassMethods
      def default_taskname(name)
        setting(:task_name, name)
      end

      def define_task(*args)
        configs = args.take_while{|arg| Calibrate::Configurable === arg}
        extracted_task_args = args[configs.length..-1]
        if extracted_task_args.any?{|arg| Calibrate::Configurable === arg}
          raise "Mattock::Task classes should be created with parent configs, then Rake task args"
        end

        if extracted_task_args.empty?
          extracted_task_args = [default_value_for(:task_name)]
        end

        task = ::Rake.application.define_task(self, *extracted_task_args) do |task, args|
          task.finalize_configuration
          task.action(args)
        end

        #XXX ?? Dilemma: this prevents an existing task action from being
        #enriched with this one, but not v/v - it also doesn't prevent double
        #-definition of this task...
        unless self === task
          raise "Task already defined for #{task.name} - attempted to redefine with #{self.name}"
        end

        task.setup_deferred
        task.setup_cascade(*configs) do |t|
          t.task_name = task.name
          t.task_args = extracted_task_args

          yield(t) if block_given?
        end
        return task
      end
    end

    def self.included(sub)
      sub.extend ClassMethods
      Calibrate::Configurable.included(sub)
      Calibrate::Configurable::DirectoryStructure.included(sub)
      DeferredDefinition.add_settings(sub)
      sub.setting :task_name
      sub.setting :task_args
    end

    attr_accessor :base_task

    def resolve_configuration
      super
    end

    def action(*task_args)
    end

    def inspect
      "#{self.class.name}: #{self.task_args.inspect}\nConfiguration:\n#{self.class.inspect_instance(self, "  ")}"
    end
  end

  class DeprecatedTaskAPI
    def self.deprecated(message)
      @deprecations ||= {}
      unless @deprecations.has_key?(message)
        warn message
        @deprecations[message] = :delivered
      end
    end

    def initialize(*args, &block)
      self.class.deprecated "#{self.class.name}.new(...) is deprecated - instead use #{target_class.name}.define_task(...)\n  (from #{caller[0]})"
      target_class.define_task(*args, &block)
    end
  end

  module Rake
    class Task < ::Rake::Task
      include ConfigurableTask
    end

    class FileTask < ::Rake::FileTask
      include ConfigurableTask
    end

    class FileCreationTask < ::Rake::FileCreationTask
      include ConfigurableTask
    end

    class MultiTask < ::Rake::MultiTask
      include ConfigurableTask
    end
  end

  class Task < DeprecatedTaskAPI
    def target_class; Rake::Task; end
  end

  class FileTask < DeprecatedTaskAPI
    def target_class; Rake::FileTask; end
  end
end