text:
import { ObjectID } from 'mongodb';
import path from 'path';
import url from 'url';
import formidable from 'formidable';
import fse from 'fs-extra';
import settings from '../../lib/settings';
import SettingsService from '../settings/settings';
import { db } from '../../lib/mongo';
import utils from '../../lib/utils';
import parse from '../../lib/parse';

class ProductCategoriesService {
	constructor() {}

	getFilter(params = {}) {
		let filter = {};
		const enabled = parse.getBooleanIfValid(params.enabled);
		if (enabled !== null) {
			filter.enabled = enabled;
		}
		const id = parse.getObjectIDIfValid(params.id);
		if (id) {
			filter._id = id;
		}
		return filter;
	}

	async getCategories(params = {}) {
		const filter = this.getFilter(params);
		const projection = utils.getProjectionFromFields(params.fields);
		const generalSettings = await SettingsService.getSettings();
		const domain = generalSettings.domain;
		const items = await db
			.collection('productCategories')
			.find(filter, { projection: projection })
			.sort({ position: 1 })
			.toArray();
		const result = items.map(category =>
			this.changeProperties(category, domain)
		);
		return result;
	}

	getSingleCategory(id) {
		if (!ObjectID.isValid(id)) {
			return Promise.reject('Invalid identifier');
		}
		return this.getCategories({ id: id }).then(categories => {
			return categories.length > 0 ? categories[0] : null;
		});
	}

	async addCategory(data) {
		const lastCategory = await db
			.collection('productCategories')
			.findOne({}, { sort: { position: -1 } });
		const newPosition =
			lastCategory && lastCategory.position > 0 ? lastCategory.position + 1 : 1;
		const dataToInsert = await this.getValidDocumentForInsert(
			data,
			newPosition
		);
		const insertResult = await db
			.collection('productCategories')
			.insertMany([dataToInsert]);
		return this.getSingleCategory(insertResult.ops[0]._id.toString());
	}

	updateCategory(id, data) {
		if (!ObjectID.isValid(id)) {
			return Promise.reject('Invalid identifier');
		}
		let categoryObjectID = new ObjectID(id);

		return this.getValidDocumentForUpdate(id, data)
			.then(dataToSet =>
				db
					.collection('productCategories')
					.updateOne({ _id: categoryObjectID }, { $set: dataToSet })
			)
			.then(res => (res.modifiedCount > 0 ? this.getSingleCategory(id) : null));
	}

	findAllChildren(items, id, result) {
		if (id && ObjectID.isValid(id)) {
			result.push(new ObjectID(id));
			let finded = items.filter(
				item => (item.parent_id || '').toString() === id.toString()
			);
			if (finded.length > 0) {
				for (let item of finded) {
					this.findAllChildren(items, item.id, result);
				}
			}
		}

		return result;
	}

	deleteCategory(id) {
		if (!ObjectID.isValid(id)) {
			return Promise.reject('Invalid identifier');
		}

		// 1. get all categories
		return this.getCategories()
			.then(items => {
				// 2. find category and children
				let idsToDelete = [];
				this.findAllChildren(items, id, idsToDelete);
				return idsToDelete;
			})
			.then(idsToDelete => {
				// 3. delete categories
				let objectsToDelete = idsToDelete.map(id => new ObjectID(id));
				// return db.collection('productCategories').deleteMany({_id: { $in: objectsToDelete}}).then(() => idsToDelete);
				return db
					.collection('productCategories')
					.deleteMany({ _id: { $in: objectsToDelete } })
					.then(
						deleteResponse =>
							deleteResponse.deletedCount > 0 ? idsToDelete : null
					);
			})
			.then(idsToDelete => {
				// 4. update category_id for products
				return idsToDelete
					? db
							.collection('products')
							.updateMany(
								{ category_id: { $in: idsToDelete } },
								{ $set: { category_id: null } }
							)
							.then(() => idsToDelete)
					: null;
			})
			.then(idsToDelete => {
				// 5. delete directories with images
				if (idsToDelete) {
					for (let categoryId of idsToDelete) {
						let deleteDir = path.resolve(
							settings.categoriesUploadPath + '/' + categoryId
						);
						fse.remove(deleteDir, err => {});
					}
					return Promise.resolve(true);
				} else {
					return Promise.resolve(false);
				}
			});
	}

	getErrorMessage(err) {
		return { error: true, message: err.toString() };
	}

	getValidDocumentForInsert(data, newPosition) {
		//  Allow empty category to create draft

		let category = {
			date_created: new Date(),
			date_updated: null,
			image: ''
		};

		category.name = parse.getString(data.name);
		category.description = parse.getString(data.description);
		category.meta_description = parse.getString(data.meta_description);
		category.meta_title = parse.getString(data.meta_title);
		category.enabled = parse.getBooleanIfValid(data.enabled, true);
		category.sort = parse.getString(data.sort);
		category.parent_id = parse.getObjectIDIfValid(data.parent_id);
		category.position = parse.getNumberIfValid(data.position) || newPosition;

		let slug = !data.slug || data.slug.length === 0 ? data.name : data.slug;
		if (!slug || slug.length === 0) {
			return Promise.resolve(category);
		} else {
			return utils.getAvailableSlug(slug).then(newSlug => {
				category.slug = newSlug;
				return category;
			});
		}
	}

	getValidDocumentForUpdate(id, data) {
		return new Promise((resolve, reject) => {
			if (!ObjectID.isValid(id)) {
				reject('Invalid identifier');
			}
			if (Object.keys(data).length === 0) {
				reject('Required fields are missing');
			}

			let category = {
				date_updated: new Date()
			};

			if (data.name !== undefined) {
				category.name = parse.getString(data.name);
			}

			if (data.description !== undefined) {
				category.description = parse.getString(data.description);
			}

			if (data.meta_description !== undefined) {
				category.meta_description = parse.getString(data.meta_description);
			}

			if (data.meta_title !== undefined) {
				category.meta_title = parse.getString(data.meta_title);
			}

			if (data.enabled !== undefined) {
				category.enabled = parse.getBooleanIfValid(data.enabled, true);
			}

			if (data.image !== undefined) {
				category.image = data.image;
			}

			if (data.position >= 0) {
				category.position = data.position;
			}

			if (data.sort !== undefined) {
				category.sort = data.sort;
			}

			if (data.parent_id !== undefined) {
				category.parent_id = parse.getObjectIDIfValid(data.parent_id);
			}

			if (data.slug !== undefined) {
				let slug = data.slug;
				if (!slug || slug.length === 0) {
					slug = data.name;
				}

				utils
					.getAvailableSlug(slug, id)
					.then(newSlug => {
						category.slug = newSlug;
						resolve(category);
					})
					.catch(err => {
						reject(err);
					});
			} else {
				resolve(category);
			}
		});
	}

	changeProperties(item, domain) {
		if (item) {
			item.id = item._id.toString();
			item._id = undefined;

			if (item.parent_id) {
				item.parent_id = item.parent_id.toString();
			}

			if (item.slug) {
				item.url = url.resolve(domain, `/${item.slug}`);
				item.path = url.resolve('/', item.slug);
			}

			if (item.image) {
				item.image = url.resolve(
					domain,
					`${settings.categoriesUploadUrl}/${item.id}/${item.image}`
				);
			}
		}

		return item;
	}

	deleteCategoryImage(id) {
		let dir = path.resolve(settings.categoriesUploadPath + '/' + id);
		fse.emptyDirSync(dir);
		this.updateCategory(id, { image: '' });
	}

	uploadCategoryImage(req, res) {
		let categoryId = req.params.id;
		let form = new formidable.IncomingForm(),
			file_name = null,
			file_size = 0;

		form
			.on('fileBegin', (name, file) => {
				// Emitted whenever a field / value pair has been received.
				let dir = path.resolve(
					settings.categoriesUploadPath + '/' + categoryId
				);
				fse.emptyDirSync(dir);
				file.name = utils.getCorrectFileName(file.name);
				file.path = dir + '/' + file.name;
			})
			.on('file', function(field, file) {
				// every time a file has been uploaded successfully,
				file_name = file.name;
				file_size = file.size;
			})
			.on('error', err => {
				res.status(500).send(this.getErrorMessage(err));
			})
			.on('end', () => {
				//Emitted when the entire request has been received, and all contained files have finished flushing to disk.
				if (file_name) {
					this.updateCategory(categoryId, { image: file_name });
					res.send({ file: file_name, size: file_size });
				} else {
					res
						.status(400)
						.send(this.getErrorMessage('Required fields are missing'));
				}
			});

		form.parse(req);
	}
}

export default new ProductCategoriesService();


text:
package org.springframework.boot.actuate.autoconfigure.endpoint.condition;

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

import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.EndpointExtension;
import org.springframework.context.annotation.Conditional;
import org.springframework.core.env.Environment;

/**
 * {@link Conditional} that checks whether an endpoint is enabled or not. Matches
 * according to the endpoints specific {@link Environment} property, falling back to
 * {@code management.endpoints.enabled-by-default} or failing that
 * {@link Endpoint#enableByDefault()}.
 *

 * When placed on a {@code @Bean} method, the endpoint defaults to the return type of the
 * factory method:
 *
 *

 * @Configuration
 * public class MyConfiguration {
 *
 *     @ConditionalOnEnableEndpoint
 *     @Bean
 *     public MyEndpoint myEndpoint() {
 *         ...
 *     }
 *
 * }

 *

 * It is also possible to use the same mechanism for extensions:
 *
 *

 * @Configuration
 * public class MyConfiguration {
 *
 *     @ConditionalOnEnableEndpoint
 *     @Bean
 *     public MyEndpointWebExtension myEndpointWebExtension() {
 *         ...
 *     }
 *
 * }

 *

 * In the sample above, {@code MyEndpointWebExtension} will be created if the endpoint is
 * enabled as defined by the rules above. {@code MyEndpointWebExtension} must be a regular
 * extension that refers to an endpoint, something like:
 *
 *

 * @EndpointWebExtension(endpoint = MyEndpoint.class)
 * class MyEndpointWebExtension {
 *
 * }

 *

 * Alternatively, the target endpoint can be manually specified for components that should
 * only be created when a given endpoint is enabled:
 *
 *

 * @Configuration
 * public class MyConfiguration {
 *
 *     @ConditionalOnEnableEndpoint(endpoint = MyEndpoint.class)
 *     @Bean
 *     public MyComponent myComponent() {
 *         ...
 *     }
 *
 * }

 *
 * @author Stephane Nicoll
 * @since 2.0.0
 * @see Endpoint
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Documented
@Conditional(OnEnabledEndpointCondition.class)
public @interface ConditionalOnEnabledEndpoint {

	/**
	 * The endpoint type that should be checked. Inferred when the return type of the
	 * {@code @Bean} method is either an {@link Endpoint} or an {@link EndpointExtension}.
	 * @return the endpoint type to check
	 * @since 2.1.0
	 */
	Class<?> endpoint() default Void.class;

}

redpajama_set_name: RedPajamaGithub


text:
package io.awacs.server;

import io.awacs.common.Configurable;
import io.awacs.common.Configuration;
import io.awacs.common.Releasable;
import io.awacs.common.net.Packet;
import io.awacs.server.codec.PacketDecoder;
import io.awacs.server.codec.PacketEncoder;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.*;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
import io.netty.util.concurrent.DefaultEventExecutorGroup;
import io.netty.util.concurrent.EventExecutorGroup;
import org.reflections.Reflections;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.Field;
import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Created by pixyonly on 8/24/16.
 */
public final class ServerEntry implements Server, Configurable {

    private final static Logger log = LoggerFactory.getLogger(ServerEntry.class);

    private EventLoopGroup boss;

    private EventLoopGroup worker;

    private String host;

    private int port;

    private EventExecutorGroup businessGroup;

    private Map<Integer, Handler> handlerHolder = new HashMap<>();

    private Components components;

    private void initHandler() {
        Reflections ref = new Reflections("io.awacs.server.handler");
        Set<Class<? extends Handler>> classes = ref.getSubTypesOf(Handler.class);
        for (Class<? extends Handler> clazz : classes) {
            try {
                Handler handler = clazz.newInstance();
                List<Field> waitForInject = Stream.of(clazz.getDeclaredFields())
                        .filter(f -> f.isAnnotationPresent(Inject.class))
                        .collect(Collectors.toList());
                for (Field f : waitForInject) {
                    f.setAccessible(true);
                    Inject i = f.getDeclaredAnnotation(Inject.class);
                    String name = i.value();
                    Object component = components.lookup(name, f.getType());
                    f.set(handler, component);
                    log.info("Component {} injected onto handler {}", name, handler);
                }
                handlerHolder.put(Byte.toUnsignedInt(handler.key()), handler);
                log.info("Handler {} registered with key {}", clazz.getCanonicalName(), handler.key());
            } catch (InstantiationException | IllegalAccessException e) {
                throw new RuntimeException(e);
            }
        }
    }

    @Override
    public void start() {
        ServerBootstrap bootstrap = new ServerBootstrap();
        bootstrap.group(boss, worker)
                .channel(NioServerSocketChannel.class)
                .handler(new LoggingHandler(LogLevel.DEBUG))
                .childOption(ChannelOption.SO_KEEPALIVE, true)
                .childHandler(new ChannelInitializer<SocketChannel>() {
                    @Override
                    protected void initChannel(SocketChannel ch) throws Exception {
                        ch.pipeline().addLast(new PacketDecoder());
                        ch.pipeline().addLast(new PacketEncoder());
                        ch.pipeline().addLast(businessGroup, new Dispatcher(ServerEntry.this));
                    }
                });
        try {
            bootstrap.bind(host, port).sync();
        } catch (InterruptedException e) {
            stop();
        }
    }

    @Override
    public void stop() {
        boss.shutdownGracefully();
        worker.shutdownGracefully();
        businessGroup.shutdownGracefully();
        handlerHolder.values().forEach(Releasable::release);
        components.release();
    }

    @Override
    public void init(Configuration configuration) {
        components = new Components();
        components.init(configuration);
        initHandler();
        host = configuration.getString(Configurations.CFG_BIND_HOST, Configurations.DEFAULT_BIND_HOST);
        port = configuration.getInteger(Configurations.CFG_BIND_PORT, Configurations.DEFAULT_BIND_PORT);
        int bossCore = configuration.getInteger(Configurations.CFG_BOSS_CORE, Configurations.DEFAULT_BOSS_CORE);
        int workerCore = configuration.getInteger(Configurations.CFG_WORKER_CORE, Configurations.DEFAULT_WORKER_CORE);
        boss = new NioEventLoopGroup(bossCore);
        worker = new NioEventLoopGroup(workerCore);
        businessGroup = new DefaultEventExecutorGroup(Runtime.getRuntime().availableProcessors());
    }

    public static class Dispatcher extends SimpleChannelInboundHandler<Packet> {

        private ServerEntry ref;

        Dispatcher(ServerEntry ref) {
            this.ref = ref;
        }

        @Override
        public void channelRead0(ChannelHandlerContext ctx, Packet packet) throws Exception {
            InetSocketAddress address = (InetSocketAddress) ctx.channel().remoteAddress();
            Handler handler = ref.handlerHolder.get(Byte.toUnsignedInt(packet.key()));
            if (handler == null) {
                //TODO default handler
                log.info(packet.getNamespace());
                log.info(new String(packet.getBody()));
                return;
            }
            Packet response = handler.onReceive(packet, address);
            if (response != null) {
                ctx.writeAndFlush(response);
            }
        }

        @Override
        public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
            cause.printStackTrace();
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using GameRes.Utility;

namespace GameRes.Formats.Xuse
{
    internal class WagArchive : ArcFile
    {
        public readonly byte[] Key;

        public WagArchive (ArcView arc, ArchiveFormat impl, ICollection<Entry> dir, byte[] key)
            : base (arc, impl, dir)
        {
            Key = key;
        }
    }

    [Export(typeof(ArchiveFormat))]
    public class WagOpener : ArchiveFormat
    {
        public override string         Tag { get { return "WAG"; } }
        public override string Description { get { return "Xuse/Eternal resource archive"; } }
        public override uint     Signature { get { return 0x40474157; } } // 'WAG@'
        public override bool  IsHierarchic { get { return true; } }
        public override bool      CanWrite { get { return false; } }

        public WagOpener ()
        {
            Extensions = new string[] { "wag", "4ag", "004" };
            Signatures = new uint[] { 0x40474157, 0x34464147 }; // 'GAF4'
        }

        public override ArcFile TryOpen (ArcView file)
        {
            int version = file.View.ReadUInt16 (4);
            if (0x300 != version && 0x200 != version)
                return null;
            int count = file.View.ReadInt32 (0x46);
            if (!IsSaneCount (count))
                return null;

            var reader = new IndexReader (file, version, count);
            var dir = reader.ReadIndex();
            if (null == dir)
                return null;
            return new WagArchive (file, this, dir, reader.DataKey);
        }

        public override Stream OpenEntry (ArcFile arc, Entry entry)
        {
            var warc = arc as WagArchive;
            if (null == warc)
                return arc.File.CreateStream (entry.Offset, entry.Size);
            var data = arc.File.View.ReadBytes (entry.Offset, entry.Size);
            Decrypt ((uint)entry.Offset, warc.Key, data);
            return new BinMemoryStream (data, entry.Name);
        }

        static private byte[] GenerateKey (byte[] keyword)
        {
            return GenerateKey (keyword, keyword.Length);
        }

        static private byte[] GenerateKey (byte[] keyword, int length)
        {
            int hash = 0;
            for (int i = 0; i < length; ++i)
                hash = (((sbyte)keyword[i] + i) ^ hash) + length;

            int key_length = (hash & 0xFF) + 0x40;

            for (int i = 0; i < length; ++i)
                hash += (sbyte)keyword[i];

            byte[] key = new byte[key_length--];
            key[1] = (byte)(hash >> 8);
            hash &= 0xF;
            key[0] = (byte)hash;
            key[2] = 0x46;
            key[3] = 0x88;

            for (int i = 4; i < key_length; ++i)
            {
                hash += (((sbyte)keyword[i % length] ^ hash) + i) & 0xFF;
                key[i] = (byte)hash;
            }
            return key;
        }

        static private void Decrypt (uint offset, byte[] key, byte[] index)
        {
            Decrypt (offset, key, index, 0, index.Length);
        }

        static private void Decrypt (uint offset, byte[] key, byte[] index, int pos, int length)
        {
            uint key_last = (uint)key.Length-1;
            for (uint i = 0; i < length; ++i)
                index[pos+i] ^= key[(offset + i) % key_last];
        }

        internal class IndexReader
        {
            ArcView     m_file;
            int         m_version;
            int         m_count;
            byte[]      m_data_key;

            public byte[] DataKey { get { return m_data_key; } }

            public IndexReader (ArcView file, int version, int count)
            {
                m_file = file;
                m_version = version;
                m_count = count;
            }

            byte[]      m_chunk_buf = new byte[0x40];

            public List<Entry> ReadIndex ()
            {
                byte[] title = m_file.View.ReadBytes (6, 0x40);
                int title_length = Array.IndexOf<byte> (title, 0);
                if (-1 == title_length)
                    title_length = title.Length;
                string arc_filename = Path.GetFileName (m_file.Name);
                if (0x200 != m_version)
                    arc_filename = arc_filename.ToLowerInvariant();
                string base_filename = Path.GetFileNameWithoutExtension (arc_filename);

                byte[] name_key = GenerateKey (Encodings.cp932.GetBytes (arc_filename));

                uint index_offset = 0x200 + (uint)name_key.Select (x => (int)x).Sum();
                for (int i = 0; i < name_key.Length; ++i)
                {
                    index_offset ^= name_key[i];
                    index_offset = Binary.RotR (index_offset, 1);
                }
                for (int i = 0; i < name_key.Length; ++i)
                {
                    index_offset ^= name_key[i];
                    index_offset = Binary.RotR (index_offset, 1);
                }
                index_offset %= 0x401;

                index_offset += 0x4A;
                byte[] index = m_file.View.ReadBytes (index_offset, (uint)(4*m_count));
                if (index.Length != 4*m_count)
                    return null;

                byte[] index_key = new byte[index.Length];
                for (int i = 0; i < index_key.Length; ++i)
                {
                    int v = name_key[(i+1) % name_key.Length] ^ (name_key[i % name_key.Length] + i);
                    index_key[i] = (byte)(m_count + v);
                }
                Decrypt (index_offset, index_key, index);
                m_data_key = GenerateKey (title, title_length);
                var dir = new List<Entry> (m_count);
                int current_offset = 0;
                uint next_offset = LittleEndian.ToUInt32 (index, current_offset);
                for (int i = 0; i < m_count; ++i)
                {
                    current_offset += 4;
                    uint entry_offset = next_offset;
                    if (entry_offset >= m_file.MaxOffset)
                        return null;
                    if (i + 1 == m_count)
                        next_offset = (uint)m_file.MaxOffset;
                    else
                        next_offset = LittleEndian.ToUInt32 (index, current_offset);
                    uint entry_size = next_offset - entry_offset;
                    var entry = ParseEntry (entry_offset, entry_size);
                    if (string.IsNullOrEmpty (entry.Name))
                        entry.Name = string.Format ("{0}#{1:D4}", base_filename, i);
                    dir.Add (entry);
                }
                return dir;
            }

            Entry ParseEntry (uint entry_offset, uint entry_size)
            {
                ReadChunk (entry_offset, 8);
                if (0x200 == m_version)
                    return ParseEntryV2 (entry_offset, entry_size);
                else
                    return ParseEntryV3 (entry_offset, entry_size);
            }

            void ReadChunk (uint offset, int chunk_size)
            {
                if (chunk_size > m_chunk_buf.Length)
                    m_chunk_buf = new byte[chunk_size];
                if (chunk_size != m_file.View.Read (offset, m_chunk_buf, 0, (uint)chunk_size))
                    throw new InvalidFormatException();
                Decrypt (offset, m_data_key, m_chunk_buf, 0, chunk_size);
            }

            Entry ParseEntryV2 (uint entry_offset, uint entry_size)
            {
                var data_size = LittleEndian.ToUInt32 (m_chunk_buf, 0);
                if (data_size >= entry_size)
                    throw new InvalidFormatException();
                var name_length = LittleEndian.ToInt32 (m_chunk_buf, 4);
                entry_offset += 0x10;
                var entry = new Entry();
                if (name_length > 0)
                {
                    ReadChunk (entry_offset+data_size, name_length);
                    if ('|' == m_chunk_buf[name_length-1])
                        --name_length;
                    entry.Name = Encodings.cp932.GetString (m_chunk_buf, 0, name_length);
                    entry.Type = FormatCatalog.Instance.GetTypeFromName (entry.Name);
                }
                entry.Offset = entry_offset;
                entry.Size = data_size;
                return entry;
            }

            Entry ParseEntryV3 (uint entry_offset, uint entry_size)
            {
                if (!Binary.AsciiEqual (m_chunk_buf, "DSET"))
                    throw new InvalidFormatException();

                uint chunk_offset = entry_offset + 10;
                int chunk_count = LittleEndian.ToInt32 (m_chunk_buf, 4);
                var entry = new Entry();
                string filename = null;
                for (int chunk = 0; chunk < chunk_count; ++chunk)
                {
                    ReadChunk (chunk_offset, 8);
                    int chunk_size = LittleEndian.ToInt32 (m_chunk_buf, 4);
                    if (chunk_size <= 0)
                        throw new InvalidFormatException();
                    if (Binary.AsciiEqual (m_chunk_buf, "PICT"))
                    {
                        if (string.IsNullOrEmpty (entry.Type))
                        {
                            entry.Type = "image";
                            entry_offset = chunk_offset + 0x10;
                            entry_size = (uint)chunk_size - 6;
                        }
                    }
                    else if (null == filename && Binary.AsciiEqual (m_chunk_buf, "FTAG"))
                    {
                        ReadChunk (chunk_offset+10, chunk_size-2);
                        filename = Encodings.cp932.GetString (m_chunk_buf, 0, chunk_size-2);
                    }
                    chunk_offset += 10 + (uint)chunk_size;
                }
                if (!string.IsNullOrEmpty (filename))
                    entry.Name = DriveRe.Replace (filename, "");
                entry.Offset = entry_offset;
                entry.Size = entry_size;
                return entry;
            }

            static readonly Regex DriveRe = new Regex (@"^(?:.+:)?\\+");
        }
    }
}


text:
package org.jasig.portlet.calendar.mvc;

/**
 * Form bean for adding new user-defined http-based iCalendar feeds.
 *
 * @author Jen Bourey
 * @version $Revision$
 */
public class UserHttpIcalCalendarForm {

  private Long id;

  private String subscribeId;

  //	@NotBlank
  private String name;

  // RegEx copied from commons validation library
  //	@NotBlank
  //	@RegExp("^http[s]?:(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?")
  private String url;

  private boolean displayed;

  public UserHttpIcalCalendarForm() {
    id = new Long(-1);
    displayed = true;
  }

  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public String getSubscribeId() {
    return subscribeId;
  }

  public void setSubscribeId(String subscribeId) {
    this.subscribeId = subscribeId;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getUrl() {
    return url;
  }

  public void setUrl(String url) {
    this.url = url;
  }

  public boolean isDisplayed() {
    return displayed;
  }

  public void setDisplayed(boolean displayed) {
    this.displayed = displayed;
  }
}


text:
Spree::Promotion.class_eval do

  has_one :ink_deal, class_name: "Spree::InkDeal", dependent: :destroy

end


text:
This repository holds the beginnings of a clone of [Slim](http://slimframework.com/)
for Hack, Facebook's new statically-typed PHP-based language, in strict-mode as
possible. Slim relies on various dynamic features of PHP, so the API has to
differ in some places, but the aim is to get as close as possible, so porting a
Slim code base is as easy as possible.

## Current Status
The `Lean\Router` class is currently responding to GET, POST, PUT and DELETE,
it passes paramters from routes through to the callback defined by the user
through a `Map<string, mixed>` in the function.

__Update__: I've now begun porting the Request and Response API/Classes over, and
building the public `Lean\Lean` class and API. I think I'll be able to do it all in
strict mode, too, but it may entail some divergence from Slim's API, we'll see what
happens!

## Installation
Currently this needs a bit of work, but clone this repository down and run
`composer install`. The you'll want to point Nginx at it (I need to rework the
route matcher to handle `/index.php/<route>` request URIs so you can use it
without needing a rewrite), and ensure you havea `try_files /index.php$args;`
line in your location block.

Then, take a look at the `index.php` file in `/public` for how it currently works.

## Usage
Defining a route is easy, if a bit messy currently.

````
<?hh //partial

require_once __DIR__ . '/../vendor/autoload.php';

$app = new Lean\Router();

$app->get('/hello/:name', function(Map<string, mixed> $items) {
    print "Hello, " . $name . "!";
});

$app->run($_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD']);
````

The current methods on `$app` are:

* get()
* post()
* put()
* delete()
* run()
* setStatus()

I'll enumerate when this is locked down a bit more, check out `index.php` for
a proper example

## Contributing
Pull requests are more than welcome! I'd love some help to get this going,
it's a bit rough at the moment but theres a solid base there. Feel free to
send me a stack of issues too, let me know what you need and what needs work.


text:
namespace ui {
namespace win {

namespace {

// Default ShellExecuteEx flags used with "openas", "explore", and default
// verbs.
//
// SEE_MASK_NOASYNC is specified so that ShellExecuteEx can be invoked from a
// thread whose message loop may not wait around long enough for the
// asynchronous tasks initiated by ShellExecuteEx to complete. Using this flag
// causes ShellExecuteEx() to block until these tasks complete.
const DWORD kDefaultShellExecuteFlags = SEE_MASK_NOASYNC;

// Invokes ShellExecuteExW() with the given parameters.
bool InvokeShellExecute(const std::wstring& path,
                        const std::wstring& working_directory,
                        const std::wstring& args,
                        const std::wstring& verb,
                        DWORD mask) {
  base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
                                                base::BlockingType::WILL_BLOCK);
  SHELLEXECUTEINFO sei = {sizeof(sei)};
  sei.fMask = mask;
  sei.nShow = SW_SHOWNORMAL;
  sei.lpVerb = (verb.empty() ? nullptr : verb.c_str());
  sei.lpFile = path.c_str();
  sei.lpDirectory =
      (working_directory.empty() ? nullptr : working_directory.c_str());
  sei.lpParameters = (args.empty() ? nullptr : args.c_str());

  // Mitigate the issues caused by loading DLLs on a background thread
  // (http://crbug/973868).
  SCOPED_MAY_LOAD_LIBRARY_AT_BACKGROUND_PRIORITY();

  return ::ShellExecuteExW(&sei);
}

}  // namespace

bool OpenFileViaShell(const base::FilePath& full_path) {
  // Invoke the default verb on the file with no arguments.
  return InvokeShellExecute(full_path.value(), full_path.DirName().value(),
                            std::wstring(), std::wstring(),
                            kDefaultShellExecuteFlags);
}

bool OpenFolderViaShell(const base::FilePath& full_path) {
  // The "explore" verb causes the folder at |full_path| to be displayed in a
  // file browser. This will fail if |full_path| is not a directory.
  return InvokeShellExecute(full_path.value(), full_path.value(),
                            std::wstring(), L"explore",
                            kDefaultShellExecuteFlags);
}

bool PreventWindowFromPinning(HWND hwnd) {
  DCHECK(hwnd);

  Microsoft::WRL::ComPtr<IPropertyStore> pps;
  if (FAILED(SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pps))))
    return false;

  return base::win::SetBooleanValueForPropertyStore(
      pps.Get(), PKEY_AppUserModel_PreventPinning, true);
}

// TODO(calamity): investigate moving this out of the UI thread as COM
// operations may spawn nested run loops which can cause issues.
void SetAppDetailsForWindow(const std::wstring& app_id,
                            const base::FilePath& app_icon_path,
                            int app_icon_index,
                            const std::wstring& relaunch_command,
                            const std::wstring& relaunch_display_name,
                            HWND hwnd) {
  DCHECK(hwnd);

  Microsoft::WRL::ComPtr<IPropertyStore> pps;
  if (FAILED(SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pps))))
    return;

  if (!app_id.empty())
    base::win::SetAppIdForPropertyStore(pps.Get(), app_id.c_str());
  if (!app_icon_path.empty()) {
    // Always add the icon index explicitly to prevent bad interaction with the
    // index notation when file path has commas.
    base::win::SetStringValueForPropertyStore(
        pps.Get(), PKEY_AppUserModel_RelaunchIconResource,
        base::StringPrintf(L"%ls,%d", app_icon_path.value().c_str(),
                           app_icon_index)
            .c_str());
  }
  if (!relaunch_command.empty()) {
    base::win::SetStringValueForPropertyStore(
        pps.Get(), PKEY_AppUserModel_RelaunchCommand,
        relaunch_command.c_str());
  }
  if (!relaunch_display_name.empty()) {
    base::win::SetStringValueForPropertyStore(
        pps.Get(), PKEY_AppUserModel_RelaunchDisplayNameResource,
        relaunch_display_name.c_str());
  }
}

void SetAppIdForWindow(const std::wstring& app_id, HWND hwnd) {
  SetAppDetailsForWindow(app_id, base::FilePath(), 0, std::wstring(),
                         std::wstring(), hwnd);
}

void SetAppIconForWindow(const base::FilePath& app_icon_path,
                         int app_icon_index,
                         HWND hwnd) {
  SetAppDetailsForWindow(std::wstring(), app_icon_path, app_icon_index,
                         std::wstring(), std::wstring(), hwnd);
}

void SetRelaunchDetailsForWindow(const std::wstring& relaunch_command,
                                 const std::wstring& display_name,
                                 HWND hwnd) {
  SetAppDetailsForWindow(std::wstring(), base::FilePath(), 0, relaunch_command,
                         display_name, hwnd);
}

void ClearWindowPropertyStore(HWND hwnd) {
  DCHECK(hwnd);

  Microsoft::WRL::ComPtr<IPropertyStore> pps;
  if (FAILED(SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pps))))
    return;

  DWORD property_count;
  if (FAILED(pps->GetCount(&property_count)))
    return;

  PROPVARIANT empty_property_variant = {};
  for (DWORD i = property_count; i > 0; i--) {
    PROPERTYKEY key;
    if (SUCCEEDED(pps->GetAt(i - 1, &key))) {
      // Removes the value from |pps|'s array.
      pps->SetValue(key, empty_property_variant);
    }
  }
  if (FAILED(pps->Commit()))
    return;

  // Verify none of the keys are leaking.
  DCHECK(FAILED(pps->GetCount(&property_count)) || property_count == 0);
}

bool IsAeroGlassEnabled() {
  // For testing in Win8 (where it is not possible to disable composition) the
  // user can specify this command line switch to mimic the behavior.  In this
  // mode, cross-HWND transparency is not supported and various types of
  // widgets fallback to more simplified rendering behavior.
  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
          switches::kDisableDwmComposition))
    return false;

  // If composition is not enabled, we behave like on XP.
  return IsDwmCompositionEnabled();
}

bool IsDwmCompositionEnabled() {
  // As of Windows 8, DWM composition is always enabled.
  // In Windows 7 this can change at runtime.
  if (base::win::GetVersion() >= base::win::Version::WIN8) {
    return true;
  }
  BOOL is_enabled;
  return SUCCEEDED(DwmIsCompositionEnabled(&is_enabled)) && is_enabled;
}

}  // namespace win
}  // namespace ui


text:
package org.apache.camel.impl.engine;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import org.apache.camel.CamelContext;
import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.model.RoutesDefinition;
import org.apache.camel.spi.Resource;
import org.apache.camel.util.IOHelper;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

public class DefaultPackageScanResourceResolverTest {
    private static Set<String> loadRouteIDs(CamelContext context, String path) {
        return loadRouteDefinitions(context, path).stream().map(RouteDefinition::getId).collect(Collectors.toSet());
    }

    private static List<RouteDefinition> loadRouteDefinitions(CamelContext context, String path) {
        List<RouteDefinition> answer = new ArrayList<>();

        ExtendedCamelContext ecc = context.adapt(ExtendedCamelContext.class);
        try {
            for (Resource resource : ecc.getPackageScanResourceResolver().findResources(path)) {
                InputStream is = resource.getInputStream();
                try {
                    RoutesDefinition routes
                            = (RoutesDefinition) ecc.getXMLRoutesDefinitionLoader().loadRoutesDefinition(ecc, is);
                    if (routes != null) {
                        answer.addAll(routes.getRoutes());
                    }
                } finally {
                    IOHelper.close(is);
                }
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        return answer;
    }

    @Test
    public void testFileResourcesScan() {
        DefaultCamelContext ctx = new DefaultCamelContext(false);

        assertThat(loadRouteIDs(ctx, "file:src/test/resources/org/apache/camel/impl/engine/**/*.xml"))
                .containsOnly("dummy-a", "scan-a", "dummy-b", "scan-b");
        assertThat(loadRouteIDs(ctx, "file:src/test/resources/org/apache/camel/impl/engine/a?/*.xml"))
                .containsOnly("dummy-a", "scan-a");
        assertThat(loadRouteIDs(ctx, "file:src/test/resources/org/apache/camel/impl/engine/b?/*.xml"))
                .containsOnly("dummy-b", "scan-b");
        assertThat(loadRouteIDs(ctx, "file:src/test/resources/org/apache/camel/impl/engine/c?/*.xml"))
                .isEmpty();
    }
}


text:
class GrContext;

namespace base {
class Lock;
}

namespace gpu {
class ContextSupport;
namespace gles2 { class GLES2Interface; }
}

namespace cc {
struct ManagedMemoryPolicy;

class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> {
 public:
  class ScopedContextLock {
   public:
    explicit ScopedContextLock(ContextProvider* context_provider)
        : context_provider_(context_provider),
          context_lock_(*context_provider_->GetLock()) {
      // Allow current thread to use |context_provider_|.
      context_provider_->DetachFromThread();
    }
    ~ScopedContextLock() {
      // Allow usage by thread for which |context_provider_| is bound to.
      context_provider_->DetachFromThread();
    }

    gpu::gles2::GLES2Interface* ContextGL() {
      return context_provider_->ContextGL();
    }

   private:
    ContextProvider* const context_provider_;
    base::AutoLock context_lock_;
  };
  // Bind the 3d context to the current thread. This should be called before
  // accessing the contexts. Calling it more than once should have no effect.
  // Once this function has been called, the class should only be accessed
  // from the same thread unless the function has some explicitly specified
  // rules for access on a different thread. See SetupLockOnMainThread(), which
  // can be used to provide access from multiple threads.
  virtual bool BindToCurrentThread() = 0;
  virtual void DetachFromThread() {}

  virtual gpu::gles2::GLES2Interface* ContextGL() = 0;
  virtual gpu::ContextSupport* ContextSupport() = 0;
  virtual class GrContext* GrContext() = 0;

  struct Capabilities {
    gpu::Capabilities gpu;
    size_t max_transfer_buffer_usage_bytes;

    CC_EXPORT Capabilities();
  };

  // Invalidates the cached OpenGL state in GrContext.
  // See skia GrContext::resetContext for details.
  virtual void InvalidateGrContext(uint32_t state) = 0;

  // Sets up a lock so this context can be used from multiple threads. After
  // calling this, all functions without explicit thread usage constraints can
  // be used on any thread while the lock returned by GetLock() is acquired.
  virtual void SetupLock() = 0;

  // Returns the lock that should be held if using this context from multiple
  // threads. This can be called on any thread.
  virtual base::Lock* GetLock() = 0;

  // Returns the capabilities of the currently bound 3d context.
  virtual Capabilities ContextCapabilities() = 0;

  // Ask the provider to check if the contexts are valid or lost. If they are,
  // this should invalidate the provider so that it can be replaced with a new
  // one.
  virtual void VerifyContexts() = 0;

  // Delete all cached gpu resources.
  virtual void DeleteCachedResources() = 0;

  // A method to be called from the main thread that should return true if
  // the context inside the provider is no longer valid.
  virtual bool DestroyedOnMainThread() = 0;

  // Sets a callback to be called when the context is lost. This should be
  // called from the same thread that the context is bound to. To avoid races,
  // it should be called before BindToCurrentThread(), or VerifyContexts()
  // should be called after setting the callback.
  typedef base::Closure LostContextCallback;
  virtual void SetLostContextCallback(
      const LostContextCallback& lost_context_callback) = 0;

  // Sets a callback to be called when the memory policy changes. This should be
  // called from the same thread that the context is bound to.
  typedef base::Callback<void(const ManagedMemoryPolicy& policy)>
      MemoryPolicyChangedCallback;
  virtual void SetMemoryPolicyChangedCallback(
      const MemoryPolicyChangedCallback& memory_policy_changed_callback) = 0;

 protected:
  friend class base::RefCountedThreadSafe<ContextProvider>;
  virtual ~ContextProvider() {}
};

}  // namespace cc

#endif  // CC_OUTPUT_CONTEXT_PROVIDER_H_


text:
<?xml version='1.0' encoding='utf-8'?>
<widget id="mx.sixmanantiales.mobile" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
    <name>Six Manantiales</name>
    <description>
        Six Manantiales - Promocionales Mobile
        Usa esta aplicación para enterarte de nuestras promociones,
        además organiza tus eventos especiales.
    </description>
    <author email="alberto.vazq.rmz@gmail.com" href="http://six-mobile-app.herokuapp.com/">
        CeroMaya Team
    </author>
    <feature name="http://api.phonegap.com/1.0/device" />
    <preference name="permissions" value="none" />
    <preference name="orientation" value="portrait" />
    <preference name="target-device" value="universal" />
    <preference name="fullscreen" value="true" />
    <preference name="webviewbounce" value="true" />
    <preference name="prerendered-icon" value="true" />
    <preference name="stay-in-webview" value="false" />
    <preference name="ios-statusbarstyle" value="black-opaque" />
    <preference name="detect-data-types" value="true" />
    <preference name="exit-on-suspend" value="false" />
    <preference name="show-splash-screen-spinner" value="true" />
    <preference name="auto-hide-splash-screen" value="true" />
    <preference name="disable-cursor" value="false" />
    <preference name="android-minSdkVersion" value="7" />
    <preference name="android-installLocation" value="auto" />
    <icon src="icon.png" />
    <icon gap:density="ldpi" gap:platform="android" src="res/icon/android/six-icon-36-ldpi.png" />
    <icon gap:density="mdpi" gap:platform="android" src="res/icon/android/six-icon-48-mdpi.png" />
    <icon gap:density="hdpi" gap:platform="android" src="res/icon/android/six-icon-72-hdpi.png" />
    <icon gap:density="xhdpi" gap:platform="android" src="res/icon/android/six-icon-96-xhdpi.png" />
    <icon gap:platform="blackberry" src="res/icon/blackberry/icon-80.png" />
    <icon gap:platform="blackberry" gap:state="hover" src="res/icon/blackberry/icon-80.png" />
    <icon gap:platform="ios" height="57" src="res/icon/ios/icon-57.png" width="57" />
    <icon gap:platform="ios" height="72" src="res/icon/ios/icon-72.png" width="72" />
    <icon gap:platform="ios" height="114" src="res/icon/ios/icon-57-2x.png" width="114" />
    <icon gap:platform="ios" height="144" src="res/icon/ios/icon-72-2x.png" width="144" />
    <icon gap:platform="webos" src="res/icon/webos/icon-64.png" />
    <icon gap:platform="winphone" src="res/icon/windows-phone/icon-48.png" />
    <icon gap:platform="winphone" gap:role="background" src="res/icon/windows-phone/icon-173.png" />
    <gap:splash gap:density="ldpi" gap:platform="android" src="res/screen/android/screen-ldpi-portrait.png" />
    <gap:splash gap:density="mdpi" gap:platform="android" src="res/screen/android/screen-mdpi-portrait.png" />
    <gap:splash gap:density="hdpi" gap:platform="android" src="res/screen/android/screen-hdpi-portrait.png" />
    <gap:splash gap:density="xhdpi" gap:platform="android" src="res/screen/android/screen-xhdpi-portrait.png" />
    <gap:splash gap:platform="blackberry" src="res/screen/blackberry/screen-225.png" />
    <gap:splash gap:platform="ios" height="480" src="res/screen/ios/screen-iphone-portrait.png" width="320" />
    <gap:splash gap:platform="ios" height="960" src="res/screen/ios/screen-iphone-portrait-2x.png" width="640" />
    <gap:splash gap:platform="ios" height="1024" src="res/screen/ios/screen-ipad-portrait.png" width="768" />
    <gap:splash gap:platform="ios" height="768" src="res/screen/ios/screen-ipad-landscape.png" width="1024" />
    <gap:splash gap:platform="winphone" src="res/screen/windows-phone/screen-portrait.jpg" />

    <!-- Access and plugin configuration -->
    <access origin="https://cp.pushwoosh.com" subdomains="true" />
    <access origin="http://six-mobile-app.herokuapp.com/*"/>
    <access origin="http://res.cloudinary.com/*"/>
    <access origin="http://maps.google.com/*" subdomains="true" />
    <access origin="http://*.google.com/*" subdomains="true" />
    <access origin="http://*.googleapis.com/*" subdomains="true" />
    <access origin="http://*.gstatic.com/*" subdomains="true" />

    <gap:plugin name="com.pushwoosh.plugins.pushwoosh" />
    <gap:plugin name="org.apache.cordova.device" />
    <gap:plugin name="org.apache.cordova.dialogs" />
    <gap:plugin name="org.apache.cordova.network-information" />
</widget>


text:
<?php

namespace Illuminate\View\Compilers\Concerns;

trait CompilesComponents
{
    /**
     * Compile the component statements into valid PHP.
     *
     * @param  string  $expression
     * @return string
     */
    protected function compileComponent($expression)
    {
        return "<?php \$__env->startComponent{$expression}; ?>";
    }

    /**
     * Compile the end-component statements into valid PHP.
     *
     * @return string
     */
    protected function compileEndComponent()
    {
        return '<?php echo $__env->renderComponent(); ?>';
    }

    /**
     * Compile the slot statements into valid PHP.
     *
     * @param  string  $expression
     * @return string
     */
    protected function compileSlot($expression)
    {
        return "<?php \$__env->slot{$expression}; ?>";
    }

    /**
     * Compile the end-slot statements into valid PHP.
     *
     * @return string
     */
    protected function compileEndSlot()
    {
        return '<?php $__env->endSlot(); ?>';
    }

    /**
     * Compile the component-first statements into valid PHP.
     *
     * @param  string  $expression
     * @return string
     */
    protected function compileComponentFirst($expression)
    {
        return "<?php \$__env->startComponentFirst{$expression}; ?>";
    }

    /**
     * Compile the end-component-first statements into valid PHP.
     *
     * @return string
     */
    protected function compileEndComponentFirst()
    {
        return $this->compileEndComponent();
    }
}


text:
<!DOCTYPE html>

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title><?=COMPANY_NAME;?> - Checkout</title>

    <link href="<?=base_url('css/homestyle/bootstrap.min.css');?>" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="<?=base_url('css/datatables/jquery.dataTables.css');?>">
    <link href="<?=base_url('css/homestyle/animate.min.css');?>"  rel="stylesheet">
    <link href="<?=base_url('css/homestyle/font-awesome.min.css');?>" rel="stylesheet">
    <link href="<?=base_url('css/homestyle/lightbox.css');?>" rel="stylesheet">
    <link href="<?=base_url('css/homestyle/main.css');?>"  rel="stylesheet">
    <link href="<?=base_url('css/treeview-style.css');?>"  rel="stylesheet">
    <link href="<?=base_url('css/side-menu/side-menu.css');?>"  rel="stylesheet">
    <link id="css-preset" href="<?=base_url('css/homestyle/presets/preset1.css');?>"  rel="stylesheet">
    <link href="<?=base_url('css/homestyle/responsive.css');?>"  rel="stylesheet">

   <?php $this->load->view("header_home");?>

Select the Category

          <?php foreach($listfamily as $f) {?>

             <?php
                $fno = $f->Level1No;
                $listcategorybyfamily = array_filter( $listcategory,  function ($e) use ($fno) { return $e->Level1No == $fno; } );

             ?>

             <a  data-id='{"l1":"<?=$fno;?>"}' data-name='["<?=$f->Name1?>"]'  <?=(($listcategorybyfamily) ? "data-toggle=\"collapse\" class=\"collapsed\" data-target=\"#sidr-id-f" . $fno . "\"" : "");?> onclick="categorymenuClick(this);"> <?=$f->Name1;?>

             <?php if($listcategorybyfamily) {?>
               <ul <?="class=\"collapse\" id=\"f". $fno ."\"";?> aria-expanded="false" style="height: 1px;">
               <?php foreach($listcategorybyfamily as $c) {?>

                   <?php $url = base_url('customer?family='. $fno .'&category='. $c->Level2No);?>
                      <?php
                          $cno = $c->Level2No;

                          $listSubcategorybyfamily = array_filter(
                              $listsubcategory,
                              function ($e) use ($fno, $cno) {
                                  return $e->Level1No == $fno && $e->Level2No == $cno;
                              }
                          );
                       ?>
                      <a  data-id='{"l1":"<?=$fno;?>","l2":"<?=$cno;?>"}' data-name='["<?=$f->Name1?>","<?=$c->Name2?>"]' onclick="categorymenuClick(this);"> <?=$c->Name2;?>
                       <?php if($listSubcategorybyfamily) {?>

                         <?php foreach($listSubcategorybyfamily as $sc) {?>

<a data-id='{"l1":"<?=$fno;?>","l2":"<?=$cno;?>","l3":"<?=$sc->Level3No;?>"}' data-name='["<?=$f->Name1?>","<?=$c->Name2?>","<?=$sc->Name3?>"]' onclick="categorymenuClick(this);"> <?=$sc->Name3;?>

                         <?php } ?>

                       <?php } ?>

               <?php } ?>

             <?php } ?>

         <?php } ?>

           Account Information

          <?php $username = $this->session->userdata("username"); ?>
          <?php $customer = ($customer) ? $customer[0] : null;  ?>

          <?php $lastname = ($customer) ? $customer->Lastname : ""; ?>
          <?php $firstname = ($customer) ? $customer->Firstname : ""; ?>
          <?php $contact = ($customer) ? $customer->ContactNo : ""; ?>
          <?php $email = ($customer) ? $customer->Email : ""; ?>
          <?php $shipaddress = ($customer) ? $customer->ShipAddress : ""; ?>
          <?php $readonly = ($username) ? "readonly" : ""; ?>
          <?php if(!$username){ ?>
            Already registered? Click <a href="<?=base_url('login?t=customer')?>">Login
          <?php } ?>

          <div class="row customer-form <?=(($customer) ? 'login' : '');?>">

              <input type="hidden" id="itemfor" value="<?=$for;?>"/>

                    <input class="inputMaterial" type="text" id="txt-lastname" value="<?=$lastname;?>" required  <?=$readonly?>>

                    Last name:

                    <input class="inputMaterial" type="text"  id="txt-firstname" value="<?=$firstname;?>" required <?=$readonly?>>

                    First name:

                    <input class="inputMaterial" type="text"  id="txt-company" value="<?=$firstname;?>" required <?=$readonly?>>

                    Company Name:

                    <input class="inputMaterial" type="text"  id="txt-contact"  value="<?=$contact;?>" required <?=$readonly?>>

                    Contact #:

                    <input class="inputMaterial" type="text"  id="txt-email"  value="<?=$email;?>" required <?=$readonly?>>

                    Email Address:

              <?php if(!$username){ ?>

                    <input class="inputMaterial" type="text"  id="txt-homeaddress" required >

                    Home Address:

              <?php } ?>

                    <input class="inputMaterial" type="text"  id="txt-shipaddress"  value="<?=$shipaddress;?>" required <?=$readonly?>>

                    Shipping Address:

                <?php if(!$username){ ?>

                    <input type="checkbox">Same to Home Address

                <?php } ?>

            <?php $total = 0.00;?>
            <?php foreach($itemsoncart as $key) {?>
            <?php $total += ($key->Price * $key->Quantity);?>
            <?php }?>

          <a class="pull-right" href="<?=base_url('items/cart')?>"><carttotal><?=$totalItemCart?></carttotal> item(s)
           Order Summary

Payment Type:  Cash on delivery

Subtotal: ₱ <?=number_format($total,2);?>

Total:  ₱ <?=number_format($total,2);?>

                  <input type="checkbox" value="">I agree to the <a href="<?=base_url('items/termsandconditions')?>" target="_blank">term of conditions

                <button class="btn btn-action btn-submitorder" > SUBMIT</button>

© 2016 Lampano Hardware.

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

Your Order has been submitted.

          You may now print your order by clicking the "Print my Order" button.
Please wait for the approval by admin via email and for your password has been sent to your email address.

        Print my Order
        <a type="button" class="btn btn-default"  href="<?=base_url();?>" >Done


text:
package org.jfrog.hudson.maven3;

import hudson.Extension;
import hudson.Launcher;
import hudson.matrix.MatrixConfiguration;
import hudson.model.*;
import hudson.tasks.BuildWrapper;
import hudson.util.ListBoxModel;
import hudson.util.XStream2;
import org.apache.commons.lang.StringUtils;
import org.jfrog.hudson.*;
import org.jfrog.hudson.action.ActionableHelper;
import org.jfrog.hudson.release.promotion.UnifiedPromoteBuildAction;
import org.jfrog.hudson.util.*;
import org.jfrog.hudson.util.converters.DeployerResolverOverriderConverter;
import org.jfrog.hudson.util.plugins.MultiConfigurationUtils;
import org.jfrog.hudson.util.plugins.PluginsUtils;
import org.jfrog.hudson.util.publisher.PublisherContext;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.bind.JavaScriptMethod;
import org.kohsuke.stapler.interceptor.RequirePOST;

import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * Freestyle Maven 3 configurator.
 *
 * @author Noam Y. Tenne
 */
public class ArtifactoryMaven3Configurator extends BuildWrapper implements DeployerOverrider, ResolverOverrider,
        BuildInfoAwareConfigurator, MultiConfigurationAware {

    /**
     * Repository URL and repository to deploy artifacts to
     */
    private final ServerDetails deployerDetails;
    private final ServerDetails resolverDetails;
    private final CredentialsConfig deployerCredentialsConfig;
    private final CredentialsConfig resolverCredentialsConfig;

    /**
     * If checked (default) deploy maven artifacts
     */
    private final boolean deployArtifacts;
    private final IncludesExcludes artifactDeploymentPatterns;

    /**
     * Include environment variables in the generated build info
     */
    private final boolean includeEnvVars;

    private final boolean deployBuildInfo;
    private final boolean discardOldBuilds;
    private final boolean discardBuildArtifacts;
    private final boolean asyncBuildRetention;
    private final String deploymentProperties;
    private final boolean enableIssueTrackerIntegration;
    private final boolean filterExcludedArtifactsFromBuild;
    private final boolean enableResolveArtifacts;
    private IncludesExcludes envVarsPatterns;
    private boolean aggregateBuildIssues;
    private String aggregationBuildStatus;
    private boolean recordAllDependencies;
    private String artifactoryCombinationFilter;
    private String customBuildName;
    private boolean overrideBuildName;
    /**
     * @deprecated: Use org.jfrog.hudson.maven3.ArtifactoryMaven3Configurator#getDeployerCredentialsConfig()()
     */
    @Deprecated
    private Credentials overridingDeployerCredentials;
    /**
     * @deprecated: Use org.jfrog.hudson.maven3.ArtifactoryMaven3Configurator#getResolverCredentialsId()()
     */
    @Deprecated
    private Credentials overridingResolverCredentials;

    /**
     * @deprecated: The following deprecated variables have corresponding converters to the variables replacing them
     */
    @Deprecated
    private ServerDetails details = null;
    @Deprecated
    private final String matrixParams = null;

    @DataBoundConstructor
    public ArtifactoryMaven3Configurator(ServerDetails details, ServerDetails deployerDetails, ServerDetails resolverDetails,
                                         CredentialsConfig deployerCredentialsConfig, CredentialsConfig resolverCredentialsConfig,
                                         boolean enableResolveArtifacts, IncludesExcludes artifactDeploymentPatterns,
                                         boolean deployArtifacts, boolean deployBuildInfo, boolean includeEnvVars,
                                         IncludesExcludes envVarsPatterns,
                                         boolean discardOldBuilds, boolean discardBuildArtifacts,
                                         boolean asyncBuildRetention, String matrixParams, String deploymentProperties,
                                         boolean enableIssueTrackerIntegration, boolean aggregateBuildIssues,
                                         String aggregationBuildStatus, boolean recordAllDependencies,
                                         boolean filterExcludedArtifactsFromBuild,
                                         String customBuildName,
                                         boolean overrideBuildName,
                                         String artifactoryCombinationFilter
    ) {
        this.deployerDetails = deployerDetails;
        this.resolverDetails = resolverDetails;
        this.deployerCredentialsConfig = deployerCredentialsConfig;
        this.resolverCredentialsConfig = resolverCredentialsConfig;
        this.artifactDeploymentPatterns = artifactDeploymentPatterns;
        this.envVarsPatterns = envVarsPatterns;
        this.discardOldBuilds = discardOldBuilds;
        this.discardBuildArtifacts = discardBuildArtifacts;
        this.asyncBuildRetention = asyncBuildRetention;
        this.deploymentProperties = deploymentProperties;
        this.enableIssueTrackerIntegration = enableIssueTrackerIntegration;
        this.aggregateBuildIssues = aggregateBuildIssues;
        this.aggregationBuildStatus = aggregationBuildStatus;
        this.recordAllDependencies = recordAllDependencies;
        this.filterExcludedArtifactsFromBuild = filterExcludedArtifactsFromBuild;
        this.deployBuildInfo = deployBuildInfo;
        this.deployArtifacts = deployArtifacts;
        this.includeEnvVars = includeEnvVars;
        this.artifactoryCombinationFilter = artifactoryCombinationFilter;
        this.enableResolveArtifacts = enableResolveArtifacts;
        this.customBuildName = customBuildName;
        this.overrideBuildName = overrideBuildName;
    }

    public ServerDetails getDeployerDetails() {
        return deployerDetails;
    }

    public ServerDetails getResolverDetails() {
        return resolverDetails;
    }

    public String getDownloadReleaseRepositoryKey() {
        return resolverDetails != null ? resolverDetails.getResolveReleaseRepositoryKey() : null;
    }

    public String getDownloadSnapshotRepositoryKey() {
        return resolverDetails != null ? resolverDetails.getResolveReleaseRepositoryKey() : null;
    }

    public boolean isDiscardOldBuilds() {
        return discardOldBuilds;
    }

    public boolean isDiscardBuildArtifacts() {
        return discardBuildArtifacts;
    }

    public boolean isAsyncBuildRetention() {
        return asyncBuildRetention;
    }

    public boolean isOverridingDefaultDeployer() {
        return deployerCredentialsConfig != null && deployerCredentialsConfig.isCredentialsProvided();
    }

    public Credentials getOverridingDeployerCredentials() {
        return overridingDeployerCredentials;
    }

    public CredentialsConfig getDeployerCredentialsConfig() {
        return deployerCredentialsConfig;
    }

    public boolean isOverridingDefaultResolver() {
        return resolverCredentialsConfig.isCredentialsProvided();
    }

    public Credentials getOverridingResolverCredentials() {
        return overridingResolverCredentials;
    }

    public CredentialsConfig getResolverCredentialsConfig() {
        return resolverCredentialsConfig;
    }

    public boolean isOverridingResolverCredentials() {
        return resolverCredentialsConfig.isCredentialsProvided();
    }

    public boolean isDeployArtifacts() {
        return deployArtifacts;
    }

    public String getDeploymentProperties() {
        return deploymentProperties;
    }

    public IncludesExcludes getArtifactDeploymentPatterns() {
        return artifactDeploymentPatterns;
    }

    public boolean isDeployBuildInfo() {
        return deployBuildInfo;
    }

    public String getCustomBuildName() {
        return customBuildName;
    }

    public boolean isOverrideBuildName() {
        return overrideBuildName;
    }

    public boolean isRecordAllDependencies() {
        return recordAllDependencies;
    }

    public ArtifactoryServer getArtifactoryServer() {
        return RepositoriesUtils.getArtifactoryServer(getArtifactoryName(), getDescriptor().getArtifactoryServers());
    }

    @SuppressWarnings({"UnusedDeclaration"})
    public String getRepositoryKey() {
        return getDeployerDetails() != null ? getDeployerDetails().getDeployReleaseRepositoryKey() : null;
    }

    public String getDefaultPromotionTargetRepository() {
        //Not implemented
        return null;
    }

    /**
     * @return The snapshots deployment repository. If not defined the releases deployment repository will be returned
     */
    @SuppressWarnings({"UnusedDeclaration"})
    public String getSnapshotsRepositoryKey() {
        return getDeployerDetails() != null ?
                (getDeployerDetails().getDeploySnapshotRepository() != null ? getDeployerDetails().getDeploySnapshotRepository().getRepoKey() :
                        getDeployerDetails().getDeployReleaseRepository().getRepoKey()) :
                null;
    }

    public String getArtifactoryName() {
        return getDeployerDetails() != null ? getDeployerDetails().artifactoryName : null;
    }

    public String getArtifactoryUrl() {
        ArtifactoryServer server = getArtifactoryServer();
        return server != null ? server.getUrl() : null;
    }

    public boolean isIncludeEnvVars() {
        return includeEnvVars;
    }

    public IncludesExcludes getEnvVarsPatterns() {
        return envVarsPatterns;
    }

    public boolean isEnableIssueTrackerIntegration() {
        return enableIssueTrackerIntegration;
    }

    public boolean isAggregateBuildIssues() {
        return aggregateBuildIssues;
    }

    public boolean isEnableResolveArtifacts() {
        return enableResolveArtifacts;
    }

    public String getAggregationBuildStatus() {
        return aggregationBuildStatus;
    }

    public boolean isFilterExcludedArtifactsFromBuild() {
        return filterExcludedArtifactsFromBuild;
    }

    public String getArtifactoryCombinationFilter() {
        return artifactoryCombinationFilter;
    }

    public boolean isMultiConfProject() {
        return getDescriptor().isMultiConfProject();
    }

    public ArtifactoryServer getArtifactoryServer(String artifactoryServerName) {
        return RepositoriesUtils.getArtifactoryServer(artifactoryServerName, getDescriptor().getArtifactoryServers());
    }

    public List<Repository> getReleaseRepositoryList() {
        return RepositoriesUtils.collectRepositories(getDeployerDetails().getDeployReleaseRepository().getKeyFromSelect());
    }

    public List<Repository> getSnapshotRepositoryList() {
        return RepositoriesUtils.collectRepositories(getDeployerDetails().getDeploySnapshotRepository().getKeyFromSelect());
    }

    public List<VirtualRepository> getResolveReleaseRepositoryList() {
        return RepositoriesUtils.collectVirtualRepositories(null, resolverDetails.getResolveReleaseRepository().getKeyFromSelect());
    }

    public List<VirtualRepository> getResolveSnapshotRepositoryList() {
        return RepositoriesUtils.collectVirtualRepositories(null, resolverDetails.getResolveSnapshotRepository().getKeyFromSelect());
    }

    @Override
    public Collection<? extends Action> getProjectActions(AbstractProject project) {
        if (isOverrideBuildName()) {
            return ActionableHelper.getArtifactoryProjectAction(getArtifactoryName(), project, getCustomBuildName());
        } else {
            return ActionableHelper.getArtifactoryProjectAction(getArtifactoryName(), project);
        }
    }

    @Override
    public Environment setUp(final AbstractBuild build, final Launcher launcher, final BuildListener listener)
            throws IOException, InterruptedException {

        final String artifactoryServerName = getArtifactoryName();
        if (StringUtils.isBlank(artifactoryServerName)) {
            return super.setUp(build, launcher, listener);
        }
        final ArtifactoryServer artifactoryServer = getArtifactoryServer(artifactoryServerName);
        if (artifactoryServer == null) {
            listener.getLogger().format("No Artifactory server configured for %s. " +
                    "Please check your configuration.", artifactoryServerName).println();
            build.setResult(Result.FAILURE);
            throw new IllegalArgumentException("No Artifactory server configured for " + artifactoryServerName);
        }

        PublisherContext.Builder publisherBuilder = new PublisherContext.Builder().artifactoryServer(artifactoryServer)
                .serverDetails(getDeployerDetails()).deployerOverrider(ArtifactoryMaven3Configurator.this)
                .discardOldBuilds(isDiscardOldBuilds())
                .deployArtifacts(isDeployArtifacts()).includesExcludes(getArtifactDeploymentPatterns())
                .skipBuildInfoDeploy(!deployBuildInfo).recordAllDependencies(isRecordAllDependencies())
                .includeEnvVars(isIncludeEnvVars()).envVarsPatterns(getEnvVarsPatterns())
                .discardBuildArtifacts(isDiscardBuildArtifacts()).asyncBuildRetention(isAsyncBuildRetention())
                .deploymentProperties(getDeploymentProperties()).enableIssueTrackerIntegration(isEnableIssueTrackerIntegration())
                .aggregateBuildIssues(isAggregateBuildIssues()).aggregationBuildStatus(getAggregationBuildStatus())
                .filterExcludedArtifactsFromBuild(isFilterExcludedArtifactsFromBuild())
                .artifactoryPluginVersion(ActionableHelper.getArtifactoryPluginVersion())
                .overrideBuildName(isOverrideBuildName())
                .customBuildName(getCustomBuildName());

        if (isMultiConfProject(build) && isDeployArtifacts()) {
            if (StringUtils.isBlank(getArtifactoryCombinationFilter())) {
                String error = "The field \"Combination Matches\" is empty, but is defined as mandatory!";
                listener.getLogger().println(error);
                build.setResult(Result.FAILURE);
                throw new IllegalArgumentException(error);
            }
            boolean isFiltered = MultiConfigurationUtils.isfiltrated(build, getArtifactoryCombinationFilter());
            if (isFiltered) {
                publisherBuilder.skipBuildInfoDeploy(true).deployArtifacts(false);
            }
        }

        ResolverContext resolver = null;
        if (isEnableResolveArtifacts()) {
            CredentialsConfig credentialResolver = CredentialManager.getPreferredResolver(
                    ArtifactoryMaven3Configurator.this, getArtifactoryServer());
            resolver = new ResolverContext(getArtifactoryServer(), getResolverDetails(), credentialResolver.getCredentials(build.getProject()),
                    ArtifactoryMaven3Configurator.this);
        }
        final ResolverContext resolverContext = resolver;
        final PublisherContext publisherContext = publisherBuilder.build();
        build.setResult(Result.SUCCESS);

        return new Environment() {
            @Override
            public void buildEnvVars(Map<String, String> env) {
                try {
                    ExtractorUtils.addBuilderInfoArguments(env, build, listener, publisherContext, resolverContext, build.getWorkspace(), launcher);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }

            @Override
            public boolean tearDown(AbstractBuild build, BuildListener listener) {
                Result result = build.getResult();
                if (deployBuildInfo && result != null && result.isBetterOrEqualTo(Result.SUCCESS)) {
                    String buildName = BuildUniqueIdentifierHelper.getBuildNameConsiderOverride(ArtifactoryMaven3Configurator.this, build);
                    build.getActions().add(new BuildInfoResultAction(getArtifactoryUrl(), build, buildName));
                    build.getActions().add(new UnifiedPromoteBuildAction(build, ArtifactoryMaven3Configurator.this));
                }
                return true;
            }
        };
    }

    private boolean isMultiConfProject(AbstractBuild build) {
        return (build.getProject().getClass().equals(MatrixConfiguration.class));
    }

    @Override
    public DescriptorImpl getDescriptor() {
        return (DescriptorImpl) super.getDescriptor();
    }

    @Extension(optional = true)
    public static class DescriptorImpl extends AbstractBuildWrapperDescriptor {
        private static final String DISPLAY_NAME = "Maven3-Artifactory Integration";
        private static final String CONFIG_PREFIX = "maven3";

        public DescriptorImpl() {
            super(ArtifactoryMaven3Configurator.class, DISPLAY_NAME, CONFIG_PREFIX);
            load();
        }

        @SuppressWarnings("unused")
        @JavaScriptMethod
        public RefreshServerResponse refreshFromArtifactory(String url, String credentialsId, String username, String password, boolean overrideCredentials) {
            return super.refreshDeployersFromArtifactory(url, credentialsId, username, password, overrideCredentials, false);
        }

        @JavaScriptMethod
        public RefreshServerResponse refreshResolversFromArtifactory(String url, String credentialsId, String username, String password, boolean overrideCredentials) {
            return super.refreshResolversFromArtifactory(url, credentialsId, username, password, overrideCredentials);
        }

        @SuppressWarnings("unused")
        @RequirePOST
        public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item project) {
            return PluginsUtils.fillPluginCredentials(project);
        }
    }

    /**
     * Page Converter
     */
    public static final class ConverterImpl extends DeployerResolverOverriderConverter {
        public ConverterImpl(XStream2 xstream) {
            super(xstream);
        }
    }
}


text:
namespace cdif {
    template <Scope TScope, typename TService, typename ... TCtorArgs>
    class ListRegistrationBuilder : public RegistrationBuilder<TScope, TService, TCtorArgs...>
    {
        private:
            typedef std::array<std::function<std::any ()>, sizeof...(TCtorArgs)> ResolverCollection;

            template <typename T>
            std::function<T (const Container&)> buildListResolverFor(const std::function<std::initializer_list<TService> (const Container&)>& initializerFactory) const
            {
                return [initializerFactory] (const Container& ctx) -> T
                {
                    return initializerFactory(ctx);
                };
            }

            template <typename TRet>
            void buildRegistrationFrom(
                const std::function<TRet (const Container&)>& factory) const
            {
                this->m_ctx->template bind<TRet>(Registration(factory), this->m_name);
            }

            template <typename TRet, typename TBase = typename get_base_type<TRet>::type>
            void buildScopedRegistrationFrom(
                const std::function<TBase (const Container&)>& factory) const
            {
                this->m_ctx->template bind<TRet>(Registration(buildScopedFactory<TRet>(factory)), this->m_name);
            }

            void buildImpl() const
            {
                buildRegistrationFrom(buildListFrom<std::vector<TService>, TService, TCtorArgs...>(this->m_dependencyResolvers));
                buildRegistrationFrom(buildListFrom<std::list<TService>, TService, TCtorArgs...>(this->m_dependencyResolvers));
                buildRegistrationFrom(buildArrayFrom<std::array<TService, sizeof...(TCtorArgs)>, TService, TCtorArgs...>(this->m_dependencyResolvers));
            }

            template <typename T, typename TBase = typename get_base_type<T>::type>
            std::function<T (const Container&)> buildScopedFactory(
                const std::function<TBase (const Container&)>& resolver) const
            {
                std::function scopedFactory = this->template getScopedFactory<T>();
                return [resolver, scopedFactory] (const Container& ctx) -> decltype(auto)
                    {
                        return scopedFactory(resolver, ctx);
                    };
            }

            void buildScoped()
            {
                auto vectorFactory = buildListFrom<std::vector<TService>, TService, TCtorArgs...>(this->m_dependencyResolvers);
                buildScopedRegistrationFrom<std::vector<TService>&>(vectorFactory);
                buildScopedRegistrationFrom<std::vector<TService>*>(vectorFactory);
                buildScopedRegistrationFrom<std::shared_ptr<std::vector<TService>>>(vectorFactory);

                auto listFactory = buildListFrom<std::list<TService>, TService, TCtorArgs...>(this->m_dependencyResolvers);
                buildScopedRegistrationFrom<std::list<TService>&>(listFactory);
                buildScopedRegistrationFrom<std::list<TService>*>(listFactory);
                buildScopedRegistrationFrom<std::shared_ptr<std::list<TService>>>(listFactory);

                using arrayType = std::array<TService, sizeof...(TCtorArgs)>;
                auto arrayFactory = buildArrayFrom<arrayType, TService, TCtorArgs...>(this->m_dependencyResolvers);
                buildScopedRegistrationFrom<arrayType&>(arrayFactory);
                buildScopedRegistrationFrom<arrayType*>(arrayFactory);
                buildScopedRegistrationFrom<std::shared_ptr<arrayType>>(arrayFactory);
            }

        public:
            ListRegistrationBuilder(Container* ctx)
                : RegistrationBuilder<TScope, TService, TCtorArgs...>(ctx)
            {
            }

            ListRegistrationBuilder(Container* ctx, ResolverCollection resolvers, std::string name)
                : RegistrationBuilder<TScope, TService, TCtorArgs...>(ctx, resolvers, name) {}

            virtual ~ListRegistrationBuilder() {}
            ListRegistrationBuilder (const ListRegistrationBuilder&) = default;
            ListRegistrationBuilder& operator=(const ListRegistrationBuilder&) = default;
            ListRegistrationBuilder (ListRegistrationBuilder&&) = default;
            ListRegistrationBuilder& operator=(ListRegistrationBuilder&&) = default;

            void build() override
            {
                if constexpr (TScope == Scope::PerDependency)
                    buildImpl();
                else
                    buildScoped();
            }

            template <Scope TNewScope>
            auto in()
            {
                return ListRegistrationBuilder<TNewScope, TService, TCtorArgs...>(
                    this->m_ctx, this->m_dependencyResolvers, this->m_name);
            }
    };
}


text:
"""This module implements the Choices system for user preferences.
The environment variable CHOICESPATH gives a list of directories to search
for choices. Changed choices are saved back to the first directory in the
list."""

import os
from os.path import exists

try:
	path = os.environ['CHOICESPATH']
	paths = path.split(':')
except KeyError:
	paths = [ os.environ['HOME'] + '/Choices',
		  '/usr/local/share/Choices',
		  '/usr/share/Choices' ]

def load(dir, leaf):
	"""When you want to load user choices, use this function. 'dir' is
	the subdirectory within Choices where the choices are saved (usually
	this will be the name of your program). 'leaf' is the file within it.
	If serveral files are present, the most important one is returned. If
	no files are there, returns None.
	Eg ('Edit', 'Options') - > '/usr/local/share/Choices/Edit/Options'"""

	for path in paths:
		if path:
			full = path + '/' + dir + '/' + leaf
			if exists(full):
				return full

	return None

def save(dir, leaf, create = 1):
	"""Returns a path to save to, or None if saving is disabled.
	If 'create' is FALSE then no directories are created. 'dir' and
	'leaf' are as for load()."""

	p = paths[0]
	if not p:
		return None

	if create and not os.path.exists(p):
		os.mkdir(p, 0x1ff)
	p = p + '/' + dir
	if create and not os.path.exists(p):
		os.mkdir(p, 0x1ff)

	return p + '/' + leaf


text:
using Microsoft.Azure.NotificationHubs;
using Swashbuckle.Swagger.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using TRex.Metadata;
using System.Configuration;

namespace NotificationHubAPIApp.Controllers
{
    public class NotificationController : ApiController
    {
        [HttpPost]
        [SwaggerResponse(HttpStatusCode.OK, Type = typeof(NotificationOutcome))]
        [SwaggerResponse(HttpStatusCode.BadRequest, Type = typeof(ConfigurationErrorsException))]
        [Metadata("Send Message (GCM)")]
        public async System.Threading.Tasks.Task<HttpResponseMessage> SendGCMNotification([Metadata("Connection String")]string connectionString, [Metadata("Hub Name")]string hubName, [Metadata("Message")]string message, [Metadata("Toast Tags")]string tags = null)
        {
            try
            {
                NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString(connectionString, hubName);

                NotificationOutcome result;
                if (!string.IsNullOrEmpty(tags))
                {
                    result = await hub.SendGcmNativeNotificationAsync(message, tags);
                }
                else
                {
                    result = await hub.SendGcmNativeNotificationAsync(message);
                }

                return Request.CreateResponse<NotificationOutcome>(HttpStatusCode.OK, result);
            }
            catch (ConfigurationErrorsException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.BareMessage);
            }
        }

        [HttpPost]
        [SwaggerResponse(HttpStatusCode.OK, Type = typeof(NotificationOutcome))]
        [SwaggerResponse(HttpStatusCode.BadRequest, Type = typeof(ConfigurationErrorsException))]
        [Metadata("Send Message (MPNS)")]
        public async System.Threading.Tasks.Task<HttpResponseMessage> SendMPNSNotification([Metadata("Connection String")]string connectionString, [Metadata("Hub Name")]string hubName, [Metadata("Toast XML")]string message, [Metadata("Toast Tags")]string tags = null)
        {
            try
            {
                NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString(connectionString, hubName);

                NotificationOutcome result;
                if (!string.IsNullOrEmpty(tags))
                {
                    result = await hub.SendMpnsNativeNotificationAsync(message, tags);
                }
                else
                {
                    result = await hub.SendMpnsNativeNotificationAsync(message);
                }

                return Request.CreateResponse<NotificationOutcome>(HttpStatusCode.OK, result);
            }
            catch (ConfigurationErrorsException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.BareMessage);
            }
        }

        [HttpPost]
        [SwaggerResponse(HttpStatusCode.OK, Type = typeof(NotificationOutcome))]
        [SwaggerResponse(HttpStatusCode.BadRequest, Type = typeof(ConfigurationErrorsException))]
        [Metadata("Send Message (Windows Native)")]
        public async System.Threading.Tasks.Task<HttpResponseMessage> SendWindowsNativeNotification([Metadata("Connection String")]string connectionString, [Metadata("Hub Name")]string hubName, [Metadata("Toast XML")]string message, [Metadata("Toast Tags")]string tags = null)
        {
            try
            {
                NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString(connectionString, hubName);

                NotificationOutcome result;
                if (!string.IsNullOrEmpty(tags))
                {
                    result = await hub.SendWindowsNativeNotificationAsync(message, tags);
                }
                else
                {
                    result = await hub.SendWindowsNativeNotificationAsync(message);
                }

                return Request.CreateResponse<NotificationOutcome>(HttpStatusCode.OK, result);
            }
            catch (ConfigurationErrorsException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.BareMessage);
            }
        }

        [HttpPost]
        [SwaggerResponse(HttpStatusCode.OK, Type = typeof(NotificationOutcome))]
        [SwaggerResponse(HttpStatusCode.BadRequest, Type = typeof(ConfigurationErrorsException))]
        [Metadata("Send RAW Message (Windows Native)")]
        public async System.Threading.Tasks.Task<HttpResponseMessage> SendWindowsNativeRawNotification([Metadata("Connection String")]string connectionString, [Metadata("Hub Name")]string hubName, [Metadata("Toast RAW")]string message, [Metadata("Toast Tags")]string tags = null)
        {
            try
            {
                NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString(connectionString, hubName);

                Notification notification = new WindowsNotification(message);
                notification.Headers.Add("X-WNS-Type", "wns/raw");

                NotificationOutcome result;
                if (!string.IsNullOrEmpty(tags))
                {
                    result = await hub.SendNotificationAsync(notification, tags);
                }
                else
                {
                    result = await hub.SendNotificationAsync(notification);
                }

                return Request.CreateResponse<NotificationOutcome>(HttpStatusCode.OK, result);
            }
            catch (ConfigurationErrorsException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.BareMessage);
            }
        }

        [HttpPost]
        [SwaggerResponse(HttpStatusCode.OK, Type = typeof(NotificationOutcome))]
        [SwaggerResponse(HttpStatusCode.BadRequest, Type = typeof(ConfigurationErrorsException))]
        [Metadata("Send Message (Baidu Native)")]
        public async System.Threading.Tasks.Task<HttpResponseMessage> SendBaiduNativeNotification([Metadata("Connection String")]string connectionString, [Metadata("Hub Name")]string hubName, [Metadata("Message")]string message, [Metadata("Toast Tags")]string tags = null)
        {
            try
            {
                NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString(connectionString, hubName);

                NotificationOutcome result;
                if (!string.IsNullOrEmpty(tags))
                {
                    result = await hub.SendBaiduNativeNotificationAsync(message, tags);
                }
                else
                {
                    result = await hub.SendBaiduNativeNotificationAsync(message);
                }

                return Request.CreateResponse<NotificationOutcome>(HttpStatusCode.OK, result);
            }
            catch (ConfigurationErrorsException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.BareMessage);
            }
        }

        [HttpPost]
        [SwaggerResponse(HttpStatusCode.OK, Type = typeof(NotificationOutcome))]
        [SwaggerResponse(HttpStatusCode.BadRequest, Type = typeof(ConfigurationErrorsException))]
        [Metadata("Send Message (Apple Native)")]
        public async System.Threading.Tasks.Task<HttpResponseMessage> SendAppleNativeNotification([Metadata("Connection String")]string connectionString, [Metadata("Hub Name")]string hubName, [Metadata("JSON Payload")]string message, [Metadata("Toast Tags")]string tags = null)
        {
            try
            {
                NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString(connectionString, hubName);

                NotificationOutcome result;
                if (!string.IsNullOrEmpty(tags))
                {
                    result = await hub.SendAppleNativeNotificationAsync(message, tags);
                }
                else
                {
                    result = await hub.SendAppleNativeNotificationAsync(message);
                }

                return Request.CreateResponse<NotificationOutcome>(HttpStatusCode.OK, result);
            }
            catch (ConfigurationErrorsException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.BareMessage);
            }
        }

		[HttpPost]
		[SwaggerResponse(HttpStatusCode.OK, Type = typeof(NotificationOutcome))]
		[SwaggerResponse(HttpStatusCode.BadRequest, Type = typeof(ConfigurationErrorsException))]
		[Metadata("Send Message with device list (Apple and Google)")]
		public async System.Threading.Tasks.Task<HttpResponseMessage> SendNotificationByDeviceList([Metadata("Connection String")]string connectionString, [Metadata("Hub Name")]string hubName, [Metadata("CSV Path")]string csvPath, [Metadata("Toast Tags")]string tags = null)
		{
			try
			{
				NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString(connectionString, hubName);

				NotificationOutcome result;
				if (!string.IsNullOrEmpty(tags))
				{

					result = await hub.SendAppleNativeNotificationAsync("{}", tags);
				}
				else
				{
					result = await hub.SendAppleNativeNotificationAsync("{}");
				}

				return Request.CreateResponse<NotificationOutcome>(HttpStatusCode.OK, result);
			}
			catch (ConfigurationErrorsException ex)
			{
				return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.BareMessage);
			}
		}
    }
}


text:
import types
from pathlib import Path
import logging
import os

from groundwork.configuration.exceptions import InvalidParameter
from groundwork.configuration.config import Config

class ConfigManager:
    """
    Loads different configuration files and sets their attributes as attributes of its own instance.

    A configuration file must be an importable python file.

    Only uppercase attributes are loaded. Everything else is ignored. Example::

        import os
        APP_NAME = "My APP"                     # Is used
        APP_PATH = os.path.abspath(".")         # Is used
        app_test = "test"                       # Is NOT used
        MY_OWN_VAR = "nice"                     # Is used
    """
    def __init__(self, config_files=[]):
        #: An instance of :class:`~groundwork.configuration.configmanager.Config` for storing all
        #: configuration parameters.
        self.config = None

        self.log = logging.getLogger(__name__)
        self.log.debug("Starting Configuration initialisation")
        self.invalid_parameters = ["FILES"]

        if isinstance(config_files, list):
            self.config_files = config_files
        else:
            raise TypeError("config_files must be a list of strings")

        absolute_files = []
        for file in config_files:
            if not isinstance(file, str):
                raise TypeError("config_files members must be strings")
            try:
                absolute_file = Path(file).resolve()
            except IOError:
                self.log.warning("Config-file not found %s" % file)
                continue
            else:
                absolute_files.append(str(absolute_file))

        self.config_files = absolute_files

    def load(self, config_files):
        """
        Creates a configuration instance from class :class:`~groundwork.configuration.configmanager.Config` from all
        files in self.files and set the dictionary items as attributes of of this instance.

        :return: Instance of :class:`~groundwork.configuration.configmanager.Config`
        """
        config = Config()

        for config_file in config_files:
            if not os.path.isabs(config_file):
                config_file = os.path.join(os.getcwd(), config_file)

            self.log.debug("Loading configuration from %s" % config_file)
            d = types.ModuleType('config')
            d.__file__ = config_file
            try:
                with open(config_file) as current_config_file:
                    exec(compile(current_config_file.read(), config_file, 'exec'), d.__dict__)
            except IOError as e:
                e.strerror = 'Unable to load configuration file (%s)' % e.strerror
                raise
            for key in dir(d):
                if key.isupper():
                    if key not in self.invalid_parameters:
                        setattr(config, key, getattr(d, key))
                    else:
                        raise InvalidParameter("%s is not allowed as name for a configuration parameter" % key)
        return config


text:
package pl.kofun.mavis.tasks;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.DateAxis;
import org.jfree.chart.axis.DateTickUnit;
import org.jfree.chart.axis.DateTickUnitType;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.axis.NumberTickUnit;
import org.jfree.chart.plot.XYPlot;
import org.jfree.data.time.Month;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.TimeSeriesCollection;
import org.jfree.data.time.TimeSeriesDataItem;

import pl.kofun.mavis.Options;
import pl.kofun.mavis.Interfaces.Counter;
import pl.kofun.mavis.Interfaces.MainTask;
import pl.kofun.mavis.counters.BlogCounter;
import pl.kofun.mavis.counters.LinesCounter;
import pl.kofun.mavis.counters.PeriodToCount;
import pl.kofun.mavis.counters.TrelloCounter;
import pl.kofun.mavis.utils.FileNameCreator;
import pl.kofun.mavis.utils.FilterBuilder;
import pl.kofun.mavis.utils.yearFileNameCreator;

public class YearPlotter implements MainTask{

	private LinesCounter booksFileCounter;
	private LinesCounter gamesFileCounter;
	private BlogCounter blogCounter;
	private BlogCounter devCounter;
	private TrelloCounter tasksCounter;
	private int yearToPlot;

	private FileNameCreator fileNameCreator;

	public YearPlotter(Options options)
	{
		if(options.validForPlot())
		{
			booksFileCounter = new LinesCounter(options.get("booksfileName"));
			gamesFileCounter = new LinesCounter(options.get("gamesfileName"));
			blogCounter = new BlogCounter(options.get("blogUrl"));
			devCounter = new BlogCounter(options.get("devUrl"));
			tasksCounter = new TrelloCounter(options.get("apiKey"), options.get("apiToken"));
		}

		if(options.containsKey("yeartoPlot"))
		{
			yearToPlot = Integer.parseInt(options.get("yeartoPlot"));
		}
		else
		{
			yearToPlot = Calendar.getInstance().get(Calendar.YEAR);
		}

		fileNameCreator = new yearFileNameCreator();
	}

	@Override
	public void execute() {
		if(booksFileCounter != null || gamesFileCounter != null)
		{
			try
			{
				TimeSeries books = new TimeSeries("Books");
				TimeSeries games = new TimeSeries("Games");
				TimeSeries posts = new TimeSeries("Posts");
				TimeSeries devposts = new TimeSeries("Dev posts");
				TimeSeries tasks = new TimeSeries("Tasks");

				FilterBuilder filterMaker = new FilterBuilder();

				Month currentMonth;
				PeriodToCount currentPeriod = new PeriodToCount();
				currentPeriod.Year = yearToPlot;

				for(int i=1; i<13; ++i)
				{
					currentMonth = new Month(i,yearToPlot);
					currentPeriod.Filter = filterMaker.makeFilter(i-1,yearToPlot);
					currentPeriod.Month = i-1;

					books.add(createFileSeriesDataItem(currentMonth,currentPeriod, booksFileCounter));
					games.add(createFileSeriesDataItem(currentMonth, currentPeriod, gamesFileCounter));
					posts.add(createFileSeriesDataItem(currentMonth,currentPeriod,blogCounter));
					devposts.add(createFileSeriesDataItem(currentMonth,currentPeriod, devCounter));
					tasks.add(createFileSeriesDataItem(currentMonth,currentPeriod,tasksCounter));
				}

				TimeSeriesCollection dataset = new TimeSeriesCollection();
				dataset.addSeries(books);
				dataset.addSeries(games);
				dataset.addSeries(posts);
				dataset.addSeries(devposts);
				dataset.addSeries(tasks);

				JFreeChart chart = ChartFactory.createTimeSeriesChart(
						String.valueOf(yearToPlot),
						"Month",
						"Quantity",
						dataset,
						true,
						true,
						false
						);

				String chartFilename = fileNameCreator.createName(yearToPlot);

				XYPlot plot = chart.getXYPlot();
				NumberAxis yaxis = (NumberAxis) plot.getRangeAxis();
				yaxis.setTickUnit(new NumberTickUnit(1));

				DateAxis xaxis = (DateAxis) plot.getDomainAxis();

				xaxis.setTickUnit(new DateTickUnit(DateTickUnitType.MONTH, 1));
				xaxis.setDateFormatOverride(new SimpleDateFormat("MMM"));

				ChartUtilities.saveChartAsJPEG(new File(chartFilename), chart, 500, 300);

			}catch(IOException e)
			{
				System.out.println(e);
			}

			System.out.println("All green");
		}
		else
		{
			this.usage();
		}
	}

	private TimeSeriesDataItem createFileSeriesDataItem(Month currentMonth, PeriodToCount currentPeriod, Counter counter)
	{
			counter.setPeriodToCount(currentPeriod);
			return new TimeSeriesDataItem(currentMonth, counter.count());
	}

	@Override
	public void usage() {
		System.out.println("For Year Plotter you must define:");
		System.out.println("books filename as -b (argument) or booksfileName : (argument) inside txt file");
		System.out.println("games filename as -g (argument) or gamesfileName : (argument) inside txt file");
		System.out.println("You may want to specify");
		System.out.println("Year to plot by -y (year) in command line");
	}
}


text:
namespace OpenInvoicePeru.Comun.Dto.Intercambio
{
    public class FirmadoResponse : RespuestaComun
    {
        public string TramaXmlFirmado { get; set; }

        public string ResumenFirma { get; set; }

        public string ValorFirma { get; set; }
    }
}