text:
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/swap.h>
#include <linux/module.h>
#include <linux/pagemap.h>
#include <linux/pagevec.h>
#include <linux/task_io_accounting_ops.h>
#include <linux/buffer_head.h>	/* grr. try_to_release_page,
				   do_invalidatepage */

/**
 * do_invalidatepage - invalidate part of all of a page
 * @page: the page which is affected
 * @offset: the index of the truncation point
 *
 * do_invalidatepage() is called when all or part of the page has become
 * invalidated by a truncate operation.
 *
 * do_invalidatepage() does not have to release all buffers, but it must
 * ensure that no dirty buffer is left outside @offset and that no I/O
 * is underway against any of the blocks which are outside the truncation
 * point.  Because the caller is about to free (and possibly reuse) those
 * blocks on-disk.
 */
void do_invalidatepage(struct page *page, unsigned long offset)
{
	void (*invalidatepage)(struct page *, unsigned long);
	invalidatepage = page->mapping->a_ops->invalidatepage;
#ifdef CONFIG_BLOCK
	if (!invalidatepage)
		invalidatepage = block_invalidatepage;
#endif
	if (invalidatepage)
		(*invalidatepage)(page, offset);
}

static inline void truncate_partial_page(struct page *page, unsigned partial)
{
	memclear_highpage_flush(page, partial, PAGE_CACHE_SIZE-partial);
	if (PagePrivate(page))
		do_invalidatepage(page, partial);
}

/*
 * This cancels just the dirty bit on the kernel page itself, it
 * does NOT actually remove dirty bits on any mmap's that may be
 * around. It also leaves the page tagged dirty, so any sync
 * activity will still find it on the dirty lists, and in particular,
 * clear_page_dirty_for_io() will still look at the dirty bits in
 * the VM.
 *
 * Doing this should *normally* only ever be done when a page
 * is truncated, and is not actually mapped anywhere at all. However,
 * fs/buffer.c does this when it notices that somebody has cleaned
 * out all the buffers on a page without actually doing it through
 * the VM. Can you say "ext3 is horribly ugly"? Tought you could.
 */
void cancel_dirty_page(struct page *page, unsigned int account_size)
{
	if (TestClearPageDirty(page)) {
		struct address_space *mapping = page->mapping;
		if (mapping && mapping_cap_account_dirty(mapping)) {
			dec_zone_page_state(page, NR_FILE_DIRTY);
			if (account_size)
				task_io_account_cancelled_write(account_size);
		}
	}
}
EXPORT_SYMBOL(cancel_dirty_page);

/*
 * If truncate cannot remove the fs-private metadata from the page, the page
 * becomes anonymous.  It will be left on the LRU and may even be mapped into
 * user pagetables if we're racing with filemap_nopage().
 *
 * We need to bale out if page->mapping is no longer equal to the original
 * mapping.  This happens a) when the VM reclaimed the page while we waited on
 * its lock, b) when a concurrent invalidate_mapping_pages got there first and
 * c) when tmpfs swizzles a page between a tmpfs inode and swapper_space.
 */
static void
truncate_complete_page(struct address_space *mapping, struct page *page)
{
	if (page->mapping != mapping)
		return;

	cancel_dirty_page(page, PAGE_CACHE_SIZE);

	if (PagePrivate(page))
		do_invalidatepage(page, 0);

	ClearPageUptodate(page);
	ClearPageMappedToDisk(page);
	remove_from_page_cache(page);
	page_cache_release(page);	/* pagecache ref */
}

/*
 * This is for invalidate_mapping_pages().  That function can be called at
 * any time, and is not supposed to throw away dirty pages.  But pages can
 * be marked dirty at any time too, so use remove_mapping which safely
 * discards clean, unused pages.
 *
 * Returns non-zero if the page was successfully invalidated.
 */
static int
invalidate_complete_page(struct address_space *mapping, struct page *page)
{
	int ret;

	if (page->mapping != mapping)
		return 0;

	if (PagePrivate(page) && !try_to_release_page(page, 0))
		return 0;

	ret = remove_mapping(mapping, page);

	return ret;
}

/**
 * truncate_inode_pages - truncate range of pages specified by start and
 * end byte offsets
 * @mapping: mapping to truncate
 * @lstart: offset from which to truncate
 * @lend: offset to which to truncate
 *
 * Truncate the page cache, removing the pages that are between
 * specified offsets (and zeroing out partial page
 * (if lstart is not page aligned)).
 *
 * Truncate takes two passes - the first pass is nonblocking.  It will not
 * block on page locks and it will not block on writeback.  The second pass
 * will wait.  This is to prevent as much IO as possible in the affected region.
 * The first pass will remove most pages, so the search cost of the second pass
 * is low.
 *
 * When looking at page->index outside the page lock we need to be careful to
 * copy it into a local to avoid races (it could change at any time).
 *
 * We pass down the cache-hot hint to the page freeing code.  Even if the
 * mapping is large, it is probably the case that the final pages are the most
 * recently touched, and freeing happens in ascending file offset order.
 */
void truncate_inode_pages_range(struct address_space *mapping,
				loff_t lstart, loff_t lend)
{
	const pgoff_t start = (lstart + PAGE_CACHE_SIZE-1) >> PAGE_CACHE_SHIFT;
	pgoff_t end;
	const unsigned partial = lstart & (PAGE_CACHE_SIZE - 1);
	struct pagevec pvec;
	pgoff_t next;
	int i;

	if (mapping->nrpages == 0)
		return;

	BUG_ON((lend & (PAGE_CACHE_SIZE - 1)) != (PAGE_CACHE_SIZE - 1));
	end = (lend >> PAGE_CACHE_SHIFT);

	pagevec_init(&pvec, 0);
	next = start;
	while (next <= end &&
	       pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) {
		for (i = 0; i < pagevec_count(&pvec); i++) {
			struct page *page = pvec.pages[i];
			pgoff_t page_index = page->index;

			if (page_index > end) {
				next = page_index;
				break;
			}

			if (page_index > next)
				next = page_index;
			next++;
			if (TestSetPageLocked(page))
				continue;
			if (PageWriteback(page)) {
				unlock_page(page);
				continue;
			}
			truncate_complete_page(mapping, page);
			unlock_page(page);
		}
		pagevec_release(&pvec);
		cond_resched();
	}

	if (partial) {
		struct page *page = find_lock_page(mapping, start - 1);
		if (page) {
			wait_on_page_writeback(page);
			truncate_partial_page(page, partial);
			unlock_page(page);
			page_cache_release(page);
		}
	}

	next = start;
	for ( ; ; ) {
		cond_resched();
		if (!pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) {
			if (next == start)
				break;
			next = start;
			continue;
		}
		if (pvec.pages[0]->index > end) {
			pagevec_release(&pvec);
			break;
		}
		for (i = 0; i < pagevec_count(&pvec); i++) {
			struct page *page = pvec.pages[i];

			if (page->index > end)
				break;
			lock_page(page);
			wait_on_page_writeback(page);
			if (page->index > next)
				next = page->index;
			next++;
			truncate_complete_page(mapping, page);
			unlock_page(page);
		}
		pagevec_release(&pvec);
	}
}
EXPORT_SYMBOL(truncate_inode_pages_range);

/**
 * truncate_inode_pages - truncate *all* the pages from an offset
 * @mapping: mapping to truncate
 * @lstart: offset from which to truncate
 *
 * Called under (and serialised by) inode->i_mutex.
 */
void truncate_inode_pages(struct address_space *mapping, loff_t lstart)
{
	truncate_inode_pages_range(mapping, lstart, (loff_t)-1);
}
EXPORT_SYMBOL(truncate_inode_pages);

/**
 * invalidate_mapping_pages - Invalidate all the unlocked pages of one inode
 * @mapping: the address_space which holds the pages to invalidate
 * @start: the offset 'from' which to invalidate
 * @end: the offset 'to' which to invalidate (inclusive)
 *
 * This function only removes the unlocked pages, if you want to
 * remove all the pages of one inode, you must call truncate_inode_pages.
 *
 * invalidate_mapping_pages() will not block on IO activity. It will not
 * invalidate pages which are dirty, locked, under writeback or mapped into
 * pagetables.
 */
unsigned long invalidate_mapping_pages(struct address_space *mapping,
				pgoff_t start, pgoff_t end)
{
	struct pagevec pvec;
	pgoff_t next = start;
	unsigned long ret = 0;
	int i;

	pagevec_init(&pvec, 0);
	while (next <= end &&
			pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) {
		for (i = 0; i < pagevec_count(&pvec); i++) {
			struct page *page = pvec.pages[i];
			pgoff_t index;
			int lock_failed;

			lock_failed = TestSetPageLocked(page);

			/*
			 * We really shouldn't be looking at the ->index of an
			 * unlocked page.  But we're not allowed to lock these
			 * pages.  So we rely upon nobody altering the ->index
			 * of this (pinned-by-us) page.
			 */
			index = page->index;
			if (index > next)
				next = index;
			next++;
			if (lock_failed)
				continue;

			if (PageDirty(page) || PageWriteback(page))
				goto unlock;
			if (page_mapped(page))
				goto unlock;
			ret += invalidate_complete_page(mapping, page);
unlock:
			unlock_page(page);
			if (next > end)
				break;
		}
		pagevec_release(&pvec);
	}
	return ret;
}
EXPORT_SYMBOL(invalidate_mapping_pages);

/*
 * This is like invalidate_complete_page(), except it ignores the page's
 * refcount.  We do this because invalidate_inode_pages2() needs stronger
 * invalidation guarantees, and cannot afford to leave pages behind because
 * shrink_list() has a temp ref on them, or because they're transiently sitting
 * in the lru_cache_add() pagevecs.
 */
static int
invalidate_complete_page2(struct address_space *mapping, struct page *page)
{
	if (page->mapping != mapping)
		return 0;

	if (PagePrivate(page) && !try_to_release_page(page, GFP_KERNEL))
		return 0;

	write_lock_irq(&mapping->tree_lock);
	if (PageDirty(page))
		goto failed;

	BUG_ON(PagePrivate(page));
	__remove_from_page_cache(page);
	write_unlock_irq(&mapping->tree_lock);
	ClearPageUptodate(page);
	page_cache_release(page);	/* pagecache ref */
	return 1;
failed:
	write_unlock_irq(&mapping->tree_lock);
	return 0;
}

static int do_launder_page(struct address_space *mapping, struct page *page)
{
	if (!PageDirty(page))
		return 0;
	if (page->mapping != mapping || mapping->a_ops->launder_page == NULL)
		return 0;
	return mapping->a_ops->launder_page(page);
}

/**
 * invalidate_inode_pages2_range - remove range of pages from an address_space
 * @mapping: the address_space
 * @start: the page offset 'from' which to invalidate
 * @end: the page offset 'to' which to invalidate (inclusive)
 *
 * Any pages which are found to be mapped into pagetables are unmapped prior to
 * invalidation.
 *
 * Returns -EIO if any pages could not be invalidated.
 */
int invalidate_inode_pages2_range(struct address_space *mapping,
				  pgoff_t start, pgoff_t end)
{
	struct pagevec pvec;
	pgoff_t next;
	int i;
	int ret = 0;
	int did_range_unmap = 0;
	int wrapped = 0;

	pagevec_init(&pvec, 0);
	next = start;
	while (next <= end && !wrapped &&
		pagevec_lookup(&pvec, mapping, next,
			min(end - next, (pgoff_t)PAGEVEC_SIZE - 1) + 1)) {
		for (i = 0; i < pagevec_count(&pvec); i++) {
			struct page *page = pvec.pages[i];
			pgoff_t page_index;

			lock_page(page);
			if (page->mapping != mapping) {
				unlock_page(page);
				continue;
			}
			page_index = page->index;
			next = page_index + 1;
			if (next == 0)
				wrapped = 1;
			if (page_index > end) {
				unlock_page(page);
				break;
			}
			wait_on_page_writeback(page);
			while (page_mapped(page)) {
				if (!did_range_unmap) {
					/*
					 * Zap the rest of the file in one hit.
					 */
					unmap_mapping_range(mapping,
					   (loff_t)page_index<<PAGE_CACHE_SHIFT,
					   (loff_t)(end - page_index + 1)
							<< PAGE_CACHE_SHIFT,
					    0);
					did_range_unmap = 1;
				} else {
					/*
					 * Just zap this page
					 */
					unmap_mapping_range(mapping,
					  (loff_t)page_index<<PAGE_CACHE_SHIFT,
					  PAGE_CACHE_SIZE, 0);
				}
			}
			ret = do_launder_page(mapping, page);
			if (ret == 0 && !invalidate_complete_page2(mapping, page))
				ret = -EIO;
			unlock_page(page);
		}
		pagevec_release(&pvec);
		cond_resched();
	}
	return ret;
}
EXPORT_SYMBOL_GPL(invalidate_inode_pages2_range);

/**
 * invalidate_inode_pages2 - remove all pages from an address_space
 * @mapping: the address_space
 *
 * Any pages which are found to be mapped into pagetables are unmapped prior to
 * invalidation.
 *
 * Returns -EIO if any pages could not be invalidated.
 */
int invalidate_inode_pages2(struct address_space *mapping)
{
	return invalidate_inode_pages2_range(mapping, 0, -1);
}
EXPORT_SYMBOL_GPL(invalidate_inode_pages2);


text:
import logging

from django import shortcuts
from django.contrib import messages
from django.core import urlresolvers
from django.utils.translation import ugettext_lazy as _

from horizon import api
from horizon import exceptions
from horizon import tables

LOG = logging.getLogger(__name__)

class AllocateIP(tables.LinkAction):
    name = "allocate"
    verbose_name = _("Allocate IP To Project")
    classes = ("ajax-modal", "btn-allocate")
    url = "horizon:nova:access_and_security:floating_ips:allocate"

    def single(self, data_table, request, *args):
        return shortcuts.redirect('horizon:nova:access_and_security:index')

class ReleaseIPs(tables.BatchAction):
    name = "release"
    action_present = _("Release")
    action_past = _("Released")
    data_type_singular = _("Floating IP")
    data_type_plural = _("Floating IPs")
    classes = ('btn-danger', 'btn-release')

    def action(self, request, obj_id):
        api.tenant_floating_ip_release(request, obj_id)

class AssociateIP(tables.LinkAction):
    name = "associate"
    verbose_name = _("Associate IP")
    url = "horizon:nova:access_and_security:floating_ips:associate"
    classes = ("ajax-modal", "btn-associate")

    def allowed(self, request, fip):
        if fip.instance_id:
            return False
        return True

class DisassociateIP(tables.Action):
    name = "disassociate"
    verbose_name = _("Disassociate IP")
    classes = ("btn-disassociate", "btn-danger")

    def allowed(self, request, fip):
        if fip.instance_id:
            return True
        return False

    def single(self, table, request, obj_id):
        try:
            fip = table.get_object_by_id(int(obj_id))
            api.server_remove_floating_ip(request, fip.instance_id, fip.id)
            LOG.info('Disassociating Floating IP "%s".' % obj_id)
            messages.success(request,
                             _('Successfully disassociated Floating IP: %s')
                             % fip.ip)
        except:
            exceptions.handle(request,
                              _('Unable to disassociate floating IP.'))
        return shortcuts.redirect('horizon:nova:access_and_security:index')

def get_instance_link(datum):
    view = "horizon:nova:instances_and_volumes:instances:detail"
    if datum.instance_id:
        return urlresolvers.reverse(view, args=(datum.instance_id,))
    else:
        return None

class FloatingIPsTable(tables.DataTable):
    ip = tables.Column("ip", verbose_name=_("IP Address"))
    instance = tables.Column("instance_id",
                             link=get_instance_link,
                             verbose_name=_("Instance"),
                             empty_value="-")
    pool = tables.Column("pool",
                         verbose_name=_("Floating IP Pool"),
                         empty_value="-")

    def sanitize_id(self, obj_id):
        return int(obj_id)

    def get_object_display(self, datum):
        return datum.ip

    class Meta:
        name = "floating_ips"
        verbose_name = _("Floating IPs")
        table_actions = (AllocateIP, ReleaseIPs)
        row_actions = (AssociateIP, DisassociateIP, ReleaseIPs)

redpajama_set_name: RedPajamaGithub


text:
from django.conf import settings
from django.contrib.auth.models import User
import erppeek
from .models import OdooUser
from django.core.cache import caches
from django.db import transaction

class OdooAuthBackend(object):

    """
    Authenticate against the user in Odoo
    """
    @transaction.atomic
    def authenticate(self, username=None, password=None):
        config = getattr(settings, "ODOO_HOST", False)
        try:
            odoo_client = erppeek.Client("%s:%d" % (config['HOST'], config['PORT']), db=config['DB'],
                                         user=username, password=password, verbose=False)
        except:
            return None

        caches["odoo_auth"].set('%s_credentials' % username, password, None)

        try:
            user = User.objects.get(username=username)
            odoo_user = user.odoo_user
        except User.DoesNotExist:
            # Create a new user. Note that we can set password
            # to anything, because it won't be checked; the password
            # from Odoo will.
            user = User(username=username, password='get from Odoo')
            user.is_staff = False
            user.is_superuser = False
            user.save()
            odoo_user = OdooUser(user=user)
            odoo_user.save()
        odoo_user.odoo_client = odoo_client
        return user

    def get_user(self, user_id):
        try:
            return User.objects.get(pk=user_id)
        except User.DoesNotExist:
            return None


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.github.lxyscls.jvmjava.bytecode.reference;

import com.github.lxyscls.jvmjava.bytecode.base.ByteCode;
import com.github.lxyscls.jvmjava.bytecode.base.ByteCodeReader;
import com.github.lxyscls.jvmjava.runtimedata.Frame;
import com.github.lxyscls.jvmjava.runtimedata.OperandStack;
import com.github.lxyscls.jvmjava.runtimedata.heap.classfile.ClassLoader;
import com.github.lxyscls.jvmjava.runtimedata.heap.classfile.Jclass;
import java.io.IOException;

class Atype {
    public static final short T_BOOLEAN = 4;
    public static final short T_CHAR = 5;
    public static final short T_FLOAT = 6;
    public static final short T_DOUBLE = 7;
    public static final short T_BYTE = 8;
    public static final short T_SHORT = 9;
    public static final short T_INT = 10;
    public static final short T_LONG = 11;
}

/**
 *
 * @author sk-xinyilong
 */
public class NewArray extends ByteCode {
    private short aType;

    @Override
    public void fetchOperands(ByteCodeReader reader) {
        aType = reader.readUint8();
    }

    @Override
    public void execute(Frame frame) {
        OperandStack stack = frame.getOperandStack();
        int count = stack.popInt();
        if (count < 0) {
            throw new NegativeArraySizeException();
        }

        try {
            Jclass cls = loadArrayClass(frame.getMethod().getBelongClass().getClassLoader(), aType);
            stack.pushRef(cls.newArray(count));
        } catch (IOException ex) {
            System.err.println(ex);
            System.exit(-1);
        }
    }

    private static Jclass loadArrayClass(ClassLoader loader, short aType) throws IOException {
        switch (aType) {
            case Atype.T_BOOLEAN: return loader.loadClass("[Z");
            case Atype.T_CHAR: return loader.loadClass("[C");
            case Atype.T_FLOAT: return loader.loadClass("[F");
            case Atype.T_DOUBLE: return loader.loadClass("[D");
            case Atype.T_BYTE: return loader.loadClass("[B");
            case Atype.T_SHORT: return loader.loadClass("[S");
            case Atype.T_INT: return loader.loadClass("[I");
            case Atype.T_LONG: return loader.loadClass("[J");
            default: System.err.println("Error array type"); System.exit(-1);
        }
        return null;
    }

}


text:
package com.navercorp.redis.cluster;

import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.navercorp.redis.cluster.pipeline.BuilderFactory;

import redis.clients.jedis.BinaryClient.LIST_POSITION;
import redis.clients.jedis.GeoCoordinate;
import redis.clients.jedis.GeoRadiusResponse;
import redis.clients.jedis.GeoUnit;
import redis.clients.jedis.ScanParams;
import redis.clients.jedis.ScanResult;
import redis.clients.jedis.Tuple;
import redis.clients.jedis.params.geo.GeoRadiusParam;
import redis.clients.jedis.params.sortedset.ZAddParams;
import redis.clients.util.SafeEncoder;

/**
 * The Class RedisCluster.
 *
 * @author jaehong.kim
 */
public class RedisCluster extends BinaryRedisCluster implements
        RedisClusterCommands {

    /**
     * Instantiates a new redis cluster.
     *
     * @param host the host
     */
    public RedisCluster(final String host) {
        super(host);
    }

    /**
     * Instantiates a new redis cluster.
     *
     * @param host the host
     * @param port the port
     */
    public RedisCluster(final String host, final int port) {
        super(host, port);
    }

    /**
     * Instantiates a new redis cluster.
     *
     * @param host    the host
     * @param port    the port
     * @param timeout the timeout
     */
    public RedisCluster(final String host, final int port, final int timeout) {
        super(host, port, timeout);
    }

    public RedisCluster(final String host, final int port, final int timeout, final boolean async) {
        super(host, port, timeout, async);
    }

    // ////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Keys

    public Long del(final String... keys) {
        client.del(keys);
        return client.getIntegerReply();
    }

    public Boolean exists(final String key) {
        client.exists(key);
        return client.getIntegerReply() == 1;
    }

    public Long exists(final String... keys) {
        client.exists(keys);
        return client.getIntegerReply();
    }

    public Long expire(final String key, final int seconds) {
        client.expire(key, seconds);
        return client.getIntegerReply();
    }

    public Long expireAt(final String key, final long secondsTimestamp) {
        client.expireAt(key, secondsTimestamp);
        return client.getIntegerReply();
    }

    public Long pexpire(final String key, final long milliseconds) {
        client.pexpire(key, milliseconds);
        return client.getIntegerReply();
    }

    public Long pexpireAt(final String key, final long millisecondsTimestamp) {
        client.pexpireAt(key, millisecondsTimestamp);
        return client.getIntegerReply();
    }

    public Long objectRefcount(String string) {
        client.objectRefcount(string);
        return client.getIntegerReply();
    }

    public String objectEncoding(String string) {
        client.objectEncoding(string);
        return client.getBulkReply();
    }

    public Long objectIdletime(String string) {
        client.objectIdletime(string);
        return client.getIntegerReply();
    }

    public Long ttl(final String key) {
        client.ttl(key);
        return client.getIntegerReply();
    }

    public Long pttl(final String key) {
        client.pttl(key);
        return client.getIntegerReply();
    }

    public String type(final String key) {
        client.type(key);
        return client.getStatusCodeReply();
    }

    public Long persist(final String key) {
        client.persist(key);
        return client.getIntegerReply();
    }

    // ////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Strings

    public Long append(final String key, final String value) {
        client.append(key, value);
        return client.getIntegerReply();
    }

    public Long decr(final String key) {
        client.decr(key);
        return client.getIntegerReply();
    }

    public Long decrBy(final String key, final long integer) {
        client.decrBy(key, integer);
        return client.getIntegerReply();
    }

    public String get(final String key) {
        client.get(key);
        return client.getBulkReply();
    }

    public Boolean getbit(String key, long offset) {
        client.getbit(key, offset);
        return client.getIntegerReply() == 1;
    }

    public String getrange(String key, long startOffset, long endOffset) {
        client.getrange(key, startOffset, endOffset);
        return client.getBulkReply();
    }

    public String substr(final String key, final int start, final int end) {
        client.substr(key, start, end);
        return client.getBulkReply();
    }

    public String getSet(final String key, final String value) {
        client.getSet(key, value);
        return client.getBulkReply();
    }

    public Long incr(final String key) {
        client.incr(key);
        return client.getIntegerReply();
    }

    public Long incrBy(final String key, final long integer) {
        client.incrBy(key, integer);
        return client.getIntegerReply();
    }

    public Double incrByFloat(final String key, final double increment) {
        client.incrByFloat(key, increment);
        String reply = client.getBulkReply();
        return (reply != null ? new Double(reply) : null);
    }

    public String set(final String key, String value) {
        client.set(key, value);
        return client.getStatusCodeReply();
    }

    public String set(final String key, final String value, final String nxxx, final String expx, final long time) {
        client.set(key, value, nxxx, expx, time);
        return client.getStatusCodeReply();
    }

    public Boolean setbit(String key, long offset, boolean value) {
        client.setbit(key, offset, value);
        return client.getIntegerReply() == 1;
    }

    public String setex(final String key, final int seconds, final String value) {
        client.setex(key, seconds, value);
        return client.getStatusCodeReply();
    }

    public Long setnx(final String key, final String value) {
        client.setnx(key, value);
        return client.getIntegerReply();
    }

    public Long setrange(String key, long offset, String value) {
        client.setrange(key, offset, value);
        return client.getIntegerReply();
    }

    public Long strlen(final String key) {
        client.strlen(key);
        return client.getIntegerReply();
    }

    public List<String> mget(final String... keys) {
        client.mget(keys);
        return client.getMultiBulkReply();
    }

    public String psetex(final String key, final long milliseconds,
                         final String value) {
        client.psetex(key, milliseconds, value);
        return client.getStatusCodeReply();
    }

    public String mset(String... keysvalues) {
        client.mset(keysvalues);
        return client.getStatusCodeReply();
    }

    public Long bitcount(final String key) {
        client.bitcount(key);
        return client.getIntegerReply();
    }

    public Long bitcount(final String key, long start, long end) {
        client.bitcount(key, start, end);
        return client.getIntegerReply();
    }

    public Long bitpos(String key, boolean bit) {
        client.bitpos(key, bit);
        return client.getIntegerReply();
    }

    public Long bitpos(String key, boolean bit, int start) {
        client.bitpos(key, bit, start);
        return client.getIntegerReply();
    }

    public Long bitpos(String key, boolean bit, int start, int end) {
        client.bitpos(key, bit, start, end);
        return client.getIntegerReply();
    }

    public List<Long> bitfield(final String key, final String... arguments) {
        client.bitfield(key, arguments);
        return client.getIntegerMultiBulkReply();
    }

    // ////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Hashes

    public Long hdel(final String key, final String... fields) {
        client.hdel(key, fields);
        return client.getIntegerReply();
    }

    public Boolean hexists(final String key, final String field) {
        client.hexists(key, field);
        return client.getIntegerReply() == 1;
    }

    public String hget(final String key, final String field) {
        client.hget(key, field);
        return client.getBulkReply();
    }

    public Map<String, String> hgetAll(final String key) {
        client.hgetAll(key);
        return BuilderFactory.STRING_MAP
                .build(client.getBinaryMultiBulkReply());
    }

    public Long hincrBy(final String key, final String field, final long value) {
        client.hincrBy(key, field, value);
        return client.getIntegerReply();
    }

    public Double hincrByFloat(final String key, final String field,
                               double increment) {
        client.hincrByFloat(key, field, increment);
        String reply = client.getBulkReply();
        return (reply != null ? new Double(reply) : null);
    }

    public Set<String> hkeys(final String key) {
        client.hkeys(key);
        return BuilderFactory.STRING_SET
                .build(client.getBinaryMultiBulkReply());
    }

    public Long hlen(final String key) {
        client.hlen(key);
        return client.getIntegerReply();
    }

    public List<String> hmget(final String key, final String... fields) {
        client.hmget(key, fields);
        return client.getMultiBulkReply();
    }

    public String hmset(final String key, final Map<String, String> hash) {
        client.hmset(key, hash);
        return client.getStatusCodeReply();
    }

    public ScanResult<String> scan(final String cursor) {
        return scan(cursor, new ScanParams());
    }

    public ScanResult<String> scan(final String cursor, final ScanParams params) {
        client.scan(cursor, params);
        List<Object> result = client.getObjectMultiBulkReply();
        String newcursor = new String((byte[]) result.get(0));
        List<String> results = new ArrayList<String>();
        @SuppressWarnings("unchecked")
        List<byte[]> rawResults = (List<byte[]>) result.get(1);
        for (byte[] bs : rawResults) {
            results.add(SafeEncoder.encode(bs));
        }
        return new ScanResult<String>(newcursor, results);
    }

    public ScanResult<String> cscan(int partitionID, String cursor) {
        return cscan(partitionID, cursor, new ScanParams());
    }

    public ScanResult<String> cscan(int partitionID, String cursor, ScanParams params) {
        client.cscan(partitionID, cursor, params);
        List<Object> result = client.getObjectMultiBulkReply();
        String newcursor = new String((byte[]) result.get(0));
        List<String> results = new ArrayList<String>();
        @SuppressWarnings("unchecked")
        List<byte[]> rawResults = (List<byte[]>) result.get(1);
        for (byte[] bs : rawResults) {
            results.add(SafeEncoder.encode(bs));
        }
        return new ScanResult<String>(newcursor, results);
    }

    public ScanResult<String> sscan(final String key, final String cursor) {
        return sscan(key, cursor, new ScanParams());
    }

    public ScanResult<String> sscan(final String key, final String cursor, final ScanParams params) {
        client.sscan(key, cursor, params);
        List<Object> result = client.getObjectMultiBulkReply();
        String newcursor = new String((byte[]) result.get(0));
        List<String> results = new ArrayList<String>();
        List<byte[]> rawResults = (List<byte[]>) result.get(1);
        for (byte[] bs : rawResults) {
            results.add(SafeEncoder.encode(bs));
        }
        return new ScanResult<String>(newcursor, results);
    }

    public ScanResult<Map.Entry<String, String>> hscan(final String key, final String cursor) {
        client.hscan(key, cursor, new ScanParams());
        List<Object> result = client.getObjectMultiBulkReply();
        String newcursor = new String((byte[]) result.get(0));
        List<Map.Entry<String, String>> results = new ArrayList<Map.Entry<String, String>>();
        @SuppressWarnings("unchecked")
        List<byte[]> rawResults = (List<byte[]>) result.get(1);
        Iterator<byte[]> iterator = rawResults.iterator();
        while (iterator.hasNext()) {
            results.add(new AbstractMap.SimpleEntry<String, String>(new String((byte[]) iterator.next()),
                    new String((byte[]) iterator.next())));
        }
        return new ScanResult<Map.Entry<String, String>>(newcursor, results);
    }

    public ScanResult<Map.Entry<String, String>> hscan(final String key, final String cursor, final ScanParams params) {
        client.hscan(key, cursor, params);
        List<Object> result = client.getObjectMultiBulkReply();
        String newcursor = new String((byte[]) result.get(0));
        List<Map.Entry<String, String>> results = new ArrayList<Map.Entry<String, String>>();
        @SuppressWarnings("unchecked")
        List<byte[]> rawResults = (List<byte[]>) result.get(1);
        Iterator<byte[]> iterator = rawResults.iterator();
        while (iterator.hasNext()) {
            results.add(new AbstractMap.SimpleEntry<String, String>(new String((byte[]) iterator.next()),
                    new String((byte[]) iterator.next())));
        }
        return new ScanResult<Map.Entry<String, String>>(newcursor, results);
    }

    public ScanResult<Tuple> zscan(final String key, final String cursor) {
        return zscan(key, cursor, new ScanParams());
    }

    public ScanResult<Tuple> zscan(final String key, final String cursor, final ScanParams params) {
        client.zscan(key, cursor, params);
        List<Object> result = client.getObjectMultiBulkReply();
        String newcursor = new String((byte[]) result.get(0));
        List<Tuple> results = new ArrayList<Tuple>();
        @SuppressWarnings("unchecked")
        List<byte[]> rawResults = (List<byte[]>) result.get(1);
        Iterator<byte[]> iterator = rawResults.iterator();
        while (iterator.hasNext()) {
            results.add(new Tuple(SafeEncoder.encode(iterator.next()),
                    Double.valueOf(SafeEncoder.encode(iterator.next()))));
        }
        return new ScanResult<Tuple>(newcursor, results);
    }

    public Long hstrlen(String key, String field) {
        client.hstrlen(key, field);
        return client.getIntegerReply();
    }

    public Long hset(final String key, final String field, final String value) {
        client.hset(key, field, value);
        return client.getIntegerReply();
    }

    public Long hsetnx(final String key, final String field, final String value) {
        client.hsetnx(key, field, value);
        return client.getIntegerReply();
    }

    public List<String> hvals(final String key) {
        client.hvals(key);
        final List<String> lresult = client.getMultiBulkReply();
        return lresult;
    }

    // ////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Lists

    public String lindex(final String key, final long index) {
        client.lindex(key, index);
        return client.getBulkReply();
    }

    public Long linsert(final String key, final LIST_POSITION where,
                        final String pivot, final String value) {
        client.linsert(key, where, pivot, value);
        return client.getIntegerReply();
    }

    public Long llen(final String key) {
        client.llen(key);
        return client.getIntegerReply();
    }

    public String lpop(final String key) {
        client.lpop(key);
        return client.getBulkReply();
    }

    public Long lpush(final String key, final String... strings) {
        client.lpush(key, strings);
        return client.getIntegerReply();
    }

    public Long lpushx(final String key, final String string) {
        client.lpushx(key, string);
        return client.getIntegerReply();
    }

    public List<String> lrange(final String key, final long start,
                               final long end) {
        client.lrange(key, start, end);
        return client.getMultiBulkReply();
    }

    public Long lrem(final String key, final long count, final String value) {
        client.lrem(key, count, value);
        return client.getIntegerReply();
    }

    public String lset(final String key, final long index, final String value) {
        client.lset(key, index, value);
        return client.getStatusCodeReply();
    }

    public String ltrim(final String key, final long start, final long end) {
        client.ltrim(key, start, end);
        return client.getStatusCodeReply();
    }

    public String rpop(final String key) {
        client.rpop(key);
        return client.getBulkReply();
    }

    public Long rpush(final String key, final String... strings) {
        client.rpush(key, strings);
        return client.getIntegerReply();
    }

    public Long rpushx(final String key, final String string) {
        client.rpushx(key, string);
        return client.getIntegerReply();
    }

    // ////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Sets

    public Long sadd(final String key, final String... members) {
        client.sadd(key, members);
        return client.getIntegerReply();
    }

    public Long scard(final String key) {
        client.scard(key);
        return client.getIntegerReply();
    }

    public Boolean sismember(final String key, final String member) {
        client.sismember(key, member);
        return client.getIntegerReply() == 1;
    }

    public Set<String> smembers(final String key) {
        client.smembers(key);
        final List<String> members = client.getMultiBulkReply();
        return new HashSet<String>(members);
    }

    public String srandmember(final String key) {
        client.srandmember(key);
        return client.getBulkReply();
    }

    public List<String> srandmember(final String key, final int count) {
        client.srandmember(key, count);
        return client.getMultiBulkReply();
    }

    public Long srem(final String key, final String... members) {
        client.srem(key, members);
        return client.getIntegerReply();
    }

    // ////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Sorted Sets

    public Long zadd(final String key, final double score, final String member) {
        client.zadd(key, score, member);
        return client.getIntegerReply();
    }

    public Long zadd(final String key, final Map<Double, String> scoreMembers) {
        client.zadd(key, scoreMembers);
        return client.getIntegerReply();
    }

    public Long zadd2(final String key, final Map<String, Double> scoreMembers) {
        client.zadd2(key, scoreMembers);
        return client.getIntegerReply();
    }

    public Long zadd(String key, double score, String member, ZAddParams params) {
        client.zadd(key, score, member, params);
        return client.getIntegerReply();
    }

    public Long zadd(String key, Map<String, Double> scoreMembers, ZAddParams params) {
        client.zadd(key, scoreMembers, params);
        return client.getIntegerReply();
    }

    public Long zcard(final String key) {
        client.zcard(key);
        return client.getIntegerReply();
    }

    public Long zcount(final String key, final double min, final double max) {
        client.zcount(key, min, max);
        return client.getIntegerReply();
    }

    public Long zcount(final String key, final String min, final String max) {
        client.zcount(key, min, max);
        return client.getIntegerReply();
    }

    public Double zincrby(final String key, final double score,
                          final String member) {
        client.zincrby(key, score, member);
        String newscore = client.getBulkReply();
        return Double.valueOf(newscore);
    }

    public Set<String> zrange(final String key, final long start, final long end) {
        client.zrange(key, start, end);
        final List<String> members = client.getMultiBulkReply();
        return new LinkedHashSet<String>(members);
    }

    public Set<String> zrangeByScore(final String key, final double min,
                                     final double max) {
        client.zrangeByScore(key, min, max);
        return new LinkedHashSet<String>(client.getMultiBulkReply());
    }

    public Set<String> zrangeByScore(final String key, final String min,
                                     final String max) {
        client.zrangeByScore(key, min, max);
        return new LinkedHashSet<String>(client.getMultiBulkReply());
    }

    public Set<String> zrangeByScore(final String key, final double min,
                                     final double max, final int offset, final int count) {
        client.zrangeByScore(key, min, max, offset, count);
        return new LinkedHashSet<String>(client.getMultiBulkReply());
    }

    public Set<String> zrangeByScore(final String key, final String min,
                                     final String max, final int offset, final int count) {
        client.zrangeByScore(key, min, max, offset, count);
        return new LinkedHashSet<String>(client.getMultiBulkReply());
    }

    public Set<Tuple> zrangeWithScores(final String key, final long start,
                                       final long end) {
        client.zrangeWithScores(key, start, end);
        Set<Tuple> set = getTupledSet();
        return set;
    }

    public Set<Tuple> zrangeByScoreWithScores(final String key,
                                              final double min, final double max) {
        client.zrangeByScoreWithScores(key, min, max);
        Set<Tuple> set = getTupledSet();
        return set;
    }

    public Set<Tuple> zrangeByScoreWithScores(final String key,
                                              final String min, final String max) {
        client.zrangeByScoreWithScores(key, min, max);
        Set<Tuple> set = getTupledSet();
        return set;
    }

    public Set<Tuple> zrangeByScoreWithScores(final String key,
                                              final double min, final double max, final int offset,
                                              final int count) {
        client.zrangeByScoreWithScores(key, min, max, offset, count);
        Set<Tuple> set = getTupledSet();
        return set;
    }

    public Set<Tuple> zrangeByScoreWithScores(final String key,
                                              final String min, final String max, final int offset,
                                              final int count) {
        client.zrangeByScoreWithScores(key, min, max, offset, count);
        Set<Tuple> set = getTupledSet();
        return set;
    }

    public Long zrank(final String key, final String member) {
        client.zrank(key, member);
        return client.getIntegerReply();
    }

    public Long zlexcount(final String key, final String min, final String max) {
      client.zlexcount(key, min, max);
      return client.getIntegerReply();
    }

    public Set<String> zrangeByLex(final String key, final String min, final String max) {
      client.zrangeByLex(key, min, max);
      return new LinkedHashSet<String>(client.getMultiBulkReply());
    }

    public Set<String> zrangeByLex(final String key, final String min, final String max,
        final int offset, final int count) {
      client.zrangeByLex(key, min, max, offset, count);
      return new LinkedHashSet<String>(client.getMultiBulkReply());
    }

    public Set<String> zrevrangeByLex(String key, String max, String min) {
      client.zrevrangeByLex(key, max, min);
      return new LinkedHashSet<String>(client.getMultiBulkReply());
    }

    public Set<String> zrevrangeByLex(String key, String max, String min, int offset, int count) {
      client.zrevrangeByLex(key, max, min, offset, count);
      return new LinkedHashSet<String>(client.getMultiBulkReply());
    }

    public Long zremrangeByLex(final String key, final String min, final String max) {
      client.zremrangeByLex(key, min, max);
      return client.getIntegerReply();
    }

    public Long zrem(final String key, final String... members) {
        client.zrem(key, members);
        return client.getIntegerReply();
    }

    public Long zremrangeByRank(final String key, final long start,
                                final long end) {
        client.zremrangeByRank(key, start, end);
        return client.getIntegerReply();
    }

    public Long zremrangeByScore(final String key, final double start,
                                 final double end) {
        client.zremrangeByScore(key, start, end);
        return client.getIntegerReply();
    }

    public Long zremrangeByScore(final String key, final String start,
                                 final String end) {
        client.zremrangeByScore(key, start, end);
        return client.getIntegerReply();
    }

    public Set<String> zrevrange(final String key, final long start,
                                 final long end) {
        client.zrevrange(key, start, end);
        final List<String> members = client.getMultiBulkReply();
        return new LinkedHashSet<String>(members);
    }

    public Set<Tuple> zrevrangeWithScores(final String key, final long start,
                                          final long end) {
        client.zrevrangeWithScores(key, start, end);
        Set<Tuple> set = getTupledSet();
        return set;
    }

    public Set<String> zrevrangeByScore(final String key, final double max,
                                        final double min) {
        client.zrevrangeByScore(key, max, min);
        return new LinkedHashSet<String>(client.getMultiBulkReply());
    }

    public Set<String> zrevrangeByScore(final String key, final String max,
                                        final String min) {
        client.zrevrangeByScore(key, max, min);
        return new LinkedHashSet<String>(client.getMultiBulkReply());
    }

    public Set<String> zrevrangeByScore(final String key, final double max,
                                        final double min, final int offset, final int count) {
        client.zrevrangeByScore(key, max, min, offset, count);
        return new LinkedHashSet<String>(client.getMultiBulkReply());
    }

    public Set<Tuple> zrevrangeByScoreWithScores(final String key,
                                                 final double max, final double min) {
        client.zrevrangeByScoreWithScores(key, max, min);
        Set<Tuple> set = getTupledSet();
        return set;
    }

    public Set<Tuple> zrevrangeByScoreWithScores(final String key,
                                                 final double max, final double min, final int offset,
                                                 final int count) {
        client.zrevrangeByScoreWithScores(key, max, min, offset, count);
        Set<Tuple> set = getTupledSet();
        return set;
    }

    public Set<Tuple> zrevrangeByScoreWithScores(final String key,
                                                 final String max, final String min, final int offset,
                                                 final int count) {
        client.zrevrangeByScoreWithScores(key, max, min, offset, count);
        Set<Tuple> set = getTupledSet();
        return set;
    }

    public Set<String> zrevrangeByScore(final String key, final String max,
                                        final String min, final int offset, final int count) {
        client.zrevrangeByScore(key, max, min, offset, count);
        return new LinkedHashSet<String>(client.getMultiBulkReply());
    }

    public Set<Tuple> zrevrangeByScoreWithScores(final String key,
                                                 final String max, final String min) {
        client.zrevrangeByScoreWithScores(key, max, min);
        Set<Tuple> set = getTupledSet();
        return set;
    }

    public Long zrevrank(final String key, final String member) {
        client.zrevrank(key, member);
        return client.getIntegerReply();
    }

    public Double zscore(final String key, final String member) {
        client.zscore(key, member);
        final String score = client.getBulkReply();
        return (score != null ? new Double(score) : null);
    }

    // ////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Connection

    public String ping() {
        client.ping();
        return client.getStatusCodeReply();
    }

    // ////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Server

    public String info() {
        client.info();
        return client.getBulkReply();
    }

    public String info(final String section) {
        client.info(section);
        return client.getBulkReply();
    }

    public Long dbSize() {
        client.dbSize();
        return client.getIntegerReply();
    }

    public byte[] dump(final String key) {
        client.dump(key);
        return client.getBinaryBulkReply();
    }

    public String restore(final String key, final long ttl,
                          final byte[] serializedValue) {
        client.restore(key, ttl, serializedValue);
        return client.getStatusCodeReply();
    }

    public Long geoadd(String key, double longitude, double latitude, String member) {
        client.geoadd(key, longitude, latitude, member);
        return client.getIntegerReply();
    }

    public Long geoadd(String key, Map<String, GeoCoordinate> memberCoordinateMap) {
        client.geoadd(key, memberCoordinateMap);
        return client.getIntegerReply();
    }

    public Double geodist(String key, String member1, String member2) {
        client.geodist(key, member1, member2);
        String dval = client.getBulkReply();
        return (dval != null ? new Double(dval) : null);
    }

    public Double geodist(String key, String member1, String member2, GeoUnit unit) {
        client.geodist(key, member1, member2, unit);
        String dval = client.getBulkReply();
        return (dval != null ? new Double(dval) : null);
    }

    public List<String> geohash(String key, String... members) {
        client.geohash(key, members);
        return client.getMultiBulkReply();
    }

    public List<GeoCoordinate> geopos(String key, String... members) {
        client.geopos(key, members);
        return BuilderFactory.GEO_COORDINATE_LIST.build(client.getObjectMultiBulkReply());
    }

    public List<GeoRadiusResponse> georadius(String key, double longitude, double latitude, double radius,
            GeoUnit unit) {
        client.georadius(key, longitude, latitude, radius, unit);
        return BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT.build(client.getObjectMultiBulkReply());
    }

    public List<GeoRadiusResponse> georadius(String key, double longitude, double latitude, double radius, GeoUnit unit,
            GeoRadiusParam param) {
        client.georadius(key, longitude, latitude, radius, unit, param);
        return BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT.build(client.getObjectMultiBulkReply());
    }

    public List<GeoRadiusResponse> georadiusByMember(String key, String member, double radius, GeoUnit unit) {
        client.georadiusByMember(key, member, radius, unit);
        return BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT.build(client.getObjectMultiBulkReply());
    }

    public List<GeoRadiusResponse> georadiusByMember(String key, String member, double radius, GeoUnit unit,
            GeoRadiusParam param) {
        client.georadiusByMember(key, member, radius, unit, param);
        return BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT.build(client.getObjectMultiBulkReply());
    }

    public Long pfadd(final String key, final String... elements) {
      client.pfadd(key, elements);
      return client.getIntegerReply();
    }

    public Long pfcount(final String key) {
      client.pfcount(key);
      return client.getIntegerReply();
    }

    public Long touch(String... keys) {
        client.touch(keys);
        return client.getIntegerReply();
    }

    /**
     * Quit.
     *
     * @return the string
     */
    public String quit() {
        client.quit();
        return client.getStatusCodeReply();
    }

    /**
     * Connect.
     */
    public void connect() {
        client.connect();
    }

    /**
     * Disconnect.
     */
    public void disconnect() {
        client.disconnect();
    }

    public void passivate() {
        client.passivate();
    }

    /**
     * Checks if is connected.
     *
     * @return true, if is connected
     */
    public boolean isConnected() {
        return client.isConnected();
    }

    /**
     * Gets the tupled set.
     *
     * @return the tupled set
     */
    private Set<Tuple> getTupledSet() {
        List<String> membersWithScores = client.getMultiBulkReply();
        Set<Tuple> set = new LinkedHashSet<Tuple>();
        Iterator<String> iterator = membersWithScores.iterator();
        while (iterator.hasNext()) {
            set.add(new Tuple(iterator.next(), Double.valueOf(iterator.next())));
        }
        return set;
    }
}


text:
#ifndef HEADER_CURL_TOOL_SLEEP_H
#define HEADER_CURL_TOOL_SLEEP_H

#include "setup.h"

void tool_go_sleep(long ms);

#endif /* HEADER_CURL_TOOL_SLEEP_H */


text:
<?php
use Df\Core\Exception as DFE;
use Magento\Catalog\Model\Product as P;
use Magento\CatalogInventory\Api\StockConfigurationInterface as ICfg;
use Magento\CatalogInventory\Model\Configuration as Cfg;
use Magento\InventoryConfiguration\Model\IsSourceItemManagementAllowedForProductType as AllowedForPT;
use Magento\InventoryConfigurationApi\Model\IsSourceItemManagementAllowedForProductTypeInterface as IAllowedForPT;
/**
 * 2019-11-22
 * @used-by df_qty()
 * @throws DFE
 */
function df_assert_qty_supported(P $p):void {df_assert(
	df_pt_has_qty($t = $p->getTypeId()), "Products of type `$t` do not have a quantity."
);}

/**
 * 2019-11-21
 *	{
 *		"bundle": false,
 *		"configurable": false,
 *		"downloadable": true,
 *		"grouped": false,
 *		"simple": true,
 *		"virtual": true
 *	}
 * @used-by df_pt_has_qty()
 * @return IAllowedForPT|AllowedForPT
 */
function df_msi_allowed_for_pt() {return df_o(IAllowedForPT::class);}

/**
 * 2021-10-11
 * @used-by df_assert_qty_supported()
 * @param P|string $t
 * @throws bool
 */
function df_pt_has_qty($t) {
	$t = is_string($t) ? $t : $t->getTypeId();
	return df_msi() ? df_msi_allowed_for_pt()->execute($t) : df_stock_cfg()->isQty($t);
}

/**
 * 2019-11-22
 * @used-by df_pt_has_qty()
 * @return ICfg|Cfg
 */
function df_stock_cfg() {return df_o(ICfg::class);}


text:
// <copyright file="ExclusiveCodeBlock.cs" company="dddlib contributors">
//  Copyright (c) dddlib contributors. All rights reserved.
// </copyright>

#if PERSISTENCE
namespace dddlib.Persistence.Memory
#else
namespace dddlib.Persistence.EventDispatcher.Memory
#endif
{
    using System;
    using System.Threading;

    /// <summary>
    /// Represents an exclusive code block.
    /// </summary>
    public sealed class ExclusiveCodeBlock : IDisposable
    {
        private readonly Mutex mutex;

        private bool hasHandle;

        /// <summary>
        /// Initializes a new instance of the <see cref="ExclusiveCodeBlock"/> class.
        /// </summary>
        /// <param name="mutex">The mutex.</param>
        /// <exception cref="System.TimeoutException">Timeout waiting for exclusive access to the mutex for the memory event store.</exception>
        public ExclusiveCodeBlock(Mutex mutex)
        {
            this.mutex = mutex;

            // LINK (Cameron): http://stackoverflow.com/questions/229565/what-is-a-good-pattern-for-using-a-global-mutex-in-c
            this.hasHandle = false;
            try
            {
                this.hasHandle = this.mutex.WaitOne(5000, false);
                if (this.hasHandle == false)
                {
                    throw new TimeoutException("Timeout waiting for exclusive access to the mutex for the memory event store.");
                }
            }
            catch (AbandonedMutexException)
            {
                // NOTE (Cameron): The mutex was abandoned in another process, it will still get acquired.
                this.hasHandle = true;
            }
        }

        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            if (this.hasHandle)
            {
                this.mutex.ReleaseMutex();
            }
        }
    }
}


text:
package org.shipkit.internal.gradle.notes.tasks;

import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import org.json.simple.JsonObject;
import org.json.simple.Jsoner;
import org.shipkit.gradle.notes.UpdateReleaseNotesOnGitHubCleanupTask;
import org.shipkit.gradle.notes.UpdateReleaseNotesOnGitHubTask;
import org.shipkit.internal.gradle.util.StringUtil;
import org.shipkit.internal.notes.header.HeaderProvider;
import org.shipkit.internal.util.GitHubApi;

import java.io.IOException;

public class UpdateReleaseNotesOnGitHub {
    private static final Logger LOG = Logging.getLogger(UpdateReleaseNotesOnGitHub.class);

    private final GitHubApi gitHubApi;
    private final UpdateReleaseNotes updateReleaseNotes;

    public UpdateReleaseNotesOnGitHub(GitHubApi gitHubApi, UpdateReleaseNotes updateReleaseNotes) {
        this.gitHubApi = gitHubApi;
        this.updateReleaseNotes = updateReleaseNotes;
    }

    public void updateReleaseNotes(UpdateReleaseNotesOnGitHubTask task, HeaderProvider headerProvider) throws Exception {
        String releaseNotesText = updateReleaseNotes.generateNewContent(task, headerProvider);
        if (task.isPreviewMode()) {
            LOG.lifecycle("  Preview of release notes update:\n" +
                "  ----------------\n" + releaseNotesText + "\n----------------");
        } else {
            createReleaseByTagName(task, releaseNotesText);
        }
    }

    private String findReleaseByTagName(UpdateReleaseNotesOnGitHubTask task) throws Exception {
        String tagName = tagName(task);
        String url = "/repos/" + task.getUpstreamRepositoryName() + "/releases/tags/" + tagName;
        LOG.lifecycle("GET {}", url);

        try {
            String response = gitHubApi.get(url);
            JsonObject responseJson = (JsonObject) Jsoner.deserialize(response);
            return responseJson.getString("id");
        } catch (Exception e) {
            if (task.isDryRun()) {
                LOG.lifecycle("  returned some error, but run in -PdryRun mode, so will continue with default value: " +
                    "\"DEFAULT_RELEASE_ID\".\nSee stacktrace for more details.", e);
                return "DEFAULT_RELEASE_ID";
            }
            throw e;
        }
    }

    private void createReleaseByTagName(UpdateReleaseNotesOnGitHubTask task, String text) throws Exception {
        String tagName = tagName(task);
        String url = "/repos/" + task.getUpstreamRepositoryName() + "/releases";

        if (task.isDryRun()) {
            LOG.lifecycle("It's -PdryRun mode, releases notes on GitHub will be NOT created." +
                "\n  It will execute in normal mode: POST {}", url);
            return;
        }

        JsonObject body = new JsonObject();
        body.put("tag_name", tagName);
        body.put("name", tagName);
        body.put("body", text);

        LOG.lifecycle("POST {}", url);

        try {
            String response = gitHubApi.post(url, body.toJson());
            JsonObject responseJson = (JsonObject) Jsoner.deserialize(response);

            String htmlUrl = responseJson.getString("html_url");
            LOG.lifecycle("  Successfully updated release notes on GitHub: {}", htmlUrl);
        } catch (Exception e) {
            if (task.isDryRun()) {
                LOG.lifecycle("  returned some error, but run in -PdryRun mode, so will continue with default value: " +
                    "\"DEFAULT_RELEASE_ID\".\nSee stacktrace for more details.", e);
            }
            throw e;
        }
    }

    private String tagName(UpdateReleaseNotesOnGitHubTask task) {
        if (StringUtil.isEmpty(task.getTagPrefix())) {
            return task.getVersion();
        }
        return task.getTagPrefix() + task.getVersion();
    }

    public void removeReleaseNotes(UpdateReleaseNotesOnGitHubCleanupTask task) {
        String releaseId;

        if (task.isDryRun()) {
            LOG.lifecycle("It's -PdryRun mode, releases notes on GitHub will NOT be deleted.");
            return;
        }

        try {
            releaseId = findReleaseByTagName(task);
        } catch (Exception e) {
            LOG.lifecycle("Can't find release on GitHub to remove");
            return;
        }

        try {
            removeRelease(releaseId, task);
        } catch (IOException e) {
            LOG.lifecycle("Can't delete release {} from GitHub", releaseId);
        }
    }

    private void removeRelease(String releaseId, UpdateReleaseNotesOnGitHubCleanupTask task) throws IOException {
        String url = "/repos/" + task.getUpstreamRepositoryName() + "/releases/" + releaseId;
        gitHubApi.delete(url);
    }
}


text:
package ru.wordmetrix.ratnest
import ru.wordmetrix.ratnest.Server
import scala.actors.Actor

/*

 react {
   case q : QQ => {
     react {
       case e : EE => {
         acceptor ! (q,e)  // do something with q & e
       }
     }
   }
 }*/

/*
                 // Get id from query
                 //  ... or Get id && url from reference
                 // Request goods from storage
                 // Save goods into storage (storage ! new Goods(id, url))

                 // Make a basket from query
                 //  .. or get basket from session
                 //  .. or make empty basket
                 // Add id into basket, ( and shedule basket for future save
                 // respond with standart response (from file "/client/add.js"
                 // If request has commit key commit basket
                 // If request has no commit key ;) don't commit basket
                 // If request has every time commit key :) commit basket

                 val respond = new ResponseSuccess(Map(),io.Source.fromInputStream(new java.io.FileInputStream(root + f)).getLines.mkString(""))
                 if (cookie.contains("session")) respond else respond //+ (session,randomId)
               }

               case Some(Request(_,"/suggest",query,cookie)) => { // Ask for suggestion
                 // Make suggestion from index
                 // .. or compute suggestion
                 // .. or send suggestion to recompute and make simple suggestion
                 // .. generate standart suggestion report
                 // .. List() toJSON

                 val respond = new ResponseSuccess(Map(),io.Source.fromInputStream(new java.io.FileInputStream(root + f)).getLines.mkString(""))
                 if (cookie.contains("session")) respond else respond //+ (session,randomId)
               }

               case Some(Request(_,f,query,cookie)) => {  // Accomplish request of file
                 val respond = new ResponseSuccess(Map(),io.Source.fromInputStream(new java.io.FileInputStream(root + f)).getLines.mkString(""))
                 if (cookie.contains("session")) respond else respond //+ (session,randomId)
               }

*/

class Dispatcher extends Actor {
    val log = new Log("Dispatcher")
    def act() = {

        def queue(sockets: List[java.net.Socket], servers: List[Server]) : Unit = {
            log("Servers:", servers.length, "Sockets:", sockets.length)
            react({
                case server: Server => {
                    sockets match {
                        case socket :: sockets => {
                            server ! socket
                            queue(sockets, servers)
                        }
                        case List() => queue(sockets, server :: server :: servers)
                    }
                }
                case socket: java.net.Socket => {
                    servers match {
                        case server :: servers => {
                            server ! socket
                            queue(sockets, servers)
                        }
                        case List() => { queue(socket :: socket :: sockets, servers) }
                    }
                }

            })
        }
        queue(List(), List())
    }
}


text:
require 'sinatra/base'

module Dubai
  class Server < Sinatra::Base
    get '/pass.pkpass' do
      content_type 'application/vnd.apple.pkpass'
      attachment 'pass.pkpass'

      Passbook::Pass.new(settings.directory).pkpass.string
    end
  end
end


text:
var fs = require('fs')
var path = require("path")

var Unit = require('deadunit')
var Future = require('async-future')

var build = require('../buildModules')

var requirejs = require('requirejs')
requirejs.config({
    nodeRequire: require
})

var testsPerRun = 2

var test = Unit.test('buildModules', function(t) {

    //*
    this.test('simple module with module.exports (no dependencies)', function(t) {
	    this.count(1*testsPerRun)

        var name = 'testDependency'
	    var emitter = build(__dirname+'/'+name, {
            name: "godzilla",
            output: {path: __dirname+'/generatedTestOutput', name: 'testDependency.umd.js'},
            header: "//some text",
            minify: false
        })
        testModules(t, emitter, name, 6, "//some text")
	})

    this.test('simple module with exports (no dependencies)', function(t) {
	    this.count(1*testsPerRun)

        var name = 'testDependency2'
        var emitter = build(__dirname+'/'+name, {output: {path: __dirname+'/generatedTestOutput'}, header: "//some text"})
        testModules(t, emitter, name, 6, "//some text")
        //build('generatedTestOutput', name, "//some text",
          //  __dirname+"/testDependency2.js", undefined, undefined, testModules(t, 6, newFuture(), name))
	})

    this.test('module with dependencies', function(t) {
        this.timeout(5000)
        this.count(4*testsPerRun) // 4 `build` runs

        var name = 'testDependency3'
        var emitter = build(__dirname+'/'+name, {output: {path: __dirname+'/generatedTestOutput'}, header: "//some text"})
        testModules(t, emitter, name, 6, "//some text")
	    //build('generatedTestOutput', name, "//some text",
          //  __dirname+"/testDependency3.js", undefined, undefined, testModules(t, 6, newFuture(), name))

        name = 'testDependency4'
        var emitter = build(__dirname+'/'+name, {output: {path: __dirname+'/generatedTestOutput'}, header: "//some text"})
        testModules(t, emitter, name, 6, "//some text")
	    //build('generatedTestOutput', name, "//some text",
          //  __dirname+"/testDependency4.js", undefined, undefined, testModules(t, 6, newFuture(), name))

        name = 'testDependency5'
        var emitter = build(__dirname+'/'+name, {output: {path: __dirname+'/generatedTestOutput'}, header: "//some text"})
        testModules(t, emitter, name, 90, "//some text")

        name = 'testDependency6'
        var emitter = build(__dirname+'/'+name, {output: {path: __dirname+'/generatedTestOutput'}, header: "//some text"})
        testModules(t, emitter, name, 12, "//some text")
	})

    this.test('watcher', function(t) {
        this.timeout(2000)
        this.count(2)

        var name = 'generatedTestDependency1'
        var fileName = name+'.js'
        var filePath = path.join(__dirname,'generatedTestOutput',name+'.umd.js')

        fs.writeFileSync(__dirname+'/'+fileName, "exports.x = 2")
        var emitter = build(__dirname+'/'+name, {watch: true, output: {path: __dirname+'/generatedTestOutput'}, header: "//some text"})

        var state = 1, count = 0
        setTimeout(function() {
            fs.writeFileSync(__dirname+'/'+fileName, "exports.x = 3")
            state = 2
        }, 1000)

        emitter.on("done", function() {
            if(state === 1 && count === 1) { // not sure why this is called twice sometimes (for this it seems to be every time, but other builds it only happens once)
                requirejs([filePath], function(amd) {
                    t.eq(amd.x, 2)
                })
            } else if(state === 2) {
                requirejs.undef(filePath)
                requirejs([filePath], function(amd) {
                    t.eq(amd.x, 3)
                    emitter.close() // close the watcher
                })
            }

            count++
        })
        emitter.on("error", function(e) {
            t.ok(false, e)
        })
        emitter.on("warning", function(w) {
            t.ok(false, w)
        })
    })

    this.test("former bugs", function() {
        this.test("module requiring something below its directory", function() {
            var name = 'innerModule'
            var emitter = build(path.join(__dirname,'a',name), {output: {path: __dirname+'/generatedTestOutput'}, header: "//some text"})
            testModules(t, emitter, name, 6, "//some text")
        })

        this.test("path with multiple separator types fails (ie try to handle some invalid paths)", function() {
            var name = 'innerModule'
            var emitter = build(__dirname+'/a/'+name, {output: {path: __dirname+'/generatedTestOutput'}, header: "//some text"})
            testModules(t, emitter, name, 6, "//some text")
        })
    })
    //*/

})

test.writeConsole(1000)

// 5 oks
function testModules(t, emitter, name, value, header) {
    emitter.on('done', function() {

        var fileName = 'generatedTestOutput/'+name+'.umd.js'

        if(header !== undefined) {
            var fileContents = fs.readFileSync(__dirname+'/'+fileName).toString()
            t.ok(fileContents.indexOf(header) === 0, fileContents.substr(0,100))
        } else {
            t.ok(true) // to balance the count
        }

		requirejs([path.join(__dirname,fileName)], function(amd) {
            t.ok(amd.v === value, amd, value)
		})
    })
    emitter.on("error", function(e) {
        t.ok(false, e)
    })
    emitter.on("warning", function(w) {
        t.ok(false, w)
    })
}


text:
.. Copyright (c) 2016, Johan Mabille, Sylvain Corlay and Wolf Vollprecht

   Distributed under the terms of the BSD 3-Clause License.

   The full license is in the file LICENSE, distributed with this software.

Containers and views
====================

Containers are in-memory expressions that share a common implementation of most of the methods of the xexpression API.
The final container classes (``xarray``, ``xtensor``) mainly implement constructors and value semantic, most of the
xexpression API is actually implemented in ``xstrided_container`` and ``xcontainer``.

.. toctree::

   xcontainer
   xaccessible
   xiterable
   xarray
   xarray_adaptor
   chunked_array
   xtensor
   xtensor_adaptor
   xfixed
   xoptional_assembly_base
   xoptional_assembly
   xoptional_assembly_adaptor
   xmasked_view
   xview
   xstrided_view
   xbroadcast
   xindex_view
   xfunctor_view
   xrepeat


text:
/**
 * Created by brandon on 11/23/14.
 */

'use strict';
var _ = require('lodash');

module.exports = function(freelancers) {
    var result = {
        average: 0,
        underperform: [],
        overperform: []
    };

    freelancers = _.sortBy(freelancers, 'income');

    result.average = _.reduce(freelancers, function(total, freelancer) {
        return total + freelancer.income;
    }, 0) / _.size(freelancers);

    result.underperform = _.filter(freelancers, function(object) {
        return object.income <= result.average;
    });

    result.overperform = _.filter(freelancers, function(object) {
        return object.income > result.average;
    });

    return result;
};


text:
package com.kolich.spray.protocols

trait JsonProtocols
	extends WebAppJsonProtocol


text:
class Degree < ActiveRecord::Base
  has_many :users
  has_many :subjects

end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<meta name="generator" content="JsDoc Toolkit" />

		<title>JsDoc Reference - SIPml.Session.Configuration</title>

Class Index
| File Index

Classes

_global_

SIPml

SIPml.Event

SIPml.EventTarget

SIPml.Session

SIPml.Session.Call

SIPml.Session.Configuration

SIPml.Session.Event

SIPml.Session.Message

SIPml.Session.Publish

SIPml.Session.Registration

SIPml.Session.Subscribe

SIPml.Stack

SIPml.Stack.Configuration

SIPml.Stack.Event

				AnonymousClass SIPml.Session.Configuration

				SIPml.Session.Configuration

Defined in:  SIPml.js.

AnonymousClass Summary

						Constructor Attributes
						Constructor Name and Description

								SIPml.Session.Configuration

Anonymous SIP Session configuration object.

Field Summary

							Field Attributes
							Field Name and Description

								audio_remote

HTMLAudioElement used to playback the remote audio stream.

								bandwidth

Defines the maximum audio and video bandwidth to use.

								expires

Session timeout in seconds.

								from

Set the source uri string to be used in the From header (available since API version 1.2.170).

								screencast_window_id

Windows identifer from which to grab frames for application or desktop share.

								sip_caps

{name,value} pairs defining the SIP capabilities associated to this session.

								sip_headers

{name,value,session} trios defining the SIP headers associated to this session.

								video_local

HTMLVideoElement where to display the local video preview.

								video_remote

HTMLVideoElement where to display the remote video stream.

								video_size

Defines the maximum and minimum video size to be used.

					AnonymousClass Detail

						SIPml.Session.Configuration

					Anonymous SIP Session configuration object.

var configuration =
{
    expires: 200,
    audio_remote: document.getElementById('audio_remote'), // <audio id="audio_remote" .../>
    video_local: document.getElementById('video_local'),  // <video id="video_local" .../>
    video_remote: document.getElementById('video_remote'),  // <video id="video_remote" .../>
    sip_caps: [
                    {name: '+g.oma.sip-im'},
                    {name: '+sip.ice'},
                    {name: 'language', value: '\"en,fr\"'}
            ],
    sip_headers: [
                    {name: 'What', value: 'Audio/Video call', session: false},
                    {name: 'Organization', value: 'Doubango Telecom', session: false}
            ]
}

					Field Detail

					{HTMLAudioElement}
					audio_remote

						HTMLAudioElement used to playback the remote audio stream. This propety should only be used for audio sessions.

					{Object}
					bandwidth

						Defines the maximum audio and video bandwidth to use. This will change the outhoing SDP to include a "b:AS=" attribute. Use 0 to let the browser negotiates the right value using RTCP-REMB and congestion control. A default value for all sessions could be defined at stack level.

Available since version 1.3.203.

Example: { audio:64, video:512 }

					{Integer}
					expires

						Session timeout in seconds.

					{String}
					from

						Set the source uri string to be used in the From header (available since API version 1.2.170).

					{Integer}
					screencast_window_id

						Windows identifer from which to grab frames for application or desktop share. Use #0 to share your entire desktop. This property should only be used when webrt4all with support fot BFCP is installed.

Available since version 2.0.0.

					{Array}
					sip_caps

						{name,value} pairs defining the SIP capabilities associated to this session. The capabilities are added to the Contact header. Please refer to rfc3840 and rfc3841 for more information.

					{Array}
					sip_headers

						{name,value,session} trios defining the SIP headers associated to this session. session is a boolean defining whether the header have to be added to all outgoing request or not (initial only).

					{HTMLVideoElement}
					video_local

						HTMLVideoElement where to display the local video preview. This propety should only be used for video sessions.

					{HTMLVideoElement}
					video_remote

						HTMLVideoElement where to display the remote video stream. This propety should only be used for video sessions.

					{Object}
					video_size

						Defines the maximum and minimum video size to be used. All values are optional. The browser will try to find the best video size between max and min based on the camera capabilities. A default value for all sessions could be defined at stack level.

Available since version 1.3.203.

Example: { minWidth:640, minHeight:480, maxWidth:1920, maxHeight:1080 }

			Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 27 2016 14:54:44 GMT+0900 (KST)


text:
package test.api.athlete.async;

import javastrava.api.API;
import javastrava.model.StravaAthlete;
import test.api.athlete.ListAthletesBothFollowingTest;
import test.api.callback.APIListCallback;
import test.api.util.ArrayCallback;

/**
 * <p>
 * Specific tests for {@link API#listAthletesBothFollowingAsync(Integer, Integer, Integer)}
 * </p>
 *
 * @author Dan Shannon
 *
 */
public class ListAthletesBothFollowingAsyncTest extends ListAthletesBothFollowingTest {
	/**
	 * @see test.api.athlete.ListAthletesBothFollowingTest#listCallback()
	 */
	@Override
	protected APIListCallback<StravaAthlete, Integer> listCallback() {
		return (api, id) -> api.listAthletesBothFollowingAsync(id, null, null).get();
	}

	/**
	 * @see test.api.athlete.ListAthletesBothFollowingTest#pagingCallback()
	 */
	@Override
	protected ArrayCallback<StravaAthlete> pagingCallback() {
		return paging -> api().listAthletesBothFollowingAsync(validId(), paging.getPage(), paging.getPageSize()).get();
	}

}


text:
<!DOCTYPE html>

  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

  <title>404 Page not found</title>
  <meta property="og:title" content="404 Page not found" />
  <meta name="twitter:title" content="404 Page not found" />
  <meta name="author" content="klue"/>
  <meta name="twitter:card" content="summary" />
  <meta name="twitter:site" content="@kedyliu" />
  <meta name="twitter:creator" content="@kedyliu" />
  <meta property="og:url" content="https://klue.github.io/" />
  <meta property="og:type" content="website" />
  <meta property="og:site_name" content="klue-less thoughts" />

  <meta name="generator" content="Hugo 0.30.2" />
  <link rel="canonical" href="https://klue.github.io/" />
  <link rel="alternate" href="https://klue.github.io/index.xml" type="application/rss+xml" title="klue-less thoughts">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" integrity="sha384-wITovz90syo1dJWVh32uuETPVEtGigN07tkttEqPv+uR2SE/mbQcG7ATL28aI9H0" crossorigin="anonymous">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  <link rel="stylesheet" href="https://klue.github.io//css/main.css" />
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" />
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" />
  <link rel="stylesheet" href="https://klue.github.io//css/pygment_highlights.css" />
  <link rel="stylesheet" href="https://klue.github.io//css/highlight.min.css" /><link href="/css/prism.css" rel="stylesheet" />

      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-navbar">
        Toggle navigation

      </button>
      klue-less thoughts

              about

Whoops, this page doesn't exist. Move along. (404 error)

          klue
           •
          2017

             •
            klue-less thoughts

          Hugo v0.30.2 powered  •  Theme by Beautiful Jekyll adapted to Beautiful Hugo


text:
namespace ceres {
namespace internal {

// ------- Define ALIGNED_CHAR_ARRAY --------------------------------

#ifndef ALIGNED_CHAR_ARRAY

// Because MSVC and older GCCs require that the argument to their alignment
// construct to be a literal constant integer, we use a template instantiated
// at all the possible powers of two.
template<int alignment, int size> struct AlignType { };
template<int size> struct AlignType<0, size> { typedef char result[size]; };
#if defined(_MSC_VER)
#define BASE_PORT_H_ALIGN_ATTRIBUTE(X) __declspec(align(X))
#define BASE_PORT_H_ALIGN_OF(T) __alignof(T)
#elif defined(__GNUC__)
#define BASE_PORT_H_ALIGN_ATTRIBUTE(X) __attribute__((aligned(X)))
#define BASE_PORT_H_ALIGN_OF(T) __alignof__(T)
#endif

#if defined(BASE_PORT_H_ALIGN_ATTRIBUTE)

#define BASE_PORT_H_ALIGNTYPE_TEMPLATE(X) \
  template<int size> struct AlignType<X, size> { \
    typedef BASE_PORT_H_ALIGN_ATTRIBUTE(X) char result[size]; \
  }

BASE_PORT_H_ALIGNTYPE_TEMPLATE(1);
BASE_PORT_H_ALIGNTYPE_TEMPLATE(2);
BASE_PORT_H_ALIGNTYPE_TEMPLATE(4);
BASE_PORT_H_ALIGNTYPE_TEMPLATE(8);
BASE_PORT_H_ALIGNTYPE_TEMPLATE(16);
BASE_PORT_H_ALIGNTYPE_TEMPLATE(32);
BASE_PORT_H_ALIGNTYPE_TEMPLATE(64);
BASE_PORT_H_ALIGNTYPE_TEMPLATE(128);
BASE_PORT_H_ALIGNTYPE_TEMPLATE(256);
BASE_PORT_H_ALIGNTYPE_TEMPLATE(512);
BASE_PORT_H_ALIGNTYPE_TEMPLATE(1024);
BASE_PORT_H_ALIGNTYPE_TEMPLATE(2048);
BASE_PORT_H_ALIGNTYPE_TEMPLATE(4096);
BASE_PORT_H_ALIGNTYPE_TEMPLATE(8192);
// Any larger and MSVC++ will complain.

#define ALIGNED_CHAR_ARRAY(T, Size) \
  typename AlignType<BASE_PORT_H_ALIGN_OF(T), sizeof(T) * Size>::result

#undef BASE_PORT_H_ALIGNTYPE_TEMPLATE
#undef BASE_PORT_H_ALIGN_ATTRIBUTE

#else  // defined(BASE_PORT_H_ALIGN_ATTRIBUTE)
#define ALIGNED_CHAR_ARRAY you_must_define_ALIGNED_CHAR_ARRAY_for_your_compiler
#endif // defined(BASE_PORT_H_ALIGN_ATTRIBUTE)

#undef BASE_PORT_H_ALIGNTYPE_TEMPLATE
#undef BASE_PORT_H_ALIGN_ATTRIBUTE

#endif  // ALIGNED_CHAR_ARRAY

template <typename Type>
class ManualConstructor {
 public:
  // No constructor or destructor because one of the most useful uses of
  // this class is as part of a union, and members of a union cannot have
  // constructors or destructors.  And, anyway, the whole point of this
  // class is to bypass these.

  inline Type* get() {
    return reinterpret_cast<Type*>(space_);
  }
  inline const Type* get() const  {
    return reinterpret_cast<const Type*>(space_);
  }

  inline Type* operator->() { return get(); }
  inline const Type* operator->() const { return get(); }

  inline Type& operator*() { return *get(); }
  inline const Type& operator*() const { return *get(); }

  // You can pass up to four constructor arguments as arguments of Init().
  inline void Init() {
    new(space_) Type;
  }

  template <typename T1>
  inline void Init(const T1& p1) {
    new(space_) Type(p1);
  }

  template <typename T1, typename T2>
  inline void Init(const T1& p1, const T2& p2) {
    new(space_) Type(p1, p2);
  }

  template <typename T1, typename T2, typename T3>
  inline void Init(const T1& p1, const T2& p2, const T3& p3) {
    new(space_) Type(p1, p2, p3);
  }

  template <typename T1, typename T2, typename T3, typename T4>
  inline void Init(const T1& p1, const T2& p2, const T3& p3, const T4& p4) {
    new(space_) Type(p1, p2, p3, p4);
  }

  template <typename T1, typename T2, typename T3, typename T4, typename T5>
  inline void Init(const T1& p1, const T2& p2, const T3& p3, const T4& p4,
                   const T5& p5) {
    new(space_) Type(p1, p2, p3, p4, p5);
  }

  template <typename T1, typename T2, typename T3, typename T4, typename T5,
            typename T6>
  inline void Init(const T1& p1, const T2& p2, const T3& p3, const T4& p4,
                   const T5& p5, const T6& p6) {
    new(space_) Type(p1, p2, p3, p4, p5, p6);
  }

  template <typename T1, typename T2, typename T3, typename T4, typename T5,
            typename T6, typename T7>
  inline void Init(const T1& p1, const T2& p2, const T3& p3, const T4& p4,
                   const T5& p5, const T6& p6, const T7& p7) {
    new(space_) Type(p1, p2, p3, p4, p5, p6, p7);
  }

  template <typename T1, typename T2, typename T3, typename T4, typename T5,
            typename T6, typename T7, typename T8>
  inline void Init(const T1& p1, const T2& p2, const T3& p3, const T4& p4,
                   const T5& p5, const T6& p6, const T7& p7, const T8& p8) {
    new(space_) Type(p1, p2, p3, p4, p5, p6, p7, p8);
  }

  template <typename T1, typename T2, typename T3, typename T4, typename T5,
            typename T6, typename T7, typename T8, typename T9>
  inline void Init(const T1& p1, const T2& p2, const T3& p3, const T4& p4,
                   const T5& p5, const T6& p6, const T7& p7, const T8& p8,
                   const T9& p9) {
    new(space_) Type(p1, p2, p3, p4, p5, p6, p7, p8, p9);
  }

  template <typename T1, typename T2, typename T3, typename T4, typename T5,
            typename T6, typename T7, typename T8, typename T9, typename T10>
  inline void Init(const T1& p1, const T2& p2, const T3& p3, const T4& p4,
                   const T5& p5, const T6& p6, const T7& p7, const T8& p8,
                   const T9& p9, const T10& p10) {
    new(space_) Type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
  }

  template <typename T1, typename T2, typename T3, typename T4, typename T5,
            typename T6, typename T7, typename T8, typename T9, typename T10,
            typename T11>
  inline void Init(const T1& p1, const T2& p2, const T3& p3, const T4& p4,
                   const T5& p5, const T6& p6, const T7& p7, const T8& p8,
                   const T9& p9, const T10& p10, const T11& p11) {
    new(space_) Type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
  }

  inline void Destroy() {
    get()->~Type();
  }

 private:
  ALIGNED_CHAR_ARRAY(Type, 1) space_;
};

#undef ALIGNED_CHAR_ARRAY

}  // namespace internal
}  // namespace ceres

#endif  // CERES_PUBLIC_INTERNAL_MANUAL_CONSTRUCTOR_H_


text:
package com.rubengees.introductionsample;

import android.content.Context;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;

import com.rubengees.introductionsample.transformer.ColorPageTransformer;

/**
 * Class for retrieving colors, especially for the {@link ColorPageTransformer}. In your project
 * use this in the MainActivity to get the colors for your Introduction. This is not done here
 * to keep the sample simple.
 *
 * @author Ruben Gees
 */
public final class ColorSupplier {

    private static final Integer[] colors = new Integer[]{R.color.green, R.color.indigo, R.color.orange};
    private static final String ILLEGAL_ARGUMENT_POSITION_MESSAGE = "The position cannot be " +
            "larger than the amount of colors";

    private ColorSupplier() {
    }

    @ColorInt
    public static int getColorResForPosition(int position) {
        if (position > colors.length) {
            throw new IllegalArgumentException(ILLEGAL_ARGUMENT_POSITION_MESSAGE);
        }

        return colors[position];
    }

    @ColorInt
    public static int getColorForPosition(@NonNull Context context, int position) {
        if (position > colors.length) {
            throw new IllegalArgumentException(ILLEGAL_ARGUMENT_POSITION_MESSAGE);
        }

        return ContextCompat.getColor(context, colors[position]);
    }
}


text:
layout: post
title: Coursera
---

Coursera has several Python-focused classes which we've heard good things about.

* [An Introduction to Interactive Programming in Python (Part 1)](https://www.coursera.org/course/interactivepython1)
* [Learn to Program: The Fundamentals](https://www.coursera.org/course/programming1)
* [Programming for Everybody](https://www.coursera.org/course/pythonlearn)

For those who aren't complete beginners:

* [Crafting Quality Code](https://www.coursera.org/course/programming2)
* [Machine Learning](https://www.coursera.org/course/ml)
* [MIT 600.1x](https://www.edx.org/course/introduction-computer-science-mitx-6-00-1x-0)

Coursera classes work well with study groups since the regular schedule helps keep you on track (and self-accountable!), plus you can meet others taking the same class. It's sometimes good to hear that you weren't the only one bashing your head against a particular assignment!


text:
scoped_refptr<CrashUploadList> CreateCrashUploadList(
    UploadList::Delegate* delegate);

#endif  // CHROME_BROWSER_CRASH_UPLOAD_LIST_CRASH_UPLOAD_LIST_H_


text:
import { FieldSchema, StructureSchema } from '@ephox/boulder';
import { Result } from '@ephox/katamari';

import * as ComponentSchema from '../../core/ComponentSchema';

export interface HtmlPanelSpec {
  type: 'htmlpanel';
  html: string;
  presets?: 'presentation' | 'document';
}

export interface HtmlPanel {
  type: 'htmlpanel';
  html: string;
  // The htmlpanel can either have the attribute role = "presentation" or role = "document" and associated behaviours
  presets: 'presentation' | 'document';
}

const htmlPanelFields = [
  ComponentSchema.type,
  FieldSchema.requiredString('html'),
  FieldSchema.defaultedStringEnum('presets', 'presentation', [ 'presentation', 'document' ])
];

export const htmlPanelSchema = StructureSchema.objOf(htmlPanelFields);

export const createHtmlPanel = (spec: HtmlPanelSpec): Result<HtmlPanel, StructureSchema.SchemaError<any>> =>
  StructureSchema.asRaw<HtmlPanel>('htmlpanel', htmlPanelSchema, spec);


text:
title: "Startup Catalyst: I'm off to Silicon Valley!"
date: 2014-10-22
image: /images/startup_catalyst.png
draft: true
published: false
sitemap: false
---

![Startup Catalyst](/images/startup_catalyst.png)

Exciting news! I've been accepted into the inaugural [Startup Catalyst](http://www.startupcatalyst.com.au/) program!

> Startup Catalyst is an annual mission to Silicon Valley for
> twenty young people who have the potential to be Australia's
> next batch of globally successful tech entrepreneurs.

That means I'll be off to the US of A on the 16th of November for 2 weeks visiting companies like [Facebook](https://www.facebook.com) and [Google](https://google.com), and dropping in to accelerators like [Plug and Play Tech Center](http://www.plugandplaytechcenter.com/), [500Startups](http://500.co) and [Runway](http://www.runway.is/)!

The highlight of the program will be participating in [Startup Weekend](http://startupweekend.org/): 52 hours to come up with an idea, form a team, validate our assumptions, build a prototype and launch!

I can't wait to start exploring the global center of technology development and business growth with Brisbane's startup elite: Steve Baxter (of Pipe Networks fame), Colin Kinner, Peter Laurie and Jason Seed - as well as 19 other up and coming tech entrepreneurs.


text:
@interface AbstractUpdatePublisher : NSObject
{
  @private
    NSInvocation * invocation;
}

#pragma mark Initialization

- (id)initWithListener:(id)listener action:(SEL)action;

#pragma mark Notifying listeners -- to be called by subclasses

- (void)notifyListener:(NSArray *)args;

@end


text:
bool ViewHelpState::init()
{
	escBack = new Text(game->getRenderer(), "Esc (back)", 520, 555, game->standard_font_32);
	introductionScreen = new Sprite(game, "./gfx/intro/introductscreen.png", 0, 0, WWIDTH, WHEIGHT);

	return true;
}

void ViewHelpState::cleanup()
{
	delete escBack;
	delete introductionScreen;
}

bool ViewHelpState::handleEvent(const SDL_Event &ev)
{
	if (ev.key.type == SDL_KEYDOWN && ev.key.keysym.sym == SDLK_ESCAPE)
	{
		game->getEngine()->setState((State*)game->mainMenuState);
		return true;
	}

	return false;
}

void ViewHelpState::render(SDL_Renderer* const renderer)
{
	introductionScreen->draw(renderer);
	escBack->draw(renderer);
}


text:
package com.intellij.openapi.compiler;

import javax.annotation.Nullable;

/**
 * TODO [VISTALL] just a stub for future work
 */
public interface ClassObject
{
	String getPath();

	String getClassName();

	@Nullable
	byte[] getContent();
}


text:
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var prefix = 'far';
var iconName = 'window-minimize';
var width = 512;
var height = 512;
var aliases = [128469];
var unicode = 'f2d1';
var svgPathData = 'M0 456C0 442.7 10.75 432 24 432H488C501.3 432 512 442.7 512 456C512 469.3 501.3 480 488 480H24C10.75 480 0 469.3 0 456z';

exports.definition = {
  prefix: prefix,
  iconName: iconName,
  icon: [
    width,
    height,
    aliases,
    unicode,
    svgPathData
  ]};

exports.faWindowMinimize = exports.definition;
exports.prefix = prefix;
exports.iconName = iconName;
exports.width = width;
exports.height = height;
exports.ligatures = aliases;
exports.unicode = unicode;
exports.svgPathData = svgPathData;
exports.aliases = aliases;


text:
package com.google.api.ads.dfp.jaxws.v201306;

import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for StatementError.Reason.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *

 *

 * <simpleType name="StatementError.Reason">
 *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *     <enumeration value="VARIABLE_NOT_BOUND_TO_VALUE"/>
 *     <enumeration value="UNKNOWN"/>
 *   </restriction>
 * </simpleType>
 *

 *
 */
@XmlType(name = "StatementError.Reason")
@XmlEnum
public enum StatementErrorReason {

    /**
     *
     *                 A bind variable has not been bound to a value.
     *
     *
     */
    VARIABLE_NOT_BOUND_TO_VALUE,

    /**
     *
     *                 The value returned if the actual value is not exposed by the requested API version.
     *
     *
     */
    UNKNOWN;

    public String value() {
        return name();
    }

    public static StatementErrorReason fromValue(String v) {
        return valueOf(v);
    }

}