text:
package com.sva.service.core;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFComment;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;

/**
 *
 * @author leno
 * @version v1.0
 * @param <T>
 *            应用泛型,代表任意一个符合javabean风格的类
 *            注意这里为了简单起见,boolean型的属性xxx的get器方式为getXxx(),而不是isXxx()
 *            byte[]表jpg格式的图片数据
 */
public class ExcelService<T>
{
    /**
     * @Fields log 输出日志
     */
    private static final Logger LOG = Logger.getLogger(ExcelService.class);

    /**
     * 这是一个通用的方法,利用了JAVA的反射机制,可以将放置在JAVA集合中并且符号一定条件的数据以EXCEL 的形式输出到指定IO设备上
     *
     * @param title 表格标题名
     * @param headers 表格属性列名数组
     * @param dataset 需要显示的数据集合,集合中一定要放置符合javabean风格的类的对象。此方法支持的
     *            javabean属性的数据类型有基本数据类型及String,Date,byte[](图片数据)
     * @param out 与输出设备关联的流对象,可以将EXCEL文档导出到本地文件或者网络中
     * @param pattern 如果有时间数据,设定输出格式。默认为"yyy-MM-dd"
     */
    @SuppressWarnings("unchecked")
    public void exportExcel(String title, String[] headers,
            Collection<T> dataset, OutputStream out, String pattern)
    {
        pattern="yyy-MM-dd HH:mm:ss";
        LOG.debug(pattern);
        // 声明一个工作薄
        HSSFWorkbook workbook = new HSSFWorkbook();
        // 生成一个表格
        HSSFSheet sheet = workbook.createSheet(title);
        // 设置表格默认列宽度为15个字节
        sheet.setDefaultColumnWidth(18);
        // 生成一个样式
        HSSFCellStyle style = workbook.createCellStyle();
        // 设置这些样式
        style.setFillForegroundColor(HSSFColor.SKY_BLUE.index);
        style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
        style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
        style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
        style.setBorderRight(HSSFCellStyle.BORDER_THIN);
        style.setBorderTop(HSSFCellStyle.BORDER_THIN);
        style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
        // 生成一个字体
        HSSFFont font = workbook.createFont();
        font.setColor(HSSFColor.VIOLET.index);
        font.setFontHeightInPoints((short) 12);
        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
        // 把字体应用到当前的样式
        style.setFont(font);
        // 生成并设置另一个样式
        HSSFCellStyle style2 = workbook.createCellStyle();
        style2.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index);
        style2.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
        style2.setBorderBottom(HSSFCellStyle.BORDER_THIN);
        style2.setBorderLeft(HSSFCellStyle.BORDER_THIN);
        style2.setBorderRight(HSSFCellStyle.BORDER_THIN);
        style2.setBorderTop(HSSFCellStyle.BORDER_THIN);
        style2.setAlignment(HSSFCellStyle.ALIGN_CENTER);
        style2.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
        // 生成另一个字体
        HSSFFont font2 = workbook.createFont();
        font2.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
        // 把字体应用到当前的样式
        style2.setFont(font2);
        // 默认样式
        HSSFFont font3 = workbook.createFont();
        font3.setColor(HSSFColor.BLUE.index);

        // 声明一个画图的顶级管理器
        HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
        // 定义注释的大小和位置,详见文档
        HSSFComment comment = patriarch.createComment(new HSSFClientAnchor(0,
                0, 0, 0, (short) 4, 2, (short) 6, 5));
        // 设置注释内容
        comment.setString(new HSSFRichTextString("可以在POI中添加注释!"));
        // 设置注释作者,当鼠标移动到单元格上是可以在状态栏中看到该内容.
        comment.setAuthor("label");

        // 产生表格标题行
        HSSFRow row = sheet.createRow(0);
        for (int i = 0; i < headers.length; i++)
        {
            HSSFCell cell = row.createCell(i);
            cell.setCellStyle(style);
            HSSFRichTextString text = new HSSFRichTextString(headers[i]);
            cell.setCellValue(text);
        }

        // 遍历集合数据,产生数据行
        Iterator<T> it = dataset.iterator();
        int index = 0;
        while (it.hasNext())
        {
            index++;
            row = sheet.createRow(index);
            T t = (T) it.next();
            // 利用反射,根据javabean属性的先后顺序,动态调用getXxx()方法得到属性值
            Field[] fields = t.getClass().getDeclaredFields();
            for (int i = 0; i < fields.length; i++)
            {
                HSSFCell cell = row.createCell(i);
                cell.setCellStyle(style2);
                Field field = fields[i];
                String fieldName = field.getName();
                String getMethodName = "get"
                        + fieldName.substring(0, 1).toUpperCase()
                        + fieldName.substring(1);
                try
                {
                    @SuppressWarnings("rawtypes")
                    Class tCls = t.getClass();
                    Method getMethod = tCls.getMethod(getMethodName, new Class[]{});
                    Object value = getMethod.invoke(t, new Object[]{});
                    // 判断值的类型后进行强制类型转换
                    String textValue = null;
                    if (value instanceof Date)
                    {
                        LOG.debug(value.toString());
                        Date date = (Date) value;
                        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
                        textValue = sdf.format(date);
                    }
                    else if(value != null)
                    {
                        // 其它数据类型都当作字符串简单处理
                        textValue = value.toString();
                    }
                    else{
                        textValue = "";
                    }
                    // 如果不是图片数据,就利用正则表达式判断textValue是否全部由数字组成
                    if (textValue != null)
                    {
                        Pattern p = Pattern.compile("^//d+(//.//d+)?$");
                        Matcher matcher = p.matcher(textValue);
                        if (matcher.matches())
                        {
                            // 是数字当作double处理
                            cell.setCellValue(Double.parseDouble(textValue));
                        }
                        else
                        {
                            HSSFRichTextString richString = new HSSFRichTextString(
                                    textValue);
                            richString.applyFont(font3);
                            cell.setCellValue(richString);
                        }
                    }
                }
                catch (SecurityException e)
                {
                    LOG.error(e);
                }
                catch (NoSuchMethodException e)
                {
                    LOG.error(e);
                }
                catch (IllegalArgumentException e)
                {
                    LOG.error(e);
                }
                catch (IllegalAccessException e)
                {
                    LOG.error(e);
                }
                catch (InvocationTargetException e)
                {
                    LOG.error(e);
                }
                finally
                {
                    // 清理资源
                }
            }
        }
        try
        {
            workbook.write(out);
        }
        catch (IOException e)
        {
            LOG.error(e);
        }
    }

    /**
     * 读取Excel数据内容
     * @param InputStream
     * @return Map 包含单元格数据内容的Map对象
     */
    public List<Map<String, String>> readExcelContent(InputStream is) {
        // 结果
        List<Map<String, String>> result = new ArrayList<Map<String, String>>();

        POIFSFileSystem fs;
        HSSFWorkbook wb;
        try {
            fs = new POIFSFileSystem(is);
            wb = new HSSFWorkbook(fs);
            HSSFSheet sheet = wb.getSheetAt(0);
            // 得到总行数
            int rowNum = sheet.getLastRowNum();
            HSSFRow rowHeader = sheet.getRow(0);
            // 得到总列数
            int colNum = rowHeader.getPhysicalNumberOfCells();

            // 正文内容应该从第二行开始,第一行为表头的标题
            for (int i = 1; i <= rowNum; i++) {
                Map<String, String> content = new HashMap<String, String>();
                HSSFRow row = sheet.getRow(i);
                int j = 0;
                while (j < colNum) {
                    content.put(rowHeader.getCell(j).getStringCellValue(), row.getCell(j).getStringCellValue());
                    j++;
                }
                result.add(content);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return result;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using Realms;

// NOTE some of the following data comes from Tim's data used in the Browser screenshot in the Mac app store
// unlike the Cocoa definitions, we use Pascal casing for properties
namespace Tests.Database
{
    [TestFixture, Preserve(AllMembers = true)]
    public class LinkQueryTests
    {
        protected Realm realm;

        [SetUp]
        public void SetUp()
        {
            Realm.DeleteRealm(RealmConfiguration.DefaultConfiguration);
            realm = Realm.GetInstance();

            // we don't keep any variables pointing to these as they are all added to Realm
            using (var trans = realm.BeginWrite())
            {
                var o1 = realm.Add(new Owner { Name = "Tim" });

                var d1 = realm.Add(new Dog
                {
                    Name = "Bilbo Fleabaggins",
                    Color = "Black"
                });

                o1.TopDog = d1;  // set a one-one relationship
                o1.Dogs.Add(d1);

                var d2 = realm.Add(new Dog
                {
                    Name = "Earl Yippington III",
                    Color = "White"
                });

                o1.Dogs.Add(d2);

                // lonely people and dogs
                realm.Add(new Owner
                {
                    Name = "Dani" // the dog-less
                });

                realm.Add(new Dog // will remain unassigned
                {
                    Name = "Maggie Mongrel",
                    Color = "Grey"
                });

                trans.Commit();
            }
        }

        [TearDown]
        public void TearDown()
        {
            realm.Dispose();
            Realm.DeleteRealm(realm.Config);
        }

        [Test]
        public void TimHasABlackTopDog()
        {
            var tim = realm.All<Owner>().AddLinkQuery(x => x.TopDog.Color, PredicateOperator.Equal, "Black").FirstOrDefault();
            Assert.That(tim.Name, Is.EqualTo("Tim"));
        }

        [Test]
        public void WhereBeforeLinkQuery()
        {
            var q1 = realm.All<Owner>().Where(x => x.Name != "Tim").ToList();
            Assert.That(q1.Count, Is.EqualTo(1));

            var tim = realm.All<Owner>().Where(x => x.Name != "Tim").AddLinkQuery(x => x.TopDog.Color, PredicateOperator.Equal, "Black").ToList();
            Assert.That(tim.Count, Is.EqualTo(0));
        }

        [Test]
        public void WhereAfterLinkQuery()
        {
            var q1 = realm.All<Owner>().Where(x => x.Name != "Tim").ToList();
            Assert.That(q1.Count, Is.EqualTo(1));

            var tim = realm.All<Owner>().AddLinkQuery(x => x.TopDog.Color, PredicateOperator.Equal, "Black").Where(x => x.Name != "Tim").ToList();
            Assert.That(tim.Count, Is.EqualTo(0));
        }

        [Test]
        public void LinkQueryAfterDoubleWhere()
        {
            var tim = realm.All<Owner>().Where(x => x.Name != "zx").Where(x => x.Name != "Tim").AddLinkQuery(x => x.TopDog.Color, PredicateOperator.Equal, "Black").ToList();
            Assert.That(tim.Count, Is.EqualTo(0));
        }

        [Test]
        public void LinkQueryInWhereSandwich()
        {
            var tim = realm.All<Owner>().Where(x => x.Name != "zx").AddLinkQuery(x => x.TopDog.Color, PredicateOperator.Equal, "Black").Where(x => x.Name != "Tim").ToList();
            Assert.That(tim.Count, Is.EqualTo(0));
        }

        [Test]
        public void TimHasNoWhiteTopDog()
        {
            var tim = realm.All<Owner>().AddLinkQuery(x => x.TopDog.Color, PredicateOperator.Equal, "White").FirstOrDefault();
            Assert.That(tim, Is.Null);
        }

        [Test]
        public void TimHasWhiteDog()
        {
            var tim = realm.All<Owner>().AddLinkQuery($"{nameof(Owner.Dogs)}.{nameof(Dog.Color)}", PredicateOperator.Equal, "White").FirstOrDefault();
            Assert.That(tim.Name, Is.EqualTo("Tim"));
        }

        [Test]
        public void QueryOnBacklink()
        {
            // backlink queries are not supported yet (waiting for Java implementation to port :))
            try
            {
                var dog = realm.All<Dog>().AddLinkQuery($"Owners.Name", PredicateOperator.Equal, "Tim").ToList();
            }
            catch (InvalidOperationException e)
            {
                Assert.That(e.Message, Does.Contain("Owners is a backlink, queries are not supported yet"));
                return;
            }
            Assert.Fail("Exception should be ");
        }

        [Test]
        public void LinkQueryTwoLevelsDeep()
        {
            realm.Write(() =>
            {
                var category1 = new ItemCategory() { Id = "1" };
                var category2 = new ItemCategory() { Id = "2" };
                realm.Add(category1);
                realm.Add(category2);
                var model1 = new ItemModel() { Id = "11", ItemCategory = category1 };
                var model2 = new ItemModel() { Id = "12", ItemCategory = category2 };
                realm.Add(model1);
                realm.Add(model2);
                realm.Add(new Item() { Id = "21", ItemModel = model1 });
            });
            var item = realm.All<Item>().AddLinkQuery(x => x.ItemModel.ItemCategory.Id, PredicateOperator.Equal, "1").ToList();
            Assert.That(item[0].Id, Is.EqualTo("21"));
        }

        public class Item : RealmObject
        {
            public Item()
            {
            }

            [PrimaryKey]
            public string Id { get; set; }

            public string TestPropertyBeforeItemModel { get; set; }

            public ItemModel ItemModel { get; set; }
        }

        public class ItemModel : RealmObject
        {
            [PrimaryKey]
            public string Id { get; set; }

            public ItemCategory ItemCategory { get; set; }

            public ItemCategory Category { get; set; }
        }

        public class ItemCategory : RealmObject
        {
            [PrimaryKey]
            public string Id { get; set; }

            public string Name { get; set; }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.camel.component.sjms.jms;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;

/**
 *

 * The ConnectionResource is the contract used to provide {@link Connection}
 * pools to the SJMS component. A user should use this to provide access to an
 * alternative pooled connection resource such as a {@link Connection} pool that
 * is managed by a J2EE container.
 *

 *

 * It is recommended though that for standard {@link ConnectionFactory}
 * providers you use the {@link ConnectionFactoryResource) implementation that
 * is provided with SJMS as it is optimized for this component.
 *

 */
public interface ConnectionResource {

    /**
     * Borrows a {@link Connection} from the connection pool. An exception
     * should be thrown if no resource is available.
     *
     * @return {@link Connection}
     * @throws Exception when no resource is available
     */
    Connection borrowConnection() throws Exception;

    /**
     * Returns the {@link Connection} to the connection pool.
     *
     * @param connection the borrowed {@link Connection}
     * @throws Exception
     */
    void returnConnection(Connection connection) throws Exception;

}


text:
<?php

namespace Antares\Security\Traits;

use Antares\Extension\FilesystemFinder;
use Illuminate\Support\Facades\Schema;
use Antares\Security\Database\Cryptor;
use ReflectionClass;

trait DbCryptTrait
{

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [];

    /**
     * crypt config
     *
     * @var array
     */
    private $columnTypes = [];

    /**
     * whether cryptor is enabled
     *
     * @var bool
     */
    private $enabled = false;

    /**
     * name of cast
     *
     * @var String
     */
    private $castName = null;

    /**
     *
     * @param array $attributes
     */
    public function __construct(array $attributes = array())
    {
        parent::__construct($attributes);
        $this->setCasting();
    }

    /**
     * package name getter
     *
     * @return String
     */
    private function getPackage()
    {
        $reflection = new ReflectionClass(get_called_class());
        return app(FilesystemFinder::class)->resolveNamespace($reflection->getFileName(), true);
    }

    /**
     * fills configuration options
     *
     * @return boolean
     */
    private function setCasting()
    {
        return false;
        $package   = $this->getPackage();
        $tablename = $this->getTable();
        $config    = config("db_cryptor", []);
        if (!array_get($config, 'enabled')) {
            return false;
        }
        if (is_null($castName = array_get($config, 'cast_name'))) {
            return false;
        }
        $this->castName = $castName;
        if (is_null($columnTypes    = array_get($config, 'column_types'))) {
            return false;
        }
        $this->columnTypes = $columnTypes;
        $this->enabled     = true;
        $casts             = config($package . "::cast.{$tablename}", []);

        $this->setCast($casts);
    }

    /**
     * casts setter
     *
     * @param array $casts
     * @return void
     */
    private function setCast($casts)
    {
        foreach ($casts as $cast) {
            if (isset($this->casts[$cast])) {
                continue;
            }
            $this->casts[$cast] = $this->castName;
        }
        return;
    }

    /**
     * Cast an attribute to a native PHP type.
     *
     * @param  string  $key
     * @param  mixed  $value
     * @return mixed
     */
    protected function castAttribute($key, $value)
    {
        $return    = parent::castAttribute($key, $value);
        $tablename = $this->getTable();
        if (!$this->validate($key, $tablename)) {
            return $return;
        }
        return Cryptor::getInstance()->crypt('decrypt', $return);
    }

    /**
     * validates whether attributes need to be encrypted / decrypted
     *
     * @param type $key
     * @param type $tablename
     * @return boolean
     */
    protected function validate($key, $tablename)
    {
        if (!$this->enabled) {
            return false;
        }
        $castType = $this->getCastType($key);
        if ($castType !== $this->castName) {
            return false;
        }
        if (!$this->isAesCastable($key, $tablename)) {
            return false;
        }
        if (!in_array(Schema::getColumnType($tablename, $key), $this->columnTypes)) {
            return false;
        }
        return true;
    }

    /**
     * Set a given attribute on the model.
     *
     * @param  string  $key
     * @param  mixed  $value
     * @return $this
     */
    public function setAttribute($key, $value)
    {
        parent::setAttribute($key, $value);
        if ($this->isAesCastable($key, $this->getTable())) {
            $this->attributes[$key] = Cryptor::getInstance()->crypt('encrypt', $value);
        }
        return $this;
    }

    /**
     * Determine whether a value is JSON castable for inbound manipulation.
     *
     * @param  string  $key
     * @return bool
     */
    protected function isAesCastable($key)
    {
        return array_key_exists($key, $this->casts) and $this->casts[$key] == $this->castName;
    }

}


text:
# fluxible-action-utils

[![npm version](https://badge.fury.io/js/fluxible-action-utils.svg)](http://badge.fury.io/js/fluxible-action-utils)
![github actions](https://github.com/yahoo/fluxible-action-utils/actions/workflows/test.js.yml/badge.svg)
[![Join the chat at https://gitter.im/yahoo/fluxible-action-utils](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/yahoo/fluxible-action-utils?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Utility methods to aid in writing [actions](http://fluxible.io/api/fluxible-context.html#executeaction-action-payload-callback-) for [fluxible](http://fluxible.io) based applications.

```bash
npm install --save fluxible-action-utils
```

## Modularized Builds/Requires

The utility library provides modularized methods, and method categories to aid in providing smaller [browserify](http://browserify.org/) and [webpack](http://webpack.github.io/) builds.

```js
import actionUtils from 'fluxible-action-utils';
```

Will require the entire library, including **all** available methods grouped under their respective method categories.

For example, the following are equivalent (but will result in varying sized [webpack](http://webpack.github.io/) builds)

### Full Library (results in **largest** build)

```js
const executeMultiple = require('fluxible-action-utils').async.executeMultiple;
```

### Category

```js
const executeMultiple = require('fluxible-action-utils/async').executeMultiple;
```

### Method (results in smallest build)

```js
const executeMultiple = require('fluxible-action-utils/async/executeMultiple');
```

:rotating_light: **WARNING** :rotating_light:

Methods inside the `internals` directory/category are not explicitely exported and are considered unstable.

require externally at your own risk as breaking changes inside `internals` will not be considered `breaking` for the library.

===

## API

* [`async`](#async)
    - [`executeMultiple`](#executemultiple-context-actions-done)
    - [`executeCritical`](#executecritical-context-actions-done)
* [`mixins`](#mixins)
    - [`PeriodicActions`](#periodicactions)

===

### async

*available as of v0.2.0*

```js
import asyncActionUtils from 'fluxible-action-utils/async';
```

Methods grouped under the `async` category are concerned with providing methods that aid in managing the asynchronous control flow of [`fluxible`](http://fluxible.io) actions.

[run-auto](https://github.com/feross/run-auto#usage) is used under the hood to do the actual heavy lifting (thanks to [@feross](https://github.com/feross))

#### executeMultiple (context, actions, [done])

*available as of v0.2.0*

```js
const executeMultiple = require('fluxible-action-utils/async/executeMultiple');
```

Utility method used to execute multiple actions in parallel where possible. Each key in `actions` represents a `task` to be executed (and should be unique).

`actions[task]` can be one of the following

1. {FluxAction} an action to be executed, **cannot** be critical **nor** require params
2. {Object} an action "object" with the follwing properties
    1. `action` {FluxAction} the action to execute
    1. `[isCritical=false]` {Boolean} whether the action is **critical**
    2. `[params]` {Any} parameters to pass to the action when executing it
3. {Array} {String, String, ..., FluxAction|Object} array which defines the tasks/actions that need to be executed before executing the action of type *1.* or *2.* found at the end of the array.

The `done` {Function} parameter is optional, but if provided, will be called when all tasks complete (either with success or failure).
Signature `function (err, results)`

For each task that fails, the error returned will be aggregated under `err[task]`.

**Example**

```js
// initHome.js

const executeMultiple = require('fluxible-action-utils/async/executeMultiple');
const UserStore = require('app/stores/UserStore');

module.exports = function initHome(context, params, done) {
    executeMultiple(context, {
        loadUH: require('UH').actions.load,
        loadUser: {
            action: require('app/actions/loadUser'),
            isCritical: true
        },
        loadStuffForUser: [
            'loadUser',
            {
                // will be executed after 'loadUser' task completes successfully
                action: require('../../actions/loadStuffForUser'),
                params: context.getStore(UserStore).getGUID()
            }
        ],
        populateUserNotifications: [
            'loadUH',
            'loadStuffForUser',

            // will be executed after the 'loadUH' and 'loadStuffForUser' tasks complete successfully
            require('../../actions/populateUserNotifications')
        ]
    }, function (err, results) {
        // there was at least one error, handle them
        if (err) {
            if (err.loadUser) {
                context.dispatch('CATASTROPHE', err.loadUser);
            }

            if(err.loadStuffForUser) {
                context.dispatch('RECOVERABLE', err.loadStuffForUser);
            }
            done();
            return;
        }
        // Yay! no errors
        // ...
        done();
    });
};
```

#### executeCritical (context, actions, [done])

*available as of v0.2.0*

```js
const executeCritical = require('fluxible-action-utils/async/executeCritical');
```

`executeCritical` allows you to execute a group of actions that are **ALL** deemed critical.  This is a simple shorthand for `executeMultiple` when a group of actions are all critical.

### mixins
*available as of v0.2.0*

```js
const mixins = require('fluxible-action-utils/mixins');
```

Mixins grouped under the `mixins` category are concerned with providing React [component mixins](http://facebook.github.io/react/docs/reusable-components.html#mixins) that simplify using [`fluxible`](http://fluxible.io) actions.

#### PeriodicActions
*available as of v0.2.0*

```js
const PeriodicActionsMixin = require('fluxible-action-utils/mixins/PeriodicActions');
```

Utility mixin used to make running an action repeatedly (polling an API for example) easier to do.

You can either write code using the methods exposed by the mixin directly, or you can use the `statics` support.

`uuid` must be a unique identifier, attempting to add another action with the same `uuid` as a currently running periodic action will fail to add.

**Statics Example**

```jsx
// MyReactComponent.jsx

const PeriodicActionsMixin = require('fluxible-action-utils/mixins/PeriodicActions');
const myPollingAction = require('./myPollingAction');

// Let's say you have a child component that implement the controlling logic for the polling action below
const ControlComponent = require('./someControlComponent');

module.exports = createReactClass({
    displayName: 'MyReactComponent',
    mixins: [PeriodicActionsMixin],
    statics: {
        periodicActions: [
            {
                uuid: 'MY_UNIQUE_POLLING_ACTION_UUID_STATICS',
                action: myPollingAction,
                // Optional params
                params: {
                    customPayload: 'payload'
                },
                // Optional timeout (Defaults to 100 ms)
                timeout: 1000
            }
        ]
    },
    render: function () {
        // You can pass the auto-binded component methods to the child component to achieve
        // custom timing on the dedicated action(s)
        return <ControlComponent
                    startPolling={this.startPeriodicActions}
                    stopPolling={this.stopPeriodicActions}
               />;
    }
});
```

**Code Example**

```jsx
// MyReactComponent.jsx

const PeriodicActionsMixin = require('fluxible-action-utils/mixins/PeriodicActions');
const myPollingAction = require('./myPollingAction');

module.exports = createReactClass({
    displayName: 'MyReactComponent',
    mixins: [PeriodicActionsMixin],
    componentDidMount: function () {
        this.startPeriodicAction(
            'MY_UNIQUE_POLLING_ACTION_UUID_CODE',
            myPollingAction,
            // Optional params
            {customPayload: 'payload'},
            // Optional timeout (Defaults to 100 ms)
            1000
        );
    },
    /* Don't need this, all periodic actions will be stopped automatically on unmount
    componentWillUnmount: function () {
        this.stopPeriodicAction('MY_UNIQUE_POLLING_ACTION_UUID_CODE');
    },
    */
    render: function () {
        return null;
    }
});
```

## FAQ

* [what is a **critical** action?](https://github.com/yahoo/fluxible-action-utils/issues/18)

## Thanks

* [@mridgway](https://github.com/mridgway)
* [@akshayp](https://github.com/akshayp)
* [@redonkulus](https://github.com/redonkulus)
* [@zeikjt](https://github.com/zeikjt)

## License

This software is free to use under the Yahoo Inc. BSD license. See the [LICENSE file](https://github.com/yahoo/fluxible-action-utils/blob/master/LICENSE.md) for license text and copyright information.


text:
package com.massive.deliveries.test.ui.main;

import com.massive.deliveries.test.data.DataManager;
import com.massive.deliveries.test.data.network.model.Deliveries;
import com.massive.deliveries.test.ui.base.BasePresenter;
import com.massive.deliveries.test.utils.rx.SchedulerProvider;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.disposables.CompositeDisposable;

/**
 * Creaated by Balwinder on   26/08/17.
 */

public class MainPresenter<V extends MainIView> extends BasePresenter<V>
        implements MainIPresenter<V> {

    private static final String TAG = "MainPresenter";

    @Inject
    public MainPresenter(DataManager dataManager,
                         SchedulerProvider schedulerProvider,
                         CompositeDisposable compositeDisposable) {
        super(dataManager, schedulerProvider, compositeDisposable);
    }

    @Override
    public void onDrawerOptionLogoutClick() {
        getMvpView().showLoading();
        getDataManager().setUserAsLoggedOut();
        getMvpView().hideLoading();
        getMvpView().openLoginActivity();
    }

    @Override
    public void onViewInitialized() {

        if (getDataManager().isDeliveriesEmpty()) {
            if (!getMvpView().isNetworkConnected()) {
                getMvpView().onError("Please check your internet Connection!");
                return;
            } else {
                loadFromNetwork();
            }
        } else {
            getMvpView().showLoading();
            getCompositeDisposable().add(getDataManager()
                    .getAllDeliveries()
                    .subscribeOn(getSchedulerProvider().io())
                    .observeOn(getSchedulerProvider().ui())
                    .subscribe(this::handleResponse, this::handleError));
        }
    }

    private void handleResponse(List<Deliveries> deliveries) {

        getMvpView().refreshDeliveries(deliveries);
        getDataManager().saveDeliveries(deliveries);
        getMvpView().hideLoading();

    }

    private void handleError(Throwable error) {

        getMvpView().onError(error.getLocalizedMessage());
        getMvpView().hideLoading();

    }

    @Override
    public void onNavMenuCreated() {
        if (!isViewAttached()) {
            return;
        }
        getMvpView().updateAppVersion();

        final String currentUserName = getDataManager().getCurrentUserName();
        if (currentUserName != null && !currentUserName.isEmpty()) {
            getMvpView().updateUserName(currentUserName);
        }

        final String currentUserEmail = getDataManager().getCurrentUserEmail();
        if (currentUserEmail != null && !currentUserEmail.isEmpty()) {
            getMvpView().updateUserEmail(currentUserEmail);
        }

    }

    @Override
    public void loadFromNetwork() {

        if (!getMvpView().isNetworkConnected()) {
            getMvpView().onError("Please check your internet Connection!");
            return;
        } else {
            getMvpView().showLoading();
            getCompositeDisposable().add(getDataManager()
                    .getDelieverables()
                    .subscribeOn(getSchedulerProvider().io())
                    .observeOn(getSchedulerProvider().ui())
                    .subscribe(this::handleResponse, this::handleError));

        }

    }

}


text:
package org.fakereplace.replacement;

import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

import org.fakereplace.data.AnnotationBuilder;
import javassist.bytecode.AnnotationsAttribute;
import javassist.bytecode.ConstPool;
import javassist.bytecode.ParameterAnnotationsAttribute;

class AnnotationReplacer {

    static AnnotationsAttribute duplicateAnnotationsAttribute(ConstPool cp, AnnotatedElement element) {
        AnnotationsAttribute oldAns = new AnnotationsAttribute(cp, AnnotationsAttribute.visibleTag);
        for (Annotation a : element.getAnnotations()) {
            oldAns.addAnnotation(AnnotationBuilder.createJavassistAnnotation(a, cp));
        }
        return oldAns;
    }

    static ParameterAnnotationsAttribute duplicateParameterAnnotationsAttribute(ConstPool cp, Method method) {
        ParameterAnnotationsAttribute oldAns = new ParameterAnnotationsAttribute(cp, ParameterAnnotationsAttribute.visibleTag);
        javassist.bytecode.annotation.Annotation[][] anAr = new javassist.bytecode.annotation.Annotation[method.getParameterAnnotations().length][];
        for (int i = 0; i < anAr.length; ++i) {
            anAr[i] = new javassist.bytecode.annotation.Annotation[method.getParameterAnnotations()[i].length];
            for (int j = 0; j < anAr[i].length; ++j) {
                anAr[i][j] = AnnotationBuilder.createJavassistAnnotation(method.getParameterAnnotations()[i][j], cp);
            }
        }
        oldAns.setAnnotations(anAr);
        return oldAns;
    }

    static ParameterAnnotationsAttribute duplicateParameterAnnotationsAttribute(ConstPool cp, Constructor<?> method) {
        ParameterAnnotationsAttribute oldAns = new ParameterAnnotationsAttribute(cp, ParameterAnnotationsAttribute.visibleTag);
        javassist.bytecode.annotation.Annotation[][] anAr = new javassist.bytecode.annotation.Annotation[method.getParameterAnnotations().length][];
        for (int i = 0; i < anAr.length; ++i) {
            anAr[i] = new javassist.bytecode.annotation.Annotation[method.getParameterAnnotations()[i].length];
            for (int j = 0; j < anAr[i].length; ++j) {
                anAr[i][j] = AnnotationBuilder.createJavassistAnnotation(method.getParameterAnnotations()[i][j], cp);
            }
        }
        oldAns.setAnnotations(anAr);
        return oldAns;
    }

}


text:
app.controller('myMessageDetailCtrl',['$scope','$injector','$location',
	function($scope,$injector){
		$injector.invoke(
			function (myMessageDetailLouder,$location) {
				$scope.title="消息详情";
				$scope.search = $location.search();
				var data = {
					"guid":$scope.search.id
				};
				$scope.searchFunction = function(){
					myMessageDetailLouder.getListinfo(data).then(function(resp){

			    		$scope.listInfo = resp.data;

					});
				}
				$scope.searchFunction();

			}
		);
	}
]);


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Porosty (Lichenes). 3 (Lublin), Rodzina Lecanoraceae. Lecanora 549 (1996)

#### Original name
Lecanora hemisphaerialis Motyka

### Remarks
null


text:
void block_init(block_t *b) {
    *b = (block_t) {
        .type = BLOCK_TYPE_INVALID,
    };
}

void block_destroy(block_t *b) {
    switch (b->type) {
    case BLOCK_TYPE_PRIMARY:
        primary_block_destroy(&b->primary);
    break;

    case BLOCK_TYPE_EXT:
    break;

    case BLOCK_TYPE_INVALID:
    break;
    }
}

static block_type_t parse_block_type(parser_t *p) {
    static const char *MAP[] = {
        [BLOCK_TYPE_PRIMARY] = "primary",
        [BLOCK_TYPE_EXT] = "extension",
    };

    uint32_t type = parser_parse_sym(p, MAP, ASIZE(MAP));

    if (type == SYM_INVALID)
        return BLOCK_TYPE_INVALID;

    return (block_type_t) type;
}

#ifdef MKBUNDLE_TEST
TEST test_parse_block_type(void) {
    parser_t parser;
    parser_init(&parser);

    static const char J[] = "\"primary\": {\"a\": 0}";
    ASSERT(parser_parse(&parser, J, sizeof(J) - 1));

    ASSERT(parse_block_type(&parser) == BLOCK_TYPE_PRIMARY);
    ASSERT(parser_advance(&parser));

    ASSERT(parse_block_type(&parser) == BLOCK_TYPE_INVALID);

    PASS();
}
#endif

bool block_unserialize(block_t *b, const char *buf, size_t len) {
    parser_t parser;
    parser_init(&parser);

    if (!parser_parse(&parser, buf, len))
        return false;

    b->type = parse_block_type(&parser);

    switch (b->type) {
    case BLOCK_TYPE_PRIMARY:
        primary_block_init(&b->primary);

        if (!primary_block_unserialize(&b->primary, &parser))
            return false;
    break;

    case BLOCK_TYPE_EXT:
        ext_block_init(&b->ext);

        if (!ext_block_unserialize(&b->ext, &parser))
            return false;
    break;

    case BLOCK_TYPE_INVALID:
        return false;
    break;
    }

    return true;
}

void block_write(const block_t *b, FILE *stream) {
    switch (b->type) {
    case BLOCK_TYPE_PRIMARY:
        primary_block_write(&b->primary, stream);
    break;

    case BLOCK_TYPE_EXT:
        ext_block_write(&b->ext, stream);
    break;

    case BLOCK_TYPE_INVALID:
    break;
    }
}

#ifdef MKBUNDLE_TEST
SUITE(block_suite) {
    RUN_TEST(test_parse_block_type);
}
#endif


text:
module Language.Haskell.ExpressionSpec (spec) where

import           Test.Hspec

import           Language.Haskell.Expression

import           Language.Haskell.Meta.Parse.Careful (parseExp)
import           Language.Haskell.TH.Syntax

spec :: Spec
spec = do
  describe "parseExpression" $ do
    it "accepts variable names" $ do
      let e = "foo"
      parseExpression e `shouldBe` parseExp e

    it "accepts type signatures" $ do
      pending
      -- let e = "foo :: Int"
      -- parseExpression e `shouldBe` parseExp e
      -- (Right $ SigE (VarE $ mkName "foo") (ConT $ mkName "Int")) `shouldBe` parseExp e


text:
/**
 *
 */
package com.velocity.enums;

/**
 * This Enum defines the value for StateProvince
 *
 * @author Vimal Kumar
 * @date 12-March-2015
 */
public enum StateProvince {

}


text:
https://school.scotch.io/getting-started-with-sublime-text

##
```code
ctrl+D
//next

ctrl+F
//find

ctrl+G
//line num

ctrl+P
//file

ctrl+shift+p
//commands

```

##  settings

```json
{
  // Theme
    // "theme": "Flatland Dark.sublime-theme",
    // "color_scheme": "Packages/Theme - Flatland/Flatland Dark.tmTheme",

  // Font
    "font_face": "Operator Mono Book",
    "font_options": "subpixel_antialias",
    "line_padding_bottom": 3,
    "line_padding_top": 3,

  // Basic Personal Settings
  "rulers": [80],
    "tab_size": 2,
    "margin": 10,
    "fold_buttons": false,
    "tab_completion": false,
  "word_wrap": true,
  "bold_folder_labels": true,
  "highlight_line": true,
  "highlight_modified_tabs": true,

    // Use the amazing Vintage mode and always open files in Vim Movement Mode
  "ignored_packages": [],
  "vintage_start_in_command_mode": true,
    "translate_tabs_to_spaces": true,
    "always_show_minimap_viewport": true,

    "index_exclude_patterns": ["*.log", "node_modules/**", "bower_components/**", "vendor/**"],
    "binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip", "node_modules/**", "bower_components/**", "vendor/**"],

    "open_files_in_new_window": false
}

```


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W28647_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans11.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">A G y r o d a t a Whiting Oil & Gas Lease: Hansen Well: 44-28-2H, 4" Drill Pipe Location: Pioneer #67, Mountrail County, North Dakota Job Number: RM1 1 14GCM646

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Directional

    <p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Survey

    <p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">MEASURED DEPTH feet

    <p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">9200.00 9225.00 9250.00 9275.00 9300.00

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">9325.00 9350.00 9375.00 9400.00 9425.00

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">9450.00 9475.00 9500.00 9525.00 95 50.00
9575.00 9600.00 9625.00 9650.00 9675.00
9700.00

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Page 19 of31

    <p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">INCL
deg.

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">AZIMUTH
deg.

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">0.71 0.67 0.81 0.75 0.76

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">0.81 0.91 0.96 0.99 1.09

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">1.14 1.10 1.10 1.10 1.05
1.01 1.02 0.96 0.90 0.84
0.92

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">DOGLEG SEVERITY deg./
25 fl.

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">VERTICAL DEPTH feet

    <p class="styleSans11.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">CLOSURE DI ST. AZIMUTH feet deg.

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">57.90 65.72 55.26 49.56 54.43

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">58.96 52.47 49.95 56.94 51.22

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">48.3 1 53.90 54.53 49.12 55.99
61.20 57.55 54.93 56.82 60.75
54.91

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">HORIZONTAL COORDINATES feet

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">0.07 0.10 0.19 0.10 0.06

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">0.08 0.14 0.06 0.12 0.15

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">0.07 0.12 0.01 0.10 0.14
0.10 0.06 0.07 0.07 0.08
0.12

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">9194.13 9219.12 9244.12 9269.12 9294.12

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">9319.12 9344.11 9369.11 9394.11 9419.10

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">9444. 10 9469.09 9494.09 95 19.08 9544.08
9569.08 9594.07 9619.07 9644.06 9669.06
9694.06

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">242.4 242.6 242.8 243.1 243.4

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">14.5 14.5 14.6 14.6 14.7

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">243.6 243.9 244.2 244.6 244.9

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">14.7 14.8 14.8 14.9 15.0

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">245.3 245.7 246.1 246.5 246.8
247.2 247.5 247.8 248.1 248.4
248.7

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">15.0 15.1 15.2 15.2 15.3
15.4 15.4 15.5 15.6 15.6
15.7

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">234.72 N 234.86 N 235.02 N 235.23 N 235.43 N

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">235.62 N 235.83 N 236.09 N 236.34 N 236.61 N

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">236.92 N 237.23 N 237.51 N 237.80 N 238.09 N
238.32 N 238.55 N 238.79 N 239.02 N 239.21 N
239.42 N

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">60.58 E 60.84 E 61.12 E 61.39 E 61.65 E

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">61.94 E 62.25 E 62.56 E 62.90 E 63.27 E

    <p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">63.64 E 64.02 E 64.41 E 64.79 E 65.16 E
65.54 E 65.92 E 66.28 E 66.62 E 66.94 E
67.27 E

    <p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">


text:
<?php

/**
 * Zend_Search_Lucene_Storage_File_Filesystem
 */
require_once 'Zend/Search/Lucene/Storage/File/Filesystem.php';

/**
 * Zend_Search_Lucene_Storage_File_Memory
 */
require_once 'Zend/Search/Lucene/Storage/File/Memory.php';

/**
 * @category   Zend
 * @package    Zend_Search_Lucene
 * @subpackage UnitTests
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @group      Zend_Search_Lucene
 */
class Zend_Search_Lucene_Storage_FileTest extends PHPUnit_Framework_TestCase
{
    public function testFilesystem()
    {
        $file = new Zend_Search_Lucene_Storage_File_Filesystem(dirname(__FILE__) . '/_files/sample_data'); // open file object for reading
        $this->assertTrue($file instanceof  Zend_Search_Lucene_Storage_File);

        $fileSize = filesize(dirname(__FILE__) . '/_files/sample_data');

        $this->assertEquals($file->size(), $fileSize);

        $file->seek(0, SEEK_END);
        $this->assertEquals($file->tell(), $fileSize);

        $file->seek(2, SEEK_SET);
        $this->assertEquals($file->tell(), 2);

        $file->seek(3, SEEK_CUR);
        $this->assertEquals($file->tell(), 5);

        $file->seek(0, SEEK_SET);
        $this->assertEquals($file->tell(), 0);

        $this->assertEquals($file->readByte(),   10);
        $this->assertEquals($file->readBytes(8), "\xFF\x00\xAA\x11\xBB\x44\x66\x99");
        $this->assertEquals($file->readInt(),    49057123);
        $this->assertEquals($file->readLong(),   753823522);
        $this->assertEquals($file->readVInt(),   234586758);
        $this->assertEquals($file->readString(), "UTF-8 string with non-ascii (Cyrillic) symbols\nUTF-8 строка с не-ASCII (кириллическими) символами");
        $this->assertEquals($file->readBinary(), "\xFF\x00\xAA\x11\xBB\x44\x66\x99");

        $file->seek(0);
        $fileData = $file->readBytes($file->size());

        $file->close();
        unset($file);

        $testFName = dirname(__FILE__) . '/_files/sample_data_1';
        $file = new Zend_Search_Lucene_Storage_File_Filesystem($testFName, 'wb');
        $file->lock(LOCK_EX);
        $file->writeByte(10);
        $file->writeBytes("\xFF\x00\xAA\x11\xBB\x44\x66\x99");
        $file->writeInt(49057123);
        $file->writeLong(753823522);
        $file->writeVInt(234586758);
        $file->writeString("UTF-8 string with non-ascii (Cyrillic) symbols\nUTF-8 строка с не-ASCII (кириллическими) символами");
        $file->writeVInt(8); $file->writeBytes("\xFF\x00\xAA\x11\xBB\x44\x66\x99");
        $file->flush();
        $file->unlock();
        $file->close();

        $fh = fopen($testFName, 'rb');
        $this->assertEquals($fileData, fread($fh, filesize($testFName)));
        fclose($fh);

        unlink($testFName);
    }

    public function testMemory()
    {
        $file = new Zend_Search_Lucene_Storage_File_Filesystem(dirname(__FILE__) . '/_files/sample_data');
        $fileData = $file->readBytes($file->size());
        $file->close();
        unset($file);

        $file = new Zend_Search_Lucene_Storage_File_Memory($fileData);
        $this->assertTrue($file instanceof  Zend_Search_Lucene_Storage_File);

        $fileSize = strlen($fileData);

        $file->seek(0, SEEK_END);
        $this->assertEquals($file->tell(), $fileSize);

        $file->seek(2, SEEK_SET);
        $this->assertEquals($file->tell(), 2);

        $file->seek(3, SEEK_CUR);
        $this->assertEquals($file->tell(), 5);

        $file->seek(0, SEEK_SET);
        $this->assertEquals($file->tell(), 0);

        $this->assertEquals($file->readByte(),   10);
        $this->assertEquals($file->readBytes(8), "\xFF\x00\xAA\x11\xBB\x44\x66\x99");
        $this->assertEquals($file->readInt(),    49057123);
        $this->assertEquals($file->readLong(),   753823522);
        $this->assertEquals($file->readVInt(),   234586758);
        $this->assertEquals($file->readString(), "UTF-8 string with non-ascii (Cyrillic) symbols\nUTF-8 строка с не-ASCII (кириллическими) символами");
        $this->assertEquals($file->readBinary(), "\xFF\x00\xAA\x11\xBB\x44\x66\x99");

        // these methods do nothing, but should be provided by object
        $file->lock(LOCK_EX);
        $file->unlock();
    }
}


text:
@extends('layouts.app')
@section('content')
<meta name="csrf-token" content="{{ csrf_token() }}">

Liste des parties

      Nom
      Joueur 1
      Joueur 2
      Mode
      Statut
      Action

  @foreach($parties as $partie)

    {{$partie->nom}}
    {{$partie->user_1->name}}
    @if($partie->user_2){{$partie->user_2->name}}@endif
    {{$partie->getMode()}}
    {{$partie->getStatut()}}

    @if($boutonAction[$partie->id] == "rejoindre")
    id}}" >Rejoindre
      id}}">

    @elseif($boutonAction[$partie->id] == "choix_deck")

      <form action="partie/choix-deck" method="post">
        <input type="hidden" name="_token" value="{{ csrf_token() }}">
        <input type="hidden" name="id_partie" value="{{$partie->id}}">
        <input type="submit" class="fa submit-with-icon" value="" class="submit-with-icon" title="Choisir un deck"></button>
      </form>
      id}}">

    @elseif($boutonAction[$partie->id] == "choix_deploiement")

      <form action="partie/choix-deploiement" method="post">
        <input type="hidden" name="_token" value="{{ csrf_token() }}">
        <input type="hidden" name="id_partie" value="{{$partie->id}}">
        <input type="submit" class="fa submit-with-icon" value="" class="submit-with-icon" title="Choisir son déploiement"></button>
      </form>
      id}}">

    @elseif($boutonAction[$partie->id] == "attente_lancement")

      id}}">
      id}}">

    @elseif($boutonAction[$partie->id] == "en_cours")

      id}}">
      id}}">
      id}}">

    @elseif($partie->statut =="attente_joueur")

      id}}">

    @endif

  @endforeach

@endsection


text:
package org.apache.kafka.clients.admin;

import org.apache.kafka.common.annotation.InterfaceStability;

import java.util.List;

/**
 * Options for {@link AdminClient#alterUserScramCredentials(List, AlterUserScramCredentialsOptions)}
 *
 * The API of this class is evolving. See {@link AdminClient} for details.
 */
@InterfaceStability.Evolving
public class AlterUserScramCredentialsOptions extends AbstractOptions<AlterUserScramCredentialsOptions> {
}


text:
package org.encuestame.mvc.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.encuestame.business.setup.StartupProcess;
import org.encuestame.core.config.EnMePlaceHolderConfigurer;
import org.encuestame.core.files.PathUtil;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.ModelAndViewDefiningException;

/**
 * Setup interceptor.
 * @author Picado, Juan juanATencuestame.org
 * @since Mar 25, 2011
 */
public class SetupInterceptor extends AbstractEnMeInterceptor{

    /**
     *
     */
    private Logger log = Logger.getLogger(this.getClass());

    //@Autowired
    public StartupProcess startup;

    /*
     * (non-Javadoc)
     * @see org.springframework.web.servlet.HandlerInterceptor#afterCompletion(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, java.lang.Exception)
     */
    @Override
    public void afterCompletion(HttpServletRequest arg0,
            HttpServletResponse arg1, Object arg2, Exception arg3)
            throws Exception {
        log.trace("SetupInterceptor afterCompletion");
        log.info(this.startup);
    }

    /*
     * (non-Javadoc)
     * @see org.springframework.web.servlet.HandlerInterceptor#postHandle(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, org.springframework.web.servlet.ModelAndView)
     */
    @Override
    public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1,
            Object arg2, ModelAndView arg3) throws Exception {
         log.trace("SetupInterceptor postHandle");
         log.info(this.startup);

    }

    /*
     * (non-Javadoc)
     * @see org.springframework.web.servlet.HandlerInterceptor#preHandle(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object)
     */
    @Override
    public boolean preHandle(
            HttpServletRequest httpServletRequest,
            HttpServletResponse httpServletResponse,
            Object arg2) throws Exception {
        // get the current context path.
        final String context = httpServletRequest.getContextPath();
        // build the path
        final StringBuilder path = new StringBuilder(context);
        path.append(PathUtil.setup);
        if (log.isTraceEnabled()) {
            log.trace("Request URI "+httpServletRequest.getRequestURI());
            log.trace("Context Path URI "+path.toString());
            log.trace("Context Path URI "+ (httpServletRequest.getRequestURI().equalsIgnoreCase(path.toString())));
            log.trace("Context Path URI "+ (httpServletRequest.getRequestURI().equals(path.toString())));
        }
        // check if the uri match with the setup uri
        if (!httpServletRequest.getRequestURI().toString().equals(path.toString())) {
            final String uuid = EnMePlaceHolderConfigurer.getConfigurationManager().getProperty("install.uuid");
            if (uuid == null) {
                     log.info("system not installed ...");
                     final ModelAndView modelAndView = new ModelAndView("redirect:/setup");
                     throw new ModelAndViewDefiningException(modelAndView);
            }
        } else {
            log.trace("you are on setup interface ...");
        }

        log.trace("SetupInterceptor preHandle");
        return true;
    }

    /**
     * @return the startup
     */
    public StartupProcess getStartup() {
        return startup;
    }

    /**
     * @param startup the startup to set
     */
    public void setStartup(StartupProcess startup) {
        this.startup = startup;
    }
}


text:
package org.apache.hadoop.hive.ql.exec;

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

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
import org.apache.hadoop.hive.ql.io.HiveKey;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.plan.OperatorDesc;
import org.apache.hadoop.io.BytesWritable;

public class PTFTopNHash extends TopNHash {

  protected float memUsage;
  protected boolean isMapGroupBy;
  private Map<Key, TopNHash> partitionHeaps;
  private TopNHash largestPartition;
  private boolean prevIndexPartIsNull;
  private Set<Integer> indexesWithNullPartKey;
  private OperatorDesc conf;
  private Configuration hconf;

  public void initialize(
    int topN, float memUsage, boolean isMapGroupBy, BinaryCollector collector, final OperatorDesc conf,
    final Configuration hconf) {
    super.initialize(topN, memUsage, isMapGroupBy, collector, conf, hconf);
    this.conf = conf;
    this.hconf = hconf;
    this.isMapGroupBy = isMapGroupBy;
    this.memUsage = memUsage;
    partitionHeaps = new HashMap<Key, TopNHash>();
    indexesWithNullPartKey = new HashSet<Integer>();
  }

  public int tryStoreKey(HiveKey key, boolean partColsIsNull) throws HiveException, IOException {
    prevIndexPartIsNull = partColsIsNull;
    return _tryStoreKey(key, partColsIsNull, -1);
  }

  private void updateLargest(TopNHash p) {
    if ( largestPartition == null || largestPartition.usage < p.usage) {
      largestPartition = p;
    }
  }

  private void findLargest() {
    for(TopNHash p : partitionHeaps.values() ) {
      updateLargest(p);
    }
  }

  public int _tryStoreKey(HiveKey key, boolean partColsIsNull, int batchIndex) throws HiveException, IOException {
    if (!isEnabled) {
      return FORWARD; // short-circuit quickly - forward all rows
    }
    if (topN == 0) {
      return EXCLUDE; // short-circuit quickly - eat all rows
    }
    Key pk = new Key(partColsIsNull, key.hashCode());
    TopNHash partHeap = partitionHeaps.get(pk);
    if ( partHeap == null ) {
      partHeap = new TopNHash();
      partHeap.initialize(topN, memUsage, isMapGroupBy, collector, conf, hconf);
      if ( batchIndex >= 0 ) {
        partHeap.startVectorizedBatch(batchSize);
      }
      partitionHeaps.put(pk, partHeap);
    }
    usage = usage - partHeap.usage;
    int r = 0;
    if ( batchIndex >= 0 ) {
      partHeap.tryStoreVectorizedKey(key, false, batchIndex);
    } else {
      r = partHeap.tryStoreKey(key, false);
    }
    usage = usage + partHeap.usage;
    updateLargest(partHeap);

    if ( usage > threshold ) {
      usage -= largestPartition.usage;
      largestPartition.flush();
      usage += largestPartition.usage;
      largestPartition = null;
      findLargest();
    }
    return r;
  }

  public void storeValue(int index, int hashCode, BytesWritable value, boolean vectorized) {
    Key pk = new Key(prevIndexPartIsNull, hashCode);
    TopNHash partHeap = partitionHeaps.get(pk);
    usage = usage - partHeap.usage;
    partHeap.storeValue(index, hashCode, value, vectorized);
    usage = usage + partHeap.usage;
    updateLargest(partHeap);
  }

  public void flush() throws HiveException {
    if (!isEnabled || (topN == 0)) return;
    for(TopNHash partHash : partitionHeaps.values()) {
      partHash.flush();
    }
  }

  public int startVectorizedBatch(int size) throws IOException, HiveException {
    if (!isEnabled) {
      return FORWARD; // short-circuit quickly - forward all rows
    } else if (topN == 0) {
      return EXCLUDE; // short-circuit quickly - eat all rows
    }
    for(TopNHash partHash : partitionHeaps.values()) {
      usage = usage - partHash.usage;
      partHash.startVectorizedBatch(size);
      usage = usage + partHash.usage;
      updateLargest(partHash);
    }
    batchSize = size;
    if (batchIndexToResult == null || batchIndexToResult.length < batchSize) {
      batchIndexToResult = new int[Math.max(batchSize, VectorizedRowBatch.DEFAULT_SIZE)];
    }
    indexesWithNullPartKey.clear();
    return 0;
  }

  public void tryStoreVectorizedKey(HiveKey key, boolean partColsIsNull, int batchIndex)
      throws HiveException, IOException {
    _tryStoreKey(key, partColsIsNull, batchIndex);
    if ( partColsIsNull ) {
      indexesWithNullPartKey.add(batchIndex);
    }
    batchIndexToResult[batchIndex] = key.hashCode();
  }

  public int getVectorizedBatchResult(int batchIndex) {
    prevIndexPartIsNull = indexesWithNullPartKey.contains(batchIndex);
    Key pk = new Key(prevIndexPartIsNull, batchIndexToResult[batchIndex]);
    TopNHash partHeap = partitionHeaps.get(pk);
    return partHeap.getVectorizedBatchResult(batchIndex);
  }

  public HiveKey getVectorizedKeyToForward(int batchIndex) {
    prevIndexPartIsNull = indexesWithNullPartKey.contains(batchIndex);
    Key pk = new Key(prevIndexPartIsNull, batchIndexToResult[batchIndex]);
    TopNHash partHeap = partitionHeaps.get(pk);
    return partHeap.getVectorizedKeyToForward(batchIndex);
  }

  public int getVectorizedKeyDistLength(int batchIndex) {
    prevIndexPartIsNull = indexesWithNullPartKey.contains(batchIndex);
    Key pk = new Key(prevIndexPartIsNull, batchIndexToResult[batchIndex]);
    TopNHash partHeap = partitionHeaps.get(pk);
    return partHeap.getVectorizedKeyDistLength(batchIndex);
  }

  public int getVectorizedKeyHashCode(int batchIndex) {
    prevIndexPartIsNull = indexesWithNullPartKey.contains(batchIndex);
    Key pk = new Key(prevIndexPartIsNull, batchIndexToResult[batchIndex]);
    TopNHash partHeap = partitionHeaps.get(pk);
    return partHeap.getVectorizedKeyHashCode(batchIndex);
  }

  static class Key {
    boolean isNull;
    int hashCode;

    public Key(boolean isNull, int hashCode) {
      super();
      this.isNull = isNull;
      this.hashCode = hashCode;
    }

    @Override
    public int hashCode() {
     return hashCode;
    }

    @Override
    public boolean equals(Object obj) {
      if (this == obj)
        return true;
      if (obj == null)
        return false;
      if (getClass() != obj.getClass())
        return false;
      Key other = (Key) obj;
      if (hashCode != other.hashCode)
        return false;
      if (isNull != other.isNull)
        return false;
      return true;
    }

    @Override
    public String toString() {
      return "" + hashCode + "," + isNull;
    }

  }
}


text:
module Geokit
  # These defaults are used in Geokit::Mappable.distance_to and in acts_as_mappable
  @@default_units   = :miles
  @@default_formula = :sphere

  [:default_units, :default_formula].each do |sym|
    class_eval <<-EOS, __FILE__, __LINE__
      def self.#{sym}
        if defined?(#{sym.to_s.upcase})
          #{sym.to_s.upcase}
        else
          @@#{sym}
        end
      end

      def self.#{sym}=(obj)
        @@#{sym} = obj
      end
    EOS
  end
end

path = File.expand_path(File.dirname(__FILE__))
$:.unshift path unless $:.include?(path)
require 'geokit/core_ext'
require 'geokit/geocoders'
require 'geokit/mappable'
require 'geokit/bounds'
require 'geokit/lat_lng'
require 'geokit/geo_loc'
require 'geokit/polygon'


text:
FROM debian:jessie
MAINTAINER Roberto Quintanilla <roberto.quintanilla@gmail.com>

# Add the kibana user and group first to make sure their IDs get assigned
# consistently (we like it to be 1000), regardless of whatever dependencies get
# added:
RUN cp /etc/default/useradd /etc/default/useradd.bak \
  && echo "HOME=" >> /etc/default/useradd \
  && useradd --create-home --shell /usr/sbin/nologin kibana \
  && rm -rf /etc/default/useradd \
  && mv /etc/default/useradd.bak /etc/default/useradd \
  && rm /kibana/.bash_logout /kibana/.bashrc /kibana/.profile

# Set the Kibana Version:
ENV KIBANA_VERSION 4.0.1

# Fetch Kibana:
# - Install curl so we can fetch the kibana code
# - Fetch the Kibana code to the kibana home directory (/kibana)
# - Fetch a default kibana configuration file - which should be customized for running as a Docker container, if applies...
# - Fetch an nginx configuration customized to run exclusively the kibana 3 app
# - Uninstall curl & curl dependencies, as it is no longer required.
RUN  apt-get update && apt-get install -y curl ca-certificates --no-install-recommends \
  && curl -SL "https://download.elasticsearch.org/kibana/kibana/kibana-$KIBANA_VERSION-linux-x64.tar.gz" \
  | tar -xzC /kibana --strip-components=1 \
  && curl -SL "https://raw.githubusercontent.com/vovimayhem/docker-kibana/master/kibana4/config/kibana.yml" \
  > /kibana/config/kibana.yml \
  && apt-get remove -y curl ca-certificates && apt-get -y autoremove \
  && rm -rf /var/lib/apt/lists/*

# Change the Kibana installation files owner to elasticsearch:
RUN chown -R kibana:kibana /kibana

# Set mountable volume:
VOLUME ["/kibana/config"]

# Add kibana bin directory to path:
ENV PATH /kibana/bin:$PATH

USER kibana
WORKDIR /kibana

# Expose Kibana UI port:
EXPOSE 5601

# Define default command.
CMD ["kibana"]


text:
package org.instantlogic.interaction.page;

import java.util.List;
import java.util.Map;

import org.instantlogic.fabric.deduction.Deduction;
import org.instantlogic.fabric.util.ValueAndLevel;
import org.instantlogic.interaction.util.ChangeContext;
import org.instantlogic.interaction.util.FlowEventOccurrence;
import org.instantlogic.interaction.util.RenderContext;
import org.instantlogic.interaction.util.SubmitContext;

/**
 * Does not create a fragment on the client.
 */
public class IfElseElement extends Element {
	private final Deduction<Boolean> condition;
	private final Element ifElement;
	private final Element elseElement;

	public IfElseElement(Deduction<Boolean> selection, Element ifElement, Element elseElement) {
		this.condition = selection;
		this.ifElement = ifElement;
		this.elseElement = elseElement;
	}

	@Override
	public void render(RenderContext context, List<Map<String, Object>> appendTo) {
		ValueAndLevel<Boolean> valueAndLevel = condition.deduce(context);
		if (!valueAndLevel.hasValue()) {
			return; // Render no If nor Else elements. This may be worth reconsidering
		}
		Element element = valueAndLevel.getValue()==Boolean.TRUE?ifElement:elseElement;
		if (element!=null) {
			element.render(context, appendTo);
		}
	}

	@Override
	public FlowEventOccurrence submit(SubmitContext submitContext) {
		ValueAndLevel<?> valueAndLevel = condition.deduce(submitContext);
		if (!valueAndLevel.hasValue()) return null;
		Element element = valueAndLevel.getValue()==Boolean.TRUE?ifElement:elseElement;

		if (element != null) {
			FlowEventOccurrence itemResult = element.submit(submitContext);
			if (itemResult!=null) {
				return itemResult;
			}
		}
		return null;
	}

	@Override
	public void change(ChangeContext changeContext) {
		ValueAndLevel<?> valueAndLevel = condition.deduce(changeContext);
		if (!valueAndLevel.hasValue()) return; // Depend on render() to handle this gracefully
		Element element = valueAndLevel.getValue()==Boolean.TRUE?ifElement:elseElement;

		if (element!=null) {
			element.change(changeContext);
		}
	}
}


text:
Sergeant is an opinionated command-line application framework for Go.

## Installation

    $ go get github.com/zachlatta/sergeant/sergeant

## Getting Started

Sergeant is very easy to get started with. A basic application can be as simple
as the following:

**main.go**
```go
package main

import "github.com/zachlatta/sergeant/sergeant"

func main() {
  sergeant.ApplicationName = "helloworld"
  sergeant.ApplicationDescription = "helloworld prints `Hello World!` to the console."

  sergeant.Commands = []*sergeant.Command {
    cmdHello,
  }
  sergeant.Init()
}
```

**hello.go**
```go
package main

import (
  "fmt"
  "github.com/zachlatta/sergeant/sergeant"
)

var cmdHello = &sergeant.Command {
  UsageLine: "hello",
  Short: "say hello to the world",
  Long: `
Hello greets the world with a friendly message.
`,
}

func init() {
  cmdHello.run = runHello
}

func runHello(cmd *sergeant.Command, args []string) {
  fmt.Println("Hello world!")
}
```

Running our application produces the following:

    helloworld prints 'Hello World!' to the console.

    Usage:

      helloworld command [arguments]

    The commands are:

      hello       say hello to the world

    Use "helloworld help [command]" for more information about a command.

For more usage examples, check out the `examples` folder.


text:
namespace ppapi {
namespace proxy {

PluginResource::PluginResource(IPC::Sender* sender, PP_Instance instance)
    : Resource(OBJECT_IS_PROXY, instance),
      sender_(sender),
      next_sequence_number_(0),
      sent_create_to_renderer_(false) {
}

PluginResource::~PluginResource() {
  if (sent_create_to_renderer_)
    Send(new PpapiHostMsg_ResourceDestroyed(pp_resource()));
}

bool PluginResource::Send(IPC::Message* message) {
  return sender_->Send(message);
}

void PluginResource::SendCreateToRenderer(const IPC::Message& msg) {
  DCHECK(!sent_create_to_renderer_);
  sent_create_to_renderer_ = true;
  ResourceMessageCallParams params(pp_resource(),
                                   next_sequence_number_++);
  Send(new PpapiHostMsg_ResourceCreated(params, pp_instance(), msg));
}

void PluginResource::PostToRenderer(const IPC::Message& msg) {
  ResourceMessageCallParams params(pp_resource(),
                                   next_sequence_number_++);
  Send(new PpapiHostMsg_ResourceCall(params, msg));
}

int32_t PluginResource::CallRenderer(const IPC::Message& msg) {
  ResourceMessageCallParams params(pp_resource(),
                                   next_sequence_number_++);
  params.set_has_callback();
  Send(new PpapiHostMsg_ResourceCall(params, msg));
  return params.sequence();
}

}  // namespace proxy
}  // namespace ppapi


text:
from __future__ import annotations

import typing

from PyQt6.QtCore import Qt, QVariant
from PyQt6.QtGui import QFont, QTextFormat
from PyQt6.QtWidgets import (QDockWidget, QFrame, QHBoxLayout, QLabel,
                             QTextEdit, QVBoxLayout, QWidget)

import cemu.core
from cemu.const import COMMENT_MARKER

if typing.TYPE_CHECKING:
    from cemu.ui.main import CEmuWindow

from ..utils import assemble, get_cursor_position
from .highlighter import Highlighter

class CodeEdit(QTextEdit):
    def __init__(self, parent):
        super(CodeEdit, self).__init__(parent)
        self.cursorPositionChanged.connect(self.UpdateHighlightedLine)
        self.setFont(QFont('Courier', 11))
        self.setFrameStyle(QFrame.Shape.Panel | QFrame.Shape.NoFrame)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded)
        return

    def UpdateHighlightedLine(self):
        selection = QTextEdit.ExtraSelection()
        selection.format.setBackground(self.palette().alternateBase())
        selection.format.setProperty(
            QTextFormat.Property.FullWidthSelection, QVariant(True))
        selection.cursor = self.textCursor()
        selection.cursor.clearSelection()
        self.setExtraSelections([selection, ])
        return

class AssemblyView(QTextEdit):
    def __init__(self, parent, editor):
        super().__init__(parent)
        self.rootWindow = parent.rootWindow
        self.setReadOnly(True)
        self.setFont(QFont('Courier', 11))
        self.setFixedWidth(140)
        self.setFrameStyle(QFrame.Shape.Panel | QFrame.Shape.NoFrame)
        self.setStyleSheet("background-color: rgb(211, 211, 211);")
        self.__editor = editor
        self.__editor.textChanged.connect(self.__update_assembly_code)
        return

    def __update_assembly_code(self):
        lines = self.__editor.toPlainText().splitlines()
        nb_lines = len(lines)
        bytecode_lines = ["", ]*nb_lines
        old_code = ""

        for idx in range(nb_lines):
            curline = lines[idx].strip()
            if not curline or curline.startswith(COMMENT_MARKER):
                bytecode_lines[idx] = "\n"
                continue

            asm = "\n".join(lines[:idx+1])
            code, _ = assemble(asm)
            if len(code) > len(old_code):
                new_code = code[len(old_code):]
                new_line = " ".join(["%.02x" % x for x in new_code])
                old_code = code
                bytecode_lines[idx] = new_line

        self.setText("\n".join(bytecode_lines))
        return

class CodeWithAssemblyFrame(QFrame):
    def __init__(self, parent: CodeEditorFrame):
        super().__init__(parent)
        self.rootWindow = parent.rootWindow
        self.__code_widget = CodeEdit(self)
        self.__asm_widget = AssemblyView(self, self.__code_widget)
        layout = QHBoxLayout(self)
        layout.setSpacing(0)
        layout.addWidget(self.__asm_widget)
        layout.addWidget(self.__code_widget)
        self.setLayout(layout)
        return

    @property
    def code_editor(self):
        return self.__code_widget

class CodeEditorFrame(QFrame):
    def __init__(self, parent: CodeWidget):
        super().__init__(parent)
        self.rootWindow = parent.rootWindow
        inner_frame = CodeWithAssemblyFrame(self)
        self.editor = inner_frame.code_editor
        self.highlighter = Highlighter(self.editor, "asm")
        layout = QVBoxLayout(self)
        layout.setSpacing(0)
        layout.addWidget(inner_frame)
        return

class CodeWidget(QDockWidget):
    def __init__(self, parent, *args, **kwargs):
        super(CodeWidget, self).__init__("Code View", parent)
        self.parentWindow = parent
        self.rootWindow: CEmuWindow = parent.rootWindow
        self.code_editor_frame = CodeEditorFrame(self)
        self.editor: CodeEdit = self.code_editor_frame.editor
        self.editor.cursorPositionChanged.connect(self.onCursorPositionChanged)
        layout = QVBoxLayout()
        layout.setSpacing(0)
        self.widget_title_label = QLabel("Code (Line:1 Column:1)")
        layout.addWidget(self.widget_title_label)
        layout.addWidget(self.code_editor_frame)
        widget = QWidget(self)
        widget.setLayout(layout)
        self.setWidget(widget)
        return

    def onCursorPositionChanged(self):
        self.UpdateTitleLabel()
        return

    def UpdateTitleLabel(self):
        row_num, col_num = get_cursor_position(self.editor)
        self.widget_title_label.setText(
            f"Code (Line:{row_num+1} Column:{col_num+1})")
        return

    def getCleanContent(self) -> str:
        """
        Returns the content of the Code widget as a byte array or string.
        """

        def remove_comments(lines: list[str]) -> list[str]:
            clean = []
            for line in lines:
                line = line.strip()
                if line.startswith(COMMENT_MARKER):
                    # ignore line comments
                    continue
                if "#" in line:
                    # strip everything *after* the `#`
                    line = line[: line.find("#")]
                clean.append(line)
            return clean

        def parse_syscalls(lines: list[str]) -> list[str]:
            parsed = []
            syscalls = cemu.core.context.architecture.syscalls
            syscall_names = syscalls.keys()
            for line in lines:
                for sysname in syscall_names:
                    pattern = f"__NR_SYS_{sysname}"
                    if pattern in line:
                        line = line.replace(pattern, str(syscalls[sysname]))
                parsed.append(line)
            return parsed

        code: str = self.editor.toPlainText()
        if not code:
            return ""

        lines: list[str] = code.splitlines()

        lines = remove_comments(lines)

        lines = parse_syscalls(lines)

        return '\n'.join(lines)


text:
"""
wx.SystemSettings:

Allows the application to ask for details about the system.

This can include settings such as standard colours, fonts, and user interface
element sizes.

"""

__author__ = "Cody Precord <cprecord@editra.org>"

#-----------------------------------------------------------------------------#
# Imports
import os
import sys
import wx
import wx.lib.scrolledpanel as scrolled

#-----------------------------------------------------------------------------#

class TestPanel(wx.Panel):
    def __init__(self, parent, log):
        wx.Panel.__init__(self, parent)

        # Attributes
        self.log = log
        self._nb = wx.Notebook(self)

        # Setup
        panel1 = ScrolledWrapper(self._nb, SysColorPanel, self.log)
        self._nb.AddPage(panel1, "System Colors")
        panel2 = ScrolledWrapper(self._nb, SysFontPanel, self.log)
        self._nb.AddPage(panel2, "System Fonts")
        panel3 = ScrolledWrapper(self._nb, SysMetricPanel, self.log)
        self._nb.AddPage(panel3, "System Metrics")
        panel4 = ScrolledWrapper(self._nb, SysFeaturePanel, self.log)
        self._nb.AddPage(panel4, "System Features")

        # Layout
        self.__DoLayout()

    def __DoLayout(self):
        """Layout the panel"""
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self._nb, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.SetAutoLayout(True)

#----------------------------------------------------------------------

class SysPanelBase(wx.Panel):
    def __init__(self, parent, log):
        wx.Panel.__init__(self, parent)#, size=(500, 500))

        # Attributes
        self.log = log
        self._vals = list()

        ## Event Handlers
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_SCROLLWIN, self.OnScroll)

    def DoGetBestSize(self):
        """Return the best size for this panel"""
        maxw = 0
        for vals in self._vals:
            extent = self.GetTextExtent(vals)[0]
            if extent > maxw:
                maxw = extent

        self._maxw = maxw
        maxw += 75
        maxh = (len(self._vals) + 1) * 22
        return (maxw, maxh)

    def SetupPaintDC(self, dc):
        """Paint the screen
        @param dc: paint DC

        """
        dc.SetFont(self.GetFont())
        dc.SetBrush(wx.WHITE_BRUSH)
        dc.Clear()
        dc.DrawRectangle(self.GetClientRect())

        dc.SetPen(wx.BLACK_PEN)
        dc.SetTextForeground(wx.BLACK)

    def OnPaint(self, evt):
        dc = wx.PaintDC(self)
        evt.Skip()

    def OnSize(self, evt):
        self.Refresh()
        evt.Skip()

    def OnScroll(self, evt):
        self.Refresh()
        evt.Skip()

    def OnErase(self, evt):
        pass

#----------------------------------------------------------------------

class SysColorPanel(SysPanelBase):
    def __init__(self, parent, log):
        SysPanelBase.__init__(self, parent, log)

        # Attributes:
        self._box = (50, 15) # Color box dimensions
        self._maxw = 0
        self._vals = [ color for color in dir(wx)
                       if color.startswith('SYS_COLOUR_') and
                       color != 'SYS_COLOUR_MAX' ]

    def OnPaint(self, evt):
        dc = wx.AutoBufferedPaintDCFactory(self)
        self.SetupPaintDC(dc)

        # Draw a sample box for each system color
        nextx = 10
        nexty = 10
        column = 0
        row_count = 0
        for val in self._vals:
            syscolor = wx.SystemSettings.GetColour(getattr(wx, val))
            dc.SetBrush(wx.Brush(syscolor))

            # Draw label
            dc.DrawText(val, nextx, nexty)

            # Calculate box position
            nextx += self._maxw + 8
            dc.DrawRectangle(nextx, nexty, self._box[0], self._box[1])

            nextx = 10
            nexty += 20

#----------------------------------------------------------------------

class SysFontPanel(SysPanelBase):
    def __init__(self, parent, log):
        SysPanelBase.__init__(self, parent, log)

        # Attributes:
        self._maxw = 0
        self._vals = ['SYS_ANSI_FIXED_FONT',
                      'SYS_ANSI_VAR_FONT',
                      'SYS_DEFAULT_GUI_FONT',
                      'SYS_DEVICE_DEFAULT_FONT',
                      # 'SYS_ICONTITLE_FONT',
                      'SYS_OEM_FIXED_FONT',
                      # 'SYS_SYSTEM_FIXED_FONT',
                      'SYS_SYSTEM_FONT'
                      ]

    def OnPaint(self, evt):
        dc = wx.AutoBufferedPaintDCFactory(self)
        self.SetupPaintDC(dc)

        # Draw a sample box for each system color
        nextx = 10
        nexty = 10
        column = 0
        row_count = 0
        for val in self._vals:
            dc.SetFont(self.GetFont())
            sysfont = wx.SystemSettings.GetFont(getattr(wx, val))

            # Draw label
            dc.DrawText(val, nextx, nexty)

            # Calculate box position
            nextx += self._maxw + 8
            dc.SetFont(sysfont)
            dc.DrawText(sysfont.GetFaceName(), nextx, nexty)

            nextx = 10
            nexty += 20

#----------------------------------------------------------------------

class SysMetricPanel(SysPanelBase):
    def __init__(self, parent, log):
        SysPanelBase.__init__(self, parent, log)

        # Attributes:
        self._maxw = 0
        self._vals = ['SYS_BORDER_X', 'SYS_BORDER_Y', 'SYS_CAPTION_Y',
                      'SYS_CURSOR_X', 'SYS_CURSOR_Y', 'SYS_DCLICK_X',
                      'SYS_DCLICK_Y', 'SYS_DRAG_X', 'SYS_DRAG_Y',
                      'SYS_EDGE_X', 'SYS_EDGE_Y', 'SYS_FRAMESIZE_X',
                      'SYS_FRAMESIZE_Y', 'SYS_HSCROLL_ARROW_X',
                      'SYS_HSCROLL_ARROW_Y', 'SYS_HSCROLL_Y', 'SYS_HTHUMB_X',
                      'SYS_ICONSPACING_X', 'SYS_ICONSPACING_Y', 'SYS_ICON_X',
                      'SYS_ICON_Y', 'SYS_MENU_Y', 'SYS_SCREEN_X',
                      'SYS_SCREEN_Y', 'SYS_SMALLICON_X', 'SYS_SMALLICON_Y',
                      'SYS_VSCROLL_ARROW_X', 'SYS_VSCROLL_ARROW_Y',
                      'SYS_VSCROLL_X', 'SYS_VTHUMB_Y', 'SYS_WINDOWMIN_X',
                      'SYS_WINDOWMIN_Y', 'SYS_MOUSE_BUTTONS',
                      'SYS_NETWORK_PRESENT', 'SYS_PENWINDOWS_PRESENT',
                      'SYS_SHOW_SOUNDS', 'SYS_SWAP_BUTTONS']
        self._vals.sort()

    def OnPaint(self, evt):
        dc = wx.AutoBufferedPaintDCFactory(self)
        self.SetupPaintDC(dc)

        # Draw a sample box for each system color
        nextx = 10
        nexty = 10
        column = 0
        row_count = 0
        for val in self._vals:
            sysmetric = wx.SystemSettings.GetMetric(getattr(wx, val))

            # Draw label
            dc.DrawText(val, nextx, nexty)

            # Calculate box position
            nextx += self._maxw + 8
            dc.DrawText(repr(sysmetric), nextx, nexty)

            nextx = 10
            nexty += 20

#----------------------------------------------------------------------

class SysFeaturePanel(SysPanelBase):
    def __init__(self, parent, log):
        SysPanelBase.__init__(self, parent, log)

        # Attributes:
        self._maxw = 0
        self._vals = ['SYS_CAN_DRAW_FRAME_DECORATIONS',
                      'SYS_CAN_ICONIZE_FRAME',
                      'SYS_TABLET_PRESENT' ]

    def OnPaint(self, evt):
        dc = wx.AutoBufferedPaintDCFactory(self)
        self.SetupPaintDC(dc)

        # Draw a sample box for each system color
        nextx = 10
        nexty = 10
        column = 0
        row_count = 0
        for val in self._vals:
            sysfeature = wx.SystemSettings.HasFeature(getattr(wx, val))

            # Draw label
            dc.DrawText(val, nextx, nexty)

            # Calculate box position
            nextx += self._maxw + 8
            dc.DrawText(repr(sysfeature), nextx, nexty)

            nextx = 10
            nexty += 20

#----------------------------------------------------------------------

class ScrolledWrapper(scrolled.ScrolledPanel):
    def __init__(self, parent, ctor, log):
        """Wrap the given window in a scrolled panel"""
        scrolled.ScrolledPanel.__init__(self, parent)

        # Attributes
        self._panel = ctor(self, log)

        # Layout
        sizer = wx.BoxSizer(wx.VERTICAL)

        sizer.Add(self._panel, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.SetAutoLayout(True)

        # Setup
        self.SetupScrolling()

#----------------------------------------------------------------------

def runTest(frame, nb, log):
    win = TestPanel(nb, log)
    return win

class TestLog:
    def __init__(self):
        pass

    def write(self, msg):
        print(msg)

#----------------------------------------------------------------------

overview = __doc__

#-----------------------------------------------------------------------------#
if __name__ == '__main__':
    try:
        import sys
        import run
    except ImportError:
        app = wx.App(False)
        frame = wx.Frame(None, title="SystemSettings Demo", size=(500, 500))
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(TestPanel(frame, TestLog()), 1, wx.EXPAND)
        frame.CreateStatusBar()
        frame.SetSizer(sizer)
        frame.Show()
        app.MainLoop()
    else:
        run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])


text:
<?xml version='1.0' encoding='UTF-8'?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.apache.maven.plugins.antrun</groupId>
  <artifactId>mantrun-155</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>mantrun-155</name>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>@pom.version@</version>
        <executions>
          <execution>
            <id>antrun</id>
            <phase>test</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <!-- non-ASCII chars: ÅÄÖ -->
                <echo message="non-ASCII chars: ÅÄÖ" />
                <!-- escaped characters -->
                <echo message="Some "strange and mysterious" result"/>
              </tasks>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>


text:
namespace OrchardHarvest.Caching {
    internal static class WellKnownSignals {
        public static string TwitterPartChanged { get { return "OrchardHarvest.Twitter.TwitterPartChanged"; } }
    }
}