text:
<?php

namespace Pff\TextSizeCalculator;

class Autoloader
{
    public static function register()
    {
        spl_autoload_register(array('Pff\TextSizeCalculator\Autoloader', 'autoload'));
    }
    public static function autoload($class_name)
    {
        $base_path = dirname(__FILE__).'/../..';
        $rel_path = str_replace(array('_', '\\'), DIRECTORY_SEPARATOR, $class_name).'.php';
        $full_path = $base_path.DIRECTORY_SEPARATOR.$rel_path;
        if (file_exists($full_path))
        {
            require_once $full_path;
        }
    }
}


text:
module RackMiddlewareSpecHelper
  shared_context "200 OK", assert: :RequestSuccess do
    it 'should return 200 OK' do
      get @path
      expect(last_response.status).to eq 200
      expect(last_response.body).not_to be_nil
      expect(last_response.header).not_to be_empty
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
@interface ViewController : UIViewController<ChartViewDataSource,GridViewDataSource,GridViewDelegate,UITableViewDataSource,UITableViewDelegate>
{
    NSMutableArray *rows;
    //总指标数
    NSInteger totalIndexs;
    //选中的指标索引
    NSMutableArray *selectedIndexs;

}

@property (retain, nonatomic) IBOutlet UISegmentedControl *segctrlChartType;
@property (retain, nonatomic) IBOutlet GridView *gridViewChart;
@property (retain, nonatomic) IBOutlet ChartView *chartViewChart;

@property (retain, nonatomic) IBOutlet UITableView *tableViewIndex;

- (IBAction)dataChanged:(id)sender;

- (IBAction)handleChartTypeChanged:(id)sender;
@end


text:
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import pprint
import util
from website import (
    fetch_airchina,
    fetch_ceair,
    fetch_ch,
    fetch_csair,
    fetch_ctrip
)
from model.flight import Flight
from constant import (
    Website,
    CITY_NAME,
    EXEC_TIME,
)
from setting.subscribe_settings import (
    SUBSCRIBE_PERIODS,
    TOP_CHEAP_COUNT,
    PRICE_FLUCTUATION,
    IS_RECORD_HTML,
    IS_SEND_EMAIL,
)
import template.page

func_map = {
    Website.CTRIP: fetch_ctrip,
    Website.CEAIR: fetch_ceair,
    Website.CSAIR: fetch_csair,
    Website.CH: fetch_ch,
    Website.AIRCHINA: fetch_airchina,
}

def get_top_cheap_flights(period):
    last_fetch_time = Flight.get_last_fetch_time()
    if not last_fetch_time:
        return []
    params = {'from_city': period['from_city'], 'to_city': period['to_city'],
              'flight_date': period['date'], 'fetch_time': last_fetch_time}
    flights = Flight.select(**params)
    selected_flights = [flight for flight in flights
                        if _filter_flight(flight, period)]
    return sorted(selected_flights, key=lambda x: x['price'])[0:TOP_CHEAP_COUNT]

def get_price_trend(period):
    flights = Flight.select(from_city=period['from_city'],
                            to_city=period['to_city'],
                            flight_date=period['date'])
    flights = [flight for flight in flights if _filter_flight(flight, period)]
    result = {'all': _get_price_trend(flights)}
    for website in Website.ALL:
        result[website] = _get_price_trend(
            filter(lambda x: x['website'] == website, flights))
    return result

def _filter_flight(flight, period):
    if flight['to_time'] < flight['from_time']:
        flight['to_time'] = str(int(flight['to_time'][0:2])+24) + \
            flight['to_time'][2:]
    if flight['from_airport'] in period['from_airport'] and \
            flight['to_airport'] in period['to_airport'] and \
            period['from_time'][0] <= flight['from_time'] \
            <= period['from_time'][1] and \
            period['to_time'][0] <= flight['to_time'] \
            <= period['to_time'][1]:
        return True
    return False

def _get_price_trend(flights):
    fetch_time_dict = {}
    for flight in flights:
        if flight['fetch_time'] in fetch_time_dict:
            fetch_time_dict[flight['fetch_time']].append(flight)
        else:
            fetch_time_dict[flight['fetch_time']] = [flight]
    result = []
    for fetch_time in sorted(fetch_time_dict.keys(), reverse=True):
        choose_flight = \
            sorted(fetch_time_dict[fetch_time], key=lambda x: x['price'])[0]
        if not result or \
                (result and abs(choose_flight['price']-result[-1]['price']) >
                    PRICE_FLUCTUATION):
            result.append(choose_flight)
    return result

def main():
    message_info = []
    trend_dict = {}
    for period in SUBSCRIBE_PERIODS:
        message_info.append({'from_city_name': CITY_NAME[period['from_city']],
                             'to_city_name': CITY_NAME[period['to_city']],
                             'from_city': period['from_city'],
                             'to_city': period['to_city'],
                             'date': period['date'],
                             'week_day_info': util.get_week_day(period['date']),
                             'flights': get_top_cheap_flights(period)})
        trend_dict[(period['date'], period['from_city'], period['to_city'])] =\
            get_price_trend(period)

    message_info = sorted(message_info, key=lambda x: x['date'])
    if message_info:
        tmp = template.page.get_html(message_info, trend_dict)
        if IS_RECORD_HTML:
            with open('html/%s.html' % EXEC_TIME.replace(' ', '_'), 'w') \
                    as handler:
                handler.write(tmp)
        if IS_SEND_EMAIL:
            util.send_email(tmp)

if __name__ == '__main__':
    main()


text:
/*
Bitmap info structure
*/

#ifndef FT_ESD_BITMAPINFO_H
#define FT_ESD_BITMAPINFO_H

#include "Ft_Esd.h"
#include "FT_DataTypes.h"
#include "Ft_Esd_GpuAlloc.h"

ESD_TYPE(Ft_Esd_BitmapInfo, Native = Struct) // TODO: Struct support, expose values
typedef struct
{
	ft_int32_t Width;
	ft_int32_t Height;
	ft_int32_t Stride;
	ft_int32_t Format;
	ft_int32_t Size;
	const char *File;

	// Handle pointing to the address in RAM_G if it is allocated
	Ft_Esd_GpuHandle GpuHandle;

	// Bitmap handle that is being used
	ft_uint32_t BitmapHandle;

	const char *PaletteFile;
	Ft_Esd_GpuHandle PaletteGpuHandle;

	// When this is set, the allocated ram is not free'd automatically
	// Use Ft_Esd_GpuAlloc_Free(GpuAlloc, GpuHandle) to free the GPU ram manually
	ft_bool_t Persistent;

} Ft_Esd_BitmapInfo;

ESD_TYPE(Ft_Esd_BitmapInfo *, Native = Pointer, Edit = Library)

ESD_TYPE(Ft_Esd_BitmapCell, Native = Struct) // TODO: Struct support, expose values
typedef struct
{
	Ft_Esd_BitmapInfo *Info;
	ft_int32_t Cell;
} Ft_Esd_BitmapCell;

ESD_TYPE(Ft_Esd_BitmapCell *, Native = Pointer, Edit = Library)

// Attempts to load the specified bitmap if it has not been loaded into RAM_G yet.
// Call during the Update cycle of each frame to keep the bitmap flagged as in use, otherwise the memory allocator may wipe the allocation from RAM.
ESD_FUNCTION(Ft_Esd_LoadBitmap, Type = ft_uint32_t, Include = "Ft_Esd_BitmapInfo.h", DisplayName = "Load Bitmap to RAM_G", Category = EsdUtilities)
ESD_PARAMETER(bitmapInfo, Type = Ft_Esd_BitmapInfo *)
ft_uint32_t Ft_Esd_LoadBitmap(Ft_Esd_BitmapInfo *bitmapInfo);

ESD_FUNCTION(Ft_Esd_LoadPalette, Type = ft_uint32_t, Include = "Ft_Esd_BitmapInfo.h", DisplayName = "Load Palette to RAM_G", Category = EsdUtilities)
ESD_PARAMETER(bitmapInfo, Type = Ft_Esd_BitmapInfo *)
ft_uint32_t Ft_Esd_LoadPalette(Ft_Esd_BitmapInfo *bitmapInfo);

ESD_ENUM(_BitmapResourceFormat, DisplayName = "Bitmap Format")
ESD_IDENTIFIER(ARGB1555)
ESD_IDENTIFIER(L1)
ESD_IDENTIFIER(L2)
ESD_IDENTIFIER(L4)
ESD_IDENTIFIER(L8)
ESD_IDENTIFIER(RGB332)
ESD_IDENTIFIER(ARGB2)
ESD_IDENTIFIER(ARGB4)
ESD_IDENTIFIER(RGB565)
ESD_IDENTIFIER(PALETTED565)
ESD_IDENTIFIER(PALETTED4444)
// ESD_IDENTIFIER(PALETTED8)
// ESD_IDENTIFIER(JPEG)
// ESD_IDENTIFIER(PNG)
ESD_END()

ESD_LOGIC(Ft_Esd_SwitchBitmapCell, Callback, Include = "Ft_Esd_BitmapInfo.h", DisplayName = "Switch Bitmap Cell", Category = EsdUtilities, Compact)
typedef struct
{
	// Callback
	void *Parent;

	//
	// Input
	//

	ESD_INPUT(BitmapInfo, Type = Ft_Esd_BitmapInfo *, DisplayName = "Bitmap Info")
	Ft_Esd_BitmapInfo *(* BitmapInfo)(void *context);

	ESD_INPUT(Cell, Type = ft_uint8_t, DisplayName = "Cell")
	ft_uint8_t(* Cell)(void *context);

	//
	// Variables
	//

	// BitmapCell object
	Ft_Esd_BitmapCell BitmapCell;

} Ft_Esd_SwitchBitmapCell;

void Ft_Esd_SwitchBitmapCell__Initializer(Ft_Esd_SwitchBitmapCell *context);

ESD_OUTPUT(BitmapCell, Type = Ft_Esd_BitmapCell *, DisplayName = "Bitmap Cell")
Ft_Esd_BitmapCell *Ft_Esd_SwitchBitmapCell_BitmapCell(Ft_Esd_SwitchBitmapCell *context);

ESD_UPDATE(Ft_Esd_BitmapPersist, DisplayName = "Bitmap Persist", Category = EsdUtilities)
ESD_PARAMETER(bitmapCell, Type = Ft_Esd_BitmapCell *)
void Ft_Esd_BitmapPersist(Ft_Esd_BitmapCell *bitmapCell);

ESD_FUNCTION(Ft_Esd_BitmapCell_GetInfo, Type = Ft_Esd_BitmapInfo *, DisplayName = "ESD BitmapCell GetInfo", Category = EsdUtilities, Inline)
ESD_PARAMETER(bitmapCell, Type = Ft_Esd_BitmapCell *)
static Ft_Esd_BitmapInfo *Ft_Esd_BitmapCell_GetInfo(Ft_Esd_BitmapCell *bitmapCell)
{
	if (!bitmapCell) return 0;
	return bitmapCell->Info;
}

ESD_FUNCTION(Ft_Esd_BitmapInfo_GetWidth, Type = ft_int32_t, DisplayName = "ESD BitmapInfo GetWidth", Category = EsdUtilities, Inline)
ESD_PARAMETER(bitmapInfo, Type = Ft_Esd_BitmapInfo *)
static inline ft_int32_t Ft_Esd_BitmapInfo_GetWidth(Ft_Esd_BitmapInfo *bitmapInfo)
{
	if (!bitmapInfo) return 1;
	return bitmapInfo->Width;
}

ESD_FUNCTION(Ft_Esd_BitmapInfo_GetHeight, Type = ft_int32_t, DisplayName = "ESD BitmapInfo GetHeight", Category = EsdUtilities, Inline)
ESD_PARAMETER(bitmapInfo, Type = Ft_Esd_BitmapInfo *)
static inline ft_int32_t Ft_Esd_BitmapInfo_GetHeight(Ft_Esd_BitmapInfo *bitmapInfo)
{
	if (!bitmapInfo) return 1;
	return bitmapInfo->Height;
}

#endif /* #ifndef FT_ESD_BITMAPINFO_H */

/* end of file */


text:
{% load silk_nav %}

Summary

Requests

Profiling

Clear DB


text:
if [ "$1" == "status" ]
then
  if [ $(cat /opt/scripts/.docker_config/.healthcheck) == 'maintenance' ]
  then
    echo 'Maintenance mode is ON.'
    exit 0
  elif [ $(cat /opt/scripts/.docker_config/.healthcheck) != 'maintenance' ]
  then
    echo 'Maintenance mode is OFF.'
    exit 0
  fi
elif [ "$1" == "on" ]
then
  echo 'You are going to stop ioBroker and activating maintenance mode for this container.'
  read -p 'Do you want to continue [yes/no]? ' A
  if [ "$A" == "y" ] || [ "$A" == "Y" ] || [ "$A" == "yes" ]
  then
    echo 'Activating maintenance mode...'
    echo "maintenance" > /opt/scripts/.docker_config/.healthcheck
    sleep 1
    echo 'Done.'
    echo 'Stopping ioBroker...'
    pkill -u iobroker
    sleep 1
    echo 'Done.'
    exit 0
  else
    exit 0
  fi
elif [ "$1" == "off" ]
then
  echo 'You are going to deactivate maintenance mode for this container.'
  echo 'Depending of the restart policy of this container, this will stop/ restart your container immediately.'
  read -p 'Do you want to continue [yes/no]? ' A
  if [ "$A" == "y" ] || [ "$A" == "Y" ] || [ "$A" == "yes" ]
  then
    echo 'Deactivating maintenance mode and forcing container to stop/ restart...'
    echo "maintenance" > /opt/scripts/.docker_config/.healthcheck
    pkill -u root
    exit 0
  else
    exit 0
  fi
else
  echo 'Invalid command. Please try again.'
fi

exit 0


text:
set :base_url, "https://www.serf.io/"

activate :hashicorp do |h|
  h.name        = "serf"
  h.version     = "0.7.0"
  h.github_slug = "hashicorp/serf"
end

helpers do
  # This helps by setting the "active" class for sidebar nav elements
  # if the YAML frontmatter matches the expected value.
  def sidebar_current(expected)
    current = current_page.data.sidebar_current
    if current.start_with?(expected)
      return " class=\"active\""
    else
      return ""
    end
  end
end


text:
define(['Ti/_/Evented', 'Ti/_/lang', 'Ti/_/Contacts/helper', 'Ti/Contacts'], function(Evented, lang, contactHelper, Contacts) {

	function errorCallback(e, callback) {
		callback({
			code: -1,
			error: e.type + ': ' + e.message,
			success: false
		});
	}

	// This function is supplied as a success callback to Tizen's contact searching functions.
	// It takes an array of native Tizen's contact objects, converts them to Titanium contacts, and returns
	// to the user via callback.
	//
	// Parameters:
	//
	// - "contacts" is an array of Tizen native contact objects that were found;
	// - "successCallback" is the callback from client code, to be called when the result is ready.

	function findContactsSuccessCallback (contacts, group, callback) {
		var contactsCount = contacts.length,
			groupsCount, j, groupIds,
			i = 0,
			persons = [],
			Person = require('Ti/Contacts/Person');

		for (; i < contactsCount; i++) {
			groupIds = contacts[i].groupIds;
			groupsCount = groupIds.length;

			// Tizen's contact object contains group ids in array, but it doesn't support the indexOf method.
			// So we need a loop to find the value.
			for (j = 0; j < groupsCount; j++) {
				if (groupIds[j] === group.recordId) {
					persons.push(new Person(contactHelper.createTitaniumContact(contacts[i])));
					break;
				}
			}
		}
		callback({
			code: 0,
			success: true,
			persons: persons
		});
	}

	return lang.setObject('Ti.Contacts.Tizen.Group', Evented, {

		members: function(group, callback) {
			var addressbook = tizen.contact.getDefaultAddressBook();

			// Tell Tizen to perform the search.
			addressbook.find(function(contacts) {
				findContactsSuccessCallback(contacts, group, callback);
			}, function (e) {
				errorCallback(e, callback);
			});
		},

		sortedMembers: function(sortBy, group, callback) {
			var sortField = (sortBy === Contacts.CONTACTS_SORT_FIRST_NAME) ? 'name.firstName' : 'name.lastName',
				// Create a SortMode object to define the desired contact sorting mode:
				sortMode = new tizen.SortMode(sortField, 'ASC'),
				addressbook = tizen.contact.getDefaultAddressBook();

			// Tell Tizen to perform the search.
			addressbook.find(function(contacts) {
				findContactsSuccessCallback(contacts, group, callback);
			}, function (e) {
				errorCallback(e, callback);
			}, null, sortMode);
		}

	});
});


text:
DROP TABLE IF EXISTS reservation;
DROP TABLE IF EXISTS workshop;
DROP TABLE IF EXISTS cook;
DROP TABLE IF EXISTS gourmet;
DROP TABLE IF EXISTS user_login;
DROP TABLE IF EXISTS user_account;
DROP TABLE IF EXISTS kitchen;


text:
package org.frameworkset.spi;

import java.io.InputStream;
import java.net.URL;

import org.apache.log4j.Logger;
import org.frameworkset.spi.assemble.ServiceProviderManager;
import org.frameworkset.spi.assemble.callback.AssembleCallback;

/**
 *
Title: DefaultApplicationContext.java

 *
Description:

 *
bboss workgroup

 *
Copyright (c) 2007

 * @Date 2011-5-11 上午11:25:51
 * @author biaoping.yin
 * @version 1.0
 */
public class DefaultApplicationContext extends BaseApplicationContext {
	private static Logger log = Logger.getLogger(DefaultApplicationContext.class);
	/**
	 * 获取指定根配置文件上下文bean组件管理容器,配置文件从参数configfile对应配置文件开始
	 * 不同的上下文件环境容器互相隔离,组件间不存在依赖关系,属性也不存在任何引用关系。
	 *
	 * @return
	 */
	public static DefaultApplicationContext getApplicationContext(String configfile) {
		if (configfile == null || configfile.equals("")) {
			log.debug("configfile is null or empty.default Config File["
					+ ServiceProviderManager.defaultConfigFile
					+ "] will be used. ");
			configfile = ServiceProviderManager.defaultConfigFile;
		}
		DefaultApplicationContext instance = (DefaultApplicationContext)applicationContexts.get(configfile);
		if (instance != null)
		{
			instance.initApplicationContext();
			return instance;
		}
		synchronized (lock) {
			instance = (DefaultApplicationContext)applicationContexts.get(configfile);
			if (instance != null)
				return instance;
			instance = new DefaultApplicationContext(configfile);
			BaseApplicationContext.addShutdownHook(new BeanDestroyHook(instance));
			applicationContexts.put(configfile, instance);

		}
		instance.initApplicationContext();
		return instance;
	}

	public static DefaultApplicationContext getApplicationContext(URL configfile) {
		if (configfile == null || configfile.equals("")) {
			throw new IllegalArgumentException("configfile is null");
		}
		String conf = configfile.getFile();
		DefaultApplicationContext instance = (DefaultApplicationContext)applicationContexts.get(conf);
		if (instance != null)
		{
			instance.initApplicationContext();
			return instance;
		}
		synchronized (lock) {
			instance = (DefaultApplicationContext)applicationContexts.get(conf);
			if (instance != null)
				return instance;
			instance = new DefaultApplicationContext(configfile);
			BaseApplicationContext.addShutdownHook(new BeanDestroyHook(instance));
			applicationContexts.put(conf, instance);

		}
		instance.initApplicationContext();
		return instance;
	}

	protected DefaultApplicationContext(String configfile)
	{
		super(configfile);
	}
	protected DefaultApplicationContext(String configfile, boolean isfile,boolean init)
	{
		super((String)configfile,isfile,init);
	}
	protected DefaultApplicationContext(String configfile, boolean isfile,String charset,boolean init)
	{
		super((String)configfile,isfile,charset, init);
	}
	protected DefaultApplicationContext(String docbaseType, String docbase,
			String configfile)
	{
		super( docbaseType,  docbase,
				 configfile);
	}
	protected DefaultApplicationContext(String docbaseType, String docbase,
			String configfile,boolean isfile)
	{
		super( docbaseType,  docbase,
				 configfile, isfile,true);
	}
	public DefaultApplicationContext(URL file, String path)
	{

		super((URL)file,  path);
	}

	public DefaultApplicationContext(InputStream instream, boolean isfile,boolean init) {
		super((InputStream)instream,isfile,true);
	}

	/**
	 * 可以用于外部文件加载,类似于构造函数
	 * public DefaultApplicationContext(String configfile)
	 * @param configfile
	 */
	public DefaultApplicationContext(URL configfile) {
		super(AssembleCallback.classpathprex, "",
				configfile, true);
	}

//	public ServiceID buildServiceID(Map<String, ServiceID> serviceids,
//			String serviceid, int serviceType, String providertype,
//			BaseApplicationContext applicationcontext) {
//		return ServiceIDUtil.buildServiceID(serviceids, serviceid, serviceType,
//				providertype, applicationcontext);
//
//	}
//
//
//
//	public ServiceID buildServiceID(Map<String, ServiceID> serviceids,
//			String serviceid, int serviceType,
//			BaseApplicationContext applicationcontext) {
//
//		return buildServiceID(serviceids, serviceid, serviceType, null,
//				applicationcontext);
//
//	}
//
//	public ServiceID buildBeanServiceID(Map<String, ServiceID> serviceids,
//			String serviceid, BaseApplicationContext applicationcontext) {
//
//		return buildServiceID(serviceids, serviceid,
//				ServiceID.PROPERTY_BEAN_SERVICE, null, applicationcontext);
//
//	}

}


text:
<?php

namespace JulianoBailao\LaravelEasyApi;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;

trait ValidationTrait
{
    /**
     * Implements to customize the validation rules.
     *
     * @param string $method storage or update
     * @param int    $id     the id from update record
     *
     * @return array
     */
    abstract protected function validationRules($method, $id = null);

    /**
     * Implements to customize the validation messages.
     *
     * @param string $method storage or update
     * @param int    $id     the id from update record
     *
     * @return array
     */
    abstract protected function validationMessages($method, $id = null);

    /**
     * Validate a Request data.
     *
     * @param Request $request
     * @param string  $method
     * @param string  $id
     *
     * @return mixed
     */
    protected function validateRequest(Request $request, $method, $id = null)
    {
        $validator = Validator::make(
            $request->all(),
            $this->validationRules($method, $id),
            $this->validationMessages($method, $id)
        );

        if ($validator->fails()) {
            $rerrorData = [
                'error'    => true,
                'messages' => $validator->messages()->all(),
            ];

            return response()->json($rerrorData, 422);
        }

        return true;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using Oracle.ManagedDataAccess.Client;
using System.Data;

namespace DjangoSharp {
    /*
     * List of all filter's type
     * A filter type define the condition of a filter.
     *
     */

    public enum FilterOperator {
          between
        , different
        , equal
        , greaterOrEqualThan
        , greaterThan
        , inList
        , like
        , lesserThan
        , lesserOrEqualThan
        , notInList
        , notLike
        , isNull
        , notNull
    }

    public static class FilterType_extension {
        /// <summary>
        ///     Dictionnary of all types by their string representation
        /// </summary>
        private static Dictionary<string, FilterOperator> operatorFromString = new Dictionary<string,FilterOperator>() {
              {"between"           , FilterOperator.between           }
            , {"different"         , FilterOperator.different         }
            , {"equal"             , FilterOperator.equal             }
            , {"greaterThan"       , FilterOperator.greaterThan       }
            , {"greaterOrEqualThan", FilterOperator.greaterOrEqualThan}
            , {"lesserThan"        , FilterOperator.lesserThan        }
            , {"lesserOrEqualThan" , FilterOperator.lesserOrEqualThan }
            , {"like"              , FilterOperator.like              }
            , {"in"                , FilterOperator.inList            }
            , {"notIn"             , FilterOperator.notInList         }
            , {"notLike"           , FilterOperator.notLike           }
            , {"null"              , FilterOperator.isNull            }
            , {"notNull"           , FilterOperator.notNull           }
        };

        /// <summary>
        ///     Dictionnary of string representation of each filter types
        /// </summary>
        private static Dictionary<FilterOperator, string> operatorToString = new Dictionary<FilterOperator, string>() {
              {FilterOperator.between           , "between"           }
            , {FilterOperator.different         , "different"         }
            , {FilterOperator.equal             , "equal"             }
            , {FilterOperator.greaterThan       , "greaterThan"       }
            , {FilterOperator.greaterOrEqualThan, "greaterOrEqualThan"}
            , {FilterOperator.lesserThan        , "lesserThan"        }
            , {FilterOperator.lesserOrEqualThan , "lesserOrEqualThan" }
            , {FilterOperator.like              , "like"              }
            , {FilterOperator.inList            , "in"                }
            , {FilterOperator.notInList         , "notIn"             }
            , {FilterOperator.notLike           , "notLike"           }
            , {FilterOperator.isNull            , "null"              }
            , {FilterOperator.notNull           , "notNull"           }
        };

        /// <summary>
        ///     Return the string representation of a type
        ///     If no type correspond, then return null.
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string ToString(this FilterOperator type) {
            if (!operatorToString.ContainsKey(type))
                return "";

            return operatorToString[type];
        }

        /// <summary>
        ///     Return the operator corresponding to a string.
        ///     If no type correspond, then return null.
        /// </summary>
        /// <param name="operatorName"></param>
        /// <returns></returns>
        public static FilterOperator? ToFilter(this string operatorName) {

            return FilterType_extension.StringToFilter(operatorName);

        }

        public static FilterOperator? StringToFilter(string operatorName) {
            if (!operatorFromString.ContainsKey(operatorName))
                return null;

            return operatorFromString[operatorName];
        }

        /// <summary>
        ///
        ///     Convert the filter operator to a SQL operation.
        ///     The function will also add a new SQL parameter into the parameters list.
        ///     Example :
        ///         FilterOperator.equal.toSQL("id", ["1"], SQLType.NUMBER)
        ///             ==> "id = 1"
        ///
        ///         FilterOperator.in.toSQL("code", ["fr", "en", "us", "ge", "it"], [parameters], "@code")
        ///             ==> "code IN @code"
        ///
        ///         FilterOperator.between.toSQL("value", ["1", "10"], [parameters], "@value")
        ///             ==> "value BETWEEN @value_min AND @value_max"
        ///
        ///         FilterOperator.like.toSQL("label", "%france%", [parameters], @label)
        ///             ==> "label LIKE @label"
        ///
        /// </summary>
        /// <param name="type"></param>
        /// <param name="column"></param>
        /// <param name="dbType"></param>
        /// <param name="values"></param>
        /// <param name="parameters">List of parameters of the SQL query. Used to add the new OracleParameter objects</param>
        /// <param name="parameterName"></param>
        /// <returns></returns>
        public static string toSQL(this FilterOperator type, string column, OracleDbType dbType, string[] values, List<OracleParameter> parameters, string parameterName=null) {

            bool   addParameter;
            bool   first;
            string paramName_max;
            string paramName_min;
            string sql;

            addParameter  = true;
            sql = column;
            parameterName = ":" + (parameterName == null ? 'p' + parameters.Count.ToString() : parameterName);

            switch (type) {

                case FilterOperator.between:

                    paramName_max = parameterName + "_max";
                    paramName_min = parameterName + "_min";

                    sql += " BETWEEN " + parameterName + " AND " + paramName_max;

                    parameters.Add(new OracleParameter ( direction     : ParameterDirection.Input
                                                       , obj           : values[0]
                                                       , parameterName : paramName_min
                                                       , type          : dbType) );

                    parameters.Add(new OracleParameter ( direction     : ParameterDirection.Input
                                                       , obj           : values[1]
                                                       , parameterName : paramName_max
                                                       , type          : dbType) );

                    addParameter = false;
                    break;

                case FilterOperator.different:
                    sql += " <> " + parameterName;
                    break;

                case FilterOperator.equal:
                    sql += " = " + parameterName;
                    break;

                case FilterOperator.greaterOrEqualThan:
                    sql += " >= " + parameterName;
                    break;

                case FilterOperator.greaterThan:
                    sql += " > " + parameterName;
                    break;

                case FilterOperator.inList:
                    sql += " IN (";
                    first = true;

                    for(int v=0; v < values.Length; v++) {

                        sql += (first ? "" : ",") + parameterName + "_" + v.ToString();

                        parameters.Add(new OracleParameter ( direction     : ParameterDirection.Input
                                                           , obj           : values[v]
                                                           , parameterName : parameterName + "_" + v.ToString()
                                                           , type          : dbType) );

                        first = false;
                    }

                    sql += ")";

                    addParameter = false;

                    break;

                case FilterOperator.lesserOrEqualThan:
                    sql += " <= " + parameterName;
                    break;

                case FilterOperator.lesserThan:
                    sql += " < " + parameterName;
                    break;

                case FilterOperator.like:
                    sql += " LIKE " + parameterName;
                    break;

                case FilterOperator.notInList:
                    sql += " NOT IN ";
                    first = true;

                    for(int v=0; v < values.Length; v++) {

                        sql += (first ? "" : ",") + parameterName + "_" + v.ToString();

                        parameters.Add(new OracleParameter ( direction     : ParameterDirection.Input
                                                           , obj           : values[v]
                                                           , parameterName : parameterName + "_" + v.ToString()
                                                           , type          : dbType) );

                        first = false;
                    }

                    sql += ")";

                    addParameter = false;

                    break;

                case FilterOperator.notLike:
                    sql += " NOT LIKE " + parameterName;
                    break;

                case FilterOperator.isNull:
                    sql += " IS NULL ";
                    addParameter = false;
                    break;

                case FilterOperator.notNull:
                    sql += " IS NOT NULL ";
                    addParameter = false;
                    break;
            }

            if (addParameter)
                parameters.Add(new OracleParameter ( direction     : ParameterDirection.Input
                                                   , obj           : values[0]
                                                   , parameterName : parameterName
                                                   , type          : dbType) );

            return sql;
        }

    }

}


text:
Alone ia a clean [Jekyll](http://jekyllrb.com) theme . It's based on [Lanyon](http://lanyon.getpoole.com).

## License

Open sourced under the [MIT license](LICENSE.md).


text:
package it.unisa.dia.gas.plaf.jpbc.pairing.parameters;

import it.unisa.dia.gas.jpbc.PairingParameters;
import it.unisa.dia.gas.plaf.jpbc.util.io.Base64;

import java.io.*;
import java.math.BigInteger;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.StringTokenizer;

/**
 * @author Angelo De Caro (jpbclib@gmail.com)
 */
public class PropertiesParameters implements PairingParameters, Externalizable {

    protected final Map<String, String> parameters;

    public PropertiesParameters() {
        this.parameters = new LinkedHashMap<String, String>();
    }

    public String getType() {
        return parameters.get("type");
    }

    public boolean containsKey(String key) {
        return parameters.containsKey(key);
    }

    public int getInt(String key) {
        String value = parameters.get(key);
        if (value == null)
            throw new IllegalArgumentException("Cannot find value for the following key : " + key);

        return Integer.parseInt(value);
    }

    public int getInt(String key, int defaultValue) {
        String value = parameters.get(key);
        if (value == null)
            return defaultValue;

        return Integer.parseInt(value);
    }

    public long getLong(String key) {
        String value = parameters.get(key);
        if (value == null)
            throw new IllegalArgumentException("Cannot find value for the following key : " + key);

        return Long.parseLong(value);
    }

    public long getLong(String key, long defaultValue) {
        String value = parameters.get(key);
        if (value == null)
            return defaultValue;

        return Long.parseLong(value);
    }

    public BigInteger getBigInteger(String key) {
        String value = parameters.get(key);
        if (value == null)
            throw new IllegalArgumentException("Cannot find value for the following key : " + key);

        return new BigInteger(value);
    }

    public BigInteger getBigIntegerAt(String key, int index) {
        return getBigInteger(key+index);
    }

    public BigInteger getBigInteger(String key, BigInteger defaultValue) {
        String value = parameters.get(key);
        if (value == null)
            return defaultValue;

        return new BigInteger(value);
    }

    public String getString(String key) {
        String value = parameters.get(key);
        if (value == null)
            throw new IllegalArgumentException("Cannot find value for the following key : " + key);

        return value;
    }

    public String getString(String key, String defaultValue) {
        String value = parameters.get(key);
        if (value == null)
            return defaultValue;

        return value;
    }

    public byte[] getBytes(String key) {
        try {
            return Base64.decode(getString(key));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public byte[] getBytes(String key, byte[] defaultValue) {
        String value = parameters.get(key);
        if (value == null)
            return defaultValue;

        try {
            return Base64.decode(value);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public Object getObject(String key) {
        return parameters.get(key);
    }

    public String toString(String separator) {
        StringBuilder buffer = new StringBuilder();

        for (Map.Entry<String, String> entry : parameters.entrySet()) {
            buffer.append(entry.getKey()).append(separator).append(entry.getValue()).append("\n");
        }

        return buffer.toString();
    }

    public void put(String key, String value) {
        parameters.put(key, value);
    }

    public void putBytes(String key, byte[] bytes) {
        parameters.put(key, Base64.encodeBytes(bytes, 0, bytes.length));
    }

    public String remove(String key) {
        return parameters.remove(key);
    }

    public PropertiesParameters load(InputStream inputStream) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
        try {
            while (true) {
                String line = reader.readLine();
                if (line == null)
                    break;
                line = line.trim();
                if (line.length() == 0)
                    continue;
                if (line.startsWith("#"))
                    continue;

                StringTokenizer tokenizer = new StringTokenizer(line, "= :", false);
                String key = tokenizer.nextToken();
                String value = tokenizer.nextToken();

                parameters.put(key, value);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        return this;
    }

    public PropertiesParameters load(String path) {
        InputStream inputStream;

        File file = new File(path);
        if (file.exists()) {
            try {
                inputStream = file.toURI().toURL().openStream();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        } else {
            inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
        }

        if (inputStream == null)
            throw new IllegalArgumentException("No valid resource found!");

        load(inputStream);

        try {
            inputStream.close();
        } catch (IOException e) {
            // Discard
        }

        return this;
    }

    public String toString() {
        return toString(" ");
    }

    public void writeExternal(ObjectOutput out) throws IOException {
        out.writeUTF(toString());
    }

    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        load(new ByteArrayInputStream(in.readUTF().getBytes()));
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PropertiesParameters that = (PropertiesParameters) o;

        if (parameters != null ? !parameters.equals(that.parameters) : that.parameters != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return parameters != null ? parameters.hashCode() : 0;
    }

}


text:
using FCP.Cache.Service.Memory;
using FCP.Cache.Service.Redis;

namespace FCP.Cache.Service.Test
{
    internal class CacheServiceTestHelper
    {
        internal const string RedisConfiguration = "localhost,allowAdmin=true";

        internal const string RedisMasterName = "redismaster1";

        internal static string[] RedisSentinelHosts = new[]
        {
            "127.0.0.1",
            "127.0.0.1:32001",
            "127.0.0.1:32002"
        };

        internal static ICacheService GetMemoryCacheService()
        {
            return new CacheServiceBuilder()
                .AddMemoryCache()
                .Build();
        }

        internal static ICacheService GetCacheService()
        {
            return new CacheServiceBuilder()
                .AddMemoryCache()
                .AddRedisCache(RedisConfiguration)
                .UseJsonSerializer()
                .Build();
        }

        internal static ICacheService GetCacheService(string memoryName)
        {
            return new CacheServiceBuilder()
                .AddMemoryCache(memoryName)
                .AddRedisCache(RedisConfiguration)
                .UseJsonSerializer()
                .Build();
        }

        internal static ICacheService GetCacheServiceBySentinel()
        {
            return new CacheServiceBuilder()
                .AddMemoryCache()
                .AddRedisCacheBySentinel(RedisMasterName, RedisSentinelHosts)
                .UseJsonSerializer()
                .Build();
        }
    }
}


text:
import webpack from 'webpack';
import { ForkTsCheckerWebpackPluginConfiguration } from '../ForkTsCheckerWebpackPluginConfiguration';
import { ForkTsCheckerWebpackPluginState } from '../ForkTsCheckerWebpackPluginState';
declare function interceptDoneToGetWebpackDevServerTap(compiler: webpack.Compiler, configuration: ForkTsCheckerWebpackPluginConfiguration, state: ForkTsCheckerWebpackPluginState): void;
export { interceptDoneToGetWebpackDevServerTap };


text:
package com.enginemobi.common.time.domain;

import java.lang.annotation.*;

@Target(value={ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface AutoPopulate {
    boolean autoUpdateValue() default false;
}


text:
package com.google.android.material.internal;

import android.os.Parcel;
import android.os.Parcelable;

public class ParcelableTestUtils {

  private ParcelableTestUtils() {}

  public static <T> T parcelAndCreate(Parcelable parcelable, Parcelable.Creator<T> creator) {
    Parcel parcel = Parcel.obtain();
    parcelable.writeToParcel(parcel, /* flags= */ 0);
    parcel.setDataPosition(0);
    return creator.createFromParcel(parcel);
  }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<appender name="DefaultAppender"
		class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>${user.home}/logs/rocketmqlogs/broker_default.log</file>
		<append>true</append>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/bk_default-%d{yyyy-MM-dd}.%i.log
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy
				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<maxFileSize>104857600</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<MaxHistory>10</MaxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern>
			<charset class="java.nio.charset.Charset">UTF-8</charset>
		</encoder>
	</appender>

	<appender name="RocketmqBrokerAppender"
		class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>${user.home}/logs/rocketmqlogs/broker.log</file>
		<append>true</append>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/broker-%d{yyyy-MM-dd}.%i.log
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy
				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<maxFileSize>104857600</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<MaxHistory>10</MaxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %class %L %t - %m%n</pattern>
			<charset class="java.nio.charset.Charset">UTF-8</charset>
		</encoder>
	</appender>

	<appender name="RocketmqTransactionAppender"
		class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>${user.home}/logs/rocketmqlogs/transaction.log</file>
		<append>true</append>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/transaction-%d{yyyy-MM-dd}.%i.log
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy
				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<maxFileSize>104857600</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<MaxHistory>10</MaxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern>
			<charset class="java.nio.charset.Charset">UTF-8</charset>
		</encoder>
	</appender>

	<appender name="RocketmqRebalanceLockAppender"
		class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>${user.home}/logs/rocketmqlogs/lock.log</file>
		<append>true</append>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/lock-%d{yyyy-MM-dd}.%i.log
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy
				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<maxFileSize>104857600</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<MaxHistory>10</MaxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern>
			<charset class="java.nio.charset.Charset">UTF-8</charset>
		</encoder>
	</appender>

	<appender name="RocketmqPutStatsMoniterAppender"
		class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>${user.home}/logs/rocketmqlogs/put.log</file>
		<append>true</append>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/put-%d{yyyy-MM-dd}.%i.log
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy
				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<maxFileSize>104857600</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<MaxHistory>10</MaxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern>
			<charset class="java.nio.charset.Charset">UTF-8</charset>
		</encoder>
	</appender>

	<appender name="RocketmqGetStatsMoniterAppender"
		class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>${user.home}/logs/rocketmqlogs/get.log</file>
		<append>true</append>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/get-%d{yyyy-MM-dd}.%i.log
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy
				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<maxFileSize>104857600</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<MaxHistory>10</MaxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern>
			<charset class="java.nio.charset.Charset">UTF-8</charset>
		</encoder>
	</appender>

	<appender name="RocketmqStoreStatsMoniterAppender"
		class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>${user.home}/logs/rocketmqlogs/store.log</file>
		<append>true</append>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/store-%d{yyyy-MM-dd}.%i.log
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy
				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<maxFileSize>104857600</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<MaxHistory>10</MaxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern>
			<charset class="java.nio.charset.Charset">UTF-8</charset>
		</encoder>
	</appender>

	<appender name="RocketmqPullmsgLiveMoniterAppender"
		class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>${user.home}/logs/rocketmqlogs/pullmsgLive.log</file>
		<append>true</append>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/pullmsgLive-%d{yyyy-MM-dd}.%i.log
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy
				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<maxFileSize>104857600</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<MaxHistory>10</MaxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern>
			<charset class="java.nio.charset.Charset">UTF-8</charset>
		</encoder>
	</appender>
	<appender name="RocketmqSendmsgLiveMoniterAppender"
		class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>${user.home}/logs/rocketmqlogs/putmsgLive.log</file>
		<append>true</append>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/putmsgLive-%d{yyyy-MM-dd}.%i.log
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy
				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<maxFileSize>104857600</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<MaxHistory>10</MaxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern>
			<charset class="java.nio.charset.Charset">UTF-8</charset>
		</encoder>
	</appender>
	<appender name="RocketmqSendbackmsgLiveMoniterAppender"
		class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>${user.home}/logs/rocketmqlogs/sendbackmsgLive.log</file>
		<append>true</append>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/sendbackmsgLive-%d{yyyy-MM-dd}.%i.log
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy
				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<maxFileSize>104857600</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<MaxHistory>10</MaxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern>
			<charset class="java.nio.charset.Charset">UTF-8</charset>
		</encoder>
	</appender>
	<appender name="UpdateCommitOffsetMoniterAppender"
		class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>${user.home}/logs/rocketmqlogs/updateCommitOffset.log</file>
		<append>true</append>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/updateCommitOffset-%d{yyyy-MM-dd}.%i.log
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy
				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<maxFileSize>104857600</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<MaxHistory>10</MaxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern>
			<charset class="java.nio.charset.Charset">UTF-8</charset>
		</encoder>
	</appender>

	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
		<append>true</append>
		<encoder>
			<pattern>%d{yyy-MM-dd HH\:mm\:ss,GMT+8} %p %t - %m%n</pattern>
			<charset class="java.nio.charset.Charset">UTF-8</charset>
		</encoder>
	</appender>

	<logger name="RocketmqBroker" additivity="false">
		<level value="ALL" />
		<appender-ref ref="RocketmqBrokerAppender" />
	</logger>

	<logger name="RocketmqCommon" additivity="false">
		<level value="ALL" />
		<appender-ref ref="RocketmqBrokerAppender" />
	</logger>

	<logger name="RocketmqStore" additivity="false">
		<level value="ALL" />
		<appender-ref ref="RocketmqBrokerAppender" />
	</logger>

	<logger name="RocketmqTransaction" additivity="false">
		<level value="ALL" />
		<appender-ref ref="RocketmqTransactionAppender" />
	</logger>

	<logger name="RocketmqRebalanceLock" additivity="false">
		<level value="ALL" />
		<appender-ref ref="RocketmqRebalanceLockAppender" />
	</logger>

	<logger name="RocketmqRemoting" additivity="false">
		<level value="ALL" />
		<appender-ref ref="RocketmqBrokerAppender" />
	</logger>

	<logger name="PutStatsMoniter" additivity="false">
		<level value="ALL" />
		<appender-ref ref="RocketmqPutStatsMoniterAppender" />
	</logger>

	<logger name="GetStatsMoniter" additivity="false">
		<level value="ALL" />
		<appender-ref ref="RocketmqGetStatsMoniterAppender" />
	</logger>

	<logger name="StoreStatsMoniter" additivity="false">
		<level value="ALL" />
		<appender-ref ref="RocketmqStoreStatsMoniterAppender" />
	</logger>

	<logger name="PullmsgLiveMoniter" additivity="false">
		<level value="ALL" />
		<appender-ref ref="RocketmqPullmsgLiveMoniterAppender" />
	</logger>

	<logger name="SendbackmsgLiveMoniter" additivity="false">
		<level value="ALL" />
		<appender-ref ref="RocketmqSendbackmsgLiveMoniterAppender" />
	</logger>

	<logger name="SendmsgLiveMoniter" additivity="false">
		<level value="ALL" />
		<appender-ref ref="RocketmqSendmsgLiveMoniterAppender" />
	</logger>
	<logger name="UpdateCommitOffsetMoniter" additivity="false">
		<level value="ALL" />
		<appender-ref ref="UpdateCommitOffsetMoniterAppender" />
	</logger>

	<root>
		<level value="ALL" />
		<appender-ref ref="DefaultAppender" />
	</root>
</configuration>


text:
package org.apache.felix.webconsole.internal.core;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

import org.apache.felix.webconsole.SimpleWebConsolePlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.framework.FrameworkEvent;
import org.osgi.framework.FrameworkListener;
import org.osgi.framework.wiring.FrameworkWiring;
import org.osgi.service.log.LogService;
import org.osgi.service.startlevel.StartLevel;

abstract class BaseUpdateInstallHelper implements Runnable
{

    private final SimpleWebConsolePlugin plugin;

    private final File bundleFile;

    private final boolean refreshPackages;

    private Thread updateThread;

    BaseUpdateInstallHelper( SimpleWebConsolePlugin plugin, String name, File bundleFile, boolean refreshPackages )
    {
        this.plugin = plugin;
        this.bundleFile = bundleFile;
        this.refreshPackages = refreshPackages;
        this.updateThread = new Thread( this, name );
        this.updateThread.setDaemon( true );
    }

    protected File getBundleFile()
    {
        return bundleFile;
    }

    protected abstract Bundle doRun( InputStream bundleStream ) throws BundleException;

    protected final Object getService( String serviceName )
    {
        return plugin.getService( serviceName );
    }

    protected final SimpleWebConsolePlugin getLog()
    {
        return plugin;
    }

    protected Bundle getTargetBundle()
    {
        return null;
    }

    /**
     * @return the installed bundle or null if no bundle was touched
     * @throws BundleException
     * @throws IOException
     */
    protected Bundle doRun() throws Exception
    {
        // now deploy the resolved bundles
        try( final InputStream bundleStream = new FileInputStream( bundleFile )) {
            return doRun( bundleStream );
        }
    }

    final void start()
    {
        if ( updateThread != null )
        {
            updateThread.start();
        }
    }

    @Override
    public final void run()
    {
        // now deploy the resolved bundles
        try
        {
            // we need the framework wiring before we call the bundle
            // installation or update, since we might be updating
            // our selves in which case the bundle context will be
            // invalid by the time we want to call the update
            final FrameworkWiring fw = refreshPackages ? plugin.getBundle().getBundleContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkWiring.class) : null;

            // same for the startlevel
            StartLevel startLevel = null;

            Bundle bundle = getTargetBundle();

            int state = fw != null && bundle != null ? bundle.getState() : 0;
            int startFlags = 0;

            // If the bundle has been started we want to stop it first, then update it, refresh it, and restart it
            // because otherwise, it will be stopped and started twice (once by the update and once by the refresh)
            if ((state & (Bundle.ACTIVE | Bundle.STARTING)) != 0)
            {
                // we need the StartLevel service  before we stop the bundle
                // before the update, since we might be stopping
                // our selves in which case the bundle context will be
                // invalid by the time we want to call the startlevel
                startLevel = (StartLevel) getService(StartLevel.class.getName());

                // We want to start the bundle afterwards without affecting the persistent state of the bundle
                // However, we can only use the transient options if the framework startlevel is not less than the
                // bundle startlevel (in case that there is no starlevel service we assume we are good).
                if (startLevel == null || startLevel.getStartLevel() >= startLevel.getBundleStartLevel(bundle))
                {
                    startFlags |= Bundle.START_TRANSIENT;
                }

                // If the bundle is in the starting state it might be lazy and not started yet - hence, start it
                // according to its policy.
                if (state == Bundle.STARTING)
                {
                    startFlags |= Bundle.START_ACTIVATION_POLICY;
                }

                // We stop the bundle transiently - assuming we can also start it transiently later (see above) in which
                // case we didn't mess with its persistent state at all.
                bundle.stop(Bundle.STOP_TRANSIENT);
            }

            // We want to catch an exception during update to be able to restart the bundle if we stopped it previously
            Exception rethrow = null;
            try
            {
                // perform the action!
                bundle = doRun();

                if ( bundle != null )
                {
                    // refresh packages and give it at most 5 seconds to finish
                    refreshPackages(fw, plugin.getBundle().getBundleContext(), 5000L, bundle );
                }
            }
            catch (Exception ex)
            {
                rethrow = ex;
                throw ex;
            }
            finally
            {
                // If we stopped the bundle lets try to restart it (we created the correct flags above already).
                if ((state & (Bundle.ACTIVE | Bundle.STARTING)) != 0)
                {
                    try
                    {
                        bundle.start(startFlags);
                    }
                    catch (Exception ex)
                    {
                        if (rethrow == null)
                        {
                            throw ex;
                        }
                        else
                        {
                            try
                            {
                                getLog().log( LogService.LOG_ERROR, "Cannot restart bundle: " + bundle + " after exception during update!", ex);
                            }
                            catch ( Exception secondary )
                            {
                                // at the time this exception happens the log used might have
                                // been destroyed and is not available to use any longer. So
                                // we only can write to stderr at this time to at least get
                                // some message out ...
                                System.err.println( "Cannot restart bundle: " + bundle + " after exception during update!");
                                ex.printStackTrace( System.err );
                            }
                        }
                    }
                }
            }
        }
        catch ( Exception e )
        {
            try
            {
                getLog().log( LogService.LOG_ERROR, "Cannot install or update bundle from " + bundleFile, e );
            }
            catch ( Exception secondary )
            {
                // at the time this exception happens the log used might have
                // been destroyed and is not available to use any longer. So
                // we only can write to stderr at this time to at least get
                // some message out ...
                System.err.println( "Cannot install or update bundle from " + bundleFile );
                e.printStackTrace( System.err );
            }
        }
        finally
        {
            if ( bundleFile != null )
            {
                bundleFile.delete();
            }

            // release update thread for GC
            updateThread = null;
        }
    }

    /**
     * This is an utility method that issues refresh package instruction to the framework.
     *
     * @param fw framework wiring (might be null)
     * @param bundleContext of the caller. This is needed to add a framework listener.
     * @param maxWait the maximum time to wait for the packages to be refreshed
     * @param bundle the bundle, which packages to refresh or null to refresh all packages.
     * @return true if refresh is succesfull within the given time frame
     */
    static boolean refreshPackages(final FrameworkWiring fw,
        final BundleContext bundleContext,
        final long maxWait,
        final Bundle bundle)
    {
        return new RefreshPackageTask().refreshPackages(fw, bundleContext, maxWait, bundle );
    }

    static class RefreshPackageTask implements FrameworkListener
    {

        private volatile boolean refreshed = false;
        private final Object lock = new Object();

        private Bundle searchHost(final BundleContext bundleContext, final Bundle bundle) {
            final String host = bundle.getHeaders().get( Constants.FRAGMENT_HOST );
            if ( host != null && host.indexOf(Constants.EXTENSION_DIRECTIVE) == -1 ) {
                for(final Bundle i : BundleContextUtil.getWorkingBundleContext(bundleContext).getBundles()) {
                    if ( host.equals(i.getSymbolicName()) ) {
                        return i;
                    }
                }
            }
            return null;
        }

        boolean refreshPackages(final FrameworkWiring fw,
                  final BundleContext bundleContext,
                  final long maxWait,
                  Bundle bundle )
        {
            List<Bundle> refreshFragments = null;
            if (null == bundleContext || fw == null )
            {
                return false;
            }

            if (null == bundle)
            {
                // search fragment hosts
                refreshFragments = new ArrayList<>();
                for(final Bundle i : BundleContextUtil.getWorkingBundleContext(bundleContext).getBundles()) {
                    if ( i.getState() != Bundle.RESOLVED ) {
                        final Bundle hostBundle = searchHost(bundleContext, i);
                        if ( hostBundle != null ) {
                            refreshFragments.add(hostBundle);
                        }
                    }
                }
                if ( refreshFragments.isEmpty() ) {
                    refreshFragments = null;
                }
                fw.refreshBundles(null, this);
            }
            else
            {
                // For a fragment, refresh the host instead
                final Bundle hostBundle = searchHost(bundleContext, bundle);
                if ( hostBundle != null ) {
                    bundle = hostBundle;
                }

                fw.refreshBundles(Collections.singleton(bundle), this);
            }

            waitForRefresh(maxWait);

            if ( refreshFragments != null ) {
                // check for uninstalled
                final Iterator<Bundle> iter = refreshFragments.iterator();
                while ( iter.hasNext() ) {
                    if ( iter.next().getState() == Bundle.UNINSTALLED ) {
                        iter.remove();
                    }
                }
                if ( !refreshFragments.isEmpty() ) {
                    refreshed = false;
                    fw.refreshBundles(refreshFragments, this);
                    waitForRefresh(maxWait);
                }
            }
            return refreshed;
        }

        private void waitForRefresh(long maxWait) {
            try
            {
                // check for spurious wait
                long start = System.currentTimeMillis();
                long delay = maxWait;
                while (!refreshed && delay > 0)
                {
                    synchronized (lock)
                    {
                        if ( !refreshed )
                        {
                            lock.wait(delay);
                            // remove the time we already waited for
                            delay = maxWait - (System.currentTimeMillis() - start);
                        }
                    }
                }
            }
            catch (final InterruptedException e)
            {
                // just return if the thread is interrupted
                Thread.currentThread().interrupt();
            }
        }

        @Override
        public void frameworkEvent(final FrameworkEvent e)
        {
            if (e.getType() == FrameworkEvent.PACKAGES_REFRESHED)
            {
                synchronized (lock)
                {
                    refreshed = true;
                    lock.notifyAll();
                }
            }

        }
    }
}


text:
package org.apache.druid.query.topn;

import org.apache.druid.segment.DimensionHandlerUtils;
import org.apache.druid.segment.column.ValueType;

import java.util.Map;

/**
 */
public class DimValHolder
{
  private final Object topNMetricVal;
  private final Comparable dimValue;
  private final Object dimValIndex;
  private final Map<String, Object> metricValues;

  public DimValHolder(
      Object topNMetricVal,
      Comparable dimValue,
      Object dimValIndex,
      Map<String, Object> metricValues
  )
  {
    this.topNMetricVal = topNMetricVal;
    this.dimValue = dimValue;
    this.dimValIndex = dimValIndex;
    this.metricValues = metricValues;
  }

  public Object getTopNMetricVal()
  {
    return topNMetricVal;
  }

  public Comparable getDimValue()
  {
    return dimValue;
  }

  public Object getDimValIndex()
  {
    return dimValIndex;
  }

  public Map<String, Object> getMetricValues()
  {
    return metricValues;
  }

  public static class Builder
  {
    private Object topNMetricVal;
    private Comparable dimValue;
    private Object dimValIndex;
    private Map<String, Object> metricValues;

    public Builder()
    {
      topNMetricVal = null;
      dimValue = null;
      dimValIndex = null;
      metricValues = null;
    }

    public Builder withTopNMetricVal(Object topNMetricVal)
    {
      this.topNMetricVal = topNMetricVal;
      return this;
    }

    /**
     * This method is called by {@link TopNResultBuilder#addEntry} to store query results.
     *
     * The method accepts a type argument because Jackson will deserialize numbers as integers instead of longs
     * if they are small enough. Similarly, type mismatch can arise when using floats when Jackson deserializes
     * numbers as doubles instead.
     *
     * This method will ensure that any added dimension value is converted to the expected
     * type.
     *
     * @param dimValue Dimension value from TopNResultBuilder
     * @param type     Type that dimValue should have, according to the output type of the
     *                 {@link org.apache.druid.query.dimension.DimensionSpec} associated with dimValue from the
     *                 calling TopNResultBuilder
     */
    public Builder withDimValue(Comparable dimValue, ValueType type)
    {
      this.dimValue = DimensionHandlerUtils.convertObjectToType(dimValue, type);
      return this;
    }

    public Builder withDimValIndex(Object dimValIndex)
    {
      this.dimValIndex = dimValIndex;
      return this;
    }

    public Builder withMetricValues(Map<String, Object> metricValues)
    {
      this.metricValues = metricValues;
      return this;
    }

    public DimValHolder build()
    {
      return new DimValHolder(topNMetricVal, dimValue, dimValIndex, metricValues);
    }
  }
}


text:
package com.genentech.chemistry.tool.sdfMultiplexer;

import java.io.*;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.concurrent.BlockingQueue;

public class Worker extends Thread
{
   private static final Charset CHARSet = Charset.forName("US-ASCII");
   private final SDFMultiplexer master;
   final BlockingQueue<String> outQue;
   private final BlockingQueue<String> inQue;
   final int workerNum;
   private final String errFilePrefix;
   private final String[] shell;
   private final String cmdLine;
   private final boolean stopOnError;

   final boolean groupByTitle;
   final boolean groupByAtomCount;
   private long nBatch;
   private int nCrashRecover;

   /**
    * @param master sdfMultiplexer driving this worker.
    * @param workerNum index of this worked in master.
    * @param shell shell to execute command line eg. "" or "ssh hostname"
    * @param cmdLine commandLine to execute $procNum $currentDir will be replaced.
    * @param groupByTitle
    * @param errFilePrefix if not "" write err output to file with this prefix.
    * @param nBatch restart cmdLine after nBatch molecules are completed.
    * @param nCrashRecover maximum number of times to recover from a crash.
    */
   public Worker(SDFMultiplexer master, int workerNum, String shell, String cmdLine,
                 boolean groupByTitle, boolean groupByAtomCount, boolean stopOnError,
                 String errFilePrefix, long nBatch, int nCrashRecover)
   {  this.master = master;
      this.inQue = master.getInQueue();
      this.outQue = master.getOutQueue();
      this.workerNum = workerNum;
      this.nBatch = nBatch;
      this.nCrashRecover = nCrashRecover;
      this.errFilePrefix = errFilePrefix;
      this.groupByTitle = groupByTitle;
      this.groupByAtomCount = groupByAtomCount;
      this.stopOnError = stopOnError;
      this.shell = shell.split("\\s");

      cmdLine = cmdLine.replace("$procNum", Integer.toString(workerNum));
      cmdLine = cmdLine.replace("$currentDir", System.getProperty("user.dir"));
      this.cmdLine = cmdLine;
   }

   /**
    * @param cmdLine
    * @param shell
    * @param workerNum
    * @param batchCount
    * @return
    */
   private String[] compileCommandLine(int workerNum, int batchCount)
   {  String cmdLn = cmdLine.replace("$batchNum", Integer.toString(batchCount));

      String[] cmd = Arrays.copyOf(shell, shell.length+1);
      cmd[cmd.length-1] = cmdLn;
      return cmd;
   }

   @Override
   public void run()
   {  int batchCount = -1;
      boolean completed = false;
      while( !completed && nCrashRecover-- != 0)
      {  batchCount++;
         String[] cmdAndArgs = compileCommandLine(workerNum, batchCount);
         Process process;
         ProgramErrorReaderThread errReaderThread;
         OutputReaderThread outputReaderThread;
         try
         {  StringBuilder sb = new StringBuilder();
            sb.append("starting ").append(workerNum).append(':');
            for(String s: cmdAndArgs) sb.append(" " + s);
            System.err.println(sb.toString());

            process = Runtime.getRuntime().exec(cmdAndArgs);
         } catch (IOException e1)
         {  StringBuilder sb = new StringBuilder();
            for(String s: cmdAndArgs) sb.append(s).append(' ');

            throw new Error(String.format("Error (%s, args) executing commandLine:\n%s\n",
                e1.getMessage(), sb.toString()));
         }

         errReaderThread = new ProgramErrorReaderThread( errFilePrefix, process.getErrorStream() );
         errReaderThread.start();

         outputReaderThread = new OutputReaderThread( process.getInputStream());
         outputReaderThread.start();
         OutputStream procInput = process.getOutputStream();
         String mol = null;
         try
         {  long nBatchLeft = nBatch;

            while( ! completed )
            {  if((mol = inQue.take()) == SDFMultiplexer.ENDOfQueue )
               {  completed = true;
                  break;
               }

               procInput.write(mol.getBytes(CHARSet));

               if( --nBatchLeft == 0)
               {  nCrashRecover++;  // this is not a crash, compensate for decrement
                  nBatchLeft = nBatch;
                  break;
               }
            }

         }catch( IOException e )
         {  // crash
            System.err.printf("W%d: Error (%s) writing mol:%s\n"
                             +"Resubmitting, but some molcules might be missing\n",
                             workerNum, e.getMessage(), mol);
            try
            {  inQue.put(mol);  //requeue failed molecule
            } catch (InterruptedException e1)
            {  System.err.printf("W%d: unexpected interrupt (%s) requeueing mol\n",
                              workerNum, e1.getMessage());
            }

            master.incrementCrashCount();

         } catch (InterruptedException e)
         {  System.err.printf("W%d: unexpected interrupt (%s) queueing mol:%s\n",
                              workerNum, e.getMessage(), mol);

         }finally
         {  try
            {  procInput.close();
            } catch (IOException e)
            {  System.err.printf("W%d: error closing stream to process: %s\n",
                                 workerNum, e.getMessage());
            }

            int exCode = -1;
            try
            {  exCode= process.waitFor();
            } catch (InterruptedException e)
            {  System.err.printf("W%d: unexpected interrupt waiting for process exit: %s\n",
                                 workerNum, e.getMessage());
            }

            try
            {  outputReaderThread.join();
               errReaderThread.join();
            } catch (InterruptedException e)
            {  System.err.printf("W%d: unexpected interrupt waiting for EOF from process: %s\n",
                                 workerNum, e.getMessage());
            }

            System.err.printf("W%d: Shutdown exitCode=%d\n", workerNum, exCode);
            if( exCode != 0 && stopOnError ) nCrashRecover = 0;
         }
      }
      System.err.printf("W%d: finished\n", workerNum);
   }

   public int getWorkerNum()
   {  return workerNum;
   }

   class OutputReaderThread extends Thread
   {  private final BufferedReader reader;

      OutputReaderThread(InputStream outStrm)
      {  reader = new BufferedReader( new InputStreamReader( outStrm ) );
      }

      @Override
      public void run()
      {  String line;
         StringBuilder sb = new StringBuilder(4000);

         try
         {  int lineNum=0;
            String title = "";
            String lastTitle = "";
            String atBonds = "";
            String lastAtBonds = "";
            int lastRecordStart = 0;

            while ( (line = reader.readLine()) != null )
            {  lineNum++;

               if( lineNum == 1 )
               {  lastRecordStart = sb.length();
                  title = line;
               }

               if(groupByAtomCount && lineNum == 4)
                  atBonds = line.substring(0,Math.min(6, line.length()));

               sb.append(line).append('\n');
               if( line.equals("$$$$") )
               {
                  if( groupByTitle )
                  {  if( ! lastTitle.equals(title) )
                     {  // output all but last record
                        if( lastRecordStart > 0 )
                        {  outQue.put(sb.substring(0, lastRecordStart));
                           String lastRecord = sb.substring(lastRecordStart);
                           sb.setLength(0);
                           sb.append(lastRecord);
                        }

                        lastTitle = title;
                        lastAtBonds = atBonds;
                     }

                  } else if( groupByAtomCount )
                  {  if( ! lastAtBonds.equals(atBonds) )
                     {  // output all but last record
                        if( lastRecordStart > 0 )
                        {  outQue.put(sb.substring(0, lastRecordStart));
                           String lastRecord = sb.substring(lastRecordStart);
                           sb.setLength(0);
                           sb.append(lastRecord);
                        }

                        lastTitle = title;
                        lastAtBonds = atBonds;
                     }

                  }else // not groupByTitle not groupByAtomCount
                  {  outQue.put(sb.toString());
                     sb.setLength(0);
                  }

                  lineNum = 0;
               }
            }
            if( ( groupByTitle || groupByAtomCount )
                && sb.length() != 0 && lineNum == 0 )
            {  outQue.put(sb.toString());  // put last group to queue

            }else if( lineNum != 0  )
            {  System.err.printf("W%d: Incomplete molfile at end of output:%s\n",
                                 workerNum, sb.toString());
            }

            reader.close();

         } catch (IOException e)
         {  System.err.printf("w%D: Error reading from output: %s\n", workerNum, e.getMessage());

         } catch (InterruptedException e)
         {  System.err.printf("W%d: unexpected interrupt (%s) while queueing mol:%s\n",
                              workerNum, e.getMessage(), sb.toString());
         }
      }
   }

   class ProgramErrorReaderThread extends Thread
   {  private final BufferedReader reader;
      private final PrintStream err;

      ProgramErrorReaderThread(String errFilePrefix, InputStream errStrm)
      {  reader = new BufferedReader( new InputStreamReader( errStrm ) );

         if( errFilePrefix.length() > 0 )
         {  try
            {  err = new PrintStream(new FileOutputStream(errFilePrefix + '.' + workerNum + ".err.log", true));
            } catch (FileNotFoundException e)
            {  throw new Error("Coold not open erro stream: " + e.getMessage(), e);
            }
         }
         else
         {  err = System.err;
         }
      }

      @Override
      public void run()
      {  String line;
         try
         {  while ( (line = reader.readLine()) != null )
            {  err.println( line );
            }
            reader.close();

         } catch (IOException e)
         {  System.err.printf("W%d: Error reading from STDErr: ", workerNum, e.getMessage());
         }

      }
   }
}


text:
//
//  Generated by the J2ObjC translator.  DO NOT EDIT!
//  source: android/libcore/luni/src/main/java/javax/net/ServerSocketFactory.java
//

#include "../../J2ObjC_header.h"

#pragma push_macro("INCLUDE_ALL_JavaxNetServerSocketFactory")
#ifdef RESTRICT_JavaxNetServerSocketFactory
#define INCLUDE_ALL_JavaxNetServerSocketFactory 0
#else
#define INCLUDE_ALL_JavaxNetServerSocketFactory 1
#endif
#undef RESTRICT_JavaxNetServerSocketFactory

#pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

#if !defined (JavaxNetServerSocketFactory_) && (INCLUDE_ALL_JavaxNetServerSocketFactory || defined(INCLUDE_JavaxNetServerSocketFactory))
#define JavaxNetServerSocketFactory_

@class JavaNetInetAddress;
@class JavaNetServerSocket;

/*!
 @brief This abstract class defines methods to create server sockets.
 It can be
 subclassed to create specific server socket types.
 */
@interface JavaxNetServerSocketFactory : NSObject

#pragma mark Public

/*!
 @brief Creates a new server socket which is not bound to any local address.
 This
 method has to be overridden by a subclass otherwise a SocketException
  is thrown.
 @return the created unbound server socket.
 @throws IOException
 if an error occurs while creating a new server socket.
 */
- (JavaNetServerSocket *)createServerSocket;

/*!
 @brief Creates a new server socket which is bound to the given port with a
 maximum backlog of 50 unaccepted connections.
 @param port the port on which the created socket has to listen.
 @return the created bound server socket.
 @throws IOException
 if an error occurs while creating a new server socket.
 */
- (JavaNetServerSocket *)createServerSocketWithInt:(jint)port;

/*!
 @brief Creates a new server socket which is bound to the given port and
 configures its maximum of queued connections.
 @param port the port on which the created socket has to listen.
 @param backlog the maximum number of unaccepted connections. Passing 0 or
 a negative value yields the default backlog of 50.
 @return the created bound server socket.
 @throws IOException if an error occurs while creating a new server socket.
 */
- (JavaNetServerSocket *)createServerSocketWithInt:(jint)port
                                           withInt:(jint)backlog;

/*!
 @brief Creates a new server socket which is bound to the given address on the
 specified port and configures its maximum of queued connections.
 @param port the port on which the created socket has to listen.
 @param backlog the maximum number of unaccepted connections. Passing 0 or
 a negative value yields the default backlog of 50.
 @param iAddress the address of the network interface which is used by the
 created socket.
 @return the created bound server socket.
 @throws IOException if an error occurs while creating a new server socket.
 */
- (JavaNetServerSocket *)createServerSocketWithInt:(jint)port
                                           withInt:(jint)backlog
                            withJavaNetInetAddress:(JavaNetInetAddress *)iAddress;

/*!
 @brief Gets the default server socket factory of the system which can be used to
 create new server sockets without creating a subclass of this factory.
 @return the system default server socket factory.
 */
+ (JavaxNetServerSocketFactory *)getDefault;

#pragma mark Protected

/*!
 @brief Creates a new ServerSocketFactory instance.
 */
- (instancetype)init;

@end

J2OBJC_EMPTY_STATIC_INIT(JavaxNetServerSocketFactory)

FOUNDATION_EXPORT JavaxNetServerSocketFactory *JavaxNetServerSocketFactory_getDefault();

FOUNDATION_EXPORT void JavaxNetServerSocketFactory_init(JavaxNetServerSocketFactory *self);

J2OBJC_TYPE_LITERAL_HEADER(JavaxNetServerSocketFactory)

#endif

#pragma clang diagnostic pop
#pragma pop_macro("INCLUDE_ALL_JavaxNetServerSocketFactory")


text:
package ru.adios.budgeter;

import android.content.Context;
import android.support.annotation.UiThread;

import org.joda.money.CurrencyUnit;
import org.joda.money.Money;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

import javax.annotation.concurrent.ThreadSafe;

import java8.util.function.Consumer;
import java8.util.stream.Collectors;
import ru.adios.budgeter.api.Units;
import ru.adios.budgeter.core.CoreUtils;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Designed for UI thread.
 *
 * Created by Michail Kulikov
 * 10/14/15
 */
@UiThread
@ThreadSafe
public final class BalancesUiThreadState {

    private static final ArrayList<Money> innerBalances = new ArrayList<>(10);
    public static Money innerTotalBalance = Money.zero(Units.RUB);
    private static CurrencyUnit totalUnit = Units.RUB;
    private static boolean initialized = false;

    public static final class Pair {
        public final ArrayList<Money> balances;
        public final Money totalBalance;

        public Pair(ArrayList<Money> balances, Money totalBalance) {
            this.balances = balances;
            this.totalBalance = totalBalance;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            final Pair pair = (Pair) o;
            return balances.equals(pair.balances)
                    && totalBalance.equals(pair.totalBalance);
        }

        @Override
        public int hashCode() {
            return 31 * balances.hashCode() + totalBalance.hashCode();
        }
    }

    private static final Logger logger = LoggerFactory.getLogger(BalancesUiThreadState.class);
    private static final HashSet<Consumer<Pair>> listenersSet = new HashSet<>();

    public static Pair getSnapshot() {
        return new Pair(innerBalances, innerTotalBalance);
    }

    public static void registerListener(Consumer<Pair> listener) {
        listenersSet.add(listener);
    }

    public static void removeListener(Consumer<Pair> listener) {
        listenersSet.remove(listener);
    }

    public static void setTotalUnit(CurrencyUnit unit) {
        checkNotNull(unit, "unit is null");
        totalUnit = unit;
    }

    public static void addMoney(final Money money, final Context context) {
        if (!initialized) {
            instantiate(context);
        }

        boolean intact = true;
        for (int i = 0; i < innerBalances.size(); i++) {
            final Money bal = innerBalances.get(i);
            if (bal.getCurrencyUnit().equals(money.getCurrencyUnit())) {
                innerBalances.remove(i);
                innerBalances.add(i, money.plus(bal));
                intact = false;
                break;
            }
        }
        if (intact) {
            innerBalances.add(money);
        }

        innerTotalBalance = CoreUtils.addToTotalBalance(innerTotalBalance, money, context, true);

        notifyListeners();
    }

    public static void instantiate(Context application) {
        initialized = false;
        try {
            final BalanceElementCore balanceElement =
                    new BalanceElementCore(BundleProvider.getBundle().treasury(), Constants.CURRENCIES_EXCHANGE_SERVICE);
            balanceElement.setTotalUnit(totalUnit);

            final List<Money> collect = balanceElement.streamIndividualBalances().collect(Collectors.<Money>toList());
            final ArrayList<Money> balances = collect instanceof ArrayList
                    ? (ArrayList<Money>) collect
                    : new ArrayList<>(collect);

            innerBalances.clear();
            innerBalances.addAll(balances);
            innerTotalBalance = CoreUtils.getTotalBalance(balanceElement, application, logger);

            initialized = true;

            notifyListeners();
        } catch (RuntimeException ex) {
            logger.warn("Exception while instantiating balances state", ex);
            innerBalances.clear();
            innerTotalBalance = Money.zero(totalUnit);
        }
    }

    private static void notifyListeners() {
        final Pair pair = new Pair(innerBalances, innerTotalBalance);
        for (final Consumer<Pair> listener : listenersSet) {
            listener.accept(pair);
        }
    }

    private BalancesUiThreadState() {}

}


text:
/******************************************************************************
 * This project provides two demo applications.  A simple blinky style project,
 * and a more comprehensive test and demo application.  The
 * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting (defined in this file) is used to
 * select between the two.  The simply blinky demo is implemented and described
 * in main_blinky.c.  The more comprehensive test and demo application is
 * implemented and described in main_full.c.
 *
 * This file implements the code that is not demo specific, including the
 * hardware setup and FreeRTOS hook functions.
 */

/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"

/* Standard demo includes. */
#include "partest.h"
#include "QueueOverwrite.h"
#include "QueueSet.h"
#include "EventGroupsDemo.h"

/* Hardware specific includes. */
#include "ConfigPerformance.h"

/* Core configuration fuse settings */
#if defined(__32MZ2048ECM144) || defined(__32MZ2048ECH144)
	#pragma config FMIIEN = OFF, FETHIO = OFF, PGL1WAY = OFF, PMDL1WAY = OFF, IOL1WAY = OFF, FUSBIDIO = OFF
	#pragma config FNOSC = SPLL, FSOSCEN = OFF, IESO = OFF, POSCMOD = EC
	#pragma config OSCIOFNC = OFF, FCKSM = CSECMD, FWDTEN = OFF, FDMTEN = OFF
	#pragma config DMTINTV = WIN_127_128, WDTSPGM = STOP, WINDIS= NORMAL
	#pragma config WDTPS = PS1048576, FWDTWINSZ = WINSZ_25, DMTCNT = DMT31
	#pragma config FPLLIDIV = DIV_3, FPLLRNG = RANGE_13_26_MHZ, FPLLICLK = PLL_POSC
	#pragma config FPLLMULT = MUL_50, FPLLODIV = DIV_2, UPLLFSEL = FREQ_12MHZ, UPLLEN = OFF
	#pragma config EJTAGBEN = NORMAL, DBGPER = PG_ALL, FSLEEP = OFF, FECCCON = OFF_UNLOCKED
	#pragma config BOOTISA = MIPS32, TRCEN = ON, ICESEL = ICS_PGx2, JTAGEN = OFF, DEBUG = ON
	#pragma config CP = OFF
#elif defined(__32MZ2048EFM144) || defined(__32MZ2048EFH144)
	#pragma config FMIIEN = OFF, FETHIO = OFF, PGL1WAY = OFF, PMDL1WAY = OFF, IOL1WAY = OFF, FUSBIDIO = OFF
	#pragma config FNOSC = SPLL, FSOSCEN = OFF, IESO = OFF, POSCMOD = EC
	#pragma config OSCIOFNC = OFF, FCKSM = CSECMD, FWDTEN = OFF, FDMTEN = OFF
	#pragma config DMTINTV = WIN_127_128, WDTSPGM = STOP, WINDIS= NORMAL
	#pragma config WDTPS = PS1048576, FWDTWINSZ = WINSZ_25, DMTCNT = DMT31
	#pragma config FPLLIDIV = DIV_3, FPLLRNG = RANGE_13_26_MHZ, FPLLICLK = PLL_POSC
	#pragma config FPLLMULT = MUL_50, FPLLODIV = DIV_2, UPLLFSEL = FREQ_12MHZ
	#pragma config EJTAGBEN = NORMAL, DBGPER = PG_ALL, FSLEEP = OFF, FECCCON = OFF_UNLOCKED
	#pragma config BOOTISA = MIPS32, TRCEN = ON, ICESEL = ICS_PGx2, JTAGEN = OFF, DEBUG = ON
	#pragma config CP = OFF
#endif

/*-----------------------------------------------------------*/

/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,
or 0 to run the more comprehensive test and demo application. */
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY	0

/*-----------------------------------------------------------*/

/*
 * Set up the hardware ready to run this demo.
 */
static void prvSetupHardware( void );

/*
 * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.
 * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.
 */
extern void main_blinky( void );
extern void main_full( void );

/*-----------------------------------------------------------*/

/*
 * Create the demo tasks then start the scheduler.
 */
int main( void )
{
	/* Prepare the hardware to run this demo. */
	prvSetupHardware();

	/* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top
	of this file. */
	#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1
	{
		main_blinky();
	}
	#else
	{
		main_full();
	}
	#endif

	return 0;
}
/*-----------------------------------------------------------*/

static void prvSetupHardware( void )
{
	/* Configure the hardware for maximum performance. */
	vHardwareConfigurePerformance();

	/* Setup to use the external interrupt controller. */
	vHardwareUseMultiVectoredInterrupts();

	portDISABLE_INTERRUPTS();

	/* Setup the digital IO for the LED's. */
	vParTestInitialise();
}
/*-----------------------------------------------------------*/

void vApplicationMallocFailedHook( void )
{
	/* vApplicationMallocFailedHook() will only be called if
	configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h.  It is a hook
	function that will get called if a call to pvPortMalloc() fails.
	pvPortMalloc() is called internally by the kernel whenever a task, queue,
	timer or semaphore is created.  It is also called by various parts of the
	demo application.  If heap_1.c or heap_2.c are used, then the size of the
	heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in
	FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used
	to query the size of free heap space that remains (although it does not
	provide information on how the remaining heap might be fragmented). */
	taskDISABLE_INTERRUPTS();
	for( ;; );
}
/*-----------------------------------------------------------*/

void vApplicationIdleHook( void )
{
	/* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
	to 1 in FreeRTOSConfig.h.  It will be called on each iteration of the idle
	task.  It is essential that code added to this hook function never attempts
	to block in any way (for example, call xQueueReceive() with a block time
	specified, or call vTaskDelay()).  If the application makes use of the
	vTaskDelete() API function (as this demo application does) then it is also
	important that vApplicationIdleHook() is permitted to return to its calling
	function, because it is the responsibility of the idle task to clean up
	memory allocated by the kernel to any task that has since been deleted. */
}
/*-----------------------------------------------------------*/

void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
{
	( void ) pcTaskName;
	( void ) pxTask;

	/* Run time task stack overflow checking is performed if
	configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2.  This hook	function is
	called if a task stack overflow is detected.  Note the system/interrupt
	stack is not checked. */
	taskDISABLE_INTERRUPTS();
	for( ;; );
}
/*-----------------------------------------------------------*/

void vApplicationTickHook( void )
{
	/* This function will be called by each tick interrupt if
	configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h.  User code can be
	added here, but the tick hook is called from an interrupt context, so
	code must not attempt to block, and only the interrupt safe FreeRTOS API
	functions can be used (those that end in FromISR()). */

	#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )
	{
		/* Call the periodic queue overwrite from ISR demo. */
		vQueueOverwritePeriodicISRDemo();

		/* Call the queue set ISR test function. */
		vQueueSetAccessQueueSetFromISR();

		/* Exercise event groups from interrupts. */
		vPeriodicEventGroupsProcessing();
	}
	#endif
}
/*-----------------------------------------------------------*/

extern void vAssertCalled( const char * pcFile, unsigned long ulLine )
{
volatile char *pcFileName;
volatile unsigned long ulLineNumber;

	/* Prevent things that are useful to view in the debugger from being
	optimised away. */
	pcFileName = ( char * ) pcFile;
	( void ) pcFileName;
	ulLineNumber = ulLine;

	/* Set ulLineNumber to 0 in the debugger to break out of this loop and
	return to the line that triggered the assert. */
	while( ulLineNumber != 0 )
	{
		__asm volatile( "NOP" );
		__asm volatile( "NOP" );
		__asm volatile( "NOP" );
		__asm volatile( "NOP" );
		__asm volatile( "NOP" );
	}
}
/*-----------------------------------------------------------*/

/* This function overrides the normal _weak_ generic handler. */
void _general_exception_handler(void)
{
static enum {
	EXCEP_IRQ = 0, 	/* interrupt */
	EXCEP_AdEL = 4, /* address error exception (load or ifetch) */
	EXCEP_AdES, 	/* address error exception (store) */
	EXCEP_IBE, 		/* bus error (ifetch) */
	EXCEP_DBE, 		/* bus error (load/store) */
	EXCEP_Sys, 		/* syscall */
	EXCEP_Bp, 		/* breakpoint */
	EXCEP_RI, 		/* reserved instruction */
	EXCEP_CpU, 		/* coprocessor unusable */
	EXCEP_Overflow,	/* arithmetic overflow */
	EXCEP_Trap, 	/* trap (possible divide by zero) */
	EXCEP_FPE = 15, /* floating point exception */
	EXCEP_IS1 = 16,	/* implementation specfic 1 */
	EXCEP_CEU, 		/* CorExtend Unuseable */
	EXCEP_C2E, 		/* coprocessor 2 */
	EXCEP_DSPDis = 26   /* DSP module disabled */
} _excep_code;

static unsigned long _epc_code;
static unsigned long _excep_addr;

	asm volatile( "mfc0 %0,$13" : "=r" (_epc_code) );
	asm volatile( "mfc0 %0,$14" : "=r" (_excep_addr) );

	_excep_code = ( _epc_code & 0x0000007C ) >> 2;

    for( ;; )
	{
		/* prevent compiler warning */
		(void) _excep_code;

		/* Examine _excep_code to identify the type of exception.  Examine
		_excep_addr to find the address that caused the exception */
		LATHSET = 0x0007;
		Nop();
		Nop();
		Nop();
	}
}
/*-----------------------------------------------------------*/