text:
class CAstroFighterGame : public CAstroFighterBaseGame
{
    public:

        //
        // Constructors for this game.
        //

        static IGame* createInstanceSet2(
        );

        static IGame* createInstanceClockMasterSet2(
        );

        //
        // IGame Interface - wholly implemented in the Base game.
        //

    private:

        //
        // Different ROM sets supplied.
        //
        CAstroFighterGame(
            const bool       clockMaster,
            const ROM_REGION *romRegion
        );

};

#endif


text:
#include <utils/ashmem.h>
#include <utils/api_level.h>

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

#include <utils/Path.h>

#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#   include <fcntl.h>
#   include <stdlib.h>
#   include <unistd.h>
#endif

#if defined(WIN32)
#include <io.h>
#include <Windows.h>
#include <Winbase.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/types.h>
#endif

#ifdef __ANDROID__
#   include <sys/ioctl.h>
#   include <sys/stat.h>
#   include <memory.h>
#   include <dlfcn.h>
#   include <linux/ashmem.h>
#   include <android/api-level.h>
#   include <android/sharedmem.h>
#endif

namespace utils {

#ifdef __ANDROID__

#if __ANDROID_API__ >= 26

// Starting with API 26 (Oreo) we have ASharedMemory
int ashmem_create_region(const char *name, size_t size) {
    return ASharedMemory_create(name, size);
}

#else

static int __ashmem_open() {
    int ret;
    struct stat st;

    int fd = open("/dev/ashmem", O_RDWR);
    if (fd < 0) {
        return fd;
    }

    ret = fstat(fd, &st);
    if (ret < 0) {
        int save_errno = errno;
        close(fd);
        errno = save_errno;
        return ret;
    }
    if (!S_ISCHR(st.st_mode) || !st.st_rdev) {
        close(fd);
        errno = ENOTTY;
        return -1;
    }

    return fd;
}

int ashmem_create_region(const char *name, size_t size) {
    // Fetch the API level to avoid dlsym() on API 19
    if (api_level() >= 26) {
        // dynamically check if we have "ASharedMemory_create" (should be the case since 26 (Oreo))
        using TASharedMemory_create = int(*)(const char *name, size_t size);
        TASharedMemory_create pfnASharedMemory_create =
                (TASharedMemory_create)dlsym(RTLD_DEFAULT, "ASharedMemory_create");
        if (pfnASharedMemory_create) {
            return pfnASharedMemory_create(name, size);
        }
    }

    int ret, save_errno;
    int fd = __ashmem_open();
    if (fd < 0) {
        return fd;
    }

    if (name) {
        char buf[ASHMEM_NAME_LEN] = {0};

        strlcpy(buf, name, sizeof(buf));
        ret = ioctl(fd, ASHMEM_SET_NAME, buf);
        if (ret < 0) {
            goto error;
        }
    }

    ret = ioctl(fd, ASHMEM_SET_SIZE, size);
    if (ret < 0) {
        goto error;
    }

    return fd;

error:
    save_errno = errno;
    close(fd);
    errno = save_errno;
    return ret;
}

#endif // __ANDROID_API__ >= 26

#elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))

int ashmem_create_region(const char*, size_t size) {
    char template_path[512];
    snprintf(template_path, sizeof(template_path), "%s/filament-ashmem-%d-XXXXXXXXX",
            Path::getTemporaryDirectory().c_str(), getpid());
    int fd = mkstemp(template_path);
    if (fd == -1) return -1;
    unlink(template_path);
    if (ftruncate(fd, (off_t)size) == -1) {
        close(fd);
        return -1;
    }
    return fd;
}

#else
int ashmem_create_region(const char*, size_t size) {
    char template_path[512];
    snprintf(template_path, sizeof(template_path), "%s/filament-ashmem-%lu-XXXXXXXXX",
            Path::getTemporaryDirectory().c_str(), GetCurrentProcessId());
    const char* tmpPath = _mktemp(template_path);
    int fd = _open(tmpPath, _O_BINARY);
    if (fd == -1) return -1;
    unlink(template_path);
    if (_chsize(fd, size) == -1) {
        _close(fd);
        return -1;
    }
    return fd;
}
#endif

} // namespace utils

redpajama_set_name: RedPajamaGithub


text:
<?php
namespace HcBackend\Data\Exception;

use HcBackend\Exception\ExceptionInterface;

class DomainException extends \RuntimeException implements ExceptionInterface
{
}


text:
package tchannel

// Copyright (c) 2015 Uber Technologies, Inc.

// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import (
	"fmt"
	"runtime"
	"strings"
	"sync"
)

type RecordingFramePool struct {
	mut         sync.Mutex
	allocations map[*Frame]string
	badRelease  []string
}

func NewRecordingFramePool() *RecordingFramePool {
	return &RecordingFramePool{
		allocations: make(map[*Frame]string),
	}
}

func recordStack() string {
	buf := make([]byte, 4096)
	runtime.Stack(buf, false)
	return string(buf)
}

func (p *RecordingFramePool) Get() *Frame {
	p.mut.Lock()
	defer p.mut.Unlock()
	frame := NewFrame(MaxFramePayloadSize)
	p.allocations[frame] = recordStack()
	return frame
}

func zeroOut(bs []byte) {
	for i := range bs {
		bs[i] = 0
	}
}

func (p *RecordingFramePool) Release(f *Frame) {
	// Make sure the payload is not used after this point by clearing the frame.
	zeroOut(f.Payload)
	f.Payload = nil
	zeroOut(f.buffer)
	f.buffer = nil
	zeroOut(f.headerBuffer)
	f.headerBuffer = nil
	f.Header = FrameHeader{}

	p.mut.Lock()
	defer p.mut.Unlock()

	if _, ok := p.allocations[f]; !ok {
		p.badRelease = append(p.badRelease, "bad Release at "+recordStack())
		return
	}

	delete(p.allocations, f)
}

func (p *RecordingFramePool) CheckEmpty() (int, string) {
	p.mut.Lock()
	defer p.mut.Unlock()

	var badCalls []string
	badCalls = append(badCalls, p.badRelease...)
	for f, s := range p.allocations {
		badCalls = append(badCalls, fmt.Sprintf("frame %p: %v not released, get from: %v", f, f.Header, s))
	}
	return len(p.allocations), strings.Join(badCalls, "\n")
}


text:
package com.toypinta.virtaulmouse;

import java.awt.AWTException;
import org.bytedeco.javacpp.Loader;
import org.bytedeco.javacpp.helper.opencv_core.CvArr;
import org.bytedeco.javacpp.opencv_core.CvMemStorage;
import org.bytedeco.javacpp.opencv_core.CvScalar;
import org.bytedeco.javacpp.opencv_core.CvSeq;
import org.bytedeco.javacpp.opencv_core.IplImage;
import static org.bytedeco.javacpp.opencv_core.cvCreateImage;
import static org.bytedeco.javacpp.opencv_core.cvOr;
import static org.bytedeco.javacpp.opencv_core.cvReleaseImage;
import static org.bytedeco.javacpp.opencv_core.cvReleaseMemStorage;
import static org.bytedeco.javacpp.opencv_core.cvScalar;
import static org.bytedeco.javacpp.opencv_core.cvSize;
import static org.bytedeco.javacpp.opencv_highgui.CV_CAP_ANY;
import static org.bytedeco.javacpp.opencv_highgui.CV_CAP_PROP_FRAME_HEIGHT;
import static org.bytedeco.javacpp.opencv_highgui.CV_CAP_PROP_FRAME_WIDTH;
import org.bytedeco.javacpp.opencv_highgui.CvCapture;
import static org.bytedeco.javacpp.opencv_highgui.cvCreateCameraCapture;
import static org.bytedeco.javacpp.opencv_highgui.cvQueryFrame;
import static org.bytedeco.javacpp.opencv_highgui.cvReleaseCapture;
import static org.bytedeco.javacpp.opencv_highgui.cvSetCaptureProperty;
import static org.bytedeco.javacpp.opencv_highgui.cvShowImage;
import static org.bytedeco.javacpp.opencv_highgui.cvWaitKey;
import org.bytedeco.javacpp.opencv_imgproc.CvMoments;

/**
 *
 * @author casanovatoy
 */
public class VirtualMouse {

    public static void main(String[] args) throws AWTException {

        IplImage img1, imgbinG, imgbinB;
        IplImage imghsv;

        CvScalar Gminc = cvScalar(20, 150, 75, 0), Gmaxc = cvScalar(40, 255, 255, 0); // Blue
        CvScalar Bminc = cvScalar(40, 50, 60, 0), Bmaxc = cvScalar(80, 255, 255, 0); // Green

//        CvScalar Bminc = cvScalar(95, 150, 75, 0), Bmaxc = cvScalar(145, 255, 255, 0); // Blue
//        CvScalar Gminc = cvScalar(40, 50, 60, 0), Gmaxc = cvScalar(80, 255, 255, 0); // Green
        //img1 = cvLoadImage("Pic.jpg");
        CvArr mask;
        int w = 320, h = 240;
        imghsv = cvCreateImage(cvSize(w, h), 8, 3);
        imgbinG = cvCreateImage(cvSize(w, h), 8, 1);
        imgbinB = cvCreateImage(cvSize(w, h), 8, 1);
        IplImage imgC = cvCreateImage(cvSize(w, h), 8, 1);
        CvSeq contour1 = new CvSeq(), contour2 = null;
        CvMemStorage storage = CvMemStorage.create();
        CvMoments moments = new CvMoments(Loader.sizeof(CvMoments.class));

        CvCapture capture1 = cvCreateCameraCapture(CV_CAP_ANY);
        cvSetCaptureProperty(capture1, CV_CAP_PROP_FRAME_WIDTH, w);
        cvSetCaptureProperty(capture1, CV_CAP_PROP_FRAME_HEIGHT, h);

        //int i=1;
        while (true) {

            img1 = cvQueryFrame(capture1);
            if (img1 == null) {
                System.err.println("No Image");
                break;
            }

            imgbinB = CcmFilter.Filter(img1, imghsv, imgbinB, Bmaxc, Bminc, contour1, contour2, storage, moments, 1, 0);
            imgbinG = CcmFilter.Filter(img1, imghsv, imgbinG, Gmaxc, Gminc, contour1, contour2, storage, moments, 0, 1);

            cvOr(imgbinB, imgbinG, imgC, mask = null);
//            cvFlip(img1, img1, 1); // Flip Camera Capture
//            cvFlip(imgC, imgC, 1); // Flip Camera Capture
            cvShowImage("Combined", imgC);
            cvShowImage("Original", img1);
            char c = (char) cvWaitKey(15);
            if (c == 'q') {
                break;
            }

        }
        cvReleaseImage(imghsv);
        cvReleaseImage(imgbinG);
        cvReleaseImage(imgbinB);
        cvReleaseImage(imghsv);
        cvReleaseMemStorage(storage);
        cvReleaseCapture(capture1);

    }
}


text:
This program is designed to take stress-strain data as the input and output useful information such as 0.2 %
yield stress, toughness (area under curve), ultimate tensile strength, breaking strength, etc.
This program aims to speed up rate at which stress-strain data can be analysed.

Setup:
1. Install python 3
2. Install modules: scipy, statsmodels, numpy, matplotlib, PyQt4 (instal SIP first)

Using program:
1. Run stressStrainAnalyse python file
2. Click on browse to select data file
>Data file must be in csv format, with strain (in %) column on left, stress (in MPa) column on right
3. Select test type (compression/tensile) from dropdown box
4. Adjust other settings as necessary to tune accuracy and suit your preferences (see 'Program Details.txt' for
more information.
5. Click 'Run Analysis' button to start analysis.
>It usually takes less than 10 seconds to perform the analysis using default settings.

NOTE: It is strongly recommended that you visually check the results produced by this program against what you
expect from looking at the stress-strain curve.


text:
package org.apache.accumulo.core.client.impl;

import static com.google.common.base.Charsets.UTF_8;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.impl.thrift.ClientService;
import org.apache.accumulo.core.client.impl.thrift.ClientService.Client;
import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.util.ArgumentChecker;
import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.core.util.ServerServices;
import org.apache.accumulo.core.util.ServerServices.Service;
import org.apache.accumulo.core.util.ThriftUtil;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.zookeeper.ZooCache;
import org.apache.log4j.Logger;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;

public class ServerClient {
  private static final Logger log = Logger.getLogger(ServerClient.class);
  private static final Map<String,ZooCache> zooCaches = new HashMap<String,ZooCache>();

  private synchronized static ZooCache getZooCache(Instance instance) {
    ZooCache result = zooCaches.get(instance.getZooKeepers());
    if (result == null) {
      result = new ZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut(), null);
      zooCaches.put(instance.getZooKeepers(), result);
    }
    return result;
  }

  public static <T> T execute(Instance instance, ClientExecReturn<T,ClientService.Client> exec) throws AccumuloException, AccumuloSecurityException {
    try {
      return executeRaw(instance, exec);
    } catch (ThriftSecurityException e) {
      throw new AccumuloSecurityException(e.user, e.code, e);
    } catch (AccumuloException e) {
      throw e;
    } catch (Exception e) {
      throw new AccumuloException(e);
    }
  }

  public static void execute(Instance instance, ClientExec<ClientService.Client> exec) throws AccumuloException, AccumuloSecurityException {
    try {
      executeRaw(instance, exec);
    } catch (ThriftSecurityException e) {
      throw new AccumuloSecurityException(e.user, e.code, e);
    } catch (AccumuloException e) {
      throw e;
    } catch (Exception e) {
      throw new AccumuloException(e);
    }
  }

  public static <T> T executeRaw(Instance instance, ClientExecReturn<T,ClientService.Client> exec) throws Exception {
    while (true) {
      ClientService.Client client = null;
      String server = null;
      try {
        Pair<String,Client> pair = ServerClient.getConnection(instance);
        server = pair.getFirst();
        client = pair.getSecond();
        return exec.execute(client);
      } catch (TTransportException tte) {
        log.debug("ClientService request failed " + server + ", retrying ... ", tte);
        UtilWaitThread.sleep(100);
      } finally {
        if (client != null)
          ServerClient.close(client);
      }
    }
  }

  public static void executeRaw(Instance instance, ClientExec<ClientService.Client> exec) throws Exception {
    while (true) {
      ClientService.Client client = null;
      String server = null;
      try {
        Pair<String,Client> pair = ServerClient.getConnection(instance);
        server = pair.getFirst();
        client = pair.getSecond();
        exec.execute(client);
        break;
      } catch (TTransportException tte) {
        log.debug("ClientService request failed " + server + ", retrying ... ", tte);
        UtilWaitThread.sleep(100);
      } finally {
        if (client != null)
          ServerClient.close(client);
      }
    }
  }

  static volatile boolean warnedAboutTServersBeingDown = false;

  public static Pair<String,ClientService.Client> getConnection(Instance instance) throws TTransportException {
    return getConnection(instance, true);
  }

  public static Pair<String,ClientService.Client> getConnection(Instance instance, boolean preferCachedConnections) throws TTransportException {
    AccumuloConfiguration conf = instance.getConfiguration();
    return getConnection(instance, preferCachedConnections, conf.getTimeInMillis(Property.GENERAL_RPC_TIMEOUT));
  }

  public static Pair<String,ClientService.Client> getConnection(Instance instance, boolean preferCachedConnections, long rpcTimeout) throws TTransportException {
    ArgumentChecker.notNull(instance);
    // create list of servers
    ArrayList<ThriftTransportKey> servers = new ArrayList<ThriftTransportKey>();

    // add tservers

    ZooCache zc = getZooCache(instance);
    AccumuloConfiguration conf = instance.getConfiguration();
    for (String tserver : zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZTSERVERS)) {
      String path = ZooUtil.getRoot(instance) + Constants.ZTSERVERS + "/" + tserver;
      byte[] data = ZooUtil.getLockData(zc, path);
      if (data != null) {
        String tserverData = new String(data, UTF_8);
        if (!tserverData.equals("master")) {
          servers.add(new ThriftTransportKey(new ServerServices(tserverData).getAddressString(Service.TSERV_CLIENT), conf.getPort(Property.TSERV_CLIENTPORT),
              rpcTimeout));
        }
      }
    }

    boolean opened = false;
    try {
      Pair<String,TTransport> pair = ThriftTransportPool.getInstance().getAnyTransport(servers, preferCachedConnections);
      ClientService.Client client = ThriftUtil.createClient(new ClientService.Client.Factory(), pair.getSecond());
      opened = true;
      warnedAboutTServersBeingDown = false;
      return new Pair<String,ClientService.Client>(pair.getFirst(), client);
    } finally {
      if (!opened) {
        if (!warnedAboutTServersBeingDown) {
          if (servers.isEmpty()) {
            log.warn("There are no tablet servers: check that zookeeper and accumulo are running.");
          } else {
            log.warn("Failed to find an available server in the list of servers: " + servers);
          }
          warnedAboutTServersBeingDown = true;
        }
      }
    }
  }

  public static void close(ClientService.Client client) {
    if (client != null && client.getInputProtocol() != null && client.getInputProtocol().getTransport() != null) {
      ThriftTransportPool.getInstance().returnTransport(client.getInputProtocol().getTransport());
    } else {
      log.debug("Attempt to close null connection to a server", new Exception());
    }
  }
}


text:
$(document).ready(function() {

  var completeItem = function(item) {
    $.ajax({
        type: "POST",
        url: '/lists/' + $('#listId').text() + '/items/' + item.id,
        data: { _method: 'PUT', item : { completed : !item.completed } },
        dataType: 'json',
        success: function(msg) {
          clearLists();
          reloadLists();
        }
    });
  };

  var deleteItem = function(item) {
    $.ajax({
        type: "POST",
        url: '/lists/' + $('#listId').text() + '/items/' + item.id,
        data: { _method: 'DELETE' },
        dataType: 'json',
        success: function(msg) {
          clearLists();
          reloadLists();
        }
    });
  };

  var itemTextFor = function(item) {
    var item_state = item.completed ? "completed" : "active";

    var tag = '
';
    if ( !item.completed ) {
      tag += '';
    }

    var toggle_item_verb = item.completed ? "uncomplete" : "complete";

    return tag +
      '' +
      '<input type="checkbox" class="' + item_state + 'ListItemCheckbox" name="list_item_' + item.id + '_checkbox" value="selected" title="Select to apply bulk actions to this list item using the selected box above" />' +
      '' +
      item.name +
      '' +
      '' +
      '
';
  };

  var clearLists = function() {
    $('.item_list').text('');
  };

  var populatePageWith = function(data) {
    var completed_items = 0;
    var active_items    = 0;

    $.each(data, function(i, item) {
      var item_state = item.completed ? "completed" : "active";

      $("#" + item_state + "_items").find('ul').append(itemTextFor(item));
      $("#" + item_state + "_items ul li:last-child").data('item', item);

      var editable_item_name = "#editable_item_" + item.id + "_name";
      $(editable_item_name).editable('/lists/' + $('#listId').text() + '/items/' + item.id + '.json', {
        submit   : 'OK',
        cancel   : 'Cancel',
        type     : 'textarea',
        indicator: 'Saving...',
        tooltip  : 'Click to edit this list item',
        width    : '350px',
        callback : function(response) { $(editable_item_name).html(jQuery.parseJSON(response).name ) },
        name     : 'item[name]',
        method   : 'PUT',
        onblur   : 'ignore'
      });

      item.completed ? completed_items++ : active_items++;
    });

    $('#active_item_count').html('(' + active_items + ')');
    $('#completed_item_count').html('(' + completed_items + ')');

    $(".complete_box").bind('click', function() {
      completeItem($(this).parent('li').data('item'));
    });

    $(document.body).data('activeItemsSelected', false);
    $(document.body).data('completedItemsSelected', false);

    $(".delete_box").bind('click', function() {
      var answer = confirm("Are you sure you wish to delete this item?");

      if (answer) {
        deleteItem($(this).parent('li').data('item'));
        return false;
      }
    });

    $('#sortable').sortable('refresh');
  };

  var reloadLists = function() {
    if ( $('#listId').text() != "" ) {
      // Load the lists from JSON and construct them in the lists section dynamically
      $.getJSON('/lists/' + $('#listId').text() + '/items.json', function(data) {
        populatePageWith(data);
      });
    }
  };

  $("#sortable").sortable({
    handle : 'img.handleImage',
    axis : 'y'
  });

  $("#sortable").disableSelection();

  // Sortable list processing
  $("#sortable").bind( "sortupdate", function(event, ui) {
    var itemIds = $('ul#sortable li');
    var itemOrder = new Array();

    for (var i = 0; i < itemIds.length; i++) {
      itemOrder[i] = $(itemIds[i]).data('item').id;
    }

    $.post('/list_order', {
      list_id : $('#listId').text(),
      authenticity_token : $('#authToken').text(),
      items : itemOrder
    });
  });

  reloadLists();

  $('.list_title').editable('/lists/' + $('#listId').text() + '.json', {
    submit  : 'OK',
    cancel  : 'Cancel',
    tooltip : 'Click to edit this list title',
    width   : 260,
    callback: function(response) { $( '.list_title').html(jQuery.parseJSON(response).name ) },
    name    : 'list[name]',
    method  : 'PUT'
  });

  $('#sortAction').change(function() {
    var selectedValue = $('#sortAction option:selected').text();
    $.getJSON('/lists/' + $('#listId').text() + '/items.json?sort=' + selectedValue +
                          '&keyword=' + $('#filterListTextField').val(), function(data) {
      clearLists();
      populatePageWith(data);
    });

    return false;
  });

  $('#addItemForm').hide();

  $('#addItemCancel').click(function(){
    $('#addItemButton').show();
    $('#addItemForm').hide();
    $('#listItems').focus();
  });

  $("#newItemName").bind('keyup', 'esc', function() {
    $('#addItemButton').show();
    $('#addItemForm').hide();
  });

  var revealAddItemForm = function() {
    $('#addItemForm').show();
    $('#addItemButton').hide();
    $("#newItemName").focus();
  };

  $('#addItemButton').click(function() {
    revealAddItemForm();
  });

  $(document).bind('keyup', 'a', function(){
    revealAddItemForm();
  });

  // Accepts 'active' or 'completed' as toggle section
  var toggleSelectedState = function(sectionToToggle) {
    var newSelectedState = !$(document.body).data(sectionToToggle + 'ItemsSelected');
    var checkBoxes = $("." + sectionToToggle + "ListItemCheckbox");

    for (var i = 0; i < checkBoxes.length; i++) {
      $(checkBoxes[i]).attr('checked', newSelectedState);
    }

    $(document.body).data(sectionToToggle + 'ItemsSelected', newSelectedState);
    return false;
  };

  $("#selectActiveItems").click(function(){
    toggleSelectedState('active');
  });

  $("#selectCompletedItems").click(function(){
    toggleSelectedState('completed');
  });

  var submitForm = function() {
    var itemName = $('#newItemName').val();
    var listId = $('#listId').text();
    var authToken = $('#authToken').text();

    var hideNewItemForm = function(data) {
      $('#addItemButton').show();
      $('#addItemForm').hide();
      $('#newItemName').val('');
    };

    var successFunction = function(data) {
      hideNewItemForm();
      clearLists();
      reloadLists();
    };

    var errorFunction = function(xhr, ajaxOptions, thrownError) {
      alert('Item save failed.');
    };

    if (!itemName.length == 0) {
      $.ajax({
        url: '/lists/' + listId + '/items',
        type: "POST",
        data: { item : { name: itemName } },
        success: successFunction,
        error: errorFunction
      });
    } else {
      hideNewItemForm();
      alert('Unable to create item with empty name.');
    }

    return false;
  };

  $('#addItemSubmit').click(submitForm);
  $('#newItemForm').submit(submitForm);

  var delayed;
  $('#filterListTextField').keyup(function() {
       clearTimeout(delayed);
       var value = this.value;
       delayed = setTimeout(function() {
         var selectedValue = $('#sortAction option:selected').text();
         $.getJSON('/lists/' + $('#listId').text() + '/items.json?sort=' + selectedValue +
                               '&keyword=' + $('#filterListTextField').val(), function(data) {
           clearLists();
           populatePageWith(data);
         });
       }, 900);
  });

  $('#selectedAction').change(function() {

    var selectedValue = $('#selectedAction option:selected').text();

    var checkedItems = $(':checkbox:checked');
    var selectedItemIds = new Array();
    for (var i = 0; i < checkedItems.length ; i++) {
      selectedItemIds[i] = $(checkedItems[i]).parent('li').data('item').id;
    }

    var reloadItemsFunction = function() {
      clearLists();
      reloadLists();
    };

    $.ajax({
      url: '/lists/' + $('#listId').text() + '/bulk_update',
      type: "PUT",
      data: { apply : selectedValue, items : selectedItemIds, authenticity_token : $('#authToken').text() },
      success: reloadItemsFunction
    });

    return false;
  });
});


text:
namespace occluded { namespace buffers { namespace attributes {

const std::size_t attribute::ATTRIB_SIZE = 4; // May change if more attribute types are added

attribute::attribute( const std::string& name, const unsigned int arity, const attribute_t type, const bool normalized ):
	m_name( name ),
	m_arity( arity ),
	m_type( type ),
	m_normalized( normalized )
{
}

attribute::~attribute()
{
}

const std::string& attribute::get_name() const {
	return m_name;
}

const unsigned int attribute::get_arity() const {
	return m_arity;
}

const attribute_t attribute::get_type() const {
	return m_type;
}

const std::size_t attribute::get_component_size() const {
	return ATTRIB_SIZE;
}

const std::size_t attribute::get_attrib_size() const {
	return ATTRIB_SIZE * m_arity;
}

const bool attribute::is_normalized() const {
	return m_normalized;
}

const bool attribute::operator==( const attribute& other ) const {
	return this->m_name == other.m_name && this->m_arity == other.m_arity && this->m_type == other.m_type;
}

const bool attribute::operator!=( const attribute& other ) const {
	return !( *this == other );
}

} // end of attributes namespace
} // end of buffers namespace
} // end of occluded namespace


text:
..
      Copyright 2014-2015 OpenStack Foundation
      All Rights Reserved.

      Licensed under the Apache License, Version 2.0 (the "License"); you may
      not use this file except in compliance with the License. You may obtain
      a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
      WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
      License for the specific language governing permissions and limitations
      under the License.

===============================
Mistral workflow VIM monitoring
===============================

For the purpose to make tacker server scale, the mistral workflow is used to
re-implement the VIM monitoring feature.

The main monitoring process is like this:

- user registers a VIM
- tacker server saves it into database
- tacker server generates a mistral workflow and executes it
- the VIM monitor mistral action is executed and do the monitoring, if there
  is status change, it will RPC call conductor
- the conductor changes the VIM status

Feature exploration
===================

Firstly register a VIM:

.. code-block:: console

    $ openstack vim register --config-file ~/testvim_config.yaml testvim2 -c id -c name -c status
    Created a new vim:
    +--------+--------------------------------------+
    | Field  | Value                                |
    +--------+--------------------------------------+
    | id     | 4406cf8f-f2af-46cc-bfb9-e00add5805b7 |
    | name   | testvim2                             |
    | status | PENDING                              |
    +--------+--------------------------------------+

..

The registered VIM's id is '4406cf8f-f2af-46cc-bfb9-e00add5805b7', after this,
there is a mistral workflow named as
'vim_id_4406cf8f-f2af-46cc-bfb9-e00add5805b7', is generated in mistral:

.. code-block:: console

    $ openstack workflow list --filter name=vim_id_4406cf8f-f2af-46cc-bfb9-e00add5805b7 -c ID -c Name
    +--------------------------------------+---------------------------------------------+
    | ID                                   | Name                                        |
    +--------------------------------------+---------------------------------------------+
    | 0cd0deff-6132-4ee2-a181-1c877cd594cc | vim_id_4406cf8f-f2af-46cc-bfb9-e00add5805b7 |
    +--------------------------------------+---------------------------------------------+

..

and it is executed:

.. code-block:: console

    $ openstack workflow execution list --filter workflow_name=vim_id_4406cf8f-f2af-46cc-bfb9-e00add5805b7 -c ID -c 'Workflow name' -c State
    +--------------------------------------+---------------------------------------------+---------+
    | ID                                   | Workflow name                               | State   |
    +--------------------------------------+---------------------------------------------+---------+
    | 99ced0e2-be09-4219-ab94-299df8ee8789 | vim_id_4406cf8f-f2af-46cc-bfb9-e00add5805b7 | RUNNING |
    +--------------------------------------+---------------------------------------------+---------+

..

The monitoring task is running too:

.. code-block:: console

    $ openstack task execution list --filter workflow_name=vim_id_4406cf8f-f2af-46cc-bfb9-e00add5805b7 -c ID -c 'Workflow name' -c Name  -c State
    +--------------------------------------+-----------------------------+---------------------------------------------+---------+
    | ID                                   | Name                        | Workflow name                               | State   |
    +--------------------------------------+-----------------------------+---------------------------------------------+---------+
    | f2fe2904-6ff2-4531-9bd0-4c998ef1515f | monitor_ping_vimPingVIMTASK | vim_id_4406cf8f-f2af-46cc-bfb9-e00add5805b7 | RUNNING |
    +--------------------------------------+-----------------------------+---------------------------------------------+---------+

..

Of course, the VIM's state is in 'REACHABLE' status:

.. code-block:: console

    $ openstack vim list --name testvim2 -c id -c name -c status
    +--------------------------------------+----------+-----------+
    | id                                   | name     | status    |
    +--------------------------------------+----------+-----------+
    | 4406cf8f-f2af-46cc-bfb9-e00add5805b7 | testvim2 | REACHABLE |
    +--------------------------------------+----------+-----------+

..

The deletion of VIM will lead to removal of all of these mistral resources.

Rabbitmq queues
===============

Each mistral VIM monitoring action is listening on three queues:

.. code-block:: console

    ~/tacker$ sudo rabbitmqctl list_queues | grep -i KILL_ACTION
    KILL_ACTION    0
    KILL_ACTION.4406cf8f-f2af-46cc-bfb9-e00add5805b7    0
    KILL_ACTION_fanout_a8118e2e18b9443986a1b37f7b082ab9    0

..

But only KILL_ACTION with VIM id as suffix is used.


text:
/* eslint no-debugger: 0 */
"use strict";
const resolveId = require('postcss-import/lib/resolve-id.js');
const AtImport = require('postcss-import');
const resolve = require('import-sub');

function sub(options) {
  /**
   * Support simple mode of rules definition
   */
  let rules;
  if (options instanceof Array) {
    rules = options;
    options = {};
  } else {
    rules = options.sub;
    delete options.sub;
  }

  options.originalResolve = resolveId;
  /**
   * Define real options
   */
  return Object.assign({}, options, {
    resolve: function(id, base, importOptions) {
      return resolve(rules, Object.assign(
        {},
        options,
        {
          base: base,
          request: id,
          importOptions: importOptions || {},
        }
      ));
    }
  });
}

module.exports = function substitute(options) {
  return AtImport(sub(options));
}

module.exports.sub = sub;
module.exports.process = AtImport.process;
module.exports.postcss = AtImport.postcss;
module.exports.AtImport = AtImport;


text:
package org.apache.bcel.generic;

/**
 * DALOAD - Load double from array
 *
 * <PRE>
 * Stack: ..., arrayref, index -> ..., result.word1, result.word2
 * </PRE>
 */
public class DALOAD extends ArrayInstruction implements StackProducer {

    /**
     * Load double from array
     */
    public DALOAD() {
        super(org.apache.bcel.Const.DALOAD);
    }

    /**
     * Call corresponding visitor method(s). The order is: Call visitor methods of implemented interfaces first, then call
     * methods according to the class hierarchy in descending order, i.e., the most specific visitXXX() call comes last.
     *
     * @param v Visitor object
     */
    @Override
    public void accept(final Visitor v) {
        v.visitStackProducer(this);
        v.visitExceptionThrower(this);
        v.visitTypedInstruction(this);
        v.visitArrayInstruction(this);
        v.visitDALOAD(this);
    }
}


text:
<!DOCTYPE html>

    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <title></title>

    <link href="../../Content/Office.css" rel="stylesheet" type="text/css" />

    <link href="../App.css" rel="stylesheet" type="text/css" />

    <link href="Home.css" rel="stylesheet" type="text/css" />

Welcome

This example will read the current document selection.

            <button id="get-data-from-selection">Get data from selection</button>

                Find more samples online...


text:
package com.films.utils;

import java.util.Properties;

public class ConfigInfo {
	private static Properties cache = new Properties();
	static{
		try {
			cache.load(ConfigInfo.class.getClassLoader().getResourceAsStream("merchantInfo.properties"));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static String getValue(String key){
		return cache.getProperty(key);
	}
}


text:
#import "AFNetworkTask.h"
#import "MJExtension.h"
#import "AFNetworkDataBlockAdapter.h"
#import "AFNetworkDataCovertModelAdapter.h"

@implementation AFNetworkMsg

- (instancetype)init
{
    self = [super init];
    if (self) {
    }
    return self;
}

-(void)recyle{
    self.responseHeaders = nil;
}
-(void)dealloc{
#if DEBUG
    NSLog(@"------%@ dealloc",self.class);
#endif
}

@end

@interface AFNetworkTask()

@property (nonatomic,strong) NSMutableArray<AFNetworkDataAdapter *>  * _Nonnull dataAdapters NS_AVAILABLE_IOS(7_0);  //请求协议类型

@property (nonatomic,strong) NSURLSessionTask *sessionTask;
@property (nonatomic,strong) AFNetworkMsg *msg;
@property (nonatomic,strong) AFNetworkTaskSession *networkTaskSession;

@end

@implementation AFNetworkTask
@synthesize dataAdapters;

- (instancetype _Nonnull)initWithTaskSession:(AFNetworkTaskSession * _Nonnull)session
{
    self = [super init];
    if (self) {

        dataAdapters= [[NSMutableArray alloc] initWithCapacity:0];
        self.networkTaskSession = session;
        self.msg = [AFNetworkMsg new];

    }
    return self;
}

-(void)addDataAdapter:(AFNetworkDataAdapter * _Nonnull)adapter{
    if([[dataAdapters lastObject] isKindOfClass:[AFNetworkDataBlockAdapter class]])
        [dataAdapters insertObject:adapter atIndex:dataAdapters.count-1];
    else
        [dataAdapters addObject:adapter];
}

-(void)addDefaultStructure:(Class)clazz{
    AFNetworkDataCovertModelAdapter * _Nonnull dataAdapter =[AFNetworkDataCovertModelAdapter new];
    [dataAdapter addStructure:clazz];
    [self addDataAdapter:dataAdapter];

}
-(void)addDataBlock:(AFNetworkingTaskDataBlock _Nullable)dataBlock{
    AFNetworkDataBlockAdapter * _Nonnull dataAdapter =[AFNetworkDataBlockAdapter new];
    [dataAdapter dataBlock:dataBlock];
    [self addDataAdapter:dataAdapter];
}

#pragma mark - GET

-(void)GET:(NSString * _Nonnull)url  finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{
      [self GET:url form:nil finishedBlock:finishedBlock];
}
-(void)GET:(NSString * _Nonnull)url data:(id<AFNetworkRequestData> _Nullable)data finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{
    NSDictionary *from  =[(Class)data mj_keyValues];

      [self GET:url form:from finishedBlock:finishedBlock];
}

-(void)GET:(NSString * _Nonnull)URLString
                          form:(NSDictionary * _Nullable)form
                 finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

    __block AFNetworkTask *weakSelf = self;

    self.sessionTask =  [self.networkTaskSession GET:URLString parameters:form success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {

        [weakSelf processSuccessResult:responseObject task:task msg:weakSelf.msg  finish:finishedBlock];

    } failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {

        [weakSelf processErrorResult:task error:error msg:weakSelf.msg finish:finishedBlock];

    }];

}
#pragma mark - POST

-(void)POST:(NSString * _Nonnull)url data:(id<AFNetworkRequestData> _Nullable)data finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{
    NSDictionary *from  =[(Class)data mj_keyValues];

      [self POST:url form:from finishedBlock:finishedBlock];
}

- (void)POST:(NSString * _Nonnull)URLString
                            form:(NSDictionary * _Nullable)form
                   finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

    __block typeof(self) weakSelf = self;

    self.sessionTask = [self.networkTaskSession POST:URLString parameters:form success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {

        [weakSelf processSuccessResult:responseObject task:task  msg:weakSelf.msg finish:finishedBlock];
    } failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {

        [weakSelf processErrorResult:task error:error msg:weakSelf.msg finish:finishedBlock];
    }];

}

- (void)POST:(NSString * _Nonnull)URLString
                            data:(id<AFNetworkRequestData> _Nullable)data
                           files:(NSDictionary * _Nullable)files
                   finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

    NSDictionary *from  =[(Class)data mj_keyValues];

      [self POST:URLString form:from files:files finishedBlock:finishedBlock];
}

- (void)POST:(NSString * _Nonnull)URLString
                            form:(NSDictionary * _Nullable)from
                           files:(NSDictionary * _Nullable)files
                   finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

      [self POST:URLString form:from files:files progressBlock:NULL finishedBlock:finishedBlock];

}
-(void)POST:(NSString * _Nonnull)URLString form:(NSDictionary * _Nullable)form files:(NSDictionary * _Nullable)files progressBlock:(AFNetworkTaskProgressBlock _Nullable)progressBlock finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

    __block typeof(self) weakSelf = self;

    self.sessionTask =   [self.networkTaskSession uploadTaskWithHTTPMethod:@"POST" URLString:URLString parameters:form files:files progressBlock:NULL success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {
        [weakSelf processSuccessResult:responseObject task:task msg:weakSelf.msg finish:finishedBlock];
    } failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
        [weakSelf processErrorResult:task error:error msg:weakSelf.msg finish:finishedBlock];
    }];

}
#pragma mark - PUT

-(void)PUT:(NSString * _Nonnull)url data:(id<AFNetworkRequestData> _Nullable)data finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{
    NSDictionary *from  =[(Class)data mj_keyValues];

      [self PUT:url form:from finishedBlock:finishedBlock];
}

- (void)PUT:(NSString * _Nonnull)URLString
                           form:(NSDictionary * _Nullable)form
                  finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

    __block typeof(self) weakSelf = self;

    self.sessionTask =  [self.networkTaskSession PUT:URLString parameters:form success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {

        [weakSelf processSuccessResult:responseObject task:task msg:weakSelf.msg finish:finishedBlock];
    } failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {

        [weakSelf processErrorResult:task error:error msg:weakSelf.msg finish:finishedBlock];
    }];

}

- (void)PUT:(NSString * _Nonnull)URLString
                           data:(id<AFNetworkRequestData> _Nullable)data
                          files:(NSDictionary * _Nullable)files
                  finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

    NSDictionary *from  =[(Class)data mj_keyValues];

      [self PUT:URLString form:from files:files finishedBlock:finishedBlock];
}

- (void)PUT:(NSString * _Nonnull)URLString
                           form:(NSDictionary * _Nullable)form
                          files:(NSDictionary * _Nullable)files
                  finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

      [self PUT:URLString form:form files:files progressBlock:NULL finishedBlock:finishedBlock];

}
-(void)PUT:(NSString * _Nonnull)URLString form:(NSDictionary * _Nullable)form files:(NSDictionary * _Nullable)files progressBlock:(AFNetworkTaskProgressBlock _Nullable)progressBlock finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

    __block typeof(self) weakSelf = self;

    self.sessionTask =    [self.networkTaskSession uploadTaskWithHTTPMethod:@"PUT" URLString:URLString parameters:form files:files progressBlock:NULL success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {
        [weakSelf processSuccessResult:responseObject task:task msg:weakSelf.msg finish:finishedBlock];
    } failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
        [weakSelf processErrorResult:task error:error msg:weakSelf.msg finish:finishedBlock];
    }];

}
#pragma mark - PATCH

-(void)PATCH:(NSString * _Nonnull)url finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

       [self PATCH:url form:nil finishedBlock:finishedBlock];
}
-(void)PATCH:(NSString * _Nonnull)url data:(id<AFNetworkRequestData> _Nullable)data finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{
    NSDictionary *from  =[(Class)data mj_keyValues];

       [self PATCH:url form:from finishedBlock:finishedBlock];
}

-(void)PATCH:(NSString * _Nonnull)URLString
                            form:(NSDictionary * _Nullable)form
                   finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

    __block typeof(self) weakSelf = self;

    self.sessionTask = [self.networkTaskSession PATCH:URLString parameters:form success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {

        [weakSelf processSuccessResult:responseObject task:task msg:weakSelf.msg finish:finishedBlock];

    } failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {

        [weakSelf processErrorResult:task error:error msg:weakSelf.msg finish:finishedBlock];

    }];

}
#pragma mark - DELETE

-(void)DELETE:(NSString * _Nonnull)url finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

      [self DELETE:url form:nil finishedBlock:finishedBlock];
}
-(void)DELETE:(NSString * _Nonnull)url data:(id<AFNetworkRequestData> _Nullable)data finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{
    NSDictionary *from  =[(Class)data mj_keyValues];

        [self DELETE:url form:from finishedBlock:finishedBlock];
}

-(void)DELETE:(NSString * _Nonnull)URLString
                             form:(NSDictionary * _Nullable)form
                    finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

    __block typeof(self) weakSelf = self;

    self.sessionTask = [self.networkTaskSession DELETE:URLString parameters:form success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {

        [weakSelf processSuccessResult:responseObject task:task msg:weakSelf.msg finish:finishedBlock];

    } failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {

        [weakSelf processErrorResult:task error:error msg:weakSelf.msg finish:finishedBlock];

    }];

}
#pragma mark - DOWNLOAD

-(void)DOWNLOAD:(NSString * _Nonnull)url  finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

       [self DOWNLOAD:url form:nil finishedBlock:finishedBlock];
}

- (void)DOWNLOAD:(NSString * _Nonnull)URLString
                                data:(id<AFNetworkRequestData> _Nullable)data
                       finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

    NSDictionary *from  =[(Class)data mj_keyValues];

       [self DOWNLOAD:URLString form:from  finishedBlock:finishedBlock];
}

- (void)DOWNLOAD:(NSString * _Nonnull)URLString
                                form:(NSDictionary * _Nullable)form
                       finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

       [self DOWNLOAD:URLString form:form progressBlock:NULL finishedBlock:finishedBlock];

}

-(void)DOWNLOAD:(NSString * _Nonnull)URLString data:(id<AFNetworkRequestData> _Nullable)data progressBlock:(AFNetworkTaskProgressBlock _Nullable)progressBlock finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{
    NSDictionary *from  =[(Class)data mj_keyValues];

       [self DOWNLOAD:URLString form:from progressBlock:progressBlock finishedBlock:finishedBlock];

}

-(void)DOWNLOAD:(NSString * _Nonnull)URLString form:(NSDictionary * _Nullable)form progressBlock:(AFNetworkTaskProgressBlock _Nullable)progressBlock finishedBlock:(AFNetworkingTaskFinishedBlock _Nullable)finishedBlock{

    __block typeof(self) weakSelf = self;

    self.sessionTask =  [self.networkTaskSession downloadTaskWithHTTPMethod:@"GET" URLString:URLString parameters:form  progressBlock:progressBlock success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {
        [weakSelf processSuccessResult:responseObject task:task msg:weakSelf.msg finish:finishedBlock];
    } failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
        [weakSelf processErrorResult:task error:error msg:weakSelf.msg finish:finishedBlock];
    }];

}

#pragma mark - process  Result
-(void)processSuccessResult:(id _Nullable)responseObject task:(NSURLSessionDataTask * _Nonnull)task  msg:(AFNetworkMsg * _Nullable)msg finish:(AFNetworkingTaskFinishedBlock _Nullable)finish{
    NSHTTPURLResponse  *response = (NSHTTPURLResponse  *)task.response;

    [self.networkTaskSession.container sessionResponseAdapter:response msg:msg];

    id body = [self processSuccessWithTask:task response:response msg:msg originalObj:responseObject];
    if(finish){
        finish(msg,responseObject,body);
    }

    [self recyle];

}
-(void)processErrorResult:(NSURLSessionDataTask * _Nonnull)task error:(NSError * _Nullable)error msg:(AFNetworkMsg * _Nullable)msg finish:(AFNetworkingTaskFinishedBlock _Nullable)finish{
    [self processFailWithTask:task msg:msg error:error];
    if(finish){
        finish(msg,nil,nil);
    }

    [self recyle];

}

-(id)processSuccessWithTask:(NSURLSessionTask * _Nonnull)task response:(NSHTTPURLResponse * _Nonnull)response  msg:(AFNetworkMsg * _Nullable)msg  originalObj:(id _Nullable)originalObj{
    id parentObj = originalObj;
    id returnObj = nil;

    @try {
        for (AFNetworkDataAdapter * _Nonnull adapter in self.dataAdapters) {
            id returnValue = nil;
            AFNetworkDataType  dataType=  [adapter processSuccessWithTask:task originalObj:originalObj parentObj:parentObj msg:msg returnObj:&returnValue];
            parentObj = returnValue;
            if(dataType == AFNetworkDataTypeData&&returnValue!=nil){
                returnObj = returnValue;
                //                break;
            }
        }
        msg.errorCode = AFNetworkStatusCodeSuccess;
    } @catch (NSException *exception) {
        msg.errorCode = AFNetworkStatusCodeDataError;
    }

    return returnObj;
}
-(void)processFailWithTask:(NSURLSessionTask * _Nonnull)task  msg:(AFNetworkMsg * _Nullable)msg error:(NSError * _Nullable)error{
    for (AFNetworkDataAdapter * _Nonnull adapter in self.dataAdapters) {
        [adapter processFailWithTask:task msg:msg error:error];
    }
    msg.errorCode = AFNetworkStatusCodeHttpError;
    msg.httpStatusCode = error.code;
}

-(void)recyle{

    self.networkTaskSession= nil;
    [self.msg recyle];
    self.msg= nil;
    self.sessionTask= nil;

    for (AFNetworkDataAdapter * _Nonnull adapter in self.dataAdapters) {
        [adapter recyle];
    }
    [dataAdapters removeAllObjects];
    dataAdapters = nil;

}
-(void)cancel{
    [self.sessionTask cancel];
}
-(void)dealloc{
#if DEBUG
        NSLog(@"------%@ dealloc",self.class);
#endif
}
@end


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>${groupId}</groupId>
    <artifactId>${artifactId}</artifactId>
    <version>${version}</version>
    <packaging>war</packaging>

    <name>${artifactId}</name>

    <dependencies>

        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.7</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.7</version>
        </dependency>

    </dependencies>

    <build>
        <finalName>${artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>


text:
require 'active_support/core_ext/hash'

module Ufo
  module Util
    # The default cluster normally defaults to the Ufo.env value.
    # But it can be overriden by ufo/settings.yml cluster
    #
    # More info: http://ufoships.com/docs/settings/
    def default_cluster(service)
      # to_s.to_sym in case service is nil
      settings.dig(:service_cluster, service.to_s.to_sym) ||
      settings[:cluster] ||
      Ufo.env
    end

    # Keys are strings for simplicity.
    def settings
      @settings ||= Ufo.settings
    end

    # Custom user params from .ufo/params.yml
    # Param keys are symbols for the aws-sdk calls.
    def user_params
      @user_params ||= Param.new.data
    end

    def execute(command, local_options={})
      if @options[:noop] && !local_options[:live]
        say "NOOP: #{command}"
        result = true # always success with no noop for specs
      else
        if local_options[:use_system]
          result = system(command)
        else
          result = `#{command}`
        end
      end
      result
    end

    # http://stackoverflow.com/questions/4175733/convert-duration-to-hoursminutesseconds-or-similar-in-rails-3-or-ruby
    def pretty_time(total_seconds)
      minutes = (total_seconds / 60) % 60
      seconds = total_seconds % 60
      if total_seconds < 60
        "#{seconds.to_i}s"
      else
        "#{minutes.to_i}m #{seconds.to_i}s"
      end
    end

    def display_params(options)
      puts YAML.dump(options.deep_stringify_keys)
    end

    def task_definition_arns(service, max_items=10)
      resp = ecs.list_task_definitions(
        family_prefix: service,
        sort: "DESC",
      )
      arns = resp.task_definition_arns
      arns = arns.select do |arn|
        task_definition = arn.split('/').last.split(':').first
        task_definition == service
      end
      arns[0..max_items]
    end
  end
end


text:
package org.twobit.spacehack.tiles;

import org.twobit.spacehack.utility.GameConstants;

import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.math.Rectangle;

public class Tileset
{
	Texture image;
	Integer tileWidthInPixels;
	Integer tileHeightInPixels;
	Integer tilesWide;
	Integer tilesHigh;
	Integer tileWidth;
	Integer tileHeight;

	Rectangle[] sourceRectangles;

	public Tileset(Texture image, Integer tileWidthInPixels,
			Integer tileHeightInPixels, Integer tilesWide, Integer tilesHigh) {
		super();
		this.image = image;
		this.tileWidthInPixels = tileWidthInPixels;
		this.tileHeightInPixels = tileHeightInPixels;
		this.tilesWide = tilesWide;
		this.tilesHigh = tilesHigh;

		int tiles = tilesWide * tilesHigh;
		sourceRectangles = new Rectangle[tiles];

		int tile = 0;

        for (int y = 0; y < tilesHigh; y++)
            for (int x = 0; x < tilesWide; x++)
            {
                sourceRectangles[tile] = new Rectangle((x * GameConstants.tileWidth), (y * GameConstants.tileHeight), GameConstants.tileWidth, GameConstants.tileHeight);
                tile++;
            }
	}

	/**
	 * @return the image
	 */
	public Texture getImage() {
		return image;
	}

	/**
	 * @param image the image to set
	 */
	public void setImage(Texture image) {
		this.image = image;
	}

	/**
	 * @return the tileWidthInPixels
	 */
	public Integer getTileWidthInPixels() {
		return tileWidthInPixels;
	}

	/**
	 * @param tileWidthInPixels the tileWidthInPixels to set
	 */
	public void setTileWidthInPixels(Integer tileWidthInPixels) {
		this.tileWidthInPixels = tileWidthInPixels;
	}

	/**
	 * @return the tileHeightInPixels
	 */
	public Integer getTileHeightInPixels() {
		return tileHeightInPixels;
	}

	/**
	 * @param tileHeightInPixels the tileHeightInPixels to set
	 */
	public void setTileHeightInPixels(Integer tileHeightInPixels) {
		this.tileHeightInPixels = tileHeightInPixels;
	}

	/**
	 * @return the tilesWide
	 */
	public Integer getTilesWide() {
		return tilesWide;
	}

	/**
	 * @param tilesWide the tilesWide to set
	 */
	public void setTilesWide(Integer tilesWide) {
		this.tilesWide = tilesWide;
	}

	/**
	 * @return the tilesHigh
	 */
	public Integer getTilesHigh() {
		return tilesHigh;
	}

	/**
	 * @param tilesHigh the tilesHigh to set
	 */
	public void setTilesHigh(Integer tilesHigh) {
		this.tilesHigh = tilesHigh;
	}

	/**
	 * @return the sourceRectangles
	 */
	public Rectangle[] getSourceRectangles() {
		return sourceRectangles.clone();
	}

}


text:
using System;
using System.Data.Common;
using System.Diagnostics.Contracts;
using System.Threading.Tasks;
using IdentityServer4.EntityFramework.DbContexts;
using IdentityServer4.EntityFramework.Entities;
using JezekT.AspNetCore.IdentityServer4.WebApp.Models.ApiResourceClaimViewModels;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;

namespace JezekT.AspNetCore.IdentityServer4.WebApp.Controllers
{
    [Authorize(Policy = "AdministratorOnly")]
    public class ApiResourceClaimsController : Controller
    {
        private readonly ConfigurationDbContext _dbContext;
        private readonly ILogger _logger;

        public IActionResult Create(int apiResourceId)
        {
            var vm = new ApiResourceClaimViewModel { ApiResourceId = apiResourceId };
            return View(vm);
        }

        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<IActionResult> Create(ApiResourceClaimViewModel vm)
        {
            if (vm == null)
            {
                return BadRequest();
            }

            if (ModelState.IsValid)
            {
                var apiResource = await _dbContext.ApiResources.FindAsync(vm.ApiResourceId);
                if (apiResource == null)
                {
                    return BadRequest();
                }

                var apiResourceClaim = new ApiResourceClaim
                {
                    Type = vm.Type,
                    ApiResource = apiResource
                };

                _dbContext.Set<ApiResourceClaim>().Add(apiResourceClaim);
                try
                {
                    await _dbContext.SaveChangesAsync();
                    _logger.LogInformation($"API resource claim Id {apiResourceClaim.Id} created by {User?.Identity?.Name}.");
                    return RedirectToAction("Edit", "ApiResources", new { id = vm.ApiResourceId });
                }
                catch (DbException ex)
                {
                    _logger.LogError(ex.GetBaseException()?.Message ?? ex.Message);
                    throw;
                }
            }
            return View(vm);
        }

        public async Task<IActionResult> Edit(int id)
        {
            var vm = await GetViewModel(id);
            return View(vm);
        }

        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<IActionResult> Edit(ApiResourceClaimViewModel vm)
        {
            if (vm == null)
            {
                return BadRequest();
            }

            if (ModelState.IsValid)
            {
                var obj = await _dbContext.Set<ApiResourceClaim>().FindAsync(vm.Id);
                if (obj == null)
                {
                    return NotFound();
                }

                obj.Type = vm.Type;
                try
                {
                    await _dbContext.SaveChangesAsync();
                    _logger.LogInformation($"API resource claim Id {obj.Id} updated by {User?.Identity?.Name}.");
                    return RedirectToAction("Edit", "ApiResources", new { id = vm.ApiResourceId });
                }
                catch (DbException ex)
                {
                    _logger.LogError(ex.GetBaseException()?.Message ?? ex.Message);
                    throw;
                }
            }
            return View(vm);
        }

        public async Task<IActionResult> Delete(int id)
        {
            var vm = await GetViewModel(id);
            return View(vm);
        }

        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<IActionResult> Delete(ApiResourceClaimViewModel vm)
        {
            if (vm == null)
            {
                return BadRequest();
            }

            var obj = await _dbContext.Set<ApiResourceClaim>().FindAsync(vm.Id);
            if (obj == null)
            {
                return NotFound();
            }

            _dbContext.Remove(obj);
            try
            {
                await _dbContext.SaveChangesAsync();
                _logger.LogInformation($"API resource claim Id {vm.Id} removed by {User?.Identity?.Name}.");
                return RedirectToAction("Edit", "ApiResources", new { id = vm.ApiResourceId });
            }
            catch (DbException ex)
            {
                _logger.LogError(ex.GetBaseException()?.Message ?? ex.Message);
                throw;
            }
        }

        public ApiResourceClaimsController(ConfigurationDbContext dbContext, ILogger<ApiResourceClaimsController> logger)
        {
            if (dbContext == null || logger == null) throw new ArgumentNullException();
            Contract.EndContractBlock();

            _dbContext = dbContext;
            _logger = logger;
        }

        private async Task<ApiResourceClaimViewModel> GetViewModel(int id)
        {
            var identityClaim = await _dbContext.Set<ApiResourceClaim>().Include(x => x.ApiResource).FirstOrDefaultAsync(x => x.Id == id);
            if (identityClaim != null)
            {
                return new ApiResourceClaimViewModel
                {
                    Id = identityClaim.Id,
                    ApiResourceId = identityClaim.ApiResource.Id,
                    Type = identityClaim.Type
                };
            }
            return null;
        }

    }
}


text:
<?php

defined('_JEXEC') or die;

if (!is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Editor extends \RegularLabs\Library\Field
{
	public $type = 'Editor';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		$this->params = $this->element->attributes();

		$width  = $this->get('width', '100%');
		$height = $this->get('height', 400);

		$this->value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');

		// Get an editor object.
		$editor = JFactory::getEditor();
		$html   = $editor->display($this->name, $this->value, $width, $height, true, $this->id);

		return '</div><div>' . $html;
	}
}


text:
<?php

namespace AppBundle\Manager\Entity\Common\Main;

use AppBundle\Entity\Main\NewsletterGroup;
use AppBundle\Manager\Entity\Base\EntityManager;
use Symfony\Component\HttpFoundation\Request;

class NewsletterGroupManager extends EntityManager {

	public function createFromRequest(Request $request) {
		$entry = parent::createFromRequest($request);
		/** @var NewsletterGroup $entry */

		$entry->setName($request->get('name'));

		return $entry;
	}

	/**
	 *
	 * @param NewsletterGroup $template
	 *
	 * {@inheritDoc}
	 *
	 * @see \AppBundle\Manager\Entity\Base\EntityManager::createFromTemplate()
	 */
	public function createFromTemplate($template) {
		$entry = parent::createFromTemplate($template);
		/** @var NewsletterGroup $entry */

		$entry->setName($template->getName());

		return $entry;
	}

	protected function getEntityType() {
		return NewsletterGroup::class;
	}
}


text:
/***********************************************************************************************
 * arch/arm/src/armv7-m/itm.h
 *
 *   Copyright (c) 2009 - 2013 ARM LIMITED
 *
 *  All rights reserved.
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *  - Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  - Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *  - Neither the name of ARM nor the names of its contributors may be used
 *    to endorse or promote products derived from this software without
 *    specific prior written permission.
 *  *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 *  ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 *  POSSIBILITY OF SUCH DAMAGE.
 *
 *   Copyright (C) 2014 Pierre-noel Bouteville . All rights reserved.
 *   Author: Pierre-noel Bouteville <pnb990@gmail.com>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 * 3. Neither the name NuttX nor the names of its contributors may be
 *    used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 ***********************************************************************************************/

#ifndef __ARCH_ARM_SRC_ARMV7_M_ITM_H
#define __ARCH_ARM_SRC_ARMV7_M_ITM_H

/***********************************************************************************************
 * Included Files
 ***********************************************************************************************/

#include <stdint.h>

/***********************************************************************************************
 * Pre-processor Definitions
 ***********************************************************************************************/

/* Instrumentation Trace Macrocell Register (ITM) Definitions **********************************/
/* ITM Register Base Address *******************************************************************/

#define ITM_BASE                 (0xe0000000ul)

/* ITM Register Addresses **********************************************************************/

#define ITM_PORT(i)              (ITM_BASE + (i * 4))	/* Stimulus Port 32-bit */
#define ITM_TER                  (ITM_BASE + 0x0e00)	/* Trace Enable Register */
#define ITM_TPR                  (ITM_BASE + 0x0e40)	/* Trace Privilege Register */
#define ITM_TCR                  (ITM_BASE + 0x0e80)	/* Trace Control Register */
#define ITM_IWR                  (ITM_BASE + 0x0ef8)	/* Integration Write Register */
#define ITM_IRR                  (ITM_BASE + 0x0efc)	/* Integration Read Register */
#define ITM_IMCR                 (ITM_BASE + 0x0f00)	/* Integration Mode Control Register */
#define ITM_LAR                  (ITM_BASE + 0x0fb0)	/* Lock Access Register */
#define ITM_LSR                  (ITM_BASE + 0x0fb4)	/* Lock Status Register */
#define ITM_PID4                 (ITM_BASE + 0x0fd0)	/* Peripheral Identification Register #4 */
#define ITM_PID5                 (ITM_BASE + 0x0fd4)	/* Peripheral Identification Register #5 */
#define ITM_PID6                 (ITM_BASE + 0x0fd8)	/* Peripheral Identification Register #6 */
#define ITM_PID7                 (ITM_BASE + 0x0fdc)	/* Peripheral Identification Register #7 */
#define ITM_PID0                 (ITM_BASE + 0x0fe0)	/* Peripheral Identification Register #0 */
#define ITM_PID1                 (ITM_BASE + 0x0fe4)	/* Peripheral Identification Register #1 */
#define ITM_PID2                 (ITM_BASE + 0x0fe8)	/* Peripheral Identification Register #2 */
#define ITM_PID3                 (ITM_BASE + 0x0fec)	/* Peripheral Identification Register #3 */
#define ITM_CID0                 (ITM_BASE + 0x0ff0)	/* Component  Identification Register #0 */
#define ITM_CID1                 (ITM_BASE + 0x0ff4)	/* Component  Identification Register #1 */
#define ITM_CID2                 (ITM_BASE + 0x0ff8)	/* Component  Identification Register #2 */
#define ITM_CID3                 (ITM_BASE + 0x0ffc)	/* Component  Identification Register #3 */

/* ITM Register Bit Field Definitions **********************************************************/

#define ITM_TPR_PRIVMASK_Pos     0	/* ITM TPR: PRIVMASK Position */
#define ITM_TPR_PRIVMASK_Msk     (0xful << ITM_TPR_PRIVMASK_Pos)	/* ITM TPR: PRIVMASK Mask */

#define ITM_TCR_BUSY_Pos         23	/* ITM TCR: BUSY Position */
#define ITM_TCR_BUSY_Msk         (1ul << ITM_TCR_BUSY_Pos)	/* ITM TCR: BUSY Mask */
#define ITM_TCR_TraceBusID_Pos   16	/* ITM TCR: ATBID Position */
#define ITM_TCR_TraceBusID_Msk   (0x7ful << ITM_TCR_TraceBusID_Pos)	/* ITM TCR: ATBID Mask */
#define ITM_TCR_GTSFREQ_Pos      10	/* ITM TCR: Global timestamp frequency Position */
#define ITM_TCR_GTSFREQ_Msk      (3ul << ITM_TCR_GTSFREQ_Pos)	/* ITM TCR: Global timestamp frequency Mask */
#define ITM_TCR_TSPrescale_Pos   8	/* ITM TCR: TSPrescale Position */
#define ITM_TCR_TSPrescale_Msk   (3ul << ITM_TCR_TSPrescale_Pos)	/* ITM TCR: TSPrescale Mask */
#define ITM_TCR_SWOENA_Pos       4	/* ITM TCR: SWOENA Position */
#define ITM_TCR_SWOENA_Msk       (1ul << ITM_TCR_SWOENA_Pos)	/* ITM TCR: SWOENA Mask */
#define ITM_TCR_DWTENA_Pos       3	/* ITM TCR: DWTENA Position */
#define ITM_TCR_DWTENA_Msk       (1ul << ITM_TCR_DWTENA_Pos)	/* ITM TCR: DWTENA Mask */
#define ITM_TCR_SYNCENA_Pos      2	/* ITM TCR: SYNCENA Position */
#define ITM_TCR_SYNCENA_Msk      (1ul << ITM_TCR_SYNCENA_Pos)	/* ITM TCR: SYNCENA Mask */
#define ITM_TCR_TSENA_Pos        1	/* ITM TCR: TSENA Position */
#define ITM_TCR_TSENA_Msk        (1ul << ITM_TCR_TSENA_Pos)	/* ITM TCR: TSENA Mask */
#define ITM_TCR_ITMENA_Pos       0	/* ITM TCR: ITM Enable bit Position */
#define ITM_TCR_ITMENA_Msk       (1ul << ITM_TCR_ITMENA_Pos)	/* ITM TCR: ITM Enable bit Mask */

#define ITM_IWR_ATVALIDM_Pos     0	/* ITM IWR: ATVALIDM Position */
#define ITM_IWR_ATVALIDM_Msk     (1ul << ITM_IWR_ATVALIDM_Pos)	/* ITM IWR: ATVALIDM Mask */

#define ITM_IRR_ATREADYM_Pos     0	/* ITM IRR: ATREADYM Position */
#define ITM_IRR_ATREADYM_Msk     (1ul << ITM_IRR_ATREADYM_Pos)	/* ITM IRR: ATREADYM Mask */

#define ITM_IMCR_INTEGRATION_Pos 0	/* ITM IMCR: INTEGRATION Position */
#define ITM_IMCR_INTEGRATION_Msk (1ul << ITM_IMCR_INTEGRATION_Pos)	/* ITM IMCR: INTEGRATION Mask */

#define ITM_LSR_ByteAcc_Pos      2	/* ITM LSR: ByteAcc Position */
#define ITM_LSR_ByteAcc_Msk      (1ul << ITM_LSR_ByteAcc_Pos)	/* ITM LSR: ByteAcc Mask */
#define ITM_LSR_Access_Pos       1	/* ITM LSR: Access Position */
#define ITM_LSR_Access_Msk       (1ul << ITM_LSR_Access_Pos)	/* ITM LSR: Access Mask */
#define ITM_LSR_Present_Pos      0	/* ITM LSR: Present Position */
#define ITM_LSR_Present_Msk      (1ul << ITM_LSR_Present_Pos)	/* ITM LSR: Present Mask */

#define ITM_RXBUFFER_EMPTY       0x5aa55aa5	/* Value identifying g_itm_rxbuffer is ready for next character. */

/***********************************************************************************************
 * Public Data
 ***********************************************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

extern volatile int32_t g_itm_rxbuffer;	/* External variable to receive characters. */

/***********************************************************************************************
 * Public Function Prototypes
 ***********************************************************************************************/

uint32_t itm_sendchar(uint32_t ch);
int32_t itm_receivechar(void);
int32_t itm_checkchar(void);

#ifdef __cplusplus
}
#endif
#endif							/* __ARCH_ARM_SRC_ARMV7_M_ITM_H */


text:
title:  Jongerenles
date:   21/01/2022
---

### Jezus, onze trouwe broer

#### Opdracht van de vorige week

`Hoe ziet de relatie tussen de Vader en de Zoon eruit en wat betekent dat?`

#### Lees samen

Hebreeën 2:10-18

#### Ijsbrekervraag

`Met welk familielid heb jij de beste relatie en waarom?`

#### Inspiratie

'Gods Zoon heeft zijn leven gegeven voor alle mensen. Zo laat God zien hoe goed Hij voor ons is.' (Hebreeën 2:9, BGT.)

#### Behandel de tekst

Het komt wel voor dat broers en zussen die binnen hetzelfde gezin opgroeien nogal van elkaar verschillen. De een werkt hard, volgt een goede opleiding en krijgt een goede baan. Terwijl een ander de kantjes ervan afloopt, geen zin heeft in studeren en door de omgang met foute vrienden aan lager wal raakt. De ene gerespecteerde die iets van zijn of haar leven maakt, probeert de ander te bereiken om zijn of haar leven ten goede te keren. Zolang de aan lager wal geraakte het aanbod niet aanneemt, kan degene die zijn leven op de rit heeft, proberen wat hij wil. Het zal hem echter niet lukken een verandering tot stand te brengen. Machteloos moet hij toezien hoe het met de ander de foute kant op gaat. Zo is het ook met Jezus. Hij wil ons als een broer uit onze erbarmelijke zondige bestaan bevrijden. Hij heeft daar werkelijk alles voor over en offert daar zelfs zijn leven voor op. Het is echter aan ons of wij die hulp aanvaarden en op zijn aanbod, ons te bevrijden, willen ingaan.

#### Gespreksvragen naar aanleiding van de tekst

`Wat was het resultaat van het feit dat Jezus tot het einde toe zijn lijden heeft volgehouden? (Hebreeën 2:10)`

`Wat hebben wij met Jezus gemeen, wat is onze overeenkomst? (verzen 11-13)`

`Wie zijn wij dus? (vers 14) En wat kon Jezus doen door mens te worden?`

`En wat is daarvan het gevolg voor ons? (vers 15) Hoe ervaar jij dat?`

`Wat was het doel van de komst van Jezus naar deze aarde? (vers 16)`

`Wat kon Jezus nog meer worden door mens te worden? (verzen 17) Waarom kan Jezus ons helpen en wat betekent dat voor jou? (vers 18)`

#### Opdracht

`Wie ben jij in de ogen van God?`


text:
int main()
{
    boost::reference_wrapper<int const> r( 1 ); // this should produce an ERROR
}

#else
#  error To fail, this test requires rvalue references
#endif


text:
tail -f orders.log | ./jk-pipe.sh parsers.xml -s

read -p "Press [Enter] key to exit..."


text:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

//
//  MasterViewController.m
//  ICE-IT
//
//  Created by Andi Palo on 15/10/14.
//  Copyright (c) 2014 Andi Palo. All rights reserved.
//

#import "MasterViewController.h"
#import "DetailViewController.h"
#import "AppDelegate.h"
#import "APDBManager.h"
#import "APConstants.h"
#import "APNumberTableViewCell.h"
#import "APCityNumber.h"
#import "APImageStore.h"
#import "APLanguagesViewController.h"
#import "Chameleon.h"
#import "AMPopTip.h"

static int kTitleWidth = 180;
static int kLeftUpperAdjustement = 50;

@interface MasterViewController ()
@property (strong,nonatomic)  NSArray   *numbers;
@property (strong, nonatomic) NSString  *cityName;
@property (strong, nonatomic) NSString  *language;
@property (nonatomic) CGSize leftImageSize;
@property (nonatomic) CGSize rightImageSize;
@property (strong, nonatomic) UILabel *cityTitle;
@property (strong, nonatomic) UILabel *subTitleLabel;
@property (nonatomic) BOOL tipsWereShown;

@property (nonatomic, strong) AMPopTip *cityTip;
@property (nonatomic, strong) AMPopTip *langTip;

@property (nonatomic) NSUInteger commonNames;
@end

@implementation MasterViewController

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    // Set the side bar button action. When it's tapped, it'll show up the sidebar.
    //get user prefs for the preferred car model id
    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    self.cityName = [prefs objectForKey:kPreferredCity];
    self.language = [prefs objectForKey:kCurrentLang];

    _sidebarButton.target = self.revealViewController;
    _sidebarButton.action = @selector(revealToggle:);

    //to inform master of reveal add delegate to self
    self.revealViewController.delegate = self;

    self.leftImageSize = CGSizeMake(50, 50);
    self.rightImageSize = CGSizeMake(40, 24);

    UIImage *img = [APImageStore imageWithImageName:[NSString stringWithFormat:@"%@_img",[self.cityName lowercaseString]]
                                       scaledToSize:self.leftImageSize];
    _sidebarButton.image = [img imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

    img = [APImageStore imageWithImageName:[NSString stringWithFormat:@"%@_flag",self.language]
                              scaledToSize:self.rightImageSize];
    _rightbarButton.image = [img imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

    [self drawTitleView];

    self.title = [[APDBManager sharedInstance] getUIStringForCode:@"go_back"];

    [self.navigationController.navigationBar setBarTintColor:[UIColor flatTealColor]];
    [self.navigationController.navigationBar setTranslucent:NO];

    [APDBManager getCityNums:self.cityName forLang:self.language reportTo:self];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    self.tableView.allowsSelection = NO;

    // Setup Tips
    self.tipsWereShown = [[prefs objectForKey:kUITipsWereShown] intValue];

    if (!self.tipsWereShown) {
        [self setupHintTips];
        [self showHint:kTipLanguage];
        [self showHint:kTipCity];
    }
}
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
//    if (!self.tipsWereShown) {
//        [self showHint:kTipCity];
//        [self showHint:kTipLanguage];
//    }
}
-(UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}

- (void)setupHintTips {
    // alloc the tooltip view and customize it
    [[AMPopTip appearance] setFont:[UIFont fontWithName:@"Avenir-Medium" size:12]];

    self.cityTip = [AMPopTip popTip];
    self.cityTip.shouldDismissOnTap = YES;
//    self.cityTip.shouldDismissOnTapOutside = NO;
    self.cityTip.edgeMargin = 5;
    self.cityTip.offset = 2;
    self.cityTip.arrowSize = CGSizeMake(10, 55);
    self.cityTip.edgeInsets = UIEdgeInsetsMake(0, 10, 0, 10);

    self.langTip = [AMPopTip popTip];
    self.langTip.shouldDismissOnTap = YES;
//    self.langTip.shouldDismissOnTapOutside = NO;
    self.langTip.edgeMargin = 5;
    self.langTip.offset = 2;
    self.langTip.edgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);

    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    __weak typeof(self) weakSelf = self;

    self.cityTip.dismissHandler = ^{
        [prefs setObject:[NSNumber numberWithInt:1] forKey:kUITipsWereShown];
        if (weakSelf.langTip) {
            [weakSelf.langTip hide];
        }
    };
    self.langTip.dismissHandler = ^{
        [prefs setObject:[NSNumber numberWithInt:1] forKey:kUITipsWereShown];
        if (weakSelf.cityTip) {
            [weakSelf.cityTip hide];
        }

    };
}

- (void)showHint:(TIP_TYPE) type {
    CGRect tipFrame;
    CGRect tempFrame = self.navigationController.navigationBar.frame;

    if (type == kTipCity) {
        tipFrame = CGRectMake(0, tempFrame.origin.y, kLeftUpperAdjustement, tempFrame.size.height);
        self.cityTip.popoverColor = [UIColor flatOrangeColor];
        NSString * t = [[APDBManager sharedInstance] getUIStringForCode:@"city_tip"];
        [self.cityTip showText: t
                     direction:AMPopTipDirectionDown
                      maxWidth:200
                        inView:self.navigationController.view
                     fromFrame:tipFrame];

    }else if (type == kTipLanguage){
        tipFrame = CGRectMake(tempFrame.size.width - kLeftUpperAdjustement, tempFrame.origin.y, kLeftUpperAdjustement, tempFrame.size.height);
        self.langTip.popoverColor = [UIColor flatOrangeColor];

        [self.langTip showText:[[APDBManager sharedInstance] getUIStringForCode:@"lang_tip"]
                     direction:AMPopTipDirectionDown
                      maxWidth:200
                        inView:self.navigationController.view
                     fromFrame:tipFrame];
    }
    //ALog("Frame of view is %f %f %f %f",test.origin.x, test.origin.y, test.size.width, test.size.height);

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)drawTitleView {
    int temp;
    int sum = 0;
    self.subTitleLabel = [self createFirstTitleLabel:&temp andLabel:[[APDBManager sharedInstance] getUIStringForCode:@"phone_numbers"]];
    sum += temp;
    UILabel *second = [self createSecondTitleLabel:&temp fromHeight:sum];
    sum += temp;
    self.cityTitle = second;
    UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kTitleWidth, sum + 20)];

    [titleView addSubview:self.subTitleLabel];
    [titleView addSubview:second];

    self.navigationController.navigationBar.topItem.titleView = titleView;
}

- (UILabel*) createFirstTitleLabel:(int*)height andLabel:(NSString*) content{
    UIFont *customFont = [UIFont systemFontOfSize:16.0f];
    CGSize size = [content sizeWithAttributes:@{NSFontAttributeName:customFont}];

    *height = size.height;
    UILabel *fromLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 6, kTitleWidth, size.height)];
    fromLabel.text = content;
    fromLabel.textColor = [UIColor flatWhiteColor];
    fromLabel.textAlignment = NSTextAlignmentCenter;
    fromLabel.font = customFont;
    fromLabel.clipsToBounds = YES;
    return fromLabel;
}

- (UILabel*) createSecondTitleLabel:(int*)height fromHeight:(int)from{
    NSString * content = [self.cityName uppercaseString];
    UIFont *customFont = [UIFont fontWithName:@"Helvetica-Bold" size:20.0];
    CGSize size = [content sizeWithAttributes:@{NSFontAttributeName:customFont}];
    *height = size.height;
    UILabel *fromLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, from + 8, kTitleWidth, size.height)];
    fromLabel.text = content;
    fromLabel.textColor = [UIColor flatWhiteColor];
    fromLabel.font = customFont;
    fromLabel.textAlignment = NSTextAlignmentCenter;
    fromLabel.clipsToBounds = YES;
    return fromLabel;
}

#pragma mark - Segues

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([[segue identifier] isEqualToString:@"showOptions"]) {
        APLanguagesViewController *lvc = [segue destinationViewController];
        lvc.currentLangCode = self.language;
        lvc.delegate = self;

        if (self.tipsWereShown == 0) {
            [self.langTip hide];
        }
    }else{

    }
}

-(void) cityOrLanguageChanged{
    [APDBManager getCityNums:self.cityName forLang:self.language reportTo:self];
}

/*! Called from background queues */
- (void) cityChanged:(NSString*) newName{
    self.cityName = newName;

    dispatch_async(dispatch_get_main_queue(), ^{
    UIImage *img = [APImageStore imageWithImageName:[NSString stringWithFormat:@"%@_img",[self.cityName lowercaseString]]
                                       scaledToSize:self.leftImageSize];
        _sidebarButton.image = [img imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        self.cityTitle.text = [self.cityName uppercaseString];
    });

    //save in the preferences the city name
    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    [prefs setObject:newName forKey:kPreferredCity];
    [self cityOrLanguageChanged];
}
/*! Called from background queues */
- (void) languageChanged:(NSString*) newLang{
    self.language = newLang;

    dispatch_async(dispatch_get_main_queue(), ^{
        UIImage *img = [APImageStore imageWithImageName:[NSString stringWithFormat:@"%@_flag",self.language]
                                           scaledToSize:self.rightImageSize];
        _rightbarButton.image = [img imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    });

    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    [prefs setObject:newLang forKey:kCurrentLang];

    [self cityOrLanguageChanged];
}

/*! Here we return to main queue to update UI */
- (void) newDataIsReady:(NSArray*) newData{
    _numbers = newData;
    self.commonNames = 0;
    for (APCityNumber *cn in _numbers) {
        if (cn.isCommon) {
            self.commonNames++;
        }
    }
    dispatch_async(dispatch_get_main_queue(), ^{
        [self.tableView reloadData];
    });
}

#pragma mark - Table View

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 2;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section == 0) {
        return self.commonNames;
    }else{
        return [self.numbers count] - self.commonNames;
    }
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *headerView = [[UIView alloc] init];
    switch (section)
    {
        case 0:
            [headerView addSubview:[self prepareHeaderLabel:[self tableView:self.tableView titleForHeaderInSection:section]]];
            break;
        case 1:
            [headerView addSubview:[self prepareHeaderLabel:[self tableView:self.tableView titleForHeaderInSection:section]]];
            break;
        default:
            return nil;
            break;
    }

    return headerView;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    NSString *sectionName;
    switch (section)
    {
        case 0:
            sectionName = [[APDBManager sharedInstance] getUIStringForCode:@"common_nums"];
            break;
        case 1:
            sectionName = [[APDBManager sharedInstance] getUIStringForCode:@"local_nums"];
            break;
        default:
            sectionName = @"";
            break;
    }
    return sectionName;
}

- (UILabel*) prepareHeaderLabel:(NSString*)text {
    UIFont *footerFont = [UIFont fontWithName:@"Helvetica-Bold" size:17];
    int margin = 15;
    //Find expected size
    CGSize labelSize =  [text boundingRectWithSize:CGSizeMake(self.view.frame.size.width - 2 * margin, MAXFLOAT)
                                           options:NSStringDrawingUsesLineFragmentOrigin
                                        attributes:@{NSFontAttributeName : footerFont}
                                           context:nil].size;
    UILabel *myLabel = [[UILabel alloc] init];
    myLabel.frame = CGRectMake(0, 0, self.view.frame.size.width, labelSize.height);
    myLabel.font = footerFont;
    myLabel.text = text;
    myLabel.backgroundColor = [UIColor flatWhiteColorDark];
    myLabel.textAlignment = NSTextAlignmentCenter;
    myLabel.shadowColor = [UIColor flatWhiteColor];
    myLabel.shadowOffset      = CGSizeMake(1, 1);
    myLabel.textColor = [UIColor colorWithRed:0.298 green:0.337 blue:0.423 alpha:1.000];
    myLabel.numberOfLines = 0;
    return myLabel;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"NumberCell";
    APNumberTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    if (cell == nil) {
        cell = [[APNumberTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    //[cell setBackgroundColor:[UIColor flatWhiteColor]];
    // Configure the cell...
    [self configureCell:cell atIndexPath:indexPath];
    return cell;
}

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}

- (void)configureCell:(APNumberTableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
    APCityNumber *cn;
    if (indexPath.section == 0 ) {
        cn = [self.numbers objectAtIndex:indexPath.row];
    }else{
        cn = [self.numbers objectAtIndex:(indexPath.row + self.commonNames)];
    }

    cell.numberLabel.text = cn.number;
    cell.descLabel.text = cn.desc;

    cell.descLabel.numberOfLines = 0;

    // No formatting
    /*
    if (cn.priority < kCommonNumbersMaxPrio) {
        if (indexPath.row % 2 == 0) {
//            [cell setBackgroundColor:[UIColor colorWithRed:96/255.0 green:186/255.0 blue:70/255.0 alpha:.5]];
            [cell setBackgroundColor:[UIColor flatWhiteColor]];
        }else{
            [cell setBackgroundColor:[UIColor flatRedColor]];
        }
    }else{
        if (indexPath.row % 2 == 0) {
//            [cell setBackgroundColor:[UIColor colorWithRed:175/255.0 green:238/255.0 blue:238/255.0 alpha:.5]];
            [cell setBackgroundColor:[UIColor flatWhiteColor]];
        }else{
            [cell setBackgroundColor:[UIColor flatGreenColor]];
        }

    }
    */
    if ([cell respondsToSelector:@selector(layoutMargins)]) {
        cell.layoutMargins = UIEdgeInsetsZero;
    }
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

}

#pragma mark - SWReveal

- (void)revealController:(SWRevealViewController *)revealController didMoveToPosition:(FrontViewPosition)position{
    if (position == FrontViewPositionRight) {
        [self.langTip hide];
    }
}
#pragma mark - UI Strings when language is changed

- (void) uiStringsReady{

    //Go to UI queue
    dispatch_async(dispatch_get_main_queue(), ^{
        self.title = [[APDBManager sharedInstance] getUIStringForCode:@"go_back"];

        self.subTitleLabel.text = [[APDBManager sharedInstance] getUIStringForCode:@"phone_numbers"];
    });
}

- (IBAction)callAction:(id)sender {
    //call button was pressed on a row, find the point of the screen of this info button
    CGPoint buttonOriginInTableView = [sender convertPoint:CGPointZero toView:self.tableView];

    //Find the row that corresponds to this point
    NSIndexPath *ipath = [self.tableView indexPathForRowAtPoint:buttonOriginInTableView];
    APCityNumber *cn;
    if (ipath.section == 0) {
        cn = [self.numbers objectAtIndex:ipath.row];
    }else{
        cn = [self.numbers objectAtIndex:(ipath.row + self.commonNames)];
    }
//    ALog("Selected number: %@",cn.number);
    //    NSString *phoneNumber = [@"telprompt://" stringByAppendingString:cn.number];
    NSString *phoneNumber = [@"tel://" stringByAppendingString:[cn callString]];
//    ALog("CAll string is: %@", [cn callString]);
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
}
@end


text:
FILE(REMOVE_RECURSE
  "libsegmentation.a"
)


text:
var debug = require('debug')('venn');
EmailServiceProvider = require("../../messaging_service_provider");
MessagingServiceStatus = require('../../messaging_service_status');
MessagingUserStatus = require('../../messaging_user_status');

/*=============================================================================

Define Nexmo Service Provider

=============================================================================*/
function Nexmo(keys){
  if (!keys) return
	this.name = "nexmo"
	this.keys = keys

  this.initialize = function() {
    var API_PROTOCOL = "https"
    var DEBUG = false
    nexmo = require('easynexmo')
    nexmo.initialize(this.keys.api_key, this.keys.api_secret, API_PROTOCOL, DEBUG)
    this.client = nexmo
  }

  this.send = function(data, callback) {
    var context = this;
    this.client.sendTextMessage(this.keys.from_phone, data.to, data.message, {}, function(err, result){
      var nexmoStat;
      if (err) {
        nexmoStat = new NexmoErrorStatus(err);
        debug("-_-_ FAILED with nexmo _-_-");
        debug(nexmoStat);
        return callback(nexmoStat);
      } else {
        nexmoStat = new NexmoSuccessStatus(result);
        debug("-_-_ sent with nexmo _-_-");
        result.service = context;
        result.status = nexmoStat;
        debug(result);
        return callback(null, result);
      }
    })

  }

  this.initialize()
}

Nexmo.prototype = new MessagingServiceProvider()

/*=============================================================================

Define Nexmo Service Status Handlers

=============================================================================*/

/*
Success Status

@param response     JSON response object from Nexmo service
*/
function NexmoSuccessStatus(response) {
  MessagingServiceStatus.call(this, 'nexmo');

  // Put logic here for handling successfull sends
}

NexmoSuccessStatus.prototype = Object.create(MessagingServiceStatus.prototype);
NexmoSuccessStatus.prototype.constructor = NexmoSuccessStatus;

/*
Error Status

@param response     JSON response object from Nexmo service
*/
function NexmoErrorStatus(response) {
  MessagingServiceStatus.call(this, 'nexmo');

  // Put logic here for handling any possible service errors
}

NexmoErrorStatus.prototype = Object.create(MessagingServiceStatus.prototype);
NexmoErrorStatus.prototype.constructor = NexmoErrorStatus;

/*=============================================================================

Define Nexmo User Status Handler

=============================================================================*/
function NexmoUserStatus(message, code) {
  MessagingUserStatus.call(this, 'nexmo');

  // Put logic here for handling any possible user errors
}

NexmoUserStatus.prototype = Object.create(MessagingUserStatus.prototype);
NexmoUserStatus.prototype.constructor = NexmoUserStatus;

/*=============================================================================

Define Nexmo Helper Functions

=============================================================================*/

module.exports = Nexmo


text:
export function SearchCountriesController(searchCountriesService, _) {
    'ngInject';

    const vm = this;

    // Adding data to $scope
    vm.searchText = '';
    vm.searchResults = [];
    vm.statusText = null;

    // Adding behaviour to $scope
    vm.search = search;

    // Search country
    function search(searchText, searchTextInvalid) {
        // Calling the country search service if the searchText is valid and not empty
        if ((searchTextInvalid === false) && (_.isEmpty(searchText) === false)) {
            searchCountriesService.country(searchText)
                .then(successHandler)
                .catch(errorHandler);
        }
        else {
            vm.searchResults = [];
        }

        // Defining the handlers for the country search call
        function successHandler(countries) {
            vm.searchResults = countries;
            vm.statusText = null;
        }
        function errorHandler(response) {
            vm.searchResults = [];
            if (response.status === 404) {
                vm.statusText = 'No countries found';
            }
        }
    }
}


text:
import java.util.Collection;
import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Stream;

class MyTest {

  public static <T, V> void map(Collection<? extends T> iterable,
                                Function<T, V> mapping) {}

  interface StubElement<P extends String> {
    P getPsi();
  }

  void foo(List<StubElement> stubs) {
    map(stubs, StubElement::getPsi);
  }

  void bar(Stream<StubElement> stream) {
    stream.<String>map(StubElement::getPsi).map(s -> s.substring(0));
  }
}


text:
function turn(side, n)
    local side = side or "right"
    local n = n or 1

    for i = 1, n do
        if side == "right" then
            turtle.turnRight()
        elseif side == "left" then
            turtle.turnLeft()
        end
    end
end


text:
package org.apache.rocketmq.redis.replicator.mq;

import com.moilioncircle.redis.replicator.event.Event;

public interface EventListener {
    void onEvent(Event event);
}


text:
title: 'Pick Up your $1 Jekyll Sticker'
date: 2014-06-04 15:46:53 -0400
author: parkr
categories: [partners]
---

![Jekyll Sticker](/img/jekyll-sticker.png)

You may have heard that [@cobyism](https://github.com/cobyism)'s excellent
Jekyll logo has been made into a sticker. You may have sat idly by, wishing
that you could have a sticker honoring your beloved Jekyll.

The StickerMule team says, *"Pine no longer!"* StickerMule has **[discounted the
price of Jekyll stickers down to $1 and are offering free (domestic)
shipping](https://www.stickermule.com/marketplace/825-jekyll-stickers)!**
Go grab one now on the StickerMule marketplace – [they'll look
swell on your favourite hardware.](https://twitter.com/parkr/status/430826309707902976/photo/1)