text:
#include <memory>
#include <array>
#include <iostream>

#include "tcp.hpp"
#include "http_server.hpp"
#include "http_v2_connection.hpp"
#include "http_v1_connection.hpp"

namespace manifold
{
  namespace http
  {
    int alpn_select_proto_cb(SSL *ssl, const unsigned char **out,
      unsigned char *out_len, const unsigned char *in,
      unsigned int in_len, void *arg)
    {
      //static const char*const h2_proto_string = "\x02h2\x08http/1.1";
      std::size_t h2_proto_string_len = ::strlen(MANIFOLD_HTTP_ALPN_SUPPORTED_PROTOCOLS);

      int ret = SSL_select_next_proto((unsigned char **)out, out_len, (unsigned char*)MANIFOLD_HTTP_ALPN_SUPPORTED_PROTOCOLS, h2_proto_string_len, in, in_len) == OPENSSL_NPN_NEGOTIATED ? SSL_TLSEXT_ERR_OK : SSL_TLSEXT_ERR_ALERT_FATAL;
      auto select_proto = *out;
      int e = SSL_get_error(ssl, ret);
      return  ret;
//      const unsigned char* client_proto = in;
//      const unsigned char* client_proto_end = in + in_len;
//      for ( ; client_proto + h2_proto_string_len <= client_proto_end; client_proto += *client_proto + 1)
//      {
//        std::size_t client_proto_len = (*client_proto + 1);
//        if (::memcmp(h2_proto_string, client_proto, h2_proto_string_len <  client_proto_len ? h2_proto_string_len : client_proto_len) == 0)
//        {
//          *out = client_proto + 1;
//          *out_len = (unsigned char)(client_proto_len - 1);
//          return SSL_TLSEXT_ERR_OK;
//        }
//      }
      return SSL_TLSEXT_ERR_NOACK;
    }

    //================================================================//
    class server_impl : public std::enable_shared_from_this<server_impl>
    {
    public:
      //----------------------------------------------------------------//
      server_impl(asio::io_service& ioService, unsigned short port = 80, const std::string& host = "0.0.0.0");
      server_impl(asio::io_service& ioService, asio::ssl::context& ctx, unsigned short port = 443, const std::string& host = "0.0.0.0");
      ~server_impl();
      //----------------------------------------------------------------//

      //----------------------------------------------------------------//
      void timeout(std::chrono::system_clock::duration value);
      void listen(const std::function<void(server::request&& req, server::response&& res)>& handler, std::error_code& ec);
      void close();
      //void register_handler(const std::regex& expression, const std::function<void(server::request&& req, server::response&& res)>& handler);
      void set_default_server_header(const std::string& value);
      //----------------------------------------------------------------//
    private:
      //----------------------------------------------------------------//
      asio::io_service& io_service_;
      asio::ip::tcp::acceptor acceptor_;
      asio::ssl::context* ssl_context_;
      unsigned short port_;
      std::string host_;
      bool closed_ = false;
      std::set<std::shared_ptr<http::connection<response_head, request_head>>> connections_;
      std::function<void(server::request&& req, server::response&& res)> request_handler_;
      std::string default_server_header_ = "Manifold";
      std::chrono::system_clock::duration timeout_;
      //std::list<std::pair<std::regex,std::function<void(server::request&& req, server::response&& res)>>> stream_handlers_;
      //----------------------------------------------------------------//

      //----------------------------------------------------------------//
      void accept();
      void accept(asio::ssl::context& ctx);
      void manage_connection(const std::shared_ptr<http::connection<response_head, request_head>>& conn);
      //----------------------------------------------------------------//

      // TODO: Set enable_push in v2_connection
//#ifndef MANIFOLD_DISABLE_HTTP2
//      //================================================================//
//      class v2_connection : public http::v2_connection<response_head, request_head>
//      {
//      public:
//        v2_connection(non_tls_socket&& sock)
//          : http::v2_connection<response_head, request_head>(std::move(sock))
//        {
//          this->local_settings_[setting_code::enable_push] = 0;
//        }
//        v2_connection(tls_socket&& sock)
//          : http::v2_connection<response_head, request_head>(std::move(sock))
//        {
//          this->local_settings_[setting_code::enable_push] = 0;
//        }
//      };
//      //================================================================//
//#endif //MANIFOLD_DISABLE_HTTP2
    };
    //================================================================//

    //----------------------------------------------------------------//
    server::request::request(request_head&& head, const std::shared_ptr<http::connection<response_head, request_head>>& conn, std::int32_t stream_id)
      : incoming_message<response_head, request_head>(conn, stream_id)
    {
      this->head_ = std::move(head);
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    server::request::request(server::request&& source)
      : incoming_message(std::move(source)), head_(std::move(source.head_))
    {
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    server::request::~request()
    {
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    const request_head& server::request::head() const
    {
      return this->head_;
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    server::response::response(response_head&& head, const std::shared_ptr<http::connection<response_head, request_head>>& conn, std::int32_t stream_id, const std::string& request_method, const std::string& request_authority)
      : outgoing_message<response_head, request_head>(conn, stream_id), request_method_(request_method), request_authority_(request_authority)
    {
      this->head_ = std::move(head);
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    server::response::response(server::response&& source)
      : outgoing_message(std::move(source)), head_(std::move(source.head_)), request_method_(std::move(source.request_method_)), request_authority_(std::move(source.request_authority_))
    {
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    server::response::~response()
    {
      if (this->connection_)
        this->end();
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    response_head& server::response::head()
    {
      return this->head_;
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    bool server::response::send_headers(bool end_stream)
    {
      if (this->head().header("date").empty())
        this->head().header("date", server::date_string());
      if (this->request_method_ == "HEAD")
        end_stream = true;
      return outgoing_message::send_headers(end_stream);
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    server::push_promise server::response::send_push_promise(request_head&& push_promise_headers)
    {
      push_promise ret;

      if (this->connection_)
      {
        std::string method = push_promise_headers.method();
        std::uint32_t promised_stream_id = this->connection_->send_push_promise(this->stream_id_, push_promise_headers);
        if (promised_stream_id)
        {
          if (push_promise_headers.authority().empty())
            push_promise_headers.authority(this->request_authority_);
          ret = push_promise(server::request(std::move(push_promise_headers), this->connection_, promised_stream_id), server::response(response_head(200, {{"server", this->head().header("server")}}), this->connection_, promised_stream_id, method, this->request_authority_));
        }
      }

      return ret;
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    server::push_promise server::response::send_push_promise(const request_head& push_promise_headers)
    {
      return this->send_push_promise(request_head(push_promise_headers));
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    server::push_promise::push_promise()
      : fulfilled_(false)
    {
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    server::push_promise::push_promise(request&& req, response&& res)
      : req_(new request(std::move(req))), res_(new response(std::move(res))), fulfilled_(false)
    {

    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    void server::push_promise::fulfill(const std::function<void(server::request&& req, server::response&& res)>& handler)
    {
      if (!this->fulfilled_ && this->req_ && this->res_)
      {
        this->fulfilled_ = true;
        handler(std::move(*req_), std::move(*res_));
      }
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    server_impl::server_impl(asio::io_service& ioservice, unsigned short port, const std::string& host)
      : io_service_(ioservice),
        acceptor_(io_service_),
        ssl_context_(nullptr)
    {
      this->port_ = port;
      this->host_ = host;
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    server_impl::server_impl(asio::io_service& ioservice, asio::ssl::context& ctx, unsigned short port, const std::string& host)
      : io_service_(ioservice),
      acceptor_(io_service_),
      ssl_context_(&ctx)
    {
//      this->ssl_context_->set_options(
//        asio::ssl::context::default_workarounds
//          | asio::ssl::context::no_sslv2
//          | asio::ssl::context::single_dh_use);

//      if (true) //options.pfx.size())
//      {
//        //this->ssl_context_->use_certificate_chain_file("/Users/jonathonl/Developer/certs2/server-cert.pem");
//        //this->ssl_context_->use_private_key_file("/Users/jonathonl/Developer/certs2/server-key.pem", asio::ssl::context::pem);
//        //this->ssl_context_->use_tmp_dh_file("/Users/jonathonl/Developer/certs/dh512.pem");
//
//        char cwd[FILENAME_MAX];
//        getcwd(cwd, FILENAME_MAX);
//
//        //this->ssl_context_->use_certificate_chain_file("tests/certs/server.crt");
//        //this->ssl_context_->use_private_key_file("tests/certs/server.key", asio::ssl::context::pem);
//        //this->ssl_context_->use_tmp_dh_file("tests/certs/dh2048.pem");
//
//        this->ssl_context_->use_certificate_chain(asio::buffer(options.chain.data(), options.chain.size()));
//        this->ssl_context_->use_private_key(asio::buffer(options.key.data(), options.key.size()), asio::ssl::context::pem);
//        this->ssl_context_->use_tmp_dh(asio::buffer(options.dhparam.data(), options.dhparam.size()));
//      }
//      else
//      {
//        std::error_code ec;
//        if (options.cert.size())
//          this->ssl_context_->use_certificate_chain(asio::const_buffer(options.cert.data(), options.cert.size()));
//        if (options.key.size())
//          this->ssl_context_->use_private_key(asio::const_buffer(options.key.data(), options.key.size()), asio::ssl::context::file_format::pem);
//        if (options.ca.size())
//          this->ssl_context_->use_tmp_dh_file("/Users/jonathonl/Developer/certs/dh512.pem");
//      }

      auto ssl_opts = (SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS) |
        SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_COMPRESSION |
        SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION |
        SSL_OP_SINGLE_ECDH_USE | SSL_OP_NO_TICKET |
        SSL_OP_CIPHER_SERVER_PREFERENCE;

      SSL_CTX_set_options(ssl_context_->native_handle(), SSL_CTX_get_options(ssl_context_->native_handle()) | SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
      //SSL_CTX_set_options(ssl_context_->impl(), ssl_opts);
      //SSL_CTX_set_mode(ssl_context_->impl(), SSL_MODE_AUTO_RETRY);
      //SSL_CTX_set_mode(ssl_context_->impl(), SSL_MODE_RELEASE_BUFFERS);

      static const char *const DEFAULT_CIPHER_LIST =
        //"HIGH:!AES256-SHA:!AES128-GCM-SHA256:!AES128-SHA:!DES-CBC3-SHA";
        //"DHE:EDH:kDHE:kEDH:DH:kEECDH:kECDHE:ECDHE:EECDH:ECDH";
        "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-"
        "AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:"
        "DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-"
        "AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-"
        "AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-"
        "AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:"
        "DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:"
        "!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK";

      //SSL_CTX_set_cipher_list(ssl_context_->impl(), DEFAULT_CIPHER_LIST);

      ::SSL_CTX_set_alpn_select_cb(this->ssl_context_->impl(), alpn_select_proto_cb, nullptr);
      this->port_ = port;
      this->host_ = host;
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    server_impl::~server_impl()
    {
      this->close();
    }
    //----------------------------------------------------------------//

    void server_impl::timeout(std::chrono::system_clock::duration value)
    {
      this->timeout_ = value;
    }

    //----------------------------------------------------------------//
    void server_impl::listen(const std::function<void(server::request&& req, server::response&& res)>& handler, std::error_code& ec)
    {
      this->request_handler_ = handler;
      // Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR).
      //asio::ip::tcp::resolver resolver(io_service_);
      //asio::ip::tcp::endpoint endpoint = *(resolver.resolve({host, std::to_string(port)}));
      auto ep = asio::ip::tcp::endpoint(asio::ip::address::from_string(this->host_), this->port_);

      acceptor_.open(ep.protocol(), ec);
      if (!ec) acceptor_.set_option(asio::ip::tcp::acceptor::reuse_address(true), ec);
      if (!ec) acceptor_.bind(ep, ec);
      if (!ec) acceptor_.listen(asio::socket_base::max_connections, ec);

      if (!ec)
      {
        if (this->ssl_context_)
          this->accept(*this->ssl_context_);
        else
          this->accept();
      }
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    void server_impl::close()
    {
      if (!this->closed_)
      {
        this->closed_ = true;

        this->acceptor_.close();
        std::set<std::shared_ptr<http::connection<response_head, request_head>>> tmp;
        tmp.swap(this->connections_);
        for (auto it = tmp.begin(); it != tmp.end(); ++it)
          (*it)->close(v2_errc::cancel);
        tmp.clear();
      }
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    void server_impl::accept()
    {
      if (acceptor_.is_open() && !this->closed_)
      {
        auto sock = std::make_shared<non_tls_socket>(this->io_service_);
        auto self = shared_from_this();
        acceptor_.async_accept((asio::ip::tcp::socket&)*sock, [self, sock](std::error_code ec)
        {
          if (ec)
          {
            std::cout << "accept error: " << ec.message() << std::endl;
          }
          else
          {
            auto c = std::make_shared<v1_connection<response_head, request_head>>(std::move(*sock));
            auto res = self->connections_.emplace(c);
            if (res.second)
            {
              self->manage_connection(c);
              c->run(self->timeout_); //TODO: allow to configure.
            }
          }

          self->accept();
        });
      }
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    void server_impl::accept(asio::ssl::context& ctx)
    {
      if (acceptor_.is_open())
      {
        auto sock = std::make_shared<tls_socket>(this->io_service_, ctx);
        auto self = shared_from_this();
        acceptor_.async_accept(((asio::ssl::stream<asio::ip::tcp::socket>&)*sock).lowest_layer(), [self, sock, &ctx](std::error_code ec)
        {
          if (ec)
          {
            std::cout << "accept error: " << ec.message() << std::endl;
          }
          else
          {
            ((asio::ssl::stream<asio::ip::tcp::socket>&)*sock).async_handshake(asio::ssl::stream_base::server, [self, sock] (const std::error_code& ec)
            {
              std::cout << "Cipher: " << SSL_CIPHER_get_name(SSL_get_current_cipher(((asio::ssl::stream<asio::ip::tcp::socket>&)*sock).native_handle())) << std::endl;
              const unsigned char* selected_alpn = nullptr;
              unsigned int selected_alpn_sz = 0;
              SSL_get0_alpn_selected(((asio::ssl::stream<asio::ip::tcp::socket>&)*sock).native_handle(), &selected_alpn, &selected_alpn_sz);
              std::cout << "Server ALPN: " << std::string((char*)selected_alpn, selected_alpn_sz) << std::endl;
              if (ec)
              {
                std::cout << ec.message() << ":" __FILE__ << "/" << __LINE__ << std::endl;
              }
  #ifndef MANIFOLD_DISABLE_HTTP2
              else if (std::string((char*)selected_alpn, selected_alpn_sz) == "h2")
              {
                auto* preface_buf = new std::array<char,v2_connection<response_head, request_head>::preface.size()>();
                sock->recv(preface_buf->data(), preface_buf->size(), [self, sock, preface_buf](const std::error_code& ec, std::size_t bytes_read)
                {
                  if (ec)
                  {
                    std::cout << ec.message() << ":" __FILE__ << "/" << __LINE__ << std::endl;
                    std::string err = ec.message();
                    if (ec.category() == asio::error::get_ssl_category())
                    {
                      err = std::string(" (");
                      //ERR_PACK /* crypto/err/err.h */
                      char buf[128];
                      ::ERR_error_string_n(ec.value(), buf, sizeof(buf));
                      err += buf;
                    }
                  }
                  else
                  {
                    const char* t = preface_buf->data();
                    if (*preface_buf != v2_connection<response_head, request_head>::preface)
                    {
                      std::cout << "Invalid Connection Preface" << ":" __FILE__ << "/" << __LINE__ << std::endl;
                    }
                    else
                    {
                      auto c = std::make_shared<v2_connection<response_head, request_head>>(std::move(*sock));
                      auto res = self->connections_.emplace(c);
                      if (res.second)
                      {
                        self->manage_connection(c);
                        c->run(self->timeout_, {});
                      }
                    }
                  }
                  delete preface_buf;
                });
              }
  #endif //MANIFOLD_DISABLE_HTTP2
              else
              {
                auto c = std::make_shared<v1_connection<response_head, request_head>>(std::move(*sock));
                auto res = self->connections_.emplace(c);
                if (res.second)
                {
                  self->manage_connection(c);
                  c->run(self->timeout_); // TODO: Allow to configure
                }
              }
            });
          }

          self->accept(ctx);
        });
      }
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    void server_impl::manage_connection(const std::shared_ptr<http::connection<response_head, request_head>>& conn)
    {
      conn->on_new_stream([this, conn](std::int32_t stream_id)
      {
        conn->on_headers(stream_id, [conn, stream_id, this](request_head&& headers)
        {
          std::string method = headers.method();
          std::string authority = headers.authority();
          this->request_handler_ ? this->request_handler_(server::request(std::move(headers), conn, stream_id), server::response(response_head(), conn, stream_id, method, authority)) : void();
        });

        conn->on_push_promise(stream_id, [stream_id, conn](response_head&& head, std::uint32_t promised_stream_id)
        {
          conn->send_goaway(v2_errc::protocol_error, "Clients Cannot Push!");
        });
      });

      conn->on_close([conn, this](const std::error_code& ec)
      {
        this->connections_.erase(conn);
      });
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    void server_impl::set_default_server_header(const std::string& value)
    {
      this->default_server_header_ = value;
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    server::server(asio::io_service& ioservice, unsigned short port, const std::string& host)
      : impl_(std::make_shared<server_impl>(ioservice, port, host))
    {
      this->reset_timeout();
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    server::server(asio::io_service& ioservice, asio::ssl::context& ctx, unsigned short port, const std::string& host)
      : impl_(std::make_shared<server_impl>(ioservice, ctx, port, host))
    {
      this->reset_timeout();
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    server::~server()
    {
      this->impl_->close();
    }
    //----------------------------------------------------------------//

    void server::reset_timeout(std::chrono::system_clock::duration value)
    {
      this->impl_->timeout(value);
    }

    //----------------------------------------------------------------//
    void server::listen(const std::function<void(server::request&& req, server::response&& res)>& handler)
    {
      std::error_code ec;
      this->impl_->listen(handler, ec);
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    void server::listen(const std::function<void(server::request&& req, server::response&& res)>& handler, std::error_code& ec)
    {
      this->impl_->listen(handler, ec);
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    void server::close()
    {
      this->impl_->close();
    }
    //----------------------------------------------------------------//

    //----------------------------------------------------------------//
    void server::set_default_server_header(const std::string& value)
    {
      this->impl_->set_default_server_header(value);
    }
    //----------------------------------------------------------------//
  }
}


text:
using PCBWayApi.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace PCBWayApi.BLL.Tests
{
    public class RevisionBizTest : IDisposable
    {
        public RevisionBizTest()
        {
            //在这里可以做测试开始前的初始化工作
            System.Console.WriteLine("Init");
        }
        [Fact]
        public void Find()
        {
            Revision result;
            using (var biz = new RevisionBiz())
            {
                result = biz.Find(1);
            }
            Assert.NotNull(result);
            Assert.Equal<int>(1, result.Id);
        }
        [Fact]
        public void Insert()
        {
            Revision result;
            Revision revision = new Revision
            {
                RevisionId = "eac123nsdsj212bsdsjsd232kllo2",
                FetchRevisionUrl = "http://www.baidu.com/asddd.?asd=1",
                AuthorEmail = "juhntao@live.com",
                Layers = "2",
                Thickness = "1.2",
                Width = "100",
                Length = "100",
                Soldermask = "Red",
                Silkscreen = "White",
                CopperThickness = "1",
                SurfaceFinish = "HASL with lead"
            };
            using (var biz = new RevisionBiz())
            {
                result = biz.Insert(revision);
            }
            Assert.NotNull(result);
            Assert.NotEqual<int>(0, result.Id);
        }
        public void Dispose()
        {

        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
describe('Client Integration', function () {
  it('should work', function () {
    expect(true).toBe(true)
  });

  it('Foo should exist', function () {
    expect(Foo).toBeDefined();
  })
});


text:
var test = require("tape"),
    isString = require("../src/index");

test("isObjectLike", function(t) {

    t.equal(isString("string"), true, "strings return true");

    t.equal(isString(null), false, "null returns false");
    t.equal(isString(undefined), false, "undefined returns false");
    t.equal(isString(NaN), false, "NaN returns false");
    t.equal(isString(true), false, "booleans returns false");
    t.equal(isString(45), false, "numbers returns false");
    t.equal(isString({}), false, "objects return false");
    t.equal(isString([]), false, "arrays return false");
    t.equal(isString(/regexp/), false, "regexps return false");
    t.equal(isString(function() {}), false, "functions return false");

    t.end();
});


text:
import sys, os, traceback, types, pywin32_system32

def isUserAdmin():

    if os.name == 'nt':
        import ctypes
        # WARNING: requires Windows XP SP2 or higher!
        try:
            return ctypes.windll.shell32.IsUserAnAdmin()
        except:
            traceback.print_exc()
            print("Admin check failed, assuming not an admin.")
            return False
    elif os.name == 'posix':
        # Check for root on Posix
        return os.getuid() == 0
    else:
        raise(RuntimeError, "Unsupported operating system for this module: %s" % (os.name,))

def runAsAdmin(cmdLine=None, wait=True):

    if os.name != 'nt':
        raise(RuntimeError, "This function is only implemented on Windows.")

    import win32.win32api, win32.win32console, win32.win32event, win32.win32process
    import win32comext.shell.shell as shell
    from win32comext.shell import shellcon

    python_exe = sys.executable

    if cmdLine is None:
        cmdLine = [python_exe] + sys.argv
    elif type(cmdLine) not in (types.TupleType,types.ListType):
        raise(ValueError, "cmdLine is not a sequence.")
    cmd = '"%s"' % (cmdLine[0],)
    # XXX TODO: isn't there a function or something we can call to massage command line params?
    params = " ".join(['"%s"' % (x,) for x in cmdLine[1:]])
    cmdDir = ''
    showCmd = win32.win32console.SW_SHOWNORMAL
    #showCmd = win32con.SW_HIDE
    lpVerb = 'runas'  # causes UAC elevation prompt.

    # print "Running", cmd, params

    # ShellExecute() doesn't seem to allow us to fetch the PID or handle
    # of the process, so we can't get anything useful from it. Therefore
    # the more complex ShellExecuteEx() must be used.

    # procHandle = win32api.ShellExecute(0, lpVerb, cmd, params, cmdDir, showCmd)

    procInfo = shell.ShellExecuteEx(nShow=showCmd,
                              fMask=shellcon.SEE_MASK_NOCLOSEPROCESS,
                              lpVerb=lpVerb,
                              lpFile=cmd,
                              lpParameters=params)

    if wait:
        procHandle = procInfo['hProcess']
        obj = win32.win32event.WaitForSingleObject(procHandle, win32.win32event.INFINITE)
        rc = win32.win32process.GetExitCodeProcess(procHandle)
        #print "Process handle %s returned code %s" % (procHandle, rc)
    else:
        rc = None

    return rc


text:
require 'active_support/core_ext/array/wrap'
require 'muster/strategies/hash'

module Muster
  module Strategies
    # Query string parsing strategy with additional value handling for sort orders
    #
    # @example
    #
    #   strategy = Muster::Strategies::SortExpression.new
    #   results  = strategy.parse('sort=name:desc')  #=>  { 'sort' => 'name desc' }
    class SortExpression < Muster::Strategies::Hash
      # Processes a query string and returns a hash of its fields/values
      #
      # @param query_string [String] the query string to parse
      #
      # @return [Hash]
      #
      # @example
      #
      #   results = strategy.parse('order=name')            #=>  { 'order' => 'name asc' }
      #   results = strategy.parse('order=name:desc')       #=>  { 'order' => 'name desc' }
      #   results = strategy.parse('order=name,date:desc')  #=>  { 'order' => ['name asc', 'date desc'] }
      def parse(query_string)
        parameters = super

        parameters.each do |key, value|
          parameters[key] = parse_sort_expression(value)
        end
      end

      protected

      # Separates the values into their field and direction
      #
      # @param expression [String] the value being parsed
      #
      # @return [String,Arrary] String if a single value, Array otherwise
      #
      # @example
      #
      #    value = self.parse_sort_expression('name:asc')  #=>  'name asc'
      #    value = self.parse_sort_expression(['name:asc', 'date'])  #=>  ['name asc', 'date asc']
      def parse_sort_expression(expression)
        values = Array.wrap(expression)

        values = values.map do |value|
          name, direction = value.split(':', 2)
          direction = parse_direction(direction)

          "#{name} #{direction}"
        end.flatten

        (values.size > 1) ? values : values.first
      end

      # Parse and normalize the sot expression direction
      #
      # @param direction [String] the direction to normalize
      #
      # @return [String]
      #
      # @example
      #
      #   direction = self.parse_direction('ascending')   #=> 'asc'
      #   direction = self.parse_direction('descending')  #=> 'desc'
      def parse_direction(direction)
        direction.to_s.match(/^desc/i) ? 'desc' : 'asc'
      end
    end
  end
end


text:
package main

import (
	"fmt"
	"github.com/jinzhu/gorm"
	_ "github.com/mattn/go-sqlite3"
	"github.com/yuin/cidre"
	"html/template"
	"net/http"
	"path/filepath"
	"strings"
	"time"
)

type WikiConfig struct {
	SiteName        string
	SiteDescription string
	DataDirectory   string
}

var wikiConfig = &WikiConfig{
	SiteName:        "cidre Wiki",
	SiteDescription: "Simple wiki app written in cidre",
	DataDirectory:   "./data",
}

type View struct {
	Context *cidre.Context
	App     *cidre.App
	Config  *WikiConfig
	Title   string
	Data    interface{}
	Flashes map[string][]string
}

func NewView(w http.ResponseWriter, r *http.Request, title string, data interface{}) *View {
	ctx := cidre.RequestContext(r)
	self := &View{ctx, ctx.App, wikiConfig, title, data, ctx.Session.Flashes()}
	return self
}

type Article struct {
	Id        int
	Name      string
	Body      string
	UpdatedAt time.Time
	CreatedAt time.Time
}

// gorm.DB is thread safe
var DB gorm.DB

func InitDB(dataFilePath string) error {
	var err error
	DB, err = gorm.Open("sqlite3", dataFilePath)
	if err != nil {
		return err
	}
	if !DB.HasTable(Article{}) {
		DB.CreateTable(Article{})
		articleModel := DB.Model(Article{})
		articleModel.AddIndex("articles_name_idx", "name")
		articleModel.AddIndex("articles_updated_at_idx", "updated_at")
	}
	return nil
}

func FindArticle(db *gorm.DB, name string) (*Article, error) {
	var article Article
	err := db.Where("name = ?", name).First(&article).Error
	return &article, err
}

func FindArticles(db *gorm.DB) []Article {
	articles := make([]Article, 0, 10)
	db.Order("updated_at desc").Find(&articles)
	return articles
}

func DBTransactionMiddleware(w http.ResponseWriter, r *http.Request) {
	ctx := cidre.RequestContext(r)
	ctx.Set("db", DB.Begin())
	defer func() {
		status := w.(cidre.ResponseWriter).Status()
		if status >= 200 && status < 400 {
			ctx.Get("db").(*gorm.DB).Commit()
		} else {
			ctx.Get("db").(*gorm.DB).Rollback()
		}
	}()
	ctx.MiddlewareChain.DoNext(w, r)
}

func ctxdb(r *http.Request) (*cidre.Context, *gorm.DB) {
	ctx := cidre.RequestContext(r)
	db := ctx.Get("db").(*gorm.DB)
    return ctx, db
}

func main() {
	// Load configurations
	appConfig := cidre.DefaultAppConfig()
	sessionConfig := cidre.DefaultSessionConfig()
	_, err := cidre.ParseIniFile("app.ini",
		// cidre
		cidre.ConfigMapping{"cidre", appConfig},
		// session middleware
		cidre.ConfigMapping{"session.base", sessionConfig},
		// this app
		cidre.ConfigMapping{"wiki", wikiConfig},
	)
	if err != nil {
		panic(err)
	}
	app := cidre.NewApp(appConfig)
	// Set template function on setup
	app.Hooks.Add("setup", func(w http.ResponseWriter, r *http.Request, data interface{}) {
		config := app.Renderer.(*cidre.HtmlTemplateRenderer).Config
		config.FuncMap["nl2br"] = func(text string) template.HTML {
			return template.HTML(strings.Replace(text, "\n", "<br />", -1))
		}
	})

	// Auto transaction management
	app.Use(DBTransactionMiddleware)
	// Use the session middleware for flash messaging
	app.Use(cidre.NewSessionMiddleware(app, sessionConfig, nil))

	root := app.MountPoint("/")
	// serve static files
	root.Static("statics", "statics", "./statics")

	root.Get("show_pages", "", func(w http.ResponseWriter, r *http.Request) {
		_, db := ctxdb(r)
		app.Renderer.Html(w, "show_pages", NewView(w, r, "List pages", FindArticles(db)))
	})

	root.Get("show_page", "pages/(?P<name>[^/]+)", func(w http.ResponseWriter, r *http.Request) {
		ctx, db := ctxdb(r)
		name := ctx.PathParams.Get("name")
		article, err := FindArticle(db, name)
		if err != nil {
			switch err {
			case gorm.RecordNotFound:
				app.OnNotFound(w, r)
			default:
				app.OnPanic(w, r, err)
			}
			return
		}
		app.Renderer.Html(w, "show_page", NewView(w, r, "Page:"+name, article))
	})

	root.Get("edit_page", "pages/(?P<name>[^/]+)/edit", func(w http.ResponseWriter, r *http.Request) {
		ctx, db := ctxdb(r)
		name := ctx.PathParams.Get("name")
		article, _ := FindArticle(db, name)
		article.Name = name
		app.Renderer.Html(w, "edit_page", NewView(w, r, "EDIT: "+name, article))
	})

	root.Post("save_page", "pages/(?P<name>[^/]+)", func(w http.ResponseWriter, r *http.Request) {
		ctx, db := ctxdb(r)
		name := ctx.PathParams.Get("name")
		article, _ := FindArticle(db, name)
		article.Name = name
		article.Body = r.FormValue("body")
		if db.Save(article).Error != nil {
			ctx.Session.AddFlash("error", "Failed to save a page: "+err.Error())
			http.Redirect(w, r, app.BuildUrl("edit_page", name), http.StatusFound)
		} else {
			ctx.Session.AddFlash("info", "Page updated")
			http.Redirect(w, r, app.BuildUrl("show_page", name), http.StatusFound)
		}
	})

	root.Delete("delete_page", "pages/(?P<name>[^/]+)", func(w http.ResponseWriter, r *http.Request) {
		ctx, db := ctxdb(r)
		name := ctx.PathParams.Get("name")
		article, err := FindArticle(db, name)
		if err != nil && db.Delete(article).Error == nil {
			ctx.Session.AddFlash("info", "Page deleted")
			http.Redirect(w, r, app.BuildUrl("show_pages"), http.StatusFound)
		} else {
			ctx.Session.AddFlash("error", "Failed to delete a page: "+err.Error())
			http.Redirect(w, r, app.BuildUrl("edit_page", name), http.StatusFound)
		}
	})

	app.Hooks.Add("start_request", func(w http.ResponseWriter, r *http.Request, data interface{}) {
		w.Header().Add("X-Server", "Go")
	})
	app.OnNotFound = func(w http.ResponseWriter, r *http.Request) {
		w.WriteHeader(http.StatusNotFound)
		fmt.Fprintf(w, "Oops! Page not found.")
	}

	InitDB(filepath.Join(wikiConfig.DataDirectory, "wiki.bin"))
	app.Run()
}


text:
package controllers

import javax.inject.{Inject, Singleton}

import controllers.NeedLogin.Authenticated
import play.api.mvc.{AnyContent, MessagesAbstractController, MessagesControllerComponents}
import models.ShoppingCartItemRepo
import play.api.db.Database

@Singleton
class MyPage @Inject() (
  cc: MessagesControllerComponents,
  authenticated: Authenticated,
  implicit val shoppingCartItemRepo: ShoppingCartItemRepo,
  implicit val db: Database,
) extends MessagesAbstractController(cc) {
  def index() = authenticated { implicit request: AuthMessagesRequest[AnyContent] =>
    implicit val login = request.login
    if (login.isAnonymousBuyer)
      Redirect(routes.Application.index)
    else
      Ok(views.html.myPage())
  }
}


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>RE:Lucky</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link href='https://fonts.googleapis.com/css?family=Sniglet' rel='stylesheet' type='text/css'>

        <link rel="stylesheet" href="css/normalize.css">
        <link rel="stylesheet" href="css/main.css">

 Regresar

 Entrar

¿Quién eres?

Cliente

Talento

Competencia

No somos nosotros,

                            eres tú

Visto por última vez

Aquí está nuestra chamba

                            ¿Tienes ganas de volar?

Si

Doblada

Subtitulada

 Obtener código.

Alejandro Muñoz

Director

alex@luckyme.mx

(33) 31 65 14 77/80

Fray Francisco Frejes #175,

                            Col. Ladrón de Guevara,

                            Guadalajara, Jalisco,

                            C.P. 44650

Trae este código y caele a cotorrear un viernes.

(Nos reservamos el derecho de abrirte).

                                    #FuckThemICanFly

                                    Fray Francisco Frejes #175,

                                    Col. Ladrón de Guevara,

                                    Guadalajara, Jalisco.

 Volver al video


text:
package uk.ac.ed.ph.snuggletex.webapp;

import uk.ac.ed.ph.snuggletex.SnuggleConstants;
import uk.ac.ed.ph.snuggletex.SnuggleRuntimeException;
import uk.ac.ed.ph.snuggletex.definitions.W3CConstants;
import uk.ac.ed.ph.snuggletex.utilities.MathMLPostProcessor;
import uk.ac.ed.ph.snuggletex.utilities.MathMLUtilities;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

/**
 * Simple {@link MathMLPostProcessor} that replaces any MathML islands
 * with HTML links calling back on {@link MathInputToImageServlet} to
 * render them as images.
 *
 * TODO: This might be quite a useful utility so may want to
 * be generalised and moved out of the demo webapp.
 *
 * @author  David McKain
 * @version $Revision$
 */
public final class MathMLToImageLinkPostProcessor extends MathMLPostProcessor {

    private final String contextPath;

    public MathMLToImageLinkPostProcessor(final String contextPath) {
        this.contextPath = contextPath;
    }

    @Override
    protected void handleMathMLIsland(Element inputMathIsland, Document outputDocument,
            Node outputParentNode, int mathmlCounter) {
        /* Extract SnuggleTeX annotation */
        String snuggleInput = MathMLUtilities.extractAnnotationString(inputMathIsland, SnuggleConstants.SNUGGLETEX_MATHML_SOURCE_ANNOTATION_ENCODING);
        if (snuggleInput==null) {
            throw new SnuggleRuntimeException("Expected to find SnuggleTeX annotation inside MathML - fix this process!");
        }
        /* Replace with appropriate image servlet link */
        boolean isBlock = "block".equals(inputMathIsland.getAttribute("display"));
        Element replacement = outputDocument.createElementNS(W3CConstants.XHTML_NAMESPACE, isBlock ? "div" : "span");
        replacement.setAttribute("class", "mathml-math");

        Element image = outputDocument.createElementNS(W3CConstants.XHTML_NAMESPACE, "img");
        try {
            image.setAttribute("src", contextPath + "/MathInputToImage.png?input="
                    + URLEncoder.encode(snuggleInput, "UTF-8"));
        }
        catch (UnsupportedEncodingException e) {
            throw new SnuggleRuntimeException("Unexpected Exception", e);
        }
        replacement.appendChild(image);
        outputParentNode.appendChild(replacement);
    }

}


text:
from markbook.models import Note

def test_index(session):
    rv = session.get("/", follow_redirects=True)
    assert rv.status_code == 200
    assert "Notebook".encode("utf-8") in rv.data
    assert "close".encode("utf-8") in rv.data

def test_get_note(session, db):
    note = Note("TITLE", "TEXT")
    db.session.add(note)
    db.session.commit()
    rv = session.get("/notes/" + str(note.id), follow_redirects=True)
    assert rv.status_code == 200
    assert "
TEXT
".encode("utf-8") in rv.data


text:
from nova.api.validation import parameter_types

server_create = {
    'config_drive': parameter_types.boolean,
}


text:
$(function() {
  var arrowNav = $('.arrow_nav.top.right');
  var topOffset = arrowNav.offset().top;
  var rightOffset = ($(window).width() - (arrowNav.offset().left + arrowNav.outerWidth()));

  var nextArticles = $('.next-articles');
  nextArticles.css('top', (topOffset + arrowNav.outerHeight()) + 'px');
  nextArticles.css('right', rightOffset + 'px');

  var DEBUG = false;
  if(DEBUG) {
    nextArticles.show();
    return;
  }

  var naShowing = false;
  var naAbortHiding = false;
  var hoverIn = function() {
    naAbortHiding = true;
    if(naShowing) {
      return;
    }
    nextArticles.show(100);
    naShowing = true;
  };
  var hoverOut = function() {
    if(!naShowing) {
      return;
    }

    naAbortHiding = false;
    setInterval(function() {
      if(naAbortHiding) {
        return;
      }
      nextArticles.hide(100);
      naShowing = false;
    }, 750);
  };

  var nextButton = $('#next-button');
  nextButton.hover(hoverIn, hoverOut);
  nextArticles.hover(hoverIn, hoverOut);
});


text:
cpsdata
=======

Tool for Linking the Current Population Survey (CPS) into a Longitudinal Database


text:
"""GeoKey settings."""

from geokey.core.settings.dev import *

DEFAULT_FROM_EMAIL = 'no-reply@travis-ci.org'
ACCOUNT_EMAIL_VERIFICATION = 'optional'

SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxx'

DATABASES = {
    'default': {
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'NAME': 'geokey',
        'USER': 'postgres',
        'PASSWORD': '',
        'HOST': '',
        'PORT': '',
    }
}

INSTALLED_APPS += (
    'geokey_webresources',
)

STATIC_URL = '/static/'

MEDIA_ROOT = normpath(join(dirname(dirname(abspath(__file__))), 'assets'))
MEDIA_URL = '/assets/'

WSGI_APPLICATION = 'wsgi.application'


text:
const assembler = {
	methods: {
		assemble: function(input) {
			// [1]LABEL, [2]OPCODE [3]OPERAND /[4]COMMENT
			const regexInterpreter = /^[\s]?(?:(\w*)[,])?[\s]*(?:(\w*))?[\s]*(?:(-?\w*))?/
			const marieRegex = /^[\s]?(?:(\w*)[,])?[\s]*(?:(\w*))?[\s]*(?:(-?\w*))?/
			const whitespaceRegex = /^\s*(?:\/.*)?$/
			const labelRegex = /^\d.*$/
			const addressRegex = /^\d[0-9a-fA-F]*$/

			const GROUP_LABEL = 1
			const GROUP_OPCODE = 2
			const GROUP_OPERAND = 3
			const GROUP_COMMENT = 4

			const MAX_ADDRESS = 4095 // 2^12 [0000 0000] = 4095
			const MAX_INT = 32767
			const MIN_INT = -32768
			const DEC = -1
			const OCT = -2
			const HEX = -3
			const ORG = -4
			const END = -5

			const errorMessages = [
				"ORiGination directive must be first noncomment line of program.", // 0
				"A label cannot have 0..9 as its beginning character.", // 1
				"Statement label must be unique.", // 2
				"Instruction not recognized.", // 3
				"Missing instruction.", // 4
				"Missing operand.", // 5
				"Hex address literal out of range 0 to 0FFF allowable.", // 6
				"Invalid decimal value: -32768 to 32767 allowable.", // 7
				"Invalid octal value: 0 to 177777 allowable.", // 8
				"Invalid hexadecimal value: 0 to FFFF allowable.", // 9
				"Operand undefined.", // 10
				"Maximum source lines exceeded. Assembly halted.", // 11
				"Maximum line number exceeded. Assembly halted." // 12
			]

			// split the lines
			var lines = input.split('\n')
			var parsed = []
			var origin = 0
			var symbols = {}
			var errors = []

			if (lines.length > MAX_ADDRESS) {
				// throw errorMessages
				errors.push({
					name: errorMessages,
					line: 0
				})
			}

			// first pass
			for (var i = 0, l = lines.length; i < l; ++i) {
				var line = lines[i]

				if (/^\s*(?:\/.*)?$/.test(line))
					continue

				// [1]LABEL, [2]OPCODE [3]OPERAND
				var interpreter = marieRegex.exec(line)

				// check for other instructions
				var label = interpreter[GROUP_LABEL]
				var opcode = interpreter[GROUP_OPCODE].toUpperCase()
				var operand = interpreter[GROUP_OPERAND]

				// check for originator
				if (opcode == "ORG") {
					if (parsed.length > 0) {
						// unexpected origination directive.
						// throw errorMessages[0]
						errors.push({
							name: errorMessages[0],
							line: i
						})
					}

					if (!operand) {
						// throw errorMessages[5]
						errors.push({
							name: errorMessages[5],
							line: i
						})
					}

					origin = parseInt(operand, 16)
					continue
				}

				if (label) {
					// check for a valid label
					if (label.match(labelRegex)) {
						// throw errorMessages[1]
						errors.push({
							name: errorMessages[1],
							line: i
						})
					}

					// check for unique labels
					if (label in symbols) {
						// throw errorMessages[2]
						errors.push({
							name: errorMessages[2],
							line: i
						})
					}

					// add the symbol
					symbols[label] = parsed.length + origin
				}

				// check for the end directive
				if (opcode == "END") {
					break
				}

				// otherwise just push it
				parsed.push({
					address: parsed.length,
					label: label,
					opcode: opcode,
					operand: operand,
					line: (i + 1)
				})
			}

			if (parsed.length > MAX_ADDRESS) {
				errors.push({
					name: errorMessages[12],
					line: MAX_ADDRESS
				})
			}

			// second pass
			for (var i = 0, l = parsed.length; i < l; ++i) {
				var instruction = parsed[i]

				var directiveBase = undefined
				switch (instruction.opcode) {
					case "DEC":
						directiveBase = 10
						break
					case "OCT":
						directiveBase = 8
						break
					case "HEX":
						directiveBase = 16
						break
				}

				// if this is a directive
				if (directiveBase) {
					// directives need operands
					if (!instruction.operand) {
						// throw errorMessages[5]
						errors.push({
							name: errorMessages[5],
							line: instruction.line
						})
					}

					var literal = parseInt(instruction.operand, directiveBase)

					// needs to be a valid number
					if (isNaN(literal)) {
						// throw (directiveBase == 10) ?
						//   errorMessages[7] : (directiveBase == 8) ?
						//   errorMessages[8] : errorMessages[9]
						if (directiveBase == 10) {
							errors.push({
								name: errorMessages[7],
								line: instruction.line
							})
						} else if (directiveBase == 8) {
							errors.push({
								name: errorMessages[8],
								line: instruction.line
							})
						} else if (directiveBase == 16) {
							errors.push({
								name: errorMessages[9],
								line: instruction.line
							})
						}
					}

					// check for the (min, max)
					if (MIN_INT > literal || literal > MAX_INT) {
						// throw (directiveBase == 10) ?
						//   errorMessages[7] : (directiveBase == 8) ?
						//   errorMessages[8] : errorMessages[9]
						if (directiveBase == 10) {
							errors.push({
								name: errorMessages[7],
								line: instruction.line
							})
						} else if (directiveBase == 8) {
							errors.push({
								name: errorMessages[8],
								line: instruction.line
							})
						} else if (directiveBase == 16) {
							errors.push({
								name: errorMessages[9],
								line: instruction.line
							})
						}
					}

					// create our hexcode (just a literal)
					instruction.hexcode = literal

					// check to see if we need an operand
					continue
				}

				var opcode = this.opcodes[instruction.opcode]
				var operand = instruction.operand

				// check for valid opcodes
				if (!opcode) {
					// throw errorMessages[3]
					errors.push({
						name: errorMessages[3],
						line: instruction.line
					})
					// check to see if we need an operand
					continue
				}

				// check to see if we need an operand
				if (opcode.operand && !operand) {
					// throw errorMessages[5]
					errors.push({
						name: errorMessages[5],
						line: instruction.line
					})
				}

				// if we have an operand
				// we can only make it this far if we have one and need it
				if (operand) {
					// were either a hex address literal, or a symbol
					if (operand.match(addressRegex)) {
						operand = parseInt(operand, 16)
						if (operand > 0x0FFF) {
							// throw errorMessages[6]
							errors.push({
								name: errorMessages[6],
								line: instruction.line
							})
						}
					} else {
						if (!(operand in symbols)) {
							// throw errorMessages[10]
							errors.push({
								name: errorMessages[10],
								line: instruction.line
							})
						}

						operand = symbols[operand]
					}
				}

				// create hexcode
				instruction.hexcode = ((opcode.opcode << 12) | operand)
			}

			return {
				origin: origin,
				program: parsed,
				symbols: symbols,
				errors: errors
			}
		}
	}
}


text:
package com.gmail.jiangyang5157.sudoku.component;

import android.app.Fragment;
import android.view.*;
import android.widget.*;

import com.gmail.jiangyang5157.sudoku.R;

import android.os.Bundle;
import android.os.Handler;
import android.view.animation.AnimationUtils;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnCreateContextMenuListener;

public class ExpandableListFragment extends Fragment
        implements OnCreateContextMenuListener,
        ExpandableListView.OnChildClickListener,
        ExpandableListView.OnGroupCollapseListener,
        ExpandableListView.OnGroupExpandListener {

    static final int INTERNAL_PROGRESS_CONTAINER_ID = R.id.progress_container;
    static final int INTERNAL_LIST_CONTAINER_ID = R.id.list_container;
    static final int INTERNAL_EMPTY_ID = R.id.tv_empty;

    final private Handler mHandler = new Handler();

    final private Runnable mRequestFocus = new Runnable() {
        public void run() {
            mExpandableList.focusableViewAvailable(mExpandableList);
        }
    };

    final private AdapterView.OnItemClickListener mOnClickListener
            = (parent, v, position, id) -> onListItemClick((ExpandableListView) parent, v, position, id);

    ExpandableListAdapter mAdapter;
    ExpandableListView mExpandableList;
    boolean mFinishedStart = false;
    View mEmptyView;
    TextView mStandardEmptyView;
    View mProgressContainer;
    View mExpandableListContainer;
    CharSequence mEmptyText;
    boolean mExpandableListShown;

    public ExpandableListFragment() {
    }

    /**
     * Provide default implementation to return a simple list view.  Subclasses
     * can override to replace with their own layout.  If doing so, the
     * returned view hierarchy must have a ListView whose id
     * is {@link android.R.id#list android.R.id.list} and can optionally
     * have a sibling view id {@link android.R.id#empty android.R.id.empty}
     * that is to be shown when the list is empty.
     *

     *
If you are overriding this method with your own custom content,
     * consider including the standard layout {@link android.R.layout#list_content}
     * in your layout file, so that you continue to retain all of the standard
     * behavior of ListFragment.  In particular, this is currently the only
     * way to have the built-in indeterminant progress state be shown.
     */
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_expandable_list_internal, container, false);
    }

    /**
     * Attach to list view once the view hierarchy has been created.
     */
    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        ensureList();
    }

    /**
     * Detach from list view.
     */
    @Override
    public void onDestroyView() {
        mHandler.removeCallbacks(mRequestFocus);
        mExpandableList = null;
        mExpandableListShown = false;
        mEmptyView = mProgressContainer = mExpandableListContainer = null;
        mStandardEmptyView = null;
        super.onDestroyView();
    }

    /**
     * This method will be called when an item in the list is selected.
     * Subclasses should override. Subclasses can call
     * getListView().getItemAtPosition(position) if they need to access the
     * data associated with the selected item.
     *
     * @param l        The ListView where the click happened
     * @param v        The view that was clicked within the ListView
     * @param position The position of the view in the list
     * @param id       The row id of the item that was clicked
     */
    public void onListItemClick(ExpandableListView l, View v, int position, long id) {
    }

    /**
     * Provide the cursor for the list view.
     */
    public void setListAdapter(ExpandableListAdapter adapter) {
        boolean hadAdapter = mAdapter != null;
        mAdapter = adapter;
        if (mExpandableList != null) {
            mExpandableList.setAdapter(adapter);
            if (!mExpandableListShown && !hadAdapter) {
                // The list was hidden, and previously didn't have an
                // adapter.  It is now time to show it.
                setListShown(true, getView().getWindowToken() != null);
            }
        }
    }

    /**
     * Set the currently selected list item to the specified
     * position with the adapter's data
     *
     * @param position
     */
    public void setSelection(int position) {
        ensureList();
        mExpandableList.setSelection(position);
    }

    /**
     * Get the position of the currently selected list item.
     */
    public int getSelectedItemPosition() {
        ensureList();
        return mExpandableList.getSelectedItemPosition();
    }

    /**
     * Get the cursor row ID of the currently selected list item.
     */
    public long getSelectedItemId() {
        ensureList();
        return mExpandableList.getSelectedItemId();
    }

    /**
     * Get the activity's list view widget.
     */
    public ExpandableListView getListView() {
        ensureList();
        return mExpandableList;
    }

    /**
     * The default content for a ListFragment has a TextView that can
     * be shown when the list is empty.  If you would like to have it
     * shown, call this method to supply the text it should use.
     */
    public void setEmptyText(CharSequence text) {
        ensureList();
        if (mStandardEmptyView == null) {
            throw new IllegalStateException("Can't be used with a custom content view");
        }
        mStandardEmptyView.setText(text);
        if (mEmptyText == null) {
            mExpandableList.setEmptyView(mStandardEmptyView);
        }
        mEmptyText = text;
    }

    /**
     * Control whether the list is being displayed.  You can make it not
     * displayed if you are waiting for the initial data to show in it.  During
     * this time an indeterminant progress indicator will be shown instead.
     *

     *
Applications do not normally need to use this themselves.  The default
     * behavior of ListFragment is to start with the list not being shown, only
     * showing it once an adapter is given with .
     * If the list at that point had not been shown, when it does get shown
     * it will be do without the user ever seeing the hidden state.
     *
     * @param shown If true, the list view is shown; if false, the progress
     *              indicator.  The initial value is true.
     */
    public void setListShown(boolean shown) {
        setListShown(shown, true);
    }

    /**
     * Like {@link #setListShown(boolean)}, but no animation is used when
     * transitioning from the previous state.
     */
    public void setListShownNoAnimation(boolean shown) {
        setListShown(shown, false);
    }

    /**
     * Control whether the list is being displayed.  You can make it not
     * displayed if you are waiting for the initial data to show in it.  During
     * this time an indeterminant progress indicator will be shown instead.
     *
     * @param shown   If true, the list view is shown; if false, the progress
     *                indicator.  The initial value is true.
     * @param animate If true, an animation will be used to transition to the
     *                new state.
     */
    private void setListShown(boolean shown, boolean animate) {
        ensureList();
        if (mProgressContainer == null) {
            throw new IllegalStateException("Can't be used with a custom content view");
        }
        if (mExpandableListShown == shown) {
            return;
        }
        mExpandableListShown = shown;
        if (shown) {
            if (animate) {
                mProgressContainer.startAnimation(AnimationUtils.loadAnimation(
                        getActivity(), android.R.anim.fade_out));
                mExpandableListContainer.startAnimation(AnimationUtils.loadAnimation(
                        getActivity(), android.R.anim.fade_in));
            } else {
                mProgressContainer.clearAnimation();
                mExpandableListContainer.clearAnimation();
            }
            mProgressContainer.setVisibility(View.GONE);
            mExpandableListContainer.setVisibility(View.VISIBLE);
        } else {
            if (animate) {
                mProgressContainer.startAnimation(AnimationUtils.loadAnimation(
                        getActivity(), android.R.anim.fade_in));
                mExpandableListContainer.startAnimation(AnimationUtils.loadAnimation(
                        getActivity(), android.R.anim.fade_out));
            } else {
                mProgressContainer.clearAnimation();
                mExpandableListContainer.clearAnimation();
            }
            mProgressContainer.setVisibility(View.VISIBLE);
            mExpandableListContainer.setVisibility(View.GONE);
        }
    }

    /**
     * Get the ListAdapter associated with this activity's ListView.
     */
    public ExpandableListAdapter getListAdapter() {
        return mAdapter;
    }

    private void ensureList() {
        if (mExpandableList != null) {
            return;
        }
        View root = getView();
        if (root == null) {
            throw new IllegalStateException("Content view not yet created");
        }
        if (root instanceof ExpandableListView) {
            mExpandableList = (ExpandableListView) root;
        } else {
            mStandardEmptyView = (TextView) root.findViewById(INTERNAL_EMPTY_ID);
            if (mStandardEmptyView == null) {
                mEmptyView = root.findViewById(android.R.id.empty);
            } else {
                mStandardEmptyView.setVisibility(View.GONE);
            }
            mProgressContainer = root.findViewById(INTERNAL_PROGRESS_CONTAINER_ID);
            mExpandableListContainer = root.findViewById(INTERNAL_LIST_CONTAINER_ID);
            View rawExpandableListView = root.findViewById(android.R.id.list);
            if (!(rawExpandableListView instanceof ExpandableListView)) {
                if (rawExpandableListView == null) {
                    throw new RuntimeException(
                            "Your content must have a ListView whose id attribute is " +
                                    "'android.R.id.list'");
                }
                throw new RuntimeException(
                        "Content has view with id attribute 'android.R.id.list' "
                                + "that is not a ListView class");
            }
            mExpandableList = (ExpandableListView) rawExpandableListView;
            if (mEmptyView != null) {
                mExpandableList.setEmptyView(mEmptyView);
            } else if (mEmptyText != null) {
                mStandardEmptyView.setText(mEmptyText);
                mExpandableList.setEmptyView(mStandardEmptyView);
            }
        }
        mExpandableListShown = true;
        mExpandableList.setOnItemClickListener(mOnClickListener);
        if (mAdapter != null) {
            ExpandableListAdapter adapter = mAdapter;
            mAdapter = null;
            setListAdapter(adapter);
        } else {
            // We are starting without an adapter, so assume we won't
            // have our data right away and start with the progress indicator.
            if (mProgressContainer != null) {
                setListShown(false, false);
            }
        }
        mHandler.post(mRequestFocus);
    }

    /**
     * Override this to populate the context menu when an item is long pressed. menuInfo
     * will contain an {@link ExpandableListView.ExpandableListContextMenuInfo}
     * whose packedPosition is a packed position
     * that should be used with {@link ExpandableListView#getPackedPositionType(long)} and
     * the other similar methods.
     *

     * {@inheritDoc}
     */
    @Override
    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    }

    /**
     * onChildClick this for receiving callbacks when a child has been clicked.
     *

     * {@inheritDoc}
     */
    public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
                                int childPosition, long id) {
        return false;
    }

    /**
     * Override this for receiving callbacks when a group has been collapsed.
     */
    public void onGroupCollapse(int groupPosition) {
    }

    /**
     * Override this for receiving callbacks when a group has been expanded.
     */
    public void onGroupExpand(int groupPosition) {
    }

//    /**
//     * Ensures the expandable list view has been created before Activity restores all
//     * of the view states.
//     *
//     *@see Activity#onRestoreInstanceState(Bundle)
//     */
//    @Override
//    protected void onRestoreInstanceState(Bundle state) {
//        ensureList();
//        super.onRestoreInstanceState(state);
//    }

    /**
     * Updates the screen state (current list and other views) when the
     * content changes.
     *
     * @see android.app.Activity#onContentChanged()
     */
    public void onContentChanged() {
//        super.onContentChanged();
        View emptyView = getView().findViewById(android.R.id.empty);
        mExpandableList = (ExpandableListView) getView().findViewById(android.R.id.list);
        if (mExpandableList == null) {
            throw new RuntimeException(
                    "Your content must have a ExpandableListView whose id attribute is " +
                            "'android.R.id.list'");
        }
        if (emptyView != null) {
            mExpandableList.setEmptyView(emptyView);
        }
        mExpandableList.setOnChildClickListener(this);
        mExpandableList.setOnGroupExpandListener(this);
        mExpandableList.setOnGroupCollapseListener(this);

        if (mFinishedStart) {
            setListAdapter(mAdapter);
        }
        mFinishedStart = true;
    }

    /**
     * Get the activity's expandable list view widget.  This can be used to get the selection,
     * set the selection, and many other useful functions.
     *
     * @see ExpandableListView
     */
    public ExpandableListView getExpandableListView() {
        ensureList();
        return mExpandableList;
    }

    /**
     * Get the ExpandableListAdapter associated with this activity's
     * ExpandableListView.
     */
    public ExpandableListAdapter getExpandableListAdapter() {
        return mAdapter;
    }

    /**
     * Gets the ID of the currently selected group or child.
     *
     * @return The ID of the currently selected group or child.
     */
    public long getSelectedId() {
        return mExpandableList.getSelectedId();
    }

    /**
     * Gets the position (in packed position representation) of the currently
     * selected group or child. Use
     * {@link ExpandableListView#getPackedPositionType},
     * {@link ExpandableListView#getPackedPositionGroup}, and
     * {@link ExpandableListView#getPackedPositionChild} to unpack the returned
     * packed position.
     *
     * @return A packed position representation containing the currently
     * selected group or child's position and type.
     */
    public long getSelectedPosition() {
        return mExpandableList.getSelectedPosition();
    }

    /**
     * Sets the selection to the specified child. If the child is in a collapsed
     * group, the group will only be expanded and child subsequently selected if
     * shouldExpandGroup is set to true, otherwise the method will return false.
     *
     * @param groupPosition     The position of the group that contains the child.
     * @param childPosition     The position of the child within the group.
     * @param shouldExpandGroup Whether the child's group should be expanded if
     *                          it is collapsed.
     * @return Whether the selection was successfully set on the child.
     */
    public boolean setSelectedChild(int groupPosition, int childPosition, boolean shouldExpandGroup) {
        return mExpandableList.setSelectedChild(groupPosition, childPosition, shouldExpandGroup);
    }

    /**
     * Sets the selection to the specified group.
     *
     * @param groupPosition The position of the group that should be selected.
     */
    public void setSelectedGroup(int groupPosition) {
        mExpandableList.setSelectedGroup(groupPosition);
    }
}


text:
namespace blink {

class CSSRotateNonInterpolableValue : public NonInterpolableValue {
public:
    static PassRefPtr<CSSRotateNonInterpolableValue> create(const Rotation& rotation)
    {
        return adoptRef(new CSSRotateNonInterpolableValue(true, rotation, Rotation(), false, false));
    }

    static PassRefPtr<CSSRotateNonInterpolableValue> create(const CSSRotateNonInterpolableValue& start, const CSSRotateNonInterpolableValue& end)
    {
        return adoptRef(new CSSRotateNonInterpolableValue(false, start.rotation(), end.rotation(), start.isAdditive(), end.isAdditive()));
    }

    PassRefPtr<CSSRotateNonInterpolableValue> composite(const CSSRotateNonInterpolableValue& other, double otherProgress)
    {
        ASSERT(m_isSingle && !m_isStartAdditive);
        if (other.m_isSingle) {
            ASSERT(otherProgress == 0);
            ASSERT(other.isAdditive());
            return create(Rotation::add(rotation(), other.rotation()));
        }

        ASSERT(other.m_isStartAdditive || other.m_isEndAdditive);
        Rotation start = other.m_isStartAdditive ? Rotation::add(rotation(), other.m_start) : other.m_start;
        Rotation end = other.m_isEndAdditive ? Rotation::add(rotation(), other.m_end) : other.m_end;
        return create(Rotation::slerp(start, end, otherProgress));
    }

    void setSingleAdditive() { ASSERT(m_isSingle); m_isStartAdditive = true; }

    Rotation slerpedRotation(double progress) const
    {
        ASSERT(!m_isStartAdditive && !m_isEndAdditive);
        ASSERT(!m_isSingle || progress == 0);
        if (progress == 0)
            return m_start;
        if (progress == 1)
            return m_end;
        return Rotation::slerp(m_start, m_end, progress);
    }

    DECLARE_NON_INTERPOLABLE_VALUE_TYPE();

private:
    CSSRotateNonInterpolableValue(bool isSingle, const Rotation& start, const Rotation& end, bool isStartAdditive, bool isEndAdditive)
        : m_isSingle(isSingle)
        , m_start(start)
        , m_end(end)
        , m_isStartAdditive(isStartAdditive)
        , m_isEndAdditive(isEndAdditive)
    { }

    const Rotation& rotation() const { ASSERT(m_isSingle); return m_start; }
    bool isAdditive() const { ASSERT(m_isSingle); return m_isStartAdditive; }

    bool m_isSingle;
    Rotation m_start;
    Rotation m_end;
    bool m_isStartAdditive;
    bool m_isEndAdditive;
};

DEFINE_NON_INTERPOLABLE_VALUE_TYPE(CSSRotateNonInterpolableValue);
DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(CSSRotateNonInterpolableValue);

namespace {

Rotation getRotation(const ComputedStyle& style)
{
    if (!style.rotate())
        return Rotation(FloatPoint3D(0, 0, 1), 0);
    return Rotation(style.rotate()->axis(), style.rotate()->angle());
}

InterpolationValue convertRotation(const Rotation& rotation)
{
    return InterpolationValue(InterpolableNumber::create(0), CSSRotateNonInterpolableValue::create(rotation));
}

class InheritedRotationChecker : public InterpolationType::ConversionChecker {
public:
    static PassOwnPtr<InheritedRotationChecker> create(const Rotation& inheritedRotation)
    {
        return adoptPtr(new InheritedRotationChecker(inheritedRotation));
    }

    bool isValid(const InterpolationEnvironment& environment, const InterpolationValue& underlying) const final
    {
        Rotation inheritedRotation = getRotation(*environment.state().parentStyle());
        return m_inheritedRotation.axis == inheritedRotation.axis
            && m_inheritedRotation.angle == inheritedRotation.angle;
    }
private:
    InheritedRotationChecker(const Rotation& inheritedRotation)
        : m_inheritedRotation(inheritedRotation)
    { }

    const Rotation m_inheritedRotation;
};

} // namespace

InterpolationValue CSSRotateInterpolationType::maybeConvertNeutral(const InterpolationValue& underlying, ConversionCheckers&) const
{
    return convertRotation(Rotation());
}

InterpolationValue CSSRotateInterpolationType::maybeConvertInitial(const StyleResolverState&, ConversionCheckers&) const
{
    return convertRotation(getRotation(ComputedStyle::initialStyle()));
}

InterpolationValue CSSRotateInterpolationType::maybeConvertInherit(const StyleResolverState& state, ConversionCheckers& conversionCheckers) const
{
    Rotation inheritedRotation = getRotation(*state.parentStyle());
    conversionCheckers.append(InheritedRotationChecker::create(inheritedRotation));
    return convertRotation(inheritedRotation);
}

InterpolationValue CSSRotateInterpolationType::maybeConvertValue(const CSSValue& value, const StyleResolverState&, ConversionCheckers&) const
{
    return convertRotation(StyleBuilderConverter::convertRotation(value));
}

InterpolationValue CSSRotateInterpolationType::maybeConvertSingle(const PropertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const
{
    InterpolationValue result = CSSInterpolationType::maybeConvertSingle(keyframe, environment, underlying, conversionCheckers);
    if (!result)
        return nullptr;
    if (keyframe.composite() != EffectModel::CompositeReplace)
        toCSSRotateNonInterpolableValue(*result.nonInterpolableValue).setSingleAdditive();
    return result;
}

PairwiseInterpolationValue CSSRotateInterpolationType::maybeMergeSingles(InterpolationValue&& start, InterpolationValue&& end) const
{
    return PairwiseInterpolationValue(
        InterpolableNumber::create(0),
        InterpolableNumber::create(1),
        CSSRotateNonInterpolableValue::create(
            toCSSRotateNonInterpolableValue(*start.nonInterpolableValue),
            toCSSRotateNonInterpolableValue(*end.nonInterpolableValue)));
}

InterpolationValue CSSRotateInterpolationType::maybeConvertUnderlyingValue(const InterpolationEnvironment& environment) const
{
    return convertRotation(getRotation(*environment.state().style()));
}

void CSSRotateInterpolationType::composite(UnderlyingValueOwner& underlyingValueOwner, double underlyingFraction, const InterpolationValue& value, double interpolationFraction) const
{
    CSSRotateNonInterpolableValue& underlyingNonInterpolableValue = toCSSRotateNonInterpolableValue(*underlyingValueOwner.value().nonInterpolableValue);
    const CSSRotateNonInterpolableValue& nonInterpolableValue = toCSSRotateNonInterpolableValue(*value.nonInterpolableValue);
    double progress = toInterpolableNumber(*value.interpolableValue).value();
    underlyingValueOwner.mutableValue().nonInterpolableValue = underlyingNonInterpolableValue.composite(nonInterpolableValue, progress);
}

void CSSRotateInterpolationType::apply(const InterpolableValue& interpolableValue, const NonInterpolableValue* untypedNonInterpolableValue, InterpolationEnvironment& environment) const
{
    double progress = toInterpolableNumber(interpolableValue).value();
    const CSSRotateNonInterpolableValue& nonInterpolableValue = toCSSRotateNonInterpolableValue(*untypedNonInterpolableValue);
    Rotation rotation = nonInterpolableValue.slerpedRotation(progress);
    environment.state().style()->setRotate(RotateTransformOperation::create(rotation, TransformOperation::Rotate3D));
}

} // namespace blink


text:
package org.libsdl.app;

import android.hardware.usb.UsbDevice;

interface HIDDevice
{
    public int getId();
    public int getVendorId();
    public int getProductId();
    public String getSerialNumber();
    public int getVersion();
    public String getManufacturerName();
    public String getProductName();
    public UsbDevice getDevice();
    public boolean open();
    public int sendFeatureReport(byte[] report);
    public int sendOutputReport(byte[] report);
    public boolean getFeatureReport(byte[] report);
    public void setFrozen(boolean frozen);
    public void close();
    public void shutdown();
}


text:
/*
 * 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 VMware, Inc. 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 VMWARE, INC. 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.
 */

/*
 *
 * configuartion interface definitions
 *
 *
 * this is intended to serve as a replacement for the cluttered
 *  policy.c code for reading and writing core parameters. OOP
 *  style has been kept in mind to allow easy porting to c++
 *  if/when we decide to make that switch.
 *
 * usage:
 *  a ConfigGroup is more or less equivalent to a registry key: it can
 *  hold name-value pairs and 'children' ConfigGroups. ConfigGroup
 *  paths are ":" separated, and for registry purposes are assumed to
 *  be rooted at HKLM/Software/Determina. the idea is that if we move
 *  away from the registry (eg, due to moving to another platform or
 *  to config files for core params), this interface should still be
 *  usable, and the only change would be in {read,write}_config_group.
 *
 *  there are also direct-access single-parameter config
 *  functions; these allow for arbitray registry read/write. however,
 *  unless otherwise specified with the 'absolute' parameter, these
 *  are still based at the determina key.
 *
 *
 */

#ifndef _DETERMINA_CONFIG_H_
#define _DETERMINA_CONFIG_H_

#ifdef __cplusplus
extern "C"{
#endif

/* we have circular dep issues if we include share.h */
typedef UINT_PTR process_id_t;

#define MAX_PARAM_LEN 1024
#define CONFIG_PATH_SEPARATOR L':'
#define LIST_SEPARATOR_CHAR L';'
#define APPINIT_SEPARATOR_CHAR L','
#define CONFIGURATION_ROOT_REGISTRY_KEY L"Software\\"L_EXPAND_LEVEL(COMPANY_NAME)

/* this provides a hook for forced parameter deletion, even if
 * "should_clear" is FALSE. */
#define L_DELETE_PARAMETER_KEY L"__DELETE_PARAMETER_KEY"

/* note this does NOT include the null terminator: the limit
 *  is 31 chars. */
#define APPINIT_SYSTEM32_LENGTH_LIMIT  31

typedef struct NameValuePairNode_ {
    struct NameValuePairNode_ *next;
    WCHAR *name;
    WCHAR *value;
} NameValuePairNode;

typedef struct ConfigGroup_ {
    struct ConfigGroup_ *next;
    struct ConfigGroup_ *children;
    /* used internally only for efficiency */
    struct ConfigGroup_ *lastchild;
    NameValuePairNode *params;
    BOOL should_clear;
    WCHAR *name;
} ConfigGroup;

/* group config management */

DWORD
get_key_handle(HKEY *key, HKEY parent, const WCHAR *path,
               BOOL absolute, DWORD flags);

DWORD
recursive_delete_key(HKEY parent, const WCHAR *keyname, ConfigGroup *filter);

ConfigGroup *
new_config_group(const WCHAR *name);

ConfigGroup *
copy_config_group(ConfigGroup *config, BOOL deep);

/* name is the subkey name from the system registry root (e.g.,
 *  HKLM/Software/Determina). */
DWORD
read_config_group(ConfigGroup **configptr, const WCHAR *name,
                  BOOL read_children_recursively);

void
set_should_clear(ConfigGroup *config, BOOL should_clear);

void
remove_children(ConfigGroup *config);

void
remove_child(const WCHAR *child, ConfigGroup *config);

WCHAR *
get_config_group_parameter(ConfigGroup *config, const WCHAR *name);

void
set_config_group_parameter(ConfigGroup *config,
                           const WCHAR *name, const WCHAR *value);

void
remove_config_group_parameter(ConfigGroup *config, const WCHAR *name);

void
add_config_group(ConfigGroup *parent, ConfigGroup *new_child);

ConfigGroup *
get_child(const WCHAR *name, ConfigGroup *c);

DWORD
write_config_group(ConfigGroup *config);

void
free_config_group(ConfigGroup *configptr);

void
dump_nvp(NameValuePairNode *nvpn);

void
dump_config_group(char *prefix, char *incr, ConfigGroup *c, BOOL traverse);

BOOL
get_config_group_parameter_bool(ConfigGroup *config, const WCHAR *name);

int
get_config_group_parameter_int(ConfigGroup *config, const WCHAR *name);

void
get_config_group_parameter_scrambled(ConfigGroup *config, const WCHAR *name,
                                     WCHAR *buffer, UINT maxchars);

void
set_config_group_parameter_bool(ConfigGroup *config, const WCHAR *name,
                                BOOL value);

void
set_config_group_parameter_int(ConfigGroup *config, const WCHAR *name,
                               int value);

void
set_config_group_parameter_ascii(ConfigGroup *config, const WCHAR *name,
                                 char *value);

void
set_config_group_parameter_scrambled(ConfigGroup *config, const WCHAR *name,
                                     const WCHAR *value);

/* single parameter config functions */

DWORD
set_config_parameter(const WCHAR *path, BOOL absolute,
                     const WCHAR *name, const WCHAR *value);

DWORD
get_config_parameter(const WCHAR *path, BOOL absolute,
                     const WCHAR *name, WCHAR *value, int maxlen);

DWORD
read_reg_string(HKEY subkey, const WCHAR *keyname, WCHAR *value, int valchars);

/* if value is NULL, the value will be deleted */
DWORD
write_reg_string(HKEY subkey, const WCHAR *keyname, const WCHAR *value);

/* identifies processes relative to a ConfigGroup */
ConfigGroup *
get_process_config_group(ConfigGroup *config, process_id_t pid);

BOOL
is_parent_of_qualified_config_group(ConfigGroup *config);

/* tries both with and without no_strip */
ConfigGroup *
get_qualified_config_group(ConfigGroup *config,
                           const WCHAR *exename, const WCHAR *cmdline);

/* some list management and utility routines */
/* all lists are ;-separated */
/* comparisons are case insensitive */
/* filename comparisons are independent of path */

WCHAR *
new_file_list(SIZE_T initial_chars);

void
free_file_list(WCHAR *list);

/*
 * given a ;-separated list and a filename, return a pointer to
 *  the filename in the list, if it appears. comparisons are
 *  case insensitive and independent of path; eg,
 *     get_entry_location("c:\\foo\\bar.dll;blah;...", "D:\\Bar.DLL")
 *  would return a pointer to the beginning of the list.
 */
WCHAR *
get_entry_location(const WCHAR *list, const WCHAR *filename, WCHAR separator);

BOOL
is_in_file_list(const WCHAR *list, const WCHAR *filename, WCHAR separator);

/* frees the old list and returns a newly alloc'ed one */
WCHAR *
add_to_file_list(WCHAR *list, const WCHAR *filename,
                 BOOL check_for_duplicates, BOOL add_to_front,
                 BOOL overwrite_existing, WCHAR separator);

void
remove_from_file_list(WCHAR *list, const WCHAR *filename, WCHAR separator);

BOOL
blacklist_filter(WCHAR *list, const WCHAR *blacklist,
                 BOOL check_only, WCHAR separator);

BOOL
whitelist_filter(WCHAR *list, const WCHAR *whitelist,
                 BOOL check_only, WCHAR separator);

DWORD
set_autoinjection_ex(BOOL inject, DWORD flags,
                     const WCHAR *blacklist,
                     const WCHAR *whitelist, DWORD *list_error,
                     const WCHAR *custom_preinject_name,
                     WCHAR *current_list, SIZE_T maxchars);

DWORD
set_custom_autoinjection(const WCHAR *preinject, DWORD flags);

DWORD
set_autoinjection();

DWORD
unset_custom_autoinjection(const WCHAR *preinject, DWORD flags);

DWORD
unset_autoinjection();

BOOL
is_autoinjection_set();

BOOL
is_custom_autoinjection_set(const WCHAR *preinject);

DWORD
set_loadappinit();

DWORD
unset_loadappinit();

BOOL
is_loadappinit_set();

DWORD
create_eventlog(const WCHAR *dll_path);

DWORD
destroy_eventlog(void);

BOOL
is_vista(void);

BOOL
is_win7(void);

DWORD
copy_earlyhelper_dlls(const WCHAR *dir);

#ifdef __cplusplus
}
#endif

#endif _DETERMINA_CONFIG_H_


text:
#ifndef GNU_GO_WINSOCKET_H
#define GNU_GO_WINSOCKET_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#define USE_WINDOWS_SOCKET_CLUDGE		\
  ((defined(_WIN32) || defined(_WIN32_WCE))	\
   && defined(ENABLE_SOCKET_SUPPORT))

#if USE_WINDOWS_SOCKET_CLUDGE

#include <stdarg.h>
#include <stdio.h>

#ifndef WINSOCKET_H_INTERNAL_INCLUSION

/* (sic.) Teh cludge. */

/* At least in some versions of `stdio.h' on Windows, feof() is a
 * macro, not a function.
 */
#ifdef feof
#undef feof
#endif

#define setbuf		winsocket_setbuf
#define fflush		winsocket_fflush
#define feof		winsocket_feof
#define fclose		winsocket_fclose

#define fread		winsocket_fread
#define fgets		winsocket_fgets

#define fwrite		winsocket_fwrite
#define fputc		winsocket_fputc
#define fputs		winsocket_fputs
#define fprintf		winsocket_fprintf
#define vfprintf	winsocket_vfprintf

#endif	/* WINSOCKET_H_INTERNAL_INCLUSION */

void		winsocket_activate(int _socket_handle);

void		winsocket_setbuf(FILE *file, char *buffer);
int		winsocket_fflush(FILE *file);
int		winsocket_feof(FILE *file);
int		winsocket_fclose(FILE *file);

size_t		winsocket_fread(void *buffer,
				size_t size, size_t num_items, FILE *file);
char *		winsocket_fgets(char *buffer, int size, FILE *file);

size_t		winsocket_fwrite(const void *buffer,
				 size_t size, size_t num_items, FILE *file);
int		winsocket_fputc(int character, FILE *file);
int		winsocket_fputs(const char *string, FILE *file);
int		winsocket_fprintf(FILE *file, const char *format_string, ...);
int		winsocket_vfprintf(FILE *file, const char *format_string,
				   va_list arguments);

#endif	/* USE_WINDOWS_SOCKET_CLUDGE */

#endif	/* GNU_GO_WINSOCKET_H */

/*
 * Local Variables:
 * tab-width: 8
 * c-basic-offset: 2
 * End:
 */


text:
/* global files */
'use strict';

require('../../../static/cms/js/polyfills/function.prototype.bind');
require('../../../static/cms/js/polyfills/array.prototype.findindex');
require('jquery');
require('./helpers/mock-ajax');
require('./helpers/jasmine-jquery');

if (files[0] === '*') {
    require('./cms.base.test');
    require('./cms.messages.test');
    require('./cms.changetracker.test');
    require('./cms.modal.test');
    require('./cms.sideframe.test');
    require('./cms.clipboard.test');
    require('./cms.plugins.test');
    require('./cms.structureboard.test');
    require('./cms.navigation.test');
    require('./cms.toolbar.test');
    require('./cms.tooltip.test');
    require('./cms.pagetree.dropdown.test');
    require('./cms.pagetree.stickyheader.test');
    require('./cms.pagetree.test');
    require('./shortcuts.test');
    require('./keyboard.test');
} else {
    files.forEach(function (file) {
        require('./' + file + '.test');
    });
}


text:
#include <aws/guardduty/model/PortProbeDetail.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace GuardDuty
{
namespace Model
{

PortProbeDetail::PortProbeDetail() :
    m_localPortDetailsHasBeenSet(false),
    m_remoteIpDetailsHasBeenSet(false)
{
}

PortProbeDetail::PortProbeDetail(JsonView jsonValue) :
    m_localPortDetailsHasBeenSet(false),
    m_remoteIpDetailsHasBeenSet(false)
{
  *this = jsonValue;
}

PortProbeDetail& PortProbeDetail::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("localPortDetails"))
  {
    m_localPortDetails = jsonValue.GetObject("localPortDetails");

    m_localPortDetailsHasBeenSet = true;
  }

  if(jsonValue.ValueExists("remoteIpDetails"))
  {
    m_remoteIpDetails = jsonValue.GetObject("remoteIpDetails");

    m_remoteIpDetailsHasBeenSet = true;
  }

  return *this;
}

JsonValue PortProbeDetail::Jsonize() const
{
  JsonValue payload;

  if(m_localPortDetailsHasBeenSet)
  {
   payload.WithObject("localPortDetails", m_localPortDetails.Jsonize());

  }

  if(m_remoteIpDetailsHasBeenSet)
  {
   payload.WithObject("remoteIpDetails", m_remoteIpDetails.Jsonize());

  }

  return payload;
}

} // namespace Model
} // namespace GuardDuty
} // namespace Aws


text:
<?php

class Rodada {

	private id;
	private nome;
	private $partidas;

}