text:
using NUnit.Framework;
using Qiniu.Util;
using Qiniu.Tests;
using Qiniu.Http;
using System;
using System.Collections.Generic;
namespace Qiniu.Storage.Tests
{
    [TestFixture]
    public class BucketManagerTests : TestEnv
    {
        [Test]
        public void StatTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            config.UseHttps = true;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string key = "qiniu.png";
            StatResult statRet = bucketManager.Stat(Bucket, key);
            if (statRet.Code != (int)HttpCode.OK)
            {
                Assert.Fail("stat error: " + statRet.ToString());
            }
            Console.WriteLine(statRet.Result.Hash);
            Console.WriteLine(statRet.Result.MimeType);
            Console.WriteLine(statRet.Result.Fsize);
            Console.WriteLine(statRet.Result.MimeType);
            Console.WriteLine(statRet.Result.FileType);
        }

        [Test]
        public void DeleteTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string newKey = "qiniu-to-delete.png";
            bucketManager.Copy(Bucket, "qiniu.png", Bucket, newKey);
            HttpResult deleteRet = bucketManager.Delete(Bucket, newKey);
            if (deleteRet.Code != (int)HttpCode.OK)
            {
                Assert.Fail("delete error: " + deleteRet.ToString());
            }
        }

        [Test]
        public void CopyTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string newKey = "qiniu-to-copy.png";
            HttpResult copyRet = bucketManager.Copy(Bucket, "qiniu.png", Bucket, newKey, true);
            if (copyRet.Code != (int)HttpCode.OK)
            {
                Assert.Fail("copy error: " + copyRet.ToString());
            }
            Console.WriteLine(copyRet.ToString());
        }

        [Test]
        public void MoveTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string newKey = "qiniu-to-copy.png";
            HttpResult copyRet = bucketManager.Copy(Bucket, "qiniu.png", Bucket, newKey, true);
            if (copyRet.Code != (int)HttpCode.OK)
            {
                Assert.Fail("copy error: " + copyRet.ToString());
            }
            Console.WriteLine(copyRet.ToString());

            HttpResult moveRet = bucketManager.Move(Bucket, newKey, Bucket, "qiniu-move-target.png", true);
            if (moveRet.Code != (int)HttpCode.OK)
            {
                Assert.Fail("move error: " + moveRet.ToString());
            }
            Console.WriteLine(moveRet.ToString());
        }

        [Test]
        public void ChangeMimeTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            HttpResult ret = bucketManager.ChangeMime(Bucket, "qiniu.png", "image/x-png");
            if (ret.Code != (int)HttpCode.OK)
            {
                Assert.Fail("change mime error: " + ret.ToString());
            }
            Console.WriteLine(ret.ToString());
        }

        [Test]
        public void ChangeTypeTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            HttpResult ret = bucketManager.ChangeType(Bucket, "qiniu.png", 1);
            if (ret.Code != (int)HttpCode.OK && !ret.Text.Contains("already in line stat"))
            {
                Assert.Fail("change type error: " + ret.ToString());
            }
            Console.WriteLine(ret.ToString());
        }

        [Test]
        public void RestoreArArchiveTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);

            string newKey = "qiniu-archive-to-restore.png";
            HttpResult copyRet = bucketManager.Copy(Bucket, "qiniu.png", Bucket, newKey, true);
            if (copyRet.Code != (int)HttpCode.OK)
            {
                Assert.Fail("copy error: " + copyRet.ToString());
            }
            Console.WriteLine(copyRet.ToString());

            HttpResult changeTypeRet = bucketManager.ChangeType(Bucket, newKey, 2);
            if (changeTypeRet.Code != (int)HttpCode.OK && !changeTypeRet.Text.Contains("already in line stat"))
            {
                Assert.Fail("change type error: " + changeTypeRet.ToString());
            }

            HttpResult ret = bucketManager.RestoreAr(Bucket, newKey, 2);
            if (ret.Code != (int)HttpCode.OK && !ret.Text.Contains("already in line stat"))
            {
                Assert.Fail("change type error: " + ret.ToString());
            }
        }

        [Test]
        public void RestoreArDeepArchiveTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);

            string newKey = "qiniu-deep-archive-to-restore.png";
            HttpResult copyRet = bucketManager.Copy(Bucket, "qiniu.png", Bucket, newKey, true);
            if (copyRet.Code != (int)HttpCode.OK)
            {
                Assert.Fail("copy error: " + copyRet.ToString());
            }
            Console.WriteLine(copyRet.ToString());

            HttpResult changeTypeRet = bucketManager.ChangeType(Bucket, newKey, 3);
            if (changeTypeRet.Code != (int)HttpCode.OK && !changeTypeRet.Text.Contains("already in line stat"))
            {
                Assert.Fail("change type error: " + changeTypeRet.ToString());
            }

            HttpResult ret = bucketManager.RestoreAr(Bucket, newKey, 2);
            if (ret.Code != (int)HttpCode.OK && !ret.Text.Contains("already in line stat"))
            {
                Assert.Fail("change type error: " + ret.ToString());
            }
        }

        [Test]
        public void DeleteAfterDaysTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string newKey = "qiniu-to-copy.png";
            HttpResult copyRet = bucketManager.Copy(Bucket, "qiniu.png", Bucket, newKey, true);
            if (copyRet.Code != (int)HttpCode.OK)
            {
                Assert.Fail("copy error: " + copyRet.ToString());
            }
            Console.WriteLine(copyRet.ToString());
            HttpResult expireRet = bucketManager.DeleteAfterDays(Bucket, newKey, 7);
            if (expireRet.Code != (int)HttpCode.OK)
            {
                Assert.Fail("deleteAfterDays error: " + expireRet.ToString());
            }
            Console.WriteLine(expireRet.ToString());
        }

        [Test]
        public void SetObjectLifecycleTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string newKey = "qiniu-to-set-object-lifecycle.png";
            HttpResult copyRet = bucketManager.Copy(Bucket, "qiniu.png", Bucket, newKey, true);
            if (copyRet.Code != (int)HttpCode.OK)
            {
                Assert.Fail("copy error: " + copyRet.ToString());
            }
            Console.WriteLine(copyRet.ToString());
            HttpResult ret = bucketManager.SetObjectLifecycle(
                Bucket,
                newKey,
                10,
                20,
                30,
                40);
            if (ret.Code != (int)HttpCode.OK)
            {
                Assert.Fail("deleteAfterDays error: " + ret.ToString());
            }
            Console.WriteLine(ret.ToString());
        }

        [Test]
        public void SetObjectLifecycleCondTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string newKey = "qiniu-to-set-object-lifecycle-cond.png";

            HttpResult copyRet = bucketManager.Copy(Bucket, "qiniu.png", Bucket, newKey, true);
            if (copyRet.Code != (int)HttpCode.OK)
            {
                Assert.Fail("copy error: " + copyRet.ToString());
            }
            Console.WriteLine(copyRet.ToString());

            StatResult statRet = bucketManager.Stat(Bucket, newKey);
            if (statRet.Code != (int)HttpCode.OK)
            {
                Assert.Fail("copy error: " + statRet.ToString());
            }

            HttpResult ret = bucketManager.SetObjectLifecycle(
                Bucket,
                newKey,
                new Dictionary<string, string>
                {
                    { "hash", statRet.Result.Hash },
                    { "fsize", statRet.Result.Fsize.ToString() }
                },
                10,
                20,
                30,
                40);
            if (ret.Code != (int)HttpCode.OK)
            {
                Assert.Fail("deleteAfterDays error: " + ret.ToString());
            }
            Console.WriteLine(ret.ToString());
        }

        [Test]
        public void PrefetchTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            HttpResult ret = bucketManager.Prefetch(Bucket, "qiniu.png");
            if (ret.Code != (int)HttpCode.OK && !ret.Text.Contains("bucket source not set"))
            {
                Assert.Fail("prefetch error: " + ret.ToString());
            }
            Console.WriteLine(ret.ToString());
        }

        [Test]
        public void DomainsTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            DomainsResult ret = bucketManager.Domains(Bucket);
            if (ret.Code != (int)HttpCode.OK)
            {
                Assert.Fail("domains error: " + ret.ToString());
            }
            Console.WriteLine(ret.ToString());
        }

        [Test]
        public void BucketsTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            BucketsResult ret = bucketManager.Buckets(true);
            if (ret.Code != (int)HttpCode.OK)
            {
                Assert.Fail("buckets error: " + ret.ToString());
            }

            foreach (string bucket in ret.Result)
            {
                Console.WriteLine(bucket);
            }
        }

        [Test]
        public void FetchTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string resUrl = "http://devtools.qiniu.com/qiniu.png";
            FetchResult ret = bucketManager.Fetch(resUrl, Bucket, "qiniu-fetch.png");
            if (ret.Code != (int)HttpCode.OK)
            {
                Assert.Fail("fetch error: " + ret.ToString());
            }
            Console.WriteLine(ret.ToString());

            ret = bucketManager.Fetch(resUrl, Bucket, null);
            if (ret.Code != (int)HttpCode.OK)
            {
                Assert.Fail("fetch error: " + ret.ToString());
            }
            Console.WriteLine(ret.ToString());
        }

        [Test]
        public void ListFilesTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string prefix = "";
            string delimiter = "";
            int limit = 100;
            string marker = "";
            ListResult listRet = bucketManager.ListFiles(Bucket, prefix, marker, limit, delimiter);
            if (listRet.Code != (int)HttpCode.OK)
            {
                Assert.Fail("list files error: " + listRet.ToString());
            }
            Console.WriteLine(listRet.ToString());
        }

        [Test]
        public void ListBucketTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string prefix = "";
            string delimiter = "";
            int limit = 100;
            string marker = "";
            do
            {
                ListResult listRet = bucketManager.ListFiles(Bucket, prefix, marker, limit, delimiter);
                if (listRet.Code != (int)HttpCode.OK)
                {
                    Assert.Fail("list files error: " + listRet.ToString());
                }
                Console.WriteLine(listRet.ToString());

                marker = listRet.Result.Marker;
            } while (!string.IsNullOrEmpty(marker));
        }

        // batch stat, delete, copy, move, chtype, chgm, deleteAfterDays
        // 批量操作每次不能超过1000个指令
        [Test]
        public void BatchStatTest()
        {
            BatchCopyTest();

            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string[] keys = {
                "qiniu-0.png",
                "qiniu-1.png",
                "qiniu-2.png"
            };

            List<string> ops = new List<string>();
            foreach (string key in keys)
            {
                string op = bucketManager.StatOp(Bucket, key);
                ops.Add(op);
            }

            BatchResult ret = bucketManager.Batch(ops);
            if (ret.Code / 100 != 2)
            {
                Assert.Fail("batch error: " + ret.ToString());
            }
            foreach (BatchInfo info in ret.Result)
            {
                if (info.Code == (int)HttpCode.OK)
                {
                    Console.WriteLine("{0}, {1}, {2}, {3}, {4}", info.Data.MimeType,
                        info.Data.PutTime, info.Data.Hash, info.Data.Fsize, info.Data.FileType);
                }
                else
                {
                    Console.WriteLine(info.Data.Error);
                }
            }
        }

        [Test]
        public void BatchDeleteTest()
        {
            BatchCopyTest();

            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string[] keys = {
                "qiniu-0.png",
                "qiniu-1.png",
                "qiniu-2.png"
            };

            List<string> ops = new List<string>();
            foreach (string key in keys)
            {
                string op = bucketManager.DeleteOp(Bucket, key);
                ops.Add(op);
            }

            BatchResult ret = bucketManager.Batch(ops);
            if (ret.Code / 100 != 2)
            {
                Assert.Fail("batch error: " + ret.ToString());
            }
            foreach (BatchInfo info in ret.Result)
            {
                if (info.Code == (int)HttpCode.OK)
                {
                    Console.WriteLine("delete success");
                }
                else
                {
                    Console.WriteLine(info.Data.Error);
                }
            }
        }

        [Test]
        public void BatchCopyTest()
        {
            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string[] keys = {
                "qiniu-0.png",
                "qiniu-1.png",
                "qiniu-2.png"
            };

            List<string> ops = new List<string>();
            foreach (string key in keys)
            {
                string op = bucketManager.CopyOp(Bucket, "qiniu.png", Bucket, key, true);
                ops.Add(op);
            }

            BatchResult ret = bucketManager.Batch(ops);
            if (ret.Code / 100 != 2)
            {
                Assert.Fail("batch error: " + ret.ToString());
            }
            foreach (BatchInfo info in ret.Result)
            {
                if (info.Code == (int)HttpCode.OK)
                {
                    Console.WriteLine("copy success");
                }
                else
                {
                    Console.WriteLine(info.Data.Error);
                }
            }
        }

        [Test]
        public void BatchMoveTest()
        {
            BatchCopyTest();

            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string[] keys = {
                "qiniu-0.png",
                "qiniu-1.png",
                "qiniu-2.png"
            };

            List<string> ops = new List<string>();
            foreach (string key in keys)
            {
                string op = bucketManager.MoveOp(Bucket, key, Bucket, key + "-batch-move", true);
                ops.Add(op);
            }

            BatchResult ret = bucketManager.Batch(ops);
            if (ret.Code / 100 != 2)
            {
                Assert.Fail("batch error: " + ret.ToString());
            }
            foreach (BatchInfo info in ret.Result)
            {
                if (info.Code == (int)HttpCode.OK)
                {
                    Console.WriteLine("move success");
                }
                else
                {
                    Console.WriteLine(info.Data.Error);
                }
            }
        }

        [Test]
        public void BatchChangeMimeTest()
        {
            BatchCopyTest();

            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string[] keys = {
                "qiniu-0.png",
                "qiniu-1.png",
                "qiniu-2.png"
            };

            List<string> ops = new List<string>();
            foreach (string key in keys)
            {
                string op = bucketManager.ChangeMimeOp(Bucket, key, "image/batch-x-png");
                ops.Add(op);
            }

            BatchResult ret = bucketManager.Batch(ops);
            if (ret.Code / 100 != 2)
            {
                Assert.Fail("batch error: " + ret.ToString());
            }
            foreach (BatchInfo info in ret.Result)
            {
                if (info.Code == (int)HttpCode.OK)
                {
                    Console.WriteLine("chgm success");
                }
                else
                {
                    Console.WriteLine(info.Data.Error);
                }
            }
        }

        [Test]
        public void BatchChangeTypeTest()
        {
            BatchCopyTest();

            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string[] keys = {
                "qiniu-0.png",
                "qiniu-1.png",
                "qiniu-2.png"
            };

            List<string> ops = new List<string>();
            foreach (string key in keys)
            {
                string op = bucketManager.ChangeTypeOp(Bucket, key, 0);
                ops.Add(op);
            }

            BatchResult ret = bucketManager.Batch(ops);
            if (ret.Code / 100 != 2)
            {
                Assert.Fail("batch error: " + ret.ToString());
            }
            foreach (BatchInfo info in ret.Result)
            {
                if (info.Code == (int)HttpCode.OK)
                {
                    Console.WriteLine("chtype success");
                }
                else
                {
                    Console.WriteLine(info.Data.Error);
                }
            }
        }

        [Test]
        public void BatchDeleteAfterDaysTest()
        {
            BatchCopyTest();

            Config config = new Config();
            config.Zone = Zone.ZONE_CN_East;
            Mac mac = new Mac(AccessKey, SecretKey);
            BucketManager bucketManager = new BucketManager(mac, config);
            string[] keys = {
                "qiniu-0.png",
                "qiniu-1.png",
                "qiniu-2.png"
            };

            List<string> ops = new List<string>();
            foreach (string key in keys)
            {
                string op = bucketManager.DeleteAfterDaysOp(Bucket, key, 7);
                ops.Add(op);
            }

            BatchResult ret = bucketManager.Batch(ops);
            if (ret.Code / 100 != 2)
            {
                Assert.Fail("batch error: " + ret.ToString());
            }
            foreach (BatchInfo info in ret.Result)
            {
                if (info.Code == (int)HttpCode.OK)
                {
                    Console.WriteLine("deleteAfterDays success");
                }
                else
                {
                    Console.WriteLine(info.Data.Error);
                }
            }
        }
    }
}


text:
package fr.nantes.cta.one;

import fr.nantes.cta.Airway;
import fr.nantes.cta.VOR;

public class AirwayImpl implements Airway{
	private VOR _depart, _arriver;

	public AirwayImpl(VOR start, VOR stop){
		_depart = start;
		_arriver = stop;
	}

	public double getDistance() {
		return _depart.distanceTo(_arriver);
	}

	public String GetVORDepart(){
		return _depart.getName();
	}
	 public String GetVORArrive(){
		 return _arriver.getName();
	 }

	public VOR departure() {
		// TODO Auto-generated method stub
		return null;
	}

	public VOR arrival() {
		// TODO Auto-generated method stub
		return null;
	}

}

redpajama_set_name: RedPajamaGithub


text:
package org.matthewroberts.apibase.persistence.impl;

import java.io.Serializable;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.matthewroberts.apibase.domain.ApiUser;
import org.matthewroberts.apibase.persistence.ApiDao;
import org.springframework.jdbc.core.support.JdbcDaoSupport;

/**
 * The implementation of the ApiDao interface. This class should connect to a
 * data store or external API to retrieve data. It currently assembles a default
 * object for demonstration purposes.
 *
 * @author mroberts
 *
 */
public class ApiDaoImpl extends JdbcDaoSupport implements ApiDao, Serializable {

	private static final long serialVersionUID = 1L;
	protected final Log logger = LogFactory.getLog(getClass());

	/**
	 * Assembles a ApiUser object for demonstration purposes.
	 *
	 * @param email the email address of the user to retrieve
	 * @return returns a constructed ApiUser object
	 */
	public ApiUser getApiUser(String email) {

		ApiUser apiUser = new ApiUser();

		if (email.equalsIgnoreCase("apiuser@test.com")) {
			apiUser.setEmail(email);
			apiUser.setUserName("apiuser1");
			apiUser.setId(3427238913498723489L);
		} else {
			apiUser.setError(true);
		}

		return apiUser;
	}

	public boolean processApiUser(String name, String email) {

		/* Logic to persist a new user */

		return true;
	}
}


text:
/* http://www.oracle.com/technetwork/articles/servers-storage-dev/standardheaderfiles-453865.html */
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199309L
#endif

#include "hb-private.hh"

#include "hb-object-private.hh"

#ifdef HAVE_SYS_MMAN_H
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#include <sys/mman.h>
#endif /* HAVE_SYS_MMAN_H */

#include <stdio.h>
#include <errno.h>

#ifndef HB_DEBUG_BLOB
#define HB_DEBUG_BLOB (HB_DEBUG+0)
#endif

struct hb_blob_t {
  hb_object_header_t header;
  ASSERT_POD ();

  bool immutable;

  const char *data;
  unsigned int length;
  hb_memory_mode_t mode;

  void *user_data;
  hb_destroy_func_t destroy;
};

static bool _try_writable (hb_blob_t *blob);

static void
_hb_blob_destroy_user_data (hb_blob_t *blob)
{
  if (blob->destroy) {
    blob->destroy (blob->user_data);
    blob->user_data = NULL;
    blob->destroy = NULL;
  }
}

/**
 * hb_blob_create: (Xconstructor)
 * @data: (array length=length) (closure user_data) (destroy destroy) (scope notified) (transfer none): Pointer to blob data.
 * @length: Length of @data in bytes.
 * @mode: Memory mode for @data.
 * @user_data: Data parameter to pass to @destroy.
 * @destroy: Callback to call when @data is not needed anymore.
 *
 * Creates a new "blob" object wrapping @data.  The @mode parameter is used
 * to negotiate ownership and lifecycle of @data.
 *
 * Return value: New blob, or the empty blob if something failed or if @length is
 * zero.  Destroy with hb_blob_destroy().
 *
 * Since: 1.0
 **/
hb_blob_t *
hb_blob_create (const char        *data,
		unsigned int       length,
		hb_memory_mode_t   mode,
		void              *user_data,
		hb_destroy_func_t  destroy)
{
  hb_blob_t *blob;

  if (!length || !(blob = hb_object_create<hb_blob_t> ())) {
    if (destroy)
      destroy (user_data);
    return hb_blob_get_empty ();
  }

  blob->data = data;
  blob->length = length;
  blob->mode = mode;

  blob->user_data = user_data;
  blob->destroy = destroy;

  if (blob->mode == HB_MEMORY_MODE_DUPLICATE) {
    blob->mode = HB_MEMORY_MODE_READONLY;
    if (!_try_writable (blob)) {
      hb_blob_destroy (blob);
      return hb_blob_get_empty ();
    }
  }

  return blob;
}

/**
 * hb_blob_create_sub_blob:
 * @parent: Parent blob.
 * @offset: Start offset of sub-blob within @parent, in bytes.
 * @length: Length of sub-blob.
 *
 * Returns a blob that represents a range of bytes in @parent.  The new
 * blob is always created with %HB_MEMORY_MODE_READONLY, meaning that it
 * will never modify data in the parent blob.  The parent data is not
 * expected to be modified, and will result in undefined behavior if it
 * is.
 *
 * Makes @parent immutable.
 *
 * Return value: New blob, or the empty blob if something failed or if
 * @length is zero or @offset is beyond the end of @parent's data.  Destroy
 * with hb_blob_destroy().
 *
 * Since: 1.0
 **/
hb_blob_t *
hb_blob_create_sub_blob (hb_blob_t    *parent,
			 unsigned int  offset,
			 unsigned int  length)
{
  hb_blob_t *blob;

  if (!length || offset >= parent->length)
    return hb_blob_get_empty ();

  hb_blob_make_immutable (parent);

  blob = hb_blob_create (parent->data + offset,
			 MIN (length, parent->length - offset),
			 HB_MEMORY_MODE_READONLY,
			 hb_blob_reference (parent),
			 (hb_destroy_func_t) hb_blob_destroy);

  return blob;
}

/**
 * hb_blob_get_empty:
 *
 * Returns the singleton empty blob.
 *
 * See TODO:link object types for more information.
 *
 * Return value: (transfer full): the empty blob.
 *
 * Since: 1.0
 **/
hb_blob_t *
hb_blob_get_empty (void)
{
  static const hb_blob_t _hb_blob_nil = {
    HB_OBJECT_HEADER_STATIC,

    true, /* immutable */

    NULL, /* data */
    0, /* length */
    HB_MEMORY_MODE_READONLY, /* mode */

    NULL, /* user_data */
    NULL  /* destroy */
  };

  return const_cast<hb_blob_t *> (&_hb_blob_nil);
}

/**
 * hb_blob_reference: (skip)
 * @blob: a blob.
 *
 * Increases the reference count on @blob.
 *
 * See TODO:link object types for more information.
 *
 * Return value: @blob.
 *
 * Since: 1.0
 **/
hb_blob_t *
hb_blob_reference (hb_blob_t *blob)
{
  return hb_object_reference (blob);
}

/**
 * hb_blob_destroy: (skip)
 * @blob: a blob.
 *
 * Descreases the reference count on @blob, and if it reaches zero, destroys
 * @blob, freeing all memory, possibly calling the destroy-callback the blob
 * was created for if it has not been called already.
 *
 * See TODO:link object types for more information.
 *
 * Since: 1.0
 **/
void
hb_blob_destroy (hb_blob_t *blob)
{
  if (!hb_object_destroy (blob)) return;

  _hb_blob_destroy_user_data (blob);

  free (blob);
}

/**
 * hb_blob_set_user_data: (skip)
 * @blob: a blob.
 * @key: key for data to set.
 * @data: data to set.
 * @destroy: callback to call when @data is not needed anymore.
 * @replace: whether to replace an existing data with the same key.
 *
 * Return value:
 *
 * Since: 1.0
 **/
hb_bool_t
hb_blob_set_user_data (hb_blob_t          *blob,
		       hb_user_data_key_t *key,
		       void *              data,
		       hb_destroy_func_t   destroy,
		       hb_bool_t           replace)
{
  return hb_object_set_user_data (blob, key, data, destroy, replace);
}

/**
 * hb_blob_get_user_data: (skip)
 * @blob: a blob.
 * @key: key for data to get.
 *
 *
 *
 * Return value: (transfer none):
 *
 * Since: 1.0
 **/
void *
hb_blob_get_user_data (hb_blob_t          *blob,
		       hb_user_data_key_t *key)
{
  return hb_object_get_user_data (blob, key);
}

/**
 * hb_blob_make_immutable:
 * @blob: a blob.
 *
 *
 *
 * Since: 1.0
 **/
void
hb_blob_make_immutable (hb_blob_t *blob)
{
  if (hb_object_is_inert (blob))
    return;

  blob->immutable = true;
}

/**
 * hb_blob_is_immutable:
 * @blob: a blob.
 *
 *
 *
 * Return value: TODO
 *
 * Since: 1.0
 **/
hb_bool_t
hb_blob_is_immutable (hb_blob_t *blob)
{
  return blob->immutable;
}

/**
 * hb_blob_get_length:
 * @blob: a blob.
 *
 *
 *
 * Return value: the length of blob data in bytes.
 *
 * Since: 1.0
 **/
unsigned int
hb_blob_get_length (hb_blob_t *blob)
{
  return blob->length;
}

/**
 * hb_blob_get_data:
 * @blob: a blob.
 * @length: (out):
 *
 *
 *
 * Returns: (transfer none) (array length=length):
 *
 * Since: 1.0
 **/
const char *
hb_blob_get_data (hb_blob_t *blob, unsigned int *length)
{
  if (length)
    *length = blob->length;

  return blob->data;
}

/**
 * hb_blob_get_data_writable:
 * @blob: a blob.
 * @length: (out): output length of the writable data.
 *
 * Tries to make blob data writable (possibly copying it) and
 * return pointer to data.
 *
 * Fails if blob has been made immutable, or if memory allocation
 * fails.
 *
 * Returns: (transfer none) (array length=length): Writable blob data,
 * or %NULL if failed.
 *
 * Since: 1.0
 **/
char *
hb_blob_get_data_writable (hb_blob_t *blob, unsigned int *length)
{
  if (!_try_writable (blob)) {
    if (length)
      *length = 0;

    return NULL;
  }

  if (length)
    *length = blob->length;

  return const_cast<char *> (blob->data);
}

static hb_bool_t
_try_make_writable_inplace_unix (hb_blob_t *blob)
{
#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MPROTECT)
  uintptr_t pagesize = -1, mask, length;
  const char *addr;

#if defined(HAVE_SYSCONF) && defined(_SC_PAGE_SIZE)
  pagesize = (uintptr_t) sysconf (_SC_PAGE_SIZE);
#elif defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
  pagesize = (uintptr_t) sysconf (_SC_PAGESIZE);
#elif defined(HAVE_GETPAGESIZE)
  pagesize = (uintptr_t) getpagesize ();
#endif

  if ((uintptr_t) -1L == pagesize) {
    DEBUG_MSG_FUNC (BLOB, blob, "failed to get pagesize: %s", strerror (errno));
    return false;
  }
  DEBUG_MSG_FUNC (BLOB, blob, "pagesize is %lu", (unsigned long) pagesize);

  mask = ~(pagesize-1);
  addr = (const char *) (((uintptr_t) blob->data) & mask);
  length = (const char *) (((uintptr_t) blob->data + blob->length + pagesize-1) & mask)  - addr;
  DEBUG_MSG_FUNC (BLOB, blob,
		  "calling mprotect on [%p..%p] (%lu bytes)",
		  addr, addr+length, (unsigned long) length);
  if (-1 == mprotect ((void *) addr, length, PROT_READ | PROT_WRITE)) {
    DEBUG_MSG_FUNC (BLOB, blob, "mprotect failed: %s", strerror (errno));
    return false;
  }

  blob->mode = HB_MEMORY_MODE_WRITABLE;

  DEBUG_MSG_FUNC (BLOB, blob,
		  "successfully made [%p..%p] (%lu bytes) writable\n",
		  addr, addr+length, (unsigned long) length);
  return true;
#else
  return false;
#endif
}

static bool
_try_writable_inplace (hb_blob_t *blob)
{
  DEBUG_MSG_FUNC (BLOB, blob, "making writable inplace\n");

  if (_try_make_writable_inplace_unix (blob))
    return true;

  DEBUG_MSG_FUNC (BLOB, blob, "making writable -> FAILED\n");

  /* Failed to make writable inplace, mark that */
  blob->mode = HB_MEMORY_MODE_READONLY;
  return false;
}

static bool
_try_writable (hb_blob_t *blob)
{
  if (blob->immutable)
    return false;

  if (blob->mode == HB_MEMORY_MODE_WRITABLE)
    return true;

  if (blob->mode == HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE && _try_writable_inplace (blob))
    return true;

  if (blob->mode == HB_MEMORY_MODE_WRITABLE)
    return true;

  DEBUG_MSG_FUNC (BLOB, blob, "current data is -> %p\n", blob->data);

  char *new_data;

  new_data = (char *) malloc (blob->length);
  if (unlikely (!new_data))
    return false;

  DEBUG_MSG_FUNC (BLOB, blob, "dupped successfully -> %p\n", blob->data);

  memcpy (new_data, blob->data, blob->length);
  _hb_blob_destroy_user_data (blob);
  blob->mode = HB_MEMORY_MODE_WRITABLE;
  blob->data = new_data;
  blob->user_data = new_data;
  blob->destroy = free;

  return true;
}


text:
import { Action } from '@ngrx/store';
import { ActionWithPayload } from './../action-with-payload.interface';
import { BudgetItem } from './budget-item.model';

export const CREATE_BUDGET_ITEM = 'CREATE_BUDGET_ITEM';

export function budgetItemReducer(state = [], action: ActionWithPayload<BudgetItem>) {
    switch (action.type) {
        case CREATE_BUDGET_ITEM:
            return [ action.payload, ...state ];
        default:
            return state;
    }
}


text:
#ifndef CCPPBRASIL_SOAMAP_H
#define CCPPBRASIL_SOAMAP_H

#include <vector>
#include <boost/iterator/counting_iterator.hpp>

namespace ccppbrasil {

template< class KeyType,
		  class ValueType,
		  class KeyCompare = std::less< KeyType >,
		  class KeyAllocator = std::allocator< KeyType >,
		  class ValueAllocator = std::allocator< ValueType > >
class soa_map;

template< class KeyType,
          class ValueType,
          class KeyCompare,
          class KeyAllocator,
          class ValueAllocator >
class soa_pair
{
public:
    typedef soa_pair< KeyType, ValueType, KeyCompare, KeyAllocator, ValueAllocator > my_type;
    typedef soa_map< KeyType, ValueType, KeyCompare, KeyAllocator, ValueAllocator > value_type;

    soa_pair( value_type& obj, size_t pos );
    soa_pair( const soa_pair& other ) = default;
    soa_pair( soa_pair&& other );
    my_type& operator=( soa_pair&& other );
    bool operator<( const my_type& other ) const;

    const KeyType& key() const;

    ValueType& value();
    const ValueType& value() const;

private:
    value_type& soa_map_;
    size_t pos_;
};

template< class KeyType,
		  class ValueType,
		  class KeyCompare,
		  class KeyAllocator,
		  class ValueAllocator >
class soa_iterator : public boost::counting_iterator<size_t>
{
public:
    typedef soa_map< KeyType, ValueType, KeyCompare, KeyAllocator, ValueAllocator > value_type;
    typedef soa_pair< KeyType, ValueType, KeyCompare, KeyAllocator, ValueAllocator > ref_type;

    soa_iterator( value_type& obj, size_t pos );
    soa_iterator( const soa_iterator& other ) = default;
    soa_iterator& operator=( const soa_iterator& other ) = default;
    soa_iterator& operator=( soa_iterator&& other );

    void swap( soa_iterator& other );

    const KeyType& key() const;

    ValueType& value();
    const ValueType& value() const;

    ref_type operator*();
    ref_type operator*() const;

    ref_type operator->();
    ref_type operator->() const;

private:
    value_type& soa_map_;
};

template< class KeyType,
		  class ValueType,
		  class KeyCompare,
		  class KeyAllocator,
		  class ValueAllocator >
class soa_map
{
public:
   	typedef soa_iterator<KeyType, ValueType, KeyCompare, KeyAllocator, ValueAllocator >            iterator;
   	typedef const soa_iterator<KeyType, ValueType, KeyCompare, KeyAllocator, ValueAllocator >      const_iterator;

	void reserve( size_t capacity );
	size_t size() const;
	bool empty() const;
	void clear();

	bool insert( const std::pair< KeyType, ValueType > &keyValuePair );

    bool emplace( KeyType && moveKey, ValueType && value );

	iterator erase( const KeyType &key );

	void swap( soa_map &other );

	const KeyType& keyAtIndex( size_t index ) const;

	ValueType& atIndex( size_t index );
	const ValueType& atIndex( size_t index ) const;

	ValueType& at( const KeyType & key );
	const ValueType& at( const KeyType & key ) const;

	ValueType& operator[]( const KeyType &key );

	iterator begin();
	const_iterator begin() const;

	iterator end();
	const_iterator end() const;

	iterator lower_bound( const KeyType &key );
	const_iterator lower_bound( const KeyType &key ) const;

	iterator upper_bound( const KeyType &key );
	const_iterator upper_bound( const KeyType &key ) const;

	iterator find( const KeyType &key );
	const_iterator find( const KeyType &key ) const;

private:
    typedef std::vector< KeyType, KeyAllocator > key_container_type;
    typedef std::vector< ValueType, ValueAllocator > value_container_type;

    friend class soa_iterator<KeyType, ValueType, KeyCompare, KeyAllocator, ValueAllocator >;

    key_container_type key_container_;
    value_container_type value_container_;
};

}

namespace std {

template< class KeyType, class ValueType, class KeyCompare, class KeyAllocator, class ValueAllocator >
void swap( ::ccppbrasil::soa_pair< KeyType, ValueType, KeyCompare, KeyAllocator, ValueAllocator >& lhs,
           ::ccppbrasil::soa_pair< KeyType, ValueType, KeyCompare, KeyAllocator, ValueAllocator >& rhs );

}

#include "soa_map-impl.h"

#endif // CCPPBRASIL_SOAMAP_H


text:
require 'highline/import'
require 'erb'

# Require our stack
Dir[File.join(File.dirname(__FILE__), 'stack', '*.rb')].each do |lib|
  require lib
end

policy :watchdog_stack, :roles => :provision do
  requires :ruby_enterprise
  requires :nginx_passenger
  requires :nginx_conf
  requires :nginx_init
  requires :git
  requires :monit
  requires :monit_conf
  requires :monit_init
  requires :rack
  requires :sinatra
  requires :sqlite
  requires :sqlite_driver
end

deployment do
  # mechanism for deployment
  delivery :capistrano do
    begin
      recipes 'Capfile'
    rescue LoadError
      recipes 'deploy'
    end

    default_run_options[:pty] = true
    set :use_sudo, true
    role :provision, ask("Enter the IP address or hostname to provision: ")
    set :user, ask("Enter your username on the host to provision: ") { |q| q.default = ENV['USER'] }
  end

  # source based package installer defaults
  source do
    prefix   '/usr/local'
    archives '/usr/local/sources'
    builds   '/usr/local/build'
  end
end

# Depend on a specific version of sprinkle
begin
  gem 'sprinkle', ">= 0.2.6"
rescue Gem::LoadError
  puts "sprinkle 0.2.6 required.\n Run: `gem install sprinkle`"
  exit
end


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="25dp"
    android:layout_marginLeft="25dp"
    android:layout_marginRight="25dp"
    android:layout_marginTop="50dp"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    tools:context="com.app.swe443.openbankapp.LoginActivity">

    <FrameLayout
        android:id="@+id/contentFragment"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1">
        <!-- Login progress -->
        <ProgressBar
            android:id="@+id/login_progress"
            style="?android:attr/progressBarStyleLarge"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginBottom="8dp"
            android:visibility="gone" />

        <!--<ScrollView-->
        <!--android:id="@+id/login_form"-->
        <!--android:layout_marginTop="30dp"-->
        <!--android:layout_width="match_parent"-->
        <!--android:layout_height="match_parent">-->

        <LinearLayout
            android:id="@+id/username_login_form"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="150dp"
                android:layout_gravity="center"
                android:src="@drawable/ic_action_bank_logo"
                android:tint="@color/colorAccent" />

            <android.support.design.widget.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <AutoCompleteTextView
                    android:id="@+id/username"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="Username"
                    android:inputType="text"
                    android:maxLines="1"
                    android:imeOptions="actionNext"
                    android:singleLine="true" />

            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <EditText
                    android:id="@+id/password"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/prompt_password"
                    android:imeActionId="@+id/login"
                    android:imeActionLabel="@string/action_sign_in_short"
                    android:imeOptions="actionUnspecified"
                    android:inputType="textPassword"
                    android:maxLines="1"
                    android:singleLine="true" />

            </android.support.design.widget.TextInputLayout>

            <TextView
                style="?android:textAppearanceSmall"
                android:id="@+id/forgotPass"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Forgot Password"
                android:textColor="#0b3c5d" />

            <Button
                android:id="@+id/username_sign_in_button"
                style="?android:textAppearanceSmall"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="30dp"
                android:background="#0b3c5d"
                android:paddingLeft="50dp"
                android:paddingRight="50dp"
                android:text="@string/action_sign_in"
                android:textStyle="bold" />

            <Button
                android:id="@+id/register"
                style="?android:textAppearanceSmall"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="30dp"
                android:background="#0b3c5d"
                android:paddingLeft="50dp"
                android:paddingRight="50dp"
                android:text="Register"
                android:textStyle="bold" />

        </LinearLayout>
        <!--</ScrollView>-->
    </FrameLayout>
</LinearLayout>


text:
<?php

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */

// LICENSE AGREEMENT. If folded, press za here to unfold and read license {{{

/**
* +-----------------------------------------------------------------------------+
* | Copyright (c) 2004-2006 Sergio Goncalves Carvalho                                |
* +-----------------------------------------------------------------------------+
* | This file is part of XML_RPC2.                                              |
* |                                                                             |
* | XML_RPC2 is free software; you can redistribute it and/or modify            |
* | it under the terms of the GNU Lesser General Public License as published by |
* | the Free Software Foundation; either version 2.1 of the License, or         |
* | (at your option) any later version.                                         |
* |                                                                             |
* | XML_RPC2 is distributed in the hope that it will be useful,                 |
* | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
* | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
* | GNU Lesser General Public License for more details.                         |
* |                                                                             |
* | You should have received a copy of the GNU Lesser General Public License    |
* | along with XML_RPC2; if not, write to the Free Software                     |
* | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                    |
* | 02111-1307 USA                                                              |
* +-----------------------------------------------------------------------------+
* | Author: Sergio Carvalho <sergio.carvalho@portugalmail.com>                  |
* +-----------------------------------------------------------------------------+
*
* @category   XML
* @package    XML_RPC2
* @author     Sergio Carvalho <sergio.carvalho@portugalmail.com>
* @copyright  2004-2006 Sergio Carvalho
* @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
* @version    CVS: $Id: Client.php,v 1.14 2008/09/10 18:50:31 sergiosgc Exp $
* @link       http://pear.php.net/package/XML_RPC2
*/

// }}}

// dependencies {{{
require_once 'XML/RPC2/Exception.php';
require_once 'XML/RPC2/Backend.php';
// }}}

/**
 * XML_RPC client class. Use this class to access remote methods.
 *
 * To use this class, construct it providing the server URL and method prefix.
 * Then, call remote methods on the new instance as if they were local.
 *
 * Example:
 *
 *  require_once 'XML_RPC2/Client.php';
 *
 *  $client = XML_RPC2_Client('http://xmlrpc.example.com/1.0/', 'example.');
 *  $result = $client->hello('Sergio');
 *  print($result);
 *
 *
 * The above example will call the example.hello method on the xmlrpc.example.com
 * server, under the /1.0/ URI.
 *
 * @category   XML
 * @package    XML_RPC2
 * @author     Sergio Carvalho <sergio.carvalho@portugalmail.com>
 * @copyright  2004-2006 Sergio Carvalho
 * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
 * @link       http://pear.php.net/package/XML_RPC2
 */
abstract class XML_RPC2_Client
{
    const VERSION = '1.0.4';
    // {{{ properties

    /**
     * uri Field (holds the uri for the XML_RPC server)
     *
     * @var string
     */
    protected $uri = null;

    /**
     * proxy Field (holds the proxy server data)
     *
     * @var string
     */
    protected $proxy = null;

    /**
     * Holds the prefix to prepend to method names
     *
     * @var string
     */
    protected $prefix = null;

    /**
     * Holds the debug flag
     *
     * @var boolean
     */
    protected $debug = false;

    /**
     * Hold the encoding of the client request
     *
     * @var string
     */
    protected $encoding = 'iso-8859-1';

    /**
     * Hold the SSL verify flag
     *
     * @var boolean
     */
    protected $sslverify = true;

    // }}}
    // {{{ remoteCall___()

    /**
     * ugly hack flag to avoid http://bugs.php.net/bug.php?id=21949
     *
     * see XML_RPC2_Backend_Xmlrpcext_Value::createFromNative() from more infos
     */
    protected $uglyStructHack = true;

    /**
     * remoteCall executes the XML-RPC call, and returns the result
     *
     * NB : The '___' at the end of the method name is to avoid collisions with
     * XMLRPC __call()
     *
     * @param   string      Method name
     * @param   array       Parameters
     */
    public abstract function remoteCall___($methodName, $parameters);

    // }}}
    // {{{ constructor

    /**
     * Construct a new XML_RPC2_Client.
     *
     * To create a new XML_RPC2_Client, a URI must be provided (e.g. http://xmlrpc.example.com/1.0/).
     * Optionally, some options may be set as an associative array. Accepted keys are :
     * 'prefix', 'proxy', 'debug' => see correspondant property to get more informations
     *
     * @param string URI for the XML-RPC server
     * @param array (optional) Associative array of options
     */
    protected function __construct($uri, $options = array())
    {
        if (!$uriParse = parse_url($uri)) {
            throw new XML_RPC2_InvalidUriException(sprintf('Client URI \'%s\' is not valid', $uri));
        }
        $this->uri = $uri;
        if (isset($options['prefix'])) {
            if (!($this->testMethodName___($options['prefix']))) {
                throw new XML_RPC2_InvalidPrefixException(sprintf('Prefix \'%s\' is not valid', $options['prefix']));
            }
            $this->prefix = $options['prefix'];
        }
        if (isset($options['proxy'])) {
            if (!$proxyParse = parse_url($options['proxy'])) {
                throw new XML_RPC2_InvalidProxyException(sprintf('Proxy URI \'%s\' is not valid', $options['proxy']));
            }
            $this->proxy = $options['proxy'];
        }
        if (isset($options['debug'])) {
            if (!(is_bool($options['debug']))) {
                throw new XML_RPC2_InvalidDebugException(sprintf('Debug \'%s\' is not valid', $options['debug']));
            }
            $this->debug = $options['debug'];
        }
        if (isset($options['encoding'])) {
            // TODO : control & exception
            $this->encoding = $options['encoding'];
        }
        if (isset($options['uglyStructHack'])) {
            $this->uglyStructHack = $options['uglyStructHack'];
        }
        if (isset($options['sslverify'])) {
            if (!(is_bool($options['sslverify']))) {
                throw new XML_RPC2_InvalidSslverifyException(sprintf('SSL verify \'%s\' is not valid', $options['sslverify']));
            }
            $this->sslverify = $options['sslverify'];
        }
    }

    // }}}
    // {{{ create()

    /**
     * Factory method to select, create and return a XML_RPC2_Client backend
     *
     * To create a new XML_RPC2_Client, a URI must be provided (e.g. http://xmlrpc.example.com/1.0/).
     *
     * Optionally, some options may be set.
     *
     * @param string URI for the XML-RPC server
     * @param array (optional) associative array of options (see constructor)
     */
    public static function create($uri, $options = array())
    {
        if (isset($options['backend'])) {
            XML_RPC2_Backend::setBackend($options['backend']);
        }
        $backend = XML_RPC2_Backend::getClientClassname();
        return new $backend($uri, $options);
    }

    // }}}
    // {{{ __call()

    /**
     * __call Catchall. This method catches remote method calls and provides for remote forwarding.
     *
     * If the parameters are native types, this method will use XML_RPC_Value::createFromNative to
     * convert it into an XML-RPC type. Whenever a parameter is already an instance of XML_RPC_Value
     * it will be used as provided. It follows that, in situations when XML_RPC_Value::createFromNative
     * proves inacurate -- as when encoding DateTime values -- you should present an instance of
     * XML_RPC_Value in lieu of the native parameter.
     *
     * @param   string      Method name
     * @param   array       Parameters
     * @return  mixed       The call result, already decoded into native types
     */
    public function __call($methodName, $parameters)
    {
        $args = array($methodName, $parameters);
        return @call_user_func_array(array($this, 'remoteCall___'), $args);
    }

    // }}}
    // {{{ displayDebugInformations___()

    /**
     * Display debug informations
     *
     * NB : The '___' at the end of the method name is to avoid collisions with
     * XMLRPC __call()
     *
     * @param string $request XML client request
     * @param string $body XML server response
     */
    protected function displayDebugInformations___($request, $body)
    {
        print '
';
        print "***** Request *****\n";
        print htmlspecialchars($request);
        print "***** End Of request *****\n\n";
        print "***** Server response *****\n";
        print htmlspecialchars($body);
        print "\n***** End of server response *****\n\n";
    }

    // }}}
    // {{{ displayDebugInformations2___()

    /**
     * Display debug informations (part 2)
     *
     * NB : The '___' at the end of the method name is to avoid collisions with
     * XMLRPC __call()
     *
     * @param mixed $result decoded server response
     */
    protected function displayDebugInformations2___($result)
    {
        print "***** Decoded result *****\n";
        print_r($result);
        print "\n***** End of decoded result *****";
        print '
';
    }

    // }}}
    // {{{ testMethodName___()

    /**
     * Return true is the given method name is ok with XML/RPC spec.
     *
     * NB : The '___' at the end of the method name is to avoid collisions with
     * XMLRPC __call()
     *
     * @param string $methodName method name
     * @return boolean true if ok
     */
    protected function testMethodName___($methodName)
    {
        return (preg_match('~^[a-zA-Z0-9_.:/]*$~', $methodName));
    }

}

?>


text:
from __pyjamas__ import get_main_frame, doc, JS

sNextHashId = 0

def getNextHashId():
    global sNextHashId
    sNextHashId += 1
    return sNextHashId

def getHashCode(o):
    JS("""
    return (@{{o}} == null) ? 0 :
        (@{{o}}.$H ? @{{o}}.$H : (@{{o}}.$H = @{{!pygwt_getNextHashId}}()))
    """)

def getModuleName():
    import os
    import sys
    mod_name = sys.argv[0]
    mod_name = os.path.split(mod_name)[1]
    mod_name = os.path.spliext(mod_name)[0]
    return mod_name

def getModuleBaseURL():
    import os.path

    # get original app base
    s = get_main_frame().getUri()

    # pull out the directory part
    s = os.path.dirname(s)

    if len(s) > 0:
        return s + "/"
    return ""

def getImageBaseURL(images=False):
    import pyjd

    if images:
        if isinstance(images, str):
            return getModuleBaseURL() + images + '/'
        else:
            return getModuleBaseURL() + "images/"
    else:
        return getModuleBaseURL()


text:
echo "ngrok v2 running with the following settings:"
echo "subdomain: ${NGROK_SUBDOMAIN}"
echo "foward host: ${NGROK_FORWARD_HOST}"
echo "port: ${NGROK_PORT}"

./ngrok http -subdomain=${NGROK_SUBDOMAIN} ${NGROK_FORWARD_HOST}:${NGROK_PORT}


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Text.RegularExpressions;
using Xunit;

public class R2LGetGroupNamesMatchTests
{
    /*
    Tested Methods:

        public static Boolean RightToLeft;

        public static String[] GetGroupNames();     "(?<first_name>\\S+)\\s(?<last_name>\\S+)"

        public static Match Match(string input);
            "David Bau"

        public static Boolean IsMatch(string input);     //D+
            "12321"

    */

    [Fact]
    public static void R2LGetGroupNamesMatch()
    {
        //////////// Global Variables used for all tests
        String strLoc = "Loc_000oo";
        String strValue = String.Empty;
        int iCountErrors = 0;
        int iCountTestcases = 0;
        Regex r;
        Match m;
        String s;
        String[] names;
        try
        {
            /////////////////////////  START TESTS ////////////////////////////
            ///////////////////////////////////////////////////////////////////
            s = "David Bau";
            r = new Regex("(?<first_name>\\S+)\\s(?<last_name>\\S+)");
            // [] public static String[] GetGroupNames();     "(?<first_name>\\S+)\\s(?<last_name>\\S+)"
            //-----------------------------------------------------------------
            strLoc = "Loc_498yg";
            iCountTestcases++;
            names = r.GetGroupNames();
            if (!names[0].Equals("0"))
            {
                iCountErrors++;
                Console.WriteLine("Err_234fsadg! unexpected result");
            }

            if (!names[1].Equals("first_name"))
            {
                iCountErrors++;
                Console.WriteLine("Err_234fsadg! unexpected result");
            }

            if (!names[2].Equals("last_name"))
            {
                iCountErrors++;
                Console.WriteLine("Err_234fsadg! unexpected result");
            }

            // [] public static Match Match(string input);
            //"David Bau"
            //-----------------------------------------------------------------
            strLoc = "Loc_563sdfg";
            iCountTestcases++;
            m = r.Match(s);
            if (!m.Success)
            {
                iCountErrors++;
                Console.WriteLine("Err_87543! doesnot match");
            }

            // [] public static Match Match(string input);
            //"David Bau"
            //-----------------------------------------------------------------
            strLoc = "Loc_298vy";
            iCountTestcases++;
            s = "12321";
            r = new Regex(@"\D+");
            if (r.IsMatch(s))
            {
                iCountErrors++;
                Console.WriteLine("Err_fsdf! doesnot match");
            }
            ///////////////////////////////////////////////////////////////////
            /////////////////////////// END TESTS /////////////////////////////
        }
        catch (Exception exc_general)
        {
            ++iCountErrors;
            Console.WriteLine("Error Err_8888yyy!  strLoc==" + strLoc + ", exc_general==" + exc_general.ToString());
        }
    }
}


text:
using namespace std;

// =======================================================================================
//                                      XAudio2Exception
// =======================================================================================

///---------------------------------------------------------------------------------------
/// \brief	Handles the possible exceptions sent from XAudio2
///
/// # XAudio2Exception
/// Detailed description.....
/// Created on: 6-12-2012
///---------------------------------------------------------------------------------------

class XAudio2Exception : public exception
{
public:
	XAudio2Exception( HRESULT p_hresult, const string &p_file, const string &p_func,
		int p_line)
	{
		LPSTR errTxt = NULL;
		FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER |
			FORMAT_MESSAGE_IGNORE_INSERTS, NULL, p_hresult, MAKELANGID(LANG_NEUTRAL,
			SUBLANG_DEFAULT), (LPSTR)&errTxt, 0, NULL);
		if (errTxt!=NULL)
			SetMsg(toString(errTxt),p_file,p_func,p_line);
		else
			SetMsg("Unknown HRESULT error! \n",p_file,p_func,p_line);
	}
	XAudio2Exception( HRESULT p_hresult, const string &p_filePath, const string &p_file,
		const string &p_func, int p_line)
	{
		LPSTR errTxt = NULL;
		FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER |
			FORMAT_MESSAGE_IGNORE_INSERTS, NULL, p_hresult, MAKELANGID(LANG_NEUTRAL,
			SUBLANG_DEFAULT), (LPSTR)&errTxt, 0, NULL);
		if (errTxt!=NULL)
			SetMsg(toString(errTxt)+p_filePath,p_file,p_func,p_line);
		else
			SetMsg("Unknown HRESULT error! \n",p_file,p_func,p_line);
	}
	XAudio2Exception( const string& p_message, const string& p_file, const string& p_func,
		int p_line)
	{
		SetMsg(p_message,p_file,p_func,p_line);
	}
	virtual const char* what() const throw()
	{
		return m_msg.c_str();
	}

private:
	///-----------------------------------------------------------------------------------
	/// Sets the layout and contents of the error message
	/// \param p_msg
	/// \param p_file
	/// \param p_func
	/// \param p_line
	/// \return void
	///-----------------------------------------------------------------------------------
	void SetMsg(const string &p_msg,const string &p_file,const string &p_func,int p_line)
	{
		m_msg = "\nXAudio2 Error: ";
		m_msg.append(p_msg);
		m_msg.append(" > ");
		m_msg.append(p_file);
		m_msg.append(" : ");
		m_msg.append(p_func);
		m_msg.append(" line ");
		m_msg.append(toString(p_line));
		m_msg.append("\n\n");
	}

	string m_msg;
};


text:
package org.b3log.symphony.service;

import org.apache.commons.lang.time.DateUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.repository.Query;
import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.repository.SortDirection;
import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.CollectionUtils;
import org.b3log.latke.util.Stopwatchs;
import org.b3log.symphony.model.Pointtransfer;
import org.b3log.symphony.model.UserExt;
import org.b3log.symphony.repository.PointtransferRepository;
import org.b3log.symphony.repository.UserRepository;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Activity query service.
 *
 * @author Liang Ding
 * @version 1.5.1.6, May 27, 2018
 * @since 1.3.0
 */
@Service
public class ActivityQueryService {

    /**
     * Logger.
     */
    private static final Logger LOGGER = Logger.getLogger(ActivityQueryService.class);

    /**
     * Pointtransfer repository.
     */
    @Inject
    private PointtransferRepository pointtransferRepository;

    /**
     * User repository.
     */
    @Inject
    private UserRepository userRepository;

    /**
     * Pointtransfer query service.
     */
    @Inject
    private PointtransferQueryService pointtransferQueryService;

    /**
     * Avatar query service.
     */
    @Inject
    private AvatarQueryService avatarQueryService;

    /**
     * Gets average point of activity eating snake of a user specified by the given user id.
     *
     * @param userId the given user id
     * @return average point, if the point small than {@code 1}, returns {@code pointActivityEatingSnake} which
     * configured in sym.properties
     */
    public int getEatingSnakeAvgPoint(final String userId) {
        return pointtransferRepository.getActivityEatingSnakeAvg(userId);
    }

    /**
     * Gets the top eating snake users (single game max) with the specified fetch size.
     *
     * @param avatarViewMode the specified avatar view mode
     * @param fetchSize      the specified fetch size
     * @return users, returns an empty list if not found
     */
    public List<JSONObject> getTopEatingSnakeUsersMax(final int avatarViewMode, final int fetchSize) {
        final List<JSONObject> ret = new ArrayList<>();

        try {
            final List<JSONObject> users = userRepository.select("SELECT\n"
                    + "	u.*, MAX(sum) AS point\n"
                    + "FROM\n"
                    + "	" + pointtransferRepository.getName() + " AS p,\n"
                    + "	" + userRepository.getName() + " AS u\n"
                    + "WHERE\n"
                    + "	p.toId = u.oId\n"
                    + "AND type = 27\n"
                    + "GROUP BY\n"
                    + "	toId\n"
                    + "ORDER BY\n"
                    + "	point DESC\n"
                    + "LIMIT ?", fetchSize);

            for (final JSONObject user : users) {
                avatarQueryService.fillUserAvatarURL(avatarViewMode, user);

                ret.add(user);
            }
        } catch (final RepositoryException e) {
            LOGGER.log(Level.ERROR, "Gets top eating snake users error", e);
        }

        return ret;
    }

    /**
     * Gets the top eating snake users (sum) with the specified fetch size.
     *
     * @param avatarViewMode the specified avatar view mode
     * @param fetchSize      the specified fetch size
     * @return users, returns an empty list if not found
     */
    public List<JSONObject> getTopEatingSnakeUsersSum(final int avatarViewMode, final int fetchSize) {
        final List<JSONObject> ret = new ArrayList<>();

        try {
            final List<JSONObject> users = userRepository.select("SELECT\n"
                    + "	u.*, Sum(sum) AS point\n"
                    + "FROM\n"
                    + "	" + pointtransferRepository.getName() + " AS p,\n"
                    + "	" + userRepository.getName() + " AS u\n"
                    + "WHERE\n"
                    + "	p.toId = u.oId\n"
                    + "AND type = 27\n"
                    + "GROUP BY\n"
                    + "	toId\n"
                    + "ORDER BY\n"
                    + "	point DESC\n"
                    + "LIMIT ?", fetchSize);

            for (final JSONObject user : users) {
                avatarQueryService.fillUserAvatarURL(avatarViewMode, user);

                ret.add(user);
            }
        } catch (final RepositoryException e) {
            LOGGER.log(Level.ERROR, "Gets top eating snake users error", e);
        }

        return ret;
    }

    /**
     * Gets the top checkin users with the specified fetch size.
     *
     * @param avatarViewMode the specified avatar view mode
     * @param fetchSize      the specified fetch size
     * @return users, returns an empty list if not found
     */
    public List<JSONObject> getTopCheckinUsers(final int avatarViewMode, final int fetchSize) {
        final List<JSONObject> ret = new ArrayList<>();

        final Query query = new Query().addSort(UserExt.USER_LONGEST_CHECKIN_STREAK, SortDirection.DESCENDING).
                addSort(UserExt.USER_CURRENT_CHECKIN_STREAK, SortDirection.DESCENDING).
                setCurrentPageNum(1).setPageSize(fetchSize);

        try {
            final JSONObject result = userRepository.get(query);
            final List<JSONObject> users = CollectionUtils.jsonArrayToList(result.optJSONArray(Keys.RESULTS));

            for (final JSONObject user : users) {
                if (UserExt.USER_APP_ROLE_C_HACKER == user.optInt(UserExt.USER_APP_ROLE)) {
                    user.put(UserExt.USER_T_POINT_HEX, Integer.toHexString(user.optInt(UserExt.USER_POINT)));
                } else {
                    user.put(UserExt.USER_T_POINT_CC, UserExt.toCCString(user.optInt(UserExt.USER_POINT)));
                }

                avatarQueryService.fillUserAvatarURL(avatarViewMode, user);

                ret.add(user);
            }
        } catch (final RepositoryException e) {
            LOGGER.log(Level.ERROR, "Gets top checkin users error", e);
        }

        return ret;
    }

    /**
     * Does checkin today?
     *
     * @param userId the specified user id
     * @return {@code true} if checkin succeeded, returns {@code false} otherwise
     */
    public synchronized boolean isCheckedinToday(final String userId) {
        Stopwatchs.start("Checks checkin");
        try {
            final JSONObject user = userRepository.get(userId);
            final long time = user.optLong(UserExt.USER_CHECKIN_TIME);

            return DateUtils.isSameDay(new Date(), new Date(time));
        } catch (final Exception e) {
            LOGGER.log(Level.ERROR, "Checks checkin failed", e);

            return true;
        } finally {
            Stopwatchs.end();
        }
    }

    /**
     * Does participate 1A0001 today?
     *
     * @param userId the specified user id
     * @return {@code true} if participated, returns {@code false} otherwise
     */
    public synchronized boolean is1A0001Today(final String userId) {
        final Date now = new Date();

        final List<JSONObject> records = pointtransferQueryService.getLatestPointtransfers(userId,
                Pointtransfer.TRANSFER_TYPE_C_ACTIVITY_1A0001, 1);
        if (records.isEmpty()) {
            return false;
        }

        final JSONObject maybeToday = records.get(0);
        final long time = maybeToday.optLong(Pointtransfer.TIME);

        return DateUtils.isSameDay(now, new Date(time));
    }

    /**
     * Did collect 1A0001 today?
     *
     * @param userId the specified user id
     * @return {@code true} if collected, returns {@code false} otherwise
     */
    public synchronized boolean isCollected1A0001Today(final String userId) {
        final Date now = new Date();

        final List<JSONObject> records = pointtransferQueryService.getLatestPointtransfers(userId,
                Pointtransfer.TRANSFER_TYPE_C_ACTIVITY_1A0001_COLLECT, 1);
        if (records.isEmpty()) {
            return false;
        }

        final JSONObject maybeToday = records.get(0);
        final long time = maybeToday.optLong(Pointtransfer.TIME);

        return DateUtils.isSameDay(now, new Date(time));
    }

    /**
     * Did collect yesterday's liveness reward?
     *
     * @param userId the specified user id
     * @return {@code true} if collected, returns {@code false} otherwise
     */
    public synchronized boolean isCollectedYesterdayLivenessReward(final String userId) {
        final Date now = new Date();

        final List<JSONObject> records = pointtransferQueryService.getLatestPointtransfers(userId,
                Pointtransfer.TRANSFER_TYPE_C_ACTIVITY_YESTERDAY_LIVENESS_REWARD, 1);
        if (records.isEmpty()) {
            return false;
        }

        final JSONObject maybeToday = records.get(0);
        final long time = maybeToday.optLong(Pointtransfer.TIME);

        return DateUtils.isSameDay(now, new Date(time));
    }
}


text:
<?php

namespace Jb\Bundle\FileUploaderBundle\Service\Resolver;

use Symfony\Component\Asset\Packages;

/**
 * AssetsResolver
 *
 * @author jobou
 */
class AssetsResolver implements ResolverInterface
{
    /**
     * @var Packages
     */
    protected $assetPackages;

    /**
     * @var string
     */
    protected $directory;

    /**
     * AssetsResolver constructor.
     * @param Packages $assetPackages
     * @param $directory
     */
    public function __construct(Packages $assetPackages, $directory)
    {
        $this->assetPackages = $assetPackages;
        $this->directory = $directory;
    }

    /**
     * {@inheritdoc}
     */
    public function getUrl($key)
    {
        return $this->assetPackages->getUrl(
            trim($this->directory, '/') . '/' . $key
        );
    }
}


text:
import React from 'react';
import PropTypes from 'prop-types';
import autobind from 'core-decorators/es/autobind';
import { compose, graphql } from 'react-apollo';
import { Button, Intent, Spinner, EditableText, Dialog } from '@blueprintjs/core';
import { getArticle, setArticleTitle, editArticle } from '../../../../graphql/article';
import MarkdownEditor from '../../../../../../lib/react/components/MarkdownEditor';
import NotificationToaster from '../../../components/NotificationToaster';
import LoadingSpinner from '../../../components/LoadingSpinner';
import DeleteInstructionArticle from './DeleteInstructionArticle';

import '../../../user/scss/components/_instruction-panel.scss';
import '../../scss/components/_markdown-preview.scss';

const QueryGetArticleParams = 'title content modified modifiedBy{username}';

const QueryGetArticleOptions = {
	name: 'QueryGetArticle',
	options: (props) => {
		return {
			variables: { category: 'instructions', articleId: props.article._id }
		}
	}
}

@compose(
	graphql(getArticle(QueryGetArticleParams), QueryGetArticleOptions),
	graphql(setArticleTitle('ok'), { name: 'MutationSetArticleTitle' }),
	graphql(editArticle('ok'), { name: 'MutationEditArticle' })
)
@autobind
class InstructionArticleProfile extends React.Component {
	static propTypes = {
		article: PropTypes.shape({
			_id: PropTypes.string.isRequired,
			title: PropTypes.string.isRequired
		}).isRequired,
		refetchArticles: PropTypes.func.isRequired,
		closeProfile: PropTypes.func.isRequired
	}

	state = {
		saving: false,
		modified: false,
		titleText: this.props.article.title,
		content: null,
		showConfirmClose: false
	}

	componentDidMount() {
		this._mounted = true;
	}

	componentWillUnmount() {
		this._mounted = false;
	}

	closeProfile() {
		this.props.closeProfile();
	}

	toggleConfirmClose() {
		if (this.state.showConfirmClose) {
			this.setState({ showConfirmClose: false });
		}
		else {
			if (this.state.modified) {
				this.setState({ showConfirmClose: true });
			}
			else {
				this.closeProfile();
			}
		}
	}

	editTitle(value) {
		this.setState({ titleText: value });
	}

	confirmTitle(value) {
		if (value.length < 1) {
			this.setState({ titleText: this.props.article.title });
			NotificationToaster.show({
				intent: Intent.DANGER,
				message: 'Title cannot be empty.'
			});
		}
		else {
			const options = {
				variables: {
					articleId: this.props.article._id,
					category: 'instructions',
					newTitle: this.state.titleText
				}
			};
			this._save(this.props.MutationSetArticleTitle, options);
		}
	}

	componentDidUpdate() {
		if (!this.state.content && this.props.QueryGetArticle.getArticle) {
			this.setState({content: this.props.QueryGetArticle.getArticle.content});
		}
	}

	editContent(event) {
		this.setState({content: event.target.value, modified: true});
	}

	saveContent() {
		this.setState({modified: false});
		const options = {
			variables: {
				articleId: this.props.article._id,
				category: 'instructions',
				content: this.state.content
			}
		};
		this._save(this.props.MutationEditArticle, options);
	}

	async _save(mutation, mutationOptions) {
		try {
			this.setState({saving: true});
			await mutation(mutationOptions);

			await this.props.QueryGetArticle.refetch();
			if (this._mounted) this.setState({saving: false});
		}
		catch (e) {
			NotificationToaster.show({
				intent: Intent.DANGER,
				message: err.toString()
			});
			if (this._mounted) this.setState({saving: false});
		}
	}

	render() {
		const { loading, getArticle } = this.props.QueryGetArticle;
		let content;

		if (getArticle) {
			content = (

					<MarkdownEditor title='Article Content' content={this.state.content || this.props.QueryGetArticle.getArticle.content} onChange={this.editContent}/>

			);
		}
		else if (loading) {
			content = <LoadingSpinner/>;
		}

		return (

				<Button className='pt-minimal' intent={Intent.NONE} iconName='cross' onClick={this.toggleConfirmClose} style={{float:'right'}}/>
				<Button className='pt-minimal' intent={Intent.PRIMARY} iconName='floppy-disk' onClick={this.saveContent} style={{float:'right'}} disabled={!this.state.modified}/>
				<DeleteInstructionArticle articleId={this.props.article._id} refetchArticles={this.props.refetchArticles} closeProfile={this.closeProfile}/>
				{loading || this.state.saving ?

						<Spinner className='pt-small'/>

				: null }

					Title:

						<EditableText value={this.state.titleText} onChange={this.editTitle} onConfirm={this.confirmTitle}/>

				{content}

				{/* Confirm close dialog */}
				<Dialog isOpen={this.state.showConfirmClose} onClose={this.toggleConfirmClose} title='Unsaved changes'>

						Are you sure you want to close without saving?

							<Button intent={Intent.DANGER} className='pt-minimal' text='Close' onClick={this.closeProfile}/>
							<Button intent={Intent.PRIMARY} text='Cancel' onClick={this.toggleConfirmClose}/>

				</Dialog>

		);
	}
}

export default InstructionArticleProfile;


text:
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
(function (factory) {
    if (typeof module === 'object' && typeof module.exports === 'object') {
        var v = factory(require, exports); if (v !== undefined) module.exports = v;
    }
    else if (typeof define === 'function' && define.amd) {
        define(["require", "exports", '@angular/core', '@angular/forms', '../../config/config', '../ion', '../../util/util'], factory);
    }
})(function (require, exports) {
    "use strict";
    var core_1 = require('@angular/core');
    var forms_1 = require('@angular/forms');
    var config_1 = require('../../config/config');
    var ion_1 = require('../ion');
    var util_1 = require('../../util/util');
    /**
     * \@name SegmentButton
     * \@description
     * The child buttons of the `ion-segment` component. Each `ion-segment-button` must have a value.
     *
     * \@usage
     *
     * ```html
     * <ion-content>
     *   <!-- Segment buttons with icons -->
     *   <ion-segment [(ngModel)]="icons" color="secondary">
     *     <ion-segment-button value="camera">
     *       <ion-icon name="camera"></ion-icon>
     *     </ion-segment-button>
     *     <ion-segment-button value="bookmark">
     *       <ion-icon name="bookmark"></ion-icon>
     *     </ion-segment-button>
     *   </ion-segment>
     *
     *   <!-- Segment buttons with text -->
     *   <ion-segment [(ngModel)]="relationship" color="primary">
     *     <ion-segment-button value="friends" (ionSelect)="selectedFriends()">
     *       Friends
     *     </ion-segment-button>
     *     <ion-segment-button value="enemies" (ionSelect)="selectedEnemies()">
     *       Enemies
     *     </ion-segment-button>
     *   </ion-segment>
     * </ion-content>
     * ```
     *
     *
     * \@demo /docs/v2/demos/src/segment/
     * @see {\@link /docs/v2/components#segment Segment Component Docs}
     * @see {\@link /docs/v2/api/components/segment/Segment/ Segment API Docs}
     */
    var SegmentButton = (function () {
        /**
         * @param {?} _renderer
         * @param {?} _elementRef
         */
        function SegmentButton(_renderer, _elementRef) {
            this._renderer = _renderer;
            this._elementRef = _elementRef;
            this._disabled = false;
            /**
             * @output {SegmentButton} Emitted when a segment button has been clicked.
             */
            this.ionSelect = new core_1.EventEmitter();
        }
        Object.defineProperty(SegmentButton.prototype, "disabled", {
            /**
             * \@input {boolean} If true, the user cannot interact with this element.
             * @return {?}
             */
            get: function () {
                return this._disabled;
            },
            /**
             * @param {?} val
             * @return {?}
             */
            set: function (val) {
                this._disabled = util_1.isTrueProperty(val);
                this._setElementClass('segment-button-disabled', this._disabled);
            },
            enumerable: true,
            configurable: true
        });
        /**
         * @param {?} cssClass
         * @param {?} shouldAdd
         * @return {?}
         */
        SegmentButton.prototype._setElementClass = function (cssClass, shouldAdd) {
            this._renderer.setElementClass(this._elementRef.nativeElement, cssClass, shouldAdd);
        };
        /**
         * On click of a SegmentButton
         * @return {?}
         */
        SegmentButton.prototype.onClick = function () {
            (void 0) /* console.debug */;
            this.ionSelect.emit(this);
        };
        /**
         * @return {?}
         */
        SegmentButton.prototype.ngOnInit = function () {
            if (!util_1.isPresent(this.value)) {
                console.warn('<ion-segment-button> requires a "value" attribute');
            }
        };
        Object.defineProperty(SegmentButton.prototype, "isActive", {
            /**
             * @param {?} isActive
             * @return {?}
             */
            set: function (isActive) {
                this._renderer.setElementClass(this._elementRef.nativeElement, 'segment-activated', isActive);
                this._renderer.setElementAttribute(this._elementRef.nativeElement, 'aria-pressed', isActive);
            },
            enumerable: true,
            configurable: true
        });
        SegmentButton.decorators = [
            { type: core_1.Component, args: [{
                        selector: 'ion-segment-button',
                        template: '<ng-content></ng-content>' +
                            '

',
                        host: {
                            'tappable': '',
                            'class': 'segment-button',
                            'role': 'button'
                        },
                        encapsulation: core_1.ViewEncapsulation.None,
                    },] },
        ];
        /** @nocollapse */
        SegmentButton.ctorParameters = function () { return [
            { type: core_1.Renderer, },
            { type: core_1.ElementRef, },
        ]; };
        SegmentButton.propDecorators = {
            'value': [{ type: core_1.Input },],
            'ionSelect': [{ type: core_1.Output },],
            'disabled': [{ type: core_1.Input },],
            'onClick': [{ type: core_1.HostListener, args: ['click',] },],
        };
        return SegmentButton;
    }());
    exports.SegmentButton = SegmentButton;
    function SegmentButton_tsickle_Closure_declarations() {
        /** @type {?} */
        SegmentButton.decorators;
        /**
         * @nocollapse
         * @type {?}
         */
        SegmentButton.ctorParameters;
        /** @type {?} */
        SegmentButton.propDecorators;
        /** @type {?} */
        SegmentButton.prototype._disabled;
        /**
         * \@input {string} the value of the segment button. Required.
         * @type {?}
         */
        SegmentButton.prototype.value;
        /**
         * \@output {SegmentButton} Emitted when a segment button has been clicked.
         * @type {?}
         */
        SegmentButton.prototype.ionSelect;
        /** @type {?} */
        SegmentButton.prototype._renderer;
        /** @type {?} */
        SegmentButton.prototype._elementRef;
    }
    /**
     * \@name Segment
     * \@description
     * A Segment is a group of buttons, sometimes known as Segmented Controls, that allow the user to interact with a compact group of a number of controls.
     * Segments provide functionality similar to tabs, selecting one will unselect all others. You should use a tab bar instead of a segmented control when you want to let the user move back and forth between distinct pages in your app.
     * You could use Angular 2's `ngModel` or `FormBuilder` API. For an overview on how `FormBuilder` works, checkout [Angular 2 Forms](http://learnangular2.com/forms/), or [Angular FormBuilder](https://angular.io/docs/ts/latest/api/forms/index/FormBuilder-class.html)
     *
     *
     * ```html
     * <!-- Segment in a header -->
     * <ion-header>
     *   <ion-toolbar>
     *     <ion-segment [(ngModel)]="icons" color="secondary">
     *       <ion-segment-button value="camera">
     *         <ion-icon name="camera"></ion-icon>
     *       </ion-segment-button>
     *       <ion-segment-button value="bookmark">
     *         <ion-icon name="bookmark"></ion-icon>
     *       </ion-segment-button>
     *     </ion-segment>
     *   </ion-toolbar>
     * </ion-header>
     *
     * <ion-content>
     *   <!-- Segment in content -->
     *   <ion-segment [(ngModel)]="relationship" color="primary">
     *     <ion-segment-button value="friends" (ionSelect)="selectedFriends()">
     *       Friends
     *     </ion-segment-button>
     *     <ion-segment-button value="enemies" (ionSelect)="selectedEnemies()">
     *       Enemies
     *     </ion-segment-button>
     *   </ion-segment>
     *
     *   <!-- Segment in a form -->
     *   <form [formGroup]="myForm">
     *     <ion-segment formControlName="mapStyle" color="danger">
     *       <ion-segment-button value="standard">
     *         Standard
     *       </ion-segment-button>
     *       <ion-segment-button value="hybrid">
     *         Hybrid
     *       </ion-segment-button>
     *       <ion-segment-button value="sat">
     *         Satellite
     *       </ion-segment-button>
     *     </ion-segment>
     *   </form>
     * </ion-content>
     * ```
     *
     *
     * \@demo /docs/v2/demos/src/segment/
     * @see {\@link /docs/v2/components#segment Segment Component Docs}
     * @see [Angular 2 Forms](http://learnangular2.com/forms/)
     */
    var Segment = (function (_super) {
        __extends(Segment, _super);
        /**
         * @param {?} config
         * @param {?} elementRef
         * @param {?} renderer
         * @param {?} ngControl
         */
        function Segment(config, elementRef, renderer, ngControl) {
            _super.call(this, config, elementRef, renderer, 'segment');
            this._disabled = false;
            /**
             * @output {Any} Emitted when a segment button has been changed.
             */
            this.ionChange = new core_1.EventEmitter();
            /**
             * @private
             */
            this.onChange = function (_) { };
            /**
             * @private
             */
            this.onTouched = function (_) { };
            if (ngControl) {
                ngControl.valueAccessor = this;
            }
        }
        Object.defineProperty(Segment.prototype, "color", {
            /**
             * \@input {string} The color to use from your Sass `$colors` map.
             * Default options are: `"primary"`, `"secondary"`, `"danger"`, `"light"`, and `"dark"`.
             * For more information, see [Theming your App](/docs/v2/theming/theming-your-app).
             * @param {?} val
             * @return {?}
             */
            set: function (val) {
                this._setColor(val);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Segment.prototype, "mode", {
            /**
             * \@input {string} The mode determines which platform styles to use.
             * Possible values are: `"ios"`, `"md"`, or `"wp"`.
             * For more information, see [Platform Styles](/docs/v2/theming/platform-specific-styles).
             * @param {?} val
             * @return {?}
             */
            set: function (val) {
                this._setMode(val);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Segment.prototype, "disabled", {
            /**
             * \@input {boolean} If true, the user cannot interact with any of the buttons in the segment.
             * @return {?}
             */
            get: function () {
                return this._disabled;
            },
            /**
             * @param {?} val
             * @return {?}
             */
            set: function (val) {
                var _this = this;
                this._disabled = util_1.isTrueProperty(val);
                if (this._buttons) {
                    this._buttons.forEach(function (button) {
                        button._setElementClass('segment-button-disabled', _this._disabled);
                    });
                }
            },
            enumerable: true,
            configurable: true
        });
        /**
         * Write a new value to the element.
         * @param {?} value
         * @return {?}
         */
        Segment.prototype.writeValue = function (value) {
            this.value = util_1.isPresent(value) ? value : '';
            if (this._buttons) {
                var /** @type {?} */ buttons = this._buttons.toArray();
                for (var _i = 0, buttons_1 = buttons; _i < buttons_1.length; _i++) {
                    var button = buttons_1[_i];
                    button.isActive = (button.value === this.value);
                }
            }
        };
        /**
         * @return {?}
         */
        Segment.prototype.ngAfterViewInit = function () {
            var _this = this;
            this._buttons.forEach(function (button) {
                button.ionSelect.subscribe(function (selectedButton) {
                    _this.writeValue(selectedButton.value);
                    _this.onChange(selectedButton.value);
                    _this.ionChange.emit(selectedButton);
                });
                if (util_1.isPresent(_this.value)) {
                    button.isActive = (button.value === _this.value);
                }
                if (util_1.isTrueProperty(_this._disabled)) {
                    button._setElementClass('segment-button-disabled', _this._disabled);
                }
            });
        };
        /**
         * Set the function to be called when the control receives a change event.
         * @param {?} fn
         * @return {?}
         */
        Segment.prototype.registerOnChange = function (fn) { this.onChange = fn; };
        /**
         * Set the function to be called when the control receives a touch event.
         * @param {?} fn
         * @return {?}
         */
        Segment.prototype.registerOnTouched = function (fn) { this.onTouched = fn; };
        Segment.decorators = [
            { type: core_1.Directive, args: [{
                        selector: 'ion-segment'
                    },] },
        ];
        /** @nocollapse */
        Segment.ctorParameters = function () { return [
            { type: config_1.Config, },
            { type: core_1.ElementRef, },
            { type: core_1.Renderer, },
            { type: forms_1.NgControl, decorators: [{ type: core_1.Optional },] },
        ]; };
        Segment.propDecorators = {
            'color': [{ type: core_1.Input },],
            'mode': [{ type: core_1.Input },],
            'ionChange': [{ type: core_1.Output },],
            '_buttons': [{ type: core_1.ContentChildren, args: [SegmentButton,] },],
            'disabled': [{ type: core_1.Input },],
        };
        return Segment;
    }(ion_1.Ion));
    exports.Segment = Segment;
    function Segment_tsickle_Closure_declarations() {
        /** @type {?} */
        Segment.decorators;
        /**
         * @nocollapse
         * @type {?}
         */
        Segment.ctorParameters;
        /** @type {?} */
        Segment.propDecorators;
        /** @type {?} */
        Segment.prototype._disabled;
        /** @type {?} */
        Segment.prototype.value;
        /**
         * \@output {Any} Emitted when a segment button has been changed.
         * @type {?}
         */
        Segment.prototype.ionChange;
        /** @type {?} */
        Segment.prototype._buttons;
        /** @type {?} */
        Segment.prototype.onChange;
        /** @type {?} */
        Segment.prototype.onTouched;
    }
});
//# sourceMappingURL=segment.js.map


text:
<?xml version="1.0" encoding="UTF-8"?>
<property-set xmlns="http://mcc.lip6.fr/">
  <property>
    <id></id>
    <description>There is no deadlock in the system.</description>
    <tags>
        <is-structural>false</is-structural>
        <is-reachability>false</is-reachability>
        <is-ctl>false</is-ctl>
        <is-ltl>false</is-ltl>
    </tags>
    <formula>
      <impossibility>
        <deadlock/>
      </impossibility>
    </formula>
  </property>
  <property>
    <id></id>
    <description>There is a deadlock in the system.</description>
    <tags>
        <is-structural>false</is-structural>
        <is-reachability>false</is-reachability>
        <is-ctl>false</is-ctl>
        <is-ltl>false</is-ltl>
    </tags>
    <formula>
      <possibility>
        <deadlock/>
      </possibility>
    </formula>
  </property>
</property-set>


text:
import { chain, identity, pickBy } from 'lodash';

import { ISortFilter } from 'core/filterModel';

function generateIterator(sortFilter: ISortFilter & { [key: string]: any }) {
  return function iterator(acc: { headings: any; pool: any }, headingType: string) {
    const { headings, pool } = acc;
    headings[headingType] = chain(pool)
      .map(headingType)
      .uniq()
      .compact()
      .value();
    unselectUnavailableHeadings(headings[headingType], sortFilter[headingType]);
    acc.pool = filterPoolBySelectedHeadings(pool, headingType, sortFilter);
    return acc;
  };
}

function filterPoolBySelectedHeadings(
  pool: any,
  headingType: string,
  sortFilter: ISortFilter & { [key: string]: any },
) {
  const selectedHeadings = sortFilter[headingType];
  if (!Object.keys(pickBy(selectedHeadings, identity)).length) {
    return pool;
  }

  return pool.filter((unit: any) => selectedHeadings[unit[headingType]]);
}

function unselectUnavailableHeadings(headings: string[], selectedHeadings: { [key: string]: {} }) {
  if (!selectedHeadings) {
    return;
  }

  const headingSet = new Set(headings);
  Object.keys(selectedHeadings).forEach(key => {
    if (!headingSet.has(key)) {
      delete selectedHeadings[key];
    }
  });
}

export function digestDependentFilters({
  pool,
  dependencyOrder,
  sortFilter,
}: {
  pool: {};
  dependencyOrder: string[];
  sortFilter: ISortFilter;
}) {
  return dependencyOrder.reduce(generateIterator(sortFilter), { pool, headings: {} }).headings;
}