text:
Cookbook for Opscode Chef.

http://community.opscode.com/cookbooks/unix_bin

## Description

Provides LWRPs for installing/requiring unix command-line executables,
without needing to know or specify the OS package that provides it.

For supported platforms and operating systems, see below.

## Example Usage

### You want an executable whose package doesn't match its name

Ex. we want **nslookup** (which is really provided by _bind-utils_)

    unix_bin "nslookup" do
      action :install
    end

    ##--  instead of  --##

    package "bind-utils" do
      action :install
    end

### The package name is different between operating systems

Ex. we want **mysqldump** (which can be in _mysql_ or _mysql-client_ depending)

    unix_bin "mysqldump" do
      action :install
    end

    ##--  instead of  --##

    case node[:platform]
      when "ubuntu","debian"
        package "mysql-client" do
          action :install
        end
      when "centos"
        package "mysql" do
          action :install
        end
      end
    end

### You want the "mail" command and don't care where it comes from

The **sendmail** binary could come from _postfix_, _sendmail_, or _exim_.
Demanding a specific package is an unnecessary headache if any of them meet your needs.

You can specify a default preference if the command is missing,
or the first package offered will be selected automatically

    # Install sendmail, only if no mail command already installed.

    unix_bin "mail" do
      action :install
      package "sendmail"     # OPTIONAL, default preference
    end

    ##--  instead of  --##

    # Assuming sendmail, causing your recipe to fail on exim or postfix.

    package "sendmail" do
      action :install
    end

    # Assuming the path is the same across all operating systems,
    # and with more verbose code.

    package "sendmail" do
      action :install
      not_if { ::File.exists?("/usr/sbin/sendmail") }
    end

### You want to require any "java", but not attempt to install it.

Since java can come from many sources, requiring a package is problematic.
In this case your recipe will error out at runtime if java is not installed.

    unix_bin "java" do
      action :require
    end

    ##--  instead of  --##

    extend ::Chef::Mixin::ShellOut
    shell_out!("/usr/bin/which mail")

Your cookbook's user can solve the requirement by adding a Java recipe to the server's run_list,
or by installing manually via the operating system.

## Rationale and Benefits

**Increased portability**

An install action works in any OS this cookbook does, even if the required package is different.

**Increased readability**

Clarity in what resource you need even if the executable is part of a larger package.

**Simplified cookbook prep**

Ensure the command-line tools you need are in-place, and optionally try to install missing ones, without extensive
testing and/or causing more obscure errors later in your recipe.

## LWRP Documentation

### Requiring an executable

An exception will be raised if the executable is not available, no attempt will be made to install it.
(**This is the default action.**)

As an example, we want to ensure **ifconfig** is available.

    unix_bin "ifconfig"

If you don't want to require the executable be available in the system's shell PATH, but are satisfied with it only
being installed (in one of the configured paths), you can use:

    unix_bin "ifconfig"
      action :require
      in_shell_path false
    end

### Installing an executable (if it is missing)

This also requires the executable in general, so a failure to install will lead to an exception.

Say we want to use the **convert** utility, which is actually part of ImageMagick:

    unix_bin "convert"
      action :install
    end

On **redhat** platforms you can also request the matching development package be installed.
(**This generates a warning on debian.**)

    unix_bin "convert"
      action :install
      with_devel true
    end

Which would install the packages:

  * ImageMagic
  * ImageMagic-devel

### Bulk syntax

As a convenience you can also use the following helper definition:

    unix_binaries do
      install [ "nslookup", "ncat", "wget" ]
      require [ "ifconfig" ]
    end

It also accepts the `in_shell_path` and `with_devel` flags (which are applied uniformly).

## Recipes

The default recipe is not required to use the LWRPs, however adding it to your `run_list` will automatically install
any executables listed in an array under `node['unix_bin']['install']`. (**By default this list is empty.**)

## Attributes

* `node['unix_bin']['search_paths']` - An array of paths to check (non-recursively) that an executable is already installed.
* `node['unix_bin']['install']` - An array of executable names to automatically install, if the default recipe is run.

## Resource add-ons

This cookbook also provides a helper for use with `only_if` and `not_if` clauses in Chef resources.

    cookbook_file "/etc/skel/.vimrc" do
      source "vimrc"
      only_if unix_bin_available("vim")
    end

## Platforms

Compatibility is largely dependent on the underlying OS package manager.

### Current Platforms

At present **yum** and **apt** are supported -- by extension most redhat and debian distros.

There are subtleties with every operating system however, we welcome bug reports.

### Future Platforms

Support is already planned for zypper and thereby OpenSUSE and SLED.

Feel free to open a ticket (see below) to request any platforms that are missing.

## Test-Kitchen

This package is **test-kitchen** enabled and automatically tested against:

- CentOS 5 and 6
- Ubuntu 10 and 12

## Detection method

Testing whether or not an executable is available is consistent across each OS.

The executable is determined to be **INSTALLED** if it exists in one of the paths specified in the configuration
`node['unix_bin']['search_paths']`, which defaults to: `/usr/bin : /usr/sbin : /bin : /sbin`.

It is determined to be **AVAILABLE** if it can be invoked from the system's shell PATH.

By default the `:require` action ensures that a given executable be AVAILABLE, but this can be changed.

However, no attempt will be made to install an executable that is either AVAILABLE or INSTALLED.

As such, if you :install an excutable that is installed in a search path, but not available via the shell PATH,
an exception will be raised (unless the `in_shell_path` attribute is false).

## Development and Maintenance

* Found a bug?
* Need some help?
* Have a suggestion?
* Want to contribute?

Please visit: [code.binbab.org](http://code.binbab.org)

## Authors and License

  * Author:: BinaryBabel OSS (<projects@binarybabel.org>)
  * Copyright:: 2013 `sha1(OWNER) = df334a7237f10846a0ca302bd323e35ee1463931`
  * License:: Apache License, Version 2.0

----

    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.


text:
<?php

use Philo\Blade\Blade;
use Riverskies\Laravel\VueComponent\BladeDirectiveInterface;
use Riverskies\Laravel\VueComponent\VueComponentDirective;

class VueComponentTest extends \PHPUnit_Framework_TestCase
{
    /**
     * Blade template engine instance.
     * @var Blade
     */
    protected $blade;

    /**
     * Set up function.
     */
    public function setUp() {
        parent::setUp();

        $this->blade = $this->setUpTemplateEngine(new VueComponentDirective);
    }

    /** @test */
    public function it_ignores_the_tags_if_the_specified_variable_is_not_defined()
    {
        $html = $this->blade->view()->make('test')->render();

        $this->assertEquals('
Testing
', $this->clean($html));
    }

    /** @test */
    public function it_returns_the_component_tags_if_vue_component_variable_is_set()
    {
        $html = $this->blade->view()->make('test')->with(['vueComponent' => 'test-comp'])->render();

        $this->assertEquals(
            '<component is="test-comp" inline-template v-cloak>
Testing
</component>',
            $this->clean($html)
        );
    }

    /** @test */
    public function it_returns_the_component_tag_if_vue_component_variable_is_array()
    {
        $data = [
            'vueComponent' => [
                'is' => 'test-comp'
            ],
        ];

        $html = $this->blade->view()->make('test')->with($data)->render();

        $this->assertEquals(
            '<component is="test-comp" inline-template v-cloak>
Testing
</component>',
            $this->clean($html)
        );
    }

    /** @test */
    public function it_adds_the_data_parameter_to_the_component()
    {
        $data = [
            'vueComponent' => [
                'is' => 'test-comp',
                'data' => [
                    'value' => 123
                ]
            ],
        ];

        $html = $this->blade->view()->make('test')->with($data)->render();

        $this->assertEquals(
            '<component is="test-comp" data="JSON.parse(decodeURIComponent(\'' . rawurlencode(json_encode($data['vueComponent']['data'])) . '\'))" inline-template v-cloak>
Testing
</component>',
            $this->clean($html)
        );
    }

    /**
     * Minifying HTML content.
     *
     * @link http://stackoverflow.com/questions/5312349/minifying-final-html-output-using-regular-expressions-with-codeigniter#answer-5324014
     *
     * @param $data
     * @return mixed
     */
    private function clean($data)
    {
        $regexp = '%# Collapse whitespace everywhere but in blacklisted elements.
        (?>             # Match all whitespaces other than single space.
          [^\S ]\s*     # Either one [\t\r\n\f\v] and zero or more ws,
        | \s{2,}        # or two or more consecutive-any-whitespace.
        ) # Note: The remaining regex consumes no text at all...
        (?=             # Ensure we are not in a blacklist tag.
          [^<]*+        # Either zero or more non-"<" {normal*}
          (?:           # Begin {(special normal*)*} construct
            <           # or a < starting a non-blacklist tag.
            (?!/?(?:textarea|pre|script)\b)
            [^<]*+      # more non-"<" {normal*}
          )*+           # Finish "unrolling-the-loop"
          (?:           # Begin alternation group.
            <           # Either a blacklist start tag.
            (?>textarea|pre|script)\b
          | \z          # or end of file.
          )             # End alternation group.
        )  # If we made it here, we are not in a blacklist tag.
        %Six';

        return preg_replace($regexp, "", $data);
    }

    /**
     * Creates the context.
     *
     * @return array
     */
    private function createTestWorld()
    {
        list($resource, $view, $cache) = $this->getDirectories();

        @mkdir($resource);
        @mkdir($cache);
        @mkdir($view);

        @file_put_contents($view . '/test.blade.php', '
            @vue($vueComponent)

Testing

            @endvue
        ');

        return [$view, $cache];
    }

    /**
     * Sets up template engine to mimic Laravel.
     *
     * @param BladeDirectiveInterface $directive
     * @return Blade
     */
    private function setUpTemplateEngine(BladeDirectiveInterface $directive)
    {
        list($views, $cache) = $this->createTestWorld();
        $blade = new Blade($views, $cache);

        $blade->getCompiler()->directive(
            $directive->openingTag(), [$directive, 'openingHandler']
        );

        $blade->getCompiler()->directive(
            $directive->closingTag(), [$directive, 'closingHandler']
        );

        return $blade;
    }

    /**
     * Tear down function.
     */
    public function tearDown()
    {
        list($resource, $view, $cache) = $this->getDirectories();

        $this->deleteDirectory($view);
        $this->deleteDirectory($cache);
        $this->deleteDirectory($resource);
    }

    /**
     * Helper to set the directories.
     *
     * @return array
     */
    private function getDirectories()
    {
        $resource = __DIR__ . '/../resources';
        $view = __DIR__ . '/../resources/views';
        $cache = __DIR__ . '/../resources/cache';

        return array($resource, $view, $cache);
    }

    /**
     * Delete a directory with recursive check.
     *
     * @param $dir
     * @return bool
     */
    private function deleteDirectory($dir) {
        if (!file_exists($dir)) {
            return true;
        }

        if (!is_dir($dir)) {
            return unlink($dir);
        }

        foreach (scandir($dir) as $item) {
            if ($item == '.' || $item == '..') {
                continue;
            }

            if (!$this->deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) {
                return false;
            }

        }

        return rmdir($dir);
    }
}

redpajama_set_name: RedPajamaGithub


text:
def call_main_program_implicit_handle_base_exception():
    try:
        #application.main calls sys.exit() when done.
        application.main()
    except Exception as ex:
        log(ex)
    except:
        pass

def call_main_program_explicit_handle_base_exception():
    try:
        #application.main calls sys.exit() when done.
        application.main()
    except Exception as ex:
        log(ex)
    except BaseException:
        pass

def call_main_program_fixed():
    try:
        #application.main calls sys.exit() when done.
        application.main()
    except Exception as ex:
        log(ex)
    except SystemExit:
        pass


text:
using System;
using d60.Cirqus.Snapshotting.New;

namespace d60.Cirqus.Snapshotting
{
    /// <summary>
    /// Configuration extensions for enabling in-mem aggregate root snapshots
    /// </summary>
    public static class InMemSnapshotConfigEx
    {
        /// <summary>
        /// Configures Cirqus to use RAM to store aggregate root snapshots
        /// </summary>
        public static void UseInMemorySnapshotStore(this SnapshottingConfigurationBuilder builder)
        {
            if (builder == null) throw new ArgumentNullException("builder");

            builder.Register(c => new InMemorySnapshotStore());
        }
    }
}


text:
<?php
// Generated by Zend Framework 2
return array(
    'TMC\Controller\TMCController' => __DIR__ . '/src/TMC/Controller/TMCController.php',
    'TMC\Module'                   => __DIR__ . '/Module.php',
);


text:
package org.seasar.doma.jdbc.builder;

import java.sql.Statement;

import org.seasar.doma.DomaNullPointerException;
import org.seasar.doma.jdbc.Config;
import org.seasar.doma.jdbc.JdbcException;
import org.seasar.doma.jdbc.Sql;
import org.seasar.doma.jdbc.SqlLogType;
import org.seasar.doma.jdbc.command.DeleteCommand;
import org.seasar.doma.jdbc.query.SqlDeleteQuery;

/**
 * DELETE文を組み立て実行するクラスです。
 *

 * このクラスはスレッドセーフではありません。
 *
 *
例

 *
Java

 *
 *

 * DeleteBuilder builder = DeleteBuilder.newInstance(config);
 * builder.sql("delete from Emp");
 * builder.sql("where");
 * builder.sql("name = ").param(String.class, "SMITH");
 * builder.sql("and");
 * builder.sql("salary = ").param(BigDecimal.class, new BigDecimal(1000));
 * builder.execute();
 *

 *
 *
実行されるSQL

 *
 *

 * delete from Emp
 * where
 * name = 'SMITH'
 * and
 * salary = 1000
 *

 *
 *
 * @author taedium
 * @since 1.8.0
 */
public class DeleteBuilder {

    private final BuildingHelper helper;

    private final SqlDeleteQuery query;

    private final ParamIndex paramIndex;

    private DeleteBuilder(Config config) {
        this.helper = new BuildingHelper();
        this.query = new SqlDeleteQuery();
        this.query.setConfig(config);
        this.query.setCallerClassName(getClass().getName());
        this.query.setSqlLogType(SqlLogType.FORMATTED);
        this.paramIndex = new ParamIndex();
    }

    private DeleteBuilder(BuildingHelper builder, SqlDeleteQuery query,
            ParamIndex parameterIndex) {
        this.helper = builder;
        this.query = query;
        this.paramIndex = parameterIndex;
    }

    /**
     * ファクトリメソッドです。
     *
     * @param config
     *            設定
     * @return DELETE文を組み立てるビルダー
     * @throws DomaNullPointerException
     *             引数が{@code null} の場合
     */
    public static DeleteBuilder newInstance(Config config) {
        if (config == null) {
            throw new DomaNullPointerException("config");
        }
        return new DeleteBuilder(config);
    }

    /**
     * SQLの断片を追加します。
     *
     * @param sql
     *            SQLの断片
     * @return このインスタンス
     * @throws DomaNullPointerException
     *             引数が {@code null} の場合
     */
    public DeleteBuilder sql(String sql) {
        if (sql == null) {
            throw new DomaNullPointerException("sql");
        }
        helper.appendSqlWithLineSeparator(sql);
        return new SubsequentDeleteBuilder(helper, query, paramIndex);
    }

    /**
     * 最後に追加したSQLもしくはパラメータを削除します。
     *
     * @return このインスタンス
     */
    public DeleteBuilder removeLast() {
        helper.removeLast();
        return new SubsequentDeleteBuilder(helper, query, paramIndex);
    }

    /**
     * パラメータを追加します。
     *

     * パラメータの型には、基本型とドメインクラスを指定できます。
     *
     * @param

     *            パラメータの型
     * @param paramClass
     *            パラメータのクラス
     * @param param
     *            パラメータ
     * @return このインスタンス
     * @throws DomaNullPointerException
     *             {@code parameterClass} が {@code null} の場合
     */
    public
 DeleteBuilder param(Class
 paramClass, P param) {
        if (paramClass == null) {
            throw new DomaNullPointerException("paramClass");
        }
        return appendParam(paramClass, param, false);
    }

    /**
     * リテラルとしてパラメータを追加します。
     *

     * パラメータの型には、基本型とドメインクラスを指定できます。
     *
     * @param

     *            パラメータの型
     * @param paramClass
     *            パラメータのクラス
     * @param param
     *            パラメータ
     * @return このインスタンス
     * @throws DomaNullPointerException
     *             {@code parameterClass} が {@code null} の場合
     */
    public
 DeleteBuilder literal(Class
 paramClass, P param) {
        if (paramClass == null) {
            throw new DomaNullPointerException("paramClass");
        }
        return appendParam(paramClass, param, true);
    }

    private
 DeleteBuilder appendParam(Class
 paramClass, P param,
            boolean literal) {
        helper.appendParam(new Param(paramClass, param, paramIndex, literal));
        paramIndex.increment();
        return new SubsequentDeleteBuilder(helper, query, paramIndex);
    }

    /**
     * SQLを実行します。
     *
     * @return 更新件数
     * @throws JdbcException
     *             JDBCに関する例外が発生した場合
     */
    public int execute() {
        if (query.getMethodName() == null) {
            query.setCallerMethodName("execute");
        }
        prepare();
        DeleteCommand command = new DeleteCommand(query);
        int result = command.execute();
        query.complete();
        return result;
    }

    private void prepare() {
        query.clearParameters();
        for (Param p : helper.getParams()) {
            query.addParameter(p.name, p.paramClass, p.param);
        }
        query.setSqlNode(helper.getSqlNode());
        query.prepare();
    }

    /**
     * クエリタイムアウト(秒)を設定します。
     *

     * 指定しない場合、 {@link Config#getQueryTimeout()} が使用されます。
     *
     * @param queryTimeout
     *            クエリタイムアウト(秒)
     * @see Statement#setQueryTimeout(int)
     */
    public void queryTimeout(int queryTimeout) {
        query.setQueryTimeout(queryTimeout);
    }

    /**
     * SQLのログの出力形式を設定します。
     *
     * @param sqlLogType
     *            SQLのログの出力形式
     */
    public void sqlLogType(SqlLogType sqlLogType) {
        if (sqlLogType == null) {
            throw new DomaNullPointerException("sqlLogType");
        }
        query.setSqlLogType(sqlLogType);
    }

    /**
     * 呼び出し元のクラス名です。
     *

     * 指定しない場合このクラスの名前が使用されます。
     *
     * @param className
     *            呼び出し元のクラス名
     * @throws DomaNullPointerException
     *             引数が {@code null} の場合
     */
    public void callerClassName(String className) {
        if (className == null) {
            throw new DomaNullPointerException("className");
        }
        query.setCallerClassName(className);
    }

    /**
     * 呼び出し元のメソッド名です。
     *

     * 指定しない場合このSQLを生成するメソッド({@link #execute()}))の名前が使用されます。
     *
     * @param methodName
     *            呼び出し元のメソッド名
     * @throws DomaNullPointerException
     *             引数が {@code null} の場合
     */
    public void callerMethodName(String methodName) {
        if (methodName == null) {
            throw new DomaNullPointerException("methodName");
        }
        query.setCallerMethodName(methodName);
    }

    /**
     * 組み立てられたSQLを返します。
     *
     * @return 組み立てられたSQL
     */
    public Sql<?> getSql() {
        if (query.getMethodName() == null) {
            query.setCallerMethodName("getSql");
        }
        prepare();
        return query.getSql();
    }

    private static class SubsequentDeleteBuilder extends DeleteBuilder {

        private SubsequentDeleteBuilder(BuildingHelper builder,
                SqlDeleteQuery query, ParamIndex parameterIndex) {
            super(builder, query, parameterIndex);
        }

        @Override
        public DeleteBuilder sql(String sql) {
            if (sql == null) {
                throw new DomaNullPointerException("sql");
            }
            super.helper.appendSql(sql);
            return this;
        }

    }
}


text:
@NamedQuery(name = "allMouse_1_0",
		query = "select m from ApplicationServer1 m")
package org.hibernate.ejb.test.pack.defaultpar_1_0;
import org.hibernate.annotations.NamedQuery;


text:
package samples.reflection;

public class UseMe implements UseMeInterface {

}