text:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace B2_CSharp_SDK
{
    public class B2SDK
    {
        static string BASE_BACKBLAZE_URL = "https://api.backblaze.com/b2api/v1/";

        string accountID;
        string apiUrl;
        string authorizationToken;
        string downloadURL;
        string uploadAuthToken = "";
        bool authorized = false;
        Dictionary<string,string> uploadUrls = new Dictionary<string, string>();

        private bool checkStringParamsNotEmpty(string[] parameters)
        {
            foreach(string param in parameters) {
                if (param == "" || param == null)
                {
                    return false;
                }
            }
            return true;
        }

        public B2SDK(string accountId, string applicationKey)
        {
            if (!checkStringParamsNotEmpty(new string[] { accountId, applicationKey })) {
                return;
            }
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(BASE_BACKBLAZE_URL + "b2_authorize_account");
            string credentials = Convert.ToBase64String(Encoding.UTF8.GetBytes(accountId + ":" + applicationKey));
            request.Headers.Add("Authorization", "Basic " + credentials);
            request.ContentType = "application/json; charset=utf-8";
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            if (response.StatusCode == HttpStatusCode.OK)
            {
                string responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
                response.Close();

                dynamic jsonData = JsonConvert.DeserializeObject(responseString);

                // set Data
                accountID = accountId;
                apiUrl = jsonData.apiUrl;
                authorizationToken = jsonData.authorizationToken;
                downloadURL = jsonData.downloadUrl;
                authorized = true;
            }
        }

        /// <summary>
        /// <param name="bucketName"> Name for the new bucket(unique)</param>
        /// <param name="bucketType">"allPrivate" - or - "allpublic"</param>
        /// </summary>
        /// <returns> B2Bucket object with created bucket. Returns null for failure.</returns>
        public B2Bucket b2_create_bucket (string bucketName, string bucketType)
        {
            if (!checkStringParamsNotEmpty(new string[] { bucketName, bucketType }) || !authorized)
            {
                return null;
            }
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(apiUrl + "/b2api/v1/b2_create_bucket");
            string body =
                    "{\"accountId\":\"" + accountID + "\",\n" +
                    "\"bucketName\":\"" + bucketName + "\",\n" +
                    "\"bucketType\":\"" + bucketType + "\"}";
            var data = Encoding.UTF8.GetBytes(body);
            webRequest.Method = "POST";
            webRequest.Headers.Add("Authorization", authorizationToken);
            webRequest.ContentType = "application/json; charset=utf-8";
            using (var stream = webRequest.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
                stream.Close();
            }
            HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
            if (response.StatusCode == HttpStatusCode.OK)
            {
                var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
                response.Close();
                dynamic jsonData = JsonConvert.DeserializeObject(responseString);
                B2Bucket returnData = new B2Bucket((String)jsonData.accountId, (String)jsonData.bucketId, (String)jsonData.bucketName, (String)jsonData.bucketType);
                return returnData;
            } else
            {
                return null;
            }
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="bucketId">ID of bucket to be deleted</param>
        /// <returns>Object for bucket that was deleted</returns>
        public B2Bucket b2_delete_bucket (string bucketId)
        {
            if (!checkStringParamsNotEmpty(new string[] { bucketId }) || !authorized)
            {
                return null;
            }
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(apiUrl + "/b2api/v1/b2_delete_bucket");
            string body =
                "{\"accountId\":\"" + accountID + "\",\n" +
                "\"bucketId\":\"" + bucketId + "\"}";
            var data = Encoding.UTF8.GetBytes(body);
            webRequest.Method = "POST";
            webRequest.Headers.Add("Authorization", authorizationToken);
            webRequest.ContentType = "application/json; charset=utf-8";
            webRequest.ContentLength = data.Length;
            using (var stream = webRequest.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
                stream.Close();
            }
            try
            {
                HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
                var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
                dynamic jsonData = JsonConvert.DeserializeObject(responseString);
                B2Bucket returnData = new B2Bucket((String)jsonData.accountId, (String)jsonData.bucketId, (String)jsonData.bucketName, (String)jsonData.bucketType);
                return returnData;
            }
            // we catch ex in case we have a better way of logging errors to the user in the future
            catch (Exception ex)
            {
                return null;
            };
        }

        /// <summary>
        /// Lists all buckets associated with current instance of the SDK
        /// </summary>
        /// <returns> JSON string of buckets as returned from backblaze API</returns>
        public List<B2Bucket> b2_list_buckets()
        {
            if (!authorized)
            {
                return null;
            }
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(apiUrl + "/b2api/v1/b2_list_buckets");
            string body = "{\"accountId\":\"" + accountID + "\"}";
            var data = Encoding.UTF8.GetBytes(body);
            webRequest.Method = "POST";
            webRequest.Headers.Add("Authorization", authorizationToken);
            webRequest.ContentType = "application/json; charset=utf-8";
            webRequest.ContentLength = data.Length;
            using (var stream = webRequest.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
                stream.Close();
            }
            WebResponse response = (HttpWebResponse)webRequest.GetResponse();
            var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
            response.Close();
            B2BucketList bucketData = (B2BucketList)Newtonsoft.Json.JsonConvert.DeserializeObject(responseString, typeof(B2BucketList));
            return bucketData.buckets;
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="bucketId"> ID for bucket to get files from</param>
        /// <param name="startFileName"> StartFileName to start with for next request</param>
        /// <returns>B2FileList -- list of files in bucket</returns>
        public B2FileList b2_list_file_names(string bucketId, string startFileName)
        {
            if (!checkStringParamsNotEmpty(new string[] { bucketId }) || !authorized)
            {
                return null;
            }
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(apiUrl + "/b2api/v1/b2_list_file_names");
            string body = "{\"bucketId\":\"" + bucketId + "\","
                +         "\"startFileName\":\"" + startFileName + "\"}";
            var data = Encoding.UTF8.GetBytes(body);

            webRequest.Method = "POST";
            webRequest.Headers.Add("Authorization", authorizationToken);
            webRequest.ContentType = "application/json; charset=utf-8";
            webRequest.ContentLength = data.Length;
            using(var stream = webRequest.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
                stream.Close();
            }
            try {
                HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
                var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
                B2FileList fileList = (B2FileList)Newtonsoft.Json.JsonConvert.DeserializeObject(responseString, typeof(B2FileList));
                return fileList;
            }
            catch (Exception ex)
            {
                return null;
            };

        }

        /// <summary>
        /// Gets versions of every file in a bucket starting with the start file name
        /// </summary>
        /// <param name="bucketId"> id of bucket to search</param>
        /// <param name="startFileName"> starting file name for files</param>
        /// <returns> B2FileList -- list of files in bucket </returns>
        public B2FileList b2_list_file_versions(string bucketId, string startFileName)
        {
            if (!checkStringParamsNotEmpty(new string[] { bucketId }) || !authorized)
            {
                return null;
            }
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(apiUrl + "/b2api/v1/b2_list_file_versions");
            string body = "{\"bucketId\":\"" + bucketId + "\","
                + "\"startFileName\":\"" + startFileName + "\"}";
            var data = Encoding.UTF8.GetBytes(body);

            webRequest.Method = "POST";
            webRequest.Headers.Add("Authorization", authorizationToken);
            webRequest.ContentType = "application/json; charset=utf-8";
            webRequest.ContentLength = data.Length;
            using (var stream = webRequest.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
                stream.Close();
            }

            try
            {
                HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
                var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
                B2FileList fileList = (B2FileList)Newtonsoft.Json.JsonConvert.DeserializeObject(responseString, typeof(B2FileList));
                return fileList;
            }
            catch (Exception ex)
            {
                return null;
            };
        }

        /// <summary>
        /// Deletes a specific version of a file given a filename and id
        /// </summary>
        /// <param name="fileName"> Name of file</param>
        /// <param name="fileId"> Id of file to delete</param>
        /// <returns> True if successful, false if unsuccessful</returns>
        public bool b2_delete_file_version(string fileName, string fileId)
        {
            if (!checkStringParamsNotEmpty(new string[] { fileName, fileId }) || !authorized)
            {
                return false;
            }
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(apiUrl + "/b2api/v1/b2_delete_file_version");
            string body =
               "{\"fileName\":\"" + fileName + "\",\n" +
               "\"fileId\":\"" + fileId + "\"}";
            var data = Encoding.UTF8.GetBytes(body);
            webRequest.Method = "POST";
            webRequest.Headers.Add("Authorization", authorizationToken);
            webRequest.ContentType = "application/json; charset=utf-8";
            webRequest.ContentLength = data.Length;
            using (var stream = webRequest.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
                stream.Close();
            }

            HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
            if (response.StatusCode == HttpStatusCode.OK)
            {
                response.Close();
                return true;
            }
            else
            {
                response.Close();
                return false;
            }
        }

        /// <summary>
        /// Downloads a file from b2 given a fileId
        /// </summary>
        /// <param name="fileId"> ID of file to download</param>
        /// <returns>Byte array of download data. Returns null if invalid fileId</returns>
        public byte[] b2_download_file_by_id(string fileId)
        {
            if (!checkStringParamsNotEmpty(new string[] { fileId }) || !authorized)
            {
                return null;
            }
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(downloadURL + "/b2api/v1/b2_download_file_by_id");
            string body = "{\"fileId\":\"" + fileId + "\"}";
            var data = Encoding.UTF8.GetBytes(body);
            webRequest.Method = "POST";
            webRequest.Headers.Add("Authorization", authorizationToken);
            webRequest.ContentType = "application/json; charset=utf-8";
            webRequest.ContentLength = data.Length;
            using (var stream = webRequest.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
                stream.Close();
            }
            WebResponse response = (HttpWebResponse)webRequest.GetResponse();
            Stream responseStream = response.GetResponseStream();
            byte[] fileBytes;
            using (BinaryReader br = new BinaryReader(responseStream))
            {
                fileBytes = br.ReadBytes(500000);
                br.Close();
            }

            responseStream.Close();
            response.Close();

            return fileBytes;
        }

        /// <summary>
        /// Downloads a file from b2 given a fileName and Bucket to download from
        /// </summary>
        /// <param name="fileName"> Name of file to download</param>
        /// <param name="bucketName"> Name of bucket that file is stored in</param>
        /// <returns> Byte array of downloaded file. Returns null if fileName/bucketname combo are invalid.</returns>
        public byte[] b2_download_file_by_name(string fileName, string bucketName)
        {
            if (!checkStringParamsNotEmpty(new string[] { fileName, bucketName }) || !authorized)
            {
                return null;
            }
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(String.Format("{0}/file/{1}/{2}", downloadURL, bucketName, fileName));
            webRequest.Method = "GET";
            webRequest.Headers.Add("Authorization", authorizationToken);
            WebResponse response = (HttpWebResponse)webRequest.GetResponse();
            Stream responseStream = response.GetResponseStream();
            byte[] fileBytes;
            using (BinaryReader br = new BinaryReader(responseStream))
            {
                fileBytes = br.ReadBytes(500000);
                br.Close();
            }
            responseStream.Close();
            response.Close();

            return fileBytes;
        }

        /// <summary>
        /// Returns file info in string form for a given fileId
        /// </summary>
        /// <param name="fileId"> string file id </param>
        /// <returns> B2FileInfo object of file information</returns>
        public B2FileInfo b2_get_file_info(string fileId)
        {
            if (!checkStringParamsNotEmpty(new string[] { fileId }) || !authorized)
            {
                return null;
            }
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(apiUrl + "/b2api/v1/b2_get_file_info");
            string body = "{\"fileId\":\"" + fileId + "\"}";
            var data = Encoding.UTF8.GetBytes(body);
            webRequest.Method = "POST";
            webRequest.Headers.Add("Authorization", authorizationToken);
            webRequest.ContentType = "application/json; charset=utf-8";
            webRequest.ContentLength = data.Length;
            using (var stream = webRequest.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
                stream.Close();
            }

            try
            {
                HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
                var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
                B2FileInfo fileInfo = (B2FileInfo)Newtonsoft.Json.JsonConvert.DeserializeObject(responseString, typeof(B2FileInfo));
                return fileInfo;
            }
            catch (Exception ex)
            {
                return null;
            };
        }

        /// <summary>
        /// Gets Upload Url for pushing files to a specific bucket.
        /// </summary>
        /// <param name="bucketId"> Id for bucket to get upload url for</param>
        /// <returns>string upload url</returns>
        public string b2_get_upload_url(string bucketId)
        {
            if (!checkStringParamsNotEmpty(new string[] { bucketId }) || !authorized)
            {
                return "";
            }
            if (uploadUrls.ContainsKey(bucketId))
            {
                return uploadUrls[bucketId];
            }

            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(apiUrl + "/b2api/v1/b2_get_upload_url");
            string body = "{\"bucketId\":\"" + bucketId + "\"}";
            var data = Encoding.UTF8.GetBytes(body);
            webRequest.Method = "POST";
            webRequest.Headers.Add("Authorization", authorizationToken);
            webRequest.ContentType = "application/json; charset=utf-8";
            webRequest.ContentLength = data.Length;
            using (var stream = webRequest.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
                stream.Close();
            }
            WebResponse response = (HttpWebResponse)webRequest.GetResponse();
            var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
            response.Close();
            dynamic jsonData = JsonConvert.DeserializeObject(responseString);
            uploadUrls[bucketId] = jsonData.uploadUrl;
            uploadAuthToken = jsonData.authorizationToken;
            return uploadUrls[bucketId];
        }

        /// <summary>
        /// Hides a file by its name. It will still exist and can be downloaded by version.
        /// </summary>
        /// <param name="bucketId"> Id of the bucket</param>
        /// <param name="fileName"> Id of the file</param>
        /// <returns> Bool True if successful, false if any error</returns>
        public bool b2_hide_file(string bucketId, string fileName)
        {
            if (!checkStringParamsNotEmpty(new string[] { fileName, bucketId }) || !authorized)
            {
                return false;
            }
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(apiUrl + "/b2api/v1/b2_hide_file");
            string body =
            "{\"bucketId\":\"" + bucketId + "\",\n" +
            "\"fileName\":\"" + fileName + "\"}";
            var data = Encoding.UTF8.GetBytes(body);
            webRequest.Method = "POST";
            webRequest.Headers.Add("Authorization", authorizationToken);
            webRequest.ContentType = "application/json; charset=utf-8";
            webRequest.ContentLength = data.Length;
            using (var stream = webRequest.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
                stream.Close();
            }
            HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
            if (response.StatusCode == HttpStatusCode.OK)
            {
                response.Close();
                return true;
            }
            else
            {
                response.Close();
                return false;
            }
        }

        /// <summary>
        /// Updates bucket information
        /// </summary>
        /// <param name="bucketId"> Id of bucket to update</param>
        /// <param name="bucketType"> "allPrivate" or "allPublic" for private or public bucket</param>
        /// <returns> B2Bucket -- the updated bucket after applying the changes</returns>
        public B2Bucket b2_update_bucket(string bucketId, string bucketType)
        {
            if (!checkStringParamsNotEmpty(new string[] { bucketType, bucketId }) || !authorized)
            {
                return null;
            }
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(apiUrl + "/b2api/v1/b2_update_bucket");
            string body =
            "{\"accountId\":\"" + accountID + "\",\n" +
            "\"bucketId\":\"" + bucketId + "\",\n" +
            "\"bucketType\":\"" + bucketType + "\"}";
            var data = Encoding.UTF8.GetBytes(body);
            webRequest.Method = "POST";
            webRequest.Headers.Add("Authorization", authorizationToken);
            webRequest.ContentType = "application/json; charset=utf-8";
            webRequest.ContentLength = data.Length;
            using (var stream = webRequest.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
                stream.Close();
            }
            try
            {
                HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
                var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
                dynamic jsonData = JsonConvert.DeserializeObject(responseString);
                B2Bucket returnData = new B2Bucket((String)jsonData.accountId, (String)jsonData.bucketId, (String)jsonData.bucketName, (String)jsonData.bucketType);
                return returnData;
            }
            // we catch ex in case we have a better way of logging errors to the user in the future
            catch (Exception ex)
            {
                return null;
            };
        }

        public B2FileInfo b2_upload_file(byte[] bytes, string fileName, string bucketId)
        {
            if (!checkStringParamsNotEmpty(new string[] { fileName, bucketId }) || !authorized)
            {
                return null;
            }
            SHA1CryptoServiceProvider sh = new SHA1CryptoServiceProvider();
            sh.ComputeHash(bytes);
            byte[] hash = sh.Hash;
            StringBuilder sb = new StringBuilder();
            foreach (byte b in hash)
            {
                sb.Append(b.ToString("x2"));
            }

            string sha1 = sb.ToString();

            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(b2_get_upload_url(bucketId));
            webRequest.Method = "POST";
            webRequest.Headers.Add("Authorization", uploadAuthToken);
            webRequest.Headers.Add("X-Bz-File-Name", fileName);
            webRequest.ContentType = "b2/x-auto";
            webRequest.ContentLength = bytes.Length;
            webRequest.Headers.Add("X-Bz-Content-Sha1", sha1);
            using (var stream = webRequest.GetRequestStream())
            {
                stream.Write(bytes, 0, bytes.Length);
                stream.Close();
            }
            try
            {
                HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
                var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
                B2FileInfo fileInfo = (B2FileInfo)Newtonsoft.Json.JsonConvert.DeserializeObject(responseString, typeof(B2FileInfo));
                return fileInfo;
            }
            catch (Exception ex)
            {
                return null;
            };
        }
    }
}


text:
package com.github.stigmata.command;

import java.io.PrintWriter;
import java.util.Iterator;

import com.github.stigmata.BirthmarkContext;
import com.github.stigmata.BirthmarkEngine;
import com.github.stigmata.ComparisonMethod;
import com.github.stigmata.ComparisonResultSet;
import com.github.stigmata.ExtractionResultSet;
import com.github.stigmata.Stigmata;
import com.github.stigmata.event.BirthmarkEngineAdapter;
import com.github.stigmata.event.BirthmarkEngineEvent;
import com.github.stigmata.event.WarningMessages;
import com.github.stigmata.printer.ComparisonResultSetPrinter;
import com.github.stigmata.spi.ResultPrinterService;

/**
 *
 * @author Haruaki Tamada
 */
public class CompareCommand extends AbstractStigmataCommand{
    @Override
    public boolean isAvailableArguments(String[] args){
        return args.length > 0;
    }

    @Override
    public String getCommandString(){
        return "compare";
    }

    @Override
    public void perform(Stigmata stigmata, BirthmarkContext context, String[] args){
        try{
            BirthmarkEngine engine = new BirthmarkEngine(context.getEnvironment());
            context.setComparisonMethod(ComparisonMethod.ROUND_ROBIN_SAME_PAIR);
            engine.addBirthmarkEngineListener(new BirthmarkEngineAdapter(){
                @Override
                public void operationDone(BirthmarkEngineEvent e){
                    WarningMessages warnings = e.getMessage();
                    for(Iterator<Exception> i = warnings.exceptions(); i.hasNext(); ){
                        i.next().printStackTrace();
                    }
                }
            });

            ExtractionResultSet rs = engine.extract(args, context);
            ComparisonResultSet resultset = engine.compare(rs);
            if(context.hasFilter()){
                resultset = engine.filter(resultset);
            }

            ResultPrinterService spi = stigmata.getPrinterManager().getService(context.getFormat());
            ComparisonResultSetPrinter formatter = spi.getComparisonResultSetPrinter();
            formatter.printResult(new PrintWriter(System.out), resultset);
        }catch(Exception e){
            e.printStackTrace();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.fest.assertions.error;

import org.fest.assertions.data.*;

/**
 * Creates an error message indicating that an assertion that verifies that a two colors are equal at a given
 * point fails.
 *
 * @author Yvonne Wang
 */
public class ShouldBeEqualColors extends BasicErrorMessageFactory {

  /**
   * Creates a new <code>{@link ShouldBeEqualColors}</code>.
   * @param expected the expected color.
   * @param actual the actual color.
   * @param point the point where {@code expected} and {@code actual} were compared at.
   * @param offset helps decide if two colors are similar: two colors that are identical to the human eye may still have
   * slightly different color values. For example, by using an offset of 1 we can indicate that a blue value of 60 is
   * similar to a blue value of 61.
   * @return the created {@code ErrorMessageFactory}.
   */
  public static ErrorMessageFactory shouldBeEqualColors(RgbColor expected, RgbColor actual, Point point, Offset<?> offset) {
    return new ShouldBeEqualColors(expected, actual, point, offset);
  }

  private ShouldBeEqualColors(RgbColor expected, RgbColor actual, Point point, Offset<?> offset) {
    super("expected:<%s> but was:<%s> at:<%s> within offset:<%s>", expected, actual, point, offset.value);
  }
}


text:
package com.mogujie.tt.ui.fragment;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.mogujie.tt.R;
import com.mogujie.tt.adapter.EntityListViewAdapter;
import com.mogujie.tt.config.SysConstant;
import com.mogujie.tt.imlib.proto.ContactEntity;
import com.mogujie.tt.imlib.proto.DepartmentEntity;
import com.mogujie.tt.imlib.proto.GroupEntity;
import com.mogujie.tt.imlib.service.IMService;
import com.mogujie.tt.imlib.utils.IMUIHelper;
import com.mogujie.tt.log.Logger;
import com.mogujie.tt.ui.activity.MainActivity;
import com.mogujie.tt.ui.base.TTBaseFragment;
import com.mogujie.tt.ui.utils.EntityList;
import com.mogujie.tt.ui.utils.IMServiceHelper;
import com.mogujie.tt.ui.utils.IMServiceHelper.OnIMServiceListner;

public class SearchFragment extends TTBaseFragment
		implements
			OnIMServiceListner {

	private Logger logger = Logger.getLogger(SearchFragment.class);
	private IMServiceHelper imServiceHelper = new IMServiceHelper();
	private View curView = null;
	private ListView listView;
	private EntityListViewAdapter adapter;
	IMService imService;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {

		imServiceHelper.connect(this.getActivity(), null, IMServiceHelper.INTENT_MAX_PRIORITY, this);

		if (null != curView) {
			((ViewGroup) curView.getParent()).removeView(curView);
			return curView;
		}
		curView = inflater.inflate(R.layout.tt_fragment_search, topContentView);

		initTopBar();

		initListView();

		return curView;
	}

	@Override
	public void onResume() {

		super.onResume();
	}

	private void initTopBar() {
		setTopBar(R.color.half_transparent_light);
		showTopSearchBar();
		setTopLeftButton(R.drawable.tt_top_back);
		hideTopRightButton();

		topLeftBtn.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View arg0) {
				getActivity().finish();
			}
		});

		topSearchEdt.addTextChangedListener(new TextWatcher() {

			@Override
			public void onTextChanged(CharSequence s, int start, int before,
					int count) {

				String key = s.toString();
				adapter.setEnabled(!key.isEmpty());

				adapter.onSearch(key);
			}

			@Override
			public void beforeTextChanged(CharSequence s, int start, int count,
					int after) {

			}

			@Override
			public void afterTextChanged(Editable s) {
			}
		});
	}

	private void initListView() {
		listView = (ListView) curView.findViewById(R.id.search);
		adapter = new EntityListViewAdapter(getActivity());
		adapter.setEnabled(false);

		listView.setAdapter(adapter);
		adapter.initClickEvents(listView);
	}

	private void initSearchEntityLists() {
		initDepartmentEntityList();
		initGroupEntityList();
		initContactEntityList();

	}

	private void initContactEntityList() {
		if (imService == null) {
			return;
		}

		Map<String, ContactEntity> contacts = imService.getContactManager().getContacts();
		List<Object> contactList = IMUIHelper.getContactSortedList(contacts);

		EntityList entityList = new EntityList(contactList) {
			@Override
			public String getSectionName(int position) {
				if (!list.isEmpty() && position == 0) {
					return getString(R.string.contact);
				}

				return "";
			}

			/*
			 * (non-Javadoc)
			 *
			 * @see
			 * com.mogujie.tt.ui.utils.EntityList#onSearchImpl(java.lang.String)
			 * feature:
			 * 支持首字母拼音搜索
			 * 拼音搜索从完整字的搜索开始
			 * 当然支持汉字搜索
			 * 去重
			 * 单元测试先通过
			 *
			 * 理解如何给单独的element加上颜色
			 * 首字母拼音搜索:
			 * 将所有单个汉字的拼音放到队列里去
			 * 首字母搜索的时候,可以计算是从哪个字符开始,一共有几个字符符合,那么计算一下起始位置
			 * 拼音搜索,遍历,生成一个子拼音,startswith符合,则符合,但是需要计算一下起始位置, 单独写一个算法根据长度来计算
			 * name搜索,本身已经支持
			 *
			 * 特殊case:
			 * 输入一个字符的时候,走首字母拼音搜索没有问题...基本A-Z都有覆盖的
			 */
			@Override
			public void onSearchImpl(String key) {
				ArrayList<Object> searchList = new ArrayList<Object>();
				for (Object obj : backupList) {
					ContactEntity contact = (ContactEntity) obj;

					if (IMUIHelper.handleContactSearch(key, contact)) {
						searchList.add(obj);
					}
				}

				list = searchList;
			}
		};

		adapter.add(0, entityList);
	}

	private void initGroupEntityList() {
		if (imService == null) {
			return;
		}

		Map<String, GroupEntity> groups = imService.getGroupManager().getGroups();
		List<Object> groupList = IMUIHelper.getGroupSortedList(groups);

		EntityList entityList = new EntityList(groupList) {
			@Override
			public String getSectionName(int position) {
				if (!list.isEmpty() && position == 0) {
					return getString(R.string.fixed_group_or_temp_group);
				}

				return "";
			}

			@Override
			public void onSearchImpl(String key) {
				ArrayList<Object> searchList = new ArrayList<Object>();
				for (Object obj : backupList) {
					GroupEntity group = (GroupEntity) obj;

					if (IMUIHelper.handleGroupSearch(key, group)) {
						searchList.add(obj);
					}
				}

				list = searchList;
			}
		};

		adapter.add(0, entityList);
	}

	private void initDepartmentEntityList() {
		if (imService == null) {
			return;
		}

		Map<String, DepartmentEntity> departments = imService.getContactManager().getDepartments();
		List<Object> departmentList = IMUIHelper.getDepartmentSortedList(departments);

		EntityList entityList = new EntityList(departmentList) {
			@Override
			public String getSectionName(int position) {
				if (!list.isEmpty() && position == 0) {
					return getString(R.string.department);
				}

				return "";
			}

			@Override
			public void onSearchImpl(String key) {
				ArrayList<Object> searchList = new ArrayList<Object>();
				for (Object obj : backupList) {
					DepartmentEntity department = (DepartmentEntity) obj;

					if (IMUIHelper.handleDepartmentSearch(key, department)) {
						searchList.add(obj);
					}
				}

				list = searchList;
			}

			@Override
			public void onItemClick(Context ctx, View view, int position) {
				DepartmentEntity department = (DepartmentEntity) list.get(position);
				locateDepartment(ctx, department);
			}

			private void locateDepartment(Context ctx,
					DepartmentEntity department) {
				if (ctx == null || department == null) {
					return;
				}

				Intent intent = new Intent(ctx, MainActivity.class);
				intent.putExtra(SysConstant.KEY_LOCATE_DEPARTMENT, department.id);

				ctx.startActivity(intent);
			}
		};

		adapter.add(0, entityList);
	}

	@Override
	protected void initHandler() {
	}

	@Override
	public void onAction(String action, Intent intent,
			BroadcastReceiver broadcastReceiver) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onIMServiceConnected() {
		logger.d("config#onIMServiceConnected");

		imService = imServiceHelper.getIMService();

		initSearchEntityLists();
	}
}


text:
<?php
/**
 * TOP API: taobao.wlb.wms.sku.get request
 *
 * @author auto create
 * @since 1.0, 2015.08.17
 */
class WlbWmsSkuGetRequest
{
	/**
	 * 商家商品编码,与itemid必须有一个值不为空
	 **/
	private $itemCode;

	/**
	 * 菜鸟商品ID,与itemcode必须有一个值不为空
	 **/
	private $itemId;

	/**
	 * 货主ID
	 **/
	private $ownerUserId;

	private $apiParas = array();

	public function setItemCode($itemCode)
	{
		$this->itemCode = $itemCode;
		$this->apiParas["item_code"] = $itemCode;
	}

	public function getItemCode()
	{
		return $this->itemCode;
	}

	public function setItemId($itemId)
	{
		$this->itemId = $itemId;
		$this->apiParas["item_id"] = $itemId;
	}

	public function getItemId()
	{
		return $this->itemId;
	}

	public function setOwnerUserId($ownerUserId)
	{
		$this->ownerUserId = $ownerUserId;
		$this->apiParas["owner_user_id"] = $ownerUserId;
	}

	public function getOwnerUserId()
	{
		return $this->ownerUserId;
	}

	public function getApiMethodName()
	{
		return "taobao.wlb.wms.sku.get";
	}

	public function getApiParas()
	{
		return $this->apiParas;
	}

	public function check()
	{

	}

	public function putOtherTextParam($key, $value) {
		$this->apiParas[$key] = $value;
		$this->$key = $value;
	}
}


text:
#ifndef FINIT_SVC_H_
#define FINIT_SVC_H_

#include <sys/ipc.h>		/* IPC_CREAT */
#include <sys/resource.h>
#include <sys/types.h>		/* pid_t */
#ifdef _LIBITE_LITE
# include <libite/lite.h>
# include <libite/queue.h>	/* BSD sys/queue.h API */
#else
# include <lite/lite.h>
# include <lite/queue.h>	/* BSD sys/queue.h API */
#endif
#include <uev/uev.h>

#include "cgroup.h"
#include "helpers.h"

typedef int svc_cmd_t;

typedef enum {
	SVC_TYPE_FREE       = 0,	/* Free to allocate */
	SVC_TYPE_SERVICE    = 1,	/* Monitored, will be respawned */
	SVC_TYPE_TASK       = 2,	/* One-shot, runs in parallel */
	SVC_TYPE_RUN        = 4,	/* Like task, but wait for completion */
	SVC_TYPE_TTY        = 8,	/* Like service, but dedicated to TTYs */
	SVC_TYPE_SYSV       = 32,	/* SysV style init.d script w/ start/stop */
} svc_type_t;

#define SVC_TYPE_ANY          (-1)
#define SVC_TYPE_RESPAWN      (SVC_TYPE_SERVICE | SVC_TYPE_TTY)
#define SVC_TYPE_RUNTASK      (SVC_TYPE_RUN | SVC_TYPE_TASK | SVC_TYPE_SYSV)

typedef enum {
	SVC_HALTED_STATE = 0,	/* Not allowed in runlevel, or not enabled. */
	SVC_DONE_STATE,		/* Task/Run job has been run */
	SVC_STOPPING_STATE,	/* Waiting to collect the child process */
	SVC_CLEANUP_STATE,	/* Running post: script */
	SVC_SETUP_STATE,	/* Running pre: script */
	SVC_PAUSED_STATE,	/* Condition is in flux, process SIGSTOPed */
	SVC_WAITING_STATE,	/* Enabled but condition not satisfied */
	SVC_STARTING_STATE,	/* Conditions OK and pre: script done, start */
	SVC_RUNNING_STATE,	/* Process running */
} svc_state_t;

typedef enum {
	SVC_BLOCK_NONE = 0,
	SVC_BLOCK_MISSING,
	SVC_BLOCK_CRASHING,
	SVC_BLOCK_USER,
	SVC_BLOCK_BUSY,
	SVC_BLOCK_RESTARTING,
} svc_block_t;

typedef enum {
	SVC_ONCRASH_IGNORE = 0,
	SVC_ONCRASH_REBOOT,
	SVC_ONCRASH_SCRIPT,
} svc_oncrash_action_t;

#define MAX_ID_LEN       16
#define MAX_ARG_LEN      64
#define MAX_IDENT_LEN    (MAX_ARG_LEN + MAX_ID_LEN + 1)
#define MAX_STR_LEN      64
#define MAX_COND_LEN     (MAX_ARG_LEN * 3)
#define MAX_USER_LEN     16
#define MAX_NUM_FDS      64	     /* Max number of I/O plugins */
#define MAX_NUM_SVC_ARGS 64

/* Default kill delay (msec) after SIGTERM (svc->sighalt) that we SIGKILL processes */
#define SVC_TERM_TIMEOUT 3000

/* Prevent endless respawn of faulty services. */
#define SVC_RESPAWN_MAX  10

/*
 * Default enable for all services, can be stopped by means
 * of issuing an initctl call. E.g.
 *
 *   initctl <stop|start|restart> service
 */
typedef struct svc {
	TAILQ_ENTRY(svc) link;

	/* Origin of service */
	char           file[MAX_ARG_LEN];

	/* Limits and scoping */
	struct rlimit  rlimit[RLIMIT_NLIMITS];
	struct cgroup  cgroup;

	/* Service details */
	int            sighalt;        /* Signal to stop process, default: SIGTERM */
	int            killdelay;      /* Delay in msec before sending SIGKILL */
	pid_t          oldpid, pid;
	char           pidfile[256];
	long           start_time;     /* Start time, as seconds since boot, from sysinfo() */
	int            started;	       /* Set for run/task/sysv to track if started */
	int            status;	       /* From waitpid() when process is collected */
	const svc_state_t state;       /* Paused, Reloading, Restart, Running, ... */
	svc_type_t     type;	       /* Service, run, task, ... */
	char           protect;        /* Services like dbus-daemon & udev by Finit */
	char           manual;	       /* run/task that require `initctl start foo` */
	const int      dirty;	       /* 0: unmodified, 1: modified */
	const int      removed;
	int            starting;       /* ... waiting for pidfile to be re-asserted */
	int	       runlevels;
	int            sighup;	       /* This service supports SIGHUP :) */
	int	       forking;	       /* This is a service/sysv daemon that forks, wait for it ... */
	svc_block_t    block;	       /* Reason that this service is currently stopped */
	char           cond[MAX_COND_LEN];

	/* Instance specifics */
	int            job;	       /* For intenal use only, canonical ref is NAME:ID */
	char           name[MAX_ARG_LEN];
	char           id[MAX_ID_LEN]; /* :ID */

	/* Counters */
	char           once;	       /* run/task, (at least) once per runlevel */
	unsigned int   restart_tot;    /* Total restarts ever, summarized, including `initctl restart` */
	int            restart_max;    /* Maximum number of restarts allowed */
	int            restart_saved;  /* INTERNAL, saved copy of .conf value */
	int            restart_tmo;    /* Time before restarting a crashing service */
	unsigned char  oncrash_action; /* Action to perform in crashed state. */
	char           respawn;	       /* ttys, or services with `respawn`, never increment restart_cnt */
	const char     restart_cnt;    /* Incremented for each restart by service monitor. */

	union {
		/* services we redirect stdout/stderr to syslog (not TTYs!) */
		struct {
			char  enabled;
			char  null;
			char  console;
			char  file[64];
			char  prio[20];
			char  ident[20];
		} log;

		/* Only for TTY type services */
		struct {
			char  dev[32];
			char  baud[10];
			char  term[10];
			char  noclear;
			char  nowait;
			char  nologin;
			char  notty;
			char  rescue;
		};
	};

	/* Identity */
	char	       username[MAX_USER_LEN];
	char	       group[MAX_USER_LEN];

	/* Command, arguments and service description */
	char	       cmd[MAX_ARG_LEN];
	char	       args[MAX_NUM_SVC_ARGS][MAX_ARG_LEN];
	int            args_dirty;
	char	       desc[MAX_STR_LEN];
	char	       env[MAX_ARG_LEN];
	char	       pre_script[MAX_ARG_LEN];
	char	       post_script[MAX_ARG_LEN];
	char	       ready_script[MAX_ARG_LEN];

	/*
	 * Used to forcefully kill services that won't shutdown on
	 * termination and to delay restarts of crashing services.
	 */
	uev_t          timer;
	void           (*timer_cb)(struct svc *svc);

	/*
	 * Readiness notification socket: systemd, s6
	 */
	int	       notify;	       /* 0: none, 1: systemd, 2: s6 */
	uev_t	       notify_watcher; /* i/o watcher */

	/* time at svc_del(), used by gc timer */
	struct timespec gc;
} svc_t;

svc_t      *svc_new                (char *cmd, char *name, char *id, int type);
int	    svc_del	           (svc_t *svc);
void	    svc_validate	   (svc_t *svc);

svc_t	   *svc_find	           (char *name, char *id);
svc_t	   *svc_find_by_pid        (pid_t pid);
svc_t	   *svc_find_by_cond	   (const char *cond);
svc_t	   *svc_find_by_jobid      (int job, char *id);
svc_t	   *svc_find_by_tty        (char *dev);
svc_t      *svc_find_by_pidfile    (char *fn);

svc_t      *svc_iterator           (svc_t **iter, int first);
svc_t      *svc_named_iterator     (svc_t **iter, int first, char *cmd);
svc_t      *svc_job_iterator       (svc_t **iter, int first, int job);

void	    svc_foreach	           (int (*cb)(svc_t *));
void        svc_foreach_type       (int types, int (*cb)(svc_t *));

svc_t	   *svc_stop_completed	   (void);

void	    svc_mark_dynamic       (void);
void	    svc_mark_dirty         (svc_t *svc);
void	    svc_mark_clean         (svc_t *svc);
void	    svc_clean_dynamic      (void (*cb)(svc_t *));
int	    svc_clean_bootstrap    (svc_t *svc);
void	    svc_prune_bootstrap	   (void);

void        svc_enable             (svc_t *svc);
int         svc_enabled            (svc_t *svc);

int         svc_parse_jobstr       (char *str, size_t len, void *user_data, int (*found)(svc_t *, void *), int (not_found)(char *, char *, void *));

static inline int svc_is_daemon    (svc_t *svc) { return svc && SVC_TYPE_SERVICE == svc->type; }
static inline int svc_is_sysv      (svc_t *svc) { return svc && SVC_TYPE_SYSV    == svc->type; }
static inline int svc_is_tty       (svc_t *svc) { return svc && SVC_TYPE_TTY     == svc->type; }
static inline int svc_is_runtask   (svc_t *svc) { return svc && (SVC_TYPE_RUNTASK & svc->type);}
static inline int svc_is_forking   (svc_t *svc) { return svc && svc->forking; }
static inline int svc_is_manual    (svc_t *svc) { return svc && svc->manual; }

static inline int svc_in_runlevel  (svc_t *svc, int runlevel) { return svc && ISSET(svc->runlevels, runlevel); }
static inline int svc_nohup        (svc_t *svc) { return svc &&  (0 == svc->sighup || 0 != svc->args_dirty); }
static inline int svc_has_pidfile  (svc_t *svc) { return svc_is_daemon(svc) && svc->pidfile[0] != 0 && svc->pidfile[0] != '!'; }
static inline int svc_has_pre      (svc_t *svc) { return svc->pre_script[0];  }
static inline int svc_has_post     (svc_t *svc) { return svc->post_script[0]; }
static inline int svc_has_ready    (svc_t *svc) { return svc->ready_script[0];}

static inline void svc_starting    (svc_t *svc) { if (svc) svc->starting = 1;       }
static inline void svc_started     (svc_t *svc) { if (svc) svc->starting = 0;       }
static inline int  svc_is_starting (svc_t *svc) { return svc && 0 != svc->starting; }
static inline int  svc_is_running  (svc_t *svc) { return svc && svc->state == SVC_RUNNING_STATE; }

static inline int  svc_is_removed  (svc_t *svc) { return svc && svc->removed; }
static inline int  svc_is_changed  (svc_t *svc) { return svc &&  0 != svc->dirty; }
static inline int  svc_is_updated  (svc_t *svc) { return svc &&  1 == svc->dirty; }

static inline int  svc_is_blocked  (svc_t *svc) { return svc && svc->block != SVC_BLOCK_NONE; }
static inline int  svc_is_busy     (svc_t *svc) { return svc && svc->block == SVC_BLOCK_BUSY; }
static inline int  svc_is_missing  (svc_t *svc) { return svc && svc->block == SVC_BLOCK_MISSING; }
static inline int  svc_is_crashing (svc_t *svc) { return svc && svc->block == SVC_BLOCK_CRASHING; }
static inline int  svc_is_restart  (svc_t *svc) { return svc && svc->block == SVC_BLOCK_RESTARTING; }

static inline void svc_unblock     (svc_t *svc) { if (svc) svc->block = SVC_BLOCK_NONE;       }
#define            svc_start(svc)  svc_unblock(svc)
static inline void svc_stop        (svc_t *svc) { if (svc) svc->block = SVC_BLOCK_USER; }
static inline void svc_busy        (svc_t *svc) { if (svc) svc->block = SVC_BLOCK_BUSY; }
static inline void svc_missing     (svc_t *svc) { if (svc) svc->block = SVC_BLOCK_MISSING; }
static inline void svc_restarting  (svc_t *svc) { if (svc) svc->block = SVC_BLOCK_RESTARTING; }
static inline void svc_crashing    (svc_t *svc) { if (svc) svc->block = SVC_BLOCK_CRASHING; }

/* Has condition in configuration and cond is allowed? */
static inline int svc_has_cond(svc_t *svc)
{
	if (!svc->cond[0])
		return 0;

	switch (svc->type) {
	case SVC_TYPE_SERVICE:
	case SVC_TYPE_TASK:
	case SVC_TYPE_RUN:
	case SVC_TYPE_TTY:
	case SVC_TYPE_SYSV:
		return 1;

	default:
		break;
	}

	return 0;
}

static inline const char *svc_typestr(svc_t *svc)
{
	switch (svc->type) {
	case SVC_TYPE_FREE:
		return "free";

	case SVC_TYPE_SERVICE:
		return "service";

	case SVC_TYPE_TASK:
		return "task";

	case SVC_TYPE_RUN:
		return "run";

	case SVC_TYPE_TTY:
		return "tty";

	case SVC_TYPE_SYSV:
		return "sysv";
	}

	return "unknown";
}

static inline char *svc_status(svc_t *svc)
{
	if (!svc)
		return "Unknown";

	switch (svc->state) {
	case SVC_HALTED_STATE:
		switch (svc->block) {
		case SVC_BLOCK_NONE:
			return "halted";

		case SVC_BLOCK_MISSING:
			return "missing";

		case SVC_BLOCK_CRASHING:
			return "crashed";

		case SVC_BLOCK_USER:
			return "stopped";

		case SVC_BLOCK_BUSY:
			return "busy";

		case SVC_BLOCK_RESTARTING:
			return "restart";
		}
		return "unknown";

	case SVC_DONE_STATE:
		if (svc->started)
			return "done";
		else
			return "failed";

	case SVC_STOPPING_STATE:
		switch (svc->type) {
		case SVC_TYPE_RUN:
		case SVC_TYPE_TASK:
			return "active";

		default:
			return "stopping";
		}

	case SVC_CLEANUP_STATE:
		return "cleanup";

	case SVC_SETUP_STATE:
		return "setup";

	case SVC_PAUSED_STATE:
		return "paused";

	case SVC_WAITING_STATE:
		return "waiting";

	case SVC_STARTING_STATE:
		return "starting";

	case SVC_RUNNING_STATE:
		return "running";

	default:
		return "UNKNOWN";
	}
}

static inline const char *svc_dirtystr(svc_t *svc)
{
	if (!svc)
		return "Unknown";

	if (svc_is_removed(svc))
		return "removed";
	if (svc_is_updated(svc))
		return "updated";
	if (svc_is_changed(svc))
		return "UNKNOWN";

	return "clean";
}

/*
 * Returns svc unique identifier tuple 'name:id', or just 'name',
 * if that's enough to identify the service.
 */
static inline char *svc_ident(svc_t *svc, char *buf, size_t len)
{
	static char ident[MAX_IDENT_LEN];

	if (!buf) {
		buf = ident;
		len = sizeof(ident);
	}

	if (!svc)
		return "nil";

	strlcpy(buf, svc->name, len);
	if (strlen(svc->id)) {
		strlcat(buf, ":", len);
		strlcat(buf, svc->id, len);
	}

	return buf;
}

/*
 * Returns svc unique identifier tuple 'job:id', or just 'job',
 * if that's enough to identify the service.
 */
static inline char *svc_jobid(svc_t *svc, char *buf, size_t len)
{
	static char ident[MAX_IDENT_LEN];

	if (!buf) {
		buf = ident;
		len = sizeof(ident);
	}

	if (!svc)
		return "nul";

	if (strlen(svc->id))
		snprintf(buf, len, "%d:%s", svc->job, svc->id);
	else
		snprintf(buf, len, "%d", svc->job);

	return buf;
}

/*
 * non-zero env, no checking if file exists or not
 */
static inline char *svc_getenv(svc_t *svc)
{
	int v = 0;

	if (!svc->env[0])
		return NULL;

	if (svc->env[0] == '-')
		v = 1;

	return &svc->env[v];
}

/*
 * Check if svc has env, if env file exists returns true
 * if it doesn't exist, but has '-', also true.  if svc
 * doesn't have env, also true.
 */
static inline int svc_checkenv(svc_t *svc)
{
	char *env = svc_getenv(svc);

	if (!env || svc->env[0] == '-')
		return 1;

	return fexist(env);
}

#endif /* FINIT_SVC_H_ */

/**
 * Local Variables:
 *  indent-tabs-mode: t
 *  c-file-style: "linux"
 * End:
 */


text:
<?xml version="1.0"?>
<qualifications class="ICP99">
  <qualification id="ICP26199" title="Certificate II in Printing and Graphic Arts (General)">
    <units/>
  </qualification>
  <qualification id="ICP22199" title="Certificate II in Printing and Graphic Arts (Screen Printing)">
    <units/>
  </qualification>
  <qualification id="ICP21299" title="Certificate II in Printing and Graphic Arts (Print Production Support)">
    <units/>
  </qualification>
  <qualification id="ICP20199" title="Certificate II in Printing and Graphic Arts (Desktop Publishing)">
    <units/>
  </qualification>
  <qualification id="ICP24199" title="Certificate II in Printing and Graphic Arts (Graphic Arts Services)">
    <units/>
  </qualification>
  <qualification id="ICP23199" title="Certificate II in Printing and Graphic Arts (Cardboard Box Container and Carton)">
    <units/>
  </qualification>
  <qualification id="ICP20299" title="Certificate II in Printing and Graphic Arts (Print Design)">
    <units/>
  </qualification>
  <qualification id="ICP21199" title="Certificate II in Printing and Graphic Arts (Small Offset)">
    <units/>
  </qualification>
  <qualification id="ICP25299" title="Certificate II in Printing and Graphic Arts (Mail Houses)">
    <units/>
  </qualification>
  <qualification id="ICP25199" title="Certificate II in Printing and Graphic Arts (Ink Manufacture)">
    <units/>
  </qualification>
  <qualification id="ICP33199" title="Certificate III in Printing and Graphic Arts (Cardboard Box Container and Carton)">
    <units/>
  </qualification>
  <qualification id="ICP35299" title="Certificate III in Printing and Graphic Arts (Mail Houses)">
    <units/>
  </qualification>
  <qualification id="ICP32199" title="Certificate III in Printing and Graphic Arts (Screen Printing)">
    <units/>
  </qualification>
  <qualification id="ICP30399" title="Certificate III in Printing and Graphic Arts (Graphic Pre-press)">
    <units/>
  </qualification>
  <qualification id="ICP35199" title="Certificate III in Printing and Graphic Arts (Ink Manufacture)">
    <units/>
  </qualification>
  <qualification id="ICP36199" title="Certificate III in Printing and Graphic Arts (General)">
    <units/>
  </qualification>
  <qualification id="ICP30499" title="Certificate III in Printing and Graphic Arts (Multimedia)">
    <units/>
  </qualification>
  <qualification id="ICP31399" title="Certificate III in Printing and Graphic Arts (Printing)">
    <units/>
  </qualification>
  <qualification id="ICP31499" title="Certificate III in Printing and Graphic Arts (Print Finishing)">
    <units/>
  </qualification>
  <qualification id="ICP41399" title="Certificate IV in Printing and Graphic Arts (Printing)">
    <units/>
  </qualification>
  <qualification id="ICP40499" title="Certificate IV in Printing and Graphic Arts (Multimedia)">
    <units/>
  </qualification>
  <qualification id="ICP45199" title="Certificate IV in Printing and Graphic Arts (Ink Manufacture)">
    <units/>
  </qualification>
  <qualification id="ICP40399" title="Certificate IV in Printing and Graphic Arts (Graphic Pre-press)">
    <units/>
  </qualification>
  <qualification id="ICP43199" title="Certificate IV in Printing and Graphic Arts (Cardboard Box Container and Carton)">
    <units/>
  </qualification>
  <qualification id="ICP46199" title="Certificate IV in Printing and Graphic Arts (General)">
    <units/>
  </qualification>
  <qualification id="ICP45299" title="Certificate IV in Printing and Graphic Arts (Mail Houses)">
    <units/>
  </qualification>
  <qualification id="ICP42199" title="Certificate IV in Printing and Graphic Arts (Screen Printing)">
    <units/>
  </qualification>
  <qualification id="ICP44299" title="Certificate IV in Printing and Graphic Arts (Graphic Arts Service Technician)">
    <units/>
  </qualification>
  <qualification id="ICP41499" title="Certificate IV in Printing and Graphic Arts (Print Finishing)">
    <units/>
  </qualification>
  <qualification id="ICP46299" title="Certificate IV in Printing and Graphic Arts (Management/Sales)">
    <units/>
  </qualification>
  <qualification id="ICP50399" title="Diploma of Printing and Graphic Arts (Graphic Pre-press)">
    <units/>
  </qualification>
  <qualification id="ICP52199" title="Diploma of Printing and Graphic Arts (Screen Printing)">
    <units/>
  </qualification>
  <qualification id="ICP54299" title="Diploma of Printing and Graphic Arts (Graphic Arts Service Technician)">
    <units/>
  </qualification>
  <qualification id="ICP51499" title="Diploma of Printing and Graphic Arts (Print Finishing)">
    <units/>
  </qualification>
  <qualification id="ICP56199" title="Diploma of Printing and Graphic Arts (General)">
    <units/>
  </qualification>
  <qualification id="ICP50499" title="Diploma of Printing and Graphic Arts (Multimedia)">
    <units/>
  </qualification>
  <qualification id="ICP55199" title="Diploma of Printing and Graphic Arts (Ink Manufacture)">
    <units/>
  </qualification>
  <qualification id="ICP55299" title="Diploma of Printing and Graphic Arts (Mail Houses)">
    <units/>
  </qualification>
  <qualification id="ICP53199" title="Diploma of Printing and Graphic Arts (Cardboard Box Container and Carton)">
    <units/>
  </qualification>
  <qualification id="ICP56299" title="Diploma of Printing and Graphic Arts (Management/Sales)">
    <units/>
  </qualification>
  <qualification id="ICP51399" title="Diploma of Printing and Graphic Arts (Printing)">
    <units/>
  </qualification>
  <qualification id="ICP64299" title="Advanced Diploma of Printing and Graphic Arts (Graphic Arts Service Technician)">
    <units/>
  </qualification>
  <qualification id="ICP60399" title="Advanced Diploma of Printing and Graphic Arts (Graphic Pre-press)">
    <units/>
  </qualification>
  <qualification id="ICP66199" title="Advanced Diploma of Printing and Graphic Arts (General)">
    <units/>
  </qualification>
  <qualification id="ICP65199" title="Advanced Diploma of Printing and Graphic Arts (Ink Manufacture)">
    <units/>
  </qualification>
  <qualification id="ICP65299" title="Advanced Diploma of Printing and Graphic Arts (Mail Houses)">
    <units/>
  </qualification>
  <qualification id="ICP60499" title="Advanced Diploma of Printing and Graphic Arts (Multimedia)">
    <units/>
  </qualification>
  <qualification id="ICP61399" title="Advanced Diploma of Printing and Graphic Arts (Printing)">
    <units/>
  </qualification>
  <qualification id="ICP62199" title="Advanced Diploma of Printing and Graphic Arts (Screen Printing)">
    <units/>
  </qualification>
  <qualification id="ICP61499" title="Advanced Diploma of Printing and Graphic Arts (Print Finishing)">
    <units/>
  </qualification>
  <qualification id="ICP66299" title="Advanced Diploma of Printing and Graphic Arts (Management/Sales)">
    <units/>
  </qualification>
  <qualification id="ICP63199" title="Advanced Diploma of Printing and Graphic Arts (Cardboard Box Container and Carton)">
    <units/>
  </qualification>
</qualifications>


text:
import json
import numpy as np

from ule.sensorimotor import Sensor, Motor
from ule.spaces import Discrete, Vector, Image

def parseFeedback(string, sensors):
    jsonlst = json.loads(string)

    if 'sensors' in jsonlst:
        # modify sensors directly
        updateSensors(jsonlst['sensors'], sensors)

    reward = int(jsonlst['reward'])
    done = int(jsonlst['done'])

    info = jsonlst['info']

    return reward, done, info

def updateSensors(jsonsensors, sensors):
    for jsensor in jsonsensors:
        for sensor in sensors:
            if sensor.name() == jsensor['name']:
                sensor.value_from_json(jsensor['value'])

def parseSensorsAndMotors(info):
    jsn = json.loads(info)

    jsonsensors = {}
    jsonmotors = {}

    if 'sensors' in jsn:
        jsonsensors = jsn['sensors']
    if 'motors' in jsn:
        jsonmotors = jsn['motors']

    sensors = []
    motors = []

    for jsonsensor in jsonsensors:
        try:
            sensors.append(Sensor(jsonsensor))
        except Exception as e:
            print('Error decoding json sensors.')

    for jsonmotor in jsonmotors:
        try:
            motors.append(Motor(jsonmotor))
        except Exception as e:
            print('Error decoding json motors.')

    return sensors, motors

def motorsToJsonable(motors):
    motorlist = []
    for i in range(len(motors)):
        current = motors[i].to_jsonable()
        motorlist.append(current)

    return motorlist


text:
<?php namespace AdammBalogh\Box\Exception;

class NotFoundException extends \Exception
{
}


text:
module AbstractController
  module Railties
    module RoutesHelpers
      def self.with(routes)
        Module.new do
          define_method(:inherited) do |klass|
            super(klass)
            if namespace = klass.parents.detect {|m| m.respond_to?(:_railtie) }
              klass.send(:include, namespace._railtie.routes.url_helpers)
            else
              klass.send(:include, routes.url_helpers)
            end
          end
        end
      end
    end
  end
end


text:
/**
 *
 * Process Editor
 *
 * (C) 2009, 2010 inubit AG
 * (C) 2014 the authors
 *
 */
package com.inubit.research.gui.plugins.serverLoadTests.tests;

import com.inubit.research.client.UserCredentials;
import java.net.URI;
import java.util.List;

/**
 *
 * @author uha
 */
public class EdgesTestSeries extends ProcessObjectTestSeries {

    @Override
    public List<URI> getURIs(URI uri, UserCredentials credentials) {
        /*
        try {
            return ProcessUtils.getEdgeURIs(uri, credentials);
        } catch (IOException ex) {
            Logger.getLogger(EdgesTestSeries.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ParserConfigurationException ex) {
            Logger.getLogger(EdgesTestSeries.class.getName()).log(Level.SEVERE, null, ex);
        } catch (Exception ex) {
            Logger.getLogger(EdgesTestSeries.class.getName()).log(Level.SEVERE, null, ex);
        }*/
        return null;
    }
}


text:
layout: post
microblog: true
date: 2009-11-04 03:00 +0300
guid: http://desparoz.micro.blog/2009/11/04/t5410630152.html
---
At #DEMA. Been great catching up with fellow Tweeting divers like @DarcyKieran, @scubabunny and @jonrusho and many more


text:
enum _MessageViewSuspendedOperations
{
	noMVOperations,
	retwit,
	forward
} typedef MessageViewSuspendedOperations;

@class MGTwitterEngine;

@interface MessageViewController : UIViewController <UITextViewDelegate,
													ImageDownoaderDelegate,
													ImageUploaderDelegate,
													UIActionSheetDelegate>
{
    IBOutlet UIButton *avatarView;
    IBOutlet UILabel *dateField;
    IBOutlet UIButton *nameField;
    IBOutlet UIWebView *textField;
	IBOutlet UISegmentedControl *messageActionsSegmentedControl;
    IBOutlet UIButton *deleteTwit;

	UIColor *defaultTintColor;
	NSDictionary *_message;

	NSMutableDictionary *imagesLinks;
	NSMutableArray *connectionsDelegates;
	MessageViewSuspendedOperations suspendedOperation;
	UIActionSheet *progressSheet;

	BOOL _isDirectMessage;
	int _newLineCounter;
	MGTwitterEngine *_twitter;
}
- (IBAction)nameSelected;
- (IBAction)deleteTwit;
- (void)forward;
- (void)reTwit;
- (void)reply;
- (IBAction)segmentedActions:(id)sender;
- (id)initWithMessage:(NSDictionary*)message;

- (void)receivedImage:(UIImage*)image sender:(ImageDownoader*)sender;
- (void)uploadedImage:(NSString*)yFrogURL sender:(ImageUploader*)sender;
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex;

@property (nonatomic, retain) UIActionSheet *progressSheet;

@end


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>CSS Test:  font default features</title>
<link rel="author" title="Chris Lilley" href="chris@w3.org">

Test passes if the three lines below are identical, with six check marks (✓).

AAAAAA

AAAAAA

AAAAAA


text:
namespace {
// This needs to appear before `using namespace realm`. After that,
// realm::Schema's operator== becomes a candidate function to call for the
// comparison of array values within json. This occurs in a SFINAE context
// and so should simply be discarded as a candidate, but VC++ 2017 incorrectly
// considers it a hard error.
bool equals(nlohmann::json const& a, nlohmann::json const& b) {
    return a == b;
}
} // anonymous namespace

using namespace realm;

using ObjectID = sync::ObjectID;
using Instruction = sync::Instruction;

namespace {
static PropertyType from_core_type(DataType type)
{
    switch (type) {
        case type_Int:       return PropertyType::Int;
        case type_Float:     return PropertyType::Float;
        case type_Double:    return PropertyType::Double;
        case type_Bool:      return PropertyType::Bool;
        case type_String:    return PropertyType::String;
        case type_Binary:    return PropertyType::Data;
        case type_Timestamp: return PropertyType::Date;
        case type_Mixed:     return PropertyType::Any;
        case type_Link:      return PropertyType::Object | PropertyType::Nullable;
        case type_LinkList:  return PropertyType::Object | PropertyType::Array;
        case type_Table:     REALM_ASSERT(false && "Use ObjectSchema::from_core_type if subtables are a possibility");
        default: REALM_UNREACHABLE();
    }
}

class ChangesetCookerInstructionHandler final : public sync::InstructionHandler {
public:
    friend Adapter;

    ChangesetCookerInstructionHandler(const Group &group, util::Logger& logger, util::AppendBuffer<char>& out_buffer)
    : m_group(group)
    , m_table_info(m_group)
    , m_logger(logger)
    , m_out_buffer(out_buffer)
    {
    }

    const Group &m_group;
    sync::TableInfoCache m_table_info;
    util::Logger& m_logger;
    util::AppendBuffer<char>& m_out_buffer;
    std::unordered_map<std::string, ObjectSchema> m_schema;

    std::unordered_map<std::string, std::unordered_map<ObjectID, int64_t>> m_int_primaries;
    std::unordered_map<std::string, std::unordered_map<ObjectID, std::string>> m_string_primaries;
    std::unordered_map<std::string, std::unordered_set<ObjectID>> m_null_primaries;

    nlohmann::json m_pending_instruction = nullptr;

    std::string m_selected_object_type;
    ConstTableRef m_selected_table;
    ObjectSchema *m_selected_object_schema = nullptr;
    Property *m_selected_primary = nullptr;

    std::string m_list_property_name;
    nlohmann::json m_list_parent_identity;

    ConstTableRef m_list_target_table;
    ObjectSchema *m_list_target_object_schema = nullptr;
    Property *m_list_target_primary = nullptr;

    void flush() {
        if (m_pending_instruction.is_null())
            return;
        if (m_out_buffer.size())
            m_out_buffer.append(",", 1);
        else
            m_out_buffer.append("[", 1);
        auto str = m_pending_instruction.dump();
        m_out_buffer.append(str.data(), str.size());
        m_pending_instruction = nullptr;
    }

    bool finish() {
        flush();
        if (!m_out_buffer.size())
            return false;
        m_out_buffer.append("]", 1);
        return true;
    }

    void add_instruction(Adapter::InstructionType type,
                         nlohmann::json &&inst = {}, bool collapsible = false,
                         util::Optional<std::string> object_type = util::none) {
        if (!object_type && !m_selected_object_schema) {
            return; // FIXME: support objects without schemas
        }
        flush();

        inst["type"] = Adapter::instruction_type_string(type);
        inst["object_type"] = object_type ? *object_type : m_selected_object_schema->name;
        m_pending_instruction = std::move(inst);
        if (!collapsible)
            flush();
    }

    void add_set_instruction(ObjectID row, StringData column, nlohmann::json &&value) {
        nlohmann::json identity = get_identity(row, *m_selected_table, m_selected_primary);

        // collapse values if inserting/setting values for the last object
        if (!m_pending_instruction.is_null()) {
            nlohmann::json &last = m_pending_instruction;
            if (equals(identity, last["identity"]) && m_selected_object_schema && m_selected_object_schema->name == last["object_type"].get<std::string>()) {
                last["values"][column] = value;
                return;
            }
        }

        // if not collapsed create new
        add_instruction(Adapter::InstructionType::Set, {
            {"identity", std::move(identity)},
            {"values", {{column, value}}}
        }, true);
    }

    void add_column_instruction(std::string object_type, std::string prop_name, nlohmann::json &&prop) {
        if (!m_pending_instruction.is_null()) {
            nlohmann::json &last = m_pending_instruction;
            if (last["object_type"].get<std::string>() == object_type && (
                last["type"].get<std::string>() == "ADD_TYPE" ||
                last["type"].get<std::string>() == "ADD_PROPERTIES"))
            {
                last["properties"][prop_name] = prop;
                return;
            }
        }

        add_instruction(Adapter::InstructionType::AddProperties, {{"properties",
            {{prop_name, prop}}
        }}, true, object_type);
    }

    nlohmann::json get_identity(ObjectID object_id, const Table& table, Property *primary_key) {
        if (primary_key) {
            std::string object_type = ObjectStore::object_type_for_table_name(table.get_name());

            if (is_nullable(primary_key->type)) {
                auto& null_primaries = m_null_primaries[object_type];
                auto it = null_primaries.find(object_id);
                if (it != null_primaries.end())
                    return nullptr;
            }

            if (primary_key->type == PropertyType::Int) {
                auto& int_primaries = m_int_primaries[object_type];
                auto it = int_primaries.find(object_id);
                if (it != int_primaries.end()) {
                    return it->second;
                }

                size_t row = sync::row_for_object_id(m_table_info, table, object_id);
                REALM_ASSERT(row != npos);
                if (is_nullable(primary_key->type) && table.is_null(primary_key->table_column, row)) {
                    return nullptr;
                }
                return table.get_int(primary_key->table_column, row);
            }
            else if (primary_key->type == PropertyType::String) {
                auto& string_primaries = m_string_primaries[object_type];
                auto it = string_primaries.find(object_id);
                if (it != string_primaries.end()) {
                    return it->second;
                }

                size_t row = sync::row_for_object_id(m_table_info, table, object_id);
                REALM_ASSERT(row != npos);
                StringData value = table.get_string(primary_key->table_column, row);
                if (value.is_null())
                    return nullptr;
                return std::string(value);
            }
        }

        return object_id.to_string();
    }

    void select(std::string const& object_type, ObjectSchema *&out_object_schema, ConstTableRef &out_table, Property *&out_primary) {
        out_object_schema = nullptr;
        out_primary = nullptr;
        out_table = ConstTableRef();

        if (object_type.empty()) {
            return;
        }
        auto it = m_schema.find(object_type);
        if (it == m_schema.end()) {
            out_table = ObjectStore::table_for_object_type(m_group, object_type);
            if (!out_table) {
                return;
            }
            it = m_schema.emplace(std::piecewise_construct,
                                  std::forward_as_tuple(object_type),
                                  std::forward_as_tuple(m_group, object_type, out_table->get_index_in_group())).first;
        }

        out_object_schema = &it->second;
        if (!out_table)
            out_table = ObjectStore::table_for_object_type(m_group, object_type);
        out_primary = it->second.primary_key_property();
    }

    std::unordered_map<uint32_t, sync::StringBufferRange> m_interned_strings;
    util::StringBuffer m_string_buffer;

    StringData get_string(sync::StringBufferRange range) const
    {
        return StringData{m_string_buffer.data() + range.offset, range.size};
    }

    StringData get_string(sync::InternString intern_string) const
    {
        auto it = m_interned_strings.find(intern_string.value);
        REALM_ASSERT(it != m_interned_strings.end());
        return get_string(it->second);
    }

    void set_intern_string(uint32_t index, sync::StringBufferRange range) override
    {
        m_interned_strings[index] = range;
    }

    sync::StringBufferRange add_string_range(StringData data) override
    {
        size_t offset = m_string_buffer.size();
        m_string_buffer.append(data.data(), data.size());
        return sync::StringBufferRange{uint32_t(offset), uint32_t(data.size())};
    }

    // No selection needed:
    void operator()(const Instruction::SelectTable& instr)
    {
        m_selected_object_type = get_string(instr.table);
        select(m_selected_object_type, m_selected_object_schema, m_selected_table, m_selected_primary);
    }

    void operator()(const Instruction::SelectField& instr)
    {
        REALM_ASSERT(m_selected_object_schema);

        m_list_parent_identity = get_identity(instr.object, *m_selected_table, m_selected_primary);
        m_list_property_name = get_string(instr.field);

        std::string link_target_table = get_string(instr.link_target_table);
        select(link_target_table, m_list_target_object_schema, m_list_target_table, m_list_target_primary);
    }

    void operator()(const Instruction::AddTable& instr)
    {
        std::string object_type = get_string(instr.table);
        if (object_type.size()) {
            nlohmann::json dict = {{"properties", nullptr}};
            if (instr.has_primary_key) {
                dict["primary_key"] = get_string(instr.primary_key_field);
                dict["properties"][get_string(instr.primary_key_field)] = {
                    {"nullable", instr.primary_key_nullable},
                    {"type", string_for_property_type(from_core_type(instr.primary_key_type))}
                };
            }
            add_instruction(Adapter::InstructionType::AddType, std::move(dict),
                            true, object_type);
        }
    }

    void operator()(const Instruction::EraseTable&)
    {
        REALM_ASSERT(0);
    }

    // Must have table selected:
    void operator()(const Instruction::CreateObject& instr)
    {
        if (!m_selected_object_schema) {
            m_logger.warn("Adapter: Ignoring CreateObject instruction with no object schema");
            return; // FIXME: Support objects without schemas
        }

        nlohmann::json identity;
        nlohmann::json values;

        if (instr.has_primary_key) {
            if (instr.payload.type == type_Int) {
                identity = instr.payload.data.integer;
                m_int_primaries[m_selected_object_type][instr.object] = instr.payload.data.integer;
            }
            else if (instr.payload.type == type_String) {
                std::string value = get_string(instr.payload.data.str);
                identity = value;
                m_string_primaries[m_selected_object_type][instr.object] = value;
            }
            else if (instr.payload.is_null()) {
                identity = nullptr;
                m_null_primaries[m_selected_object_type].insert(instr.object);
            }
            else {
                REALM_TERMINATE("Non-integer/non-string primary keys not supported by adapter.");
            }

            values[m_selected_primary->name] = identity;
        }
        else {
            identity = instr.object.to_string(); // Use the stringified Object ID
        }
        add_instruction(Adapter::InstructionType::Insert, {
            {"identity", std::move(identity)},
            {"values", std::move(values)}
        }, true);
    }

    void operator()(const Instruction::EraseObject& instr)
    {
        if (!m_selected_object_schema) {
            m_logger.warn("Adapter: Ignoring EraseObject instruction with no object schema");
            return; // FIXME: Support objects without schemas
        }

        add_instruction(Adapter::InstructionType::Delete, {
            {"identity", get_identity(instr.object, *m_selected_table, m_selected_primary)}
        });

        if (m_selected_primary) {
            auto& int_primaries    = m_int_primaries[m_selected_object_type];
            auto& string_primaries = m_string_primaries[m_selected_object_type];
            auto& null_primaries   = m_null_primaries[m_selected_object_type];

            // invalidate caches
            int_primaries.erase(instr.object);
            string_primaries.erase(instr.object);
            null_primaries.erase(instr.object);
        }
    }

    void operator()(const Instruction::Set& instr)
    {
        if (!m_selected_object_schema) {
            m_logger.warn("Adapter: Ignoring Set instruction with no object schema");
            return; // FIXME: Support objects without schemas
        }

        StringData field = get_string(instr.field);

        if (instr.payload.is_null()) {
            return add_set_instruction(instr.object, field, nullptr);
        }

        switch (instr.payload.type) {
            case type_Int:
                return add_set_instruction(instr.object, field, instr.payload.data.integer);
            case type_Bool:
                return add_set_instruction(instr.object, field, instr.payload.data.boolean);
            case type_Float:
                return add_set_instruction(instr.object, field, instr.payload.data.fnum);
            case type_Double:
                return add_set_instruction(instr.object, field, instr.payload.data.dnum);
            case type_String:
                return add_set_instruction(instr.object, field, std::string(get_string(instr.payload.data.str)));
            case type_Binary: {
                StringData data = get_string(instr.payload.data.str);
                auto encoded_size = util::base64_encoded_size(data.size());
                std::vector<char> encoded_data(encoded_size + 1, '\0');
                util::base64_encode(data.data(), data.size(), encoded_data.data(), encoded_data.size());
                return add_set_instruction(instr.object, field, {"data64", encoded_data.data()});
            }
            case type_Timestamp: {
                Timestamp ts = instr.payload.data.timestamp;
                int64_t value = ts.get_seconds() * 1000 + ts.get_nanoseconds() / 1000000;
                return add_set_instruction(instr.object, field, {"date", value});
            }
            case type_Link: {
                ObjectSchema *target_object_schema;
                ConstTableRef target_table;
                Property *target_primary;
                std::string table_name = get_string(instr.payload.data.link.target_table);
                select(table_name, target_object_schema, target_table, target_primary);
                nlohmann::json value = get_identity(instr.payload.data.link.target, *target_table, target_primary);
                return add_set_instruction(instr.object, field, std::move(value));
            }

            case type_Table:
            case type_Mixed:
            case type_LinkList:
            case type_OldDateTime:
                REALM_TERMINATE("Unsupported data type.");
        }
    }

    void operator()(const Instruction::AddInteger&)
    {
        // FIXME
        REALM_TERMINATE("AddInteger not supported by adapter.");
    }

    void operator()(const Instruction::InsertSubstring&)
    {
        // FIXME
        REALM_TERMINATE("InsertSubstring not supported by adapter.");
    }

    void operator()(const Instruction::EraseSubstring&)
    {
        // FIXME
        REALM_TERMINATE("EraseSubstring not supported by adapter.");
    }

    void operator()(const Instruction::ClearTable&)
    {
        add_instruction(Adapter::InstructionType::Clear);
    }

    void operator()(const Instruction::AddColumn& instr)
    {
        if (m_selected_object_type.size()) {
            if (instr.type == type_Link || instr.type == type_LinkList) {
                add_column_instruction(m_selected_object_type, get_string(instr.field), {
                    {"type", (instr.type == type_Link ? "object" : "list")},
                    {"object_type", get_string(instr.link_target_table)}
                });
            }
            else if (instr.type == type_Table) {
                // FIXME: Arrays of primitives are not yet supported.
            }
            else {
                add_column_instruction(m_selected_object_type, get_string(instr.field), {
                    {"type", string_for_property_type(from_core_type(instr.type))},
                    {"nullable", instr.nullable}
                });
            }
        }
    }

    void operator()(const Instruction::EraseColumn&)
    {
        REALM_TERMINATE("EraseColumn not supported by adapter.");
    }

    // Must have linklist selected:
    void operator()(const Instruction::ArraySet& instr)
    {
        if (!m_list_property_name.size()) {
            m_logger.warn("Adapter: Ignoring ArraySet instruction on unknown list property");
            return; // FIXME
        }

        // FIXME: Support arrays of primitives

        add_instruction(Adapter::InstructionType::ListSet, {
            {"identity", m_list_parent_identity},
            {"property", m_list_property_name},
            {"list_index", instr.ndx},
            {"object_identity", get_identity(instr.payload.data.link.target, *m_list_target_table, m_list_target_primary)}
        });
    }

    void operator()(const Instruction::ArrayInsert& instr)
    {
        if (!m_list_property_name.size()) {
            m_logger.warn("Adapter: Ignoring ArrayInsert instruction on unknown list property");
            return; // FIXME
        }

        // FIXME: Support arrays of primitives

        add_instruction(Adapter::InstructionType::ListInsert, {
            {"identity", m_list_parent_identity},
            {"property", m_list_property_name},
            {"list_index", instr.ndx},
            {"object_identity", get_identity(instr.payload.data.link.target, *m_list_target_table, m_list_target_primary)}
        });
    }

    void operator()(const Instruction::ArrayMove&)
    {
        if (!m_list_property_name.size())
            return; // FIXME

        REALM_TERMINATE("ArrayMove not supported by adapter.");
    }

    void operator()(const Instruction::ArraySwap&)
    {
        if (!m_list_property_name.size())
            return; // FIXME

        REALM_TERMINATE("ArraySwap not supported by adapter.");
    }

    void operator()(const Instruction::ArrayErase& instr)
    {
        if (!m_list_property_name.size())
            return; // FIXME

        add_instruction(Adapter::InstructionType::ListErase, {
            {"identity", m_list_parent_identity},
            {"property", m_list_property_name},
            {"list_index", instr.ndx},
        });
    }

    void operator()(const Instruction::ArrayClear&)
    {
        if (!m_list_property_name.size())
            return; // FIXME

        add_instruction(Adapter::InstructionType::ListClear, {
            {"identity", m_list_parent_identity},
            {"property", m_list_property_name},
        });
    }

    void operator()(const Instruction& instr) final override
    {
        instr.visit(*this);
    }
};

class ChangesetCooker final : public sync::ClientHistory::ChangesetCooker {
public:
    ChangesetCooker(util::Logger& logger) : m_logger(logger) { }

    bool cook_changeset(const Group& group, const char* changeset,
                        std::size_t changeset_size,
                        util::AppendBuffer<char>& out_buffer) override {
        _impl::SimpleNoCopyInputStream stream(changeset, changeset_size);
        ChangesetCookerInstructionHandler cooker_handler(group, m_logger, out_buffer);
        sync::ChangesetParser().parse(stream, cooker_handler);
        return cooker_handler.finish();
    }

private:
    util::Logger& m_logger;
};

} // anonymous namespace

class Adapter::Impl final : public AdminRealmListener {
public:
    Impl(std::function<void(std::string)> realm_changed, std::function<bool(const std::string&)> should_watch_realm_predicate,
         std::string local_root_dir, SyncConfig sync_config_template);

    Realm::Config get_config(StringData virtual_path, util::Optional<Schema> schema) const;

    using AdminRealmListener::start;

private:
    void register_realm(sync::ObjectID, StringData virtual_path) override;
    void unregister_realm(sync::ObjectID, StringData) override {}
    void error(std::exception_ptr) override {} // FIXME
    void download_complete() override {}

    const std::string m_server_base_url;
    std::shared_ptr<SyncUser> m_user;
    std::function<SyncBindSessionHandler> m_bind_callback;

    const std::unique_ptr<util::Logger> m_logger;
    const std::shared_ptr<ChangesetCooker> m_transformer;

    const std::function<void(std::string)> m_realm_changed;
    const std::function<bool(const std::string&)> m_should_watch_realm_predicate;

    std::vector<std::shared_ptr<_impl::RealmCoordinator>> m_realms;

};

Adapter::Impl::Impl(std::function<void(std::string)> realm_changed, std::function<bool(const std::string&)> should_watch_realm_predicate,
                    std::string local_root_dir, SyncConfig sync_config_template)
: AdminRealmListener(std::move(local_root_dir), std::move(sync_config_template))
, m_logger(SyncManager::shared().make_logger())
, m_transformer(std::make_shared<ChangesetCooker>(*m_logger))
, m_realm_changed(std::move(realm_changed))
, m_should_watch_realm_predicate(std::move(should_watch_realm_predicate))
{
}

Realm::Config Adapter::Impl::get_config(StringData virtual_path, util::Optional<Schema> schema) const {
    Realm::Config config = AdminRealmListener::get_config(virtual_path);
    if (schema) {
        config.schema = std::move(schema);
        config.schema_version = 0;
    }
    config.sync_config->transformer = m_transformer;
    return config;
}

void Adapter::Impl::register_realm(sync::ObjectID, StringData virtual_path) {
    std::string path = virtual_path;
    if (!m_should_watch_realm_predicate(path))
        return;

    auto coordinator = _impl::RealmCoordinator::get_coordinator(get_config(path, util::none));
    std::weak_ptr<Impl> weak_self = std::static_pointer_cast<Impl>(shared_from_this());
    coordinator->set_transaction_callback([path = std::move(path), weak_self = std::move(weak_self)](VersionID, VersionID) {
        if (auto self = weak_self.lock())
            self->m_realm_changed(path);
    });
    m_realms.push_back(coordinator);
}

Adapter::Adapter(std::function<void(std::string)> realm_changed, std::function<bool(const std::string&)> should_watch_realm_predicate,
                 std::string local_root_dir, SyncConfig sync_config_template)
: m_impl(std::make_shared<Adapter::Impl>(std::move(realm_changed), std::move(should_watch_realm_predicate),
                                         std::move(local_root_dir), std::move(sync_config_template)))
{
    m_impl->start();
}

util::Optional<util::AppendBuffer<char>> Adapter::current(std::string realm_path) {
    auto history = realm::sync::make_client_history(get_config(realm_path, util::none).path);
    SharedGroup sg(*history);

    auto progress = history->get_cooked_progress();
    if (progress.changeset_index >= history->get_num_cooked_changesets()) {
        return util::none;
    }

    util::AppendBuffer<char> buffer;
    history->get_cooked_changeset(progress.changeset_index, buffer);
    return buffer;
}

void Adapter::advance(std::string realm_path) {
    auto history = realm::sync::make_client_history(get_config(realm_path, util::none).path);
    SharedGroup sg(*history);

    auto progress = history->get_cooked_progress();
    if (progress.changeset_index < history->get_num_cooked_changesets()) {
        progress.changeset_index++;
        history->set_cooked_progress(progress);
    }
}

Realm::Config Adapter::get_config(std::string path, util::Optional<Schema> schema) {
    return m_impl->get_config(path, std::move(schema));
}


text:
START_ATF_NAMESPACE
    namespace Register
    {
        class _guild_battle_reserved_schedule_result_zoclRegister : public IRegister
        {
            public:
                void Register() override
                {
                    auto& hook_core = CATFCore::get_instance();
                    for (auto& r : Detail::_guild_battle_reserved_schedule_result_zocl_functions)
                        hook_core.reg_wrapper(r.pBind, r);
                }
        };
    }; // end namespace Register
END_ATF_NAMESPACE


text:
package io.jenkins.plugins.jobrestrictions.restrictions.job;

import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.Messages;
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.restrictions.JobRestriction;
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.restrictions.JobRestrictionDescriptor;
import io.jenkins.plugins.jobrestrictions.util.ClassSelector;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.model.Queue;
import hudson.model.Run;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import edu.umd.cs.findbugs.annotations.NonNull;
import org.kohsuke.stapler.DataBoundConstructor;

/**
 * Handles job class restrictions.
 * @author Oleg Nenashev
 * @see ClassSelector
 * @since TODO
 */
// TODO: it's a real issue, needs some love
@SuppressFBWarnings(value = "SE_NO_SERIALVERSIONID",
        justification = "XStream does actually need serialization, the code needs refactoring in 1.0")
public class JobClassNameRestriction extends JobRestriction {

    private final List<ClassSelector> jobClasses;

    private transient Set<String> acceptedClassesHash = null;

    @DataBoundConstructor
    public JobClassNameRestriction(List<ClassSelector> jobClasses) {
        this.jobClasses = jobClasses;
    }

    @NonNull
    public List<ClassSelector> getJobClasses() {
        return jobClasses;
    }

    @NonNull
    private synchronized Set<String> getAcceptedJobClasses() {
        if (acceptedClassesHash == null) {
            final List<ClassSelector> selectors = getJobClasses();
            acceptedClassesHash = new HashSet<String>(selectors.size());
            for (ClassSelector selector : selectors) {
                acceptedClassesHash.add(selector.getSelectedClass()); // merge equal entries
            }
        }
        return acceptedClassesHash;
    }

    @Override
    public boolean canTake(Queue.BuildableItem item) {
        return getAcceptedJobClasses().contains(item.task.getClass().getName());
    }

    @Override
    public boolean canTake(Run run) {
        return getAcceptedJobClasses().contains(run.getParent().getClass().getName());
    }

    @Extension
    public static class DescriptorImpl extends JobRestrictionDescriptor {

        @Override
        public String getDisplayName() {
            return Messages.restrictions_Job_JobClassNameRestriction_displayName();
        }
    }
}


text:
package java.lang;

public class JavaClass {

    public static String test = "test";
}


text:
<?php

require_once "util/lti_util.php";

if ( isset($_GET['r_key']) && isset($_GET['r_secret']) ) {
    $retval = validateOAuth($_GET['r_key'], $_GET['r_secret']);
    if ( $retval === true ) {
        error_log("tp_commit.php Validated");
    } else {
        error_log("tp_commit.php Failed validation: ".$retval);
        echo("tp_commit.php Failed validation: ".$retval."\n");
    }
}

// What is the response type here?
header("Content-type: application/vnd.ims.lti.v2.toolproxy.id+json; charset=utf-8");

$method = $_SERVER['REQUEST_METHOD'];
error_log("Commmit Method: $method");
$VND = isset($_GET['correlation']) ? $_GET['correlation'] : '** MISSING **';
error_log("tp_commit saw correlation_id of ".$VND);

$headers = getallheaders();
ob_start();
var_dump($headers);
$result = ob_get_clean();
error_log("tp_commit.php");
error_log($result);
ob_start();
var_dump($_POST);
$result = ob_get_clean();
error_log($result);

if ( $method == "PUT" || $method == "DELETE" ) {
	http_response_code(200);
} else {
	http_response_code(400);
}