text:
/**
 * @license Licensed under the Apache License, Version 2.0 (the "License"):
 *          http://www.apache.org/licenses/LICENSE-2.0
 */

/**
 * @fileoverview Utility functions for handling Instances.
 */
'use strict';

goog.provide('Blockly.Instances');

goog.require('Blockly.Workspace');
goog.require('goog.string');

/**
 * Category to separate instance names from instances, procedures and
 * generated functions.
 */
Blockly.Instances.NAME_TYPE = 'INSTANCE';

/**
 * Find all user-created instances.
 * @param {?string}
 * @param {!Blockly.Workspace} workspace Workspace to transverse for instances.
 * @return {!Array.<string>} Array of instance names.
 */
Blockly.Instances.allInstancesOf = function(instanceType, workspace) {
  var blocks;
  if (workspace.getAllBlocks) {
    blocks = workspace.getAllBlocks();
  } else {
    throw 'Not a valid Workspace: ' + workspace;
  }

  var instanceHash = Object.create(null);
  // Iterate through every block and add each instance to the hash.
  for (var i = 0; i < blocks.length; i++) {
    var blockInstances = blocks[i].getInstances(instanceType);
    for (var j = 0; j < blockInstances.length; j++) {
      var instanceName = blockInstances[j];
      // Instance name may be null if the block is only half-built.
      if (instanceName) {
        instanceHash[instanceName.toLowerCase()] = instanceName;
      }
    }
  }
  // Flatten the hash into a list.
  var instanceList = [];
  for (var name in instanceHash) {
    instanceList.push(instanceHash[name]);
  }
  return instanceList;
};

/** Returns all instances of all types. */
Blockly.Instances.allInstances = function(workspace) {
  return Blockly.Instances.allInstancesOf(undefined, workspace);
};

/** Returns the first Instance name of a given type. */
Blockly.Instances.getAnyInstanceOf = function(instanceType, workspace) {
  var blocks;
  if (workspace.getAllBlocks) {
    blocks = workspace.getAllBlocks();
  } else {
    throw 'Not a valid Workspace: ' + workspace;
  }

  for (var i = 0; i < blocks.length; i++) {
    var blockInstances = blocks[i].getInstances(instanceType);
    if (blockInstances.length) {
      return blockInstances[0];
    }
  }
};

/** Indicates if the given instance is present in the workspace. */
Blockly.Instances.isInstancePresent = function(
    instanceName, instanceType, block) {
  var blocks;
  if (block.workspace && block.workspace.getAllBlocks) {
    blocks = block.workspace.getAllBlocks();
  } else {
    throw 'Not a valid block: ' + block;
  }

  for (var i = 0; i < blocks.length; i++) {
    var blockInstances = blocks[i].getInstances(instanceType);
    for (var j = 0; j < blockInstances.length; j++) {
      if ((blockInstances[j] === instanceName) && (blocks[i] !== block)) {
        return true;
      }
    }
  }
  return false;
};

/**
 * Find all instances of the specified name and type and rename them.
 * @param {string} oldName Instance to rename.
 * @param {string} newName New Instance name.
 * @param {!Blockly.Workspace} workspace Workspace rename instances in.
 */
Blockly.Instances.renameInstance = function(
    oldName, newName, instanceType, workspace) {
  Blockly.Events.setGroup(true);
  var blocks = workspace.getAllBlocks();
  // Iterate through every block.
  for (var i = 0; i < blocks.length; i++) {
    blocks[i].renameInstance(oldName, newName, instanceType);
  }
  Blockly.Events.setGroup(false);
};

/**
 * Return a new instance name that is not yet being used as an instance or as a
 * variable name. This will try to  generate single letter names in the range
 * 'i' to 'z' to start with.
 * If no unique name is located it will try 'i' to 'z', 'a' to 'h',
 * then 'i2' to 'z2' etc.  Skip 'l'.
 * @param {!Blockly.Workspace} workspace The workspace to be unique in.
 * @return {string} New instance name.
 */
Blockly.Instances.generateUniqueName = function(workspace) {
  var combinedList = Blockly.Variables.allVariables(workspace).concat(
      Blockly.Instances.allInstances(workspace));
  var newName = '';
  if (combinedList.length) {
    var nameSuffix = 1;
    var letters = 'ijkmnopqrstuvwxyzabcdefgh';  // No 'l'.
    var letterIndex = 0;
    var potName = letters.charAt(letterIndex);
    while (!newName) {
      var inUse = false;
      for (var i = 0; i < combinedList.length; i++) {
        if (combinedList[i].toLowerCase() == potName) {
          // This potential name is already used.
          inUse = true;
          break;
        }
      }
      if (inUse) {
        // Try the next potential name.
        letterIndex++;
        if (letterIndex == letters.length) {
          // Reached the end of the character sequence so back to 'i'.
          // a new suffix.
          letterIndex = 0;
          nameSuffix++;
        }
        potName = letters.charAt(letterIndex);
        if (nameSuffix > 1) {
          potName += nameSuffix;
        }
      } else {
        // We can use the current potential name.
        newName = potName;
      }
    }
  } else {
    newName = 'i';
  }
  return newName;
};

/**
 * Return a version of the instance name that has not yet been used.
 * It does so by adding a number at the end of the name.
 * @param {string} instanceName Instance name to make unique.
 * @param {!Blockly.Workspace|Blockly.Block} workspace The workspace to be unique in.
 * @return {string} Unique instance name based on name input.
 */
Blockly.Instances.convertToUniqueName = function(instanceName, workspace) {
  var combinedList = Blockly.Variables.allVariables(workspace).concat(
      Blockly.Instances.allInstances(workspace));
  return Blockly.Instances.appendToName_(instanceName, combinedList);
};

/** */
Blockly.Instances.convertToUniqueNameBlock = function(instanceName, block) {
  var blocks;
  if (block.workspace) {
    blocks = block.workspace.getAllBlocks();
  } else {
    throw 'Not a valid Workspace: ' + workspace;
  }

  var instanceHash = Object.create(null);
  // Iterate through every block and add each instance to the hash.
  for (var i = 0; i < blocks.length; i++) {
    // Do not add to the list this block instance
    if (blocks[i] !== block) {
      var blockInstances = blocks[i].getInstances();
      for (var j = 0; j < blockInstances.length; j++) {
        var blockInstanceName = blockInstances[j];
        // Instance name may be null if the block is only half-built.
        if (blockInstanceName) {
          instanceHash[blockInstanceName.toLowerCase()] = blockInstanceName;
        }
      }
    }
  }
  // Flatten the hash into a list.
  var instanceList = [];
  for (var name in instanceHash) {
    instanceList.push(instanceHash[name]);
  }

  var combinedList = Blockly.Variables.allVariables(block.workspace).concat(
      instanceList);
  return Blockly.Instances.appendToName_(instanceName, combinedList);
};

/** */
Blockly.Instances.appendToName_ = function(instanceName, nameList) {
  if (!instanceName) {
    return Blockly.Instances.generateUniqueName(workspace);
  } else {
    var newName = instanceName;
    var nameSuffix = 2;

    if (instanceName.match(/_\d+$/)) {
      // instanceName ends with and underscore and a number, so increase count
      var instanceNameSuffix = instanceName.match(/\d+$/)[0];
      instanceName = instanceName.slice(
          0, (instanceNameSuffix.length * -1) - 1);
      nameSuffix = parseInt(instanceNameSuffix, 10) + 1;
      newName = instanceName + '_' + nameSuffix;
    }

    while (nameList.indexOf(newName) !== -1) {
      newName = instanceName + '_' + nameSuffix++;
    }
    return newName;
  }
};


text:
//###################################################################################################

//###################################################################################################

using Backend.Data;
using System;
using System.Linq;
using System.Xml.Linq;
using Windows.Data.Xml.Dom;
using Windows.UI.Core;
using Windows.UI.Notifications;
using Tags = XMPP.tags;

namespace Backend.Common
{
    public class Notifier : Tags.TagHandler<bool>
    {
        private readonly BadgeUpdater BadgeUpdater = BadgeUpdateManager.CreateBadgeUpdaterForApplication();
        private readonly Runtime Backend = null;

        private int NotificationCount
        {
            get { return new Status().currentNotificationCount; }
            set { new Status().currentNotificationCount = value; }
        }

        private bool errorState = false;
        private bool windowVisible = false;

        public Notifier(Runtime backend) : base(false)
        {
            if (backend != null)
                Backend = backend;
            else
                throw new Exception("Connections constructor - BACKEND NOT DEFINED");

            UpdateBadge();
        }

        private CoreWindow _coreWindow = null;
        public CoreWindow CoreWindow
        {
            get { return _coreWindow; }
            set
            {
                try
                {
                    if (_coreWindow != null)
                        _coreWindow.VisibilityChanged -= FrontendVisibilityChanged;

                    if (value != null)
                    {
                        _coreWindow = value;
                        windowVisible = _coreWindow.Visible;
                        _coreWindow.VisibilityChanged += FrontendVisibilityChanged;
                    }
                }
                catch { }
            }
        }

        #region publicmethods

        // Return value determins persistancy for Event queue
        public bool Push(BackendEvent event_)
        {
            if (event_ is BackendEventMessage)
            {
                var messageEvent = event_ as BackendEventMessage;
                return Process(messageEvent.Tag);
            }
            else if (event_ is BackendEventState)
            {
                var stateEvent = event_ as BackendEventState;
                UpdateBadge();
            }
            else if (event_ is BackendEventError)
            {
                var errorEvent = event_ as BackendEventError;
                NotifyError(errorEvent.Policy, Helper.Translate("Error") + ": " + Helper.Translate("ErrorType"+errorEvent.Error.ToString()));
            }
            else if (event_ is BackendEventRequest)
            {
                var requestEvent = event_ as BackendEventRequest;
                if (requestEvent.RequestType == RequestType.BackgroundAccess)
                {
                    if (!windowVisible)
                        NotifyError(XMPP.ErrorPolicyType.Severe, Helper.Translate("NotifyBackgroundAccess"));
                }
            }
            else if (event_ is BackendEventWindows)
            {
                var windowsEvent = event_ as BackendEventWindows;
                if (windowsEvent.WindowsType == WindowsType.UserAway || windowsEvent.WindowsType == WindowsType.UserPresent ) // Es hat mit autoaway zutun
                {
                    var settings = new Settings();
                    if (settings.autoAway) // Autoaway ist an
                    {
                        var status = new Status();

                        // Der user ist nicht am rechner und war bisher online also sind alle voraussetzungen erfuellt
                        if (windowsEvent.WindowsType == WindowsType.UserAway && status.status == StatusType.Available)
                            Helper.PublishState(StatusType.Away, settings.autoAwayMessage);

                        // Der nutzer ist am rechner, egal was vorher war, er will seinen eigentlichen status gebroadcasted haben
                        if (windowsEvent.WindowsType == WindowsType.UserPresent )
                            Helper.PublishState(status.status, status.message );
                    }
                }
            }

            return false;
        }

        #endregion

        #region privatemethods

        private void IncrementNotificationCount()
        {
            if (!windowVisible)
                NotificationCount++;
        }

        private bool Process(Tags.jabber.client.presence presence)
        {
            if (presence.type == Tags.jabber.client.presence.typeEnum.error)
            {
                var errorMessage = Helper.GetErrorMessage(presence);
                NotifyError(XMPP.ErrorPolicyType.Informative, Helper.Translate("ErrorTagPresence") + ": " + errorMessage);
            }
            else if (presence.type == Tags.jabber.client.presence.typeEnum.subscribe)
            {
                var fromJid = new XMPP.JID(presence.from);
                Notify(presence.Account, presence.from, fromJid + " " + Helper.Translate("SubscriptionRequest"));
            }

            return false;
        }

        private bool Process(Tags.jabber.client.message message)
        {
            if (message.type == Tags.jabber.client.message.typeEnum.error)
            {
                var errorMessage = Helper.GetErrorMessage(message);
                NotifyError(XMPP.ErrorPolicyType.Informative, Helper.Translate("ErrorTagMessage") + ": " + errorMessage);
            }
            else if (message.type == Tags.jabber.client.message.typeEnum.chat || message.type == Tags.jabber.client.message.typeEnum.normal)
            {
                if (message.bodyElements.Count() > 0)
                {
                    var from = new XMPP.JID(message.from);
                    var bodytext = string.Join(" ", (from body in message.bodyElements select body.Value));
                    Notify(message.Account, from.Bare, bodytext);
                    return true;
                }
            }

            return false;
        }

        private bool Process(Tags.jabber.client.iq iq)
        {
            if (iq.type == Tags.jabber.client.iq.typeEnum.error)
            {
                var errorMessage = Helper.GetErrorMessage(iq);
                NotifyError(XMPP.ErrorPolicyType.Informative, Helper.Translate("ErrorTagIq") + ": " + errorMessage);
                return false;
            }

            return true;
        }

        public void UpdateBadge()
        {
            var badgeXml = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber);
            var badgeAttributes = badgeXml.GetElementsByTagName("badge");

            bool clearValue = false;

            if (errorState)
            {
                badgeAttributes[0].Attributes.GetNamedItem("value").NodeValue = "error";
            }
            else if (NotificationCount > 0)
            {
                badgeAttributes[0].Attributes.GetNamedItem("value").NodeValue = NotificationCount.ToString();
            }
            else if (new Accounts().Enabled.Count() <= 0)
            {
                clearValue = true;
            }
            else
            {
                var status = new Status();
                string value = "";
                switch (status.status)
                {
                    case StatusType.Available:
                        value = "available";
                        break;
                    case StatusType.Away:
                        value = "away";
                        break;
                    case StatusType.Busy:
                        value = "busy";
                        break;
                    case StatusType.Offline:
                        value = "unavailable";
                        break;
                }

                badgeAttributes[0].Attributes.GetNamedItem("value").NodeValue = value;
            }

            if (clearValue)
                BadgeUpdater.Clear();
            else
                BadgeUpdater.Update(new BadgeNotification(badgeXml));
        }

        private void NotifyError(XMPP.ErrorPolicyType type, string message)
        {
            var settings = new Settings();
            if (type != XMPP.ErrorPolicyType.Informative || settings.showInformativeErrors)
            {
                WriteToastSystem(message);
                errorState = true;
                UpdateBadge();
            }
        }

        private void Notify(string account, string jid, string message)
        {
            WriteToast(account, jid, message);
            IncrementNotificationCount();
            UpdateBadge();
        }

        private void WriteToast(string account, string jid, string message)
        {

            var settings = new Settings();
            if (settings.notificationToast && ( !windowVisible || settings.notificationVisible ) )
            {
                var contactname = jid;
                var imageURI = "";

                var Accounts = new Accounts();
                var accountObj = Accounts[account];
                if (accountObj == null)
                    return;

                var contact = accountObj.Roster[jid];
                if (contact != null)
                {
                    contactname = contact.DisplayName;

                    if (contact.ImageURI != null)
                        imageURI = contact.ImageURI.ToString();
                }

                XDocument toast = new XDocument();

                XElement toastElement = new XElement("toast",
                    new XElement("visual",
                        new XElement("binding",
                            new XAttribute("template", "ToastImageAndText02"),
                            new XElement("image",
                                new XAttribute("id", "1"),
                                new XAttribute("src", imageURI)
                            ),
                            new XElement("text",
                                new XAttribute("id", "1"),
                                new XText(contactname)
                            ),
                            new XElement("text",
                                new XAttribute("id", "2"),
                                new XText(message)
                            )
                        )
                    )
                );

                if (settings.notificationSound)
                {
                    var audio = new XElement("audio");
                    audio.Add(new XAttribute("src", "ms-winsoundevent:Notification.IM"));
                    audio.Add(new XAttribute("silent", "false"));
                    toastElement.Add(audio);
                }

                toast.Add(toastElement);
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(toast.ToString());

                // Send it
                ToastNotificationManager.CreateToastNotifier().Show(new ToastNotification(doc));
            }
        }

        private void WriteToastSystem(string message)
        {
            var settings = new Settings();

            XDocument toast = new XDocument();

            XElement toastElement = new XElement("toast",
                new XElement("visual",
                    new XElement("binding",
                        new XAttribute("template", "ToastImageAndText01"),
                            new XElement("image",
                                new XAttribute("id", "1"),
                                new XAttribute("src", "ms-appx:///Assets/Error.png")
                            ),
                            new XElement("text",
                                new XAttribute("id", "1"),
                                new XText(message)
                            )
                    )
                )
            );

            if (settings.notificationSound)
            {
                var audio = new XElement("audio");
                audio.Add(new XAttribute("src", "ms-winsoundevent:Notification.IM"));
                audio.Add(new XAttribute("silent", "false"));
                toastElement.Add(audio);
            }

            toast.Add(toastElement);
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(toast.ToString());

            // Send it
            ToastNotificationManager.CreateToastNotifier().Show(new ToastNotification(doc));
        }

        #endregion

        #region eventhandler

        private void FrontendVisibilityChanged(Windows.UI.Core.CoreWindow sender, VisibilityChangedEventArgs args)
        {
            windowVisible = args.Visible;
            NotificationCount = 0;
            errorState = false;
            UpdateBadge();
        }

        #endregion
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Giberson\Tdd\Apigility\Context\Initializer;

use Behat\Behat\Context\Context;
use Behat\Behat\Context\Initializer\ContextInitializer;
use Giberson\Tdd\Apigility\Tooling\Project;
use Giberson\Tdd\Apigility\Tooling\ProjectAware;

class ProjectAwareInitializer implements ContextInitializer
{
    /** @var  array */
    protected $config;

    /**
     * ConfigPluginManagerAwareInitializer constructor.
     * @param array $config
     */
    public function __construct(array $config)
    {
        $this->config = $config;
    }

    /**
     * Initializes provided context.
     *
     * @param Context $context
     */
    public function initializeContext(Context $context)
    {
        if (!$context instanceof ProjectAware) {
            return;
        }

        $config = $this->config;

        $project = new Project();
        $project->setApplicationConfigPath($config['application_config_path']);
        $project->setModuleNamespace($config['module_namespace']);
        $project->setModulePath($config['module_path']);
        $project->setApplicationPath(getcwd());
        $context->setProject($project);
    }
}


text:
<?php

class BV_View_Helper_TaxNameById extends Zend_View_Helper_Abstract
{

    public function taxNameById($taxTypeId)
    {
        if (is_numeric($taxTypeId)) {
            $taxModel = new Core_Model_Tax_Type;
            $name = $taxModel->getTaxNameFromId($taxTypeId);
        } else {
            $name = "None";
        }
        return $name;
    }
}


text:
package gerrit

import (
	"context"
	"fmt"
	"testing"

	"github.com/stretchr/testify/require"
	"go.skia.org/infra/docsyserver/go/codereview"
	"go.skia.org/infra/go/gerrit"
	"go.skia.org/infra/go/gerrit/mocks"
	"go.skia.org/infra/go/testutils"
)

var myFakeError = fmt.Errorf("My fake error")

const issue codereview.Issue = "123"
const issueInt64 int64 = 123

func TestGetPatchsetInfo_HappyPath(t *testing.T) {
	const expectedRef = "refs/changes/96/386796/22"
	gc := &mocks.GerritInterface{}
	changeInfo := &gerrit.ChangeInfo{
		Status: gerrit.ChangeStatusNew,
		Patchsets: []*gerrit.Revision{
			{
				Ref: expectedRef,
			},
		},
	}
	gc.On("GetChange", testutils.AnyContext, string(issue)).Return(changeInfo, nil)

	cr := gerritCodeReview{
		gc: gc,
	}
	ref, isClosed, err := cr.GetPatchsetInfo(context.Background(), issue)
	require.NoError(t, err)
	require.False(t, isClosed)
	require.Equal(t, expectedRef, ref)
}

func TestGetPatchsetInfo_GetChangeFails_ReturnsError(t *testing.T) {

	gc := &mocks.GerritInterface{}
	gc.On("GetChange", testutils.AnyContext, string(issue)).Return(nil, myFakeError)

	cr := gerritCodeReview{
		gc: gc,
	}
	_, _, err := cr.GetPatchsetInfo(context.Background(), issue)
	require.Error(t, err)
	require.Contains(t, err.Error(), myFakeError.Error())
}

func TestListModifiedFiles_FilesReturnsError_ReturnsError(t *testing.T) {

	gc := &mocks.GerritInterface{}
	gc.On("Files", testutils.AnyContext, issueInt64, "23").Return(nil, myFakeError)

	cr := gerritCodeReview{
		gc: gc,
	}
	_, err := cr.ListModifiedFiles(context.Background(), issue, "refs/changes/96/386796/23")
	require.Contains(t, err.Error(), myFakeError.Error())
}

func TestListModifiedFiles_MalformedIssue_ReturnsError(t *testing.T) {

	gc := &mocks.GerritInterface{}
	cr := gerritCodeReview{
		gc: gc,
	}
	_, err := cr.ListModifiedFiles(context.Background(), "not a valid issue number", "refs/changes/96/386796/23")
	require.Contains(t, err.Error(), "invalid syntax")
}

func TestListModifiedFiles_FilesReturnsEmptySlice_ReturnsEmptySlice(t *testing.T) {

	gc := &mocks.GerritInterface{}
	response := map[string]*gerrit.FileInfo{}
	gc.On("Files", testutils.AnyContext, issueInt64, "23").Return(response, nil)

	cr := gerritCodeReview{
		gc: gc,
	}
	files, err := cr.ListModifiedFiles(context.Background(), issue, "refs/changes/96/386796/23")
	require.NoError(t, err)
	require.Empty(t, files)
}

func TestListModifiedFiles_FilesReturnsWithCommitMessage_ReturnsEmptySlice(t *testing.T) {

	gc := &mocks.GerritInterface{}
	response := map[string]*gerrit.FileInfo{
		commitMessageFileName: {},
	}
	gc.On("Files", testutils.AnyContext, issueInt64, "23").Return(response, nil)

	cr := gerritCodeReview{
		gc: gc,
	}
	files, err := cr.ListModifiedFiles(context.Background(), issue, "refs/changes/96/386796/23")
	require.NoError(t, err)
	require.Empty(t, files)
}

func TestListModifiedFiles_HappyPath(t *testing.T) {

	gc := &mocks.GerritInterface{}
	response := map[string]*gerrit.FileInfo{
		"site/_index.md": {
			Status: gerrit.FileDeleted,
		},
		"site/users.md": {
			Status: gerrit.FileModified,
		},
		"site/dev.md": {
			Status: gerrit.FileAdded,
		},
	}
	gc.On("Files", testutils.AnyContext, issueInt64, "23").Return(response, nil)

	cr := gerritCodeReview{
		gc: gc,
	}
	files, err := cr.ListModifiedFiles(context.Background(), issue, "refs/changes/96/386796/23")
	require.NoError(t, err)
	expected := []codereview.ListModifiedFilesResult{
		{
			Filename: "site/_index.md",
			Deleted:  true,
		},
		{
			Filename: "site/users.md",
			Deleted:  false,
		},
		{
			Filename: "site/dev.md",
			Deleted:  false,
		},
	}
	require.ElementsMatch(t, expected, files)
}


text:
@implementation GRXTestAppDelegate

@end


text:
package io.advantageous.qbit.network;

import java.util.function.Consumer;

/**
 *
 * WebSocket like thing that receives messages.
 * Could be mapped to non-websocket implementations.
 * created by rhightower on 2/14/15.
 */
public interface NetSocket {

    String remoteAddress();

    String uri();

    void onTextMessage(String message);

    void onBinaryMessage(byte[] bytes);

    void onClose();

    void onOpen();

    void onError(Exception exception);

    void sendText(String string);

    void sendBinary(byte[] bytes);

    boolean isClosed();

    boolean isOpen();

    boolean isBinary();

    void setTextMessageConsumer(Consumer<String> textMessageConsumer);

    void setBinaryMessageConsumer(Consumer<byte[]> binaryMessageConsumer);

    void setCloseConsumer(Consumer<Void> closeConsumer);

    void setOpenConsumer(Consumer<Void> openConsumer);

    void setErrorConsumer(Consumer<Exception> exceptionConsumer);

    void close();

    void open();

    void openAndWait();

}


text:
class InsertHomePageImages < ActiveRecord::Migration
  def self.up
    Image.create!(:name => 'home_page_photo',
                 :html_options => ':height => 380, :width => 285',
                 :link => "{:controller => 'results', :action => 'event', :id => 6162}",
                 :source => 'http://STATIC_HOST/images/photos/home_page.jpg',
                 :caption => "'Shanan Whitlatch celebrates her victory in the Vancouver Courthouse Criterium with Norrene Godfrey and Tina Brubaker (and her coach).    Photo courtesy of Jon Kraft'")
    Image.create!(:name => 'home_page_ad_col_2_row_2',
                  :html_options => ':height => 223, :width => 288',
                  :link => "'http://www.bicycleattorney.com/'",
                  :source => 'http://STATIC_HOST/images/ads/mike_colbach.gif')
    end

  def self.down
    Image.delete_all
  end
end


text:
#include <ztest.h>
extern void test_vector_1(void);
extern void test_vector_2(void);
extern void test_vector_3(void);
extern void test_vector_4(void);
extern void test_vector_5(void);
extern void test_vector_6(void);
extern void test_vector_7(void);
extern void test_vector_8(void);

/**test case main entry*/
void test_main(void *p1, void *p2, void *p3)
{
	ztest_test_suite(test_ccm_fn,
		ztest_unit_test(test_vector_1),
		ztest_unit_test(test_vector_2),
		ztest_unit_test(test_vector_3),
		ztest_unit_test(test_vector_4),
		ztest_unit_test(test_vector_5),
		ztest_unit_test(test_vector_6),
		ztest_unit_test(test_vector_7),
		ztest_unit_test(test_vector_8));
	ztest_run_test_suite(test_ccm_fn);
}


text:
/* #define LOG_NDEBUG 0 */
#define LOG_TAG "audio_utils_format"

#include <log/log.h>

#include <audio_utils/format.h>
#include <audio_utils/primitives.h>

void memcpy_by_audio_format(void *dst, audio_format_t dst_format,
        const void *src, audio_format_t src_format, size_t count)
{
    /* default cases for error falls through to fatal log below. */
    if (dst_format == src_format) {
        switch (dst_format) {
        case AUDIO_FORMAT_PCM_16_BIT:
        case AUDIO_FORMAT_PCM_FLOAT:
        case AUDIO_FORMAT_PCM_8_BIT:
        case AUDIO_FORMAT_PCM_24_BIT_PACKED:
        case AUDIO_FORMAT_PCM_32_BIT:
        case AUDIO_FORMAT_PCM_8_24_BIT:
            if (dst != src) {
                // TODO: should assert if memory regions overlap.
                memcpy(dst, src, count * audio_bytes_per_sample(dst_format));
            }
            return;
        default:
            break;
        }
    }
    switch (dst_format) {
    case AUDIO_FORMAT_PCM_16_BIT:
        switch (src_format) {
        case AUDIO_FORMAT_PCM_FLOAT:
            memcpy_to_i16_from_float((int16_t*)dst, (float*)src, count);
            return;
        case AUDIO_FORMAT_PCM_8_BIT:
            memcpy_to_i16_from_u8((int16_t*)dst, (uint8_t*)src, count);
            return;
        case AUDIO_FORMAT_PCM_24_BIT_PACKED:
            memcpy_to_i16_from_p24((int16_t*)dst, (uint8_t*)src, count);
            return;
        case AUDIO_FORMAT_PCM_32_BIT:
            memcpy_to_i16_from_i32((int16_t*)dst, (int32_t*)src, count);
            return;
        case AUDIO_FORMAT_PCM_8_24_BIT:
            memcpy_to_i16_from_q8_23((int16_t*)dst, (int32_t*)src, count);
            return;
        default:
            break;
        }
        break;
    case AUDIO_FORMAT_PCM_FLOAT:
        switch (src_format) {
        case AUDIO_FORMAT_PCM_16_BIT:
            memcpy_to_float_from_i16((float*)dst, (int16_t*)src, count);
            return;
        case AUDIO_FORMAT_PCM_8_BIT:
            memcpy_to_float_from_u8((float*)dst, (uint8_t*)src, count);
            return;
        case AUDIO_FORMAT_PCM_24_BIT_PACKED:
            memcpy_to_float_from_p24((float*)dst, (uint8_t*)src, count);
            return;
        case AUDIO_FORMAT_PCM_32_BIT:
            memcpy_to_float_from_i32((float*)dst, (int32_t*)src, count);
            return;
        case AUDIO_FORMAT_PCM_8_24_BIT:
            memcpy_to_float_from_q8_23((float*)dst, (int32_t*)src, count);
            return;
        default:
            break;
        }
        break;
    case AUDIO_FORMAT_PCM_8_BIT:
        switch (src_format) {
        case AUDIO_FORMAT_PCM_16_BIT:
            memcpy_to_u8_from_i16((uint8_t*)dst, (int16_t*)src, count);
            return;
        case AUDIO_FORMAT_PCM_FLOAT:
            memcpy_to_u8_from_float((uint8_t*)dst, (float*)src, count);
            return;
        default:
            break;
        }
        break;
    case AUDIO_FORMAT_PCM_24_BIT_PACKED:
        switch (src_format) {
        case AUDIO_FORMAT_PCM_16_BIT:
            memcpy_to_p24_from_i16((uint8_t*)dst, (int16_t*)src, count);
            return;
        case AUDIO_FORMAT_PCM_FLOAT:
            memcpy_to_p24_from_float((uint8_t*)dst, (float*)src, count);
            return;
        case AUDIO_FORMAT_PCM_32_BIT:
            memcpy_to_p24_from_i32((uint8_t*)dst, (int32_t*)src, count);
            return;
        case AUDIO_FORMAT_PCM_8_24_BIT:
            memcpy_to_p24_from_q8_23((uint8_t*)dst, (int32_t*)src, count);
            return;
        default:
            break;
        }
        break;
    case AUDIO_FORMAT_PCM_32_BIT:
        switch (src_format) {
        case AUDIO_FORMAT_PCM_16_BIT:
            memcpy_to_i32_from_i16((int32_t*)dst, (int16_t*)src, count);
            return;
        case AUDIO_FORMAT_PCM_FLOAT:
            memcpy_to_i32_from_float((int32_t*)dst, (float*)src, count);
            return;
        case AUDIO_FORMAT_PCM_24_BIT_PACKED:
            memcpy_to_i32_from_p24((int32_t*)dst, (uint8_t *)src, count);
            return;
        default:
            break;
        }
        break;
    case AUDIO_FORMAT_PCM_8_24_BIT:
        switch (src_format) {
        case AUDIO_FORMAT_PCM_16_BIT:
            memcpy_to_q8_23_from_i16((int32_t*)dst, (int16_t*)src, count);
            return;
        case AUDIO_FORMAT_PCM_FLOAT:
            memcpy_to_q8_23_from_float_with_clamp((int32_t*)dst, (float*)src, count);
            return;
        case AUDIO_FORMAT_PCM_24_BIT_PACKED: {
            memcpy_to_q8_23_from_p24((int32_t *)dst, (uint8_t *)src, count);
            return;
        }
        default:
            break;
        }
        break;
    default:
        break;
    }
    LOG_ALWAYS_FATAL("invalid src format %#x for dst format %#x",
            src_format, dst_format);
}

size_t memcpy_by_index_array_initialization_from_channel_mask(int8_t *idxary, size_t arysize,
        audio_channel_mask_t dst_channel_mask, audio_channel_mask_t src_channel_mask)
{
    const audio_channel_representation_t src_representation =
            audio_channel_mask_get_representation(src_channel_mask);
    const audio_channel_representation_t dst_representation =
            audio_channel_mask_get_representation(dst_channel_mask);
    const uint32_t src_bits = audio_channel_mask_get_bits(src_channel_mask);
    const uint32_t dst_bits = audio_channel_mask_get_bits(dst_channel_mask);

    switch (src_representation) {
    case AUDIO_CHANNEL_REPRESENTATION_POSITION:
        switch (dst_representation) {
        case AUDIO_CHANNEL_REPRESENTATION_POSITION:
            return memcpy_by_index_array_initialization(idxary, arysize,
                    dst_bits, src_bits);
        case AUDIO_CHANNEL_REPRESENTATION_INDEX:
            return memcpy_by_index_array_initialization_dst_index(idxary, arysize,
                    dst_bits, src_bits);
        default:
            return 0;
        }
        break;
    case AUDIO_CHANNEL_REPRESENTATION_INDEX:
        switch (dst_representation) {
        case AUDIO_CHANNEL_REPRESENTATION_POSITION:
            return memcpy_by_index_array_initialization_src_index(idxary, arysize,
                    dst_bits, src_bits);
        case AUDIO_CHANNEL_REPRESENTATION_INDEX:
            return memcpy_by_index_array_initialization(idxary, arysize,
                    dst_bits, src_bits);
        default:
            return 0;
        }
        break;
    default:
        return 0;
    }
}


text:
<?php

use LejOrder\ProductManagement\Domain\Model\ProductId;
use Ramsey\Uuid\Uuid;
use Slim\Http\Request;
use Slim\Http\Response;

// api
// products
$app->get('/api/product-management/products', function (Request $request, Response $response) {
    $products = $this->productRepository->allProducts();
    return $response->write($this->serializer->serialize($products, 'json'));
});

$app->get('/api/product-management/products/{productId}', function (Request $request, Response $response) {
    $productId = new ProductId(Uuid::fromString($request->getAttribute('productId')));
    $product = $this->productRepository->productOfId($productId);

    if (null === $product) {
        return $response->withStatus(404);
    }

    return $response->write($this->serializer->serialize($product, 'json'));
});


text:
<?xml version="1.0" encoding="UTF-8"?>
<CustomFieldTranslation xmlns="http://soap.sforce.com/2006/04/metadata">
    <name>Behavior_Involvement__c</name>
    <help>The Behaviour Involvement record this Behaviour Response is for.</help>
    <relationshipLabel>Behaviour Responses</relationshipLabel>
    <label>Behaviour Involvement</label>
</CustomFieldTranslation>


text:
using System;
using System.Diagnostics;
using PdfSharp.Drawing;

namespace PdfSharp.Charting.Renderers
{
  /// <summary>
  /// Represents a plot area renderer of clustered columns, i. e. all columns are drawn side by side.
  /// </summary>
  internal class ColumnClusteredPlotAreaRenderer : ColumnPlotAreaRenderer
  {
    /// <summary>
    /// Initializes a new instance of the ColumnClusteredPlotAreaRenderer class with the
    /// specified renderer parameters.
    /// </summary>
    internal ColumnClusteredPlotAreaRenderer(RendererParameters parms) : base(parms)
    {
    }

    /// <summary>
    /// Calculates the position, width and height of each column of all series.
    /// </summary>
    protected override void CalcColumns()
    {
      ChartRendererInfo cri = (ChartRendererInfo)this.rendererParms.RendererInfo;
      if (cri.seriesRendererInfos.Length == 0)
        return;

      double xMin = cri.xAxisRendererInfo.MinimumScale;
      double yMin = cri.yAxisRendererInfo.MinimumScale;
      double yMax = cri.yAxisRendererInfo.MaximumScale;

      int pointCount = 0;
      foreach (SeriesRendererInfo sr in cri.seriesRendererInfos)
        pointCount += sr.series.seriesElements.Count;

      // Space shared by one clustered column.
      double groupWidth = cri.xAxisRendererInfo.MajorTick;

      // Space used by one column.
      double columnWidth = groupWidth * 3 / 4 / cri.seriesRendererInfos.Length;

      int seriesIdx = 0;
      XPoint[] points = new XPoint[2];
      foreach (SeriesRendererInfo sri in cri.seriesRendererInfos)
      {
        // Set x to first clustered column for each series.
        double x = xMin + groupWidth / 2;

        // Offset for columns of a particular series from the start of a clustered cloumn.
        double dx = (columnWidth * seriesIdx) - (columnWidth / 2 * cri.seriesRendererInfos.Length);

        foreach (ColumnRendererInfo column in sri.pointRendererInfos)
        {
          if (column.point != null)
          {
            double x0 = x + dx;
            double x1 = x + dx + columnWidth;
            double y0 = yMin;
            double y1 = column.point.Value;

            // Draw from zero base line, if it exists.
            if (y0 < 0 && yMax >= 0)
              y0 = 0;

            // y0 should always be lower than y1, i. e. draw column from bottom to top.
            if (y1 < 0 && y1 < y0)
            {
              double y = y0;
              y0 = y1;
              y1 = y;
            }

            points[0].X = x0; // upper left
            points[0].Y = y1;
            points[1].X = x1; // lower right
            points[1].Y = y0;

            cri.plotAreaRendererInfo.matrix.TransformPoints(points);

            column.Rect = new XRect(points[0].X,
                                    points[0].Y,
                                    points[1].X - points[0].X,
                                    points[1].Y - points[0].Y);
          }
          x++; // Next clustered column.
        }
        seriesIdx++;
      }
    }

    /// <summary>
    /// If yValue is within the range from yMin to yMax returns true, otherwise false.
    /// </summary>
    protected override bool IsDataInside(double yMin, double yMax, double yValue)
    {
      return yValue <= yMax && yValue >= yMin;
    }
  }
}


text:
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>WpfAnimatedGif</name>
    </assembly>
    <members>
        <member name="T:WpfAnimatedGif.ImageAnimationController">
            <summary>
            Provides a way to pause, resume or seek a GIF animation.
            </summary>
        </member>
        <member name="M:WpfAnimatedGif.ImageAnimationController.GotoFrame(System.Int32)">
            <summary>
            Seeks the animation to the specified frame index.
            </summary>
            <param name="index">The index of the frame to seek to</param>
        </member>
        <member name="M:WpfAnimatedGif.ImageAnimationController.Pause">
            <summary>
            Pauses the animation.
            </summary>
        </member>
        <member name="M:WpfAnimatedGif.ImageAnimationController.Play">
            <summary>
            Starts or resumes the animation. If the animation is complete, it restarts from the beginning.
            </summary>
        </member>
        <member name="M:WpfAnimatedGif.ImageAnimationController.Finalize">
            <summary>
            Finalizes the current object.
            </summary>
        </member>
        <member name="M:WpfAnimatedGif.ImageAnimationController.Dispose">
            <summary>
            Disposes the current object.
            </summary>
        </member>
        <member name="M:WpfAnimatedGif.ImageAnimationController.Dispose(System.Boolean)">
            <summary>
            Disposes the current object
            </summary>
            <param name="disposing">true to dispose both managed an unmanaged resources, false to dispose only managed resources</param>
        </member>
        <member name="P:WpfAnimatedGif.ImageAnimationController.FrameCount">
            <summary>
            Returns the number of frames in the image.
            </summary>
        </member>
        <member name="P:WpfAnimatedGif.ImageAnimationController.IsPaused">
            <summary>
            Returns a value that indicates whether the animation is paused.
            </summary>
        </member>
        <member name="P:WpfAnimatedGif.ImageAnimationController.IsComplete">
            <summary>
            Returns a value that indicates whether the animation is complete.
            </summary>
        </member>
        <member name="P:WpfAnimatedGif.ImageAnimationController.CurrentFrame">
            <summary>
            Returns the current frame index.
            </summary>
        </member>
        <member name="E:WpfAnimatedGif.ImageAnimationController.CurrentFrameChanged">
            <summary>
            Raised when the current frame changes.
            </summary>
        </member>
        <member name="T:WpfAnimatedGif.ImageBehavior">
            <summary>
            Provides attached properties that display animated GIFs in a standard Image control.
            </summary>
        </member>
        <member name="M:WpfAnimatedGif.ImageBehavior.GetAnimatedSource(System.Windows.Controls.Image)">
            <summary>
            Gets the value of the <c>AnimatedSource</c> attached property for the specified object.
            </summary>
            <param name="obj">The element from which to read the property value.</param>
            <returns>The currently displayed animated image.</returns>
        </member>
        <member name="M:WpfAnimatedGif.ImageBehavior.SetAnimatedSource(System.Windows.Controls.Image,System.Windows.Media.ImageSource)">
            <summary>
            Sets the value of the <c>AnimatedSource</c> attached property for the specified object.
            </summary>
            <param name="obj">The element on which to set the property value.</param>
            <param name="value">The animated image to display.</param>
        </member>
        <member name="F:WpfAnimatedGif.ImageBehavior.AnimatedSourceProperty">
            <summary>
            Identifies the <c>AnimatedSource</c> attached property.
            </summary>
        </member>
        <member name="M:WpfAnimatedGif.ImageBehavior.GetRepeatBehavior(System.Windows.Controls.Image)">
            <summary>
            Gets the value of the <c>RepeatBehavior</c> attached property for the specified object.
            </summary>
            <param name="obj">The element from which to read the property value.</param>
            <returns>The repeat behavior of the animated image.</returns>
        </member>
        <member name="M:WpfAnimatedGif.ImageBehavior.SetRepeatBehavior(System.Windows.Controls.Image,System.Windows.Media.Animation.RepeatBehavior)">
            <summary>
            Sets the value of the <c>RepeatBehavior</c> attached property for the specified object.
            </summary>
            <param name="obj">The element on which to set the property value.</param>
            <param name="value">The repeat behavior of the animated image.</param>
        </member>
        <member name="F:WpfAnimatedGif.ImageBehavior.RepeatBehaviorProperty">
            <summary>
            Identifies the <c>RepeatBehavior</c> attached property.
            </summary>
        </member>
        <member name="M:WpfAnimatedGif.ImageBehavior.GetAnimateInDesignMode(System.Windows.DependencyObject)">
            <summary>
            Gets the value of the <c>AnimateInDesignMode</c> attached property for the specified object.
            </summary>
            <param name="obj">The element from which to read the property value.</param>
            <returns>true if GIF animations are shown in design mode; false otherwise.</returns>
        </member>
        <member name="M:WpfAnimatedGif.ImageBehavior.SetAnimateInDesignMode(System.Windows.DependencyObject,System.Boolean)">
            <summary>
            Sets the value of the <c>AnimateInDesignMode</c> attached property for the specified object.
            </summary>
            <param name="obj">The element on which to set the property value.</param>
            <param name="value">true to show GIF animations in design mode; false otherwise.</param>
        </member>
        <member name="F:WpfAnimatedGif.ImageBehavior.AnimateInDesignModeProperty">
            <summary>
            Identifies the <c>AnimateInDesignMode</c> attached property.
            </summary>
        </member>
        <member name="M:WpfAnimatedGif.ImageBehavior.GetAutoStart(System.Windows.Controls.Image)">
            <summary>
            Gets the value of the <c>AutoStart</c> attached property for the specified object.
            </summary>
            <param name="obj">The element from which to read the property value.</param>
            <returns>true if the animation should start immediately when loaded. Otherwise, false.</returns>
        </member>
        <member name="M:WpfAnimatedGif.ImageBehavior.SetAutoStart(System.Windows.Controls.Image,System.Boolean)">
            <summary>
            Sets the value of the <c>AutoStart</c> attached property for the specified object.
            </summary>
            <param name="obj">The element from which to read the property value.</param>
            <param name="value">true if the animation should start immediately when loaded. Otherwise, false.</param>
            <remarks>The default value is true.</remarks>
        </member>
        <member name="F:WpfAnimatedGif.ImageBehavior.AutoStartProperty">
            <summary>
            Identifies the <c>AutoStart</c> attached property.
            </summary>
        </member>
        <member name="M:WpfAnimatedGif.ImageBehavior.GetAnimationController(System.Windows.Controls.Image)">
            <summary>
            Gets the animation controller for the specified <c>Image</c> control.
            </summary>
            <param name="imageControl"></param>
            <returns></returns>
        </member>
        <member name="M:WpfAnimatedGif.ImageBehavior.GetIsAnimationLoaded(System.Windows.Controls.Image)">
            <summary>
            Gets the value of the <c>IsAnimationLoaded</c> attached property for the specified object.
            </summary>
            <param name="image">The element from which to read the property value.</param>
            <returns>true if the animation is loaded. Otherwise, false.</returns>
        </member>
        <member name="F:WpfAnimatedGif.ImageBehavior.IsAnimationLoadedProperty">
            <summary>
            Identifies the <c>IsAnimationLoaded</c> attached property.
            </summary>
        </member>
        <member name="F:WpfAnimatedGif.ImageBehavior.AnimationLoadedEvent">
            <summary>
            Identifies the <c>AnimationLoaded</c> attached event.
            </summary>
        </member>
        <member name="M:WpfAnimatedGif.ImageBehavior.AddAnimationLoadedHandler(System.Windows.Controls.Image,System.Windows.RoutedEventHandler)">
            <summary>
            Adds a handler for the AnimationLoaded attached event.
            </summary>
            <param name="image">The UIElement that listens to this event.</param>
            <param name="handler">The event handler to be added.</param>
        </member>
        <member name="M:WpfAnimatedGif.ImageBehavior.RemoveAnimationLoadedHandler(System.Windows.Controls.Image,System.Windows.RoutedEventHandler)">
            <summary>
            Removes a handler for the AnimationLoaded attached event.
            </summary>
            <param name="image">The UIElement that listens to this event.</param>
            <param name="handler">The event handler to be removed.</param>
        </member>
        <member name="F:WpfAnimatedGif.ImageBehavior.AnimationCompletedEvent">
            <summary>
            Identifies the <c>AnimationCompleted</c> attached event.
            </summary>
        </member>
        <member name="M:WpfAnimatedGif.ImageBehavior.AddAnimationCompletedHandler(System.Windows.Controls.Image,System.Windows.RoutedEventHandler)">
            <summary>
            Adds a handler for the AnimationCompleted attached event.
            </summary>
            <param name="d">The UIElement that listens to this event.</param>
            <param name="handler">The event handler to be added.</param>
        </member>
        <member name="M:WpfAnimatedGif.ImageBehavior.RemoveAnimationCompletedHandler(System.Windows.Controls.Image,System.Windows.RoutedEventHandler)">
            <summary>
            Removes a handler for the AnimationCompleted attached event.
            </summary>
            <param name="d">The UIElement that listens to this event.</param>
            <param name="handler">The event handler to be removed.</param>
        </member>
        <member name="F:WpfAnimatedGif.Properties.VersionInfo.VersionString">
            <summary>
            Single place to define version
            </summary>
        </member>
    </members>
</doc>


text:
namespace gl
{
#if defined(ANGLE_ENABLE_PERF)
typedef void (WINAPI *PerfOutputFunction)(D3DCOLOR, LPCWSTR);
#else
typedef void (*PerfOutputFunction)(unsigned int, const wchar_t*);
#endif

static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg)
{
#if defined(ANGLE_ENABLE_PERF) || defined(ANGLE_ENABLE_TRACE)
    static std::vector<char> asciiMessageBuffer(512);

    // Attempt to just print to the current buffer
    int len = vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg);
    if (len < 0 || static_cast<size_t>(len) >= asciiMessageBuffer.size())
    {
        // Buffer was not large enough, calculate the required size and resize the buffer
        len = vsnprintf(NULL, 0, format, vararg);
        asciiMessageBuffer.resize(len + 1);

        // Print again
        vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg);
    }

    // NULL terminate the buffer to be safe
    asciiMessageBuffer[len] = '\0';
#endif

#if defined(ANGLE_ENABLE_PERF)
    if (perfActive())
    {
        // The perf function only accepts wide strings, widen the ascii message
        static std::wstring wideMessage;
        if (wideMessage.capacity() < asciiMessageBuffer.size())
        {
            wideMessage.reserve(asciiMessageBuffer.size());
        }

        wideMessage.assign(asciiMessageBuffer.begin(), asciiMessageBuffer.begin() + len);

        perfFunc(0, wideMessage.c_str());
    }
#endif // ANGLE_ENABLE_PERF

#if defined(ANGLE_ENABLE_TRACE)
#if defined(NDEBUG)
    if (traceFileDebugOnly)
    {
        return;
    }
#endif // NDEBUG

    static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app);
    if (file)
    {
        file.write(&asciiMessageBuffer[0], len);
        file.flush();
    }

#endif // ANGLE_ENABLE_TRACE
}

void trace(bool traceFileDebugOnly, const char *format, ...)
{
    va_list vararg;
    va_start(vararg, format);
#if defined(ANGLE_ENABLE_PERF)
    output(traceFileDebugOnly, D3DPERF_SetMarker, format, vararg);
#else
    output(traceFileDebugOnly, NULL, format, vararg);
#endif
    va_end(vararg);
}

bool perfActive()
{
#if defined(ANGLE_ENABLE_PERF)
    static bool active = D3DPERF_GetStatus() != 0;
    return active;
#else
    return false;
#endif
}

ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...)
{
#if defined(ANGLE_ENABLE_PERF)
#if !defined(ANGLE_ENABLE_TRACE)
    if (!perfActive())
    {
        return;
    }
#endif // !ANGLE_ENABLE_TRACE
    va_list vararg;
    va_start(vararg, format);
    output(true, reinterpret_cast<PerfOutputFunction>(D3DPERF_BeginEvent), format, vararg);
    va_end(vararg);
#endif // ANGLE_ENABLE_PERF
}

ScopedPerfEventHelper::~ScopedPerfEventHelper()
{
#if defined(ANGLE_ENABLE_PERF)
    if (perfActive())
    {
        D3DPERF_EndEvent();
    }
#endif
}
}


text:
require 'helper'

class TestFindAttachmentsClient < Test::Unit::TestCase
  context "when an edis client is asked to find an attachement it" do
    setup do
      @edis = EDIS::Client.new
    end

    should "return errors when an attachement can not be found" do
      result = @edis.find_attachments({document_id: 000000})
      assert result.errors
    end

    should "return an attachment" do
      result = @edis.find_attachments({document_id: 453695})
      assert result.results
    end
  end
end


text:
A GitHub plugin that adds since & author and description notes to all code files that miss it in a project
Written originally by:

Raviv Rachmiel <ravivra@campus.technion.ac.il>

Yaakov Sokolik <yaakovs@campus.technion.ac.il>

##Working with the program:
### Working on a local repository:
You can use the program in order to add the since,author, description convention to your java code files by
calling main.py with the path of the local git repository.
The program will add the right @since, @author and descriptions needed exactly where they are needed to each file
### Working on a Github repository:
You can use the program in order to add the since,author, description convention to your java code files by
calling main.py with the URL of the repo, your username and your mail.
The program will add the right @since, @author and descriptions needed exactly where they are needed to each file.
Also, the program will clone automatically the repo to a temp directory, make the changes, commit them and push to
the github repository (so you have to have the right privileges for the repo).
At the end, it will delete the temp folder it cloned

##Usage:
###For a local git repo:
    python3 main.py <local git repo path>
###for a Github repo:
    python3 main.py <github repo URL> <user.name> <user.mail>
* the user.name has to be either 1 word, or a couple of words wrapped by ""
* the <user.name> and <user.mail> are for the commit info
* you have to have the right priviliges in order to push to the github repo of course

###Dependencies:
We use:

- python3

- gitpython library:

        pip3 install gitpython

###Works for:
- Java

Enjoy :)


text:
package com.flipkart.poseidon.log4j.pattern;

import com.flipkart.poseidon.log4j.message.IAccessLog;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.pattern.ConverterKeys;
import org.apache.logging.log4j.core.pattern.PatternConverter;

/**
 * Log4J plugin to convert keys in patterns. Converts contentLength key in pattern.
 * <p/>
 * Created by mohan.pandian on 31/08/16.
 */
@Plugin(name = "ContentLengthPatternConverter", category = PatternConverter.CATEGORY)
@ConverterKeys({"contentLength"})
public class ContentLengthPatternConverter extends AccessLogPatternConverter {
    public static ContentLengthPatternConverter newInstance(final String[] options) {
        return new ContentLengthPatternConverter();
    }

    @Override
    protected void format(IAccessLog accessLog, StringBuilder stringBuilder) {
        stringBuilder.append(accessLog.getContentLength());
    }
}


text:
' Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

Imports System.Globalization
Imports System.Threading.Thread
Imports Roslyn.Test.Utilities
Imports Xunit

Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests

    Public Class ObjectDisplayTests

        <Fact()>
        Public Sub IntegralPrimitives()
            Assert.Equal("1", FormatPrimitive(CByte(1)))
            Assert.Equal("123", FormatPrimitive(CByte(123)))
            Assert.Equal("255", FormatPrimitive(Byte.MaxValue))
            Assert.Equal("1", FormatPrimitive(CSByte(1)))
            Assert.Equal("123", FormatPrimitive(CSByte(123)))
            Assert.Equal("-1", FormatPrimitive(CSByte(-1)))
            Assert.Equal("1", FormatPrimitive(CUShort(1)))
            Assert.Equal("123", FormatPrimitive(CUShort(123)))
            Assert.Equal("65535", FormatPrimitive(UShort.MaxValue))
            Assert.Equal("1", FormatPrimitive(CShort(1)))
            Assert.Equal("123", FormatPrimitive(CShort(123)))
            Assert.Equal("-1", FormatPrimitive(CShort(-1)))
            Assert.Equal("1", FormatPrimitive(CUInt(1)))
            Assert.Equal("123", FormatPrimitive(CUInt(123)))
            Assert.Equal("4294967295", FormatPrimitive(UInteger.MaxValue))
            Assert.Equal("1", FormatPrimitive(CInt(1)))
            Assert.Equal("123", FormatPrimitive(CInt(123)))
            Assert.Equal("-1", FormatPrimitive(CInt(-1)))
            Assert.Equal("1", FormatPrimitive(CULng(1)))
            Assert.Equal("123", FormatPrimitive(CULng(123)))
            Assert.Equal("18446744073709551615", FormatPrimitive(ULong.MaxValue))
            Assert.Equal("1", FormatPrimitive(CLng(1)))
            Assert.Equal("123", FormatPrimitive(CLng(123)))
            Assert.Equal("-1", FormatPrimitive(CLng(-1)))

            ' Dev10 EE does not "pad" positive values with '0', but this is desired for Roslyn
            Assert.Equal("&H00", FormatPrimitiveUsingHexadecimalNumbers(CByte(0)))
            Assert.Equal("&H01", FormatPrimitiveUsingHexadecimalNumbers(CByte(1)))
            Assert.Equal("&H7F", FormatPrimitiveUsingHexadecimalNumbers(CByte(&H7F)))
            Assert.Equal("&HFF", FormatPrimitiveUsingHexadecimalNumbers(Byte.MaxValue))
            Assert.Equal("&H00", FormatPrimitiveUsingHexadecimalNumbers(CSByte(0)))
            Assert.Equal("&H01", FormatPrimitiveUsingHexadecimalNumbers(CSByte(1)))
            Assert.Equal("&H7F", FormatPrimitiveUsingHexadecimalNumbers(CSByte(&H7F)))
            Assert.Equal("&HFFFFFFFF", FormatPrimitiveUsingHexadecimalNumbers(CSByte(-1)))
            Assert.Equal("&HFFFFFFFE", FormatPrimitiveUsingHexadecimalNumbers(CSByte((-2))))
            Assert.Equal("&H0000", FormatPrimitiveUsingHexadecimalNumbers(CUShort(0)))
            Assert.Equal("&H0001", FormatPrimitiveUsingHexadecimalNumbers(CUShort(1)))
            Assert.Equal("&H007F", FormatPrimitiveUsingHexadecimalNumbers(CUShort(&H7F)))
            Assert.Equal("&HFFFF", FormatPrimitiveUsingHexadecimalNumbers(UShort.MaxValue))
            Assert.Equal("&H0000", FormatPrimitiveUsingHexadecimalNumbers(CShort(0)))
            Assert.Equal("&H0001", FormatPrimitiveUsingHexadecimalNumbers(CShort(1)))
            Assert.Equal("&H007F", FormatPrimitiveUsingHexadecimalNumbers(CShort(&H7F)))
            Assert.Equal("&HFFFFFFFF", FormatPrimitiveUsingHexadecimalNumbers(CShort(-1)))
            Assert.Equal("&HFFFFFFFE", FormatPrimitiveUsingHexadecimalNumbers(CShort((-2))))
            Assert.Equal("&H00000000", FormatPrimitiveUsingHexadecimalNumbers(CUInt(0)))
            Assert.Equal("&H00000001", FormatPrimitiveUsingHexadecimalNumbers(CUInt(1)))
            Assert.Equal("&H0000007F", FormatPrimitiveUsingHexadecimalNumbers(CUInt(&H7F)))
            Assert.Equal("&HFFFFFFFF", FormatPrimitiveUsingHexadecimalNumbers(UInteger.MaxValue))
            Assert.Equal("&H00000000", FormatPrimitiveUsingHexadecimalNumbers(CInt(0)))
            Assert.Equal("&H00000001", FormatPrimitiveUsingHexadecimalNumbers(CInt(1)))
            Assert.Equal("&H0000007F", FormatPrimitiveUsingHexadecimalNumbers(CInt(&H7F)))
            Assert.Equal("&HFFFFFFFF", FormatPrimitiveUsingHexadecimalNumbers(CInt(-1)))
            Assert.Equal("&HFFFFFFFE", FormatPrimitiveUsingHexadecimalNumbers(CInt((-2))))
            Assert.Equal("&H0000000000000000", FormatPrimitiveUsingHexadecimalNumbers(CULng(0)))
            Assert.Equal("&H0000000000000001", FormatPrimitiveUsingHexadecimalNumbers(CULng(1)))
            Assert.Equal("&H000000000000007F", FormatPrimitiveUsingHexadecimalNumbers(CULng(&H7F)))
            Assert.Equal("&HFFFFFFFFFFFFFFFF", FormatPrimitiveUsingHexadecimalNumbers(ULong.MaxValue))
            Assert.Equal("&H0000000000000000", FormatPrimitiveUsingHexadecimalNumbers(CLng(0)))
            Assert.Equal("&H0000000000000001", FormatPrimitiveUsingHexadecimalNumbers(CLng(1)))
            Assert.Equal("&H000000000000007F", FormatPrimitiveUsingHexadecimalNumbers(CLng(&H7F)))
            Assert.Equal("&HFFFFFFFFFFFFFFFF", FormatPrimitiveUsingHexadecimalNumbers(CLng(-1)))
            Assert.Equal("&HFFFFFFFFFFFFFFFE", FormatPrimitiveUsingHexadecimalNumbers(CLng((-2))))
        End Sub

        <Fact>
        Public Sub Booleans()
            Assert.Equal("True", FormatPrimitive(True))
            Assert.Equal("False", FormatPrimitive(False))
        End Sub

        <Fact>
        Public Sub NothingLiterals()
            Assert.Equal("Nothing", FormatPrimitive(Nothing))
        End Sub

        <Fact>
        Public Sub Decimals()
            Assert.Equal("2", FormatPrimitive(CType(2, Decimal)))
        End Sub

        <Fact>
        Public Sub Singles()
            Assert.Equal("2", FormatPrimitive(CType(2, Single)))
        End Sub

        <Fact>
        Public Sub Doubles()
            Assert.Equal("2", FormatPrimitive(CType(2, Double)))
        End Sub

        <Fact>
        Public Sub Characters()
            ' Note, the legacy EE ignores the "nq" setting
            Assert.Equal("""x""c", FormatPrimitive("x"c, quoteStrings:=True))
            Assert.Equal("x", FormatPrimitive("x"c, quoteStrings:=False))
            Assert.Equal("""x""c", FormatPrimitiveUsingHexadecimalNumbers("x"c, quoteStrings:=True))
            Assert.Equal("x", FormatPrimitiveUsingHexadecimalNumbers("x"c, quoteStrings:=False))

            Assert.Equal("vbNullChar", FormatPrimitiveUsingHexadecimalNumbers(ChrW(0), quoteStrings:=True))
            Assert.Equal("ChrW(&H1E)", FormatPrimitiveUsingHexadecimalNumbers(ChrW(&H1E), quoteStrings:=True))
            Assert.Equal(New String({ChrW(&H1E)}), FormatPrimitiveUsingHexadecimalNumbers(ChrW(&H1E), quoteStrings:=False))
            Assert.Equal(New String({ChrW(20)}), FormatPrimitive(ChrW(20)))
            Assert.Equal("vbBack", FormatPrimitiveUsingHexadecimalNumbers(ChrW(&H8), quoteStrings:=True))
            Assert.Equal(vbBack, FormatPrimitive(ChrW(&H8)))
            Assert.Equal("vbLf", FormatPrimitiveUsingHexadecimalNumbers(ChrW(&HA), quoteStrings:=True))
            Assert.Equal("vbVerticalTab", FormatPrimitiveUsingHexadecimalNumbers(vbVerticalTab(0), quoteStrings:=True))
            Assert.Equal("vbTab", FormatPrimitiveUsingHexadecimalNumbers(ChrW(&H9), quoteStrings:=True))
            Assert.Equal("vbFormFeed", FormatPrimitiveUsingHexadecimalNumbers(ChrW(&HC), quoteStrings:=True))
            Assert.Equal("vbCr", FormatPrimitiveUsingHexadecimalNumbers(ChrW(&HD), quoteStrings:=True))
        End Sub

        <Fact>
        Public Sub Characters_QuotesAndEscaping()
            Assert.Equal(QuoteAndEscapingCombinations("a"c), {"a", """a""c", """a""c"})
            Assert.Equal(QuoteAndEscapingCombinations(vbTab(0)), {vbTab, """" & vbTab & """c", "vbTab"})
            Assert.Equal(QuoteAndEscapingCombinations(ChrW(&H26F4)), {ChrW(&H26F4).ToString(), """" & ChrW(&H26F4) & """c", """" & ChrW(&H26F4) & """c"}) ' Miscellaneous symbol
            Assert.Equal(QuoteAndEscapingCombinations(ChrW(&H7F)), {ChrW(&H7F).ToString(), """" & ChrW(&H7F) & """c", "ChrW(127)"}) ' Control character
            Assert.Equal(QuoteAndEscapingCombinations(""""c), {"""", """""""""c", """""""""c"}) ' Quote
        End Sub

        Private Shared Function QuoteAndEscapingCombinations(ch As Char) As IEnumerable(Of String)
            ' Disallowed in VB: ObjectDisplay.FormatLiteral(ch, ObjectDisplayOptions.EscapeNonPrintableStringCharacters),
            Return {
                ObjectDisplay.FormatLiteral(ch, ObjectDisplayOptions.None),
                ObjectDisplay.FormatLiteral(ch, ObjectDisplayOptions.UseQuotes),
                ObjectDisplay.FormatLiteral(ch, ObjectDisplayOptions.UseQuotes Or ObjectDisplayOptions.EscapeNonPrintableCharacters)
            }
        End Function

        <Fact()>
        Public Sub Strings()
            Assert.Equal("", FormatPrimitive("", quoteStrings:=False))
            Assert.Equal("a", FormatPrimitive("a", quoteStrings:=False))
            Assert.Equal("""", FormatPrimitive("""", quoteStrings:=False))
            Assert.Equal("""""", FormatPrimitive("", quoteStrings:=True))
            Assert.Equal("""""""""", FormatPrimitive("""", quoteStrings:=True))

            Assert.Equal("ChrW(&HFFFE)", FormatPrimitiveUsingHexadecimalNumbers(ChrW(&HFFFE), quoteStrings:=True))
            Assert.Equal("ChrW(65534)", FormatPrimitive(ChrW(&HFFFE), quoteStrings:=True))
            Assert.Equal(New String({ChrW(&HFFFE)}), FormatPrimitiveUsingHexadecimalNumbers(ChrW(&HFFFE), quoteStrings:=False))
            Assert.Equal(New String({ChrW(65534)}), FormatPrimitive(ChrW(&HFFFE), quoteStrings:=False))

            Dim s = "a" & ChrW(&HFFFF) & ChrW(&HFFFE) & vbCrLf & "b"

            Assert.Equal("""a"" & ChrW(&HFFFE)", FormatPrimitiveUsingHexadecimalNumbers("a" & ChrW(&HFFFE), quoteStrings:=True))
            Assert.Equal("ChrW(&HFFFE) & ""a""", FormatPrimitiveUsingHexadecimalNumbers(ChrW(&HFFFE) & "a", quoteStrings:=True))
            Assert.Equal("""a"" & ChrW(&HFFFE) & ""a""", FormatPrimitiveUsingHexadecimalNumbers("a" & ChrW(&HFFFE) & "a", quoteStrings:=True))
            Assert.Equal("ChrW(&HFFFF) & ChrW(&HFFFE)", FormatPrimitiveUsingHexadecimalNumbers(ChrW(&HFFFF) & ChrW(&HFFFE), quoteStrings:=True))
            Assert.Equal("ChrW(&HFFFF) & ""a"" & ChrW(&HFFFE)", FormatPrimitiveUsingHexadecimalNumbers(ChrW(&HFFFF) & "a" & ChrW(&HFFFE), quoteStrings:=True))
            Assert.Equal("""a"" & ChrW(&HFFFF) & ChrW(&HFFFE) & vbCrLf & ""b""", FormatPrimitiveUsingHexadecimalNumbers(s, quoteStrings:=True))

            ' non-printable characters are unchanged if quoting is disabled
            Assert.Equal(s, FormatPrimitiveUsingHexadecimalNumbers(s, quoteStrings:=False))
            Assert.Equal(s, ObjectDisplay.FormatLiteral(s, ObjectDisplayOptions.None))
            Assert.Equal("""a"" & ChrW(&HFFFF) & ChrW(&HFFFE) & vbCrLf & ""b""", ObjectDisplay.FormatLiteral(s, ObjectDisplayOptions.UseQuotes Or ObjectDisplayOptions.EscapeNonPrintableCharacters Or ObjectDisplayOptions.UseHexadecimalNumbers))

            ' "well-known" characters:
            Assert.Equal("""a"" & vbBack", FormatPrimitiveUsingHexadecimalNumbers("a" & vbBack, quoteStrings:=True))
            Assert.Equal("""a"" & vbCr", FormatPrimitiveUsingHexadecimalNumbers("a" & vbCr, quoteStrings:=True))
            Assert.Equal("""a"" & vbCrLf", FormatPrimitiveUsingHexadecimalNumbers("a" & vbCrLf, quoteStrings:=True))
            Assert.Equal("""a"" & vbFormFeed", FormatPrimitiveUsingHexadecimalNumbers("a" & vbFormFeed, quoteStrings:=True))
            Assert.Equal("""a"" & vbLf", FormatPrimitiveUsingHexadecimalNumbers("a" & vbLf, quoteStrings:=True))
            Assert.Equal("""a"" & vbNullChar", FormatPrimitiveUsingHexadecimalNumbers("a" & vbNullChar, quoteStrings:=True))
            Assert.Equal("""a"" & vbTab", FormatPrimitiveUsingHexadecimalNumbers("a" & vbTab, quoteStrings:=True))
            Assert.Equal("""a"" & vbVerticalTab", FormatPrimitiveUsingHexadecimalNumbers("a" & vbVerticalTab, quoteStrings:=True))
        End Sub

        <Fact>
        Public Sub Strings_QuotesAndEscaping()
            Assert.Equal(QuoteAndEscapingCombinations("a"), {"a", """a""", """a"""})
            Assert.Equal(QuoteAndEscapingCombinations(vbTab), {vbTab, """" & vbTab & """", "vbTab"})
            Assert.Equal(QuoteAndEscapingCombinations(ChrW(&H26F4).ToString()), {ChrW(&H26F4).ToString(), """" & ChrW(&H26F4) & """", """" & ChrW(&H26F4) & """"}) ' Miscellaneous symbol
            Assert.Equal(QuoteAndEscapingCombinations(ChrW(&H7F).ToString()), {ChrW(&H7F).ToString(), """" & ChrW(&H7F) & """", "ChrW(127)"}) ' Control character
            Assert.Equal(QuoteAndEscapingCombinations(""""), {"""", """""""""", """"""""""}) ' Quote
        End Sub

        Private Shared Function QuoteAndEscapingCombinations(s As String) As IEnumerable(Of String)
            ' Disallowed in VB: ObjectDisplay.FormatLiteral(s, ObjectDisplayOptions.EscapeNonPrintableStringCharacters),
            Return {
                ObjectDisplay.FormatLiteral(s, ObjectDisplayOptions.None),
                ObjectDisplay.FormatLiteral(s, ObjectDisplayOptions.UseQuotes),
                ObjectDisplay.FormatLiteral(s, ObjectDisplayOptions.UseQuotes Or ObjectDisplayOptions.EscapeNonPrintableCharacters)
            }
        End Function

        <Fact(), WorkItem(529850, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529850")>
        Public Sub CultureInvariance()
            Dim originalCulture = CurrentThread.CurrentCulture
            Try
                CurrentThread.CurrentCulture = New CultureInfo(1031) ' de-DE

                Dim dateValue As New Date(2001, 1, 31)
                Assert.Equal("31.01.2001 00:00:00", dateValue.ToString())
                Assert.Equal("#1/31/2001 12:00:00 AM#", FormatPrimitive(dateValue))

                Dim decimalValue As New Decimal(12.5)
                Assert.Equal("12,5", decimalValue.ToString())
                Assert.Equal("12.5", FormatPrimitive(decimalValue))
                Assert.Equal("12.5", ObjectDisplay.FormatLiteral(decimalValue, ObjectDisplayOptions.None, CultureInfo.InvariantCulture))
                Assert.Equal("12,5", ObjectDisplay.FormatLiteral(decimalValue, ObjectDisplayOptions.None, CurrentThread.CurrentCulture))

                Dim doubleValue As Double = 12.5
                Assert.Equal("12,5", doubleValue.ToString())
                Assert.Equal("12.5", FormatPrimitive(doubleValue))
                Assert.Equal("12.5", ObjectDisplay.FormatLiteral(doubleValue, ObjectDisplayOptions.None, CultureInfo.InvariantCulture))
                Assert.Equal("12,5", ObjectDisplay.FormatLiteral(doubleValue, ObjectDisplayOptions.None, CurrentThread.CurrentCulture))

                Dim singleValue As Single = 12.5
                Assert.Equal("12,5", singleValue.ToString())
                Assert.Equal("12.5", FormatPrimitive(singleValue))
                Assert.Equal("12.5", ObjectDisplay.FormatLiteral(singleValue, ObjectDisplayOptions.None, CultureInfo.InvariantCulture))
                Assert.Equal("12,5", ObjectDisplay.FormatLiteral(singleValue, ObjectDisplayOptions.None, CurrentThread.CurrentCulture))

            Finally
                CurrentThread.CurrentCulture = originalCulture
            End Try
        End Sub

        <Fact>
        Public Sub TypeSuffixes()
            Dim booleanValue As Boolean = True
            Assert.Equal("True", FormatPrimitiveIncludingTypeSuffix(booleanValue))

            Dim sbyteValue As Byte = &H2A
            Assert.Equal("42", FormatPrimitiveIncludingTypeSuffix(sbyteValue))

            Dim byteValue As Byte = &H2A
            Assert.Equal("42", FormatPrimitiveIncludingTypeSuffix(byteValue))

            Dim shortValue As Short = &H2A
            Assert.Equal("42S", FormatPrimitiveIncludingTypeSuffix(shortValue))

            Dim ushortValue As UShort = &H2A
            Assert.Equal("42US", FormatPrimitiveIncludingTypeSuffix(ushortValue))

            Dim integerValue As Integer = &H2A
            Assert.Equal("42I", FormatPrimitiveIncludingTypeSuffix(integerValue))

            Dim uintegerValue As UInteger = &H2A
            Assert.Equal("42UI", FormatPrimitiveIncludingTypeSuffix(uintegerValue))

            Dim longValue As Long = &H2A
            Assert.Equal("42L", FormatPrimitiveIncludingTypeSuffix(longValue))

            Dim ulongValue As ULong = &H2A
            Assert.Equal("42UL", FormatPrimitiveIncludingTypeSuffix(ulongValue))

            Dim singleValue As Single = 3.14159
            Assert.Equal("3.14159F", FormatPrimitiveIncludingTypeSuffix(singleValue))

            Dim doubleValue As Double = 26.2
            Assert.Equal("26.2R", FormatPrimitiveIncludingTypeSuffix(doubleValue))

            Dim decimalValue As Decimal = 12.5D
            Assert.Equal("12.5D", FormatPrimitiveIncludingTypeSuffix(decimalValue, useHexadecimalNumbers:=True))
        End Sub

        <Fact>
        Public Sub StringEscaping()
            Const value = "a" & vbTab & "b"

            Assert.Equal("a" & vbTab & "b", ObjectDisplay.FormatPrimitive(value, ObjectDisplayOptions.None))
            Assert.Equal("""a" & vbTab & "b""", ObjectDisplay.FormatPrimitive(value, ObjectDisplayOptions.UseQuotes))
            ' Not allowed in VB: ObjectDisplay.FormatPrimitive(value, ObjectDisplayOptions.EscapeNonPrintableStringCharacters)
            Assert.Equal("""a"" & vbTab & ""b""", ObjectDisplay.FormatPrimitive(value, ObjectDisplayOptions.UseQuotes Or ObjectDisplayOptions.EscapeNonPrintableCharacters))
        End Sub

        Private Function FormatPrimitive(obj As Object, Optional quoteStrings As Boolean = False) As String
            Return ObjectDisplay.FormatPrimitive(obj, If(quoteStrings, ObjectDisplayOptions.UseQuotes Or ObjectDisplayOptions.EscapeNonPrintableCharacters, ObjectDisplayOptions.None))
        End Function

        Private Function FormatPrimitiveUsingHexadecimalNumbers(obj As Object, Optional quoteStrings As Boolean = False) As String
            Dim options = If(quoteStrings, ObjectDisplayOptions.UseQuotes Or ObjectDisplayOptions.EscapeNonPrintableCharacters, ObjectDisplayOptions.None)
            Return ObjectDisplay.FormatPrimitive(obj, options Or ObjectDisplayOptions.UseHexadecimalNumbers)
        End Function

        Private Function FormatPrimitiveIncludingTypeSuffix(obj As Object, Optional useHexadecimalNumbers As Boolean = False) As String
            Dim options = If(useHexadecimalNumbers, ObjectDisplayOptions.UseHexadecimalNumbers, ObjectDisplayOptions.None)
            Return ObjectDisplay.FormatPrimitive(obj, options Or ObjectDisplayOptions.IncludeTypeSuffix)
        End Function

    End Class

End Namespace


text:
layout: page
author: Wikipedia Contributors
title: U.S. Silver Certificate
link: https://en.wikipedia.org/wiki/Silver_certificate_%28United_States%29
date: 1111-11-11
lesson: 12
---


text:
package org.mockitousage.bugs.varargs;

import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;

import org.junit.Test;
import org.mockito.Mock;
import org.mockitoutil.TestBase;

//see issue 62
public class VarargsNotPlayingWithAnyObjectTest extends TestBase {

    interface VarargMethod {
        Object run(String... args);
    }

    @Mock VarargMethod mock;

    @Test
    public void shouldMatchAnyVararg() {
        mock.run("a", "b");

        verify(mock).run(anyString(), anyString());
        verify(mock).run((String) anyObject(), (String) anyObject());

        verify(mock).run((String[]) anyVararg());

        verify(mock, never()).run();
        verify(mock, never()).run(anyString(), eq("f"));
    }

    //we cannot use anyObject() for entire varargs because it makes the verification pick up extra invocations
    //see other tests in this package
    @Test
    public void shouldNotAllowUsingAnyObjectForVarArgs() {
        mock.run("a", "b");

        try {
            verify(mock).run((String[]) anyObject());
            fail();
        } catch (AssertionError e) {}
    }

    @Test
    public void shouldStubUsingAnyVarargs() {
        when(mock.run((String[]) anyVararg())).thenReturn("foo");

        assertEquals("foo", mock.run("a", "b"));
    }
}


text:
package integration

import (
	"path"
	"reflect"
	"strings"
	"testing"

	"github.com/coreos/etcd/clientv3"
	"github.com/coreos/etcd/pkg/transport"

	apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
	"k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
	serveroptions "k8s.io/apiextensions-apiserver/pkg/cmd/server/options"
	"k8s.io/apiextensions-apiserver/test/integration/fixtures"
	"k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/apimachinery/pkg/util/json"
	genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
	"k8s.io/client-go/dynamic"
)

func TestPostInvalidObjectMeta(t *testing.T) {
	tearDown, apiExtensionClient, dynamicClient, err := fixtures.StartDefaultServerWithClients(t)
	if err != nil {
		t.Fatal(err)
	}
	defer tearDown()

	noxuDefinition := fixtures.NewNoxuCustomResourceDefinition(apiextensionsv1beta1.NamespaceScoped)
	noxuDefinition, err = fixtures.CreateNewCustomResourceDefinition(noxuDefinition, apiExtensionClient, dynamicClient)
	if err != nil {
		t.Fatal(err)
	}

	noxuResourceClient := newNamespacedCustomResourceClient("default", dynamicClient, noxuDefinition)

	obj := fixtures.NewNoxuInstance("default", "foo")
	unstructured.SetNestedField(obj.UnstructuredContent(), int64(42), "metadata", "unknown")
	unstructured.SetNestedField(obj.UnstructuredContent(), map[string]interface{}{"foo": int64(42), "bar": "abc"}, "metadata", "labels")
	_, err = instantiateCustomResource(t, obj, noxuResourceClient, noxuDefinition)
	if err == nil {
		t.Fatalf("unexpected non-error, expected invalid labels to be rejected: %v", err)
	}
	if status, ok := err.(errors.APIStatus); !ok {
		t.Fatalf("expected APIStatus error, but got: %#v", err)
	} else if !errors.IsBadRequest(err) {
		t.Fatalf("expected BadRequst error, but got: %v", errors.ReasonForError(err))
	} else if !strings.Contains(status.Status().Message, "cannot be handled") {
		t.Fatalf("expected 'cannot be handled' error message, got: %v", status.Status().Message)
	}

	unstructured.SetNestedField(obj.UnstructuredContent(), map[string]interface{}{"bar": "abc"}, "metadata", "labels")
	obj, err = instantiateCustomResource(t, obj, noxuResourceClient, noxuDefinition)
	if err != nil {
		t.Fatalf("unexpected error: %v", err)
	}

	if unknown, found, err := unstructured.NestedInt64(obj.UnstructuredContent(), "metadata", "unknown"); err != nil {
		t.Errorf("unexpected error getting metadata.unknown: %v", err)
	} else if found {
		t.Errorf("unexpected metadata.unknown=%#v: expected this to be pruned", unknown)
	}
}

func TestInvalidObjectMetaInStorage(t *testing.T) {
	tearDown, config, options, err := fixtures.StartDefaultServer(t)
	if err != nil {
		t.Fatal(err)
	}
	defer tearDown()

	apiExtensionClient, err := clientset.NewForConfig(config)
	if err != nil {
		t.Fatal(err)
	}

	dynamicClient, err := dynamic.NewForConfig(config)
	if err != nil {
		t.Fatal(err)
	}

	noxuDefinition := fixtures.NewNoxuCustomResourceDefinition(apiextensionsv1beta1.NamespaceScoped)
	noxuDefinition, err = fixtures.CreateNewCustomResourceDefinition(noxuDefinition, apiExtensionClient, dynamicClient)
	if err != nil {
		t.Fatal(err)
	}

	RESTOptionsGetter := serveroptions.NewCRDRESTOptionsGetter(*options.RecommendedOptions.Etcd)
	restOptions, err := RESTOptionsGetter.GetRESTOptions(schema.GroupResource{Group: noxuDefinition.Spec.Group, Resource: noxuDefinition.Spec.Names.Plural})
	if err != nil {
		t.Fatal(err)
	}
	tlsInfo := transport.TLSInfo{
		CertFile: restOptions.StorageConfig.CertFile,
		KeyFile:  restOptions.StorageConfig.KeyFile,
		CAFile:   restOptions.StorageConfig.CAFile,
	}
	tlsConfig, err := tlsInfo.ClientConfig()
	if err != nil {
		t.Fatal(err)
	}
	etcdConfig := clientv3.Config{
		Endpoints: restOptions.StorageConfig.ServerList,
		TLS:       tlsConfig,
	}
	etcdclient, err := clientv3.New(etcdConfig)
	if err != nil {
		t.Fatal(err)
	}

	t.Logf("Creating object with invalid labels manually in etcd")

	original := fixtures.NewNoxuInstance("default", "foo")
	unstructured.SetNestedField(original.UnstructuredContent(), int64(42), "metadata", "unknown")
	unstructured.SetNestedField(original.UnstructuredContent(), map[string]interface{}{"foo": int64(42), "bar": "abc"}, "metadata", "labels")

	ctx := genericapirequest.WithNamespace(genericapirequest.NewContext(), metav1.NamespaceDefault)
	key := path.Join("/", restOptions.StorageConfig.Prefix, noxuDefinition.Spec.Group, "noxus/default/foo")
	val, _ := json.Marshal(original.UnstructuredContent())
	if _, err := etcdclient.Put(ctx, key, string(val)); err != nil {
		t.Fatalf("unexpected error: %v", err)
	}

	t.Logf("Checking that ObjectMeta is pruned from unknown fields")

	noxuResourceClient := newNamespacedCustomResourceClient("default", dynamicClient, noxuDefinition)
	obj, err := noxuResourceClient.Get("foo", metav1.GetOptions{})
	if err != nil {
		t.Fatalf("unexpected error: %v", err)
	}

	if unknown, found, err := unstructured.NestedFieldNoCopy(obj.UnstructuredContent(), "metadata", "unknown"); err != nil {
		t.Errorf("unexpected error: %v", err)
	} else if found {
		t.Errorf("unexpected to find metadata.unknown=%#v", unknown)
	}

	t.Logf("Checking that ObjectMeta is pruned from invalid typed fields")

	if labels, found, err := unstructured.NestedStringMap(obj.UnstructuredContent(), "metadata", "labels"); err != nil {
		t.Errorf("unexpected error: %v", err)
	} else if found && !reflect.DeepEqual(labels, map[string]string{"bar": "abc"}) {
		t.Errorf("unexpected to find metadata.lables=%#v", labels)
	}
}


text:
#import <GeoFeatures/GeoFeatures.h>
#import <XCTest/XCTest.h>

@interface GFMutableMultiPolygonTests : XCTestCase
@end

@implementation GFMutableMultiPolygonTests

    - (void) testMutableCopy_IsCorrectClass {
        XCTAssertTrue([[[[GFMultiPolygon alloc] initWithWKT: @"MULTIPOLYGON(((20 0,20 10,40 10,40 0,20 0)),((5 5,5 8,8 8,8 5,5 5)))"] mutableCopy] isMemberOfClass: [GFMutableMultiPolygon class]]);
    }

    - (void) testMutableCopy_IsCorrectValue {
        XCTAssertEqualObjects([[[[GFMultiPolygon alloc] initWithWKT: @"MULTIPOLYGON(((20 0,20 10,40 10,40 0,20 0)),((5 5,5 8,8 8,8 5,5 5)))"] mutableCopy] toWKTString], @"MULTIPOLYGON(((20 0,20 10,40 10,40 0,20 0)),((5 5,5 8,8 8,8 5,5 5)))");
    }

    - (void) testAddGeometry_WithValidPolygon {
        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        [multiPolygon addGeometry: [[GFPolygon alloc] initWithWKT: @"POLYGON((20 0,20 10,40 10,40 0,20 0))"]];
        [multiPolygon addGeometry: [[GFPolygon alloc] initWithWKT: @"POLYGON((5 5,5 8,8 8,8 5,5 5))"]];

        XCTAssertEqualObjects([multiPolygon toWKTString], @"MULTIPOLYGON(((20 0,20 10,40 10,40 0,20 0)),((5 5,5 8,8 8,8 5,5 5)))");
    }

    - (void) testAddGeometry_WithNilPolygon {
        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        XCTAssertThrowsSpecificNamed([multiPolygon addGeometry: nil], NSException, NSInvalidArgumentException);
    }

    - (void) testInsertGeometry_WithValidPolygon_BeforePolygon {
        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        [multiPolygon addGeometry: [[GFPolygon alloc] initWithWKT: @"POLYGON((5 5,5 8,8 8,8 5,5 5))"]];
        [multiPolygon insertGeometry: [[GFPolygon alloc] initWithWKT: @"POLYGON((20 0,20 10,40 10,40 0,20 0))"] atIndex: 0];

        XCTAssertEqualObjects([multiPolygon toWKTString], @"MULTIPOLYGON(((20 0,20 10,40 10,40 0,20 0)),((5 5,5 8,8 8,8 5,5 5)))");
    }

    - (void) testInsertGeometry_WithValidPolygon_AtEnd {
        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        [multiPolygon addGeometry: [[GFPolygon alloc] initWithWKT: @"POLYGON((20 0,20 10,40 10,40 0,20 0))"]];
        [multiPolygon insertGeometry: [[GFPolygon alloc] initWithWKT: @"POLYGON((5 5,5 8,8 8,8 5,5 5))"] atIndex: 1];

        XCTAssertEqualObjects([multiPolygon toWKTString], @"MULTIPOLYGON(((20 0,20 10,40 10,40 0,20 0)),((5 5,5 8,8 8,8 5,5 5)))");
    }

    - (void) testInsertGeometry_WithOutOfRangeIndex {
        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        [multiPolygon addGeometry: [[GFPolygon alloc] initWithWKT: @"POLYGON((20 0,20 10,40 10,40 0,20 0))"]];

        XCTAssertThrowsSpecificNamed([multiPolygon insertGeometry: [[GFPolygon alloc] initWithWKT: @"POLYGON((5 5,5 8,8 8,8 5,5 5))"] atIndex: 2], NSException, NSRangeException);
    }

    - (void) testInsertGeometry_WithNilPolygon {
        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        XCTAssertThrowsSpecificNamed([multiPolygon insertGeometry: nil atIndex: 0], NSException, NSInvalidArgumentException);
    }

    - (void) testRemoveAllGeometries_WhileEmpty {
        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        XCTAssertNoThrow([multiPolygon removeAllGeometries]);
    }

    - (void) testRemoveAllGeometries_WhileContainingPolygons {
        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        [multiPolygon addGeometry: [[GFPolygon alloc] initWithWKT: @"POLYGON((20 0,20 10,40 10,40 0,20 0))"]];
        [multiPolygon addGeometry: [[GFPolygon alloc] initWithWKT: @"POLYGON((5 5,5 8,8 8,8 5,5 5))"]];

        [multiPolygon removeAllGeometries];

        XCTAssertEqualObjects([multiPolygon toWKTString], @"MULTIPOLYGON()");
    }

    - (void) testRemoveGeometryAtIndex_BeforePolygon {
        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        [multiPolygon addGeometry: [[GFPolygon alloc] initWithWKT: @"POLYGON((20 0,20 10,40 10,40 0,20 0))"]];
        [multiPolygon addGeometry: [[GFPolygon alloc] initWithWKT: @"POLYGON((5 5,5 8,8 8,8 5,5 5))"]];

        [multiPolygon removeGeometryAtIndex: 0];

        XCTAssertEqualObjects([multiPolygon toWKTString], @"MULTIPOLYGON(((5 5,5 8,8 8,8 5,5 5)))");
    }

    - (void) testRemoveGeometryAtIndex_AtEnd {
        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        [multiPolygon addGeometry: [[GFPolygon alloc] initWithWKT: @"POLYGON((20 0,20 10,40 10,40 0,20 0))"]];
        [multiPolygon addGeometry: [[GFPolygon alloc] initWithWKT: @"POLYGON((5 5,5 8,8 8,8 5,5 5))"]];

        [multiPolygon removeGeometryAtIndex: 1];

        XCTAssertEqualObjects([multiPolygon toWKTString], @"MULTIPOLYGON(((20 0,20 10,40 10,40 0,20 0)))");
    }

    - (void) testRemoveGeometryAtIndex_WithOutOfRangeIndex {
        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        [multiPolygon addGeometry: [[GFPolygon alloc] initWithWKT: @"POLYGON((20 0,20 10,40 10,40 0,20 0))"]];

        XCTAssertThrowsSpecificNamed([multiPolygon removeGeometryAtIndex: 1], NSException, NSRangeException);
    }

#pragma mark - Indexed Subscripting Tests

    - (void) testSetObjectAtIndexedSubscript_WithValidPolygonAndValidIndex {

        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        multiPolygon[0] = [[GFPolygon alloc] initWithWKT: @"POLYGON((20 0,20 10,40 10,40 0,20 0))"];

        XCTAssertEqualObjects([multiPolygon toWKTString], @"MULTIPOLYGON(((20 0,20 10,40 10,40 0,20 0)))");
    }

    - (void) testSetObjectAtIndexedSubscript_With3ValidPolygonsAndValidIndex {

        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        multiPolygon[0] = [[GFPolygon alloc] initWithWKT: @"POLYGON((20 0,20 10,40 10,40 0,20 0))"];
        multiPolygon[1] = [[GFPolygon alloc] initWithWKT: @"POLYGON((5 5,5 8,8 8,8 5,5 5))"];
        multiPolygon[2] = [[GFPolygon alloc] initWithWKT: @"POLYGON((4 4,4 7,7 7,7 4,4 4))"];

        XCTAssertEqualObjects([multiPolygon toWKTString], @"MULTIPOLYGON(((20 0,20 10,40 10,40 0,20 0)),((5 5,5 8,8 8,8 5,5 5)),((4 4,4 7,7 7,7 4,4 4)))");
    }

    - (void) testSetObjectAtIndexedSubscript_WithReassignValidPolygonAndValidIndex {

        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        multiPolygon[0] = [[GFPolygon alloc] initWithWKT: @"POLYGON((4 4,4 7,7 7,7 4,4 4))"];
        multiPolygon[1] = [[GFPolygon alloc] initWithWKT: @"POLYGON((5 5,5 8,8 8,8 5,5 5))"];

        multiPolygon[0] = [[GFPolygon alloc] initWithWKT: @"POLYGON((20 0,20 10,40 10,40 0,20 0))"];

        XCTAssertEqualObjects([multiPolygon toWKTString], @"MULTIPOLYGON(((20 0,20 10,40 10,40 0,20 0)),((5 5,5 8,8 8,8 5,5 5)))");
    }

    - (void) testSetObjectAtIndexedSubscript_WithNilPolygonAndValidIndex {

        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        XCTAssertThrowsSpecificNamed((multiPolygon[0] = nil), NSException, NSInvalidArgumentException);
    }

    - (void) testSetObjectAtIndexedSubscript_WithValidPolygonAndInvalidIndex {

        GFMutableMultiPolygon * multiPolygon = [[GFMutableMultiPolygon alloc] init];

        XCTAssertThrowsSpecificNamed((multiPolygon[1] = [[GFPolygon alloc] init]), NSException, NSRangeException);
    }

@end


text:
from fontTools.pens.basePen import BasePen
from flatten import InputContour, OutputContour
import pyClipper

"""
General Suggestions:
- Contours should only be sent here if they actually overlap.
  This can be checked easily using contour bounds.
- Only perform operations on closed contours.
- contours must have an on curve point
- some kind of a log
"""

class BooleanOperationManager(object):

    def _performOperation(self, operation, subjectContours, clipContours, outPen):
        # prep the contours
        subjectInputContours = [InputContour(contour) for contour in subjectContours if contour and len(contour) > 1]
        clipInputContours = [InputContour(contour) for contour in clipContours if contour and len(contour) > 1]
        inputContours = subjectInputContours + clipInputContours

        resultContours = pyClipper.clipExecute([subjectInputContour.originalFlat for subjectInputContour in subjectInputContours],
                                               [clipInputContour.originalFlat for clipInputContour in clipInputContours],
                                               operation, subjectFillType="noneZero", clipFillType="noneZero")
        # convert to output contours
        outputContours = [OutputContour(contour) for contour in resultContours]
        # re-curve entire contour
        for inputContour in inputContours:
            for outputContour in outputContours:
                if outputContour.final:
                    continue
                if outputContour.reCurveFromEntireInputContour(inputContour):
                    # the input is expired if a match was made,
                    # so stop passing it to the outputs
                    break
        # re-curve segments
        for inputContour in inputContours:
            # skip contours that were comppletely used in the previous step
            if inputContour.used:
                continue
            # XXX this could be expensive if an input becomes completely used
            # it doesn't stop from being passed to the output
            for outputContour in outputContours:
                outputContour.reCurveFromInputContourSegments(inputContour)
        # curve fit
        for outputContour in outputContours:
            outputContour.reCurveSubSegments(inputContours)
        # output the results
        for outputContour in outputContours:
            outputContour.drawPoints(outPen)
        return outputContours

    def union(self, contours, outPen):
        return self._performOperation("union", contours, [], outPen)

    def difference(self, subjectContours, clipContours, outPen):
        return self._performOperation("difference", subjectContours, clipContours, outPen)

    def intersection(self, subjectContours, clipContours, outPen):
        return self._performOperation("intersection", subjectContours, clipContours, outPen)

    def xor(self, subjectContours, clipContours, outPen):
        return self._performOperation("xor", subjectContours, clipContours, outPen)

    def getIntersections(self, contours):
        from flatten import _scalePoints, inverseClipperScale
        # prep the contours
        inputContours = [InputContour(contour) for contour in contours if contour and len(contour) > 1]

        inputFlatPoints = set()
        for contour in inputContours:
            inputFlatPoints.update(contour.originalFlat)

        resultContours = pyClipper.clipExecute([inputContour.originalFlat for inputContour in inputContours],
                                               [],
                                               "union", subjectFillType="noneZero", clipFillType="noneZero")

        resultFlatPoints = set()
        for contour in resultContours:
            resultFlatPoints.update(contour)

        intersections = resultFlatPoints - inputFlatPoints
        return _scalePoints(intersections, inverseClipperScale)


text:
package main

import (
	"bytes"
	"encoding/gob"
	"fmt"
	"os"
)

type Person struct {
	Name Name
	Emails []Email
}

type Name struct {
	Family string
	Personal string
}

type Email struct {
	Kind string
	Address string
}

func (p Person) String() string {
	var buf bytes.Buffer

	buf.WriteString(p.Name.Personal)
	buf.WriteRune(' ')
	buf.WriteString(p.Name.Family)

	for _, v := range p.Emails {
		buf.WriteRune('\n')
		buf.WriteString(v.Kind)
		buf.WriteString(": ")
		buf.WriteString(v.Address)
	}

	return buf.String()
}

func main() {
	var p Person

	loadGob("person.gob", &p)

	fmt.Println("Person", p)
}

func loadGob(fileName string, value interface{}) {
	file, err := os.Open(fileName)

	checkError(err)

	defer file.Close()

	decoder := gob.NewDecoder(file)

	err = decoder.Decode(value)

	checkError(err)
}

func checkError(err error) {
	if err != nil {
		fmt.Fprintf(os.Stderr, "Fatal error: %s\n", err)
		os.Exit(1)
	}
}


text: Automated chicken coop script


text:
module Search {

    export class User {
        Id: string;
        Name: string;
        Email: string;
    }
}


text:
                ({{ index < rate ? '*' : ' ' }})

              ({{ index < rate ? '*' : ' ' }})


text:
//UserTasksController for Angular
ecollabroApp.controller('userTasksDashboardWidgetController',['$scope', 'workflowService', function ($scope, workflowService) {
    $scope.userTasks = [];
    $scope.caption = "glyphicon glyphicon-chevron-down";
    //Method initialize()
    $scope.initialize = function () {
        $scope.loadUserTasks();
    };

    // Method loadUserTasks
    $scope.loadUserTasks = function () {
        workflowService.getUserTasks().then(function (resp) {
            if (resp.businessException == null) {
                $scope.userTasks = resp.result;
            }
            else {
                showMessage("divSummaryMessageUserTasksDashboard", resp.businessException.ExceptionMessage, "danger");
            }
        });
    };

    //Method changeCaption()
    $scope.changeCaption = function () {
        if ($scope.caption == "glyphicon glyphicon-chevron-right")
            $scope.caption = "glyphicon glyphicon-chevron-down";
        else
            $scope.caption = "glyphicon glyphicon-chevron-right";
    };
}]);


text:
@interface SUStatusChecker (Private)
- (id)initForDelegate:(id<SUStatusCheckerDelegate>)inDelegate;
- (void)checkForUpdatesAndNotify:(BOOL)verbosity;
- (BOOL)newVersionAvailable;
- (void)setDelegate:del;
@end;

@implementation SUStatusChecker

+ (SUStatusChecker *)statusCheckerForDelegate:(id<SUStatusCheckerDelegate>)inDelegate;
{
	SUStatusChecker *statusChecker = [[self alloc] initForDelegate:inDelegate];

	return [statusChecker autorelease];
}

- (id)initForDelegate:(id<SUStatusCheckerDelegate>)inDelegate
{
	[super init];

	scDelegate = [inDelegate retain];
	[self setDelegate:inDelegate];

	//[self checkForUpdatesAndNotify:NO];

	return self;
}

- (void)dealloc
{
	[scDelegate release]; scDelegate = nil;

	[super dealloc];
}

- (void)applicationDidFinishLaunching:(NSNotification *)note
{
	//Take no action when the application finishes launching
}

- (void)appcastDidFinishLoading:(SUAppcast *)ac
{
	@try
	{
		if (!ac) { [NSException raise:@"SUAppcastException" format:@"Couldn't get a valid appcast from the server."]; }

		updateItem = [[ac newestItem] retain];
		[ac autorelease];

		if (![updateItem fileVersion])
		{
			[NSException raise:@"SUAppcastException" format:@"Can't extract a version string from the appcast feed. The filenames should look like YourApp_1.5.tgz, where 1.5 is the version number."];
		}

		[scDelegate statusChecker:self
					 foundVersion:[updateItem fileVersion]
					  mktgVersion:[updateItem versionString]
					 isNewVersion:[self newVersionAvailable]];
	}
	@catch (NSException *e)
	{
		NSLog(@"%@", [e reason]);

		[scDelegate statusChecker:self foundVersion:nil mktgVersion:nil isNewVersion:NO];
	}

	updateInProgress = NO;
}

@end


text:
package com.google.api.ads.adwords.jaxws.v201509.mcm;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.api.ads.adwords.jaxws.v201509.cm.Selector;

/**
 *
 *             Returns the list of customers that meet the selector criteria.
 *
 *             @param selector The selector specifying the {@link ManagedCustomer}s to return.
 *             @return List of customers identified by the selector.
 *             @throws ApiException When there is at least one error with the request.
 *
 *
 *
Java class for get element declaration.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <element name="get">
 *   <complexType>
 *     <complexContent>
 *       <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *         <sequence>
 *           <element name="serviceSelector" type="{https://adwords.google.com/api/adwords/cm/v201509}Selector" minOccurs="0"/>
 *         </sequence>
 *       </restriction>
 *     </complexContent>
 *   </complexType>
 * </element>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "serviceSelector"
})
@XmlRootElement(name = "get")
public class ManagedCustomerServiceInterfaceget {

    protected Selector serviceSelector;

    /**
     * Gets the value of the serviceSelector property.
     *
     * @return
     *     possible object is
     *     {@link Selector }
     *
     */
    public Selector getServiceSelector() {
        return serviceSelector;
    }

    /**
     * Sets the value of the serviceSelector property.
     *
     * @param value
     *     allowed object is
     *     {@link Selector }
     *
     */
    public void setServiceSelector(Selector value) {
        this.serviceSelector = value;
    }

}