text:
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
#include <linux/timer.h>
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/fs.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/uaccess.h>
#include <asm/blackfin.h>

#define stamp(fmt, args...) \
	pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args)
#define stampit() stamp("here i am")
#define pr_devinit(fmt, args...) \
	({ static const __devinitconst char __fmt[] = fmt; \
	printk(__fmt, ## args); })
#define pr_init(fmt, args...) \
	({ static const __initconst char __fmt[] = fmt; \
	printk(__fmt, ## args); })

#define WATCHDOG_NAME "bfin-wdt"
#define PFX WATCHDOG_NAME ": "

/* The BF561 has two watchdogs (one per core), but since Linux
 * only runs on core A, we'll just work with that one.
 */
#ifdef BF561_FAMILY
# define bfin_read_WDOG_CTL()    bfin_read_WDOGA_CTL()
# define bfin_read_WDOG_CNT()    bfin_read_WDOGA_CNT()
# define bfin_read_WDOG_STAT()   bfin_read_WDOGA_STAT()
# define bfin_write_WDOG_CTL(x)  bfin_write_WDOGA_CTL(x)
# define bfin_write_WDOG_CNT(x)  bfin_write_WDOGA_CNT(x)
# define bfin_write_WDOG_STAT(x) bfin_write_WDOGA_STAT(x)
#endif

/* Bit in SWRST that indicates boot caused by watchdog */
#define SWRST_RESET_WDOG 0x4000

/* Bit in WDOG_CTL that indicates watchdog has expired (WDR0) */
#define WDOG_EXPIRED 0x8000

/* Masks for WDEV field in WDOG_CTL register */
#define ICTL_RESET   0x0
#define ICTL_NMI     0x2
#define ICTL_GPI     0x4
#define ICTL_NONE    0x6
#define ICTL_MASK    0x6

/* Masks for WDEN field in WDOG_CTL register */
#define WDEN_MASK    0x0FF0
#define WDEN_ENABLE  0x0000
#define WDEN_DISABLE 0x0AD0

/* some defaults */
#define WATCHDOG_TIMEOUT 20

static unsigned int timeout = WATCHDOG_TIMEOUT;
static int nowayout = WATCHDOG_NOWAYOUT;
static struct watchdog_info bfin_wdt_info;
static unsigned long open_check;
static char expect_close;
static DEFINE_SPINLOCK(bfin_wdt_spinlock);

/**
 *	bfin_wdt_keepalive - Keep the Userspace Watchdog Alive
 *
 * 	The Userspace watchdog got a KeepAlive: schedule the next timeout.
 */
static int bfin_wdt_keepalive(void)
{
	stampit();
	bfin_write_WDOG_STAT(0);
	return 0;
}

/**
 *	bfin_wdt_stop - Stop the Watchdog
 *
 *	Stops the on-chip watchdog.
 */
static int bfin_wdt_stop(void)
{
	stampit();
	bfin_write_WDOG_CTL(WDEN_DISABLE);
	return 0;
}

/**
 *	bfin_wdt_start - Start the Watchdog
 *
 *	Starts the on-chip watchdog.  Automatically loads WDOG_CNT
 *	into WDOG_STAT for us.
 */
static int bfin_wdt_start(void)
{
	stampit();
	bfin_write_WDOG_CTL(WDEN_ENABLE | ICTL_RESET);
	return 0;
}

/**
 *	bfin_wdt_running - Check Watchdog status
 *
 *	See if the watchdog is running.
 */
static int bfin_wdt_running(void)
{
	stampit();
	return ((bfin_read_WDOG_CTL() & WDEN_MASK) != WDEN_DISABLE);
}

/**
 *	bfin_wdt_set_timeout - Set the Userspace Watchdog timeout
 *	@t: new timeout value (in seconds)
 *
 *	Translate the specified timeout in seconds into System Clock
 *	terms which is what the on-chip Watchdog requires.
 */
static int bfin_wdt_set_timeout(unsigned long t)
{
	u32 cnt;
	unsigned long flags;

	stampit();

	cnt = t * get_sclk();
	if (cnt < get_sclk()) {
		printk(KERN_WARNING PFX "timeout value is too large\n");
		return -EINVAL;
	}

	spin_lock_irqsave(&bfin_wdt_spinlock, flags);
	{
		int run = bfin_wdt_running();
		bfin_wdt_stop();
		bfin_write_WDOG_CNT(cnt);
		if (run)
			bfin_wdt_start();
	}
	spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);

	timeout = t;

	return 0;
}

/**
 *	bfin_wdt_open - Open the Device
 *	@inode: inode of device
 *	@file: file handle of device
 *
 *	Watchdog device is opened and started.
 */
static int bfin_wdt_open(struct inode *inode, struct file *file)
{
	stampit();

	if (test_and_set_bit(0, &open_check))
		return -EBUSY;

	if (nowayout)
		__module_get(THIS_MODULE);

	bfin_wdt_keepalive();
	bfin_wdt_start();

	return nonseekable_open(inode, file);
}

/**
 *	bfin_wdt_close - Close the Device
 *	@inode: inode of device
 *	@file: file handle of device
 *
 *	Watchdog device is closed and stopped.
 */
static int bfin_wdt_release(struct inode *inode, struct file *file)
{
	stampit();

	if (expect_close == 42)
		bfin_wdt_stop();
	else {
		printk(KERN_CRIT PFX
			"Unexpected close, not stopping watchdog!\n");
		bfin_wdt_keepalive();
	}
	expect_close = 0;
	clear_bit(0, &open_check);
	return 0;
}

/**
 *	bfin_wdt_write - Write to Device
 *	@file: file handle of device
 *	@buf: buffer to write
 *	@count: length of buffer
 *	@ppos: offset
 *
 *	Pings the watchdog on write.
 */
static ssize_t bfin_wdt_write(struct file *file, const char __user *data,
						size_t len, loff_t *ppos)
{
	stampit();

	if (len) {
		if (!nowayout) {
			size_t i;

			/* In case it was set long ago */
			expect_close = 0;

			for (i = 0; i != len; i++) {
				char c;
				if (get_user(c, data + i))
					return -EFAULT;
				if (c == 'V')
					expect_close = 42;
			}
		}
		bfin_wdt_keepalive();
	}

	return len;
}

/**
 *	bfin_wdt_ioctl - Query Device
 *	@file: file handle of device
 *	@cmd: watchdog command
 *	@arg: argument
 *
 *	Query basic information from the device or ping it, as outlined by the
 *	watchdog API.
 */
static long bfin_wdt_ioctl(struct file *file,
				unsigned int cmd, unsigned long arg)
{
	void __user *argp = (void __user *)arg;
	int __user *p = argp;

	stampit();

	switch (cmd) {
	case WDIOC_GETSUPPORT:
		if (copy_to_user(argp, &bfin_wdt_info, sizeof(bfin_wdt_info)))
			return -EFAULT;
		else
			return 0;
	case WDIOC_GETSTATUS:
	case WDIOC_GETBOOTSTATUS:
		return put_user(!!(_bfin_swrst & SWRST_RESET_WDOG), p);
	case WDIOC_SETOPTIONS: {
		unsigned long flags;
		int options, ret = -EINVAL;

		if (get_user(options, p))
			return -EFAULT;

		spin_lock_irqsave(&bfin_wdt_spinlock, flags);
		if (options & WDIOS_DISABLECARD) {
			bfin_wdt_stop();
			ret = 0;
		}
		if (options & WDIOS_ENABLECARD) {
			bfin_wdt_start();
			ret = 0;
		}
		spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);
		return ret;
	}
	case WDIOC_KEEPALIVE:
		bfin_wdt_keepalive();
		return 0;
	case WDIOC_SETTIMEOUT: {
		int new_timeout;

		if (get_user(new_timeout, p))
			return -EFAULT;
		if (bfin_wdt_set_timeout(new_timeout))
			return -EINVAL;
	}
	/* Fall */
	case WDIOC_GETTIMEOUT:
		return put_user(timeout, p);
	default:
		return -ENOTTY;
	}
}

/**
 *	bfin_wdt_notify_sys - Notifier Handler
 *	@this: notifier block
 *	@code: notifier event
 *	@unused: unused
 *
 *	Handles specific events, such as turning off the watchdog during a
 *	shutdown event.
 */
static int bfin_wdt_notify_sys(struct notifier_block *this,
					unsigned long code, void *unused)
{
	stampit();

	if (code == SYS_DOWN || code == SYS_HALT)
		bfin_wdt_stop();

	return NOTIFY_DONE;
}

#ifdef CONFIG_PM
static int state_before_suspend;

/**
 *	bfin_wdt_suspend - suspend the watchdog
 *	@pdev: device being suspended
 *	@state: requested suspend state
 *
 *	Remember if the watchdog was running and stop it.
 *	TODO: is this even right?  Doesn't seem to be any
 *	      standard in the watchdog world ...
 */
static int bfin_wdt_suspend(struct platform_device *pdev, pm_message_t state)
{
	stampit();

	state_before_suspend = bfin_wdt_running();
	bfin_wdt_stop();

	return 0;
}

/**
 *	bfin_wdt_resume - resume the watchdog
 *	@pdev: device being resumed
 *
 *	If the watchdog was running, turn it back on.
 */
static int bfin_wdt_resume(struct platform_device *pdev)
{
	stampit();

	if (state_before_suspend) {
		bfin_wdt_set_timeout(timeout);
		bfin_wdt_start();
	}

	return 0;
}
#else
# define bfin_wdt_suspend NULL
# define bfin_wdt_resume NULL
#endif

static const struct file_operations bfin_wdt_fops = {
	.owner		= THIS_MODULE,
	.llseek		= no_llseek,
	.write    	= bfin_wdt_write,
	.unlocked_ioctl	= bfin_wdt_ioctl,
	.open		= bfin_wdt_open,
	.release	= bfin_wdt_release,
};

static struct miscdevice bfin_wdt_miscdev = {
	.minor    = WATCHDOG_MINOR,
	.name     = "watchdog",
	.fops     = &bfin_wdt_fops,
};

static struct watchdog_info bfin_wdt_info = {
	.identity = "Blackfin Watchdog",
	.options  = WDIOF_SETTIMEOUT |
		    WDIOF_KEEPALIVEPING |
		    WDIOF_MAGICCLOSE,
};

static struct notifier_block bfin_wdt_notifier = {
	.notifier_call = bfin_wdt_notify_sys,
};

/**
 *	bfin_wdt_probe - Initialize module
 *
 *	Registers the misc device and notifier handler.  Actual device
 *	initialization is handled by bfin_wdt_open().
 */
static int __devinit bfin_wdt_probe(struct platform_device *pdev)
{
	int ret;

	ret = register_reboot_notifier(&bfin_wdt_notifier);
	if (ret) {
		pr_devinit(KERN_ERR PFX
			"cannot register reboot notifier (err=%d)\n", ret);
		return ret;
	}

	ret = misc_register(&bfin_wdt_miscdev);
	if (ret) {
		pr_devinit(KERN_ERR PFX
			"cannot register miscdev on minor=%d (err=%d)\n",
				WATCHDOG_MINOR, ret);
		unregister_reboot_notifier(&bfin_wdt_notifier);
		return ret;
	}

	pr_devinit(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n",
	       timeout, nowayout);

	return 0;
}

/**
 *	bfin_wdt_remove - Initialize module
 *
 *	Unregisters the misc device and notifier handler.  Actual device
 *	deinitialization is handled by bfin_wdt_close().
 */
static int __devexit bfin_wdt_remove(struct platform_device *pdev)
{
	misc_deregister(&bfin_wdt_miscdev);
	unregister_reboot_notifier(&bfin_wdt_notifier);
	return 0;
}

static struct platform_device *bfin_wdt_device;

static struct platform_driver bfin_wdt_driver = {
	.probe     = bfin_wdt_probe,
	.remove    = __devexit_p(bfin_wdt_remove),
	.suspend   = bfin_wdt_suspend,
	.resume    = bfin_wdt_resume,
	.driver    = {
		.name  = WATCHDOG_NAME,
		.owner = THIS_MODULE,
	},
};

/**
 *	bfin_wdt_init - Initialize module
 *
 *	Checks the module params and registers the platform device & driver.
 *	Real work is in the platform probe function.
 */
static int __init bfin_wdt_init(void)
{
	int ret;

	stampit();

	/* Check that the timeout value is within range */
	if (bfin_wdt_set_timeout(timeout))
		return -EINVAL;

	/* Since this is an on-chip device and needs no board-specific
	 * resources, we'll handle all the platform device stuff here.
	 */
	ret = platform_driver_register(&bfin_wdt_driver);
	if (ret) {
		pr_init(KERN_ERR PFX "unable to register driver\n");
		return ret;
	}

	bfin_wdt_device = platform_device_register_simple(WATCHDOG_NAME,
								-1, NULL, 0);
	if (IS_ERR(bfin_wdt_device)) {
		pr_init(KERN_ERR PFX "unable to register device\n");
		platform_driver_unregister(&bfin_wdt_driver);
		return PTR_ERR(bfin_wdt_device);
	}

	return 0;
}

/**
 *	bfin_wdt_exit - Deinitialize module
 *
 *	Back out the platform device & driver steps.  Real work is in the
 *	platform remove function.
 */
static void __exit bfin_wdt_exit(void)
{
	platform_device_unregister(bfin_wdt_device);
	platform_driver_unregister(&bfin_wdt_driver);
}

module_init(bfin_wdt_init);
module_exit(bfin_wdt_exit);

MODULE_AUTHOR("Michele d'Amico, Mike Frysinger <vapier@gentoo.org>");
MODULE_DESCRIPTION("Blackfin Watchdog Device Driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);

module_param(timeout, uint, 0);
MODULE_PARM_DESC(timeout,
	"Watchdog timeout in seconds. (1<=timeout<=((2^32)/SCLK), default="
		__MODULE_STRING(WATCHDOG_TIMEOUT) ")");

module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout,
	"Watchdog cannot be stopped once started (default="
		__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");


text:
<?php
class ImageRoundedCorner {
	private $_r;
	private $_g;
	private $_b;
	private $_image_path;
	private $_radius;

	function __construct($image_path, $radius, $r = 255, $g = 255, $b = 255) {
		$this->_image_path = $image_path;
		$this->_radius = $radius;
		$this->_r = (int)$r;
		$this->_g = (int)$g;
		$this->_b = (int)$b;
	}

	private function _get_lt_rounder_corner() {
		$radius = $this->_radius;
		$img = imagecreatetruecolor($radius, $radius);
		$bgcolor = imagecolorallocate($img, $this->_r, $this->_g, $this->_b);
		$fgcolor = imagecolorallocate($img, 0, 0, 0);
		imagefill($img, 0, 0, $bgcolor);
		imagefilledarc($img, $radius, $radius, $radius*2, $radius*2, 180, 270, $fgcolor, IMG_ARC_PIE);
		imagecolortransparent($img, $fgcolor);
		return $img;
	}

	private function _load_source_image() {
		$ext = substr($this->_image_path, strrpos($this->_image_path, '.'));
		if (empty($ext)) {
			return false;
		}
		switch(strtolower($ext)) {
			case '.jpg':
				$img = @imagecreatefromjpeg($this->_image_path);
				break;
			case '.gif':
				$img = @imagecreatefromgif($this->_image_path);
				break;
			case '.png':
				$img = @imagecreatefrompng($this->_image_path);
				break;
			default:
				return false;
		}

		return $img;
	}

	public function round_it($p_dst_img='') {
		// load the source image
		$src_image = $this->_load_source_image();
		if ($src_image === false) {
			return false;
		}
		$image_width = imagesx($src_image);
		$image_height = imagesy($src_image);

		// create a new image, with src_width, src_height, and fill it with transparent color
		$image = imagecreatetruecolor($image_width, $image_height);
		// debug
		$alphacolor = imagecolorallocatealpha($image, $this->_r, $this->_g, $this->_b, 127);
		imagealphablending($image, false);
		imagesavealpha($image, true);
		imagefilledrectangle($image, 0, 0, $image_width, $image_height, $alphacolor);

		imagefill($image, 0, 0, $alphacolor);
		imagecopyresampled($image, $src_image, 0, 0, 0, 0, $image_width, $image_height, $image_width, $image_height);

		$radius = $this->_radius;

		imagearc($image, $radius-1, $radius-1, $radius*2, $radius*2, 180, 270, $alphacolor);
		imagefilltoborder($image, 0, 0, $alphacolor, $alphacolor);
		imagearc($image, $image_width-$radius, $radius-1, $radius*2, $radius*2, 270, 0, $alphacolor);
		imagefilltoborder($image, $image_width-1, 0, $alphacolor, $alphacolor);
		imagearc($image, $radius-1, $image_height-$radius, $radius*2, $radius*2, 90, 180, $alphacolor);
		imagefilltoborder($image, 0, $image_height-1, $alphacolor, $alphacolor);
		imagearc($image, $image_width-$radius, $image_height-$radius, $radius*2, $radius*2, 0, 90, $alphacolor);
		imagefilltoborder($image, $image_width-1, $image_height-1, $alphacolor, $alphacolor);
		imagealphablending($image, true);
		imagecolortransparent($image, $alphacolor);

// 		imageantialias($image, true);
// 		$trans_color = imagecolorallocate($image, $this->_r, $this->_g, $this->_b);
// 		imagefill($image, 0, 0, $trans_color);

// 		// then overwirte the source image to the new created image
// 		#imagecopymerge($image, $src_image, 0, 0, 0, 0, $image_width, $image_height, 100);
// 		imagecopy($image, $src_image, 0, 0, 0, 0, $image_width, $image_height);
// 		#imagecolortransparent($image, $trans_color);
// 		#header('Content-Type: image/png');imagepng($image);exit;

// 		// then just copy all the rounded corner images to the 4 corners
// 		$radius = $this->_radius;
// 		// lt
// 		$lt_corner = $this->_get_lt_rounder_corner();
// 		imagecopymerge($image, $lt_corner, 0, 0, 0, 0, $radius, $radius, 100);
// 		// lb
// 		$lb_corner = imagerotate($lt_corner, 90, $trans_color);
// 		imagecopymerge($image, $lb_corner, 0, $image_height - $radius, 0, 0, $radius, $radius, 100);
// 		// rb
// 		$rb_corner = imagerotate($lt_corner, 180, $trans_color);
// 		imagecopymerge($image, $rb_corner, $image_width - $radius, $image_height - $radius, 0, 0, $radius, $radius, 100);
// 		// rt
// 		$rt_corner = imagerotate($lt_corner, 270, $trans_color);
// 		imagecopymerge($image, $rt_corner, $image_width - $radius, 0, 0, 0, $radius, $radius, 100);

// 		// set the transparency
// 		imagecolortransparent($image, $trans_color);
		if($p_dst_img) {
			return imagepng($image, $p_dst_img);
		} else {
			header('Content-Type: image/png');
			imagepng($image);
		}

		imagedestroy($src_image);
		imagedestroy($image);
// 		imagedestroy($lt_corner);
// 		imagedestroy($lb_corner);
// 		imagedestroy($rb_corner);
// 		imagedestroy($rt_corner);
	}
}
?>

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Configuration;
using Nucleo.Configuration;

namespace Nucleo.Logs.Configuration
{
	public class LoggerSettingsSection : ConfigurationSection
	{
		#region " Properties "

		[ConfigurationProperty("currentVerbosityName")]
		public string CurrentVerbosityName
		{
			get { return (string)this["currentVerbosityName"]; }
			set { this["currentVerbosityName"] = value; }
		}

		public static LoggerSettingsSection Instance
		{
			get { return ConfigurationManager.GetSection("nucleo/loggerSettings") as LoggerSettingsSection; }
		}

		[
		ConfigurationProperty("logManagers", IsDefaultCollection=false),
		ConfigurationCollection(typeof(NameTypeElementCollection))
		]
		public NameTypeElementCollection LogManagers
		{
			get { return (NameTypeElementCollection)this["logManagers"]; }
		}

		[
		ConfigurationProperty("messageTypes", IsDefaultCollection=false),
		ConfigurationCollection(typeof(LogMessageTypeElementCollection))
		]
		public LogMessageTypeElementCollection MessageTypes
		{
			get { return (LogMessageTypeElementCollection)this["messageTypes"]; }
		}

		[
		ConfigurationProperty("verbosityTypes", IsDefaultCollection = false),
		ConfigurationCollection(typeof(LogVerbosityTypeElementCollection))
		]
		public LogVerbosityTypeElementCollection VerbosityTypes
		{
			get { return (LogVerbosityTypeElementCollection)this["verbosityTypes"]; }
		}

		#endregion
	}
}


text:
help(
[[
This module loads the connect client 0.2.1 into the environment.
The connect client is a setup of applications that allow users to
run jobs on the OSG Connect infrastructure from their local campus cluster.

]])

whatis("Loads the connect client tools")

local version = "0.2.1"
local base = "/cvmfs/oasis.opensciencegrid.org/osg/modules/connect-client/"..version

prepend_path("PATH", pathJoin(base, "bin"))

family('connect-client')
load('python/2.7')
load('gcc')


text:
enum MobileDeviceCommandType
{
    GetUDID,
    InstallApp,
    UninstallApp,
    ListApps,
    ListFiles,
    RemoveFile,
    DownloadFile,
    UploadFile
};

struct
{
    struct am_device_notification *notification;
    enum MobileDeviceCommandType type;
    char *target;
    char *app_path;
    char *bundle_id;
    char *file_path;
    char *destination_path;
    int print_paths;
    uint16_t src_port;
    uint16_t dst_port;
} command;

void print_usage()
{
    printf("\nUsage: appdeploy <command> [<options>]\n");
    printf("    -p <path_to_app>\n");
    printf("        - Local Path to .app file. ex /Users/me/Documents/CumberTest.app \n\n");
    printf("    -b <bundle_id>\n");
    printf("        - Bundle Identification of application. ex com.apple.Music \n\n");
    printf("    -f <file_path>\n");
    printf("        - The path to the file on the device. ex /Documents/File.png \n\n");
    printf("    -dest <destination_path>\n");
    printf("        - The local path to store the downloaded file. ex /Users/me/File.png \n\n");
    printf("    -t <target_device>\n");
    printf("        - The device to target with the selected action. Will install to the first device found if not specified\n\n");
    printf("    -v (verbose)\n");
    printf("        - Enables the verbose output where available.\n\n");
    printf("Commands:\n");
    printf("    get_udid\n");
    printf("        - Display UDID of connected device (will only show the first device discovered) \n\n");
    printf("    get_bundle_id <path_to_app>\n");
    printf("        - Display bundle identifier of app \n\n");
    printf("    install -p <path_to_app> [-t <target_device>]\n");
    printf("        - Install app to device\n\n");
    printf("    uninstall -b <bundle_id> [-t <target_device>]\n");
    printf("        - Uninstall app by bundle id\n\n");
    printf("    remove_file -b <bundle_id> -f <file_path> [-t <target_device>]\n");
    printf("        - Deletes the specified file at the given path\n\n");
    printf("    download_file -b <bundle_id> -f <file_path> -dest <destination_path> [-t <target_device>]\n");
    printf("        - Deletes the specified file at the given path\n\n");
    printf("    upload_file -b <bundle_id> -f <file_path> -dest <destination_path> [-t <target_device>]\n");
    printf("        - Upload the specified file at the given path\n\n");
    printf("    list_files -b <bundle_id> [-v] [-t <target_device>]\n");
    printf("        - Lists all of the files in the sandbox for the specified app.\n");
    printf("        - Use the optional -v paramater to get also list all directories\n\n");
    printf("    list_apps [-v] [-t <target_device>]\n");
    printf("        - Lists all installed apps on device\n");
    printf("        - Use the optional -v paramater to include all application installation paths\n\n");
}

// Unregister notifications
void unregister_device_notification(int status)
{
    AMDeviceNotificationUnsubscribe(command.notification);
    exit(status);
}

// Helpers
char *create_cstr_from_cfstring(CFStringRef cfstring)
{
    CFIndex str_length = CFStringGetLength(cfstring);

    if (str_length < 0)
    {
        return NULL;
    }

    CFIndex buf_length = CFStringGetMaximumSizeForEncoding(str_length, kCFStringEncodingUTF8) + 1;

    if (buf_length < 1)
    {
        return NULL;
    }

    char *cstr = (char *)malloc(buf_length);

    if (cstr == NULL)
    {
        return NULL;
    }

    if (CFStringGetCString(cfstring, cstr, buf_length, kCFStringEncodingUTF8))
    {
        return cstr;
    }

    return NULL;
}

CFURLRef get_absolute_file_url(const char *file_path)
{
    CFStringRef path = CFStringCreateWithCString(NULL, file_path, kCFStringEncodingUTF8);
    CFURLRef relative_url = CFURLCreateWithFileSystemPath(NULL, path, kCFURLPOSIXPathStyle, false);
    CFURLRef url = CFURLCopyAbsoluteURL(relative_url);

    CFRelease(path);
    CFRelease(relative_url);
    return url;
}

void connect_to_device(struct am_device *device)
{
    AMDeviceConnect(device);
    ASSERT_OR_EXIT(AMDeviceIsPaired(device), "Error attempting to connect to device: AMDeviceIsPaired failed\n");
    ASSERT_OR_EXIT(!AMDeviceValidatePairing(device), "Error attempting to connect to device: AMDeviceValidatePairing failed\n");
    ASSERT_OR_EXIT(!AMDeviceStartSession(device), "Error attempting to connect to device: AMDeviceStartSession failed\n");
}

static void print_installed_app(const void *key, const void *value, void *context)
{
    if ((key == NULL) || (value == NULL))
    {
        return;
    }

    char *bundle_id = create_cstr_from_cfstring((CFStringRef)key);

    if (bundle_id == NULL)
    {
        return;
    }

    if (command.print_paths)
    {
        char *path = NULL;
        CFStringRef path_value;
        path_value = CFDictionaryGetValue((CFDictionaryRef)value, CFSTR("Path"));

        if (path_value != NULL)
        {
            path = create_cstr_from_cfstring(path_value);
        }

        printf("%s\n\tPath: %s\n", bundle_id, (path == NULL) ? "" : path);

        if (path != NULL)
        {
            free(path);
        }
    }
    else
    {
        printf("%s\n", bundle_id);
    }

    free(bundle_id);
}

// Get UDID
void get_udid(struct am_device *device)
{
    char *udid = create_cstr_from_cfstring(AMDeviceCopyDeviceIdentifier(device));

    if (udid == NULL)
    {
        unregister_device_notification(1);
    }

    // print UDID to console
    printf("%s\n", udid);

    free(udid);
}

// Get Bundle ID
CFStringRef read_plist_for_app_path(const char *app_path)
{
    CFURLRef app_url = get_absolute_file_url(app_path);

    if (app_url == NULL)
    {
        return NULL;
    }

    CFURLRef url = CFURLCreateCopyAppendingPathComponent(NULL, app_url, CFSTR("Info.plist"), false);
    CFRelease(app_url);

    if (url == NULL)
    {
        return NULL;
    }

    CFReadStreamRef stream = CFReadStreamCreateWithFile(NULL, url);
    CFRelease(url);

    if (stream == NULL)
    {
        return NULL;
    }

    CFPropertyListRef plist = NULL;

    if (CFReadStreamOpen(stream) == TRUE)
    {
        plist = CFPropertyListCreateWithStream(NULL, stream, 0, kCFPropertyListImmutable, NULL, NULL);
    }

    CFReadStreamClose(stream);
    CFRelease(stream);

    if (plist == NULL)
    {
        return NULL;
    }

    const void *value = CFDictionaryGetValue(plist, CFSTR("CFBundleIdentifier"));
    CFStringRef bundle_id = NULL;

    if (value != NULL)
    {
        bundle_id = CFRetain(value);
    }

    CFRelease(plist);

    return bundle_id;
}

void get_bundle_id(const char *app_path)
{
    CFStringRef bundle_id = read_plist_for_app_path(app_path);

    if (bundle_id == NULL)
    {
        exit(1);
    }

    char *_bundle_id = create_cstr_from_cfstring(bundle_id);
    CFRelease(bundle_id);

    if (_bundle_id == NULL)
    {
        exit(1);
    }

    printf("%s\n", _bundle_id);
    free(_bundle_id);
    exit(0);
}

// Install App
void install_app(struct am_device *device)
{
    connect_to_device(device);

    CFURLRef local_app_url = get_absolute_file_url(command.app_path);
    CFStringRef keys[] = { CFSTR("PackageType") }, values[] = { CFSTR("Developer") };
    CFDictionaryRef options = CFDictionaryCreate(NULL, (const void **)&keys, (const void **)&values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);

    // copy .app to device
    ASSERT_OR_EXIT(!AMDeviceSecureTransferPath(0, device, local_app_url, options, NULL, 0), "Error attempting to install app: AMDeviceSecureTransferPath failed\n");

    // install package on device
    ASSERT_OR_EXIT(!AMDeviceSecureInstallApplication(0, device, local_app_url, options, NULL, 0), "Error attempting to install app: AMDeviceSecureInstallApplication failed\n");

    CFRelease(options);
    CFRelease(local_app_url);

    printf("%s successfully installed.\n", command.app_path);
}

// Uninstall App
void uninstall_app(struct am_device *device)
{
    connect_to_device(device);
    CFStringRef bundle_id = CFStringCreateWithCString(NULL, command.bundle_id, kCFStringEncodingUTF8);

    // uninstall package from device
    ASSERT_OR_EXIT(!AMDeviceSecureUninstallApplication(0, device, bundle_id, 0, NULL, 0), "Error attempting to uninstall app: AMDeviceSecureUninstallApplication failed\n");

    CFRelease(bundle_id);

    printf("%s successfully uninstalled.\n", command.bundle_id);
}

// List Apps
void list_apps(struct am_device *device)
{
    connect_to_device(device);

    CFDictionaryRef apps;
    ASSERT_OR_EXIT(!AMDeviceLookupApplications(device, 0, &apps), "Error attempting to list installed apps: AMDeviceLookupApplications failed\n");

    CFDictionaryApplyFunction(apps, print_installed_app, NULL);
    CFRelease(apps);
}

// List Files
void read_files(struct afc_connection* fileConnection, char* dir)
{
    char *dir_ent;

    struct afc_dictionary* fileDictionary;
    AFCFileInfoOpen(fileConnection, dir, &fileDictionary);

    struct afc_directory* fileDirectory;
    afc_error_t err = AFCDirectoryOpen(fileConnection, dir, &fileDirectory);

    if (err != 0)
    {
        printf("%s\n", dir);
        return;
    }
    else if (command.print_paths)
    {
        printf("%s\n", dir);
    }

    while(true)
    {
        err = AFCDirectoryRead(fileConnection, fileDirectory, &dir_ent);

        if (!dir_ent)
        {
            break;
        }

        if (strcmp(dir_ent, ".") == 0 || strcmp(dir_ent, "..") == 0)
        {
            continue;
        }

        char* dir_joined = malloc(strlen(dir) + strlen(dir_ent) + 2);
        strcpy(dir_joined, dir);

        if (dir_joined[strlen(dir)-1] != '/')
        {
            strcat(dir_joined, "/");
        }

        strcat(dir_joined, dir_ent);
        read_files(fileConnection, dir_joined);
        free(dir_joined);
    }

    AFCDirectoryClose(fileConnection, fileDirectory);
}

service_conn_t start_file_service(struct am_device * device)
{
    connect_to_device(device);

    service_conn_t serviceConnection;

    CFStringRef cf_bundle_id = CFStringCreateWithCString(NULL, command.bundle_id, kCFStringEncodingASCII);
    if (AMDeviceStartHouseArrestService(device, cf_bundle_id, 0, &serviceConnection, 0) != 0)
    {
        printf("Unable to find bundle with id: %s\n", command.bundle_id);
        exit(1);
    }

    ASSERT_OR_EXIT(AMDeviceStopSession(device) == 0, "Error attempting to list files: AMDeviceStopSession failed\n");
    ASSERT_OR_EXIT(AMDeviceDisconnect(device) == 0, "Error attempting to list files: AMDeviceDisconnect failed\n");
    CFRelease(cf_bundle_id);

    return serviceConnection;
}

void list_files(struct am_device *device)
{
    service_conn_t serviceConnection = start_file_service(device);

    struct afc_connection* fileConnection;
    AFCConnectionOpen(serviceConnection, 0, &fileConnection);

    read_files(fileConnection, "/Documents");
}

//Remove File

void delete_file(struct am_device *device)
{
    service_conn_t serviceConnection = start_file_service(device);
    struct afc_connection* fileConnection;
    AFCConnectionOpen(serviceConnection, 0, &fileConnection);

    char *fileDir = command.file_path;

    ASSERT_OR_EXIT(AFCRemovePath(fileConnection, fileDir) == 0, "Error attempting to remove file: AFCRemovePath failed\n");
    ASSERT_OR_EXIT(AFCConnectionClose(fileConnection) == 0, "Error attempting to remove file: AFCConnectionClose failed\n");

    printf("%s successfully removed.\n", command.file_path);
}

//Downlaod File

void download_file(struct am_device *device)
{
    service_conn_t serviceConnection = start_file_service(device);
    struct afc_connection* fileConnection;
    AFCConnectionOpen(serviceConnection, 0, &fileConnection);

    char *fileDir = command.file_path;
    afc_file_ref file_ref;

    ASSERT_OR_EXIT(AFCFileRefOpen(fileConnection, fileDir, 2, &file_ref) == 0, "Error attempting to download file: AFCFileRefOpen failed\n");

    struct afc_dictionary* fileDictionary;
    ASSERT_OR_EXIT(AFCFileInfoOpen(fileConnection, fileDir, &fileDictionary) == 0, "Error attempting to download file: AFCFileInfoOpen failed\n");

    char *pValue, *pKey;
    unsigned int fsize = 0;

    AFCKeyValueRead(fileDictionary, &pKey, &pValue);

	while(pKey || pValue)
    {
		if (pKey == NULL || pValue == NULL)
        {
			break;
        }
		if (!strcmp(pKey, "st_size"))
        {
			fsize = (unsigned int)atoi(pValue);
			break;
		}
		AFCKeyValueRead(fileDictionary, &pKey, &pValue);
	}
	AFCKeyValueClose(fileDictionary);

    char* buf = malloc(fsize);

    ASSERT_OR_EXIT(AFCFileRefRead(fileConnection, file_ref, buf, &fsize) == 0, "Error attempting to download file: AFCFileRefRead failed\n");
    FILE* pFile = fopen(command.destination_path, "wb");

    if (pFile)
    {
        fwrite(buf, fsize, 1, pFile);
    }
    fclose(pFile);

    ASSERT_OR_EXIT(AFCFileRefClose(fileConnection, file_ref) == 0, "Error attempting to download file: AFCFileRefClose failed\n");
    ASSERT_OR_EXIT(AFCConnectionClose(fileConnection) == 0, "Error attempting to download file: AFCConnectionClose failed\n");

    printf("%s successfully downloaded to %s.\n", command.file_path, command.destination_path);
}

//Upload File

void upload_file(struct am_device *device)
{
    service_conn_t serviceConnection = start_file_service(device);
    struct afc_connection* fileConnection;
    AFCConnectionOpen(serviceConnection, 0, &fileConnection);

    char *fileDir = command.file_path;
    char *target_dir = command.destination_path;
    afc_file_ref file_ref;

    struct stat buf;
    stat(fileDir, &buf);

    printf("%lld", buf.st_size);
    unsigned int file_size = buf.st_size;
    printf("%u", file_size);
    FILE* pFile = fopen(fileDir, "rb");
    char* content = malloc(file_size);

    if (pFile)
    {
        fread(content, file_size, 1, pFile);
    }

    ASSERT_OR_EXIT(AFCFileRefOpen(fileConnection, target_dir, 3, &file_ref) == 0, "Error attempting to upload file: AFCFileRefOpen failed\n");
    ASSERT_OR_EXIT(AFCFileRefWrite(fileConnection, file_ref, content, file_size) == 0, "Error attempting to upload file: AFCFileRefWrite failed\n");
    fclose(pFile);

    ASSERT_OR_EXIT(AFCFileRefClose(fileConnection, file_ref) == 0, "Error attempting to upload file: AFCFileRefClose failed\n");
    ASSERT_OR_EXIT(AFCConnectionClose(fileConnection) == 0, "Error attempting to upload file: AFCConnectionClose failed\n");

    printf("%s successfully upload to %s.\n", command.file_path, command.destination_path);
}

// Device Connected

void on_device_connected(struct am_device *device)
{
    switch (command.type)
    {
        case GetUDID:
            get_udid(device);
            break;

        case InstallApp:
            install_app(device);
            break;

        case UninstallApp:
            uninstall_app(device);
            break;

        case ListApps:
            list_apps(device);
            break;

        case ListFiles:
            list_files(device);
            break;

        case RemoveFile:
            delete_file(device);
            break;

        case DownloadFile:
            download_file(device);
            break;

        case UploadFile:
            upload_file(device);
            break;

        default:
            break;
    }

    unregister_device_notification(0);
}

void confirm_udid(struct am_device *device)
{
    if (command.target)
    {
        char *udid = create_cstr_from_cfstring(AMDeviceCopyDeviceIdentifier(device));

        if (strcmp(command.target, udid) == 0)
        {
            on_device_connected(device);
        }
    }
    else
    {
        on_device_connected(device);
    }
}

void on_device_notification(struct am_device_notification_callback_info *info, int cookie)
{
    switch (info->msg)
    {
        case ADNCI_MSG_CONNECTED:
            confirm_udid(info->dev);
            break;

        default:
            break;
    }
}

void register_device_notification()
{
    AMDeviceNotificationSubscribe(&on_device_notification, 0, 0, 0, &command.notification);
    CFRunLoopRun();
}

void process_args(int argc, char * params[])
{
    int i;

    for (i = 0; i < argc; i++)
    {
        if (strcmp(params[i], "-p") == 0)
        {
            command.app_path = params[i+1];
        }
        else if (strcmp(params[i], "-b") == 0)
        {
            command.bundle_id = params[i+1];
        }
        else if (strcmp(params[i], "-f") == 0)
        {
            command.file_path = params[i+1];
        }
        else if (strcmp(params[i], "-dest") == 0)
        {
            command.destination_path = params[i+1];
        }
        else if (strcmp(params[i], "-t") == 0)
        {
            command.target = params[i+1];
        }
        else if (strcmp(params[i], "-v") == 0)
        {
            command.print_paths = 1;
        }
    }
}

// Main Run Loop
int main(int argc, char * argv[])
{
    command.print_paths = 0;

    process_args(argc, argv);

    if (argc >= 2 && strcmp(argv[1], "get_udid") == 0)
    {
        command.type = GetUDID;
    }
    else if (argc >= 2 && strcmp(argv[1], "get_bundle_id") == 0)
    {
        get_bundle_id(command.app_path);
        exit(1);
    }
    else if (argc >= 2 && strcmp(argv[1], "install") == 0)
    {
        command.type = InstallApp;
    }
    else if(argc >= 2 && strcmp(argv[1], "uninstall") == 0)
    {
        command.type = UninstallApp;
    }
    else if(argc >= 2 && strcmp(argv[1], "list_apps") == 0)
    {
        command.type = ListApps;
    }
    else if(argc >= 2 && strcmp(argv[1], "list_files") == 0)
    {
        command.type = ListFiles;
    }
    else if(argc >= 2 && strcmp(argv[1], "remove_file") == 0)
    {
        command.type = RemoveFile;
    }
    else if(argc >= 2 && strcmp(argv[1], "download_file") == 0)
    {
        command.type = DownloadFile;
    }
    else if(argc >= 2 && strcmp(argv[1], "upload_file") == 0)
    {
        command.type = UploadFile;
    }
    else
    {
        print_usage();
        exit(1);
    }

    register_device_notification();
    return 1;
}


text:
#define     ASITRYSET   IncreaseGlobalAccount(0); try
#define     ASICATCHALL catch (int ASITRYCODE)
#define     ASITRYDEL   DecreaseGlobalAccount(0);
#define     ASITHROW(x) if( CheckGlobalAccount(0) ) throw((int)(x))
#pragma pack (push, 8)

DLLScope int IncreaseGlobalAccount(int ind);
DLLScope int DecreaseGlobalAccount(int ind);
DLLScope int CheckGlobalAccount(int ind);
#pragma pack (pop)


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>ke.co.greid</groupId>
  <artifactId>HybBackEnd</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <warSourceDirectory>WebContent</warSourceDirectory>
          <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
  	<dependency>
  		<groupId>mysql</groupId>
  		<artifactId>mysql-connector-java</artifactId>
  		<version>5.1.34</version>
  	</dependency>
  	<dependency>
  		<groupId>javax.persistence</groupId>
  		<artifactId>persistence-api</artifactId>
  		<version>1.0.2</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework</groupId>
  		<artifactId>spring-beans</artifactId>
  		<version>4.0.6.RELEASE</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework</groupId>
  		<artifactId>spring-context</artifactId>
  		<version>4.0.6.RELEASE</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework</groupId>
  		<artifactId>spring-core</artifactId>
  		<version>4.0.6.RELEASE</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework</groupId>
  		<artifactId>spring-jdbc</artifactId>
  		<version>4.0.6.RELEASE</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework</groupId>
  		<artifactId>spring-web</artifactId>
  		<version>4.0.6.RELEASE</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework</groupId>
  		<artifactId>spring-webmvc</artifactId>
  		<version>4.0.6.RELEASE</version>
  	</dependency>
  	<dependency>
  		<groupId>jstl</groupId>
  		<artifactId>jstl</artifactId>
  		<version>1.2</version>
  	</dependency>
  	<dependency>
  		<groupId>javax.ejb</groupId>
  		<artifactId>ejb-api</artifactId>
  		<version>3.0</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework</groupId>
  		<artifactId>spring-orm</artifactId>
  		<version>4.0.6.RELEASE</version>
  	</dependency>
  	<dependency>
  		<groupId>org.hibernate</groupId>
  		<artifactId>hibernate-core</artifactId>
  		<version>3.6.10.Final</version>
  	</dependency>
  	<dependency>
  		<groupId>javassist</groupId>
  		<artifactId>javassist</artifactId>
  		<version>3.12.1.GA</version>
  	</dependency>
  	<dependency>
  		<groupId>junit</groupId>
  		<artifactId>junit</artifactId>
  		<version>4.12</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework</groupId>
  		<artifactId>spring-test</artifactId>
  		<version>4.0.6.RELEASE</version>
  	</dependency>
  	<dependency>
  		<groupId>org.primefaces</groupId>
  		<artifactId>primefaces</artifactId>
  		<version>5.0</version>
  	</dependency>
  	<dependency>
  		<groupId>org.primefaces.extensions</groupId>
  		<artifactId>all-themes</artifactId>
  		<version>1.0.8</version>
  		<type>pom</type>
  	</dependency>
  	<dependency>
  		<groupId>com.sun.faces</groupId>
  		<artifactId>jsf-impl</artifactId>
  		<version>2.2.8-02</version>
  	</dependency>
  	<dependency>
  		<groupId>com.sun.faces</groupId>
  		<artifactId>jsf-api</artifactId>
  		<version>2.2.8-02</version>
  	</dependency>
  	<dependency>
  		<groupId>javax.servlet</groupId>
  		<artifactId>servlet-api</artifactId>
  		<version>2.5</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework.security</groupId>
  		<artifactId>spring-security-taglibs</artifactId>
  		<version>3.2.6.RELEASE</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework.security</groupId>
  		<artifactId>spring-security-config</artifactId>
  		<version>3.2.6.RELEASE</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework.security</groupId>
  		<artifactId>spring-security-web</artifactId>
  		<version>3.2.6.RELEASE</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework</groupId>
  		<artifactId>spring-aspects</artifactId>
  		<version>4.0.6.RELEASE</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework</groupId>
  		<artifactId>spring-binding</artifactId>
  		<version>1.0.6</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework.webflow</groupId>
  		<artifactId>spring-faces</artifactId>
  		<version>2.4.1.RELEASE</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework.webflow</groupId>
  		<artifactId>spring-webflow</artifactId>
  		<version>2.4.1.RELEASE</version>
  	</dependency>
  	<dependency>
  		<groupId>log4j</groupId>
  		<artifactId>log4j</artifactId>
  		<version>1.2.14</version>
  	</dependency>
  	<dependency>
  		<groupId>org.slf4j</groupId>
  		<artifactId>slf4j-api</artifactId>
  		<version>1.7.5</version>
  	</dependency>
  	<dependency>
  		<groupId>org.slf4j</groupId>
  		<artifactId>slf4j-jcl</artifactId>
  		<version>1.7.5</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework.security</groupId>
  		<artifactId>spring-security-core</artifactId>
  		<version>3.2.6.RELEASE</version>
  	</dependency>
  	<dependency>
  		<groupId>org.springframework</groupId>
  		<artifactId>spring-aop</artifactId>
  		<version>4.0.6.RELEASE</version>
  	</dependency>
	  <!-- https://mvnrepository.com/artifact/javax.el/el-api -->
	  <dependency>
		  <groupId>javax.el</groupId>
		  <artifactId>el-api</artifactId>
		  <version>2.2</version>
	  </dependency>

  </dependencies>
</project>


text:
package com.litierses.Utilidades;

import android.content.Intent;
import android.net.Uri;
import android.util.Log;

import com.litierses.Paginas.ViewDieta_Activity;
import com.google.android.gms.wearable.MessageEvent;
import com.google.android.gms.wearable.WearableListenerService;

/**
 * A Wear listener service, used to receive inbound messages from
 * the Wear device.
 */
public class ListenerService extends WearableListenerService {
    private static final String TAG = ListenerService.class.getSimpleName();

    @Override
    public void onMessageReceived(MessageEvent messageEvent) {
        Log.v(TAG, "onMessageReceived: " + messageEvent);

        if (Constants.CLEAR_NOTIFICATIONS_PATH.equals(messageEvent.getPath())) {
            // Request for this device to clear its notifications
            UtilityService.clearNotification(this);
        } else if (Constants.START_ATTRACTION_PATH.equals(messageEvent.getPath())) {
            // Request for this device open the attraction detail screen
            // to a specific tourist attraction
            String attractionName = new String(messageEvent.getData());
            Intent intent = null;//ViewDieta_Activity.getLaunchIntent(this, attractionName);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
        } else if (Constants.START_NAVIGATION_PATH.equals(messageEvent.getPath())) {
            // Request for this device to start Maps walking navigation to
            // specific tourist attraction
            String attractionQuery = new String(messageEvent.getData());
            Uri uri = Uri.parse(Constants.MAPS_NAVIGATION_INTENT_URI + Uri.encode(attractionQuery));
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
        }
    }
}


text:
<?php
  require "Usuario.php";
  require "Lance.php";
  require "Leilao.php";

  class LeilaoTest extends PHPUnit_Framework_TestCase {

    public function testDeveProporUmLance() {

      $leilao = new Leilao("Mackbook caro");

      $this->assertEquals(0, count($leilao->getLances()));

      $joao = new Usuario("Joao");

      $leilao->propoe(new Lance($joao, 2000));

      $this->assertEquals(1, count($leilao->getLances()));
      $this->assertEquals(2000, $leilao->getLances()[0]->getValor());

    }

    public function testDeveBarrarDoisLancesSeguidos() {

      $leilao = new Leilao("Macbook caro");

      $joao = new Usuario("Joao");

      $leilao->propoe(new Lance($joao, 2000));
      // tem que ignorar este cara
      $leilao->propoe(new Lance($joao, 2000));

      $this->assertEquals(1, count($leilao->getLances()));
      $this->assertEquals(2000, $leilao->getLances()[0]->getValor());

    }

    public function testDeveDarNoMaximoCincoLances() {

      $leilao = new Leilao("Macbook caro");

      $jobs = new Usuario("Jobs");
      $gates = new Usuario("Gates");

      $leilao->propoe(new Lance($jobs, 2000));
      $leilao->propoe(new Lance($gates, 3000));
      $leilao->propoe(new Lance($jobs, 4000));
      $leilao->propoe(new Lance($gates, 5000));
      $leilao->propoe(new Lance($jobs, 6000));
      $leilao->propoe(new Lance($gates, 7000));
      $leilao->propoe(new Lance($jobs, 8000));
      $leilao->propoe(new Lance($gates, 9000));
      $leilao->propoe(new Lance($jobs, 10000));
      $leilao->propoe(new Lance($gates, 11000));
      // deve ser ignorado
      $leilao->propoe(new Lance($jobs, 12000));

      $this->assertEquals(10, count($leilao->getLances()));
      $this->assertEquals(11000, $leilao->getLances()[9]->getValor());
    }

    public function testDeveDobrarOUltimoLanceDado() {
      $leilao = new Leilao("Macbook Pro 15");
      $steveJobs = new Usuario("Steve Jobs");
      $billGates = new Usuario("Bill Gates");

      $leilao->propoe(new Lance($steveJobs, 2000));
      $leilao->propoe(new Lance($billGates, 3000));
      $leilao->dobraLance($steveJobs);

      $this->assertEquals(4000, $leilao->getLances()[2]->getValor(), 0.00001);
    }

    public function testNaoDeveDobrarCasoNaoHajaLanceAnterior() {
      $leilao = new Leilao("Macbook Pro 15");
      $steveJobs = new Usuario("Steve Jobs");

      $leilao->dobraLance($steveJobs);

      $this->assertEquals(0, count($leilao->getLances()));
    }

  }

?>


text:
<?php
declare(strict_types=1);
namespace ClanWolf\C3\Library\Auth\Model;

use SlaxWeb\Database\BaseModel;

class User extends BaseModel
{
    /**
     * Database Result Set
     *
     * @var array
     */
    protected $result = null;

    /**
     * Temp table
     *
     * Table name set temporarily to disable automatic table name setting at initialisation.
     *
     * @var string
     */
    public $table = "_";

    public function __get(string $name)
    {
        $this->checkResults();
        return $this->result->{$name};
    }

    public function init()
    {
        $this->table = $this->config["auth.userTable"];
        if ($this->table === "" && $this->config["database.autoTable"]) {
            $this->setTable();
        }
    }

    /*
     ***************************************************************************
     * CODE MEANT FOR EXTENSION OF THE BASE MODEL, slaxweb/framework#118       *
     ***************************************************************************
     */
    public function select(array $colList): \SlaxWeb\Database\Interfaces\Result
    {
        $this->result = parent::select($colList);
        return $this->result;
    }

    public function next(): bool
    {
        $this->checkResults();
        return $this->result->next();
    }

    public function prev(): bool
    {
        $this->checkResults();
        return $this->result->prev();
    }

    public function row(int $row): bool
    {
        $this->checkResults();
        return $this->result->row($row);
    }

    protected function checkResults()
    {
        if ($this->result === null) {
            throw new \SlaxWeb\Database\Exception\NoDataException(
                "Result set is empty, can not proceed."
            );
        }
    }
    /*
     ***************************************************************************
     * CODE MEANT FOR EXTENSION OF THE BASE MODEL, slaxweb/framework#118       *
     ***************************************************************************
     */
}


text:
<?php

declare(strict_types=1);

namespace Sabre\Event;

class EventEmitter implements EmitterInterface
{
    use EmitterTrait;
}


text:
'use strict';

var GetIntrinsic = require('get-intrinsic');

var $Number = GetIntrinsic('%Number%');
var $TypeError = GetIntrinsic('%TypeError%');

var $isNaN = require('../helpers/isNaN');
var $isFinite = require('../helpers/isFinite');
var isPrefixOf = require('../helpers/isPrefixOf');

var ToNumber = require('./ToNumber');
var ToPrimitive = require('./ToPrimitive');
var Type = require('./Type');

// https://262.ecma-international.org/5.1/#sec-11.8.5

// eslint-disable-next-line max-statements
module.exports = function AbstractRelationalComparison(x, y, LeftFirst) {
	if (Type(LeftFirst) !== 'Boolean') {
		throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean');
	}
	var px;
	var py;
	if (LeftFirst) {
		px = ToPrimitive(x, $Number);
		py = ToPrimitive(y, $Number);
	} else {
		py = ToPrimitive(y, $Number);
		px = ToPrimitive(x, $Number);
	}
	var bothStrings = Type(px) === 'String' && Type(py) === 'String';
	if (!bothStrings) {
		var nx = ToNumber(px);
		var ny = ToNumber(py);
		if ($isNaN(nx) || $isNaN(ny)) {
			return undefined;
		}
		if ($isFinite(nx) && $isFinite(ny) && nx === ny) {
			return false;
		}
		if (nx === Infinity) {
			return false;
		}
		if (ny === Infinity) {
			return true;
		}
		if (ny === -Infinity) {
			return false;
		}
		if (nx === -Infinity) {
			return true;
		}
		return nx < ny; // by now, these are both nonzero, finite, and not equal
	}
	if (isPrefixOf(py, px)) {
		return false;
	}
	if (isPrefixOf(px, py)) {
		return true;
	}
	return px < py; // both strings, neither a prefix of the other. shortcut for steps c-f
};


text:
from tests.config import *
from nsxramlclient.client import NsxClient

__author__ = 'shrirang'

def configure_nat(session, edgeid='edge-1', oadd='10.112.196.116', tadd='172.16.1.10', oport=3389, tport=3389):
    nat_spec = session.extract_resource_body_example('edgeNat', 'update')

    nat_spec['nat']['natRules']['natRule']['ruleTag'] = 65538
    nat_spec['nat']['natRules']['natRule']['action'] = 'dnat'
    nat_spec['nat']['natRules']['natRule']['vnic'] = 0
    nat_spec['nat']['natRules']['natRule']['originalAddress'] = oadd
    nat_spec['nat']['natRules']['natRule']['translatedAddress'] = tadd
    nat_spec['nat']['natRules']['natRule']['loggingEnabled'] = 'true'
    nat_spec['nat']['natRules']['natRule']['enabled'] = 'true'
    nat_spec['nat']['natRules']['natRule']['description'] = 'Created with RAML'
    nat_spec['nat']['natRules']['natRule']['protocol'] = 'tcp'
    nat_spec['nat']['natRules']['natRule']['translatedPort'] = oport
    nat_spec['nat']['natRules']['natRule']['originalPort'] = tport

    create_response = session.update('edgeNat', uri_parameters={'edgeId': edgeid}, request_body_dict=nat_spec)

    session.view_response(create_response)

def append_nat(session, edgeid='edge-1', oadd='10.112.196.117', tadd='172.16.1.11', oport=3390, tport=3390):
    nat_spec = session.extract_resource_body_example('edgeNatRules', 'create')

    nat_spec['natRules']['natRule']['action'] = 'dnat'
    nat_spec['natRules']['natRule']['vnic'] = 0
    nat_spec['natRules']['natRule']['originalAddress'] = oadd
    nat_spec['natRules']['natRule']['translatedAddress'] = tadd
    nat_spec['natRules']['natRule']['loggingEnabled'] = 'true'
    nat_spec['natRules']['natRule']['enabled'] = 'true'
    nat_spec['natRules']['natRule']['description'] = 'Created with RAML'
    nat_spec['natRules']['natRule']['protocol'] = 'tcp'
    nat_spec['natRules']['natRule']['translatedPort'] = oport
    nat_spec['natRules']['natRule']['originalPort'] = tport

    create_response = session.create('edgeNatRules', uri_parameters={'edgeId': edgeid}, request_body_dict=nat_spec)

    session.view_response(create_response)

def update_nat(session, rule_id, edgeid='edge-1', oadd='10.112.196.118', tadd='172.16.1.12', oport=3391, tport=3391):
    nat_spec = session.extract_resource_body_example('edgeNatRule', 'update')

    nat_spec['natRule']['action'] = 'dnat'
    nat_spec['natRule']['vnic'] = 0
    nat_spec['natRule']['originalAddress'] = oadd
    nat_spec['natRule']['translatedAddress'] = tadd
    nat_spec['natRule']['loggingEnabled'] = 'true'
    nat_spec['natRule']['enabled'] = 'true'
    nat_spec['natRule']['description'] = 'Updated NAT config'
    nat_spec['natRule']['protocol'] = 'tcp'
    nat_spec['natRule']['translatedPort'] = oport
    nat_spec['natRule']['originalPort'] = tport

    create_response = session.update('edgeNatRule', uri_parameters={'edgeId': edgeid, 'ruleID': rule_id},
                                     request_body_dict=nat_spec)

    session.view_response(create_response)

def query_nat(session, edgeid='edge-1'):
    response = session.read('edgeNat', uri_parameters={'edgeId': edgeid})
    session.view_response(response)

def delete_nat(session, edgeid='edge-1'):
    del_response = session.delete('edgeNat', uri_parameters={'edgeId': edgeid})
    session.view_response(del_response)

def main():
    session = NsxClient(nsxraml_file, nsxmanager, nsx_username, nsx_password, debug=True)
    configure_nat(session)
    append_nat(session)
    query_nat(session)

    rule_id = raw_input('Enter RuleID as seen in above output: ')
    update_nat(session, rule_id)
    delete_nat(session)

if __name__ == "__main__":
    main()


text:
using Shouldly;
using StructureMap.Graph;
using StructureMap.Pipeline;
using StructureMap.Testing.Widget3;
using Xunit;

namespace StructureMap.Testing.Graph
{
    public class ComplexInstanceGraphTester
    {
        [Fact]
        public void lifecycle_for_pluginType_explicitly_set()
        {
            var graph = PluginGraph.CreateRoot();
            var profile = graph.Profile("Red");
            profile.Families[typeof(IGateway)].SetLifecycleTo<SingletonLifecycle>();

            var pipeline = PipelineGraph.BuildRoot(graph).Profiles.For("Red", new object());
            pipeline.Instances.DefaultLifecycleFor(typeof(IGateway))
                .ShouldBeOfType<ChildContainerSingletonLifecycle>();
        }

        [Fact]
        public void lifecyle_for_pluginType_not_explicitly_set_falls_back_to_parent()
        {
            var graph = PluginGraph.CreateRoot();
            graph.Families[typeof(IGateway)].SetLifecycleTo<SingletonLifecycle>();

            var pipeline = PipelineGraph.BuildRoot(graph).Profiles.For("Red", new object());
            pipeline.Instances.DefaultLifecycleFor(typeof(IGateway))
                .ShouldBeOfType<SingletonLifecycle>();
        }

        [Fact]
        public void default_lifecycle_not_set_on_any_level()
        {
            var graph = PluginGraph.CreateRoot();

            var pipeline = PipelineGraph.BuildRoot(graph).Profiles.For("Red", new object());
            pipeline.Instances.DefaultLifecycleFor(typeof(IGateway))
                .ShouldBeNull();
        }
    }
}


text:
use webcore::value::{Value, Reference};
use webcore::try_from::TryInto;
use webcore::reference_type::ReferenceType;
use webapi::file::File;

/// An object of this type is returned by the files property of the HTML `<input>` element;
/// this lets you access the list of files selected with the `<input type="file">` element.
/// It's also used for a list of files dropped into web content when using the drag and drop API.
///
/// [(JavaScript docs)](https://developer.mozilla.org/en-US/docs/Web/API/FileList)
// https://w3c.github.io/FileAPI/#dfn-filelist
#[derive(Clone, Debug, PartialEq, Eq, ReferenceType)]
#[reference(instance_of = "FileList")]
pub struct FileList( Reference );

impl FileList {
    /// Returns the number of [File](struct.File.html)s contained in this list.
    ///
    /// [(JavaScript docs)](https://developer.mozilla.org/en-US/docs/Web/API/FileList/length)
    // https://w3c.github.io/FileAPI/#ref-for-dfn-length
    pub fn len( &self ) -> u32 {
        js!( return @{self}.length; ).try_into().unwrap()
    }

    /// Returns an iterator over the list.
    pub fn iter( &self ) -> FileIter {
        FileIter {
            list: self.clone(),
            index: 0
        }
    }
}

impl IntoIterator for FileList {
    type Item = File;
    type IntoIter = FileIter;

    #[inline]
    fn into_iter( self ) -> Self::IntoIter {
        FileIter {
            list: self,
            index: 0
        }
    }
}

impl< 'a > IntoIterator for &'a FileList {
    type Item = File;
    type IntoIter = FileIter;

    #[inline]
    fn into_iter( self ) -> Self::IntoIter {
        FileIter {
            list: self.clone(),
            index: 0
        }
    }
}

#[derive(Debug)]
pub struct FileIter {
    list: FileList,
    index: i32
}

impl Iterator for FileIter {
    type Item = File;
    fn next( &mut self ) -> Option< Self::Item > {
        let value = js!(
            return @{&self.list}[ @{self.index} ];
        );

        let file = match value {
            Value::Undefined => return None,
            Value::Reference( reference ) => unsafe { File::from_reference_unchecked( reference ) },
            _ => unreachable!()
        };

        self.index += 1;
        Some( file )
    }
}


text:
Convergent Replicated Data Types for Go

Implemenations follows the Specifications in

[Shapiro, Preguica, Baquero, Zawirski: A comprehensive study of Convergent and Commutative Replicated Data Types](https://hal.inria.fr/file/index/docid/555588/filename/techreport.pdf)

Since many other implementations fail: The Focus is on correctness, not performance.


text:
package mezz.jei.gui.ingredients;

import mezz.jei.Internal;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiIngredient;
import mezz.jei.api.gui.ITooltipCallback;
import mezz.jei.api.ingredients.IIngredientHelper;
import mezz.jei.api.ingredients.IIngredientRenderer;
import mezz.jei.api.recipe.IFocus;
import mezz.jei.gui.TooltipRenderer;
import mezz.jei.startup.ForgeModIdHelper;
import mezz.jei.util.LegacyUtil;
import mezz.jei.util.Log;
import mezz.jei.util.Translator;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;

import javax.annotation.Nullable;
import java.awt.Color;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class GuiIngredient<T> extends Gui implements IGuiIngredient<T> {
	private static final String oreDictionaryIngredient = Translator.translateToLocal("jei.tooltip.recipe.ore.dict");

	private final int slotIndex;
	private final boolean input;

	private final Rectangle rect;
	private final int xPadding;
	private final int yPadding;

	private final CycleTimer cycleTimer;
	private final List<T> displayIngredients = new ArrayList<T>(); // ingredients, taking focus into account
	private final List<T> allIngredients = new ArrayList<T>(); // all ingredients, ignoring focus
	private final IIngredientRenderer<T> ingredientRenderer;
	private final IIngredientHelper<T> ingredientHelper;
	@Nullable
	private ITooltipCallback<T> tooltipCallback;
	@Nullable
	private IDrawable background;

	private boolean enabled;

	public GuiIngredient(
			int slotIndex,
			boolean input,
			IIngredientRenderer<T> ingredientRenderer,
			IIngredientHelper<T> ingredientHelper,
			Rectangle rect,
			int xPadding, int yPadding,
			int cycleOffset
	) {
		this.ingredientRenderer = ingredientRenderer;
		this.ingredientHelper = ingredientHelper;

		this.slotIndex = slotIndex;
		this.input = input;

		this.rect = rect;
		this.xPadding = xPadding;
		this.yPadding = yPadding;

		this.cycleTimer = new CycleTimer(cycleOffset);
	}

	public boolean isMouseOver(int xOffset, int yOffset, int mouseX, int mouseY) {
		return enabled && (mouseX >= xOffset + rect.x) && (mouseY >= yOffset + rect.y) && (mouseX < xOffset + rect.x + rect.width) && (mouseY < yOffset + rect.y + rect.height);
	}

	@Nullable
	@Override
	public T getDisplayedIngredient() {
		return cycleTimer.getCycledItem(displayIngredients);
	}

	@Override
	public List<T> getAllIngredients() {
		return allIngredients;
	}

	public void set(@Nullable List<T> ingredients, @Nullable IFocus<T> focus) {
		this.displayIngredients.clear();
		this.allIngredients.clear();
		List<T> displayIngredients;
		if (ingredients == null) {
			displayIngredients = Collections.emptyList();
		} else {
			displayIngredients = this.ingredientHelper.expandSubtypes(ingredients);
		}

		T match = getMatch(displayIngredients, focus);
		if (match != null) {
			this.displayIngredients.add(match);
		} else {
			this.displayIngredients.addAll(displayIngredients);
		}

		if (ingredients != null) {
			this.allIngredients.addAll(ingredients);
		}
		enabled = !this.displayIngredients.isEmpty();
	}

	public void setBackground(IDrawable background) {
		this.background = background;
	}

	@Nullable
	private T getMatch(Collection<T> ingredients, @Nullable IFocus<T> focus) {
		if (focus != null && isMode(focus.getMode())) {
			T focusValue = focus.getValue();
			return ingredientHelper.getMatch(ingredients, focusValue);
		}
		return null;
	}

	public void setTooltipCallback(@Nullable ITooltipCallback<T> tooltipCallback) {
		this.tooltipCallback = tooltipCallback;
	}

	public void draw(Minecraft minecraft, int xOffset, int yOffset) {
		cycleTimer.onDraw();

		if (background != null) {
			background.draw(minecraft, xOffset + rect.x, yOffset + rect.y);
		}

		T value = getDisplayedIngredient();
		ingredientRenderer.render(minecraft, xOffset + rect.x + xPadding, yOffset + rect.y + yPadding, value);
	}

	@Override
	public void drawHighlight(Minecraft minecraft, Color color, int xOffset, int yOffset) {
		int x = rect.x + xOffset + xPadding;
		int y = rect.y + yOffset + yPadding;
		GlStateManager.disableLighting();
		GlStateManager.disableDepth();
		drawRect(x, y, x + rect.width - xPadding * 2, y + rect.height - yPadding * 2, color.getRGB());
		GlStateManager.color(1f, 1f, 1f, 1f);
	}

	public void drawOverlays(Minecraft minecraft, int xOffset, int yOffset, int mouseX, int mouseY) {
		T value = getDisplayedIngredient();
		if (value != null) {
			drawTooltip(minecraft, xOffset, yOffset, mouseX, mouseY, value);
		}
	}

	private void drawTooltip(Minecraft minecraft, int xOffset, int yOffset, int mouseX, int mouseY, T value) {
		try {
			GlStateManager.disableDepth();

			RenderHelper.disableStandardItemLighting();
			drawRect(xOffset + rect.x + xPadding,
					yOffset + rect.y + yPadding,
					xOffset + rect.x + rect.width - xPadding,
					yOffset + rect.y + rect.height - yPadding,
					0x7FFFFFFF);
			GlStateManager.color(1f, 1f, 1f, 1f);

			List<String> tooltip = LegacyUtil.getTooltip(ingredientRenderer, minecraft, value, minecraft.gameSettings.advancedItemTooltips);
			tooltip = ForgeModIdHelper.getInstance().addModNameToIngredientTooltip(tooltip, value, ingredientHelper);

			if (tooltipCallback != null) {
				tooltipCallback.onTooltip(slotIndex, input, value, tooltip);
			}

			FontRenderer fontRenderer = ingredientRenderer.getFontRenderer(minecraft, value);
			if (value instanceof ItemStack) {
				//noinspection unchecked
				Collection<ItemStack> itemStacks = (Collection<ItemStack>) this.allIngredients;
				String oreDictEquivalent = Internal.getStackHelper().getOreDictEquivalent(itemStacks);
				if (oreDictEquivalent != null) {
					final String acceptsAny = String.format(oreDictionaryIngredient, oreDictEquivalent);
					tooltip.add(TextFormatting.GRAY + acceptsAny);
				}
				TooltipRenderer.drawHoveringText((ItemStack) value, minecraft, tooltip, xOffset + mouseX, yOffset + mouseY, fontRenderer);
			} else {
				TooltipRenderer.drawHoveringText(minecraft, tooltip, xOffset + mouseX, yOffset + mouseY, fontRenderer);
			}

			GlStateManager.enableDepth();
		} catch (RuntimeException e) {
			Log.error("Exception when rendering tooltip on {}.", value, e);
		}
	}

	@Override
	public boolean isInput() {
		return input;
	}

	public boolean isMode(IFocus.Mode mode) {
		return (input && mode == IFocus.Mode.INPUT) || (!input && mode == IFocus.Mode.OUTPUT);
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/l_chips"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/feed_item_box_nc"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:padding="1dp" >

    <ImageView
        android:id="@+id/img_post_dsel"
        android:layout_width="25dp"
        android:layout_height="25dp"
        android:layout_marginEnd="2dp"
        android:contentDescription="@string/empty_text"
        android:src="@drawable/nomugshot" />

    <TextView
        android:id="@+id/txt_post_dsel"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:maxLines="1"
        android:text="@string/test_username"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <ImageView
        android:id="@+id/img_post_dsel_del"
        android:layout_width="25dp"
        android:layout_height="25dp"
        android:layout_marginStart="2dp"
        android:contentDescription="@string/empty_text"
        android:src="@drawable/abc_ic_clear" />

</LinearLayout>


text:
'''
Created on Apr 26, 2015

@author: kydos
'''

import dds
import sys
import threading

def readData(dr):
    sys.stdout.write("-------------------------------\n")
    sys.stdout.flush()
    samples = dds.range(dr.read())

    for s in samples:
        ds = dds.decode(s.getData())
        sys.stdout.write(str(ds))
        sys.stdout.write("\n")

    # This uses the regular Java API for reading samples
    # while samples.hasNext():
    #     s = samples.next()
    #     ds = dds.decode(s.getData())
    #     sys.stdout.write(str(ds))
    #     sys.stdout.write("\n")

if __name__ == '__main__':
    t = dds.Topic("DeviceStatus")
    dr = dds.Reader(t)
    dr.onDataAvailable = readData
    threading.currentThread().join()


text:
% my_closereq
% User-defined close request function
% to display a question dialog box

selection = questdlg('Exit ISC tool?',...
    'Close Request Function',...
    'Yes','No','Yes');
switch selection,
    case 'Yes',
        delete(gcf)
    case 'No'
        return
end


text:
package msgraph

import "context"

// SkillProficiencyRequestBuilder is request builder for SkillProficiency
type SkillProficiencyRequestBuilder struct{ BaseRequestBuilder }

// Request returns SkillProficiencyRequest
func (b *SkillProficiencyRequestBuilder) Request() *SkillProficiencyRequest {
	return &SkillProficiencyRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
	}
}

// SkillProficiencyRequest is request for SkillProficiency
type SkillProficiencyRequest struct{ BaseRequest }

// Get performs GET request for SkillProficiency
func (r *SkillProficiencyRequest) Get(ctx context.Context) (resObj *SkillProficiency, err error) {
	var query string
	if r.query != nil {
		query = "?" + r.query.Encode()
	}
	err = r.JSONRequest(ctx, "GET", query, nil, &resObj)
	return
}

// Update performs PATCH request for SkillProficiency
func (r *SkillProficiencyRequest) Update(ctx context.Context, reqObj *SkillProficiency) error {
	return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
}

// Delete performs DELETE request for SkillProficiency
func (r *SkillProficiencyRequest) Delete(ctx context.Context) error {
	return r.JSONRequest(ctx, "DELETE", "", nil, nil)
}


text:
What's Monkey?
A cool cross-platform game development tool. [Learn more about Monkey](http://www.monkey-x.com)

### Features:
1. Basic color class functionality
2. Resolution Independent
2. No required resources
3. ColorPicker: Draws a panel with a verity of colors to choose from.
4. GetColorAt: Get the color at a certain position in the screen
5. Convert between: RRGGBB - HSV - RGB

### Known Bugs:
HSV2RGB not returning correct values, check calculations

### TODO:
1. Fix HSV2RGB
2. Create a how to use manual with images.

Any suggestion? I would love to hear them.


text:
require 'rails_helper'

describe EoyDonationEmail do
  let(:ak_raw_id) { "#{Settings.action_kit.akid_secret}.2678.323423423999" }
  let(:ak_hash) { Base64.urlsafe_encode64(Digest::SHA256.digest(ak_raw_id))[0..5] }
  let(:akid) { "2678.323423423999.#{ak_hash}" }

  describe '.opt_out' do
    context 'nil value' do
      subject { EoyDonationEmail.new(nil) }

      it 'should return error' do
        subject.opt_out
        errors = subject.errors.full_messages
        expect(errors).to match_array(["Akid can't be blank", "Actionkit user can't be blank"])
      end
    end

    context 'member without local actionkit id' do
      let(:member) { create :member, actionkit_user_id: nil }
      subject { EoyDonationEmail.new(akid) }

      it 'should return true when opt_out' do
        stub_request(:any, /#{Settings.ak_api_url}/).to_return(status: [204, 'No Content'])
        expect(subject.opt_out).to eql true
        expect(subject.member).to eql nil
      end
    end

    context 'member with local actionkit id' do
      before do
        create :member, actionkit_user_id: '323423423999'
        stub_request(:any, /#{Settings.ak_api_url}/).to_return(status: [204, 'No Content'])
      end

      subject { EoyDonationEmail.new(akid) }

      it 'should return true' do
        expect(subject.opt_out).to eql true
        expect(subject.member.opt_out_eoy_donation).to eql 1
      end
    end

    context 'actionkit update failed' do
      before do
        create :member, actionkit_user_id: '323423423999'
        stub_request(:any, /#{Settings.ak_api_url}/).to_return(status: [404, 'Not Found'])
      end

      subject { EoyDonationEmail.new(akid) }

      it 'should return false' do
        expect(subject.opt_out).to eql false
        expect(subject.errors.full_messages).to include('Error updating actionkit')
        expect(subject.member.opt_out_eoy_donation).to eql 0
      end
    end
  end

  describe '.opt_in' do
    context 'nil value' do
      subject { EoyDonationEmail.new(nil) }

      it 'should return error' do
        subject.opt_in
        errors = subject.errors.full_messages
        expect(errors).to match_array(["Akid can't be blank", "Actionkit user can't be blank"])
      end
    end

    context 'member without local actionkit id' do
      let(:member) { create :member, actionkit_user_id: nil }
      subject { EoyDonationEmail.new(akid) }

      it 'should return true when opt_out' do
        stub_request(:any, /#{Settings.ak_api_url}/).to_return(status: [204, 'No Content'])
        expect(subject.opt_in).to eql true
        expect(subject.member).to eql nil
      end
    end

    context 'member with local actionkit id' do
      before do
        create :member, actionkit_user_id: '323423423999', opt_out_eoy_donation: 1
        stub_request(:any, /#{Settings.ak_api_url}/).to_return(status: [204, 'No Content'])
      end

      subject { EoyDonationEmail.new(akid) }

      it 'should return true' do
        expect(subject.opt_in).to eql true
        expect(subject.member.opt_out_eoy_donation).to eql 0
      end
    end

    context 'actionkit update failed' do
      before do
        create :member, actionkit_user_id: '323423423999', opt_out_eoy_donation: 1
        stub_request(:any, /#{Settings.ak_api_url}/).to_return(status: [404, 'Not Found'])
      end

      subject { EoyDonationEmail.new(akid) }

      it 'should return false' do
        expect(subject.opt_in).to eql false
        expect(subject.errors.full_messages).to include('Error updating actionkit')
        expect(subject.member.opt_out_eoy_donation).to eql 1
      end
    end
  end
end


text:
\documentclass{article}
\usepackage[utf8]{inputenc}

\title{Bokföringsmallar}
\author{Katarina Bergbom}
\date{Juli 2018}

\usepackage{natbib}
\usepackage{graphicx}
\usepackage{hyperref}

\newcommand\tab[1][1cm]{\hspace*{#1}}
\newcommand{\prit}{P.R.I.T. }
\newcommand{\fritid}{frITid }
\newcommand{\nollkit}{NollKIT }
\newcommand{\sexit}{sexIT }
\newcommand{\fanbarerit}{FanbärerIT }
\newcommand{\snit}{snIT }
\newcommand{\mrcit}{MRCIT }
\newcommand{\digit}{digIT }
\newcommand{\armit}{ArmIT }
\newcommand{\styrit}{StyrIT }

\begin{document}

\maketitle
\tableofcontents

\section{Fakturor}
Underlag för fakturan, (dvs. pdf eller scan) ska bifogas på FM eller FS.
\subsection{När ni får en faktura}
\begin{description}
    \item [Fakturan tas emot]: Kostnaden uppstår (kostnadskontot debeteras, 2440 (leverantörsskulder) krediteras. Datum är fakturadatumet, och beskrivning skriv \textit{FM - Din text}
    \item [Fakturan betalas]: 2440 (leverantörsskulder) debeteras, bankkonto kommittée krediteras. Som beskrivning skriv \textit{FB - Din text}
\end{description}
Att använda FM och FB med samma övrig text gör att det är lätt att se vilka händelser som hör ihop, och även vilka fakturor som inte är betalda än.
\subsection{När ni skickar en faktura}
\begin{description}
    \item [Fakturan skickas]: Intäkten uppstår (intäktskontot krediteras), 1510 (Kundfordringar) debeteras. Datum är fakturadatumet, och beskrivning skriv \textit{FS - Din text}
    \item [Fakturan betalas in]: 1510 (Kundfordringar) krediteras, bankkonto kommittée debeteras. Som beskrivning skriv \textit{FI - Din text}
\end{description}
Att använda FS och FI med samma övrig text gör att det är lätt att se vilka händelser som hör ihop, och även vilka fakturor som inte är inbetalda.

\subsection{Skicka kreditfaktura}
Kreditfakturor bokförs tvärtemot vad en vanlig faktura hade bokförts.
\begin{description}
    \item [Kreditfakturan skickas]: Intäkten minskar (intäktskontot debeteras), 1510 (Kundfordringar) krediteras. Datum är fakturadatumet, och beskrivning skriv \textit{FS - Din text}
    \item [Fakturan betalas in]: 1510 (Kundfordringar) debeteras, bankkonto kommittée krediteras. Som beskrivning skriv \textit{FI - Din text}
\end{description}
Att använda FS och FI med samma övrig text gör att det är lätt att se vilka händelser som hör ihop, och även vilka fakturor som inte är inbetalda.

\subsection{Ta emot kreditfaktura}
Kreditfakturor bokförs tvärtemot vad en vanlig faktura hade bokförts.
\begin{description}
    \item [Fakturan tas emot]: Kostnaden minskas (kostnadskontot krediteras, 2440 (leverantörsskulder) debeteras. Datum är fakturadatumet, och beskrivning skriv \textit{FM - Din text}
    \item [Fakturan betalas]: 2440 (leverantörsskulder) krediteras, bankkonto kommittée debeteras. Som beskrivning skriv \textit{FB - Din text}
\end{description}
Att använda FM och FB med samma övrig text gör att det är lätt att se vilka händelser som hör ihop, och även vilka fakturor som inte är betalda än.

\section{Bankkort}
\subsection{Betalning med företagsbankkort (kommittébankkort)}
Datumet för händelsen är bokföringsdatumet för transaktionen, den kan hittas på banken. Detta datum är \textbf{inte} alltid samma som datumet då kortet drogs.

\begin{description}
    \item  [Varan/tjänsten köps]: kostnadskontot debeteras, bankkonto kommitté krediteras. Som beskrivning: \textit{BK - Din text}
\end{description}

\section{Medlemsutlägg}
\subsection{Vanligt medlemsutlägg}
Medlemsutlägg är ALLA gånger en medlem lägger ut privata pengar som sektionen sedan ska betala.
\begin{description}
    \item [Varan köps]: Kostnaden uppstår kostnadskontot (t.ex. kostnader mat) debeteras, 2918 ( skulder medlemmar) krediteras.
    \item [Pengar betalas ut till medlem]: 2918 (skulder medlemmar) debeteras, bankkonto kommittée krediteras.
\end{description}
\subsection{Medlemsutlägg i samband med äskning}
Medlemsutlägg i samband med äskning betandlas som ett vanligt utlägg, \textbf{hos StyrIT}. Dvs att du som kommittée ska inte betala utlägget, även om ni som kommittée har äskat. Skulle detta ändå råka hända, får ni min \textit{arga} blick och bokför enligt följande:
\begin{description}
    \item [Varan köps, hos StyrIT]: 4310 (Kostnader Äskningar) debeteras, 2918 ( skulder medlemmar) krediteras.
    \item [Pengar betalas ut till medlem, av kommittée, hos kommittée]: Bankkonto kommittée krediteras, 1617 (Fordran StyrIT) debeteras. \textit{Skicka internfordran till StyrIT, med datum för ut}
    \item [Pengar betalas ut till medlem, av kommittée, hos StyrIT]: 2918 ( skulder medlemmar) debeteras, fordran kommittée krediteras
    \item [StyrIT betalar kommittée, hos kommittée] : Bankkonto kommittée debeteras, 1617 (Fordran StyrIT) krediteras.
    \item [StyrIT betalar kommittée, hos StyrIT] : Bankkonto StyrIT krediteras,  skuld kommittée debeteras.
\end{description}

\subsection{Internfordran}
När en kommitté har lagt ut pengar för en annan kommitté, t.ex. för att de har köpt glass under ett samarr och ska dela på kostaden.
\begin{description}
   \item [Varan köps, hos kommitté-A]: Bankkonto kommitté-A krediteras, Fodran kommitté-B debiteras.
   \item [Varan köps, hos kommitté-B]: Skulder kommitté-B krediteras, Kostnadsskonto (t.ex. Aspning) debiteras
   \item [Kommitté-B betalar kommitté-A, hos kommitté-B]: Skulder kommitté-B debiteras, Bankkonto kommitté-B krediteras
   \item [Kommitté-B betalar kommitté-A, hos kommitté-A]: Fodran kommitté-B krediteras, Bankkonto kommitté-A debiteras
\end{description}

\section{Representation och Profilering}
\subsection{Intern Representation}
All teambuildning ni har räknas som intern representation, och bokförs på konto 4510 Intern Representation. Som underlag till bokföringshändelsen (förutom vanligt kvitto) ska det finnas ifylld medlemslista.

\section{iZettle}
\subsection{iZettle}
IZettle bokförs enligt modell:
\begin{description}
    \item [Varan säljs, hos kommitté]: Bokförs i kommittéen som en intäkt på hela beloppet (intäkt krediteras) och en fordran på styrIT debeteras (inklusive IZettle-avgiften).
    \item [iZettle sätter in på vårt konto, hos StyrIT]: Bankkonto StyrIT debeteras, IZettle avgift debiteras, skulder till kommittéen (inklusive IZettle-avgift) krediteras.
    \item [StyrIT betalar till kommitté, hos StyrIT]: Bankkonto StyrIT krediteras, skulden till kommittén debeteras
    \item [StyrIT betalar till kommitté, hos kommitté]: Bankkonto kommitté debeteras, fordran till StyrIT krediteras.
\end{description}
% \subsection{Swish}
% Swish bokförs enligt modell:
% \begin{description}
%     \item [Varan säljs, hos kommitté]: Bokförs i kommittéen som en intäkt på hela beloppet (intäkt krediteras), kostnad till swish på procentsatsen debeteras, och en fordran på styrIT debeteras.
%     \item [Swish sätter in på vårt konto, hos StyrIT]: Bankkonto Inkommande Swish debeteras, skulder till kommittéen krediteras och skulder till Swish krediteras.
%     \item [StyrIT betalar till kommitté, hos StyrIT]: Bankkonto Inkommande Swish krediteras, skulden till kommittén debeteras
%     \item [StyrIT betalar till kommitté, hos kommitté]: Bankkonto kommitté debeteras, fordran till StyrIT krediteras.
% \end{description}

\section{Bidrag från styrIT}
\subsection{Bidrag}
Bidrag bokförs enbart av styrIT, som överföring mellan konton. Bokförs alltså inte hos er!
% \subsection{Lån}
% \begin{description}
%     \item [Lånet betalas ut, hos kommitté]: Bankkonto kommitté debeteras. 2917 (Skulder StyrIT) krediteras.
%     \item [Lånet betalas ut, hos StyrIT]: Fordran kommitté debeteras. 1920 (Bankkonto StyrIT) krediteras.
%     \item [Lånet betalas tillbaka, hos kommitté]: 2917 (Skulder StyrIT) debeteras, bankkonto kommitté krediteras.
%     \item [Lånet betalas tillbaka, hos StyrIT]: 1920 (Bankkonto StyrIT) debeteras, fordran kommitté krediteras.
% \end{description}

\section{Moms på varor - ENDAST arrangemang i gasquen eller Bulten}
\textbf{Detta gäller enbart för arrangemang i gasquen eller Bulten}
\subsection{Inköp av varor till sittningen}
På kvittot står momssatsen och vad som är netto. Vi säger att ni har köpt en vara för 125 kr med momssats 12\%.
\begin{description}
    \item [1922 - Bankkonto sexIT ]: 125 kr krediteras
    \item [2641 - Ingående moms]: 13.39 kr debeteras
    \item [3212 - Kostnader Gasque]: 111.61 kr debeteras
\end{description}

\subsection{Försäljning av sittningsbiljetter}
Vid försäljning av sittningsbiljetter så behöver biljetten delas upp i två delar, en del utan dryck och en del med dryck. I detta exempel utgår vi från att biljetten utan dryck kostar 56kr (inkl. moms), och alkoholfri dryck 14 kr (inkl. moms), och alkoholhaltig dryck 34 kr (inkl. moms). All denna bokföring sker hos sexIT när försäljningen sker.
\subsubsection{Alkoholfri dryck}
\begin{description}
    \item [1922 - Bankkonto sexIT ]: 70 kr debeteras
    \item [2621 - Utgående moms på försäljning inom Sverige 12\%]: 7.5 kr krediteras
    \item [3212 - Intäkter gasque]: 62.5 kr krediteras
\end{description}
\subsubsection{Med alkoholhaltig dryck}
\begin{description}
    \item [1922 - Bankkonto sexIT ]: 90 kr debeteras
    \item [2611 - Utgående moms på försäljning inom Sverige 25\%]: 6.8 kr krediteras
    \item [2621 - Utgående moms på försäljning inom Sverige 12\%]: 6 kr krediteras
    \item [3212 - Intäkter gasque]: 77.2 kr krediteras
\end{description}
% \subsubsection{Med Swish och alkoholfri dryck}
% Enbart första steget, resten följer som anges i swish-avsnittet.
% \begin{description}
%     \item [1617 - Fordringar StyrIT ]: 68.5 kr debeteras
%     \item [2621 - Utgående moms på försäljning inom Sverige 12\%]: 7.5 kr krediteras
%     \item [3212 - Intäkter gasque]: 62.5 kr krediteras
%     \item [4313 - Kostnad Swish]: 1.5 kr debeteras
% \end{description}

\section{Depositioner}
\subsection{Vanlig}
\begin{description}
    \item [Deposition betalas in, hos PRIT]: 1931 (Bankkonto depositioner) debeteras. 2700 (Mottagna depositioner) krediteras.
    \item [Depostioner betalas tillbaka, hos PRIT]: 1931 (Bankkonto depositioner) krediteras. 2700 (Mottagna depositioner) debeteras.
\end{description}
\subsection{Borttappande av nyckel}
\begin{description}
    \item [Deposition betalas ut, hos PRIT]: 1931 (Bankkonto depositioner) krediteras med 200 kr. 2700 (Mottagna depositioner) debeteras med 300 kr. 3232 (Intäkt nyckeldepositioner) krediteras med 100 kr.
\end{description}

\section{Interimskulder och fordringar}
En interimskuld eller fordran gör när antingen en kostnad eller intäkt uppstår på fel bokföringsår. Detta kan exempelvis vara om man har haft ett arrangemang som man inte har fått fakturan för, eller om en kommittée vill börja teambuilda redan innan de officiellt har gått på. För detta används konto 2990 och 1790, som i princip säger att man har en skuld eller fordran mot sig själv.

\subsection{Interimskuld}
Exempel om vi inte har fått fakturan för kandidatmiddagen på 1000 kr.
\begin{enumerate}
\item Bokförs sista dagen på det verksamhetsåret kostnaden ska bokföras på.

\begin{tabular}{l | l | r | r}
\hline
Konto & Benämning & Debet & Kredit \\
\hline
2990 & Upplupna kostnader och förutbetalda intäkter & & 1 000,00 \\
4211 & Kostnader Kandidatmiddag & 1 000,00 &  \\
\end{tabular}

\item Fakturan kommer till den nya kassören.

\begin{tabular}{l | l | r | r}
\hline
Konto & Benämning & Debet & Kredit \\
\hline
2440 & Leverantörsskulder &  & 1 000,00\\
2990 & Upplupna kostnader och förutbetalda intäkter & 1 000,00 &  \\
\end{tabular}

\item Fakturan betalas av nya kassören

\begin{tabular}{l | l | r | r}
\hline
Konto & Benämning & Debet & Kredit \\
\hline
1920 & Bankkonto StyrIT & & 1 000,00  \\
2440 & Leverantörsskulder & 1 000,00 & \\
\end{tabular}
\end{enumerate}

\subsection{Interimfordran}
I detta exemplet har det varit en teambuilding innan verksamhetsåret börjar. Ett annat exempel kan vara att en faktura inte hann bli ivägskickad.
\begin{enumerate}
\item Bokförs när teambuildingen sker.

\begin{tabular}{l | l | r | r}
\hline
Konto & Benämning & Debet & Kredit \\
\hline
2918 & Skulder medlemmar & & 450,00 \\
1790 & Övriga förutbetalda kostnader och upplupna intäkter & 450,00 &  \\
\end{tabular}

\item Bokförs första dagen på det nya verksamhetsåret

\begin{tabular}{l | l | r | r}
\hline
Konto & Benämning & Debet & Kredit \\
\hline
1790 & Övriga förutbetalda kostnader och upplupna intäkter &  & 450,00\\
4510 & Kostnader Intern Representation & 450,00 &  \\
\end{tabular}

\item När skulden betalas ut till medlemmen, oavsett vilket år det betalas ut på

\begin{tabular}{l | l | r | r}
\hline
Konto & Benämning & Debet & Kredit \\
\hline
1920 & Bankkonto StyrIT & & 450,00  \\
2918 & Skulder medlemmar & 450,00 & \\
\end{tabular}
\end{enumerate}

\section{Övriga fall}

\subsection{Bidrag eller spons mellan kommitter för händelse}
Varje år anordnas pedagogiska priset, där snIT brukar ge ett bidrag till sexIT för att de håller i sittningen. Detta, och liknande samarbeten, bokförs enligt följande, där KA ger pengar till KB. Då vi är en, och inte flera organisationer får det \textbf{inte} bokföras mot kostnader och intäkter.
\begin{description}
    \item [Pengar förs över från KA till KB, hos KA]: Bankkonto KB debeteras, Bankkonto KA krediteras. Ange kostnadsstället på respektive kommittée vid respektive konto.
    \item [Pengar förs över från KA till KB, hos KB]: Ingen bokföring.
\end{description}

\subsection{Vidarefakturering - delad kostnad mellan parter}
Om ni lägger ut för något som ska splittras mellan flera parter, ex. en annan sektion under ett gemensamt arr, ska ni göra något som kallas för vidarefakturering. I exemplet antas det att ni har betalat 2000kr och kostnaderna ska splittras lika mellan er (KA) och Y-sektionen.
\begin{description}
    \item [IT betalar kostnaden, hos IT]: Bankkonto KA krediteras på 2000 kr, kostnadskontot debeteras på 1000 kr. , Bankkonto KA krediteras. Ange kostnadsstället på respektive kommittée vid respektive konto.
    \item [Pengar förs över från KA till KB, hos KB]: Ingen bokföring.
\end{description}

\section{Förkortningar}
För att inte "inkommen faktura" ska behöva ta upp hela beskrivningsraden, så använder vi oss på IT av olika förkortningar. Dessa följer nedan:
\begin{description}
    \item[BK] - Betalning med Företagsbankkort
    \item[FB] - Faktura betald (när du har betalar
    \item[FM] - Faktura mottagen
    \item[FS] - Faktura skickad
    \item[FI] - Faktura inbetald (när de betalar in)
    \item[MU] - Medlemsutlägg uppkommen
    \item[MB] - Medlemsutlägg betald
    \item[IFU] - Internfordran uppkommen
    \item[IFB] - Internfordran betald (antingen om du betalat eller om de betalar, men åtminstone att internfordran försvinner)

\end{description}

\end{document}


text:
<?php

namespace Magento\Backend\Model\Widget\Grid\Row;

interface GeneratorInterface
{
    /**
     * @param \Magento\Framework\DataObject $item
     * @return string
     * @api
     */
    public function getUrl($item);
}


text:
/*
 *  ======== I2CSlave.c ========
 */

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>

#include <ti/drivers/dpl/HwiP.h>
#include <ti/drivers/I2CSlave.h>

extern const I2CSlave_Config I2CSlave_config[];
extern const uint_least8_t I2CSlave_count;

/* Default I2CSlave parameters structure */
const I2CSlave_Params I2CSlave_defaultParams = {
    I2CSLAVE_MODE_BLOCKING,  /* transferMode */
    NULL,                    /* transferCallbackFxn */
    NULL                     /* custom */
};

static bool isInitialized = false;

/*
 *  ======== I2CSlave_close ========
 */
void I2CSlave_close(I2CSlave_Handle handle)
{
    handle->fxnTablePtr->closeFxn(handle);
}

/*
 *  ======== I2CSlave_control ========
 */
int_fast16_t I2CSlave_control(I2CSlave_Handle handle, uint_fast16_t cmd, void *arg)
{
    return (handle->fxnTablePtr->controlFxn(handle, cmd, arg));
}

/*
 *  ======== I2CSlave_init ========
 */
void I2CSlave_init(void)
{
    uint_least8_t i;
    uint_fast32_t key;

    key = HwiP_disable();

    if (!isInitialized) {
        isInitialized = (bool) true;

        /* Call each driver's init function */
        for (i = 0; i < I2CSlave_count; i++) {
            I2CSlave_config[i].fxnTablePtr->initFxn((I2CSlave_Handle)&(I2CSlave_config[i]));
        }
    }

    HwiP_restore(key);
}

/*
 *  ======== I2CSlave_open ========
 */
I2CSlave_Handle I2CSlave_open(uint_least8_t index, I2CSlave_Params *params)
{
    I2CSlave_Handle handle = NULL;

    /* Verify driver index and state */
    if (isInitialized && (index < I2CSlave_count)) {
        /* Use defaults if params are NULL. */
        if (params == NULL) {
            params = (I2CSlave_Params *) &I2CSlave_defaultParams;
        }

        /* Get handle for this driver instance */
        handle = (I2CSlave_Handle)&(I2CSlave_config[index]);
        handle = handle->fxnTablePtr->openFxn(handle, params);
    }

    return (handle);
}

/*
 *  ======== I2CSlave_Params_init =======
 */
void I2CSlave_Params_init(I2CSlave_Params *params)
{
    *params = I2CSlave_defaultParams;
}

/*
 *  ======== I2CSlave_read ========
 */
bool I2CSlave_read(I2CSlave_Handle handle, void *buffer, size_t size)
{
    return (handle->fxnTablePtr->readFxn(handle, buffer, size));
}

/*
 *  ======== I2CSlave_write ========
 */
bool I2CSlave_write(I2CSlave_Handle handle, const void *buffer, size_t size)
{
    return (handle->fxnTablePtr->writeFxn(handle, buffer, size));
}


text:
"""The tests for the Logger component."""
from collections import namedtuple
import logging
import unittest

from homeassistant.setup import setup_component
from homeassistant.components import logger

from tests.common import get_test_home_assistant

RECORD = namedtuple('record', ('name', 'levelno'))

NO_DEFAULT_CONFIG = {'logger': {}}
NO_LOGS_CONFIG = {'logger': {'default': 'info'}}
TEST_CONFIG = {
    'logger': {
        'default': 'warning',
        'logs': {'test': 'info'}
    }
}

class TestUpdater(unittest.TestCase):
    """Test logger component."""

    def setUp(self):
        """Set up things to be run when tests are started."""
        self.hass = get_test_home_assistant()
        self.log_filter = None

    def tearDown(self):
        """Stop everything that was started."""
        del logging.root.handlers[-1]
        self.hass.stop()

    def setup_logger(self, config):
        """Set up logger and save log filter."""
        setup_component(self.hass, logger.DOMAIN, config)
        self.log_filter = logging.root.handlers[-1].filters[0]

    def assert_logged(self, name, level):
        """Assert that a certain record was logged."""
        self.assertTrue(self.log_filter.filter(RECORD(name, level)))

    def assert_not_logged(self, name, level):
        """Assert that a certain record was not logged."""
        self.assertFalse(self.log_filter.filter(RECORD(name, level)))

    def test_logger_setup(self):
        """Use logger to create a logging filter."""
        self.setup_logger(TEST_CONFIG)

        self.assertTrue(len(logging.root.handlers) > 0)
        handler = logging.root.handlers[-1]

        self.assertEqual(len(handler.filters), 1)
        log_filter = handler.filters[0].logfilter

        self.assertEqual(log_filter['default'], logging.WARNING)
        self.assertEqual(log_filter['logs']['test'], logging.INFO)

    def test_logger_test_filters(self):
        """Test resulting filter operation."""
        self.setup_logger(TEST_CONFIG)

        # Blocked default record
        self.assert_not_logged('asdf', logging.DEBUG)

        # Allowed default record
        self.assert_logged('asdf', logging.WARNING)

        # Blocked named record
        self.assert_not_logged('test', logging.DEBUG)

        # Allowed named record
        self.assert_logged('test', logging.INFO)

    def test_set_filter_empty_config(self):
        """Test change log level from empty configuration."""
        self.setup_logger(NO_LOGS_CONFIG)

        self.assert_not_logged('test', logging.DEBUG)

        self.hass.services.call(
            logger.DOMAIN, 'set_level', {'test': 'debug'})
        self.hass.block_till_done()

        self.assert_logged('test', logging.DEBUG)

    def test_set_filter(self):
        """Test change log level of existing filter."""
        self.setup_logger(TEST_CONFIG)

        self.assert_not_logged('asdf', logging.DEBUG)
        self.assert_logged('dummy', logging.WARNING)

        self.hass.services.call(logger.DOMAIN, 'set_level',
                                {'asdf': 'debug', 'dummy': 'info'})
        self.hass.block_till_done()

        self.assert_logged('asdf', logging.DEBUG)
        self.assert_logged('dummy', logging.WARNING)

    def test_set_default_filter_empty_config(self):
        """Test change default log level from empty configuration."""
        self.setup_logger(NO_DEFAULT_CONFIG)

        self.assert_logged('test', logging.DEBUG)

        self.hass.services.call(
            logger.DOMAIN, 'set_default_level', {'level': 'warning'})
        self.hass.block_till_done()

        self.assert_not_logged('test', logging.DEBUG)

    def test_set_default_filter(self):
        """Test change default log level with existing default."""
        self.setup_logger(TEST_CONFIG)

        self.assert_not_logged('asdf', logging.DEBUG)
        self.assert_logged('dummy', logging.WARNING)

        self.hass.services.call(
            logger.DOMAIN, 'set_default_level', {'level': 'debug'})
        self.hass.block_till_done()

        self.assert_logged('asdf', logging.DEBUG)
        self.assert_logged('dummy', logging.WARNING)


text:
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "GameFramework/HUD.h"
#include "PacmanHUD.generated.h"

/**
 *
 */
UCLASS()
class PACMAN_API APacmanHUD : public AHUD
{
	GENERATED_BODY()

	APacmanHUD(const FObjectInitializer& ObjectInitializer);

	UPROPERTY()
	UFont* HUDFont;

	UPROPERTY()
	FCanvasIcon Lives;

	virtual void DrawHUD() override;

};


text:
#include "Window.h"

namespace Framework
{
    namespace Win32
    {
	    class CMDIClient : public CWindow
	    {
	    public:
					    CMDIClient(HWND, HMENU);
			virtual	    ~CMDIClient();

			void		DestroyChild(HWND);
		    void        Cascade();
		    void        TileHorizontal();
		    void        TileVertical();
            HWND        GetActiveWindow();
	    };
    }
}

#endif


text:
package com.settings.editor.components.annotations;

import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface PropertyBoolean {

    public String category() default "def";

    public String name() default "defaultName";

    public String width() default "100px";

    public String height() default "24px";
}


text:
import React, { Component, ComponentType, CSSProperties, ReactNode } from 'react';
import { ExitHandler, TransitionStatus } from 'react-transition-group/Transition';
declare type FadeProps<ComponentProps> = {
    component: ComponentType<ComponentProps>;
    in?: boolean;
    onExited?: ExitHandler<undefined | HTMLElement>;
    duration?: number;
} & ComponentProps;
export declare const Fade: <ComponentProps extends {}>({ component: Tag, duration, in: inProp, onExited, ...props }: FadeProps<ComponentProps>) => JSX.Element;
export declare const collapseDuration = 260;
declare type Width = number | 'auto';
interface CollapseProps {
    children: ReactNode;
    in?: boolean;
    onExited?: ExitHandler<undefined | HTMLElement>;
}
interface CollapseState {
    width: Width;
}
export declare class Collapse extends Component<CollapseProps, CollapseState> {
    duration: number;
    rafID?: number | null;
    state: CollapseState;
    transition: {
        [K in TransitionStatus]?: CSSProperties;
    };
    nodeRef: React.RefObject<HTMLDivElement>;
    componentDidMount(): void;
    componentWillUnmount(): void;
    getStyle: (width: Width) => CSSProperties;
    getTransition: (state: TransitionStatus) => React.CSSProperties | undefined;
    render(): JSX.Element;
}
export {};