text:
package com.android.exchange.adapter;

import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.res.Resources;
import android.os.storage.StorageManager;
import android.os.storage.StorageVolume;

import com.android.emailcommon.provider.Policy;
import com.android.exchange.EasSyncService;
import com.android.exchange.R;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;

/**
 * Parse the result of the Provision command
 */
public class ProvisionParser extends Parser {
    private final EasSyncService mService;
    private Policy mPolicy = null;
    private String mSecuritySyncKey = null;
    private boolean mRemoteWipe = false;
    private boolean mIsSupportable = true;
    private boolean smimeRequired = false;
    private final Resources mResources;

    public ProvisionParser(InputStream in, EasSyncService service) throws IOException {
        super(in);
        mService = service;
        mResources = service.mContext.getResources();
    }

    public Policy getPolicy() {
        return mPolicy;
    }

    public String getSecuritySyncKey() {
        return mSecuritySyncKey;
    }

    public void setSecuritySyncKey(String securitySyncKey) {
        mSecuritySyncKey = securitySyncKey;
    }

    public boolean getRemoteWipe() {
        return mRemoteWipe;
    }

    public boolean hasSupportablePolicySet() {
        mIsSupportable = true;
        return (mPolicy != null) && mIsSupportable;
    }

    public void clearUnsupportablePolicies() {
        mIsSupportable = true;
        mPolicy.mProtocolPoliciesUnsupported = null;
    }

    private void addPolicyString(StringBuilder sb, int res) {
        sb.append(mResources.getString(res));
        sb.append(Policy.POLICY_STRING_DELIMITER);
    }

    /**
     * Complete setup of a Policy; we normalize it first (removing inconsistencies, etc.) and then
     * generate the tokenized "protocol policies enforced" string.  Note that unsupported policies
     * must have been added prior to calling this method (this is only a possibility with wbxml
     * policy documents, as all versions of the OS support the policies in xml documents).
     */
    private void setPolicy(Policy policy) {
        policy.normalize();
        StringBuilder sb = new StringBuilder();
        if (policy.mDontAllowAttachments) {
            addPolicyString(sb, R.string.policy_dont_allow_attachments);
        }
        if (policy.mRequireManualSyncWhenRoaming) {
            addPolicyString(sb, R.string.policy_require_manual_sync_roaming);
        }
        policy.mProtocolPoliciesEnforced = sb.toString();
        mPolicy = policy;
    }

    private boolean deviceSupportsEncryption() {
        DevicePolicyManager dpm = (DevicePolicyManager)
                mService.mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
        int status = dpm.getStorageEncryptionStatus();
        return status != DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED;
    }

    private void parseProvisionDocWbxml() throws IOException {
        Policy policy = new Policy();
        ArrayList<Integer> unsupportedList = new ArrayList<Integer>();
        boolean passwordEnabled = false;

        while (nextTag(Tags.PROVISION_EAS_PROVISION_DOC) != END) {
            boolean tagIsSupported = true;
            int res = 0;
            switch (tag) {
                case Tags.PROVISION_DEVICE_PASSWORD_ENABLED:
                    if (getValueInt() == 1) {
                        passwordEnabled = true;
                        if (policy.mPasswordMode == Policy.PASSWORD_MODE_NONE) {
                            policy.mPasswordMode = Policy.PASSWORD_MODE_SIMPLE;
                        }
                    }
                    break;
                case Tags.PROVISION_MIN_DEVICE_PASSWORD_LENGTH:
                    policy.mPasswordMinLength = getValueInt();
                    break;
                case Tags.PROVISION_ALPHA_DEVICE_PASSWORD_ENABLED:
                    if (getValueInt() == 1) {
                        policy.mPasswordMode = Policy.PASSWORD_MODE_STRONG;
                    }
                    break;
                case Tags.PROVISION_MAX_INACTIVITY_TIME_DEVICE_LOCK:
                    // EAS gives us seconds, which is, happily, what the PolicySet requires
                    policy.mMaxScreenLockTime = getValueInt();
                    break;
                case Tags.PROVISION_MAX_DEVICE_PASSWORD_FAILED_ATTEMPTS:
                    policy.mPasswordMaxFails = getValueInt();
                    break;
                case Tags.PROVISION_DEVICE_PASSWORD_EXPIRATION:
                    policy.mPasswordExpirationDays = getValueInt();
                    break;
                case Tags.PROVISION_DEVICE_PASSWORD_HISTORY:
                    policy.mPasswordHistory = getValueInt();
                    break;
                case Tags.PROVISION_ALLOW_CAMERA:
                    policy.mDontAllowCamera = (getValueInt() == 0);
                    break;
                case Tags.PROVISION_ALLOW_SIMPLE_DEVICE_PASSWORD:
                    // Ignore this unless there's any MSFT documentation for what this means
                    // Hint: I haven't seen any that's more specific than "simple"
                    getValue();
                    break;
                // The following policies, if false, can't be supported at the moment
                case Tags.PROVISION_ALLOW_STORAGE_CARD:
                case Tags.PROVISION_ALLOW_UNSIGNED_APPLICATIONS:
                case Tags.PROVISION_ALLOW_UNSIGNED_INSTALLATION_PACKAGES:
                case Tags.PROVISION_ALLOW_WIFI:
                case Tags.PROVISION_ALLOW_TEXT_MESSAGING:
                case Tags.PROVISION_ALLOW_POP_IMAP_EMAIL:
                case Tags.PROVISION_ALLOW_IRDA:
                case Tags.PROVISION_ALLOW_HTML_EMAIL:
                case Tags.PROVISION_ALLOW_BROWSER:
                case Tags.PROVISION_ALLOW_CONSUMER_EMAIL:
                case Tags.PROVISION_ALLOW_INTERNET_SHARING:
                    if (getValueInt() == 0) {
                        tagIsSupported = false;
                        switch(tag) {
                            case Tags.PROVISION_ALLOW_STORAGE_CARD:
                                res = R.string.policy_dont_allow_storage_cards;
                                break;
                            case Tags.PROVISION_ALLOW_UNSIGNED_APPLICATIONS:
                                res = R.string.policy_dont_allow_unsigned_apps;
                                break;
                            case Tags.PROVISION_ALLOW_UNSIGNED_INSTALLATION_PACKAGES:
                                res = R.string.policy_dont_allow_unsigned_installers;
                                break;
                            case Tags.PROVISION_ALLOW_WIFI:
                                res = R.string.policy_dont_allow_wifi;
                                break;
                            case Tags.PROVISION_ALLOW_TEXT_MESSAGING:
                                res = R.string.policy_dont_allow_text_messaging;
                                break;
                            case Tags.PROVISION_ALLOW_POP_IMAP_EMAIL:
                                res = R.string.policy_dont_allow_pop_imap;
                                break;
                            case Tags.PROVISION_ALLOW_IRDA:
                                res = R.string.policy_dont_allow_irda;
                                break;
                            case Tags.PROVISION_ALLOW_HTML_EMAIL:
                                res = R.string.policy_dont_allow_html;
                                policy.mDontAllowHtml = true;
                                break;
                            case Tags.PROVISION_ALLOW_BROWSER:
                                res = R.string.policy_dont_allow_browser;
                                break;
                            case Tags.PROVISION_ALLOW_CONSUMER_EMAIL:
                                res = R.string.policy_dont_allow_consumer_email;
                                break;
                            case Tags.PROVISION_ALLOW_INTERNET_SHARING:
                                res = R.string.policy_dont_allow_internet_sharing;
                                break;
                        }
                        if (res > 0) {
                            unsupportedList.add(res);
                        }
                    }
                    break;
                case Tags.PROVISION_ATTACHMENTS_ENABLED:
                    policy.mDontAllowAttachments = getValueInt() != 1;
                    break;
                // Bluetooth: 0 = no bluetooth; 1 = only hands-free; 2 = allowed
                case Tags.PROVISION_ALLOW_BLUETOOTH:
                    if (getValueInt() != 2) {
                        tagIsSupported = false;
                        unsupportedList.add(R.string.policy_bluetooth_restricted);
                    }
                    break;
                // We may now support device (internal) encryption; we'll check this capability
                // below with the call to SecurityPolicy.isSupported()
                case Tags.PROVISION_REQUIRE_DEVICE_ENCRYPTION:
                    if (getValueInt() == 1) {
                         if (!deviceSupportsEncryption()) {
                            tagIsSupported = false;
                            unsupportedList.add(R.string.policy_require_encryption);
                        } else {
                            policy.mRequireEncryption = true;
                        }
                    }
                    break;
                // Note that DEVICE_ENCRYPTION_ENABLED refers to SD card encryption, which the OS
                // does not yet support.
                case Tags.PROVISION_DEVICE_ENCRYPTION_ENABLED:
                    if (getValueInt() == 1) {
                        log("Policy requires SD card encryption");
                        // Let's see if this can be supported on our device...
                        if (deviceSupportsEncryption()) {
                            StorageManager sm = (StorageManager)mService.mContext.getSystemService(
                                    Context.STORAGE_SERVICE);
                            // NOTE: Private API!
                            // Go through volumes; if ANY are removable, we can't support this
                            // policy.
                            StorageVolume[] volumeList = sm.getVolumeList();
                            for (StorageVolume volume: volumeList) {
                                if (volume.isRemovable()) {
                                    tagIsSupported = false;
                                    log("Removable: " + volume.getDescription(mService.mContext));
                                    break;  // Break only from the storage volume loop
                                } else {
                                    log("Not Removable: " + volume.getDescription(mService.mContext));
                                }
                            }
                            if (tagIsSupported) {
                                // If this policy is requested, we MUST also require encryption
                                log("Device supports SD card encryption");
                                policy.mRequireEncryption = true;
                                break;
                            }
                        } else {
                            log("Device doesn't support encryption; failing");
                            tagIsSupported = false;
                        }
                        // If we fall through, we can't support the policy
                        unsupportedList.add(R.string.policy_require_sd_encryption);
                    }
                    break;
                    // Note this policy; we enforce it in ExchangeService
                case Tags.PROVISION_REQUIRE_MANUAL_SYNC_WHEN_ROAMING:
                    policy.mRequireManualSyncWhenRoaming = getValueInt() == 1;
                    break;
                // We are allowed to accept policies, regardless of value of this tag
                // TODO: When we DO support a recovery password, we need to store the value in
                // the account (so we know to utilize it)
                case Tags.PROVISION_PASSWORD_RECOVERY_ENABLED:
                    // Read, but ignore, value
                    policy.mPasswordRecoveryEnabled = getValueInt() == 1;
                    break;
                // The following policies, if true, can't be supported at the moment
                case Tags.PROVISION_REQUIRE_SIGNED_SMIME_MESSAGES:
                case Tags.PROVISION_REQUIRE_ENCRYPTED_SMIME_MESSAGES:
                case Tags.PROVISION_REQUIRE_SIGNED_SMIME_ALGORITHM:
                case Tags.PROVISION_REQUIRE_ENCRYPTION_SMIME_ALGORITHM:
                    if (getValueInt() == 1) {
                        tagIsSupported = false;
                        if (!smimeRequired) {
                            unsupportedList.add(R.string.policy_require_smime);
                            smimeRequired = true;
                        }
                    }
                    break;
                case Tags.PROVISION_MAX_ATTACHMENT_SIZE:
                    int max = getValueInt();
                    if (max > 0) {
                        policy.mMaxAttachmentSize = max;
                    }
                    break;
                // Complex characters are supported
                case Tags.PROVISION_MIN_DEVICE_PASSWORD_COMPLEX_CHARS:
                    policy.mPasswordComplexChars = getValueInt();
                    break;
                // The following policies are moot; they allow functionality that we don't support
                case Tags.PROVISION_ALLOW_DESKTOP_SYNC:
                case Tags.PROVISION_ALLOW_SMIME_ENCRYPTION_NEGOTIATION:
                case Tags.PROVISION_ALLOW_SMIME_SOFT_CERTS:
                case Tags.PROVISION_ALLOW_REMOTE_DESKTOP:
                    skipTag();
                    break;
                // We don't handle approved/unapproved application lists
                case Tags.PROVISION_UNAPPROVED_IN_ROM_APPLICATION_LIST:
                case Tags.PROVISION_APPROVED_APPLICATION_LIST:
                    // Parse and throw away the content
                    if (specifiesApplications(tag)) {
                        tagIsSupported = false;
                        if (tag == Tags.PROVISION_UNAPPROVED_IN_ROM_APPLICATION_LIST) {
                            unsupportedList.add(R.string.policy_app_blacklist);
                        } else {
                            unsupportedList.add(R.string.policy_app_whitelist);
                        }
                    }
                    break;
                // We accept calendar age, since we never ask for more than two weeks, and that's
                // the most restrictive policy
                case Tags.PROVISION_MAX_CALENDAR_AGE_FILTER:
                    policy.mMaxCalendarLookback = getValueInt();
                    break;
                // We handle max email lookback
                case Tags.PROVISION_MAX_EMAIL_AGE_FILTER:
                    policy.mMaxEmailLookback = getValueInt();
                    break;
                // We currently reject these next two policies
                case Tags.PROVISION_MAX_EMAIL_BODY_TRUNCATION_SIZE:
                case Tags.PROVISION_MAX_EMAIL_HTML_BODY_TRUNCATION_SIZE:
                    String value = getValue();
                    // -1 indicates no required truncation
                    if (!value.equals("-1")) {
                        max = Integer.parseInt(value);
                        if (tag == Tags.PROVISION_MAX_EMAIL_BODY_TRUNCATION_SIZE) {
                            policy.mMaxTextTruncationSize = max;
                            unsupportedList.add(R.string.policy_text_truncation);
                        } else {
                            policy.mMaxHtmlTruncationSize = max;
                            unsupportedList.add(R.string.policy_html_truncation);
                        }
                        tagIsSupported = false;
                    }
                    break;
                default:
                    skipTag();
            }

            if (!tagIsSupported) {
                log("Policy not supported: " + tag);
                mIsSupportable = false;
            }
        }

        // Make sure policy settings are valid; password not enabled trumps other password settings
        if (!passwordEnabled) {
            policy.mPasswordMode = Policy.PASSWORD_MODE_NONE;
        }

        if (!unsupportedList.isEmpty()) {
            StringBuilder sb = new StringBuilder();
            for (int res: unsupportedList) {
                addPolicyString(sb, res);
            }
            policy.mProtocolPoliciesUnsupported = sb.toString();
        }

        setPolicy(policy);
    }

    /**
     * Return whether or not either of the application list tags specifies any applications
     * @param endTag the tag whose children we're walking through
     * @return whether any applications were specified (by name or by hash)
     * @throws IOException
     */
    private boolean specifiesApplications(int endTag) throws IOException {
        boolean specifiesApplications = false;
        while (nextTag(endTag) != END) {
            switch (tag) {
                case Tags.PROVISION_APPLICATION_NAME:
                case Tags.PROVISION_HASH:
                    specifiesApplications = true;
                    break;
                default:
                    skipTag();
            }
        }
        return specifiesApplications;
    }

    /*package*/ void parseProvisionDocXml(String doc) throws IOException {
        Policy policy = new Policy();

        try {
            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
            XmlPullParser parser = factory.newPullParser();
            parser.setInput(new ByteArrayInputStream(doc.getBytes()), "UTF-8");
            int type = parser.getEventType();
            if (type == XmlPullParser.START_DOCUMENT) {
                type = parser.next();
                if (type == XmlPullParser.START_TAG) {
                    String tagName = parser.getName();
                    if (tagName.equals("wap-provisioningdoc")) {
                        parseWapProvisioningDoc(parser, policy);
                    }
                }
            }
        } catch (XmlPullParserException e) {
           throw new IOException();
        }

        setPolicy(policy);
    }

    /**
     * Return true if password is required; otherwise false.
     */
    private boolean parseSecurityPolicy(XmlPullParser parser, Policy policy)
            throws XmlPullParserException, IOException {
        boolean passwordRequired = true;
        while (true) {
            int type = parser.nextTag();
            if (type == XmlPullParser.END_TAG && parser.getName().equals("characteristic")) {
                break;
            } else if (type == XmlPullParser.START_TAG) {
                String tagName = parser.getName();
                if (tagName.equals("parm")) {
                    String name = parser.getAttributeValue(null, "name");
                    if (name.equals("4131")) {
                        String value = parser.getAttributeValue(null, "value");
                        if (value.equals("1")) {
                            passwordRequired = false;
                        }
                    }
                }
            }
        }
        return passwordRequired;
    }

    private void parseCharacteristic(XmlPullParser parser, Policy policy)
            throws XmlPullParserException, IOException {
        boolean enforceInactivityTimer = true;
        while (true) {
            int type = parser.nextTag();
            if (type == XmlPullParser.END_TAG && parser.getName().equals("characteristic")) {
                break;
            } else if (type == XmlPullParser.START_TAG) {
                if (parser.getName().equals("parm")) {
                    String name = parser.getAttributeValue(null, "name");
                    String value = parser.getAttributeValue(null, "value");
                    if (name.equals("AEFrequencyValue")) {
                        if (enforceInactivityTimer) {
                            if (value.equals("0")) {
                                policy.mMaxScreenLockTime = 1;
                            } else {
                                policy.mMaxScreenLockTime = 60*Integer.parseInt(value);
                            }
                        }
                    } else if (name.equals("AEFrequencyType")) {
                        // "0" here means we don't enforce an inactivity timeout
                        if (value.equals("0")) {
                            enforceInactivityTimer = false;
                        }
                    } else if (name.equals("DeviceWipeThreshold")) {
                        policy.mPasswordMaxFails = Integer.parseInt(value);
                    } else if (name.equals("CodewordFrequency")) {
                        // Ignore; has no meaning for us
                    } else if (name.equals("MinimumPasswordLength")) {
                        policy.mPasswordMinLength = Integer.parseInt(value);
                    } else if (name.equals("PasswordComplexity")) {
                        if (value.equals("0")) {
                            policy.mPasswordMode = Policy.PASSWORD_MODE_STRONG;
                        } else {
                            policy.mPasswordMode = Policy.PASSWORD_MODE_SIMPLE;
                        }
                    }
                }
            }
        }
    }

    private void parseRegistry(XmlPullParser parser, Policy policy)
            throws XmlPullParserException, IOException {
      while (true) {
          int type = parser.nextTag();
          if (type == XmlPullParser.END_TAG && parser.getName().equals("characteristic")) {
              break;
          } else if (type == XmlPullParser.START_TAG) {
              String name = parser.getName();
              if (name.equals("characteristic")) {
                  parseCharacteristic(parser, policy);
              }
          }
      }
    }

    private void parseWapProvisioningDoc(XmlPullParser parser, Policy policy)
            throws XmlPullParserException, IOException {
        while (true) {
            int type = parser.nextTag();
            if (type == XmlPullParser.END_TAG && parser.getName().equals("wap-provisioningdoc")) {
                break;
            } else if (type == XmlPullParser.START_TAG) {
                String name = parser.getName();
                if (name.equals("characteristic")) {
                    String atype = parser.getAttributeValue(null, "type");
                    if (atype.equals("SecurityPolicy")) {
                        // If a password isn't required, stop here
                        if (!parseSecurityPolicy(parser, policy)) {
                            return;
                        }
                    } else if (atype.equals("Registry")) {
                        parseRegistry(parser, policy);
                        return;
                    }
                }
            }
        }
    }

    private void parseProvisionData() throws IOException {
        while (nextTag(Tags.PROVISION_DATA) != END) {
            if (tag == Tags.PROVISION_EAS_PROVISION_DOC) {
                parseProvisionDocWbxml();
            } else {
                skipTag();
            }
        }
    }

    private void parsePolicy() throws IOException {
        String policyType = null;
        while (nextTag(Tags.PROVISION_POLICY) != END) {
            switch (tag) {
                case Tags.PROVISION_POLICY_TYPE:
                    policyType = getValue();
                    mService.userLog("Policy type: ", policyType);
                    break;
                case Tags.PROVISION_POLICY_KEY:
                    mSecuritySyncKey = getValue();
                    break;
                case Tags.PROVISION_STATUS:
                    mService.userLog("Policy status: ", getValue());
                    break;
                case Tags.PROVISION_DATA:
                    if (policyType.equalsIgnoreCase(EasSyncService.EAS_2_POLICY_TYPE)) {
                        // Parse the old style XML document
                        parseProvisionDocXml(getValue());
                    } else {
                        // Parse the newer WBXML data
                        parseProvisionData();
                    }
                    break;
                default:
                    skipTag();
            }
        }
    }

    private void parsePolicies() throws IOException {
        while (nextTag(Tags.PROVISION_POLICIES) != END) {
            if (tag == Tags.PROVISION_POLICY) {
                parsePolicy();
            } else {
                skipTag();
            }
        }
    }

    private void parseDeviceInformation() throws IOException {
        while (nextTag(Tags.SETTINGS_DEVICE_INFORMATION) != END) {
            if (tag == Tags.SETTINGS_STATUS) {
                mService.userLog("DeviceInformation status: " + getValue());
            } else {
                skipTag();
            }
        }
    }

    @Override
    public boolean parse() throws IOException {
        boolean res = false;
        if (nextTag(START_DOCUMENT) != Tags.PROVISION_PROVISION) {
            throw new IOException();
        }
        while (nextTag(START_DOCUMENT) != END_DOCUMENT) {
            switch (tag) {
                case Tags.PROVISION_STATUS:
                    int status = getValueInt();
                    mService.userLog("Provision status: ", status);
                    res = (status == 1);
                    break;
                case Tags.SETTINGS_DEVICE_INFORMATION:
                    parseDeviceInformation();
                    break;
                case Tags.PROVISION_POLICIES:
                    parsePolicies();
                    break;
                case Tags.PROVISION_REMOTE_WIPE:
                    // Indicate remote wipe command received
                    mRemoteWipe = true;
                    break;
                default:
                    skipTag();
            }
        }
        return res;
    }
}


text:
var models = require('../models');

/*
 * GET home page.
 */

exports.view = function(req, res){

	models.Project
		.find()
		.sort('date')
		.exec(renderProjects);

	function renderProjects(err, projects) {
		res.render('resources', { 'projects': projects });
	}

};

redpajama_set_name: RedPajamaGithub


text:
package com.sun.jersey.samples.storageservice;

import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class Containers {
    private List<Container> container;

    public Containers() {
    }

    public Containers(List<Container> container) {
        setContainer(container);
    }

    public List<Container> getContainer() {
        return container;
    }

    public void setContainer(List<Container> container) {
        this.container = container;
    }
}


text:
@interface UUAVAudioPlayer ()<AVAudioPlayerDelegate>
{
    AVAudioPlayer *player;
}
@end

@implementation UUAVAudioPlayer

+ (UUAVAudioPlayer *)sharedInstance
{
    static UUAVAudioPlayer *sharedInstance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedInstance = [[self alloc] init];
    });
    return sharedInstance;
}

-(void)playSongWithUrl:(NSString *)songUrl
{
    dispatch_async(dispatch_queue_create("dfsfe", NULL), ^{

        [self.delegate UUAVAudioPlayerBeiginLoadVoice];

        NSString *path = [[[songUrl componentsSeparatedByString:@"/"] lastObject] getCachePath];
        NSData *data = [NSData dataWithContentsOfFile:path];
        if (!data) {
            data = [NSData dataWithContentsOfURL:[NSURL URLWithString:songUrl]];
            [data writeToFile:path atomically:YES];
        }

        dispatch_async(dispatch_get_main_queue(), ^{
            if (player) {
                [self.delegate UUAVAudioPlayerDidFinishPlay];
                [player stop];
                player.delegate = nil;
                player = nil;
                [[NSNotificationCenter defaultCenter]postNotificationName:@"VoicePlayHasInterrupt" object:nil];
            }
            NSError *playerError;
            player = [[AVAudioPlayer alloc]initWithData:data error:&playerError];
            player.volume = 1.0f;
            if (playerError){
                NSLog(@"ERror creating player: %@", [playerError description]);
            }
            [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategorySoloAmbient error: nil];
            player.delegate = self;
            [player play];
            [self.delegate UUAVAudioPlayerBeiginPlay];
        });
    });
}

-(void)playSongWithData:(NSData *)songData
{
    [self.delegate UUAVAudioPlayerDidFinishPlay];

    if (player) {
        [player stop];
        player.delegate = nil;
        player = nil;
        [[NSNotificationCenter defaultCenter]postNotificationName:@"VoicePlayHasInterrupt" object:nil];
    }
    NSError *playerError;
    player = [[AVAudioPlayer alloc]initWithData:songData error:&playerError];
    player.volume = 1.0f;
    [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategorySoloAmbient error: nil];
    player.delegate = self;
    [player play];
    [self.delegate UUAVAudioPlayerBeiginPlay];

    if (!player) {
        [self.delegate UUAVAudioPlayerDidFinishPlay];
    }
}

- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
{
    [self.delegate UUAVAudioPlayerDidFinishPlay];
}

- (void)stopSound
{
    if (player && player.isPlaying) {
        [player stop];
    }
    [self.delegate UUAVAudioPlayerDidFinishPlay];
}

@end


text:
/**
 *
 */
package exercises.threads.threadexception;
import java.util.concurrent.*;
/**
 * @author gongzhihui
 *
 */
public class NativeExceptionHandling {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try {
			ExecutorService exec = Executors.newCachedThreadPool();
			exec.execute(new ExceptionThread());
		} catch (RuntimeException e) {
			System.out.println(e.getMessage());
		}
	}

}


text:
#pragma once

namespace AnimatSim
{
	namespace Environment
	{
		namespace Bodies
		{

			class ANIMAT_PORT Mesh : public RigidBody
			{
			protected:
				/// The graphical mesh file to load.
				std::string m_strMeshFile;

				/// Type of the collision mesh. Can be Convex or Triangular
				std::string m_strCollisionMeshType;

				/// The collsion mesh file. If the type is convex then we load in this file instead of the graphical one.
				std::string m_strConvexMeshFile;

				///The scale factor to use for this mesh
				CStdFPoint m_vScale;

				///The scale factor that is used for reporting to the GUI
				CStdFPoint m_vReportScale;

			public:
				//This is a test comment.
				Mesh();
				virtual ~Mesh();

				static Mesh *CastToDerived(AnimatBase *lpBase) {return static_cast<Mesh*>(lpBase);}

				virtual std::string MeshFile();
				virtual void MeshFile(std::string strFile);

				virtual std::string CollisionMeshType();
				virtual void CollisionMeshType(std::string strType);

				virtual std::string ConvexMeshFile();
				virtual void ConvexMeshFile(std::string strFile);

				virtual void SetMeshFile(std::string strXml);

				virtual void SetBoundingBox(int iIdx, float fltVal);

				virtual void Scale(CStdFPoint &vScale, bool bUpdateMatrix = true);
				virtual void Scale(std::string strXml, bool bUpdateMatrix = true);
				virtual void Scale(float fltX, float fltY, float fltZ, bool bUpdateMatrix = true);
				virtual CStdFPoint Scale();

				virtual float *GetDataPointer(const std::string &strDataType);
				virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError = true);
				virtual void QueryProperties(CStdPtrArray<TypeProperty> &aryProperties);
				virtual void Load(CStdXml &oXml);
			};

		}		//Bodies
	}			// Environment
}				//AnimatSim


text:
<?php

/* SriniBlogBundle:Post:edit.html.twig */
class __TwigTemplate_78988e38c100bb5767320a5d219f3138 extends Twig_Template
{
    protected function doGetParent(array $context)
    {
        return false;
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        // line 1
        echo "
Post edit

<form action=\"";
        // line 3
        echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("post_update", array("id" => $this->getAttribute($this->getContext($context, "entity"), "id"))), "html", null, true);
        echo "\" method=\"post\" ";
        echo $this->env->getExtension('form')->renderEnctype($this->getContext($context, "edit_form"));
        echo ">
    ";
        // line 4
        echo $this->env->getExtension('form')->renderWidget($this->getContext($context, "edit_form"));
        echo "

        <button type=\"submit\">Edit</button>

</form>

        env, $this->env->getExtension('routing')->getPath("post"), "html", null, true);
        echo "\">
            Back to the list

        <form action=\"";
        // line 17
        echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("post_delete", array("id" => $this->getAttribute($this->getContext($context, "entity"), "id"))), "html", null, true);
        echo "\" method=\"post\">
            ";
        // line 18
        echo $this->env->getExtension('form')->renderWidget($this->getContext($context, "delete_form"));
        echo "
            <button type=\"submit\">Delete</button>
        </form>

";
    }

    public function getTemplateName()
    {
        return "SriniBlogBundle:Post:edit.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }
}


text:
#!/bin/bash

# Install Nvidia Driver
command -v nvidia-smi >/dev/null 2>&1 || { echo "Installing Nvidia Library" >&2; sudo apt-get install nvidia-352-updates;}

# Install python3 dependencies
sudo apt-get update && sudo apt-get install python3-numpy swig python3-dev python3-wheel python3-pip

# Download cuda_tookit and cudann files
# Use SCP
sudo dpkg -i cuda-repo-ubuntu1404*amd64.deb
sudo apt-get update
sudo apt-get install cuda

# Environmental variables for cuda toolkit
echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc

# Copy CudaNN
tar xvf cudnn*.tgz
cd cuda
sudo cp */*.h /usr/local/cuda/include/
sudo cp */libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

# Check Cuda Version:
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

# Append Environment variables
echo 'export CUDA_HOME=/usr/local/cuda' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_HOME/lib64' >> ~/.bashrc
echo 'export CUDA_VISIBLE_DEVICES=0' >> ~/.bashrc
echo 'export LC_ALL=en_US.UTF-8' >> ~/.bashrc
echo 'export LANG=en_US.UTF-8' >> ~/.bashrc

# Check Python version:
# Python 3.4.3+

# Python 3.4 export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0rc0-cp34-cp34m-linux_x86_64.whl
# Python 3.5 export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0rc0-cp35-cp35m-linux_x86_64.whl
sudo pip3 install --upgrade $TF_BINARY_URL

sudo pip3 install numpy pandas matplotlib jsonpickle


text:
<?php

# note, do not translate [CONTENT]

$lan = array(
"No such template" => "Sjabloon bestaat niet",
"Images stored" => "Afbeeldingen opgeslagen",
"No images found" => "Geen afbeeldingen gevonden",
"Image" => "Afbeelding",
"not full URL" => "niet volledige URL",
"does not exist" => "bestaat niet",
"Not a full URL:" => "Niet een volledige URL:",
"No Title" => "Geen Titel",
"Template does not contain the [CONTENT] placeholder" => "Sjabloon bevat niet de [CONTENT] placeholder",
"Template saved" => "Sjabloon opgeslagen",
"Images" => "Afbeeldingen",
"Below is the list of images used in your template. If an image is currently unavailable, please upload it to the database." => "Hieronder de lijst met afbeeldingen die in uw sjabloon zijn gebruikt. Als een afbeelding momenteel niet beschkbaar is, upload deze dan aub naar de database.",
"This includes all images, also fully referenced ones, so you may choose not to upload some. If you upload images, they will be included in the emails that use this template." => "Dit houdt alle afbeeldingen in, ook volledig gereffereerde, dus je kunt kiezen om er geen up te loaden. Als je afbeeldingen upload, dan zullen ze worden ingesloten in de emails die dit sjabloon gebruiken.",
"Image name:" => "Naam afbeelding:",
"times used" => "aantal malen gebrukt",
"Template does not contain local images" => "Sjabloon bevat geen locale afbeeldingen",
"Some errors were found, template NOT saved!" => "Er werden enkele fouten gevonden, sjabloon NIET opgeslagen!",
"List of Templates" => "Lijst met Sjablonen",
'Title of this template' => 'Titel van dit sjabloon',
'Content of the template.' => 'Inhoud van dit sjabloon.',
'The content should at least have [CONTENT] somewhere.' => 'De inhoud moet tenminste ergens [CONTENT] bevatten.',
'Check that all links have a full URL' => 'Controleer of alle links een volledige URL hebben',
'Check that all images have a full URL' => 'Controleer of alle afbeeldingen een volledige URL hebben',
'Check that all external images exist' => 'Controleer of alle externe afbeeldingen bestaan',
'Save Changes' => 'Wijzigingen opslaan',
'Save Images' => 'Afbeeldingen Opslaan',

# added 2.10.0
'You can upload a template file or paste the text in the box below' => 'U kan een sjabloon bestand uploaden of plakken in het tekstveld onderaan',
'Template file.' => 'Sjabloon bestand.',

);
?>


text:
My user plugin(s) for [Sublime Text 2](http://sublimetext.com "Sublime Text 2")

Installation
------------

* Copy the .py files into your "Packages" directory.
* Update your keymap. See the sample keymap in the repo.

The "Packages" packages directory is located at:

* Windows:
    %APPDATA%/Sublime Text 2/Packages/
* OS X:
    ~/Library/Application Support/Sublime Text 2/Packages/
* Linux:
    ~/.Sublime Text 2/Packages/

License
-------
MIT


text:
johnw335.github.io
==================
[Personal Landing Page](https://johnw335.github.io)


text:
This gem is a ruby wrapper around the SFax API. With this gem, you can easily send and receive electronic faxes.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'sfax'
```

And then execute:

    $ bundle install

Or install it yourself as:

    $ gem install sfax

## Usage

First and foremost, you need to sign up for an SFax account [here](https://www.scrypt.com/sfax/sign-up/integration/) and generate your credentials [here](http://sfax.scrypt.com/article/383-generating-your-api-credentials).

After that, you can initialize the `Faxer` class as:

```ruby
# All four fields are necessary.
# Username and api_key are used for fax processing.
# Vector and encryptiong_key are used for securing posted url.
SFax::Faxer.new(username, api_key, vector, encryption_key)
```

After this there are four main methods: `send_fax`, `fax_status`, `receive_fax` and `download_fax`.

`send_fax` accepts a `file` and a `fax_number` in the following format: `+1xxxxxxxxxx`. File can be a `Tempfile` or a url. If fax is successfully initiated, `send_fax` returns `fax_id` (a 32-digit alphanumeric id) which can be used to track the fax status.

`fax_status` accepts a `fax_id` which is returned from `send_fax` and returns the status of the fax with `fax_id`.

`receive_fax` accepts `count`, which is the number of faxes to be received. SFax returns 500 (maximum) faxes at a time, so count is capped at 500. `receive_fax` returns two values: If there are any received faxes, it returns an array of fax ids to be downloaded. If there are more faxes to be received, `receive_fax` also returns `true`. Otherwise it returns `false` along with the array of ids.

`download_fax` accepts a `fax_id` and returns the contents of the fax to be written to a file.

## Best Practices

At PatientBank, we use this gem to make calls to the SFax API via jobs. While sending faxes are triggered via the user, we use `cron` jobs to regularly check if there are any received faxes.

For development environment, it is important to not send or receive faxes from your main fax number. One workaround is to create a new fax number (and its respective API credentials) for use in development machines.

## Resources

[The Basics](http://sfax.scrypt.com/article/617-the-basics-how-it-works)

[Generating API Credentials](http://sfax.scrypt.com/article/383-generating-your-api-credentials)

[SFax Sign up](https://www.scrypt.com/sfax/sign-up/integration/)

## Credits

This gem is inspired by the [sample code](http://sfax.scrypt.com/article/328-code-samples-ruby) SFax provides to its developers.

## Contributing

1. Fork it (https://github.com/[my-github-username]/sfax/fork)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request


text:
import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BOARD)
BTN_PIN = 11
BOUNCE_TIME = 200
GPIO.setup(BTN_PIN, GPIO.IN)

def callback_function(channel):
    print("Button.Click"), time.strftime("%Y-%m-%d %H:%M:%S")

try:
    GPIO.add_event_detect(BTN_PIN, GPIO.FALLING, callback=callback_function, bouncetime=BOUNCE_TIME)

    while True:
        time.sleep(10)

except KeyboardInterrupt:
    print "Exception: KeyboardInterrupt"

finally:
    GPIO.cleanup()


text:
#include "gtest/gtest.h"
#include "json_keys.h"
#include "utils/resource_usage.h"
#include "application_manager/smart_object_keys.h"
#include "application_manager_metric.h"

namespace test {
namespace components {
namespace time_tester_test {

using namespace ::time_tester;

TEST(ApplicationManagerMetricWrapper, grabResources) {
  ApplicationManagerMetricWrapper metric_test;
  EXPECT_TRUE(metric_test.grabResources());
}

TEST(ApplicationManagerMetricWrapper, GetJsonMetric) {
  ApplicationManagerMetricWrapper metric_test;

  TimevalStruct start_time;
  start_time.tv_sec = 1;
  start_time.tv_usec = 0;

  TimevalStruct end_time;
  end_time.tv_sec = 10;
  end_time.tv_usec = 0;
  metric_test.message_metric = new application_manager::AMMetricObserver::MessageMetric();
  metric_test.message_metric->begin = start_time;
  metric_test.message_metric->end = end_time;
  NsSmartDeviceLink::NsSmartObjects::SmartObject obj;
  obj["params"][application_manager::strings::correlation_id] = 11;
  obj["params"][application_manager::strings::connection_key] = 12;
  metric_test.message_metric->message = new NsSmartDeviceLink::NsSmartObjects::SmartObject(obj);
  Json::Value jvalue = metric_test.GetJsonMetric();

  EXPECT_EQ("null\n", jvalue[time_tester::strings::stime].toStyledString());
  EXPECT_EQ("null\n", jvalue[time_tester::strings::utime].toStyledString());
  EXPECT_EQ("null\n", jvalue[time_tester::strings::memory].toStyledString());

  EXPECT_EQ(date_time::DateTime::getuSecs(start_time), jvalue[time_tester::strings::begin].asInt64());
  EXPECT_EQ(date_time::DateTime::getuSecs(end_time), jvalue[time_tester::strings::end].asInt64());
  EXPECT_EQ(obj["params"][application_manager::strings::correlation_id].asInt(), jvalue[time_tester::strings::correlation_id].asInt64());
  EXPECT_EQ(obj["params"][application_manager::strings::connection_key].asInt(), jvalue[time_tester::strings::connection_key].asInt());
}

TEST(ApplicationManagerMetricWrapper, GetJsonMetricWithGrabResources) {
  ApplicationManagerMetricWrapper metric_test;
  utils::ResourseUsage* resources = utils::Resources::getCurrentResourseUsage();
  EXPECT_TRUE(metric_test.grabResources());

  TimevalStruct start_time;
  start_time.tv_sec = 1;
  start_time.tv_usec = 0;

  TimevalStruct end_time;
  end_time.tv_sec = 10;
  end_time.tv_usec = 0;

  metric_test.message_metric = new application_manager::AMMetricObserver::MessageMetric();
  metric_test.message_metric->begin = start_time;
  metric_test.message_metric->end = end_time;
  NsSmartDeviceLink::NsSmartObjects::SmartObject obj;
  obj["params"][application_manager::strings::correlation_id] = 11;
  obj["params"][application_manager::strings::connection_key] = 12;
  metric_test.message_metric->message = new NsSmartDeviceLink::NsSmartObjects::SmartObject(obj);
  Json::Value jvalue = metric_test.GetJsonMetric();

  EXPECT_EQ(date_time::DateTime::getuSecs(start_time), jvalue[time_tester::strings::begin].asInt64());
  EXPECT_EQ(date_time::DateTime::getuSecs(end_time), jvalue[time_tester::strings::end].asInt64());
  EXPECT_EQ(obj["params"][application_manager::strings::correlation_id].asInt(), jvalue[time_tester::strings::correlation_id].asInt64());
  EXPECT_EQ(obj["params"][application_manager::strings::connection_key].asInt(), jvalue[time_tester::strings::connection_key].asInt());

  EXPECT_EQ(date_time::DateTime::getuSecs(start_time), jvalue[time_tester::strings::begin].asInt64());
  EXPECT_EQ(date_time::DateTime::getuSecs(end_time), jvalue[time_tester::strings::end].asInt64());

  EXPECT_NEAR(resources->stime, jvalue[time_tester::strings::stime].asInt(),1);
  EXPECT_NEAR(resources->utime, jvalue[time_tester::strings::utime].asInt(),1);
  EXPECT_EQ(resources->memory, jvalue[time_tester::strings::memory].asInt());

  delete resources;
}

}  // namespace time_tester
}  // namespace components
}  // namespace test


text:
package com.ocdsoft.bacta.swg.shared.localization;

/**
 * Created by crush on 11/21/2015.
 */
public class LocalizedStringTableReaderWriter {
}


text:
layout: page
title: Orb Emerald Networks Award Ceremony
date: 2016-05-24
author: Janet Horn
tags: weekly links, java
status: published
summary: Curabitur vulputate quis ante vitae elementum. Phasellus tincidunt.
banner: images/banner/wedding.jpg
booking:
  startDate: 12/04/2018
  endDate: 12/07/2018
  ctyhocn: FPAALHX
  groupCode: OENAC
published: true
---
Maecenas varius arcu sit amet orci ultrices mattis. Praesent tristique arcu vitae metus eleifend aliquet. Nullam viverra consectetur imperdiet. Donec ullamcorper felis quis erat rhoncus, sed pharetra enim gravida. Praesent at purus id lacus tempus congue sed sed est. Aenean eu molestie nibh. Mauris vel rhoncus dui. Aliquam sit amet nunc malesuada, ullamcorper odio vel, efficitur neque. In non lobortis purus. Cras faucibus sollicitudin ullamcorper. Aenean ac molestie massa.

* Duis ac erat ullamcorper ex eleifend rutrum
* Aliquam consectetur neque ac mauris tempor luctus
* Vestibulum tincidunt magna quis sodales laoreet.

Vestibulum ac placerat massa, sit amet scelerisque erat. Nam eu malesuada ante. Proin eget facilisis ex. Quisque nec diam viverra, bibendum arcu ut, pellentesque augue. Nunc at nibh maximus, dictum nunc sit amet, iaculis lorem. Curabitur eros nisl, condimentum sed blandit sit amet, pharetra ut odio. Etiam ullamcorper felis cursus vehicula vehicula. Sed facilisis neque ipsum, at vehicula enim tincidunt id. In dignissim vitae tellus eget gravida. Etiam non tempus risus. Phasellus et bibendum erat, vitae convallis elit. Aenean congue viverra elit, quis auctor massa rutrum a.


text:
var get = require('./get');

var UNDEF;

/**
 * Check if object has nested property.
 */
function has(obj, prop) {
    return get(obj, prop) !== UNDEF;
}

module.exports = has;


text:
[![NPM version](http://img.shields.io/npm/v/css-list-helpers.svg?style=flat)](https://www.npmjs.org/package/css-list-helpers)
[![npm license](http://img.shields.io/npm/l/css-list-helpers.svg?style=flat-square)](https://www.npmjs.org/package/css-list-helpers)
[![Travis Build Status](https://img.shields.io/travis/jedmao/css-list-helpers.svg?label=unix)](https://travis-ci.org/jedmao/css-list-helpers)
[![codecov](https://codecov.io/gh/jedmao/css-list-helpers/branch/master/graph/badge.svg)](https://codecov.io/gh/jedmao/css-list-helpers)

[![npm](https://nodei.co/npm/css-list-helpers.svg?downloads=true)](https://nodei.co/npm/css-list-helpers/)

Helper methods for splitting CSS lists (i.e., by spaces or commas), extracted from [PostCSS#list](https://github.com/postcss/postcss/blob/master/lib/list.es6).

## Installation

```
$ npm install css-list-helpers [--save[-dev]]
```

## Usage

```js
var listHelpers = require('css-list-helpers');

listHelpers.splitBySpaces(' 0 a(b / c) "d e" ');
// ['0', 'a(b / c)', '"d e"']

listHelpers.splitByCommas(' 0, a(b / c), "d e" ');
// ['0', 'a(b / c)', '"d e"']

listHelpers.split('a/fn(b / c)', ['/']);
// ['a', 'fn(b / c)']
```

### ES6/2015 import

```ts
import * as listHelpers from 'css-list-helpers';
```

## Docs

This project provides first-class TypeScript support via generated TypeScript
definitions, included with the package. As such, you shouldn't have to
look-up documentation in your editor, so long as your editor supports
TypeScript.

## Testing

```
$ npm test
```

This will run tests and generate a code coverage report. Anything less than 100% coverage will throw an error.


text:
require 'spec_helper'

describe port(443) do
  it { should be_listening }
end

describe command('wget -O- --no-check-certificate -q https://localhost/') do
    its(:stdout) { should match /true/ }
end

describe command('wget -O- --no-check-certificate -q https://localhost/v1/_ping') do
    its(:stdout) { should match '{}' }
end


text:
module HamlLint::Tree
  # Represents a HAML comment node.
  class HamlCommentNode < Node
    # Returns the full text content of this comment, including newlines if a
    # single comment spans multiple lines.
    #
    # @return [String]
    def text
      content = source_code
      indent = content[/^ */]

      content.gsub(/^#{indent}/, '')
             .gsub(/^-#/, '')
             .gsub(/^  /, '')
             .rstrip
    end
  end
end


text:
<?php

namespace Mapped\Tests\Extension;

use Mapped\Factory;
use Mapped\ValidationException;

class FactoryTest extends \PHPUnit_Framework_TestCase
{
    public function testString()
    {
        $factory = new Factory;
        $mapping = $factory->string();
        $this->assertSame('foo', $mapping->apply('foo'));
    }

    public function testStringFail()
    {
        $factory = new Factory;
        $mapping = $factory->string();

        $this->setExpectedException('Mapped\ValidationException');

        try {
            $mapping->apply(true);
        } catch (ValidationException $e) {
            $errors = $e->getErrors();
            $this->assertSame('error.string', $errors[0]->getMessage());
            throw $e;
        }
    }

    public function testNonEmptyText()
    {
        $factory = new Factory;
        $mapping = $factory->string()->notEmpty();
        $this->assertSame('foo', $mapping->apply('foo'));
    }

    public function testNonEmptyTextFail()
    {
        $factory = new Factory;
        $mapping = $factory->string()->notEmpty();

        $this->setExpectedException('Mapped\ValidationException');

        try {
            $mapping->apply('');
        } catch (ValidationException $e) {
            $errors = $e->getErrors();
            $this->assertSame('error.not_empty', $errors[0]->getMessage());
            throw $e;
        }
    }

    public function testInt()
    {
        $factory = new Factory;

        $mapping = $factory->mapping([
            'int' => $factory->int(),
            'float' => $factory->int(),
        ]);

        $result = $mapping->apply([
            'int' => '12',
            'float' => '42.23',
        ]);

        $this->assertSame(12, $result['int']);
        $this->assertSame(42, $result['float']);
    }

    public function testIntFail()
    {
        $factory = new Factory;
        $mapping = $factory->int();

        $this->setExpectedException('Mapped\ValidationException');

        try {
            $mapping->apply('12a');
        } catch (ValidationException $e) {
            $errors = $e->getErrors();
            $this->assertSame('error.int', $errors[0]->getMessage());
            throw $e;
        }
    }

    public function testFloat()
    {
        $factory = new Factory;

        $mapping = $factory->mapping([
            'int' => $factory->float(),
            'float' => $factory->float(),
        ]);

        $result = $mapping->apply([
            'int' => '12',
            'float' => '12.23',
        ]);

        $this->assertSame(12.0, $result['int']);
        $this->assertSame(12.23, $result['float']);
    }

    public function testFloatFail()
    {
        $factory = new Factory;
        $mapping = $factory->float();

        $this->setExpectedException('Mapped\ValidationException');

        try {
            $mapping->apply('12a');
        } catch (ValidationException $e) {
            $errors = $e->getErrors();
            $this->assertSame('error.float', $errors[0]->getMessage());
            throw $e;
        }
    }

    public function testBool()
    {
        $factory = new Factory;

        $mapping = $factory->mapping([
            'a' => $factory->bool(),
            'b' => $factory->bool(),
            'c' => $factory->bool(),
            'd' => $factory->bool(),
        ]);

        $result = $mapping->apply([
            'a' => true,
            'b' => false,
            'c' => 'true',
            'd' => 'false',
        ]);

        $this->assertTrue($result['a']);
        $this->assertFalse($result['b']);
        $this->assertTrue($result['c']);
        $this->assertFalse($result['d']);
    }
}


text:
CKEDITOR.plugins.setLang( 'codemirror', 'bg', {
    copyright: "Copyright CodeMirror © Marijn Haverbeke. All rights reserved.",
	dlgTitle: 'About CodeMirror Source Plugin',
    moreInfoShortcuts: "Available Shortcuts",
    moreInfoShortcuts1: "CTRL + K to comment the currently selected text",
    moreInfoShortcuts2: "CTRL + SHIFT + K to uncomment currently selected text",
    moreInfoShortcuts3: "CTRL + ALT + K to auto format currently selected text",
    moreInfoShortcuts4: "CTRL + Q Expand / Collapse Code Block",
    moreInfoShortcuts5: "CTRL + F to perform a search",
    moreInfoShortcuts6: "CTRL + G to find next",
    moreInfoShortcuts7: "CTRL + SHIFT + G to find previous",
    moreInfoShortcuts8: "CTRL + SHIFT to find and replace",
    moreInfoShortcuts9: "CTRL + SHIFT + R to find and replace all",
	toolbar: 'Код',
	searchCode: 'Търси в кода',
	replaceCode: 'Replace Code (CTRL + SHIFT + F)',
	autoFormat: 'Форматирай избраното',
	commentSelectedRange: 'Коментирай избраното',
	uncommentSelectedRange: 'Откоментирай избраното',
	autoCompleteToggle: 'Активирай/деактивирай авто довършване за HTML тагове'
});


text:
int status;
ariawarapper *me;
ariawarapper::ariawarapper(QObject *parent)
    :QObject(parent)
{

    aria2::libraryInit();
    config.downloadEventCallback = downloadEventCallback;
    session = aria2::sessionNew(aria2::KeyVals(), config);
    me = this;
}
void ariawarapper::update()  {

    auto start = std::chrono::steady_clock::now();
      for (;;) {
        int rv = aria2::run(session, aria2::RUN_ONCE);
        if (rv != 1) {
          break;
        }
        // the application can call aria2 API to add URI or query progress
        // here
        auto now = std::chrono::steady_clock::now();
        auto count =
            std::chrono::duration_cast<std::chrono::milliseconds>(now - start)
                .count();
        // Print progress information once per 500ms
        if (count >= 500) {
          start = now;
          aria2::GlobalStat gstat = aria2::getGlobalStat(session);
          emit globalDownloadStat(gstat.numWaiting,gstat.numActive,gstat.downloadSpeed,gstat.uploadSpeed);

          std::vector<aria2::A2Gid> gids = aria2::getActiveDownload(session);
          for (const auto& gid : gids) {
            aria2::DownloadHandle* dh = aria2::getDownloadHandle(session, gid);
            if (dh) {
              uint id = gid;
                emit downloadStatPerItem(gid,dh->getCompletedLength()/1024,dh->getTotalLength()/1024,dh->getDownloadSpeed()/1024,dh->getUploadSpeed() / 1024);
              //std::cerr << "    [" << aria2::gidToHex(gid) << "] "
              //         << dh->getCompletedLength() << "/" << dh->getTotalLength()
              //         << "(" << (dh->getTotalLength() > 0
              //                      ? (100 * dh->getCompletedLength() /
              //                           dh->getTotalLength())
              //                        : 0)
              //          << "%)"
              //          << " D:" << dh->getDownloadSpeed() / 1024
              //          << "KiB/s, U:" << dh->getUploadSpeed() / 1024 << "KiB/s"
              //          << std::endl;
              //aria2::deleteDownloadHandle(dh);
            }
          }
        }
      }
      //int rv = aria2::sessionFinal(session);
      //aria2::libraryDeinit();
}

void ariawarapper::addNewDownload( QString url, QString location)
{

   // std::cout<<"@ariawrapper/addnewDownload/99-----------";
    std::vector<std::string> urls = {url.toStdString()};
    std::string dirlocation= {location.toStdString()};
    aria2::KeyVals options;
    options.push_back(std::pair<std::string, std::string> ("dir", dirlocation=""));
    options.push_back(std::pair<std::string, std::string> ("continue","false"));
    aria2::A2Gid gid;
    int rv = aria2::addUri(session, &gid, urls, options);
    uint fid = gid;
    if(rv < 0) {
        fid = 0;
        std::cout<<"Failed";
      }
      emit finishAddNew(fid);
    //std::cout<<"@ariawrapper/addnewDownload";
}

int downloadEventCallback(aria2::Session* session, aria2::DownloadEvent event,
                          const aria2::A2Gid gid, void* userData)
{
 uint id = gid; //A2Gid is not Qtmetobject so
 switch(event) {
  case aria2::EVENT_ON_DOWNLOAD_COMPLETE:
 {
     std::cerr << "COMPLETE";
     me->downloadStatPerItem(id,0,-2,0,0);
     break;
 }
  case aria2::EVENT_ON_DOWNLOAD_ERROR:
 {
     std::cerr << "ERROR";
     me->downloadStatPerItem(id,0,-1,0,0);
     break;
 }
 default:
    return 0;
  }
  std::cerr << " [" << aria2::gidToHex(gid) << "] ";
}


text:
#include <stdio.h>
#include <stdlib.h>
#include <shmem.h>
#include <shmemx.h>
#include <assert.h>

#ifdef USE_PTHREADS
#include <pthread.h>

#ifndef USE_THREAD_INITIALIZER
#error Pthreads version requires -DUSE_THREAD_INITIALIZER
#endif
#endif

#ifdef USE_CONTEXTS
#ifndef USE_THREAD_INITIALIZER
#error Contexts version requires -DUSE_THREAD_INITIALIZER
#endif
#ifndef USE_PTHREADS
#error Contexts version requires -DUSE_PTHREADS
#endif
#endif

int ipWrk[SHMEM_REDUCE_MIN_WRKDATA_SIZE];
double dpWrk[SHMEM_REDUCE_MIN_WRKDATA_SIZE];
long pSync[SHMEM_REDUCE_SYNC_SIZE];

typedef struct {
    int start_key;
    int end_key;
    int *keys;
    int keys_per_pe;
    int pe;
    int my_errs;
#ifdef USE_CONTEXTS
    shmemx_ctx_t ctx;
#endif
} thread_context;

static int binary_search(const int key, const int *keys, const int keys_per_pe
#ifdef USE_CONTEXTS
        , shmemx_ctx_t ctx
#endif
        ) {
    int mid;

    int low = 0;
    int high = shmem_n_pes() * keys_per_pe;

    while(low < high) {
        int val;

        mid = low + (high-low)/2;
#ifdef USE_CONTEXTS
        val = shmemx_ctx_int_g(&keys[mid % keys_per_pe], mid / keys_per_pe,
                ctx);
#else
        val = shmem_int_g(&keys[mid % keys_per_pe], mid / keys_per_pe);
#endif

        if(val == key) {
            return mid;
        } else if(val < key) {
            low = mid;
        } else {
            high = mid;
        }
    }

    return -1;
}

static void *thread_body(void *input) {
    thread_context *data = (thread_context *)input;
    const int *keys = data->keys;
    const int keys_per_pe = data->keys_per_pe;
    const int pe = data->pe;
#ifdef USE_CONTEXTS
    const shmemx_ctx_t ctx = data->ctx;
#endif

    for (int i = data->start_key; i < data->end_key; i++) {
        const int j = binary_search(i, keys, keys_per_pe
#ifdef USE_CONTEXTS
                , ctx
#endif
                );
        if (j != i) {
            printf("%2d: Error searching for %d.  Found at index %d, expected "
                    "%d\n", pe, i, j, i);
            data->my_errs += 1;
        }
    }

    return NULL;
}

int main(int argc, char **argv) {
    int i;

    if (argc != 3) {
        fprintf(stderr, "usage: %s <keys-per-pe> <nthreads>\n", argv[0]);
        return 1;
    }

    const int keys_per_pe = atoi(argv[1]);
    const int nthreads = atoi(argv[2]);

#ifndef USE_PTHREADS
    assert(nthreads == 1);
#endif

#ifdef USE_THREAD_INITIALIZER
    int provided;
    shmemx_init_thread(SHMEMX_THREAD_MULTIPLE, &provided);
    assert(provided == SHMEMX_THREAD_MULTIPLE);

#ifdef USE_CONTEXTS
    shmemx_domain_t *domains = (shmemx_domain_t *)malloc(
            nthreads * sizeof(shmemx_domain_t));
    shmemx_ctx_t *contexts = (shmemx_ctx_t *)malloc(
            nthreads * sizeof(shmemx_ctx_t));
    assert(domains && contexts);
    const int derr = shmemx_domain_create(SHMEMX_THREAD_SINGLE, nthreads,
            domains);
    assert(derr == 0);
    for (i = 0; i < nthreads; i++) {
        const int cerr = shmemx_ctx_create(domains[i], &contexts[i]);
        assert(cerr == 0);
    }
#endif
#else
    shmem_init();
#endif

    const int pe = shmem_my_pe();
    const int npes = shmem_n_pes();
    const int total_keys = keys_per_pe * npes;

    for (i = 0; i < SHMEM_REDUCE_SYNC_SIZE; i++) {
        ipWrk[i] = SHMEM_SYNC_VALUE;
        dpWrk[i] = SHMEM_SYNC_VALUE;
    }

    int *keys = (int *)shmem_malloc(keys_per_pe * sizeof(int));
    assert(keys);
    int *my_errs = (int *)shmem_malloc(sizeof(int));
    assert(my_errs);
    int *all_errs = (int *)shmem_malloc(sizeof(int));
    assert(all_errs);
    *my_errs = 0;

    double *my_elapsed_time = (double *)shmem_malloc(sizeof(double));
    double *cumulative_elapsed_time = (double *)shmem_malloc(sizeof(double));
    assert(my_elapsed_time && cumulative_elapsed_time);

    const int keys_per_thread = (total_keys + nthreads - 1) / nthreads;
    thread_context *thread_data = (thread_context *)malloc(
            nthreads * sizeof(thread_context));
    pthread_t *threads = (pthread_t *)malloc(nthreads * sizeof(pthread_t));
    assert(thread_data && threads);
    for (i = 0; i < nthreads; i++) {
        thread_data[i].start_key = i * keys_per_thread;
        thread_data[i].end_key = (i + 1) * keys_per_thread;
        if (thread_data[i].end_key > total_keys) {
            thread_data[i].end_key = total_keys;
        }
        thread_data[i].keys = keys;
        thread_data[i].keys_per_pe = keys_per_pe;
        thread_data[i].pe = pe;
        thread_data[i].my_errs = 0;
#ifdef USE_CONTEXTS
        thread_data[i].ctx = contexts[i];
#endif
    }

    for (i = 0; i < keys_per_pe; i++) {
        keys[i] = keys_per_pe * pe + i;
    }

    shmem_barrier_all();

    const double start_time = shmemx_wtime();

#ifdef USE_PTHREADS
    for (int t = 1; t < nthreads; t++) {
        const int perr = pthread_create(&threads[t], NULL, thread_body,
                &thread_data[t]);
        assert(perr == 0);
    }
#endif

    thread_body(&thread_data[0]);

#ifdef USE_PTHREADS
    for (int t = 1; t < nthreads; t++) {
        const int perr = pthread_join(threads[t], NULL);
        assert(perr == 0);

        *my_errs += thread_data[t].my_errs;
    }
#endif
    *my_errs += thread_data[0].my_errs;

    *my_elapsed_time = shmemx_wtime() - start_time;

    shmem_int_sum_to_all(all_errs, my_errs, 1, 0, 0, npes, ipWrk, pSync);
    shmem_barrier_all();
    shmem_double_sum_to_all(cumulative_elapsed_time, my_elapsed_time, 1, 0, 0,
            npes, dpWrk, pSync);

    if (pe == 0) {
        if (*all_errs == 0) {
            printf("Validated with %d keys per PE, %d keys in total!\n",
                    keys_per_pe, keys_per_pe * npes);
            printf("Cumulative time : %f s\n", *cumulative_elapsed_time);
            printf("Wall time : %f s\n", *my_elapsed_time);
        }
    }

#ifdef USE_CONTEXTS
    for (int t = 0; t < nthreads; t++) {
        shmemx_ctx_destroy(contexts[t]);
    }
    shmemx_domain_destroy(nthreads, domains);
#endif
    shmem_finalize();

    return 0;
}


text:
#ifndef __SIEGE_GRAPHICS_LIGHT_H__
#define __SIEGE_GRAPHICS_LIGHT_H__

#include "../common.h"
#include "../util/list.h"
#include "../util/color.h"
#include "../util/vector.h"
#include "surface.h"
#include "sprite.h"

#include <stdarg.h>

#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus

#define SG_SHADOW_DRAW_ADD 0x00
#define SG_SHADOW_DRAW_MUL 0x01
#define SG_SHADOW_DRAW_SQR 0x02

typedef struct SGLightSpace
{
    SGSurface* buffer;
    SGSurface* lbuffer;
    SGList* lights;
    SGList* shapes;
    SGColor ambience;
} SGLightSpace;

typedef struct SGLight
{
    SGLightSpace* space;
    SGListNode* node;

    SGVec2 pos;
    float radius;
    SGColor color;

    float depth;
    float height;

    SGbool active;
    SGbool stat;
    SGbool shadow;
    SGbool _r1; // reserved

    float angle;
    float cone;
    SGSprite* sprite;
} SGLight;

typedef struct SGShadowShape
{
    SGLightSpace* space;
    SGListNode* node;

    SGenum type;
    SGVec2 pos;

    float depth;

    SGbool active;
    SGbool stat;
    SGbool _r1;
    SGbool _r2;

    float angle;

    size_t numverts;
    SGVec2* verts;
} SGShadowShape;

#ifdef SG_BUILD_LIBRARY
SGLightSpace* _sg_lightSpaceMain;
#endif // SG_BUILD_LIBRARY

SGbool SG_CALL _sgLightInit(void);
SGbool SG_CALL _sgLightDeinit(void);

void SG_CALL _sgLightSpaceAddLight(SGLightSpace* space, SGLight* light);
void SG_CALL _sgLightSpaceAddShadowShape(SGLightSpace* space, SGShadowShape* shape);
void SG_CALL _sgLightSpaceRemoveLight(SGLightSpace* space, SGLight* light);
void SG_CALL _sgLightSpaceRemoveShadowShape(SGLightSpace* space, SGShadowShape* shape);

SGLightSpace* SG_CALL sgLightSpaceCreate(SGuint width, SGuint height);
void SG_CALL sgLightSpaceDestroy(SGLightSpace* space);

/*
 * TODO: Should this set the ambience to 1.0f and premultiply the rest?
 * The problem is that any other (= non-1.0f) setting makes the lights blow up.
 */
void SG_CALL sgLightSpaceSetAmbience4f(SGLightSpace* space, float r, float g, float b, float a);

SGSurface* SG_CALL sgLightSpaceGetBuffer(SGLightSpace* space);

void SG_CALL sgLightSpaceResize(SGLightSpace* space, SGuint width, SGuint height);
/* TODO: Have an offset in the Update function, to track the camera */
void SG_CALL sgLightSpaceUpdate(SGLightSpace* space);
void SG_CALL sgLightSpaceDraw(SGLightSpace* space, SGenum flags);
void SG_CALL sgLightSpaceDrawDBG(SGLightSpace* space, SGenum flags);

SGLight* SG_CALL sgLightCreate(SGLightSpace* space, float x, float y, float radius);
void SG_CALL sgLightDestroy(SGLight* light);

void SG_CALL sgLightSetPos(SGLight* light, float x, float y);
void SG_CALL sgLightSetPosX(SGLight* light, float x);
void SG_CALL sgLightSetPosY(SGLight* light, float y);

void SG_CALL sgLightGetPos(SGLight* light, float* x, float* y);
float SG_CALL sgLightGetPosX(SGLight* light);
float SG_CALL sgLightGetPosY(SGLight* light);

void SG_CALL sgLightSetRadius(SGLight* light, float radius);
float SG_CALL sgLightGetRadius(SGLight* light);

void SG_CALL sgLightSetColor4f(SGLight* light, float r, float g, float b, float a);
void SG_CALL sgLightSetColor3f(SGLight* light, float r, float g, float b);
void SG_CALL sgLightSetColor2f(SGLight* light, float g, float a);
void SG_CALL sgLightSetColor1f(SGLight* light, float g);

void SG_CALL sgLightSetColor4ub(SGLight* light, SGubyte r, SGubyte g, SGubyte b, SGubyte a);
void SG_CALL sgLightSetColor3ub(SGLight* light, SGubyte r, SGubyte g, SGubyte b);
void SG_CALL sgLightSetColor2ub(SGLight* light, SGubyte g, SGubyte a);
void SG_CALL sgLightSetColor1ub(SGLight* light, SGubyte g);

void SG_CALL sgLightSetDepth(SGLight* light, float depth);
float SG_CALL sgLightGetDepth(SGLight* light);

void SG_CALL sgLightSetHeight(SGLight* light, float height);
float SG_CALL sgLightGetHeight(SGLight* light);

void SG_CALL sgLightSetActive(SGLight* light, SGbool active);
SGbool SG_CALL sgLightGetActive(SGLight* light);

void SG_CALL sgLightSetStatic(SGLight* light, SGbool stat);
SGbool SG_CALL sgLightGetStatic(SGLight* light);

void SG_CALL sgLightSetShadow(SGLight* light, SGbool shadow);
SGbool SG_CALL sgLightGetShadow(SGLight* light);

void SG_CALL sgLightSetAngleRads(SGLight* light, float rads);
float SG_CALL sgLightGetAngleRads(SGLight* light);

void SG_CALL sgLightSetAngleDegs(SGLight* light, float degs);
float SG_CALL sgLightGetAngleDegs(SGLight* light);

void SG_CALL sgLightSetConeRads(SGLight* light, float rads);
float SG_CALL sgLightGetConeRads(SGLight* light);

void SG_CALL sgLightSetConeDegs(SGLight* light, float degs);
float SG_CALL sgLightGetConeDegs(SGLight* light);

void SG_CALL sgLightDraw(SGLight* light);

void SG_CALL sgLightDrawDBG(SGLight* light);

SGShadowShape* SG_CALL sgShadowShapeCreate(SGLightSpace* space, SGenum type);
SGShadowShape* SG_CALL sgShadowShapeCreateSegment(SGLightSpace* space, float x1, float y1, float x2, float y2);
SGShadowShape* SG_CALL sgShadowShapeCreatePoly(SGLightSpace* space, float x, float y, float* verts, size_t numverts);
SGShadowShape* SG_CALL sgShadowShapeCreateCircle(SGLightSpace* space, float x, float y, float radius);
void SG_CALL sgShadowShapeDestroy(SGShadowShape* shape);

void SG_CALL sgShadowShapeSetDepth(SGShadowShape* shape, float depth);
float SG_CALL sgShadowShapeGetDepth(SGShadowShape* shape);

void SG_CALL sgShadowShapeSetActive(SGShadowShape* shape, SGbool active);
SGbool SG_CALL sgShadowShapeGetActive(SGShadowShape* shape);

void SG_CALL sgShadowShapeSetStatic(SGShadowShape* shape, SGbool stat);
SGbool SG_CALL sgShadowShapeGetStatic(SGShadowShape* shape);

void SG_CALL sgShadowShapeDrawDBG(SGShadowShape* shape, SGbool fill);

void SG_CALL sgShadowShapeCast(SGShadowShape* shape, SGLight* light);
void SG_CALL sgShadowShapeCastDBG(SGShadowShape* shape, SGLight* light);

#ifdef __cplusplus
}
#endif // __cplusplus

#endif // __SIEGE_GRAPHICS_LIGHT_H__


text:
// Bug 776129 - If a window w calls window.open, the resultant window should be
// remote iff w is remote.
//
// <iframe mozbrowser> can be default-OOP or default-in-process.  But we can
// override this default by setting remote=true or remote=false on the iframe.
//
// This bug arises when we are default-in-process and a OOP iframe calls
// window.open, or when we're default-OOP and an in-process iframe calls
// window.open.  In either case, if the opened iframe gets the default
// remotness, it will not match its opener's remoteness, which is bad.
//
// Since the name of the test determines the OOP-by-default pref, the "inproc"
// version of this test opens an OOP frame, and the "oop" version opens an
// in-process frame.  Enjoy.  :)

"use strict";

SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();

function runTest() {
  // We're going to open a remote frame if OOP off by default.  If OOP is on by
  // default, we're going to open an in-process frame.
  var remote = !browserElementTestHelpers.getOOPByDefaultPref();

  var iframe = document.createElement('iframe');
  iframe.mozbrowser = true;
  iframe.setAttribute('remote', remote);

  // The page we load does window.open, then checks some things and reports
  // back using alert().  Finally, it calls alert('finish').
  //
  // Bug 776129 in particular manifests itself such that the popup frame loads
  // and the tests in file_browserElement_OpenMixedProcess pass, but the
  // content of the frame is invisible.  To catch this case, we take a
  // screenshot after we load the content into the popup, and ensure that it's
  // not blank.
  var popup;
  iframe.addEventListener('mozbrowseropenwindow', function(e) {
    popup = document.body.appendChild(e.detail.frameElement);
  });

  iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
    if (e.detail.message.startsWith('pass')) {
      ok(true, e.detail.message);
    }
    else if (e.detail.message.startsWith('fail')) {
      ok(false, e.detail.message);
    }
    else if (e.detail.message == 'finish') {
      // We assume here that iframe is completely blank, and spin until popup's
      // screenshot is not the same as iframe.
      iframe.getScreenshot(1000, 1000).onsuccess = function(e) {
        var fr = FileReader();
        fr.onloadend = function() { test2(popup, fr.result); };
        fr.readAsArrayBuffer(e.target.result);
      };
    }
    else {
      ok(false, e.detail.message, "Unexpected message!");
    }
  });

  document.body.appendChild(iframe);
  iframe.src = 'file_browserElement_OpenMixedProcess.html';
}

function arrayBuffersEqual(a, b) {
  var x = new Int8Array(a);
  var y = new Int8Array(b);
  if (x.length != y.length) {
    return false;
  }

  for (var i = 0; i < x.length; i++) {
    if (x[i] != y[i]) {
      return false;
    }
  }

  return true;
}

function test2(popup, blankScreenshotArrayBuffer) {
  // Take screenshots of popup until it doesn't equal blankScreenshot (or we
  // time out).
  popup.getScreenshot(1000, 1000).onsuccess = function(e) {
    var fr = new FileReader();
    fr.onloadend = function() {
      if (!arrayBuffersEqual(blankScreenshotArrayBuffer, fr.result)) {
        ok(true, "Finally got a non-blank screenshot.");
        SimpleTest.finish();
        return;
      }

      SimpleTest.executeSoon(function() { test2(popup, blankScreenshot) });
    };
    fr.readAsArrayBuffer(e.target.result);
  };
}

addEventListener('testready', runTest);


text:
from PyQt5.QtGui import qRgb
from idacyber import ColorFilter
from ida_xref import xrefblk_t

class xrefsto(ColorFilter):
    name = "xrefs to"
    width = 16
    zoom = 20
    highlight_cursor = False
    help = "Experimental code which highlights xrefs."

    def xrefcount(self, addr):
        count = 0
        xrefs = xrefblk_t()
        if xrefs.first_to(addr, 0):
            count +=1
            while xrefs.next_to():
                count += 1
        return count

    def on_process_buffer(self, buffers, addr, size, mouse_offs):
        colors = []
        goffs = 0
        for mapped, buf in buffers:
            xrefs = []
            if mapped:
                for i in range(len(buf)):
                    xrefs.append(self.xrefcount(addr + goffs + i))

                if xrefs:
                    minimum, maximum = min(xrefs), max(xrefs)

                for count in xrefs:
                    r, g, b = self.hm(minimum, maximum, count)
                    colors.append((True, qRgb(r, g, b)))
            else:
                colors += [(False, None)]*len(buf)
            goffs += len(buf)
        return colors

    def hm(self, minimum, maximum, value):
        if minimum == maximum:
            maximum = 1
        minimum, maximum = float(minimum), float(maximum)
        ratio = 2 * (value-minimum) / (maximum - minimum)
        b = int(max(0, 255*(1 - ratio)))
        r = int(max(0, 255*(ratio - 1)))
        g = 255 - b - r
        return r, g, b

    def get_tooltip(self, addr, size, mouse_offs):
        return "%d xrefs" % self.xrefcount(addr + mouse_offs)

def FILTER_INIT(pw):
    return xrefsto()

def FILTER_EXIT():
    return


text:
            {% if site.copyright.name %}

                  Obra creada por {{site.copyright.name}} bajo licencia :

            {% endif %}

                {% if site.built-by %}

                {% endif %}


text:
typedef struct
{
    GSTerrainVertex * _Nullable vertices;
    size_t capacity;
    size_t count;
} GSTerrainGeometry;

GSTerrainGeometry * _Nonnull GSTerrainGeometryCreate(void);
void GSTerrainGeometryDestroy(GSTerrainGeometry * _Nullable geometry);
void GSTerrainGeometryAddVertex(GSTerrainGeometry * _Nonnull geometry, GSTerrainVertex * _Nonnull vertex);


text:
package com.sdcuike.springboot.practice;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class ApplicationTest {

    @Test
    public void test() {

    }

}


text:
package org.springframework.boot.build;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Collections;
import java.util.Map;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;

import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.GradleRunner;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

import org.springframework.util.FileCopyUtils;

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

/**
 * Integration tests for {@link ConventionsPlugin}.
 *
 * @author Christoph Dreis
 */
class ConventionsPluginTests {

	private File projectDir;

	private File buildFile;

	@BeforeEach
	void setup(@TempDir File projectDir) throws IOException {
		this.projectDir = projectDir;
		this.buildFile = new File(this.projectDir, "build.gradle");
	}

	@Test
	void jarIncludesLegalFiles() throws IOException {
		try (PrintWriter out = new PrintWriter(new FileWriter(this.buildFile))) {
			out.println("plugins {");
			out.println("    id 'java'");
			out.println("    id 'org.springframework.boot.conventions'");
			out.println("}");
			out.println("description 'Test'");
			out.println("jar.archiveFileName = 'test.jar'");
		}
		runGradle("jar");
		File file = new File(this.projectDir, "/build/libs/test.jar");
		assertThat(file).exists();
		try (JarFile jar = new JarFile(file)) {
			JarEntry license = jar.getJarEntry("META-INF/LICENSE.txt");
			assertThat(license).isNotNull();
			JarEntry notice = jar.getJarEntry("META-INF/NOTICE.txt");
			assertThat(notice).isNotNull();
			String noticeContent = FileCopyUtils.copyToString(new InputStreamReader(jar.getInputStream(notice)));
			// Test that variables were replaced
			assertThat(noticeContent).doesNotContain("${");
		}
	}

	@Test
	void testRetryIsConfiguredOnCI() throws IOException {
		try (PrintWriter out = new PrintWriter(new FileWriter(this.buildFile))) {
			out.println("plugins {");
			out.println("    id 'java'");
			out.println("    id 'org.springframework.boot.conventions'");
			out.println("}");
			out.println("description 'Test'");
			out.println("task retryConfig {");
			out.println("    doLast {");
			out.println("        println \"Retry plugin applied: ${plugins.hasPlugin('org.gradle.test-retry')}\"");
			out.println("    test.retry {");
			out.println("            println \"maxRetries: ${maxRetries.get()}\"");
			out.println("            println \"failOnPassedAfterRetry: ${failOnPassedAfterRetry.get()}\"");
			out.println("        }");
			out.println("    }");
			out.println("}");
		}
		assertThat(runGradle(Collections.singletonMap("CI", "true"), "retryConfig", "--stacktrace").getOutput())
				.contains("Retry plugin applied: true").contains("maxRetries: 3")
				.contains("failOnPassedAfterRetry: true");
	}

	@Test
	void testRetryIsNotConfiguredLocally() throws IOException {
		try (PrintWriter out = new PrintWriter(new FileWriter(this.buildFile))) {
			out.println("plugins {");
			out.println("    id 'java'");
			out.println("    id 'org.springframework.boot.conventions'");
			out.println("}");
			out.println("description 'Test'");
			out.println("task retryConfig {");
			out.println("    doLast {");
			out.println("        println \"Retry plugin applied: ${plugins.hasPlugin('org.gradle.test-retry')}\"");
			out.println("    }");
			out.println("}");
		}
		assertThat(runGradle(Collections.singletonMap("CI", "local"), "retryConfig", "--stacktrace").getOutput())
				.contains("Retry plugin applied: false");
	}

	private BuildResult runGradle(String... args) {
		return runGradle(Collections.emptyMap(), args);
	}

	private BuildResult runGradle(Map<String, String> environment, String... args) {
		return GradleRunner.create().withProjectDir(this.projectDir).withEnvironment(environment).withArguments(args)
				.withPluginClasspath().build();
	}

}


text:
RenderManager::RenderManager()
{
	m_bulletDebugDrawer = 0;
}

RenderManager::~RenderManager()
{
	Clear();
}

void RenderManager::Init()
{
	if (!m_bulletDebugDrawer)
		m_bulletDebugDrawer = new BTDebugDrawer();
	glewInit();
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LESS);
	EventManager::GetInstance()->AddEventListener(EventDefs::CREATE_RENDER_COMPONENT, std::bind(&RenderManager::CreateRenderComponent, this, std::placeholders::_1));

	//Create shaders and add to vector
	std::vector<GLuint> shaderList;
	shaderList.push_back(CreateShader(GL_VERTEX_SHADER, ReadFileToString("VertexShader.glsl")));
	shaderList.push_back(CreateShader(GL_FRAGMENT_SHADER, ReadFileToString("FragmentShader.glsl")));

	//Create program
	m_program = CreateProgram(shaderList);
	m_bulletDebugDrawer->SetProgram(m_program);
}
void RenderManager::Clear()
{
	if (m_bulletDebugDrawer)
		delete m_bulletDebugDrawer;

	for (unsigned int i = 0; i < m_renderComponents.size(); ++i)
	{
		delete m_renderComponents[i];
		m_renderComponents[i] = 0;
	}

	m_renderComponents.clear();
}

void RenderManager::ClearRender()
{
	if (m_bulletDebugDrawer)
		m_bulletDebugDrawer->Clear();
}

void RenderManager::Step()
{
	for (unsigned int i = 0; i < m_renderComponents.size(); ++i)
		m_renderComponents[i]->Update();
}

void RenderManager::UpdateCameraPosition(std::map<GameDefs::GameKey, bool> keys)
{
	if(keys[GameDefs::GameKey::W])
		m_position += m_direction  * m_speed;
	if (keys[GameDefs::GameKey::S])
		m_position -= m_direction  * m_speed;
	if (keys[GameDefs::GameKey::A])
		m_position -= m_right  * m_speed;
	if (keys[GameDefs::GameKey::D])
		m_position += m_right  * m_speed;
}

void RenderManager::UpdateCameraRotation(float xRotate, float yRotate)
{

	m_direction = glm::vec3(
		cos(yRotate) * sin(xRotate),
		sin(yRotate),
		cos(yRotate) * cos(xRotate)
		);

	m_right = glm::vec3(
		sin(xRotate - 3.14f / 2.0f),
		0,
		cos(xRotate - 3.14f / 2.0f)
		);
	m_up = glm::cross(m_right, m_direction);

}

void RenderManager::Draw()
{
	glUseProgram(m_program);
	glClearColor(.7f, 0.7f, 1.0f, 0.0f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	//MVP matrix, for 2D drawing this is all we need
	glm::mat4 vp(1.0f);

	glm::mat4 projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 200.0f);
	glm::mat4 view = glm::lookAt(
		m_position,
		m_position + m_direction,
		m_up
		);
	vp = projection * view;

	//for (unsigned int i = 0; i < m_renderComponents.size(); ++i)
		//m_renderComponents[i]->Draw(vp);

	m_bulletDebugDrawer->Draw(vp);

}

void RenderManager::CreateRenderComponent(IEventData* eventData)
{
	//Create a new render component and return it
	RenderComponent* newComponent = new RenderComponent(m_renderComponents.size());

	EDCreateRenderComp* renderCompED = dynamic_cast<EDCreateRenderComp*>(eventData);
	if (!renderCompED)
		return;

	newComponent->SetVertices(renderCompED->GetData()->vertices);
	newComponent->SetColor(renderCompED->GetData()->color);
	newComponent->SetProgram(m_program);
	newComponent->SetDrawPrimitive(renderCompED->GetData()->drawType);
	newComponent->SetOwner(renderCompED->GetData()->owner);

	m_renderComponents.push_back(newComponent);

	eventData->SetDelete(true);
}

RenderComponent* RenderManager::CreateRay(glm::vec3 start, glm::vec3 end)
{
	RenderComponent* newComponent = new RenderComponent(m_renderComponents.size());
	std::vector<glm::vec3> temp;
	newComponent->SetDrawPrimitive(GL_LINES);

	temp.push_back(start);
	temp.push_back(end);
	newComponent->SetVertices(temp);

	temp.clear();
	temp.push_back(glm::vec3(1.f, 0.f, 0.f));
	newComponent->SetColor(temp);

	m_renderComponents.push_back(newComponent);
	return newComponent;
}


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2013.05.27 at 03:40:55 PM CEST
//

package org.apache.ode.schemas.dd._2007._03;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for tSchedule complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="tSchedule">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="cleanup" type="{http://www.apache.org/ode/schemas/dd/2007/03}tCleanup" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *       <attribute name="when" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "tSchedule", propOrder = {
    "cleanup"
})
public class TSchedule {

    protected List<TCleanup> cleanup;
    @XmlAttribute(required = true)
    protected String when;

    /**
     * Gets the value of the cleanup property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the cleanup property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getCleanup().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link TCleanup }
     *
     *
     */
    public List<TCleanup> getCleanup() {
        if (cleanup == null) {
            cleanup = new ArrayList<TCleanup>();
        }
        return this.cleanup;
    }

    /**
     * Gets the value of the when property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getWhen() {
        return when;
    }

    /**
     * Sets the value of the when property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setWhen(String value) {
        this.when = value;
    }

}


text:
package app

import (
	"github.com/prometheus/client_golang/prometheus"
	"net/http"
	goruntime "runtime"

	apiserverconfig "k8s.io/apiserver/pkg/apis/config"
	genericapifilters "k8s.io/apiserver/pkg/endpoints/filters"
	apirequest "k8s.io/apiserver/pkg/endpoints/request"
	apiserver "k8s.io/apiserver/pkg/server"
	genericfilters "k8s.io/apiserver/pkg/server/filters"
	"k8s.io/apiserver/pkg/server/healthz"
	"k8s.io/apiserver/pkg/server/mux"
	"k8s.io/apiserver/pkg/server/routes"
	"k8s.io/kubernetes/pkg/api/legacyscheme"
	"k8s.io/kubernetes/pkg/util/configz"
)

// BuildHandlerChain builds a handler chain with a base handler and CompletedConfig.
func BuildHandlerChain(apiHandler http.Handler, authorizationInfo *apiserver.AuthorizationInfo, authenticationInfo *apiserver.AuthenticationInfo) http.Handler {
	requestInfoResolver := &apirequest.RequestInfoFactory{}
	failedHandler := genericapifilters.Unauthorized(legacyscheme.Codecs, false)

	handler := apiHandler
	if authorizationInfo != nil {
		handler = genericapifilters.WithAuthorization(apiHandler, authorizationInfo.Authorizer, legacyscheme.Codecs)
	}
	if authenticationInfo != nil {
		handler = genericapifilters.WithAuthentication(handler, authenticationInfo.Authenticator, failedHandler)
	}
	handler = genericapifilters.WithRequestInfo(handler, requestInfoResolver)
	handler = genericfilters.WithPanicRecovery(handler)

	return handler
}

// NewBaseHandler takes in CompletedConfig and returns a handler.
func NewBaseHandler(c *apiserverconfig.DebuggingConfiguration, checks ...healthz.HealthzChecker) *mux.PathRecorderMux {
	mux := mux.NewPathRecorderMux("controller-manager")
	healthz.InstallHandler(mux, checks...)
	if c.EnableProfiling {
		routes.Profiling{}.Install(mux)
		if c.EnableContentionProfiling {
			goruntime.SetBlockProfileRate(1)
		}
	}
	configz.InstallHandler(mux)
	mux.Handle("/metrics", prometheus.Handler())

	return mux
}


text:
i18next.on('loaded', function(loaded) {
  // Adds strings in correct language to the page
  $("title").text(i18next.t('list.results'));
  $('#base-content-box > div').text(i18next.t('list.loading'));

  // Counts how many artworks are in the list
  var count = 0;
  // True while it can be assumed that more artworks can be found,
  // becomes false when no more artworks are found
  var hasMore = true;
  // Is true while loading more artworks, false if no loading is conducted
  var loading = false;
  // Only used when "search nearby" is used and there are multiple lists
  var currentList = 0;

  //Check if the parameter data is empty and replaces with parameter standard
  function checkString(data, standard) {
    var str = standard;
    if(data !== null && data !== ""){
      str = data;
    }
    return str;
  }

  //Adds tags that shows if the artwork has coordinates and, in that case,
  //if it has been reported.
  function addTags(artwork, li) {
    if(helpFunctions.hasCoordinates(artwork)){ //Checks if the artworks has coordianates
      //Add correct tag if the artwoks coordinates has been reported
      if(artwork.reported == 1){
        $('<span/>', {
          "class": 'base-tag base-wrong-coord',
          text: i18next.t('base.wrongcoords')
        }).appendTo(li);
      //Add correct tag if the artwoks coordinates has not been reported
      } else {
        $('<span/>', {
          "class": 'base-tag base-has-coord',
          text: i18next.t('base.coords')
        }).appendTo(li);
      }
    //Add correct tag if the artwork does not have coordiantes
    } else {
      $('<span/>', {
        "class": 'base-tag base-no-coord',
        text: i18next.t('base.nocoords')
      }).appendTo(li);
    }
  }

  //Adds name, artist and year of an artwork to an object in the list
  function addInfoToList(artwork, li) {
    //Check if title is empty
    var title = checkString(artwork.title, i18next.t('base.notitle'));
    //Append name, artist and year to list
    $('<span/>', {
      "class": 'artwork-name',
      text: title
    }).appendTo(li);
    $('<span/>', {
      "class": 'artwork-artist',
      text: artwork.artist.split(";").join(", ")
    }).appendTo(li);
    $('<span/>', {
      "class": 'artwork-year',
      text: artwork.year
    }).appendTo(li);
  }

  //Adds all artworks to the list
  function addArtworksToList(data, lists) {
    $.each(data["body"], function(_, artwork) {
      var artworkUrl = {
        id: artwork.id
      };
      a = $("<a href= artwork.html?" + $.param(artworkUrl) + "/>").appendTo(ul);
      li = $("<li/>").appendTo(a);
      addInfoToList(artwork, li);
      addTags(artwork, li);
    });
    //If less than 20 artwork was loaded, there are no more artworks form that list
    if(data["body"]["length"] < 20){
        checkListEnd(lists);
    }
  }

  //Check what to do at the end of a list of artworks
  function checkListEnd(lists){
    if(1+currentList == lists.length) {//See that there are not another list with artworks
      hasMore = false;
      // If no artworks were added to the list, display that no artworks were found
      if ($('.list-container ul').is(':empty')) {
        $('<p/>', {
          text: i18next.t('list.nomatches')
        }).appendTo('.list-container ul');
      } else {
        // Add a div saying no more artworks can be found
        $("<div/>", {
          'id': "list-end",
          text: i18next.t('list.endmatches')
        }).appendTo(".list-container");
      }
    } else { //If there are another list with artworks (used by "search nearby")
        count = 0;
        currentList++;

        // Remove the spinner as a new one will be added
        $('.base-spinner').remove();
        // Check if there is another list
        getArtworks(count);
    }
  }

  //Load in artwork to the list
  function getArtworks(offset){
    var loadLimit = 20;
    count += loadLimit;

    // If list isn't empty, put back the spinner
    if (!$('.list-container ul').is(':empty')) {
      $("<div/>", {'class':"base-spinner-large base-spinner"}).appendTo(ul);
    }

    var lists = url.getParameter('list').split(";");

    // Load the artworks from the API
    api.getJSON({
      has_coords: url.getParameter('has_coords'),
      list: lists[currentList],
      title: url.getParameter('title'),
      artist: url.getParameter('artist'),
      has_image: url.getParameter('has_image'),
      county: url.getParameter('county'),
      muni: url.getParameter('municipality'),
      limit : loadLimit,
      offset : offset
    }, function(data) {
      // If you didn't get any artworks from the API
      if(data["body"]["length"] == 0){
        checkListEnd(lists);
      } else {//If artworks were found, add them to the list
        addArtworksToList(data, lists);
      }
      loading = false;
      // Remove the spinner as the loading is done
      $('.base-spinner').remove();
    });
  }

  // Load the first artworks to the list
  function loadFirstArtworks() {
      //See if user used "search nearby"
      if(url.getParameter('nearby') == 'true') {
      // Find user's position.
      geolocation.currentPosition(function(position){
        var nearby = new Nearby();
        nearby.getUnlocated(position, function(list) {
          history.replaceState(null, null, "list.html?" + "has_coords=false&list=" + list);
          getArtworks(count);
        });
      });
    //Get artworks if the user used "search"
    } else {
      getArtworks(count);
    }
  }

  //Loads more artworks to the list if the user have scrolled down to
  //the bottom of the page and it is assumed that more artworks can be found.
  function loadMoreArtworks() {
    $(window).scroll(function() {
      if($(window).scrollTop() + $(window).height() >= $(document).height()-100 && hasMore && !loading){
        loading = true;
        getArtworks(count);
      }
    });
  }

  //Start list
  var ul = $("<ul/>").appendTo($('.list-container'));
  //Append artwork information to list
  loadFirstArtworks();
  loadMoreArtworks();
});


text:
usage() {
    cat <<EOF
USAGE: \${DOTFILES}/shell/csh/launcher.sh <function> [arg ...]

FUNCTION:
  exit <return_code>
EOF
}

# Print usage if not specify the function that need to run.
if [ $# -eq 0 ]; then
    usage
    exit 1
fi

# The function name is the first argument.
func_name=${1}
# Remove the first argument "function name".
shift 1

# Dispatch to the corresponding function.
case ${func_name} in
    exit)
        exit ${@}
        ;;
    *)
        cat <<EOF
Error: Specify unknow function "${func_name}",
       this shell script now only support run function "exit".
EOF
        usage
        exit 1
        ;;
esac


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.jenkins-ci.plugins</groupId>
        <artifactId>plugin</artifactId>
        <version>1.532.3</version>
        <!-- which version of Jenkins is this plugin built against? Users must have at least this Jenkins version to use this plugin. -->
    </parent>

    <groupId>org.jenkins-ci.plugins</groupId>
    <artifactId>subversionMerge</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>hpi</packaging>

    <name>my subversion merge</name>

    <developers>
        <developer>
            <name>zjl</name>
            <email>zjl492738140@gmail.com</email>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://opensource.org/licenses/MIT</url>
        </license>
    </licenses>

    <issueManagement>
        <system>issues</system>
        <url>https://github.com/zz0412/subversionMerge/issues</url>
    </issueManagement>

    <ciManagement>
        <system></system>
        <url></url>
    </ciManagement>

    <scm>
        <connection>scm:git:git://github.com:zz0412/subversionMerge.git</connection>
        <developerConnection>scm:git:ssh://git@github.com:zz0412/subversionMerge.git</developerConnection>
        <url>https://github.com/zz0412/subversionMerge</url>
    </scm>
    <properties>
        <!-- *.html files are in UTF-8, and *.properties are in iso-8859-1, so this configuration is acturally incorrect,
        but this suppresses a warning from Maven, and as long as we don't do filtering we should be OK. -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven-plugin.version>2.3</maven-plugin.version>

        <java.level>6</java.level>
        <svnkit.version>1.8.5</svnkit.version>
    </properties>

    <!-- get every artifact through repo.jenkins-ci.org, which proxies all the artifacts that we need -->
    <repositories>
        <repository>
            <id>repo.jenkins-ci.org</id>
            <url>http://repo.jenkins-ci.org/public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>maven.tmatesoft.com</id>
            <url>http://maven.tmatesoft.com/content/repositories/releases/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>repo.jenkins-ci.org</id>
            <url>http://repo.jenkins-ci.org/public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <dependencies>
        <dependency>
            <groupId>org.tmatesoft.svnkit</groupId>
            <artifactId>svnkit</artifactId>
            <version>${svnkit.version}</version>
        </dependency>

    </dependencies>
</project>