text:
#region Apache License Version 2.0

#endregion Apache License Version 2.0

using System;
using System.Linq;
using System.Threading.Tasks;
using SF.Biz.Accounting.DataModels;
using SF.Biz.Payments;
using SF.Sys;
using SF.Sys.Auth;
using SF.Sys.Clients;
using SF.Sys.Data;
using SF.Sys.Entities;
using SF.Sys.Logging;
using SF.Sys.Services;

namespace SF.Biz.Accounting
{

    public class SettlementManager :
        AutoQueryableEntitySource<ObjectKey<long>, SettlementRecordDetail, SettlementRecord, SettlementRecordQueryArguments, DataModels.DataSettlementRecord>,
        ISettlementManager
    {
        Lazy<ICollectService> CollectService { get; }
        Lazy<ITransferService> TransferService { get; }
        public SettlementManager(
            IEntityServiceContext ServiceContext,
            Lazy<ICollectService> CollectService,
            Lazy<ITransferService> TransferService
            ) : base(ServiceContext)
        {
            this.CollectService = CollectService;
            this.TransferService = TransferService;
        }

        public Task<SettlementStatus> Start(SettlementStartArgument Argument)
        {
            Ensure.Assert(Argument.TotalAmount>0, "结算金额必须大于0");
            Ensure.Assert(Argument.Items.All(i => i.Amount > 0), "单项金额必须大于0");
            Ensure.Equal(Argument.TotalAmount, Argument.Items.Select(i => i.Amount).Sum(), "金额不一致");
            Ensure.Equal(Argument.Items.Length, Argument.Items.Select(i => i.AccountTitle).Distinct().Count(), "结算项目科目有重复");
            decimal CollectAmount = 0;
            if (Argument.CollectPaymentPlatformId.HasValue)
            {
                Ensure.HasContent(Argument.CollectHttpRedirect, "收款重定向页面");
                Ensure.HasContent(Argument.CollectTitle, "收款科目");
                Ensure.Equal(1, Argument.Items.Count(i => i.AccountTitle == Argument.CollectTitle), "找不到收款科目对应的项目");
                CollectAmount = Argument.Items.First(i => i.AccountTitle == Argument.CollectTitle).Amount;
            }

            return DataScope.Use("创建结算记录", async ctx =>
            {

                var titles = await ctx.Queryable<DataModels.DataAccountTitle>()
                               .Where(t=>t.LogicState==EntityLogicState.Enabled)
                               .ToDictionaryAsync(t => t.Ident, t => t.Id);

                var now = Now;
                var rid = await IdentGenerator.GenerateAsync<DataModels.DataSettlementRecord>();
                var iids = await IdentGenerator.GenerateAsync<DataSettlementItemRecord>(Argument.Items.Length);
                var record = ctx.Add(new DataModels.DataSettlementRecord
                {
                    Id = rid,
                    TotalAmount = Argument.TotalAmount,
                    LeftAmount=Argument.TotalAmount,
                    BizParent = Argument.BizParent,
                    BizRoot = Argument.BizRoot,
                    BuyerId = Argument.BuyerId,
                    SellerId = Argument.SellerId,
                    CreatedTime = now,
                    DstTitleId = titles[Argument.DstTitle],
                    Name=Argument.Name,
                    OpAddress=Argument.ClientInfo.ClientAddress,
                    OpDevice=Argument.ClientInfo.DeviceType,
                    OwnerId=Argument.ClientInfo.OperatorId,
                    PrepayTitleId =titles[Argument.PrepayTitle],
                    UpdatedTime=now,
                    UpdatorId=Argument.BuyerId,
                    CollectPaymentPlatformId = Argument.CollectPaymentPlatformId,
                    CollectTitleId= Argument.CollectTitle.HasContent()?(long?)titles[Argument.CollectTitle]:null,
                    CollectAmount= CollectAmount,

                    Items = Argument.Items.Select((i,idx)=>new DataSettlementItemRecord
                    {
                        Id= iids[idx],
                        SettlementRecordId=rid,
                        Index=idx,
                        LeftAmount=i.Amount,
                        TotalAmount=i.Amount,
                        TitleId=titles[i.AccountTitle]
                    } ).ToArray()

                });

                var result=new SettlementStatus
                {
                    Id=record.Id
                };
                if (!record.CollectPaymentPlatformId.HasValue)
                {
                    await Transform(record, Argument.ClientInfo);
                    record.State = SettlementState.WaitConfirm;
                    result.State = record.State;
                }
                else {
                    var amount = record.Items.Single(i => i.TitleId == record.CollectTitleId.Value).TotalAmount;
                    var re=await CollectService.Value.Start(new CollectRequest
                    {
                        Amount = amount,
                        BizParent = new TrackIdent("结算", "SettlementRecord", record.Id, Now.ToString("yyyyMMddHHmmss")),
                        BizRoot = record.BizRoot,
                        ClientInfo = Argument.ClientInfo,
                        Desc = Argument.Desc,
                        PaymentPlatformId = record.CollectPaymentPlatformId.Value,
                        StartTime = Now,
                        Title = record.Name,
                        HttpRedirect = Argument.CollectHttpRedirect,
                    });
                    record.CollectRecordId = re.Id;
                    result.Expires = re.Expires;
                    result.CollectStartResult = re.Data;
                    result.State=record.State = SettlementState.Processing;
                }

                await ctx.SaveChangesAsync();

                return result;
            });
        }

        async Task Transform(DataSettlementRecord record,ClientInfo ClientInfo)
        {
            var Ids=await TransferService.Value.Transfer(new TransferArgument
            {
                ClientInfo=ClientInfo,
                Items=record.Items.Select(i=>new TransferArgumentItem
                {
                    Amount=i.TotalAmount,
                    BizParent= new TrackIdent("结算", "SettlementItemRecord", i.Id),
                    BizRecordIndex=i.Index,
                    BizRoot=record.BizRoot,
                    Description=record.Desc,
                    DstId=record.SellerId,
                    DstTitleId=record.PrepayTitleId,
                    SrcId=record.BuyerId,
                    SrcTitleId=i.TitleId
                }).ToArray()
            });

            foreach (var pair in record.Items.Zip(Ids, (it, i) => (it, i)))
                pair.it.TransferRecordId = pair.i;
        }
        public Task Cancel(long Id, ClientInfo ClientInfo)
        {
            if (ClientInfo == null)
                ClientInfo = ServiceContext.ClientService.GetClientInfo();

            return DataScope.Use("取消结算", async ctx =>
            {
                var record = await ctx.Queryable<DataModels.DataSettlementRecord>(false)
                    .Where(r => r.Id == Id && r.LogicState == EntityLogicState.Enabled)
                    .Include(r => r.Items)
                    .SingleOrDefaultAsync();
                if (record == null)
                    throw new PublicArgumentException("找不到结算记录:" + Id);

                if (record.State != SettlementState.Processing)
                    throw new PublicInvalidOperationException("收款已结束,不能取消:" + record.Id);

                if(record.CollectRecordId.HasValue)
                    await CollectService.Value.Cancel(record.CollectRecordId.Value, ClientInfo);
                record.State = SettlementState.Cancelled;
                record.UpdatedTime = Now;
                record.UpdatorId = ClientInfo.OperatorId;
                ctx.Update(record);
                await ctx.SaveChangesAsync();

            });
        }
        public Task<SettlementStatus> UpdateAndQueryStatus(long Id,ClientInfo ClientInfo)
        {
            if(ClientInfo==null)
                ClientInfo = ServiceContext.ClientService.GetClientInfo();

            return DataScope.Use("更新结算记录", async ctx =>

            {
                var record = await ctx.Queryable<DataModels.DataSettlementRecord>(false)
                    .Where(r=>r.Id==Id && r.LogicState==EntityLogicState.Enabled)
                    .Include(r=>r.Items)
                    .SingleOrDefaultAsync();
                if (record == null)
                    throw new PublicArgumentException("找不到结算记录:" + Id);

                if (record.State != SettlementState.Processing)
                    return new SettlementStatus
                    {
                        Id = Id,
                        State = record.State
                    };

                if (record.CollectRecordId.HasValue)
                {
                    var re=await CollectService.Value.GetResult(record.CollectRecordId.Value, true);
                    if (!re.Response.CompletedTime.HasValue)
                        return new SettlementStatus
                        {
                            Id = Id,
                            State = SettlementState.Processing
                        };

                    if (re.Response.AmountCollected != record.CollectAmount && re.Response.Error.IsNullOrEmpty())
                    {
                        re.Response.Error = $"收款金额不符";
                        Logger.Error($"收款金额{re.Response.AmountCollected}和所需金额{record.CollectAmount}不符,结算记录:{record.Id}");
                    }
                    if (re.Response.Error.HasContent())
                    {
                        record.State = SettlementState.Failed;
                        record.Error = re.Response.Error;
                    }
                    else
                    {
                        var updater = new AccountUpdater(ctx,IdentGenerator);
                        await updater.LoadAccounts((record.CollectTitleId.Value, record.BuyerId));
                        await updater.Update(record.CollectTitleId.Value, record.BuyerId, record.CollectAmount, 0, Now);

                        record.State = SettlementState.WaitConfirm;
                    }
                }
                else
                    record.State = SettlementState.WaitConfirm;

                record.UpdatedTime = Now;
                record.UpdatorId = ClientInfo.OperatorId;

                if(record.State==SettlementState.WaitConfirm)
                    await Transform(record, ClientInfo);

                ctx.Update(record);
                await ctx.SaveChangesAsync();
                return new SettlementStatus
                {
                    Id = Id,
                    State = SettlementState.WaitConfirm
                };
            });
        }

        public Task<SettlementStatus> Confirm(long Id, ClientInfo ClientInfo = null)
        {
            if (ClientInfo == null)
                ClientInfo = ServiceContext.ClientService.GetClientInfo();

            return DataScope.Use("确认结算记录", async ctx =>
            {
                var record = await ctx.Queryable<DataSettlementRecord>(false)
                    .Where(r => r.Id == Id && r.LogicState == EntityLogicState.Enabled)
                    .SingleOrDefaultAsync();
                if (record == null)
                    throw new PublicArgumentException("找不到结算记录:" + Id);

                if (record.State != SettlementState.WaitConfirm)
                    throw new PublicInvalidOperationException("结算未就绪,不能确认:" + record.Id);

                var tids=await TransferService.Value.Transfer(new TransferArgument
                {
                    ClientInfo = ClientInfo,
                    Items = new[] { new TransferArgumentItem
                    {
                        Amount = record.LeftAmount,
                        BizParent = new TrackIdent("结算", "SettlementRecord", record.Id),
                        BizRoot = record.BizRoot,
                        BizRecordIndex = 0,
                        Description = record.Desc,
                        DstId = record.SellerId,
                        DstTitleId = record.DstTitleId,
                        SrcId = record.SellerId,
                        SrcTitleId = record.PrepayTitleId
                    } }
                });

                record.LastTransferRecordId = tids[0];
                record.State = SettlementState.Success;
                record.UpdatorId = ClientInfo.OperatorId;
                record.UpdatedTime = Now;
                ctx.Update(record);
                await ctx.SaveChangesAsync();
                return new SettlementStatus
                {
                    Id = record.Id,
                    Message = record.Error,
                    State = record.State
                };
            });
        }
    }

}


text:
package de.cosmocode.palava.core;

/**
 * Constant holder class for configuration keys.
 *
 * @since 2.0
 * @author Tobias Sarnowski
 * @author Willi Schoenborn
 */
public final class CoreConfig {

    public static final String PREFIX = "core.";

    public static final String APPLICATION = PREFIX + "application";

    public static final String STAGE = PREFIX + "stage";

    public static final String REINJECTABLE_ASPECTS = PREFIX + "reinjectableAspects";

    private CoreConfig() {

    }
}

redpajama_set_name: RedPajamaGithub


text:
//===-- RNBSocket.cpp -------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
//  Created by Greg Clayton on 12/12/07.
//
//===----------------------------------------------------------------------===//

#include "RNBSocket.h"
#include "DNBError.h"
#include "DNBLog.h"
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <map>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/event.h>
#include <termios.h>
#include <vector>

#include "lldb/Host/SocketAddress.h"

#ifdef WITH_LOCKDOWN
#include "lockdown.h"
#endif

/* Once we have a RNBSocket object with a port # specified,
   this function is called to wait for an incoming connection.
   This function blocks while waiting for that connection.  */

bool ResolveIPV4HostName(const char *hostname, in_addr_t &addr) {
  if (hostname == NULL || hostname[0] == '\0' ||
      strcmp(hostname, "localhost") == 0 ||
      strcmp(hostname, "127.0.0.1") == 0) {
    addr = htonl(INADDR_LOOPBACK);
    return true;
  } else if (strcmp(hostname, "*") == 0) {
    addr = htonl(INADDR_ANY);
    return true;
  } else {
    // See if an IP address was specified as numbers
    int inet_pton_result = ::inet_pton(AF_INET, hostname, &addr);

    if (inet_pton_result == 1)
      return true;

    struct hostent *host_entry = gethostbyname(hostname);
    if (host_entry) {
      std::string ip_str(
          ::inet_ntoa(*(struct in_addr *)*host_entry->h_addr_list));
      inet_pton_result = ::inet_pton(AF_INET, ip_str.c_str(), &addr);
      if (inet_pton_result == 1)
        return true;
    }
  }
  return false;
}

rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
                            PortBoundCallback callback,
                            const void *callback_baton) {
  // DNBLogThreadedIf(LOG_RNB_COMM, "%8u RNBSocket::%s called",
  // (uint32_t)m_timer.ElapsedMicroSeconds(true), __FUNCTION__);
  // Disconnect without saving errno
  Disconnect(false);

  DNBError err;
  int queue_id = kqueue();
  if (queue_id < 0) {
    err.SetError(errno, DNBError::MachKernel);
    err.LogThreaded("error: failed to create kqueue.");
    return rnb_err;
  }

  bool any_addr = (strcmp(listen_host, "*") == 0);

  // If the user wants to allow connections from any address we should create
  // sockets on all families that can resolve localhost. This will allow us to
  // listen for IPv6 and IPv4 connections from all addresses if those interfaces
  // are available.
  const char *local_addr = any_addr ? "localhost" : listen_host;

  std::map<int, lldb_private::SocketAddress> sockets;
  auto addresses = lldb_private::SocketAddress::GetAddressInfo(
      local_addr, NULL, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP);

  for (auto address : addresses) {
    int sock_fd = ::socket(address.GetFamily(), SOCK_STREAM, IPPROTO_TCP);
    if (sock_fd == -1)
      continue;

    SetSocketOption(sock_fd, SOL_SOCKET, SO_REUSEADDR, 1);

    lldb_private::SocketAddress bind_address = address;

    if(any_addr || !bind_address.IsLocalhost())
      bind_address.SetToAnyAddress(bind_address.GetFamily(), port);
    else
      bind_address.SetPort(port);

    int error =
        ::bind(sock_fd, &bind_address.sockaddr(), bind_address.GetLength());
    if (error == -1) {
      ClosePort(sock_fd, false);
      continue;
    }

    error = ::listen(sock_fd, 5);
    if (error == -1) {
      ClosePort(sock_fd, false);
      continue;
    }

    // We were asked to listen on port zero which means we must now read the
    // actual port that was given to us as port zero is a special code for "find
    // an open port for me". This will only execute on the first socket created,
    // subesquent sockets will reuse this port number.
    if (port == 0) {
      socklen_t sa_len = address.GetLength();
      if (getsockname(sock_fd, &address.sockaddr(), &sa_len) == 0)
        port = address.GetPort();
    }

    sockets[sock_fd] = address;
  }

  if (sockets.size() == 0) {
    err.SetError(errno, DNBError::POSIX);
    err.LogThreaded("::listen or ::bind failed");
    return rnb_err;
  }

  if (callback)
    callback(callback_baton, port);

  std::vector<struct kevent> events;
  events.resize(sockets.size());
  int i = 0;
  for (auto socket : sockets) {
    EV_SET(&events[i++], socket.first, EVFILT_READ, EV_ADD, 0, 0, 0);
  }

  bool accept_connection = false;

  // Loop until we are happy with our connection
  while (!accept_connection) {

    struct kevent event_list[4];
    int num_events =
        kevent(queue_id, events.data(), events.size(), event_list, 4, NULL);

    if (num_events < 0) {
      err.SetError(errno, DNBError::MachKernel);
      err.LogThreaded("error: kevent() failed.");
    }

    for (int i = 0; i < num_events; ++i) {
      auto sock_fd = event_list[i].ident;
      auto socket_pair = sockets.find(sock_fd);
      if (socket_pair == sockets.end())
        continue;

      lldb_private::SocketAddress &addr_in = socket_pair->second;
      lldb_private::SocketAddress accept_addr;
      socklen_t sa_len = accept_addr.GetMaxLength();
      m_fd = ::accept(sock_fd, &accept_addr.sockaddr(), &sa_len);

      if (m_fd == -1) {
        err.SetError(errno, DNBError::POSIX);
        err.LogThreaded("error: Socket accept failed.");
      }

      if (addr_in.IsAnyAddr())
        accept_connection = true;
      else {
        if (accept_addr == addr_in)
          accept_connection = true;
        else {
          ::close(m_fd);
          m_fd = -1;
          ::fprintf(
              stderr,
              "error: rejecting incoming connection from %s (expecting %s)\n",
              accept_addr.GetIPAddress().c_str(),
              addr_in.GetIPAddress().c_str());
          DNBLogThreaded("error: rejecting connection from %s (expecting %s)\n",
                         accept_addr.GetIPAddress().c_str(),
                         addr_in.GetIPAddress().c_str());
          err.Clear();
        }
      }
    }
    if (err.Fail())
      break;
  }
  for (auto socket : sockets) {
    int ListenFd = socket.first;
    ClosePort(ListenFd, false);
  }

  if (err.Fail())
    return rnb_err;

  // Keep our TCP packets coming without any delays.
  SetSocketOption(m_fd, IPPROTO_TCP, TCP_NODELAY, 1);

  return rnb_success;
}

rnb_err_t RNBSocket::Connect(const char *host, uint16_t port) {
  auto result = rnb_err;
  Disconnect(false);

  auto addresses = lldb_private::SocketAddress::GetAddressInfo(
      host, NULL, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP);

  for (auto address : addresses) {
    m_fd = ::socket(address.GetFamily(), SOCK_STREAM, IPPROTO_TCP);
    if (m_fd == -1)
      continue;

    // Enable local address reuse
    SetSocketOption(m_fd, SOL_SOCKET, SO_REUSEADDR, 1);

    address.SetPort(port);

    if (-1 == ::connect(m_fd, &address.sockaddr(), address.GetLength())) {
      Disconnect(false);
      continue;
    }
    SetSocketOption(m_fd, IPPROTO_TCP, TCP_NODELAY, 1);

    result = rnb_success;
    break;
  }
  return result;
}

rnb_err_t RNBSocket::useFD(int fd) {
  if (fd < 0) {
    DNBLogThreadedIf(LOG_RNB_COMM, "Bad file descriptor passed in.");
    return rnb_err;
  }

  m_fd = fd;
  return rnb_success;
}

#ifdef WITH_LOCKDOWN
rnb_err_t RNBSocket::ConnectToService() {
  DNBLog("Connecting to com.apple.%s service...", DEBUGSERVER_PROGRAM_NAME);
  // Disconnect from any previous connections
  Disconnect(false);
  if (::secure_lockdown_checkin(&m_ld_conn, NULL, NULL) != kLDESuccess) {
    DNBLogThreadedIf(LOG_RNB_COMM,
                     "::secure_lockdown_checkin(&m_fd, NULL, NULL) failed");
    m_fd = -1;
    return rnb_not_connected;
  }
  m_fd = ::lockdown_get_socket(m_ld_conn);
  if (m_fd == -1) {
    DNBLogThreadedIf(LOG_RNB_COMM, "::lockdown_get_socket() failed");
    return rnb_not_connected;
  }
  m_fd_from_lockdown = true;
  return rnb_success;
}
#endif

rnb_err_t RNBSocket::OpenFile(const char *path) {
  DNBError err;
  m_fd = open(path, O_RDWR);
  if (m_fd == -1) {
    err.SetError(errno, DNBError::POSIX);
    err.LogThreaded("can't open file '%s'", path);
    return rnb_not_connected;
  } else {
    struct termios stdin_termios;

    if (::tcgetattr(m_fd, &stdin_termios) == 0) {
      stdin_termios.c_lflag &= ~ECHO;   // Turn off echoing
      stdin_termios.c_lflag &= ~ICANON; // Get one char at a time
      ::tcsetattr(m_fd, TCSANOW, &stdin_termios);
    }
  }
  return rnb_success;
}

int RNBSocket::SetSocketOption(int fd, int level, int option_name,
                               int option_value) {
  return ::setsockopt(fd, level, option_name, &option_value,
                      sizeof(option_value));
}

rnb_err_t RNBSocket::Disconnect(bool save_errno) {
#ifdef WITH_LOCKDOWN
  if (m_fd_from_lockdown) {
    m_fd_from_lockdown = false;
    m_fd = -1;
    lockdown_disconnect(m_ld_conn);
    return rnb_success;
  }
#endif
  return ClosePort(m_fd, save_errno);
}

rnb_err_t RNBSocket::Read(std::string &p) {
  char buf[1024];
  p.clear();

  // Note that BUF is on the stack so we must be careful to keep any
  // writes to BUF from overflowing or we'll have security issues.

  if (m_fd == -1)
    return rnb_err;

  // DNBLogThreadedIf(LOG_RNB_COMM, "%8u RNBSocket::%s calling read()",
  // (uint32_t)m_timer.ElapsedMicroSeconds(true), __FUNCTION__);
  DNBError err;
  ssize_t bytesread = read(m_fd, buf, sizeof(buf));
  if (bytesread <= 0)
    err.SetError(errno, DNBError::POSIX);
  else
    p.append(buf, bytesread);

  if (err.Fail() || DNBLogCheckLogBit(LOG_RNB_COMM))
    err.LogThreaded("::read ( %i, %p, %llu ) => %i", m_fd, buf, sizeof(buf),
                    (uint64_t)bytesread);

  // Our port went away - we have to mark this so IsConnected will return the
  // truth.
  if (bytesread == 0) {
    m_fd = -1;
    return rnb_not_connected;
  } else if (bytesread == -1) {
    m_fd = -1;
    return rnb_err;
  }
  // Strip spaces from the end of the buffer
  while (!p.empty() && isspace(p[p.size() - 1]))
    p.erase(p.size() - 1);

  // Most data in the debugserver packets valid printable characters...
  DNBLogThreadedIf(LOG_RNB_COMM, "read: %s", p.c_str());
  return rnb_success;
}

rnb_err_t RNBSocket::Write(const void *buffer, size_t length) {
  if (m_fd == -1)
    return rnb_err;

  DNBError err;
  ssize_t bytessent = write(m_fd, buffer, length);
  if (bytessent < 0)
    err.SetError(errno, DNBError::POSIX);

  if (err.Fail() || DNBLogCheckLogBit(LOG_RNB_COMM))
    err.LogThreaded("::write ( socket = %i, buffer = %p, length = %llu) => %i",
                    m_fd, buffer, length, (uint64_t)bytessent);

  if (bytessent < 0)
    return rnb_err;

  if ((size_t)bytessent != length)
    return rnb_err;

  DNBLogThreadedIf(
      LOG_RNB_PACKETS, "putpkt: %*s", (int)length,
      (const char *)
          buffer); // All data is string based in debugserver, so this is safe
  DNBLogThreadedIf(LOG_RNB_COMM, "sent: %*s", (int)length,
                   (const char *)buffer);

  return rnb_success;
}

rnb_err_t RNBSocket::ClosePort(int &fd, bool save_errno) {
  int close_err = 0;
  if (fd > 0) {
    errno = 0;
    close_err = close(fd);
    fd = -1;
  }
  return close_err != 0 ? rnb_err : rnb_success;
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Net;

public static class FakeAddress
{
    public static string HttpAddress = "http://" + IPAddress.None + ":0";

    public static string HttpsAddress = "https://" + IPAddress.None + ":0";

    public static string TcpAddress = "net.tcp://" + IPAddress.None + ":0";
}


text:
#ifndef DIVIDE_CONQUER_FRAMEWORK_SHAREDQUEUE_H
#define DIVIDE_CONQUER_FRAMEWORK_SHAREDQUEUE_H

#include "OmpLock.h"
#include "ThreadUnsafeLockFreeQueue.h"
#include <boost/lockfree/queue.hpp>
#include <queue>

#define STL_QUEUE 1
#define BOOST_QUEUE 2
#define CUSTOM_QUEUE 3

#define ________CHOICE CUSTOM_QUEUE

#define USE_STL_QUEUE ________CHOICE == STL_QUEUE
#define USE_BOOST_QUEUE ________CHOICE == BOOST_QUEUE
#define USE_CUSTOM_QUEUE ________CHOICE == CUSTOM_QUEUE

/**
 * Queue shared across some threads.
 * We can't user #pragma omp critical, because it forces global scope of lock, for every queue instance
 * TOTO: is it worth to specify initial queue size as an argument?
 */
template<class T>
class SharedQueue {
private:
    OmpLock lock;
#if USE_STL_QUEUE
    std::queue<T> queue;
#elif USE_BOOST_QUEUE
    boost::lockfree::queue<T> queue;
#elif USE_CUSTOM_QUEUE
    ThreadUnsafeLockFreeQueue<T> queue;
#endif
public:
    SharedQueue(long initialSize);

    void put(T item);

    bool pick(T *item);

    void putMany(T *source, const int count);

    void pickMany(T *destination, const int count, int &numPicked);

    int getCountNotSynchronized();
    int getPutCountNotSynchronized();
    int getPopCountNotSynchronized();
};

#endif //DIVIDE_CONQUER_FRAMEWORK_SHAREDQUEUE_H


text:
<?php
use Doctrine\Common\ClassLoader,
    Doctrine\ORM\Configuration,
    Doctrine\ORM\EntityManager,
    Doctrine\Common\Cache\ArrayCache,
    Doctrine\DBAL\Logging\EchoSQLLogger,
    Symfony\Component\Console;
use Doctrine\ORM\Tools\Setup;

/**
 * @property \Doctrine\ORM\EntityManager $em Gerenciador de Entidade
 */
class Doctrine
{

    public $em = '';

    public function __construct()
    {
        // Set up class loading. You could use different autoloaders, provided by your favorite framework,
        // if you want to.
        require_once BASEPATH . 'third_party/Doctrine/Common/ClassLoader.php';
        require_once BASEPATH . "third_party/Doctrine/ORM/Tools/Setup.php";

        Doctrine\ORM\Tools\Setup::registerAutoloadDirectory(BASEPATH . "third_party/");

        $doctrineClassLoader = new ClassLoader('Doctrine', BASEPATH . 'third_party/Doctrine');
        $doctrineClassLoader->register();
        $proxiesClassLoader  = new ClassLoader('Proxies', APPPATH . 'models/proxies');
        $proxiesClassLoader->register();

        // Set up caches
        $config     = new Configuration;
        $cache      = new ArrayCache;
        $config->setMetadataCacheImpl($cache);
        $driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH . 'models/Entities'));
        $config->setMetadataDriverImpl($driverImpl);
        $config->setQueryCacheImpl($cache);

        $config->setQueryCacheImpl($cache);

        // Proxy configuration
        $config->setProxyDir(APPPATH . '/models/proxies');
        $config->setProxyNamespace('Proxies');

        // Set up logger
        #$logger = new EchoSQLLogger;
        #$config->setSQLLogger($logger);

        $config->setAutoGenerateProxyClasses(TRUE);

        require APPPATH . 'config/database.php';

        // Database connection information
        $connectionOptions = array(
            'driver'   => 'mysqli',
            'user'     => $db['default']['username'],
            'password' => $db['default']['password'],
            'host'     => $db['default']['hostname'],
            'dbname'   => $db['default']['database'],
            'charset'  => 'utf8',
            'driverOptions' => array(1002 => 'SET NAMES utf8')
        );

        // Enforce connection character set. This is very important if you are
        // using MySQL and InnoDB tables!
        //Doctrine_Manager::connection()->setCharset('utf8');
        //Doctrine_Manager::connection()->setCollate('utf8_general_ci');

        // Create EntityManager
        $this->em = EntityManager::create($connectionOptions, $config);
    }

}


text:
package daemon

import (
	"github.com/golang/glog"
)

func (daemon *Daemon) ContainerRename(oldname, newname string) error {
	if err := daemon.Daemon.ContainerRename(oldname, newname); err != nil {
		return err
	}

	daemon.PodList.RLock()
	glog.V(2).Infof("lock read of PodList")
	defer glog.V(2).Infof("unlock read of PodList")
	defer daemon.PodList.RUnlock()

	daemon.PodList.Find(func(p *Pod) bool {
		for _, c := range p.status.Containers {
			if c.Name == "/"+oldname {
				c.Name = "/" + newname
				return true
			}
		}
		return false
	})

	return nil
}


text:
import pytest
from PySide import QtGui, QtCore

import qmenuview

@pytest.fixture(scope='function', autouse=True)
def useqtbot(qtbot):
    pass

@pytest.fixture(scope='function')
def model():
    m = QtGui.QStandardItemModel()
    for i in range(10):
        m.appendRow(QtGui.QStandardItem("testrow%s" % i))
    return m

@pytest.fixture(scope='function')
def treemodel():
    m = QtGui.QStandardItemModel()
    for i in range(10):
        textitem = QtGui.QStandardItem("testrow%s:0" % i)
        iconitem = QtGui.QStandardItem(QtGui.QIcon(), "iconitem")
        m.appendRow([textitem, iconitem])
        for j in range(10):
            item = QtGui.QStandardItem("testrow%s:%s" % (i, j))
            textitem.appendRow(item)
            for k in range(5):
                item.appendRow(QtGui.QStandardItem("testrow%s:%s:%s" % (i, j, k)))
    return m

@pytest.fixture(scope='function')
def loadedview(treemodel):
    mv = qmenuview.MenuView()
    mv.icon_column = 1
    mv.model = treemodel
    return mv

def test_title():
    title = 'Test title'
    mv = qmenuview.MenuView(title)
    assert mv.title() == title

def test_parent():
    p = QtGui.QWidget()
    mv = qmenuview.MenuView(parent=p)
    assert mv.parent() is p

def test_set_empty_model(loadedview):
    m = QtGui.QStandardItemModel()
    loadedview.model = m
    assert loadedview.model is m
    assert loadedview.isEmpty()

def test_set_model_none(loadedview):
    loadedview.model = None
    assert loadedview.model is None
    assert loadedview.isEmpty()

def test_actions_created(model):
    mv = qmenuview.MenuView()
    mv.model = model
    actions = mv.actions()
    assert len(actions) == 10,\
        'There should be 10 actions for 10 items'
    for i in range(10):
        assert actions[i].text() == 'testrow%s' % i

def test_flatten_hierarchy(treemodel):
    flatted = qmenuview.MenuView._flatten_hierarchy(treemodel)
    i = 0
    parent = QtCore.QModelIndex()
    for index in flatted[:10]:
        assert index.parent() == parent
        assert index.row() == i
        assert index.column() == 0
        i += 1
    for j in range(10):
        parent = treemodel.index(j, 0, QtCore.QModelIndex())
        for i, index in enumerate(flatted[10 * (j + 1):10 * (j + 2)]):
            assert index.parent() == parent
            assert index.row() == i
            assert index.column() == 0

def test_menus_created(loadedview):
    for i, a in enumerate(loadedview.actions()):
        assert a.text() == 'testrow%s:0' % i
        for j, ca in enumerate(a.menu().actions()):
            assert ca.text() == 'testrow%s:%s' % (i, j)

def test_menu_action_triggered(qtbot, loadedview):
    with qtbot.waitSignal(loadedview.triggered, raising=True):
        action = loadedview.actions()[0]
        action.triggered.emit()

def test_menu_action_hovered(qtbot, loadedview):
    with qtbot.waitSignal(loadedview.action_hovered, raising=True):
        action = loadedview.actions()[0]
        action.hovered.emit()

def test_action_triggered(qtbot, loadedview):
    with qtbot.waitSignal(loadedview.action_triggered, raising=True):
        action = loadedview.actions()[0].menu().actions()[0]
        action.triggered.emit()

def test_action_hovered(qtbot, loadedview):
    with qtbot.waitSignal(loadedview.action_hovered, raising=True):
        action = loadedview.actions()[0].menu().actions()[0]
        action.hovered.emit()

def test_insert_menus(treemodel):
    mv = qmenuview.MenuView()
    mv.model = treemodel
    item = QtGui.QStandardItem("newitem1")
    item.appendRow(QtGui.QStandardItem("newitem2"))
    parentindex = treemodel.index(0, 0, treemodel.index(2, 0, treemodel.index(2, 0)))
    parent = treemodel.itemFromIndex(parentindex)
    parent.appendRow(item)
    parentmenu = mv.actions()[2].menu().actions()[2].menu().actions()[0].menu()
    assert parentmenu,\
        "The parent action was not converted to a menu"
    newaction = parentmenu.actions()[0]
    assert newaction.text() == 'newitem1'
    assert newaction.menu().actions()[0].text() == 'newitem2',\
        "Did not create submenus of inserted rows."

def test_get_parent_indizes_invalid(loadedview):
    parents = loadedview._get_parent_indizes(QtCore.QModelIndex())
    assert parents == [],\
        "Invalid index has no parents!"

def test_get_parent_indizes_other_model(loadedview, model):
    parents = loadedview._get_parent_indizes(model.index(0, 0))
    assert parents == [],\
        "There should be no parents because index is of another model!"

def test_get_parent_indizes_first_level(loadedview, treemodel):
    parents = loadedview._get_parent_indizes(treemodel.index(0, 0))
    assert parents == [],\
        "There are no parent indizes because index is on first level!"

def test_get_parent_indizes_second_level(loadedview, treemodel):
    p1 = treemodel.index(0, 0)
    parents = loadedview._get_parent_indizes(treemodel.index(0, 0, p1))
    assert parents == [p1],\
        "There should be one parent!"

def test_get_parent_indizes_third_level(loadedview, treemodel):
    p1 = treemodel.index(0, 0)
    p2 = treemodel.index(0, 0, p1)
    parents = loadedview._get_parent_indizes(treemodel.index(0, 0, p2))
    assert parents == [p2, p1],\
        "There should be two parents!"

def test_get_action_invalid(loadedview):
    action = loadedview.get_action(QtCore.QModelIndex())
    assert action is loadedview.menuAction(),\
        "Invalid Index should give the action of the menu view!"

def test_get_action_first_level(loadedview, treemodel):
    action = loadedview.get_action(treemodel.index(3, 0))
    assert action is loadedview.actions()[3]

def test_get_action_second_level(loadedview, treemodel):
    action = loadedview.get_action(treemodel.index(9, 0, treemodel.index(9, 0)))
    assert action is loadedview.actions()[9].parentWidget().actions()[9]

def test_get_action_third_level(loadedview, treemodel):
    action = loadedview.get_action(
        treemodel.index(0, 0, treemodel.index(2, 0, treemodel.index(9, 0))))
    assert action is loadedview.actions()[9].parentWidget().actions()[2].parentWidget().actions()[0]

def test_get_parents_invalid(loadedview):
    w1 = QtGui.QMenu()
    w2 = w1.addMenu("Test")
    action = QtGui.QAction(w2)
    parents = loadedview._get_parents(action)
    assert parents == [],\
        "Actions not part of the tree have no parents!"

def test_get_parents_self(loadedview):
    action = loadedview.menuAction()
    parents = loadedview._get_parents(action)
    assert parents == [],\
        "If the action is the menuAction of the menu view, there are no parents!"

def test_get_parents_first_level(loadedview):
    action = loadedview.actions()[4]
    parents = loadedview._get_parents(action)
    assert parents == [],\
        "First level actions have no parent!"

def test_get_parents_second_level(loadedview):
    p1 = loadedview.actions()[4]
    action = p1.menu().actions()[9]
    parents = loadedview._get_parents(action)
    assert parents == [p1],\
        "Second level actions only have the first level action as parent!"

def test_get_parents_third_level(loadedview):
    p1 = loadedview.actions()[4]
    p1.setParent(loadedview)
    p2 = p1.menu().actions()[5]
    action = p2.menu().actions()[2]
    parents = loadedview._get_parents(action)
    assert parents == [p2, p1],\
        "Third level actions have two actions as parent!"

def test_get_index_self(loadedview):
    i = loadedview.get_index(loadedview.menuAction())
    assert not i.isValid()

def test_get_index_invalid(loadedview):
    a = QtGui.QAction(None)
    i = loadedview.get_index(a)
    assert not i.isValid()

def test_get_index_first_level(loadedview, treemodel):
    i = loadedview.get_index(loadedview.actions()[9])
    assert i == treemodel.index(9, 0)

def test_get_index_second_level(loadedview, treemodel):
    i = loadedview.get_index(loadedview.actions()[2].menu().actions()[9])
    expected = treemodel.index(9, 0, treemodel.index(2, 0))
    assert i == expected

def test_remove_menus(loadedview, treemodel):
    first = 3
    count = 5
    treemodel.removeRows(first, count, treemodel.index(2, 0))
    remaining = loadedview.actions()[2].menu().actions()
    assert len(remaining) == 5,\
        "There should only be 5 rows remaining!"
    texts = ['2:0', '2:1', '2:2', '2:8', '2:9']
    expectedtexts = ['testrow%s' % t for t in texts]
    remainingtexts = [a.text() for a in remaining]
    assert expectedtexts == remainingtexts,\
        "There should only be actions with these texts left"

def test_remove_menus_convert_menu(loadedview, treemodel):
    first = 0
    count = 10
    treemodel.removeRows(first, count, treemodel.index(2, 0))
    assert loadedview.actions()[2].menu() is None,\
        "The should be no menu, if there are no actions left."

def test_update_menu_text(loadedview, treemodel):
    teststring = "Thanks for the fish!"
    treemodel.setData(treemodel.index(2, 0), teststring)
    assert loadedview.actions()[2].text() == teststring

def test_change_column(loadedview, treemodel):
    loadedview.text_column = 1
    i = treemodel.index(0, 1)
    txt = 'TEST'
    treemodel.setData(i, txt)
    assert loadedview.actions()[0].text() == txt

def test_remove_all_then_insert(model):
    # this test can fail, if you remove all rows,
    # then remove the menu from the parent action.
    # If the menu is the menuview itself, then
    # it will never be reparented!
    # thus resulting in a wierd error
    mv = qmenuview.MenuView()
    mv.model = model
    for i in reversed(range(model.rowCount())):
        model.removeRow(i)
    item = QtGui.QStandardItem("testrow1")
    item.appendRow(QtGui.QStandardItem("testrow2"))
    model.appendRow(item)


text:
package com.tle.admin.reporting;

import com.dytech.gui.TableLayout;
import com.dytech.gui.workers.GlassSwingWorker;
import com.tle.admin.Driver;
import com.tle.admin.baseentity.BaseEntityEditor.AbstractDetailsTab;
import com.tle.admin.baseentity.BaseEntityTab;
import com.tle.admin.gui.EditorException;
import com.tle.admin.gui.i18n.I18nTextArea;
import com.tle.admin.gui.i18n.I18nTextField;
import com.tle.beans.entity.report.Report;
import com.tle.common.adminconsole.FileUploader;
import com.tle.common.applet.client.DialogUtils;
import com.tle.common.applet.client.DialogUtils.DialogResult;
import com.tle.common.recipientselector.SingleUserSelector;
import com.tle.common.reporting.RemoteReportingService;
import com.tle.common.reporting.ReportingException;
import com.tle.common.reporting.ReportingException.Type;
import com.tle.core.remoting.RemoteUserService;
import com.tle.i18n.BundleCache;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyListener;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.List;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.filechooser.FileFilter;

/** @author Nicholas Read */
public class DetailsTab extends BaseEntityTab<Report>
    implements AbstractDetailsTab<Report>, ActionListener {
  @SuppressWarnings("nls")
  private final String TITLE = getString("detailstab.title"); // $NON-NLS-1$

  private JTextField identifier;
  private I18nTextField name;
  private I18nTextArea description;
  private SingleUserSelector owner;
  private JButton upload;
  private JButton download;
  private JCheckBox hideReport;

  private JComboBox initialReport;
  private RemoteReportingService service;

  public DetailsTab() {
    super();
  }

  @Override
  public void init(Component parent) {
    setupGUI();
    service = clientService.getService(RemoteReportingService.class);
  }

  @Override
  public String getTitle() {
    return TITLE;
  }

  private void setupGUI() {
    JLabel identifierLabel = new JLabel(getString("detailstab.identifier")); // $NON-NLS-1$
    JLabel nameLabel = new JLabel(getString("reports.detailstab.name")); // $NON-NLS-1$
    JLabel descriptionLabel = new JLabel(getString("detailstab.desc")); // $NON-NLS-1$
    JLabel ownerLabel = new JLabel(getString("reports.detailstab.owner")); // $NON-NLS-1$
    JLabel uploadLabel = new JLabel(getString("detailstab.design")); // $NON-NLS-1$
    JLabel hideReportLabel = new JLabel(getString("detailstab.hidereport")); // $NON-NLS-1$

    descriptionLabel.setVerticalAlignment(SwingConstants.TOP);

    identifier = new JTextField();
    identifier.setEditable(false);
    name = new I18nTextField(BundleCache.getLanguages());
    description = new I18nTextArea(BundleCache.getLanguages());
    owner = new SingleUserSelector(clientService.getService(RemoteUserService.class));
    hideReport = new JCheckBox();

    final int height1 = owner.getPreferredSize().height;
    final int width1 = hideReportLabel.getPreferredSize().width;

    final int[] rows = {
      height1, height1, height1 * 3, height1, height1, height1, TableLayout.FILL,
    };
    final int[] cols = {
      width1, TableLayout.DOUBLE_FILL, TableLayout.FILL,
    };

    setLayout(new TableLayout(rows, cols));

    add(identifierLabel, new Rectangle(0, 0, 1, 1));
    add(identifier, new Rectangle(1, 0, 1, 1));

    add(nameLabel, new Rectangle(0, 1, 1, 1));
    add(name, new Rectangle(1, 1, 1, 1));

    add(descriptionLabel, new Rectangle(0, 2, 1, 1));
    add(description, new Rectangle(1, 2, 1, 1));

    add(ownerLabel, new Rectangle(0, 3, 1, 1));
    add(owner, new Rectangle(1, 3, 1, 1));

    // Make sure things are readonly.
    if (state.isReadonly()) {
      name.setEnabled(false);
      description.setEnabled(false);
      owner.setEnabled(false);
    }

    initialReport = new JComboBox();
    initialReport.setEditable(false);
    initialReport.setPreferredSize(new Dimension(230, 23));

    upload = new JButton(getString("detailstab.upload")); // $NON-NLS-1$
    upload.addActionListener(this);

    download = new JButton(getString("detailstab.download")); // $NON-NLS-1$
    download.addActionListener(this);

    add(uploadLabel, new Rectangle(0, 4, 1, 1));

    // Stupid java layout!!!
    JPanel panelsomething = new JPanel();
    panelsomething.setLayout(new BorderLayout(0, 0));
    panelsomething.add(upload, BorderLayout.WEST);
    panelsomething.add(download, BorderLayout.EAST);
    JPanel panelsomething2 = new JPanel();
    panelsomething2.setLayout(new BorderLayout(5, 10));
    panelsomething2.add(initialReport, BorderLayout.CENTER);
    panelsomething2.add(panelsomething, BorderLayout.EAST);

    panelsomething2.add(initialReport, BorderLayout.CENTER);
    panelsomething2.add(panelsomething, BorderLayout.EAST);

    add(panelsomething2, new Rectangle(1, 4, 1, 1));

    add(hideReportLabel, new Rectangle(0, 5, 1, 1));
    add(hideReport, new Rectangle(1, 5, 1, 1));
  }

  @Override
  public void addNameListener(KeyListener listener) {
    name.addKeyListener(listener);
  }

  @Override
  public void load() {
    final Report report = state.getEntity();

    identifier.setText(report.getUuid());
    name.load(report.getName());
    description.load(report.getDescription());
    owner.setUserId(report.getOwner());
    initialReport.setModel(new ReportDesignModel(state.getEntityPack().getStagingID()));
    if (report.getFilename() != null) {
      initialReport.setSelectedItem(new ReportDesignValue(report.getFilename()));
    }
    hideReport.setSelected(report.isHideReport());
  }

  @Override
  public void save() {
    final Report report = state.getEntity();

    report.setName(name.save());
    report.setDescription(description.save());
    report.setOwner(owner.getUser().getUniqueID());
    report.setFilename(((ReportDesignValue) initialReport.getSelectedItem()).getFilename());
    report.setHideReport(hideReport.isSelected());
  }

  @SuppressWarnings("nls")
  @Override
  public void validation() throws EditorException {
    if (name.isCompletelyEmpty()) {
      throw new EditorException(getString("reports.detailstab.supplyname")); // $NON-NLS-1$
    }

    if (owner.getUser() == null) {
      throw new EditorException(getString("reports.detailstab.noowner")); // $NON-NLS-1$
    }

    if (initialReport.getSelectedIndex() == -1) {
      throw new EditorException(getString("detailstab.noreport"));
    }
  }

  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == upload) {
      uploadFile();
    } else if (e.getSource() == download) {
      download();
    }
  }

  public final class RPTFileFilter extends FileFilter {
    @Override
    public String getDescription() {
      return getString("detailstab.reportdesign"); // $NON-NLS-1$
    }

    @SuppressWarnings("nls")
    @Override
    public boolean accept(File f) {
      if (f.isDirectory()) {
        return true;
      } else {
        String name = f.toString().toLowerCase();
        return name.endsWith(".rptdesign") || name.endsWith(".zip") || name.endsWith(".rptlibrary");
      }
    }
  }

  public final class RPTArchiveFileFilter extends FileFilter {
    @Override
    public String getDescription() {
      return getString("detailstab.reportdowntype"); // $NON-NLS-1$
    }

    @SuppressWarnings("nls")
    @Override
    public boolean accept(File f) {
      if (f.isDirectory()) {
        return true;
      } else {
        String name = f.toString().toLowerCase();
        return name.endsWith(".zip");
      }
    }
  }

  @SuppressWarnings({"nls", "deprecation"})
  public boolean uploadFile() {
    File file;
    FileFilter filter = new RPTFileFilter();
    final DialogResult result =
        DialogUtils.openDialogStrictFilter(
            panel,
            getString("detailstab.selectreport"), // $NON-NLS-1$
            filter,
            null);
    if (result.isOkayed()) {
      file = result.getFile();
    } else {
      return false;
    }

    try {
      try {
        String staging = state.getEntityPack().getStagingID();
        BufferedInputStream in = null;
        adminService.removeFile(staging, "");
        in = new BufferedInputStream(new FileInputStream(file));
        String fileName = file.getName();
        FileUploader.upload(adminService, staging, fileName, in);
        service.processReportDesign(staging, fileName);
        initialReport.setModel(new ReportDesignModel(staging));
      } catch (ReportingException re) {
        if (re.getType() == Type.NODESIGNS) {
          Driver.displayInformation(description, getString("uploaderr.noreports"));
          return false;
        } else {
          throw re;
        }
      }
    } catch (Exception e) {
      Driver.displayError(description, getKey("uploaderr.title"), getKey("uploaderr.msg"), e);
      return false;
    }
    return true;
  }

  public void download() {
    final File file;
    FileFilter filter = new RPTArchiveFileFilter();
    final DialogResult result =
        DialogUtils.saveDialogStrictFilter(
            panel,
            getString("detailstab.selectfile"), // $NON-NLS-1$
            filter,
            null);
    if (result.isOkayed()) {
      File file2 = result.getFile();
      if (!file2.getName().contains(".")) // $NON-NLS-1$
      {
        file2 = new File(file2.getParentFile(), file2.getName() + ".zip"); // $NON-NLS-1$
      }
      file = file2;
    } else {
      return;
    }

    GlassSwingWorker<Object> worker =
        new GlassSwingWorker<Object>() {
          @Override
          public Object construct() throws Exception {
            String filename = file.getName();
            String stagingId =
                service.prepareDownload(
                    state.getEntity(), state.getEntityPack().getStagingID(), filename);
            byte[] bs = adminService.downloadFile(stagingId, filename);
            try (OutputStream stream = new BufferedOutputStream(new FileOutputStream(file))) {
              stream.write(bs);
            }
            service.cleanDownload(stagingId);
            return null;
          }

          @Override
          public void finished() {
            Driver.displayInformation(parent, getString("detailstab.complete")); // $NON-NLS-1$
          }

          @Override
          public void exception() {
            Driver.displayInformation(panel, getString("detailstab.error")); // $NON-NLS-1$
            LOGGER.error("Error downloading file", getException()); // $NON-NLS-1$
          }
        };
    worker.setComponent(parent);
    worker.start();
  }

  public final class ReportDesignModel extends DefaultComboBoxModel {
    public ReportDesignModel(String stagingId) {
      List<String> reportFilenames = service.getReportDesignFiles(stagingId);
      for (String filename : reportFilenames) {
        addElement(new ReportDesignValue(filename));
      }
    }
  }

  public static final class ReportDesignValue {
    private final String filename;
    private final String nameOnly;

    public ReportDesignValue(String filename) {
      nameOnly = new File(filename).getName();
      this.filename = filename;
    }

    public String getFilename() {
      return filename;
    }

    @Override
    public boolean equals(Object obj) {
      if (this == obj) {
        return true;
      }

      if (!(obj instanceof ReportDesignValue)) {
        return false;
      }

      return ((ReportDesignValue) obj).filename.equals(filename);
    }

    @Override
    public int hashCode() {
      return filename.hashCode();
    }

    @Override
    public String toString() {
      return nameOnly;
    }
  }
}


text:
namespace app { namespace Fuse { namespace Shapes { struct GeometryCacheEntry; } } }
namespace app { namespace Uno { namespace Collections { struct Dictionary__string__Fuse_Shapes_GeometryCacheEntry; } } }
namespace app { namespace Uno { namespace Collections { struct Dictionary2_ValueCollection_Enumerator__string__Fuse_Shapes_GeometryCacheEntry; } } }

namespace app {
namespace Uno {
namespace Collections {

struct Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry;

struct Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry__uType : ::uClassType
{
};

Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry__uType* Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry__typeof();

void Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry___ObjInit(Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry* __this, ::app::Uno::Collections::Dictionary__string__Fuse_Shapes_GeometryCacheEntry* source);
int Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry__get_Count(Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry* __this);
::app::Uno::Collections::Dictionary2_ValueCollection_Enumerator__string__Fuse_Shapes_GeometryCacheEntry Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry__GetEnumerator(Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry* __this);
Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry* Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry__New_1(::uStatic* __this, ::app::Uno::Collections::Dictionary__string__Fuse_Shapes_GeometryCacheEntry* source);
void Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry__Uno_Collections_ICollection_Add(Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry* __this, ::app::Fuse::Shapes::GeometryCacheEntry* item);
void Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry__Uno_Collections_ICollection_Clear(Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry* __this);
bool Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry__Uno_Collections_ICollection_Contains(Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry* __this, ::app::Fuse::Shapes::GeometryCacheEntry* item);
bool Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry__Uno_Collections_ICollection_Remove(Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry* __this, ::app::Fuse::Shapes::GeometryCacheEntry* item);

struct Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry : ::uObject
{
    ::uStrong< ::app::Uno::Collections::Dictionary__string__Fuse_Shapes_GeometryCacheEntry*> _source;

    void _ObjInit(::app::Uno::Collections::Dictionary__string__Fuse_Shapes_GeometryCacheEntry* source) { Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry___ObjInit(this, source); }
    int Count() { return Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry__get_Count(this); }
    ::app::Uno::Collections::Dictionary2_ValueCollection_Enumerator__string__Fuse_Shapes_GeometryCacheEntry GetEnumerator();
};

}}}

#include <app/Uno.Collections.Dictionary2_ValueCollection_Enumerator__string_-e21052d.h>

namespace app {
namespace Uno {
namespace Collections {

inline ::app::Uno::Collections::Dictionary2_ValueCollection_Enumerator__string__Fuse_Shapes_GeometryCacheEntry Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry::GetEnumerator() { return Dictionary2_ValueCollection__string__Fuse_Shapes_GeometryCacheEntry__GetEnumerator(this); }

}}}

#endif


text:
#ifndef __RT_DEVICE_H__
#define __RT_DEVICE_H__

#include <rtthread.h>

#define RT_DEVICE(device)            ((rt_device_t)device)

/* completion flag */
struct rt_completion
{
    rt_uint32_t flag;

    /* suspended list */
    rt_list_t suspended_list;
};

/* ring buffer */
struct rt_ringbuffer
{
    rt_uint8_t *buffer_ptr;
    /* use the msb of the {read,write}_index as mirror bit. You can see this as
     * if the buffer adds a virtual mirror and the pointers point either to the
     * normal or to the mirrored buffer. If the write_index has the same value
     * with the read_index, but in a different mirror, the buffer is full.
     * While if the write_index and the read_index are the same and within the
     * same mirror, the buffer is empty. The ASCII art of the ringbuffer is:
     *
     *          mirror = 0                    mirror = 1
     * +---+---+---+---+---+---+---+|+~~~+~~~+~~~+~~~+~~~+~~~+~~~+
     * | 0 | 1 | 2 | 3 | 4 | 5 | 6 ||| 0 | 1 | 2 | 3 | 4 | 5 | 6 | Full
     * +---+---+---+---+---+---+---+|+~~~+~~~+~~~+~~~+~~~+~~~+~~~+
     *  read_idx-^                   write_idx-^
     *
     * +---+---+---+---+---+---+---+|+~~~+~~~+~~~+~~~+~~~+~~~+~~~+
     * | 0 | 1 | 2 | 3 | 4 | 5 | 6 ||| 0 | 1 | 2 | 3 | 4 | 5 | 6 | Empty
     * +---+---+---+---+---+---+---+|+~~~+~~~+~~~+~~~+~~~+~~~+~~~+
     * read_idx-^ ^-write_idx
     *
     * The tradeoff is we could only use 32KiB of buffer for 16 bit of index.
     * But it should be enough for most of the cases.
     *
     * Ref: http://en.wikipedia.org/wiki/Circular_buffer#Mirroring */
    rt_uint16_t read_mirror : 1;
    rt_uint16_t read_index : 15;
    rt_uint16_t write_mirror : 1;
    rt_uint16_t write_index : 15;
    /* as we use msb of index as mirror bit, the size should be signed and
     * could only be positive. */
    rt_int16_t buffer_size;
};

/* portal device */
struct rt_portal_device
{
    struct rt_device parent;
    struct rt_device *write_dev;
    struct rt_device *read_dev;
};

/* pipe device */
#define PIPE_DEVICE(device)          ((struct rt_pipe_device*)(device))
enum rt_pipe_flag
{
    /* both read and write won't block */
    RT_PIPE_FLAG_NONBLOCK_RDWR = 0x00,
    /* read would block */
    RT_PIPE_FLAG_BLOCK_RD = 0x01,
    /* write would block */
    RT_PIPE_FLAG_BLOCK_WR = 0x02,
    /* write to this pipe will discard some data when the pipe is full.
     * When this flag is set, RT_PIPE_FLAG_BLOCK_WR will be ignored since write
     * operation will always be success. */
    RT_PIPE_FLAG_FORCE_WR = 0x04,
};

struct rt_pipe_device
{
    struct rt_device parent;

    /* ring buffer in pipe device */
    struct rt_ringbuffer ringbuffer;

    enum rt_pipe_flag flag;

    /* suspended list */
    rt_list_t suspended_read_list;
    rt_list_t suspended_write_list;

    struct rt_portal_device *write_portal;
    struct rt_portal_device *read_portal;
};

#define PIPE_CTRL_GET_SPACE          0x14            /**< get the remaining size of a pipe device */

#define RT_DATAQUEUE_EVENT_UNKNOWN   0x00
#define RT_DATAQUEUE_EVENT_POP       0x01
#define RT_DATAQUEUE_EVENT_PUSH      0x02
#define RT_DATAQUEUE_EVENT_LWM       0x03

struct rt_data_item;
#define RT_DATAQUEUE_SIZE(dq)        ((dq)->put_index - (dq)->get_index)
#define RT_DATAQUEUE_EMPTY(dq)       ((dq)->size - RT_DATAQUEUE_SIZE(dq))
/* data queue implementation */
struct rt_data_queue
{
    rt_uint16_t size;
    rt_uint16_t lwm;
    rt_bool_t   waiting_lwm;

    rt_uint16_t get_index;
    rt_uint16_t put_index;

    struct rt_data_item *queue;

    rt_list_t suspended_push_list;
    rt_list_t suspended_pop_list;

    /* event notify */
    void (*evt_notify)(struct rt_data_queue *queue, rt_uint32_t event);
};

/* workqueue implementation */
struct rt_workqueue
{
	rt_list_t   work_list;
	rt_thread_t work_thread;
};

struct rt_work
{
	rt_list_t list;

	void (*work_func)(struct rt_work* work, void* work_data);
	void *work_data;
};

/**
 * Completion
 */
void rt_completion_init(struct rt_completion *completion);
rt_err_t rt_completion_wait(struct rt_completion *completion,
                            rt_int32_t            timeout);
void rt_completion_done(struct rt_completion *completion);

/**
 * RingBuffer for DeviceDriver
 *
 * Please note that the ring buffer implementation of RT-Thread
 * has no thread wait or resume feature.
 */
void rt_ringbuffer_init(struct rt_ringbuffer *rb,
                        rt_uint8_t           *pool,
                        rt_int16_t            size);
rt_size_t rt_ringbuffer_put(struct rt_ringbuffer *rb,
                            const rt_uint8_t     *ptr,
                            rt_uint16_t           length);
rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb,
                                  const rt_uint8_t     *ptr,
                                  rt_uint16_t           length);
rt_size_t rt_ringbuffer_putchar(struct rt_ringbuffer *rb,
                                const rt_uint8_t      ch);
rt_size_t rt_ringbuffer_putchar_force(struct rt_ringbuffer *rb,
                                      const rt_uint8_t      ch);
rt_size_t rt_ringbuffer_get(struct rt_ringbuffer *rb,
                            rt_uint8_t           *ptr,
                            rt_uint16_t           length);
rt_size_t rt_ringbuffer_getchar(struct rt_ringbuffer *rb, rt_uint8_t *ch);

enum rt_ringbuffer_state
{
    RT_RINGBUFFER_EMPTY,
    RT_RINGBUFFER_FULL,
    /* half full is neither full nor empty */
    RT_RINGBUFFER_HALFFULL,
};

rt_inline rt_uint16_t rt_ringbuffer_get_size(struct rt_ringbuffer *rb)
{
    RT_ASSERT(rb != RT_NULL);
    return rb->buffer_size;
}

rt_inline enum rt_ringbuffer_state
rt_ringbuffer_status(struct rt_ringbuffer *rb)
{
    if (rb->read_index == rb->write_index)
    {
        if (rb->read_mirror == rb->write_mirror)
            return RT_RINGBUFFER_EMPTY;
        else
            return RT_RINGBUFFER_FULL;
    }
    return RT_RINGBUFFER_HALFFULL;
}

/** return the size of data in rb */
rt_inline rt_uint16_t rt_ringbuffer_data_len(struct rt_ringbuffer *rb)
{
    switch (rt_ringbuffer_status(rb))
    {
    case RT_RINGBUFFER_EMPTY:
        return 0;
    case RT_RINGBUFFER_FULL:
        return rb->buffer_size;
    case RT_RINGBUFFER_HALFFULL:
    default:
        if (rb->write_index > rb->read_index)
            return rb->write_index - rb->read_index;
        else
            return rb->buffer_size - (rb->read_index - rb->write_index);
    };
}

/** return the size of empty space in rb */
#define rt_ringbuffer_space_len(rb) ((rb)->buffer_size - rt_ringbuffer_data_len(rb))

/**
 * Pipe Device
 */
rt_err_t rt_pipe_init(struct rt_pipe_device *pipe,
                      const char *name,
                      enum rt_pipe_flag flag,
                      rt_uint8_t *buf,
                      rt_size_t size);
rt_err_t rt_pipe_detach(struct rt_pipe_device *pipe);
#ifdef RT_USING_HEAP
rt_err_t rt_pipe_create(const char *name, enum rt_pipe_flag flag, rt_size_t size);
void rt_pipe_destroy(struct rt_pipe_device *pipe);
#endif

/**
 * Portal for DeviceDriver
 */

rt_err_t rt_portal_init(struct rt_portal_device *portal,
                        const char *portal_name,
                        const char *write_dev,
                        const char *read_dev);
rt_err_t rt_portal_detach(struct rt_portal_device *portal);

#ifdef RT_USING_HEAP
rt_err_t rt_portal_create(const char *name,
                          const char *write_dev,
                          const char *read_dev);
void rt_portal_destroy(struct rt_portal_device *portal);
#endif

/**
 * DataQueue for DeviceDriver
 */
rt_err_t rt_data_queue_init(struct rt_data_queue *queue,
                            rt_uint16_t           size,
                            rt_uint16_t           lwm,
                            void (*evt_notify)(struct rt_data_queue *queue, rt_uint32_t event));
rt_err_t rt_data_queue_push(struct rt_data_queue *queue,
                            const void           *data_ptr,
                            rt_size_t             data_size,
                            rt_int32_t            timeout);
rt_err_t rt_data_queue_pop(struct rt_data_queue *queue,
                           const void          **data_ptr,
                           rt_size_t            *size,
                           rt_int32_t            timeout);
rt_err_t rt_data_queue_peak(struct rt_data_queue *queue,
                            const void          **data_ptr,
                            rt_size_t            *size);
void rt_data_queue_reset(struct rt_data_queue *queue);

#ifdef RT_USING_HEAP
/**
 * WorkQueue for DeviceDriver
 */
struct rt_workqueue *rt_workqueue_create(const char* name, rt_uint16_t stack_size, rt_uint8_t priority);
rt_err_t rt_workqueue_destroy(struct rt_workqueue* queue);
rt_err_t rt_workqueue_dowork(struct rt_workqueue* queue, struct rt_work* work);
rt_err_t rt_workqueue_cancel_work(struct rt_workqueue* queue, struct rt_work* work);

rt_inline void rt_work_init(struct rt_work* work, void (*work_func)(struct rt_work* work, void* work_data),
    void* work_data)
{
    rt_list_init(&(work->list));
    work->work_func = work_func;
    work->work_data = work_data;
}
#endif

#ifdef RT_USING_RTC
#include "drivers/rtc.h"
#ifdef RT_USING_ALARM
#include "drivers/alarm.h"
#endif
#endif /* RT_USING_RTC */

#ifdef RT_USING_SPI
#include "drivers/spi.h"
#endif /* RT_USING_SPI */

#ifdef RT_USING_MTD_NOR
#include "drivers/mtd_nor.h"
#endif /* RT_USING_MTD_NOR */

#ifdef RT_USING_MTD_NAND
#include "drivers/mtd_nand.h"
#endif /* RT_USING_MTD_NAND */

#ifdef RT_USING_USB_DEVICE
#include "drivers/usb_device.h"
#endif /* RT_USING_USB_DEVICE */

#ifdef RT_USING_USB_HOST
#include "drivers/usb_host.h"
#endif /* RT_USING_USB_HOST */

#ifdef RT_USING_SERIAL
#include "drivers/serial.h"
#endif /* RT_USING_SERIAL */

#ifdef RT_USING_I2C
#include "drivers/i2c.h"
#include "drivers/i2c_dev.h"

#ifdef RT_USING_I2C_BITOPS
#include "drivers/i2c-bit-ops.h"
#endif /* RT_USING_I2C_BITOPS */
#endif /* RT_USING_I2C */

#ifdef RT_USING_SDIO
#include "drivers/mmcsd_core.h"
#include "drivers/sd.h"
#include "drivers/sdio.h"
#endif

#ifdef RT_USING_WDT
#include "drivers/watchdog.h"
#endif

#ifdef RT_USING_PIN
#include "drivers/pin.h"
#endif

#endif /* __RT_DEVICE_H__ */


text:
package cmd

import (
	"context"
	"encoding/base64"
	"fmt"
	"time"

	"github.com/spf13/cobra"

	"istio.io/bots/policybot/mgrs/lifecyclemgr"
	"istio.io/bots/policybot/pkg/cmdutil"
	"istio.io/bots/policybot/pkg/config"
	"istio.io/bots/policybot/pkg/gh"
	"istio.io/bots/policybot/pkg/storage/cache"
	"istio.io/bots/policybot/pkg/storage/spanner"
)

func lifecycleMgrCmd() *cobra.Command {
	cmd, _ := cmdutil.Run("lifecyclemgr", "Runs the issue and pull request lifecycle manager", 0,
		cmdutil.ConfigPath|cmdutil.ConfigRepo|cmdutil.GitHubToken|cmdutil.GCPCreds, runLifecycleMgr)

	return cmd
}

func runLifecycleMgr(reg *config.Registry, secrets *cmdutil.Secrets) error {
	creds, err := base64.StdEncoding.DecodeString(secrets.GCPCredentials)
	if err != nil {
		return fmt.Errorf("unable to decode GCP credentials: %v", err)
	}

	core := reg.Core()

	store, err := spanner.NewStore(context.Background(), core.SpannerDatabase, creds)
	if err != nil {
		return fmt.Errorf("unable to create storage layer: %v", err)
	}
	defer store.Close()

	gc := gh.NewThrottledClient(context.Background(), secrets.GitHubToken)
	c := cache.New(store, time.Duration(core.CacheTTL))
	mgr := lifecyclemgr.New(gc, store, c, reg)
	return mgr.ManageAll(context.Background(), false)
}


text:
<!DOCTYPE html>

	<meta charset="utf-8">

	<title>PNConfiguration Class Reference</title>

	<link rel="stylesheet" href="../css/style.css">
	<meta name="viewport" content="initial-scale=1, maximum-scale=1.4">
	<meta name="generator" content="appledoc 2.2.1 (build 1333)">

				PubNub 4.0b3 for iOS

				PubNub

Index

Hierarchy

							On This Page

							<select id="jump-to">
	<option value="top">Jump To…</option>

	<option value="overview">Overview</option>

	<option value="tasks">Tasks</option>

	<optgroup label="Properties">

		<option value="//api/name/TLSEnabled">TLSEnabled</option>

		<option value="//api/name/authKey">authKey</option>

		<option value="//api/name/catchUpOnSubscriptionRestore">catchUpOnSubscriptionRestore</option>

		<option value="//api/name/cipherKey">cipherKey</option>

		<option value="//api/name/deviceID">deviceID</option>

		<option value="//api/name/keepTimeTokenOnListChange">keepTimeTokenOnListChange</option>

		<option value="//api/name/nonSubscribeRequestTimeout">nonSubscribeRequestTimeout</option>

		<option value="//api/name/origin">origin</option>

		<option value="//api/name/presenceHeartbeatInterval">presenceHeartbeatInterval</option>

		<option value="//api/name/presenceHeartbeatValue">presenceHeartbeatValue</option>

		<option value="//api/name/publishKey">publishKey</option>

		<option value="//api/name/restoreSubscription">restoreSubscription</option>

		<option value="//api/name/subscribeKey">subscribeKey</option>

		<option value="//api/name/subscribeMaximumIdleTime">subscribeMaximumIdleTime</option>

		<option value="//api/name/uuid">uuid</option>

	</optgroup>

	<optgroup label="Class Methods">

		<option value="//api/name/configurationWithPublishKey:subscribeKey:">+ configurationWithPublishKey:subscribeKey:</option>

	</optgroup>

	<optgroup label="Instance Methods">

		<option value="//api/name/initWithPublishKey:subscribeKey:">- initWithPublishKey:subscribeKey:</option>

	</optgroup>

</select>

PNConfiguration Class Reference

	Inherits from
	NSObject

	Declared in
	PNConfiguration.h

Overview

Uset this instance to provide values which should be by client to communicate with
             \b PubNub netwrok.

@author Sergey Mamontov

Initialization and Configuration

  origin

Reference on host name or IP address which should be used by client to get access to
          \b PubNub services.

@default Client will use it’s own constant (\b pubsub.pubnub.com) value if origin not
          specified.

@property (nonatomic, copy) NSString *origin

Availability

4.0

Declared In

PNConfiguration.h

  publishKey

Reference on key which is used to push data/state to \b PubNub service.

@property (nonatomic, copy) NSString *publishKey

Availability

4.0

Discussion

Note: This key can be obtained on PubNub’s administration portal after free registration
          https://admin.pubnub.com

Warning: Can’t be \c nil and in attempt to set \c nil will throw \b UnacceptableValue exception.

Declared In

PNConfiguration.h

  subscribeKey

Reference on key which is used to fetch data/state from \b PubNub service.

@property (nonatomic, copy) NSString *subscribeKey

Availability

4.0

Discussion

Note: This key can be obtained on PubNub’s administration portal after free registration
          https://admin.pubnub.com

Warning: Can’t be \c nil and in attempt to set \c nil will throw \b UnacceptableValue exception.

@default Client will use it’s own constant (\b demo) value if origin not specified.

Declared In

PNConfiguration.h

  authKey

Reference on key which is used along with every request to \b PubNub service to
             identify client user.

@property (nonatomic, copy) NSString *authKey

Availability

4.0

Discussion

\b PubNub service provide \b PAM (PubNub Access Manager) functionality which allow
             to specify access rights to access \b PubNub services with provided \c publishKey
             and \c subscribeKey keys. Access can be limited to concrete users. \b PAM system
             use this key to check whether client user has rights to access to required service
             or not.

@default    By default this value set to \b nil.

Declared In

PNConfiguration.h

  uuid

Reference on unique client identifier used to identify concrete client user from
             another which currently use \b PubNub services.

@property (nonatomic, copy, setter=setUUID:) NSString *uuid

Availability

4.0

Discussion

This value is different from \c authKey (which is used only by \b PAM) and
             represent concrete client across server. This identifier is used for presence events
             to tell what some client joined or leaved live feed.

Warning: There can’t be two same client identifiers online at the same time.

@default    Client will use it’s own-generated value if won’t be specified by user.

Declared In

PNConfiguration.h

  cipherKey

Reference on encryption key.

@property (nonatomic, copy) NSString *cipherKey

Availability

4.0

Discussion

Key which is used to encrypt messages pushed to \b PubNub service and decrypt messages
              received from live feeds on which client subscribed at this moment.

Declared In

PNConfiguration.h

  subscribeMaximumIdleTime

Stores reference on maximum number of seconds which client should wait for events from
             live feed.

@property (nonatomic, assign) NSTimeInterval subscribeMaximumIdleTime

Availability

4.0

Discussion

By default value is set to \b 310 seconds. If in specified time frame \b PubNub service
             won’t push any events into live feed client will re-subscribe on remote data objects
             with same time token (if configured).

Declared In

PNConfiguration.h

  nonSubscribeRequestTimeout

Reference on number of seconds which is used by client during non-subscription
             operations to check whether response potentially failed with ‘timeout’ or not.

@property (nonatomic, assign) NSTimeInterval nonSubscribeRequestTimeout

Availability

4.0

Discussion

This is maximum time which client should wait fore response from \b PubNub service
             before reporting reuest error.

@default    Client will use it’s own constant (\b 10 seconds) value if origin not specified.

Declared In

PNConfiguration.h

  presenceHeartbeatValue

Reference on number of seconds which is used by server to track whether client still
             subscribed on remote data objects live feed or not.

@property (nonatomic, assign) NSInteger presenceHeartbeatValue

Availability

4.0

Discussion

This is time within which \b PubNub service expect to receive heartbeat request from
             this client. If heartbeat request won’t be called in time \b PubNub service will
             send to other subscribers \c ‘timeout’ presence event for this client.

Note: This value can’t be smaller then \b 5 seconds and larget then \b 300 seconds and
             will be reset to it automatically.

@default    By default heartbeat functionality disabled.

Declared In

PNConfiguration.h

  presenceHeartbeatInterval

Reference on number of seconds which is used by client to issue heartbeat requests to
          \b PubNub service.

@property (nonatomic, assign) NSInteger presenceHeartbeatInterval

Availability

4.0

Discussion

Note: This vlaue should be smaller then \c presenceHeartbeatTimeout for better presence
          control.

@default By default heartbeat functionality disabled.

Declared In

PNConfiguration.h

  TLSEnabled

Stores whether client should communicate with \b PubNub services using secured
          connection or not.

@default By default client use \b YES to secure communication with \b PubNub services.

@property (nonatomic, assign, getter=isTLSEnabled) BOOL TLSEnabled

Availability

4.0

Declared In

PNConfiguration.h

  keepTimeTokenOnListChange

Stores whether client should keep previous time token when subscribe on new set of remote
         data objects live feeds.

@default By default client use \b YES to and previous time token will be used during subscription
          on new data objects.

@property (nonatomic, assign, getter=shouldKeepTimeTokenOnListChange) BOOL keepTimeTokenOnListChange

Availability

4.0

Declared In

PNConfiguration.h

  restoreSubscription

Stores whether client should restore subscription on remote data objects live feed
             after network connection restoring or not.

@property (nonatomic, assign, getter=shouldRestoreSubscription) BOOL restoreSubscription

Availability

4.0

Discussion

If set to \c YES as soon as network connection will be restored client will restore
             subscription to previously subscribed remote data objects live feeds.

@default    By default client use \b YES to restore subscription on remote data objects live
             feeds.

Declared In

PNConfiguration.h

  catchUpOnSubscriptionRestore

Stores whether client should try to catch up for events which occurred on previously
             subscribed remote data objects feed while client was off-line.

@property (nonatomic, assign, getter=shouldTryCatchUpOnSubscriptionRestore) BOOL catchUpOnSubscriptionRestore

Availability

4.0

Discussion

Live feeds return in response with events so called ‘time token’ which allow client
             to specify target time from which it should expect new events. If property is set to
             \c YES then client will re-use previously received ‘time token’ and try to receive
             messages from the past.

Warning: If there history/storage feature has been activated for \b PubNub account, some
             messages can be pushed to it after some period of time and catch up won’t be able to
             receive them.

Declared In

PNConfiguration.h

+ configurationWithPublishKey:subscribeKey:

Construct configuration instance using minimal required data.

+ (instancetype)configurationWithPublishKey:(NSString *)publishKey subscribeKey:(NSString *)subscribeKey

Parameters

						publishKey

Key which allow client to use data push API.

						subscribeKey

Key which allow client to subscribe on live feeds pushed from \b PubNub
                     service.

Return Value

Configured and ready to se configuration instance.

Availability

4.0

Declared In

PNConfiguration.h

Extension Methods

  deviceID

Stores reference on unique device identifier based on bundle identifier used by software
        vendor.

@property (nonatomic, copy) NSString *deviceID

Availability

4.0

Declared In

PNConfiguration+Private.h

– initWithPublishKey:subscribeKey:

Initialize configuration instance using minimal required data.

- (instancetype)initWithPublishKey:(NSString *)publishKey subscribeKey:(NSString *)subscribeKey

Parameters

						publishKey

Key which allow client to use data push API.

						subscribeKey

Key which allow client to subscribe on live feeds pushed from \b PubNub
                     service.

Return Value

Configured and ready to se configuration instance.

Availability

4.0

Declared In

PNConfiguration.m

Copyright © 2015 PubNub. All rights reserved. Updated: 2015-06-24

Generated by appledoc 2.2.1 (build 1333).


text:
package com.jetbrains.ther.psi.api;

import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.psi.PsiElement;

public interface TheRUnaryTildeExpression extends TheRExpression {

  @Nullable
  TheRExpression getExpression();

  @Nullable
  TheROperator getOperator();

}


text:
@interface objclibtest : XCTestCase

@end

@implementation objclibtest

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

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

- (void)testExample {
    StopWatch* sw = [StopWatch new];
    sleep(1);
    [sw stop];

    NSLog(@"%ld", sw.microseconds );
    NSLog(@"%@", sw.description);
}

@end


text:
// Copyright 2017 The Kubernetes Authors.
//
// 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.

/**
 * @type {!angular.Component}
 */
export const settingsEntryComponent = {
  bindings: {
    'key': '@',
    'desc': '@',
  },
  templateUrl: 'settings/settingsentry/settingsentry.html',
  transclude: true,
};


text:
[assembly: global::Android.Runtime.ResourceDesignerAttribute("LauncherAndroid.Resource", IsApplication=true)]

namespace LauncherAndroid
{

	[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
	public partial class Resource
	{

		static Resource()
		{
			global::Android.Runtime.ResourceIdManager.UpdateIdValues();
		}

		public static void UpdateIdValues()
		{
		}

		public partial class Attribute
		{

			static Attribute()
			{
				global::Android.Runtime.ResourceIdManager.UpdateIdValues();
			}

			private Attribute()
			{
			}
		}

		public partial class Color
		{

			// aapt resource value: 0x7f040000
			public const int custom_theme_color = 2130968576;

			static Color()
			{
				global::Android.Runtime.ResourceIdManager.UpdateIdValues();
			}

			private Color()
			{
			}
		}

		public partial class Drawable
		{

			// aapt resource value: 0x7f020000
			public const int Icon = 2130837504;

			// aapt resource value: 0x7f020001
			public const int logo = 2130837505;

			static Drawable()
			{
				global::Android.Runtime.ResourceIdManager.UpdateIdValues();
			}

			private Drawable()
			{
			}
		}

		public partial class Id
		{

			// aapt resource value: 0x7f060000
			public const int glview = 2131099648;

			// aapt resource value: 0x7f060002
			public const int imgMain = 2131099650;

			// aapt resource value: 0x7f060001
			public const int lnMain = 2131099649;

			static Id()
			{
				global::Android.Runtime.ResourceIdManager.UpdateIdValues();
			}

			private Id()
			{
			}
		}

		public partial class Layout
		{

			// aapt resource value: 0x7f030000
			public const int Main = 2130903040;

			// aapt resource value: 0x7f030001
			public const int Splash = 2130903041;

			static Layout()
			{
				global::Android.Runtime.ResourceIdManager.UpdateIdValues();
			}

			private Layout()
			{
			}
		}

		public partial class Style
		{

			// aapt resource value: 0x7f050000
			public const int Theme_Splash = 2131034112;

			static Style()
			{
				global::Android.Runtime.ResourceIdManager.UpdateIdValues();
			}

			private Style()
			{
			}
		}
	}
}
#pragma warning restore 1591


text:
module Pah
  module Templates
    class Gem < Pah::Template
      def call
        copy_static_file 'Gemfile'

        gsub_file 'Gemfile', /RUBY_VERSION/, ::Pah::RUBY_VERSION
        gsub_file 'Gemfile', /RAILS_VERSION/, ::Pah::RAILS_VERSION

        begin
          require 'bundler'
        rescue LoadError
          # Install bundler if needed
          unless run 'gem install bundler --no-ri --no-rdoc'
            puts 'Error installing bundler, will attempt to continue'.red
          end
          require 'bundler'
        end

        # Install all other gems needed from Gemfile
        status, output = bundle_install_with_progress
        if status != 0
          puts output
          puts 'Error installing gems, aborting'.red
          exit 1
        end

        git add: 'Gemfile*'
        git_commit 'Add Gemfile and Gemfile.lock.'
      end

      def bundle_install_with_progress
        require 'open3'
        output = ""
        status = 0
        Open3.popen3(ENV, "bundle install --jobs=4") do |stdin, stdout, stderr, wait_thr|
          while line = stdout.gets
            output += line
            print ".".green
          end
          status = wait_thr.value.to_i
        end
        puts ""
        [status, output]
      end

    end
  end
end


text:
<?php

// url format. http://host/css.php?f=css/a.css,themes/default/css/b.css&min=1
// e.g. http://host/css.php?f=themes/default/css/system_backend.css
//
// include app.inc
//include_once "bin/app_init.php";
define('OPENBIZ_APP_PATH',dirname(__FILE__));
define('OPENBIZ_RESOURCE_PATH', OPENBIZ_APP_PATH.DIRECTORY_SEPARATOR."resources");
define('CUBI_CACHE_DATA_PATH', OPENBIZ_APP_PATH.DIRECTORY_SEPARATOR."files".DIRECTORY_SEPARATOR."cache".DIRECTORY_SEPARATOR."data");

$file = $_GET['f'];
// get extention of given file
$list = explode('.',$file);
$ext = $list[count($list)-1];
if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png' || $ext == 'swf') {
	$_GET['img'] = $file;
    include "bin/img.php";
}
/*else {
    // include minify index
    include "bin/min/index.php";
}
*/
?>