text:
#include <time.h>
#include <iostream>
#include <fstream>
#include <sstream>

#include "oss_sdk_cpp/base/base.h"
#include "oss_sdk_cpp/base/string_piece.h"
#include "oss_sdk_cpp/base/sys_string_conversions.h"

#include "oss_sdk_cpp/utils/sign_utils.h"
#include "oss_sdk_cpp/utils/http_utils.h"
#include "oss_sdk_cpp/utils/apr_utils.h"
#include "oss_sdk_cpp/utils/string_utils.h"
#include "oss_sdk_cpp/utils/utils.h"

#include "oss_sdk_cpp/http/http_engine.h"
#include "oss_sdk_cpp/http/http_engine_input.h"
#include "oss_sdk_cpp/http/http_engine_output.h"
#include "oss_sdk_cpp/http/http_headers.h"

#include "oss_sdk_cpp/oss/oss_exception.h"
#include "oss_sdk_cpp/oss/oss_error_code.h"
#include "oss_sdk_cpp/oss/oss_client.h"

namespace oss {

OssClient::~OssClient() {
}

OssClient::OssClient(const std::string& access_key_id,
                     const std::string& access_key_secret)
  : access_key_id_(access_key_id),
    access_key_secret_(access_key_secret) {
  unit_test_mode_ = false;
}

OssClient::OssClient(const std::string& endpoint,
                     const std::string& access_key_id,
                     const std::string& access_key_secret,
                     const ClientConfiguration& config)
  : access_key_id_(access_key_id),
    access_key_secret_(access_key_secret),
    endpoint_(endpoint),
    client_config_(config) {
  ParseEndpoint(endpoint_);
  engine_.reset(new HttpEngine(endpoint, config.http_config));
  unit_test_mode_ = false;
}

Status OssClient::CreateBucket(const std::string& bucket_name,
                               const std::string& acl) {
  HttpEngineInput engine_input;
  engine_input.method = kHttpPut;
  engine_input.url = bucket_name + "." + endpoint_;
  engine_input.headers[kOssAcl] = acl;
  auto resource = "/" + bucket_name + "/";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::DeleteBucket(const std::string& bucket_name) {
  HttpEngineInput engine_input;
  engine_input.method = kHttpDelete;
  engine_input.url = bucket_name + "." + endpoint_;
  auto resource = "/" + bucket_name + "/";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::SetBucketAcl(const std::string& bucket_name,
                               const std::string& acl) {
  HttpEngineInput engine_input;
  engine_input.method = kHttpPut;
  engine_input.url = bucket_name + "." + endpoint_  + "/" + "?acl";
  engine_input.headers[kOssAcl] = acl;
  auto resource = "/" + bucket_name + "/" + "?acl";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::GetBucketAcl(const std::string& bucket_name,
                               GetBucketAclResult* result) {
  HttpEngineInput engine_input;
  engine_input.method = kHttpGet;
  engine_input.url = bucket_name + "." + endpoint_ + "/" + "?acl";
  auto resource = "/" + bucket_name + "/" + "?acl";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    if (!result->DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    }
  }

  return status;
}

Status OssClient::GetBucketAcl(const std::string& bucket_name,
                               std::string* acl) {
  GetBucketAclResult result;
  auto status = GetBucketAcl(bucket_name, &result);
  if (status.Ok()) {
    *acl = result.GetAcl();
  }

  return status;
}

Status OssClient::BucketExists(const std::string& bucket_name,
                               bool* exist) {
  std::string acl;
  auto status = GetBucketAcl(bucket_name, &acl);
  if (!status.Ok()) {
    if (status.ErrorCode() == oss_error_code::kNoSuchBucket) {
      *exist = false;
      status.SetErrorCode("");
    }
  } else {
    *exist = true;
  }

  return status;
}

Status OssClient::GetBucketLocation(const std::string& bucket_name,
                                    std::string* location) {
  HttpEngineInput engine_input;
  engine_input.method = kHttpGet;
  engine_input.url = bucket_name + "." + endpoint_ + "/?location";
  auto resource = "/" + bucket_name + "/?location";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    GetBucketLocationResult result;
    if (!result.DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    } else {
      *location = result.GetLocation();
    }
  }

  return status;
}

Status OssClient::GetBucketLogging(const std::string& bucket_name,
                                   GetBucketLoggingResult* result) {
  HttpEngineInput engine_input;
  engine_input.method = kHttpGet;
  engine_input.url = bucket_name + "." + endpoint_ + "/?logging";
  auto resource = "/" + bucket_name + "/?logging";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    if (!result->DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    }
  }

  return status;
}

Status OssClient::SetBucketLogging(const SetBucketLoggingRequest& request) {
  auto& bucket_name = request.GetSourceBucket();

  HttpEngineInput engine_input;
  auto body = request.SerializeToXml();
  engine_input.input_buffer = &body;
  engine_input.method = kHttpPut;
  engine_input.url = bucket_name + "." + endpoint_ + "/?logging";
  auto resource = "/" + bucket_name + "/?logging";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::DeleteBucketLogging(const std::string& bucket_name) {
  return DeleteBucketConfig(bucket_name, "logging");
}

Status OssClient::GetBucketWebsite(const std::string& bucket_name,
                                   GetBucketWebsiteResult* result) {
  HttpEngineInput engine_input;
  engine_input.method = kHttpGet;
  engine_input.url = bucket_name + "." + endpoint_ + "/?website";
  auto resource = "/" + bucket_name + "/?website";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  Status status = engine_output.ToStatus();
  if (status.Ok()) {
    if (!result->DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    }
  }

  return status;
}

Status OssClient::SetBucketWebsite(const SetBucketWebsiteRequest& request) {
  auto& bucket_name = request.GetBucketName();

  HttpEngineInput engine_input;
  auto body = request.SerializeToXml();
  engine_input.input_buffer = &body;
  engine_input.method = kHttpPut;
  engine_input.url = bucket_name + "." + endpoint_ + "/?website";
  auto resource = "/" + bucket_name + "/?website";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::SetBucketWebsite(const std::string& bucket_name,
                                   const std::string& index_page,
                                   const std::string& error_page) {
  SetBucketWebsiteRequest request(bucket_name, index_page, error_page);
  return SetBucketWebsite(request);
}

Status OssClient::DeleteBucketWebsite(const std::string& bucket_name) {
  return DeleteBucketConfig(bucket_name, "website");
}

Status OssClient::GetBucketCors(const std::string& bucket_name,
                                GetBucketCorsResult* result) {
  HttpEngineInput engine_input;
  engine_input.method = kHttpGet;
  engine_input.url = bucket_name + "." + endpoint_ + "/?cors";
  auto resource = "/" + bucket_name + "/?cors";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  Status status = engine_output.ToStatus();
  if (status.Ok()) {
    if (!result->DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    }
  }

  return status;
}

Status OssClient::SetBucketCors(const SetBucketCorsRequest& request) {
  auto& bucket_name = request.GetBucketName();

  HttpEngineInput engine_input;
  auto body = request.SerializeToXml();
  engine_input.input_buffer = &body;
  engine_input.method = kHttpPut;
  engine_input.url = bucket_name + "." + endpoint_ + "/?cors";
  auto resource = "/" + bucket_name + "/?cors";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::DeleteBucketCors(const std::string& bucket_name) {
  return DeleteBucketConfig(bucket_name, "cors");
}

Status OssClient::GetBucketReferer(const std::string& bucket_name,
                                   GetBucketRefererResult* result) {
  HttpEngineInput engine_input;
  engine_input.method = kHttpGet;
  engine_input.url = bucket_name + "." + endpoint_ + "/?referer";
  auto resource = "/" + bucket_name + "/?referer";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    if (!result->DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    }
  }

  return status;
}

Status OssClient::SetBucketReferer(const SetBucketRefererRequest& request) {
  auto& bucket_name = request.GetBucketName();

  HttpEngineInput engine_input;
  auto body = request.SerializeToXml();
  engine_input.input_buffer = &body;
  engine_input.method = kHttpPut;
  engine_input.url = bucket_name + "." + endpoint_ + "/?referer";
  auto resource = "/" + bucket_name + "/?referer";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::GetBucketLifecycle(const std::string& bucket_name,
                                     GetBucketLifecycleResult* result) {
  HttpEngineInput engine_input;
  engine_input.method = kHttpGet;
  engine_input.url = bucket_name + "." + endpoint_ + "/?lifecycle";
  auto resource = "/" + bucket_name + "/?lifecycle";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    if (!result->DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    }
  }

  return status;
}

Status OssClient::SetBucketLifecycle(const SetBucketLifecycleRequest &request) {
  auto& bucket_name = request.GetBucketName();

  HttpEngineInput engine_input;
  auto body = request.SerializeToXml();
  engine_input.input_buffer = &body;
  engine_input.method = kHttpPut;
  engine_input.url = bucket_name + "." + endpoint_ + "/?lifecycle";
  auto resource = "/" + bucket_name + "/?lifecycle";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::DeleteBucketLifecycle(const std::string& bucket_name) {
  return DeleteBucketConfig(bucket_name, "lifecycle");
}

Status OssClient::CreateFolder(const std::string& bucket_name,
                               const std::string& folder_name) {
  auto new_folder_name = folder_name;
  if (!EndsWith(folder_name, "/")) {
    new_folder_name += "/";
  }
  return PutString(bucket_name, new_folder_name, "");
}

Status OssClient::ObjectExists(const std::string& bucket_name,
                               const std::string& key,
                               bool* exist) {
  std::unique_ptr<ObjectMetadata> object_meta_data;
  auto status = GetObjectMetadata(bucket_name, key, &object_meta_data);
  if (!status.Ok()) {
    if (status.ErrorCode() == oss_error_code::kNoSuchKey ||
        status.ErrorCode() == oss_error_code::kNoSuchBucket) {
      *exist = false;
      status.SetErrorCode("");
    } else {
      if (status.HttpStausCode() == 404) {
        *exist = false;
        status.SetErrorCode("");
      }
    }
  } else {
    *exist = true;
  }

  return status;
}

Status OssClient::PutString(const std::string& bucket_name,
                            const std::string& key,
                            const std::string& str,
                            const ObjectMetadata* object_metadata) {
  HttpEngineInput engine_input;
  engine_input.headers[oss::http::kContentType] = kObjectDefaultContentType;
  engine_input.method = kHttpPut;
  engine_input.url = bucket_name + "." + endpoint_ + "/" + UrlEscape(key);
  engine_input.input_buffer = &str;
  if (object_metadata != NULL)
    object_metadata->AddToParameterList(&engine_input.headers);
  auto resource = "/" + bucket_name + "/" + key;

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::PutObject(const std::string& bucket_name,
                            const std::string& key,
                            const std::string& file_path,
                            const ObjectMetadata* object_metadata) {
  return PutObject(bucket_name, key, file_path, -1, object_metadata);
}

Status OssClient::PutObject(const std::string& bucket_name,
                            const std::string& key,
                            const std::string& file_path,
                            int64_t stream_bytes,
                            const ObjectMetadata* object_metadata) {
  HttpEngineInput engine_input;
  engine_input.headers[oss::http::kContentType] = kObjectDefaultContentType;
  engine_input.method = kHttpPut;
  engine_input.url = bucket_name + "." + endpoint_ + "/" + UrlEscape(key);
  engine_input.input_filename = file_path;
  engine_input.stream_bytes = stream_bytes;
  if (object_metadata != NULL)
    object_metadata->AddToParameterList(&engine_input.headers);
  auto resource = "/" + bucket_name + "/" + key;

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::PutObject(const std::string& bucket_name,
                            const std::string& key,
                            std::ifstream* stream,
                            const ObjectMetadata* object_metadata) {
  return PutObject(bucket_name, key, stream, -1, object_metadata);
}

Status OssClient::PutObject(const std::string& bucket_name,
                            const std::string& key,
                            std::ifstream* stream,
                            int64_t stream_bytes,
                            const ObjectMetadata* object_metadata) {
  HttpEngineInput engine_input;
  engine_input.headers[oss::http::kContentType] = kObjectDefaultContentType;
  engine_input.method = kHttpPut;
  engine_input.url = bucket_name + "." + endpoint_ + "/" + UrlEscape(key);
  engine_input.input_stream = stream;
  engine_input.stream_bytes = stream_bytes;
  if (object_metadata != NULL)
    object_metadata->AddToParameterList(&engine_input.headers);
  auto resource = "/" + bucket_name + "/" + key;

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::DeleteObject(const std::string& bucket_name,
                               const std::string& key) {
  HttpEngineInput engine_input;
  engine_input.method = kHttpDelete;
  engine_input.url = bucket_name + "." + endpoint_ + "/" + UrlEscape(key);
  auto resource = "/" + bucket_name + "/" + key;

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::DeleteMultipleObjects(
  const DeleteMultipleObjectsRequest& request,
  DeleteMultipleObjectsResult* result) {
  auto& bucket_name = request.GetBucketName();
  auto body = request.SerializeToXml();
  auto digest = AprBase64Encode(AprComputeMd5(body));

  HttpEngineInput engine_input;
  engine_input.headers[http::kContentMd5] = digest;
  engine_input.input_buffer = &body;
  engine_input.method = kHttpPost;
  engine_input.url = bucket_name + "." + endpoint_ + "/?delete";
  auto resource = "/" + bucket_name + "/?delete";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  Status status = engine_output.ToStatus();
  if (status.Ok()) {
    if (!result->DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    }
  }

  return status;
}

Status OssClient::OptionObject(const OptionObjectRequest& request,
                               OptionObjectResult* result) {
  auto& bucket_name = request.GetBucketName();

  HttpEngineInput engine_input;
  engine_input.headers["Origin"] = request.GetOrigin();
  engine_input.headers["Access-Control-Request-Method"]
    = request.GetRequestMethod();
  engine_input.headers["Access-Control-Request-Headers"]
    = request.GetRequestHeaders();

  engine_input.method = kHttpOptions;
  engine_input.url = bucket_name + "." + endpoint_ + "/" +
                     UrlEscape(request.GetKey());
  auto resource = "/" + request.GetKey();

  auto engine_output = ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    result->ParseFromHeader(engine_output.headers);
  }

  return status;
}

Status OssClient::CopyObject(const CopyObjectRequest& request,
                             CopyObjectResult* result) {
  auto& bucket_name = request.GetTargetBucket();
  auto& key = request.GetTargetKey();

  HttpEngineInput engine_input;
  request.AddToParameterList(&engine_input.headers);
  engine_input.method = kHttpPut;
  engine_input.content_type = kObjectDefaultContentType;
  // resource should be target.
  engine_input.url = bucket_name + "." + endpoint_ + "/" +  UrlEscape(key);
  auto resource = "/" + bucket_name + "/" + key;

  auto engine_output = ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    if (!result->DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    }
  }

  return status;
}

Status OssClient::GetObject(const GetObjectRequest & request) {
  auto& bucket_name = request.GetBucket();
  auto& key = request.GetKey();

  HttpEngineInput engine_input;
  request.AddToParameterList(&engine_input.headers);
  engine_input.method = kHttpGet;
  engine_input.url = bucket_name + "." + endpoint_ + "/" + UrlEscape(key);
  auto resource = "/" + bucket_name + "/" + key;

  engine_input.output_path = request.GetFilePath();
  engine_input.output_stream = request.GetOutputStream();

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::ListBuckets(const ListBucketsRequest& request,
                              ListBucketsResult* result) {
  HttpEngineInput engine_input;
  request.AddToParameterList(&engine_input.headers);
  engine_input.method = kHttpGet;
  engine_input.url = endpoint_;
  auto resource = "/";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    if (!result->DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    }
  }

  return status;
}

Status OssClient::ListBuckets(std::vector<Bucket>* buckets) {
  ListBucketsRequest request;
  ListBucketsResult result;
  auto status = ListBuckets(request, &result);
  if (status.Ok()) {
    result.MutableBuckets().swap(*buckets);
  }

  return status;
}

Status OssClient::DeleteBucketConfig(const std::string& bucket_name,
                                     const std::string& config_name) {
  HttpEngineInput engine_input;
  engine_input.method = kHttpDelete;
  engine_input.url = bucket_name + "." + endpoint_ + "/" + "?" + config_name;
  auto resource = "/" + bucket_name + "/" + "?" + config_name;

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::ListObjects(const ListObjectsRequest& request,
                              ListObjectsResult* result) {
  auto& bucket_name = request.GetBucketName();
  // do not sign for this request.
  auto query_string = request.BuildQueryString();

  HttpEngineInput engine_input;
  engine_input.method = kHttpGet;
  engine_input.url = bucket_name + "." + endpoint_ + "/?" + query_string;
  auto resource = "/" + bucket_name + "/";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    if (!result->DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    }
  }

  return status;
}

Status OssClient::InitiateMultipartUpload(
  const InitiateMultipartUploadRequest& request,
  InitiateMultipartUploadResult* result) {
  auto& bucket_name = request.GetBucketName();
  // must sign query parameters for this request.
  auto query_string = request.BuildQueryString();

  HttpEngineInput engine_input;
  engine_input.method = kHttpPost;
  // add query_string to resource to sign.
  engine_input.url = bucket_name + "." + endpoint_ + "/" + query_string;
  auto resource = "/" + bucket_name + "/" + query_string;

  auto engine_output = ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    if (!result->DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    }
  }

  return status;
}

Status OssClient::UploadPart(const UploadPartRequest& request,
                             UploadPartResult* result) {
  auto& bucket_name = request.GetBucketName();
  // must sign for this request.
  auto query_string = request.BuildQueryString();

  HttpEngineInput engine_input;
  if (!request.GetMd5Digest().empty()) {
    engine_input.headers[http::kContentMd5] = request.GetMd5Digest();
  }

  engine_input.method = kHttpPut;
  engine_input.headers[oss::http::kContentType] = kObjectDefaultContentType;
  engine_input.url = bucket_name + "." + endpoint_ + "/" + query_string;
  auto resource = "/" + bucket_name + "/" + query_string;

  engine_input.input_stream = request.GetInputStream();
  engine_input.stream_bytes = request.GetPartSize();

  auto engine_output =  ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    result->ParseFromHeader(engine_output.headers);
  }

  return status;
}

Status OssClient::AppendObject(const AppendObjectRequest& request) {
  auto& bucket_name = request.GetBucketName();
  // must sign for this request.
  auto query_string = request.BuildQueryString();
  HttpEngineInput engine_input;
  engine_input.method = kHttpPost;
  engine_input.headers[oss::http::kContentType] = kObjectDefaultContentType;
  engine_input.content_type = kObjectDefaultContentType;
  engine_input.url = bucket_name + "." + endpoint_ + "/" + query_string;
  auto resource = "/" + bucket_name + "/" + query_string;
  engine_input.input_filename = request.GetFilePath();

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::AppendObject(const AppendObjectRequest& request,
                               const ObjectMetadata* object_metadata) {
  AppendObjectResult result;
  return AppendObject(request, object_metadata, &result);
}

Status OssClient::AppendObject(const AppendObjectRequest& request,
                               const ObjectMetadata* object_metadata,
                               AppendObjectResult* result) {
  auto& bucket_name = request.GetBucketName();
  // must sign for this request.
  std::string query_string = request.BuildQueryString();
  HttpEngineInput engine_input;
  engine_input.method = kHttpPost;
  engine_input.headers[oss::http::kContentType] = kObjectDefaultContentType;
  engine_input.content_type = kObjectDefaultContentType;
  engine_input.url = bucket_name + "." + endpoint_ + "/" + query_string;
  if (object_metadata != NULL)
    object_metadata->AddToParameterList(&engine_input.headers);
  auto resource = "/" + bucket_name + "/" + query_string;
  engine_input.input_filename = request.GetFilePath();

  auto engine_output = ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    result->ParseFromHeader(engine_output.headers);
  }

  return engine_output.ToStatus();
}

Status OssClient::UploadPartCopy(const UploadPartCopyRequest& request,
                                 UploadPartCopyResult* result) {
  auto& bucket_name = request.GetTargetBucket();
  auto query_string = request.BuildQueryString();

  HttpEngineInput engine_input;
  request.AddToParameterList(&engine_input.headers);
  engine_input.method = kHttpPut;
  engine_input.headers[oss::http::kContentType] = kObjectDefaultContentType;
  engine_input.url = bucket_name + "." + endpoint_ + "/" + query_string;
  auto resource = "/" + bucket_name + "/" + query_string;

  auto engine_output = ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    if (!result->DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    }
  }

  return status;
}

Status OssClient::CompleteMultipartUpload(
  const CompleteMultipartUploadrequest& request,
  CompleteMultipartUploadResult* result) {
  auto& bucket_name = request.GetBucketName();
  // must sign for this request.
  auto query_string = request.BuildQueryString();
  auto body = request.SerializeToXml();

  HttpEngineInput engine_input;
  engine_input.input_buffer = &body;
  engine_input.method = kHttpPost;
  engine_input.url = bucket_name + "." + endpoint_ + "/" + query_string;
  auto resource = "/" + bucket_name + "/" + query_string;

  auto engine_output = ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    if (!result->DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    }
  }

  return status;
}

Status OssClient::AbortMultipartUpload(const std::string& bucket_name,
                                       const std::string& key,
                                       const std::string& upload_id) {
  auto query_string = key + "?uploadId=" + upload_id;

  HttpEngineInput engine_input;
  engine_input.method = kHttpDelete;
  engine_input.url = bucket_name + "." + endpoint_ + "/" + query_string;
  auto resource = "/" + bucket_name + "/" + query_string;

  auto engine_output = ExecuteHttp(&engine_input, resource);
  return engine_output.ToStatus();
}

Status OssClient::ListMultipartUploads(
  const ListMultipartUploadsRequest& request,
  ListMultipartUploadsResult* result) {
  auto& bucket_name = request.GetBucketName();
  HttpEngineInput engine_input;

  request.AddToParameterList(&engine_input.headers);
  engine_input.method = kHttpGet;
  engine_input.url = bucket_name + "." + endpoint_ + "/?uploads";
  auto resource = "/" + bucket_name + "/?uploads";

  auto engine_output = ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    if (!result->DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    }
  }

  return status;
}

Status OssClient::ListParts(const ListPartsRequest& request,
                            ListPartsResult* result) {
  auto& bucket_name = request.GetBucketName();
  auto& key = request.GetKey();
  const auto upload_id = request.GetUploaId();
  auto url_parameters = key + "?uploadId=" + upload_id;

  HttpEngineInput engine_input;
  engine_input.method = kHttpGet;
  auto resource = "/" + bucket_name + "/" + url_parameters;
  engine_input.url = bucket_name + "." + endpoint_ + "/"
                     + UrlEscape(key) + "?" + request.BuildQueryString();

  auto engine_output = ExecuteHttp(&engine_input, resource);
  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    if (!result->DeserializeFromXml(engine_output.response)) {
      status.SetErrorCode(oss_error_code::kParseXmlFailed);
    }
  }

  return status;
}

Status OssClient::GetObjectMetadata(
  const std::string& bucket_name,
  const std::string& key,
  std::unique_ptr<ObjectMetadata>* object_meta_data) {
  HttpEngineInput engine_input;
  engine_input.method = "HEAD";
  engine_input.url = bucket_name + "." + endpoint_ + "/" + UrlEscape(key);
  auto resource = "/" + bucket_name + "/" + key;

  auto engine_output = ExecuteHttp(&engine_input, resource);

  auto status = engine_output.ToStatus();
  if (status.Ok()) {
    (*object_meta_data).reset(new ObjectMetadata);
    (*object_meta_data)->SetMetadata(engine_output.headers);
  }

  return status;
}

std::string OssClient::CalculateAuthorization(const std::string& resource,
    const HttpEngineInput& input) {

  auto authorizatoin =
    BuildOssAuthorization(access_key_secret_,
                          access_key_id_,
                          input.method,
                          input.gmt_datetime,
                          resource,
                          input.headers);

  return authorizatoin;
}

HttpEngineOutput OssClient::ExecuteHttp(HttpEngineInput* input,
                                        const std::string& resource) {
  // prepend protocol to url.
  input->url.insert(0, protocol_);
  std::string authorization = CalculateAuthorization(resource, *input);
  input->headers[http::kAuthorization] = authorization;

  auto output = engine_->Execute(input);
  if (output.http_status_code == 0) {
    // error happened before http query.
    return output;
  }

  // http query succeed.
  if (output.http_status_code == 200 ||
      output.http_status_code == 201 ||
      output.http_status_code == 204 ||
      output.http_status_code == 206) {
    return output;
  }

  // http query failed.
  if (output.response.empty()) {
    // failed, but no error message.
  }

  // parse error message.
  if (!output.oss_exception.FromXml(output.response)) {
    output.code = oss_error_code::kParseXmlFailed;
  } else {
    output.code = output.oss_exception.GetCode();
  }

  if (unit_test_mode_) {
    output.code = "";
  }

  return output;
}

void OssClient::ParseEndpoint(const std::string& endpoint) {
  std::string new_endpoint;
  TrimWhiteSpaces(endpoint, &new_endpoint);
  if (StartsWith(new_endpoint, kHttps)) {
    protocol_ = kHttps;
    endpoint_ = new_endpoint.substr(strlen(kHttps));
  } else if (StartsWith(new_endpoint, kHttp)) {
    protocol_ = kHttp;
    endpoint_ = new_endpoint.substr(strlen(kHttp));
  } else {
    protocol_ = kHttp;
    endpoint_ = new_endpoint;
  }
}

void OssClient::SetEndpoint(const std::string& endpoint) {
  ParseEndpoint(endpoint);
}

void OssClient::SetUnitTestMode() {
  unit_test_mode_ = true;
  if (engine_) {
    engine_->SetUnitTestMode();
  }
}

}  // namespace oss


text:
package org.locationtech.geomesa.raster.index

import org.apache.hadoop.io.Text
import org.joda.time.DateTime
import org.locationtech.geomesa.accumulo.index.TextFormatter
import org.locationtech.geomesa.raster._
import org.locationtech.geomesa.utils.geohash.GeoHash
import org.opengis.feature.simple.SimpleFeature

/**
 * Responsible for representing the resolution by encoding a double lexicographically.
 *
 * @param number
 */
case class DoubleTextFormatter(number: Double) extends TextFormatter {
  val fmtdStr: String = lexiEncodeDoubleToString(number)
  val numBits: Int = fmtdStr.length
  def formatString(gh: GeoHash, dt: DateTime, sf: SimpleFeature) = fmtdStr

  override def format(gh: GeoHash, dt: DateTime, sf: SimpleFeature, isIndex: Boolean): Text = new Text(fmtdStr)
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0.0"
          package="com.yourcompany.cocosjucesharedlib">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true"/>
  <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="11"/>
  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
  <application android:label="@string/app_name" android:hardwareAccelerated="false">
    <activity android:name="JuceActivity" android:label="@string/app_name" android:configChanges="keyboardHidden|orientation">
      <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>
    </activity>
  </application>
</manifest>


text:
'''HiFive1-specific (flash only) runner.'''

from os import path

from runners.core import ZephyrBinaryRunner, RunnerCaps

class HiFive1BinaryRunner(ZephyrBinaryRunner):
    '''Runner front-end for the HiFive1 board, using openocd.'''

    def __init__(self, cfg):
        super().__init__(cfg)
        self.openocd_config = path.join(cfg.board_dir, 'support', 'openocd.cfg')

    @classmethod
    def name(cls):
        return 'hifive1'

    @classmethod
    def capabilities(cls):
        return RunnerCaps(commands={'flash'})

    @classmethod
    def do_add_parser(cls, parser):
        pass

    @classmethod
    def do_create(cls, cfg, args):
        if cfg.gdb is None:
            raise ValueError('--gdb not provided at command line')

        return HiFive1BinaryRunner(cfg)

    def do_run(self, command, **kwargs):
        self.require(self.cfg.openocd)
        self.require(self.cfg.gdb)
        openocd_cmd = ([self.cfg.openocd, '-f', self.openocd_config])
        gdb_cmd = ([self.cfg.gdb, self.cfg.elf_file, '--batch',
                    '-ex', 'set remotetimeout 240',
                    '-ex', 'target extended-remote localhost:3333',
                    '-ex', 'load',
                    '-ex', 'quit'])
        self.run_server_and_client(openocd_cmd, gdb_cmd)


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
SpaceSpecifier (Apache FOP 2.1 API)
</TITLE>

<META NAME="date" CONTENT="2016-01-07">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

fop 2.1

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.apache.fop.layoutmgr

Class SpaceSpecifier

java.lang.Object
  org.apache.fop.layoutmgr.SpaceSpecifier

All Implemented Interfaces:
java.lang.Cloneable

public class SpaceSpecifier
extends java.lang.Object
implements java.lang.Cloneable

Accumulate a sequence of space-specifiers (XSL space type) on
 areas with a stacking constraint. Provide a way to resolve these into
 a single MinOptMax value.

Constructor Summary

SpaceSpecifier(boolean startsReferenceArea)

          Creates a new SpaceSpecifier.

Method Summary

 void
addSpace(SpaceVal space)

          Add a new space to the sequence.

 void
clear()

          Clear all space specifiers

 java.lang.Object
clone()

 boolean
hasSpaces()

          Indicates whether any space-specifiers have been added.

 MinOptMax
resolve(boolean endsReferenceArea)

          Resolve the current sequence of space-specifiers, accounting for forcing values.

 java.lang.String
toString()

Methods inherited from class java.lang.Object

equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

SpaceSpecifier

public SpaceSpecifier(boolean startsReferenceArea)

Creates a new SpaceSpecifier.

Parameters:
startsReferenceArea - true if it starts a new reference area

Method Detail

clone

public java.lang.Object clone()

Overrides:
clone in class java.lang.Object

clear

public void clear()

Clear all space specifiers

hasSpaces

public boolean hasSpaces()

Indicates whether any space-specifiers have been added.

Returns:
true if any space-specifiers have been added.

addSpace

public void addSpace(SpaceVal space)

Add a new space to the sequence. If this sequence starts a reference
 area, and the added space is conditional, and there are no
 non-conditional values in the sequence yet, then ignore it. Otherwise
 add it to the sequence.

Parameters:
space - the space to add.

resolve

public MinOptMax resolve(boolean endsReferenceArea)

Resolve the current sequence of space-specifiers, accounting for forcing values.

Parameters:
endsReferenceArea - whether the sequence should be resolved at the trailing edge of
                          reference area.

Returns:
the resolved value as a min/opt/max triple.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

fop 2.1

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Copyright 1999-2016 The Apache Software Foundation. All Rights Reserved.


text:
<?php
namespace trifs\DIServer;

use \trifs\DIServer\Log;
use \trifs\DIServer\Log\ApiFormatter;
use \trifs\DIServer\Log\SyslogWriter;
use \trifs\DIServer\Request;
use \trifs\DIServer\Response;
use \trifs\DIServer\Server;
use \trifs\DI\Container;
use \trifs\DI\ServiceProviderInterface;

/**
 * Adds default set of DIServer's dependencies to DI
 */
class ServiceProvider implements ServiceProviderInterface
{
    /**
     * @var int
     */
    protected $idLength = 16;

    /**
     * @param \trifs\DI\Container
     * @return void
     */
    public function register(Container $app)
    {
        // add server
        $app->server = function ($app) {
            return new Server($app);
        };

        // add request
        // TODO: clean up
        $app->request = function ($app) {
            $requestUri    = $_SERVER['REQUEST_URI'];
            $requestMethod = $_SERVER['REQUEST_METHOD'];

            // parse request headers
            $requestHeaders = array_reduce(
                array_keys($_SERVER),
                function ($acc, $key) {
                    if (substr($key, 0, 5) === 'HTTP_') {
                        $cleanKey = str_replace(['HTTP_', '_'], ['', ' '], $key);
                        $cleanKey = str_replace(' ', '-', ucwords(strtolower($cleanKey)));
                        $acc[$cleanKey] = $_SERVER[$key];
                    }
                    return $acc;
                },
                []
            );

            return new Request(
                $requestMethod,
                $requestUri,
                file_get_contents('php://input'),
                $_GET ?: [],
                $requestHeaders
            );
        };

        // add response
        $app->response = function ($app) {
            return new Response;
        };

        // add log
        $app->log = function ($app) {
            return new Log(
                new ApiFormatter($app),
                new SyslogWriter($app),
                LOG_DEBUG
            );
        };

        // add requestId
        $app->register(new RequestIdServiceProvider);
    }
}


text:
package mat64

import (
	"math"

	"github.com/gonum/blas"
	"github.com/gonum/blas/blas64"
	"github.com/gonum/lapack/lapack64"
	"github.com/gonum/matrix"
)

// LQ is a type for creating and using the LQ factorization of a matrix.
type LQ struct {
	lq   *Dense
	tau  []float64
	cond float64
}

func (lq *LQ) updateCond() {
	// A = LQ, where Q is orthonormal. Orthonormal multiplications do not change
	// the condition number. Thus, ||A|| = ||L|| ||Q|| = ||Q||.
	m := lq.lq.mat.Rows
	work := make([]float64, 3*m)
	iwork := make([]int, m)
	l := lq.lq.asTriDense(m, blas.NonUnit, blas.Lower)
	v := lapack64.Trcon(matrix.CondNorm, l.mat, work, iwork)
	lq.cond = 1 / v
}

// Factorize computes the LQ factorization of an m×n matrix a where n <= m. The LQ
// factorization always exists even if A is singular.
//
// The LQ decomposition is a factorization of the matrix A such that A = L * Q.
// The matrix Q is an orthonormal n×n matrix, and L is an m×n upper triangular matrix.
// L and Q can be extracted from the LFromLQ and QFromLQ methods on Dense.
func (lq *LQ) Factorize(a Matrix) {
	m, n := a.Dims()
	if m > n {
		panic(matrix.ErrShape)
	}
	k := min(m, n)
	if lq.lq == nil {
		lq.lq = &Dense{}
	}
	lq.lq.Clone(a)
	work := make([]float64, 1)
	lq.tau = make([]float64, k)
	lapack64.Gelqf(lq.lq.mat, lq.tau, work, -1)
	work = make([]float64, int(work[0]))
	lapack64.Gelqf(lq.lq.mat, lq.tau, work, len(work))
	lq.updateCond()
}

// TODO(btracey): Add in the "Reduced" forms for extracting the m×m orthogonal
// and upper triangular matrices.

// LFromLQ extracts the m×n lower trapezoidal matrix from a LQ decomposition.
func (m *Dense) LFromLQ(lq *LQ) {
	r, c := lq.lq.Dims()
	m.reuseAs(r, c)

	// Disguise the LQ as a lower triangular
	t := &TriDense{
		mat: blas64.Triangular{
			N:      r,
			Stride: lq.lq.mat.Stride,
			Data:   lq.lq.mat.Data,
			Uplo:   blas.Lower,
			Diag:   blas.NonUnit,
		},
		cap: lq.lq.capCols,
	}
	m.Copy(t)

	if r == c {
		return
	}
	// Zero right of the triangular.
	for i := 0; i < r; i++ {
		zero(m.mat.Data[i*m.mat.Stride+r : i*m.mat.Stride+c])
	}
}

// QFromLQ extracts the n×n orthonormal matrix Q from an LQ decomposition.
func (m *Dense) QFromLQ(lq *LQ) {
	r, c := lq.lq.Dims()
	m.reuseAs(c, c)

	// Set Q = I.
	for i := 0; i < c; i++ {
		v := m.mat.Data[i*m.mat.Stride : i*m.mat.Stride+c]
		zero(v)
		v[i] = 1
	}

	// Construct Q from the elementary reflectors.
	h := blas64.General{
		Rows:   c,
		Cols:   c,
		Stride: c,
		Data:   make([]float64, c*c),
	}
	qCopy := getWorkspace(c, c, false)
	v := blas64.Vector{
		Inc:  1,
		Data: make([]float64, c),
	}
	for i := 0; i < r; i++ {
		// Set h = I.
		zero(h.Data)
		for j := 0; j < len(h.Data); j += c + 1 {
			h.Data[j] = 1
		}

		// Set the vector data as the elementary reflector.
		for j := 0; j < i; j++ {
			v.Data[j] = 0
		}
		v.Data[i] = 1
		for j := i + 1; j < c; j++ {
			v.Data[j] = lq.lq.mat.Data[i*lq.lq.mat.Stride+j]
		}

		// Compute the multiplication matrix.
		blas64.Ger(-lq.tau[i], v, v, h)
		qCopy.Copy(m)
		blas64.Gemm(blas.NoTrans, blas.NoTrans,
			1, h, qCopy.mat,
			0, m.mat)
	}
}

// SolveLQ finds a minimum-norm solution to a system of linear equations defined
// by the matrices A and b, where A is an m×n matrix represented in its LQ factorized
// form. If A is singular or near-singular a Condition error is returned. Please
// see the documentation for Condition for more information.
//
// The minimization problem solved depends on the input parameters.
//  If trans == false, find the minimum norm solution of A * X = b.
//  If trans == true, find X such that ||A*X - b||_2 is minimized.
// The solution matrix, X, is stored in place into the receiver.
func (m *Dense) SolveLQ(lq *LQ, trans bool, b Matrix) error {
	r, c := lq.lq.Dims()
	br, bc := b.Dims()

	// The LQ solve algorithm stores the result in-place into the right hand side.
	// The storage for the answer must be large enough to hold both b and x.
	// However, this method's receiver must be the size of x. Copy b, and then
	// copy the result into m at the end.
	if trans {
		if c != br {
			panic(matrix.ErrShape)
		}
		m.reuseAs(r, bc)
	} else {
		if r != br {
			panic(matrix.ErrShape)
		}
		m.reuseAs(c, bc)
	}
	// Do not need to worry about overlap between m and b because x has its own
	// independent storage.
	x := getWorkspace(max(r, c), bc, false)
	x.Copy(b)
	t := lq.lq.asTriDense(lq.lq.mat.Rows, blas.NonUnit, blas.Lower).mat
	if trans {
		work := make([]float64, 1)
		lapack64.Ormlq(blas.Left, blas.NoTrans, lq.lq.mat, lq.tau, x.mat, work, -1)
		work = make([]float64, int(work[0]))
		lapack64.Ormlq(blas.Left, blas.NoTrans, lq.lq.mat, lq.tau, x.mat, work, len(work))

		ok := lapack64.Trtrs(blas.Trans, t, x.mat)
		if !ok {
			return matrix.Condition(math.Inf(1))
		}
	} else {
		ok := lapack64.Trtrs(blas.NoTrans, t, x.mat)
		if !ok {
			return matrix.Condition(math.Inf(1))
		}
		for i := r; i < c; i++ {
			zero(x.mat.Data[i*x.mat.Stride : i*x.mat.Stride+bc])
		}
		work := make([]float64, 1)
		lapack64.Ormlq(blas.Left, blas.Trans, lq.lq.mat, lq.tau, x.mat, work, -1)
		work = make([]float64, int(work[0]))
		lapack64.Ormlq(blas.Left, blas.Trans, lq.lq.mat, lq.tau, x.mat, work, len(work))
	}
	// M was set above to be the correct size for the result.
	m.Copy(x)
	putWorkspace(x)
	if lq.cond > matrix.ConditionTolerance {
		return matrix.Condition(lq.cond)
	}
	return nil
}

// SolveLQVec finds a minimum-norm solution to a system of linear equations.
// Please see Dense.SolveLQ for the full documentation.
func (v *Vector) SolveLQVec(lq *LQ, trans bool, b *Vector) error {
	if v != b {
		v.checkOverlap(b.mat)
	}
	r, c := lq.lq.Dims()
	// The Solve implementation is non-trivial, so rather than duplicate the code,
	// instead recast the Vectors as Dense and call the matrix code.
	if trans {
		v.reuseAs(r)
	} else {
		v.reuseAs(c)
	}
	return v.asDense().SolveLQ(lq, trans, b.asDense())
}


text:
const merge = require('lodash.merge')

const postJson = require('../fixtures/post')
const effect = require('../../src/effects/flattenRenderedProps')

describe('flattenRenderedProps', () => {
  it('transforms', () => {
    const hasRendered = ['guid', 'title', 'content', 'excerpt']
    const result = effect(postJson, merge({}, postJson))
    const flattenedCount = hasRendered.reduce((i, k) => {
      return typeof result[k] === 'string' ? i + 1 : i
    }, 0)
    expect(flattenedCount).toBe(hasRendered.length)
  })
})


text:
<?php
namespace WoohooLabs\SpecGenerator\Swagger2\Schema;

use WoohooLabs\SpecGenerator\Swagger2\Items\ItemsInterface;

class ArraySchema extends AbstractExtendedSchema
{
    use ArraySchemaTrait;

    /**
     * @param \WoohooLabs\SpecGenerator\Swagger2\Items\ItemsInterface $items
     * @return $this
     */
    public static function create(ItemsInterface $items = null)
    {
        return new self($items);
    }

    /**
     * @param \WoohooLabs\SpecGenerator\Swagger2\Items\ItemsInterface $items
     */
    public function __construct(ItemsInterface $items = null)
    {
        parent::__construct("array");
        $this->setItems($items);
    }

    /**
     * @return array
     */
    public function generate()
    {
        return array_merge($this->generateExtendedSchema(), $this->generateArraySchema());
    }
}


text:
namespace NationalIdValidation
{
    /// <summary>
    /// The Swedish id-convention caters several different numbering systems
    /// The id-type let's you know what id-convention is used
    /// Your application is itself responsible for following other business rules based on type
    /// </summary>
    public enum SwedishPersonalIdType
    {
        /// <summary>
        /// Unknown
        /// </summary>
        Unknown,
        /// <summary>
        /// Officially assigned birth number
        /// </summary>
        BirthNumber,
        /// <summary>
        /// Officially assigned coordination number
        /// </summary>
        CoordinationNumber,
        /// <summary>
        /// Officially assigned organization number
        /// </summary>
        /// <remarks>Added here for completeness as this uses the same algorithm as the personal ids</remarks>
        OrganizationNumber
    }
}


text:
var Dota2 = require("../index"),
    merge = require("merge"),
    util = require("util"),
    protoMask = 0x80000000;

// Methods

Dota2.Dota2Client.prototype.findSourceTVGames = function(filterOptions, callback) {
    callback = callback || null;
    /* Sends a message to the Game Coordinator requesting `accountId`'s profile data.  Listen for `profileData` event for Game Coordinator's response. */
    if (!this._gcReady) {
        if (this.debug) util.log("GC not ready, please listen for the 'ready' event.");
        return null;
    }

    if (this.debug) util.log("Sending find SourceTV games request");

    /* Using default params and merging with filterOptions, note: numGames is ignored from GC and > 6 causes no response at all */
    var payload = new Dota2.schema.CMsgFindSourceTVGames(merge({
        searchKey: '',
        start: 0,
        numGames: 6,
        leagueid: 0,
        heroid: 0,
        teamGame: false,
        customGameId: 0,
    },filterOptions));

    this._client.toGC(this._appid, (Dota2.EDOTAGCMsg.k_EMsgGCFindSourceTVGames | protoMask), payload.toBuffer(), callback);
};

// Handlers

var handlers = Dota2.Dota2Client.prototype._handlers;

handlers[Dota2.EDOTAGCMsg.k_EMsgGCSourceTVGamesResponse] = function onSourceTVGamesResponse(message, callback) {
    callback = callback || null;

    var sourceTVGamesResponse = Dota2.schema.CMsgSourceTVGamesResponse.decode(message);

    if (typeof sourceTVGamesResponse.games !== "undefined" && sourceTVGamesResponse.games.length > 0) {
        if (this.debug) util.log("Received SourceTV games data");
        if (callback) callback(sourceTVGamesResponse);
    }
    else {
        if (this.debug) util.log("Received a bad SourceTV games response");
        if (callback) callback(sourceTVGamesResponse.result, sourceTVGamesResponse);
    }
};


text:
<?php
$lang['application_account_details'] = "Kontodetaljer";
$lang['application_action'] = "Handling";
$lang['application_active'] = "Aktiv";
$lang['application_add_item'] = "Legg til element";
$lang['application_add_media'] = "Legg til media";
$lang['application_add_new_client'] = "New Client";
$lang['application_add_task'] = "Lag ny oppgave";
$lang['application_add_to_quick_access'] = "Legg til i favoritter";
$lang['application_address'] = "Adresse";
$lang['application_admin'] = "Admin";
$lang['application_all_clients'] = "Alle Kunder";
$lang['application_all_invoices'] = "Alle Fakturaer";
$lang['application_invoice'] = "Faktura";
$lang['application_all_items'] = "All Items";
$lang['application_all_projects'] = "Alle Prosjekter";
$lang['application_all_users'] = "Alle Brukere";
$lang['application_always_make_backup'] = "Always make a backup before updating!";
$lang['application_back'] = "Tilbake";
$lang['application_backup_database'] = "Backup Database";
$lang['application_backup_file_zip'] = "Database Backup (.zip file)";
$lang['application_change_password'] = "Change Password";
$lang['application_check_for_updates'] = "Se etter oppdatering";
$lang['application_city'] = "By";
$lang['application_client'] = "Kunde";
$lang['application_client_details'] = "Kundedetaljer";
$lang['application_client_id'] = "Kunde ID";
$lang['application_client_reference'] = "Kundereferanse";
$lang['application_clients'] = "Kunder";
$lang['application_closed_projects'] = "Closed Projects";
$lang['application_company'] = "Firma";
$lang['application_company_name'] = "Firmanavn";
$lang['application_confirm_password'] = "Gjenta Passord";
$lang['application_contact'] = "Kontakt";
$lang['application_contact_person'] = "Contact Person";
$lang['application_create_invoice'] = "Ny Faktura";
$lang['application_create_item'] = "Legg til nytt element";
$lang['application_create_new_project'] = "Start nytt prosjekt";
$lang['application_create_project'] = "Nytt Prosjekt";
$lang['application_create_user'] = "Ny Bruker";
$lang['application_created_on'] = "Opprettet";
$lang['application_currency'] = "Valuta";
$lang['application_dashboard'] = "Skrivebord";
$lang['application_date'] = "Dato";
$lang['application_date_format'] = "Datoformat";
$lang['application_deadline'] = "Deadline";
$lang['application_default_currency'] = "Standard Valutta";
$lang['application_default_invoice_terms'] = "Standard Fakturavilkår";
$lang['application_default_terms'] = "Standard Vilkår";
$lang['application_delete'] = "Slett";
$lang['application_description'] = "Beskrivelse";
$lang['application_domain'] = "Domene";
$lang['application_done'] = "Ferdig";
$lang['application_download'] = "Download";
$lang['application_due_date'] = "Forfallsdato";
$lang['application_edit'] = "Rediger";
$lang['application_edit_client'] = "Edit Client";
$lang['application_edit_invoice'] = "Endre Faktura";
$lang['application_edit_item'] = "Endre Element";
$lang['application_edit_media'] = "Edit Media";
$lang['application_edit_project'] = "Endre Prosjekt";
$lang['application_edit_task'] = "Endre Oppgave";
$lang['application_edit_this_project'] = "Edit this Project";
$lang['application_edit_user'] = "Endre Bruker";
$lang['application_email'] = "E-post";
$lang['application_email_login_details'] = "Send innlogginsdetaljer";
$lang['application_file'] = "File";
$lang['application_filename'] = "Filnavn";
$lang['application_from'] = "Fra";
$lang['application_full_name'] = "Navn";
$lang['application_hello'] = "Hello";
$lang['application_hold'] = "On Hold";
$lang['application_hours'] = "Hours";
$lang['application_hrs_qty'] = "Timer/Antall";
$lang['application_inactive'] = "Inaktiv";
$lang['application_info'] = "Info";
$lang['application_install'] = "Install";
$lang['application_invoice_date'] = "Invoice Date";
$lang['application_invoice_details'] = "Fakturadetaljer";
$lang['application_invoice_id'] = "Faktura ID";
$lang['application_invoice_items'] = "Faktura elementer";
$lang['application_invoice_mail_body'] = "Invoice Mail Body";
$lang['application_invoice_mail_subject'] = "Invoice Mail Subject";
$lang['application_invoice_number'] = "Invoice No";
$lang['application_invoices'] = "Fakturaer";
$lang['application_issue_date'] = "Sendt";
$lang['application_item'] = "Element";
$lang['application_items'] = "Elementer";
$lang['application_latest_messages'] = "Latest Messages";
$lang['application_loading'] = "Laster...";
$lang['application_login'] = "Logg inn";
$lang['application_login_details'] = "Login Details";
$lang['application_logo'] = "Logo";
$lang['application_media'] = "Media";
$lang['application_message'] = "Message";
$lang['application_minutes'] = "Minutes";
$lang['application_mobile'] = "Mobil";
$lang['application_my_invoices'] = "My Invoices";
$lang['application_my_projects'] = "My Projects";
$lang['application_name'] = "Navn";
$lang['application_no'] = "Nei";
$lang['application_no_client_assigned'] = "Ikke tildelt noen kunde";
$lang['application_no_items_yet'] = "No Items yet";
$lang['application_on'] = "on";
$lang['application_Open'] = "Åpen";
$lang['application_open'] = "Åpne";
$lang['application_open_invoices'] = "Ubetalte Fakturaer";
$lang['application_open_projects'] = "Aktive Prosjekter";
$lang['application_option'] = "Option";
$lang['application_outstanding_payments'] = "Utestående Betalinger";
$lang['application_overdue'] = "Overdue";
$lang['application_overview'] = "Overview";
$lang['application_Paid'] = "Betalt";
$lang['application_paid_invoices'] = "Paid Invoices";
$lang['application_password'] = "Passord";
$lang['application_payments'] = "Innbetalinger";
$lang['application_payments_received'] = "Payments Received";
$lang['application_phase'] = "Fase";
$lang['application_phases'] = "Faser";
$lang['application_phone'] = "Telefon";
$lang['application_post_message'] = "Post Message";
$lang['application_preview'] = "Forhåndsvis PDF";
$lang['application_previous_update_required'] = "Previous update required";
$lang['application_progress'] = "Fremgang";
$lang['application_project_details'] = "Prosjektdetaljer";
$lang['application_project_id'] = "Prosjekt ID";
$lang['application_project_name'] = "Prosjektnavn";
$lang['application_projects'] = "Prosjekt";
$lang['application_quantity_hours'] = "Antall/Timer";
$lang['application_quick_access'] = "Favoritter";
$lang['application_reference_id'] = "Referanse ID";
$lang['application_release_date'] = "Release Date";
$lang['application_remove_from_quick_access'] = "Remove from Quick Access";
$lang['application_remove_item_from_invoice'] = "Remove Item from Invoice";
$lang['application_reset_default'] = "Reset Default";
$lang['application_reset_timer'] = "Tilbakestill Tidtaker";
$lang['application_restore_backup'] = "Restore Backup";
$lang['application_restore_database'] = "Gjenopprett Database";
$lang['application_restore_notice'] = "Viktig! Alle data lagt til etter oppdatering vil bli slettet!";
$lang['application_save'] = "Lagre";
$lang['application_send_invoice_to_client'] = "Send faktura til kunde";
$lang['application_Sent'] = "Sendt";
$lang['application_sent_invoices'] = "Sendte Fakturaer";
$lang['application_settings'] = "Innstillinger";
$lang['application_short_tags'] = "Koder du kan bruke";
$lang['application_show_login_details'] = "Show Login Details";
$lang['application_start_date'] = "Start Dato";
$lang['application_start_timer'] = "Start Tidtaker";
$lang['application_statistics'] = "Statistikk Innbetalinger";
$lang['application_status'] = "Status";
$lang['application_stop_timer'] = "Stopp Tidtaker";
$lang['application_street'] = "Gate";
$lang['application_sub_total'] = "Beløp";
$lang['application_system_updates'] = "System Oppdateringer";
$lang['application_task_name'] = "Oppgavenavn";
$lang['application_tasks'] = "Oppgaver";
$lang['application_tax'] = "MVA";
$lang['application_terms'] = "Fakturavilkår";
$lang['application_time_spent'] = "Tid Brukt";
$lang['application_total'] = "Å Betale";
$lang['application_type'] = "Type";
$lang['application_unit_price'] = "Pris";
$lang['application_update'] = "Oppdatering";
$lang['application_upload_backup'] = "Last opp Backup Fil";
$lang['application_uploaded_by'] = "Lastet opp av";
$lang['application_uploaded_on'] = "Lastet opp den";
$lang['application_username'] = "Brukernavn";
$lang['application_users'] = "Brukere";
$lang['application_value'] = "Å Betale";
$lang['application_view_changelog'] = "Vis Changelog";
$lang['application_write_a_message'] = "Skriv en melding";
$lang['application_write_new_message'] = "Skriv en melding";
$lang['application_yes'] = "Ja";
$lang['application_zip_code'] = "Postnr";
$lang['application_assets'] = "assets";

$lang['application_quotations'] = "Forespørsler";
$lang['application_quotation'] = "Forespørsel";
$lang['application_all_qutations'] = "Alle Forespørsler";
$lang['application_quotation_id'] = "ID";
$lang['application_worker'] = "Tildelt";
$lang['application_answers'] = "Svar";
$lang['application_quotation_details'] = "Quotation Details";
$lang['application_quotation_add_client'] = "Add to Clients";
$lang['application_personal_info'] = "Personal Info";
$lang['application_edit_quotation'] = "Edit Quotation";
$lang['application_New'] = "New";
$lang['application_Reviewed'] = "Reviewed";
$lang['application_Accepted'] = "Accepted";
$lang['application_view_quotation_form'] = "Vis Forespørselskjema";

$lang['application_write_message'] = "Send ny melding";
$lang['application_messages'] = "Meldinger";
$lang['application_message'] = "Melding";
$lang['application_received'] = "Mottatt";
$lang['application_subject'] = "Emne";
$lang['application_to'] = "Til";
$lang['application_new_messages'] = "Nye Meldinger";
$lang['application_write_messages'] = "Skriv Melding";
$lang['application_edit_message'] = "Endre Melding Status";
$lang['application_replied_messages'] = "Svarte Meldinger";
$lang['application_read_messages'] = "Leste Meldinger";
$lang['application_reply'] = "Svar";
$lang['application_send'] = "Send";
$lang['application_New'] = "Ny";
$lang['application_Read'] = "Lest";
$lang['application_Replied'] = "Svart";

$lang['application_pay_via_paypal'] = "Betal med Paypal";
$lang['application_paypal'] = "Paypal";
$lang['application_paypal_currency'] = "Paypal Valuta";
$lang['application_paypal_active'] = "Aktiver Paypal";
$lang['application_paypal_account'] = "PayPal Konto";

$lang['application_lib'] = " ";
$lang['application_close'] = "Lukk";
$lang['application_all'] = "Alle";
$lang['application_closed'] = "Avsluttede";
$lang['application_Reviewed'] = "Vurdert";
$lang['application_Accepted'] = "Godtatt";
$lang['application_really_delete'] = "Er du sikker?";
$lang['application_yes_im_sure'] = "Ja jeg er sikker";
$lang['application_no_messages'] = "Ingen meldinger her...";
$lang['application_message_list_time'] = "g:i a";
$lang['application_message_list_date'] = "m/d";
$lang['application_date_time_format'] = "Tidsformat";
$lang['application_select'] = "Velg...";
$lang['application_reply'] = "Svar...";
$lang['application_messages_show_deleted'] = "Show Deleted Messages";
$lang['application_latest_media_comments'] = "Latest comments";
$lang['application_assigned_to'] = "Tildelt";
$lang['application_assign_to'] = "Tildelt...";
$lang['application_not_assigned'] = "Ikke tildelt";
$lang['application_assign_to_agents'] = "Tildel Agent";
$lang['application_select_agents'] = "Velg Aganter...";
$lang['application_save_and_add'] = "Lagre og legg til en ny";
$lang['application_task_public'] = "Synlig for kunde";
$lang['application_media_details'] = "Media Details";
$lang['application_title'] = "Tittel";
$lang['application_no_tasks_yet'] = "Ingen oppgaver ennå...";
$lang['application_website'] = "Webside";
$lang['application_category'] = "Kategori";
$lang['application_discount'] = "Rabatt";
$lang['application_custom_item'] = "Add custom item";
$lang['application_profile_picture'] = "Profilbilde (maks 180x180)";
$lang['application_templates'] = "Maler";
$lang['application_logs'] = "Logg";
$lang['application_updates'] = "Oppdateringer";
$lang['application_refresh'] = "Oppdater";
$lang['application_clear'] = "Slett";
$lang['application_invoice_email_template'] = "Faktura E-post";
$lang['application_credentials_email_template'] = "Brukerinformasjon";
$lang['application_default_language'] = "Standard Språk";
$lang['application_credentials_mail_subject'] = "Credentials Email Subject";
$lang['application_credentials_mail_body'] = "Credentials Email Body";
$lang['application_download_counter'] = "Download Counter";
$lang['application_reset_password'] = "Tilbakestill Passord";
$lang['application_go_to_login'] = "Gå til innlogging";
$lang['application_forgot_password'] = "Mistet passordet ditt?";
$lang['application_identify_account'] = "For å tilbakestille ditt passord, må du først bekrefte din konto.";
$lang['application_notification_new_message_subject'] = "Ny melding";
$lang['application_notification_new_message'] = "Du har fått en ny melding.";
$lang['application_notification_project_assign_subject'] = "Project Update";
$lang['application_notification_project_assign'] = "Project has been assigned to you.";
$lang['application_notification_quotation_subject'] = "Ny Forespørsel";
$lang['application_notification_quotation'] = "New quotation has been submitted.";
$lang['application_previous'] = "Forrige";
$lang['application_next'] = "Neste";
$lang['application_module_access'] = "Systemrettigheter";
$lang['application_quickaccess'] = "Favoritter";
$lang['application_last_login'] = "Sist Innlogget";
$lang['application_default_template'] = "Template";
$lang['application_user_online'] = "Brukere Pålogget";
$lang['application_mail_body'] = "E-post innhold";
$lang['application_pw_reset_email_template'] = "Nytt Passord";
$lang['application_pw_reset_link_email_template'] = "Nytt Passord Bekreftelse";
$lang['application_notification_email_template'] = "Varslinger";
$lang['application_recurring'] = "Recurring Invoice";
$lang['application_subscriptions'] = "Abonnementer";
$lang['application_frequency'] = "Faktuereringsperiode";
$lang['application_weekly'] = "Ukentlig";
$lang['application_every_other_week'] = "Annenhver Uke";
$lang['application_monthly'] = "Månedlig";
$lang['application_quarterly'] = "Kvartal";
$lang['application_semi_annually'] = "Hver 6 Måned";
$lang['application_annually'] = "Årlig";
$lang['application_create_subscription'] = "Lag nytt abonnement";
$lang['application_subscriptions'] = "Abonnementer";
$lang['application_subscription'] = "Abonnement";
$lang['application_subscription_id'] = "Abonnement ID";
$lang['application_next_payment'] = "Neste Betaling";
$lang['application_end_date'] = "Avslutter";
$lang['application_Active'] = "Aktiv";
$lang['application_Inactive'] = "Innaktiv";
$lang['application_subscription_has_ended'] = "Abonnementet er avsluttet";
$lang['application_new_invoice_required'] = "New invoice required";
$lang['application_subscribe_via_paypal'] = "Subscribe via Paypal";
$lang['application_edit_subscription'] = "Endre Abonnement";
$lang['application_subscription_details'] = "Abonnementsdetaljer";
$lang['application_subscription_items'] = "Abonnements Elementer";
$lang['application_new_invoice_needed'] = "New invoice need to be created.";
$lang['application_send_subscription_to_client'] = "Send Subscription to Client";
$lang['application_no_events_yet'] = "Er ikke så mye som har skjedd ennå...";
$lang['application_customize'] = "Customize";
$lang['application_media_preview'] = "Preview";
$lang['application_useronline'] = "User Online";
$lang['application_no_company_assigned'] = "No Company assigned";
$lang['application_company_id'] = "Firma ID";
$lang['application_primary_contact'] = "Primærkontakt";
$lang['application_contacts'] = "Kontakter";
$lang['application_company_details'] = "Firmadetaljer";
$lang['application_company'] = "Firma";
$lang['application_companies'] = "Firmaer";
$lang['application_add_new_company'] = "Legg til nytt firma";
$lang['application_edit_company'] = "Rediger Firma";
$lang['application_firstname'] = "Fornavn";
$lang['application_lastname'] = "Etternavn";
$lang['application_back_to_project'] = "Tilbake til prosjekt";
$lang['application_files'] = "Filer";
$lang['application_cronjob'] = "Cronjob";
$lang['application_backup'] = "Backup";
$lang['application_no_backups'] = "Du har ingen backup ennå";
$lang['application_database_backups'] = "Database Backups";
$lang['application_system_up_to_date'] = "Ditt system er up to date!";
$lang['application_client_has_no_contacts'] = "Denne kunden har ingen kontakter!";
$lang['application_add_new_contact'] = "Legg til kontakt";
$lang['application_cronjob_help'] = "This enables the cronjob feature if it is setup correctly. Please read the documentation for detailed information.";
$lang['application_cronjob_active'] = "Aktiver Cronjob";
$lang['application_cronjob_address'] = "Cronjob Link";
$lang['application_cronjob_address_help'] = "Use this link for your cronjob service provider. Please read the documentation for detailed information.";
$lang['application_last_cronjob_run'] = "Siste Cronjob Kjøring";
$lang['application_autobackup'] = "Automatisk Database Backup";
$lang['application_autobackup_help'] = "Creates a database backup every 7 days. Requires cronjob to be acttivated!";
$lang['application_cprojects'] = "Prosjekter";
$lang['application_cinvoices'] = "Fakturaer";
$lang['application_cmessages'] = "Meldinger";
$lang['application_csubscriptions'] = "Abonnementer";
$lang['application_download_invoice'] = "Download Invoice";
$lang['application_notification_payment_processed_subject'] = "Payment processed";
$lang['application_notification_payment_processed'] = "Payment of the following invoice has been processed:";
$lang['application_notification_subscribed_subject'] = "Subscription processed";
$lang['application_notification_subscribed'] = "Payment of the following subscription has been processed:";
$lang['application_paypal_ipn_address'] = "Paypal IPN link";
$lang['application_paypal_ipn_help'] = "Legg denne linken til din Paypal konto for å aktivere IPN.";
$lang['application_subscribed_via_paypal'] = "Abonnerer via Paypal";
$lang['application_ended'] = "Avsluttet";
$lang['application_no_contact_assigned'] = "Ingen kontakt angitt";
$lang['application_events'] = "Aktiviteter";
$lang['application_my_open_tasks'] = "Mine Aktive Oppgaver";
$lang['application_recent_messages'] = "Siste Meldinger";

$lang['application_agents'] = "Agenter";
$lang['application_no_data_yet'] = "Ingen data å vise...!";
$lang['application_Jan'] = "Januar";
$lang['application_Feb'] = "Februar";
$lang['application_Mar'] = "Mars";
$lang['application_Apr'] = "April";
$lang['application_May'] = "Mai";
$lang['application_Jun'] = "Juni";
$lang['application_Jul'] = "Juli";
$lang['application_Aug'] = "August";
$lang['application_Sep'] = "September";
$lang['application_Oct'] = "Oktober";
$lang['application_Nov'] = "November";
$lang['application_Dec'] = "Desember";
$lang['application_showing_from_to'] = "Viser _START_ til _END_ av totalt _TOTAL_ ";
$lang['application_showing_from_to_empty'] = "Viser 0 til 0 av totalt 0 ";
$lang['application_view'] = "Oversikt";
$lang['application_sent'] = "Sendt";
$lang['application_paid'] = "Betalt";

$lang['application_notification'] = "Varsling";
$lang['application_credentials'] = "Brukerinformasjon";
$lang['application_pw_reset_link'] = "Nytt passord lenke";
$lang['application_pw_reset'] = "Nytt passord";

$lang['application_country'] = "Land";
$lang['application_subscription_email_template'] = "Abonnements E-post";
$lang['application_client_online'] = "Kunder Pålogget";
$lang['application_ticket'] = "Ticket";
$lang['application_tickets'] = "Tickets";
$lang['application_ctickets'] = "Tickets";
$lang['application_create_new_ticket'] = "Ny Ticket";
$lang['application_ticket_id'] = "Ticket ID";
$lang['application_queue'] = "Kø";
$lang['application_queues'] = "Køer";
$lang['application_created'] = "Opprettet";
$lang['application_ticket_details'] = "Ticket Detaljer";
$lang['application_ticket_status_new'] = "Ny";
$lang['application_ticket_status_open'] = "Åpnet";
$lang['application_ticket_status_onhold'] = "Venter";
$lang['application_ticket_status_inprogress'] = "Pågår";
$lang['application_ticket_status_reopened'] = "Gjenåpnet";
$lang['application_ticket_status_canceled'] = "Avbrutt";
$lang['application_ticket_status_closed'] = "Lukket";
$lang['application_owner'] = "Eier";
$lang['application_assign'] = "Tildel";
$lang['application_note'] = "Notat";
$lang['application_add_note'] = "Skriv Notat";
$lang['application_attachment'] = "Vedlegg";
$lang['application_notification_ticket_assign_subject'] = "Ticket assigned";
$lang['application_create_ticket'] = "Ny Ticket";
$lang['application_quick_reply'] = "Quick reply...";
$lang['application_notify_client'] = "Notify Client";
$lang['application_notify_agent'] = "Notify Agent";
$lang['application_note_visible_to_client'] = "Note visible to client";
$lang['application_closed'] = "Avsluttede";
$lang['application_closed_tickets'] = "Closed Tickets";
$lang['application_open_tickets'] = "Open Tickets";
$lang['application_imap'] = "IMAP";
$lang['application_pop'] = "POP";
$lang['application_imap_or_pop'] = "IMAP eller POP";
$lang['application_postmaster_active'] = "Aktiver E-post Tickets";
$lang['application_postmaster_help'] = "This will activate the postmaster script. You still need to add the postmaster cronjob!";
$lang['application_ssl'] = "SSL";
$lang['application_host'] = "Host";
$lang['application_port'] = "Port";
$lang['application_mailbox'] = "Mailbox";
$lang['application_additional_flags'] = "Additional Flags";
$lang['application_imap_search'] = "IMAP search";
$lang['application_imap_search_help'] = 'IMAP search: http://php.net/manual/en/function.imap-search.php';
$lang['application_delete_from_mailbox'] = "Slett mail fra server etter import";
$lang['application_delete_from_mailbox_help'] = "E-poster slettes fra mailbox etter importering.";
$lang['application_postmaster_address'] = "Postmaster cronjob link";
$lang['application_last_postmaster_run'] = "Last postmaster run";
$lang['application_postmaster_test'] = "Test email settings... (save first)";
$lang['application_ticket_default_owner'] = "Standard Ticket Eier";
$lang['application_ticket_default_queue'] = "Standard Ticket Kø";
$lang['application_ticket_default_type'] = "Standard Ticket Type";
$lang['application_ticket_default_status'] = "Standard Ticket Status";
$lang['application_types'] = "Typer";
$lang['application_add_type'] = "Legg til Type";
$lang['application_queues'] = "Køer";
$lang['application_add_queue'] = "Legg til Kø";
$lang['application_my_tickets'] = "Mine Tickets";
$lang['application_ticket_notification_email_template'] = "Ticket Varsling";
$lang['application_ticket_notification'] = "Ticket Varsling";

$lang['application_notes'] = "Notater";
$lang['application_note'] = "Notat";
$lang['application_unsaved'] = "Ulagret";
$lang['application_custom_quotations'] = "Egendefinerte Skjemaer";
$lang['application_custom_quotation'] = "Egendefinert Skjema";
$lang['application_create_quotation'] = "Opprett et nytt skjema";
$lang['application_custom_quotation_forms'] = "Egendefinerte Skjemaer";

$lang['application_Years'] = "år";
$lang['application_Year'] = "år";
$lang['application_Months'] = "måneder";
$lang['application_Month'] = "måned";
$lang['application_Weeks'] = "uker";
$lang['application_Week'] = "uke";
$lang['application_Days'] = "dager";
$lang['application_Day'] = "dag";
$lang['application_Hours'] = "timer";
$lang['application_Hour'] = "time";
$lang['application_Minutes'] = "minutter";
$lang['application_Minute'] = "minutt";
$lang['application_ago'] = "siden";
$lang['application_and'] = "og";
$lang['application_myprofile'] = "Min Profil";
$lang['application_help'] = "Hjelp";
$lang['application_logout'] = "Logg ut";
$lang['application_INBOX'] = "INBOX";
$lang['application_Marked'] = "Markert";
$lang['application_Deleted'] = "Slettet";
$lang['application_calculate_progress'] = "Kalkuler fremgang basert på oppgaver";
$lang['application_activities'] = "Aktiviteter";
$lang['application_new_media_subject'] = "Media file has been added";
$lang['application_new_media_file_was_added'] = "Hello, New media file has been added to project: ";
$lang['application_uploaded'] = "uploaded";
$lang['application_priority'] = "Prioritet";
$lang['application_no_priority'] = "Ingen prioritet";
$lang['application_low_priority'] = "Lav";
$lang['application_med_priority'] = "Medium";
$lang['application_high_priority'] = "Høy";
$lang['application_comments'] = "Kommentarer";
$lang['application_project_created'] = "Prosjekt Opprettet";
$lang['application_project_has_been_created'] = "Prosjektet ble opprettet.";
$lang['application_new_comment'] = "Ny kommentar";
$lang['application_in_my_queue'] = "I Min Kø";
$lang['application_assigned_to_me'] = "Tildelt Meg";
$lang['application_due_this_month'] = "Forfall denne måneden";
$lang['application_paid_this_month'] = "Betalt denne måneden";
$lang['application_no_invoices_yet'] = "Ingen fakturaer!";
$lang['application_no_projects_yet'] = "Ingen prosjekter ennå!";
$lang['application_province'] = "Fylke";
$lang['application_vat'] = "ORG.Number";
$lang['application_custom_tax'] = "Bruke egen MVA i % <small>(Ikke endre om du vil bruke standard MVA.)</small>";
$lang['application_payments_closed'] = "Payments Completed";
$lang['application_profile'] = "Profil";
$lang['application_assigned'] = "Mine Tickets";
$lang['application_bulk_actions'] = "Massehandling";
$lang['application_go_to_project'] = "Gå til prosjekt";
$lang['application_ticket_number'] = "Ticket Nummer";
$lang['application_reply_back'] = "Svar";
$lang['application_due'] = "due";
$lang['application_type_form_name_here'] = "Type form name here";
$lang['application_ticket_status_reopen'] = "Gjenåpne";
$lang['application_media_uploaded'] = "File uploaded";
$lang['application_pay_with_credit_card'] = "Betale med koert";
$lang['application_update_available'] = "Update available";

$lang['application_timer_set'] = "Angi Tid";
$lang['application_you_can_pay_with'] = "Du kan betale med";
$lang['application_card_number'] = "Kortnummer";
$lang['application_enter_without_spaces'] = "Skriv inn kortnummer uten mellomrom eller andre tegn.";
$lang['application_expiration'] = "Utgår";
$lang['application_mark'] = "Marker";
$lang['application_unmark'] = "Avmarker";
$lang['application_started_on'] = "samtale startet";
$lang['application_stripe'] = "Stripe";
$lang['application_stripe_active'] = "Aktiver Stripe";
$lang['application_stripe_public_key'] = "Stripe Public Key";
$lang['application_stripe_private_key'] = "Stripe Private Key";
$lang['application_credit_card'] = "Kort";
$lang['application_bank_transfer'] = "Faktura";
$lang['application_bank_transfer_active'] = "Aktivere faktura";
$lang['application_bank_transfer_details'] = "Faktura instruksjoner";

$lang['application_estimates'] = "Tilbud";
$lang['application_estimate'] = "Tilbud";
$lang['application_cestimates'] = "Tilbud";
$lang['application_create_estimate'] = "Nytt Tilbud";
$lang['application_estimate_details'] = "Estimate Details";
$lang['application_estimate_id'] = "Referanse";
$lang['application_edit_estimate'] = "Edit Estimate";
$lang['application_send_estimate_to_client'] = "Send estimate to client";
$lang['application_convert_to_invoice'] = "Convert to Invoice";
$lang['application_Invoiced'] = "Invoiced";
$lang['application_invoiced'] = "Invoiced";
$lang['application_accepted'] = "Accepted";
$lang['application_Declined'] = "Declined";
$lang['application_Revised'] = "Revised";
$lang['application_expenses'] = "Utgifter";
$lang['application_expense'] = "Utgift";
$lang['application_create_expense'] = "Ny Utgift";
$lang['application_expense_details'] = "Expense Details";
$lang['application_expense_id'] = "Referanse";
$lang['application_edit_expense'] = "Edit Expense";
$lang['application_payment'] = "Betaling";
$lang['application_refund'] = "Tilbakebetaling";
$lang['application_linked_to_project'] = "Hører til prosjekt";
$lang['application_rebill'] = "Skal gjentaes";
$lang['application_receipt_reference'] = "Kvitteringreferanse";
$lang['application_attachment_description'] = "Beskrivelse av vedlegg";
$lang['application_tax_included'] = "MVA Inkludert";
$lang['application_id'] = "ID";
$lang['application_HTML_Preview'] = "HTML Preview";
$lang['application_this_month'] = "Denne måneden";
$lang['application_show_expenses_from_agent'] = "Etter Aganet";
$lang['application_owed_this_month'] = "Skylder denne måneden";
$lang['application_owed_in'] = "Utestående I ";
$lang['application_balance'] = "Balanse";
$lang['application_rebilled_on_invoice'] = "Rebilled on Invoice";
$lang['application_created_by'] = "Opprettet av";
$lang['application_in'] = "I ";
$lang['application_go_to_invoice'] = "Gå til faktura";
$lang['application_estimate_prefix'] = "Tilbud referanse prefiks";
$lang['application_accept'] = "Godta";
$lang['application_decline'] = "Ikke godta";
$lang['application_payment_date'] = "Betalingsdato";
$lang['application_estimate_email_template'] = "Tilbuds E-post";
$lang['application_reason'] = "Grunn";
$lang['application_Seconds'] = "Sekunder";
$lang['application_pay_invoice'] = "Betal Faktura";

$lang['application_money_format'] = "Valutaformat";
$lang['application_currency_position'] = "Valuta Plassering";
$lang['application_Overdue'] = "Overdue";
$lang['application_second_tax'] = "Sekundær MVA";
$lang['application_pdf_templates'] = "PDF Maler";
$lang['application_pdf_settings'] = "PDF Innstillinger";
$lang['application_invoice_template'] = "Faktura Mal";
$lang['application_estimate_template'] = "Tilbuds Mal";
$lang['application_activate'] = "Aktiver";
$lang['application_in_use'] = "I bruk";
$lang['application_pdf_path'] = "Bruk absolutt sti til bilder <small>(Deaktiver denne om logo ikke vises i PDF)</small>";
$lang['application_pdf_font'] = "PDF Font";
$lang['application_clients_can_register'] = "Aktiver registrering";
$lang['application_you_dont_have_an_account'] = "Har du ingen konto?";
$lang['application_create_account'] = "Opprett en ny konto";
$lang['application_enter_your_details_to_create_an_account'] = "Fyll ut skjemaet for å opprette en ny konto.<br><small>(en e-post med innloggingsdetaljer blir sendt til e-posten din)</small>";
$lang['application_new_client_has_registered'] = "En kunde har opprettet en konto";
$lang['application_your_account_has_been_created'] = "Din konto er opprettet";
$lang['application_create_account_email_template'] = "Opprett Konto";

$lang['application_api_login_id'] = "API Login ID";
$lang['application_api_transaction_key'] = "API Transaksjons ID";
$lang['application_authorize_active'] = "Aktiver Authorize.net";
$lang['application_your_credit_card_will_be_charged_for'] = "Ditt kredittkort vil bli belastet for";
$lang['application_Canceled'] = "Avbrutt";
$lang['application_company_prefix'] = "Selskapet Prefix";
$lang['application_invoice_prefix'] = "Faktura Prefix";
$lang['application_project_prefix'] = "Project Prefix";
$lang['application_quotation_prefix'] = "sitat Prefix";
$lang['application_subscription_prefix'] = "abonnement Prefix";
$lang['application_copy_project'] = "Kopier Project";
$lang['application_copy_tasks'] = "Kopier Tasks";

$lang['application_payment'] = "Payment";
$lang['application_add_payment'] = "Legg Payment";
$lang['application_cash'] = "Cash";
$lang['application_PartiallyPaid'] = "delvis betalt";
$lang['application_total_outstanding'] = "Outstanding";
$lang['application_payment_id'] = "Payment ID";


text:
<?php

$this->startSetup();

$this->updateAttribute('customer', 'customer_activated', 'frontend_input', 'select');
$this->updateAttribute('customer', 'customer_activated', 'source_model', 'eav/entity_attribute_source_boolean');

$this->endSetup();


text:
<!doctype html>

    <title>Speedie-gram</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <link rel="stylesheet" href="css/insta.css">


text:
namespace GgUnit.CollectiveCheck
{
    using System.Collections.Generic;

    public interface ITestCase
    {
        string Name { get; set; }

        List<Result> Checks { get; set; }

        bool Include { set; }

        State CalculateResult();
    }
}


text:
package org.zstack.header.storage.primary;

import org.zstack.header.message.NeedJsonSchema;

/**
 * Created by xing5 on 2016/3/23.
 */
public class PrimaryStorageCanonicalEvent {
    public static final String PRIMARY_STORAGE_DELETED_PATH = "/primaryStorage/delete";

    @NeedJsonSchema
    public static class PrimaryStorageDeletedData {
        private String primaryStorageUuid;
        private PrimaryStorageInventory inventory;

        public String getPrimaryStorageUuid() {
            return primaryStorageUuid;
        }

        public void setPrimaryStorageUuid(String primaryStorageUuid) {
            this.primaryStorageUuid = primaryStorageUuid;
        }

        public PrimaryStorageInventory getInventory() {
            return inventory;
        }

        public void setInventory(PrimaryStorageInventory inventory) {
            this.inventory = inventory;
        }
    }
}


text:
package br.pucrio.opus.smells.tests.dummy.relation.extension;

public class FloatChild extends GenericParent<Float> {

	@Override
	public void a() {
		super.a();
	}

	public <L> void generic(L a) {
		super.generic(a);
	}

	public void c() {

	}
}


text:
print('not False')
print not False
print('not True')
print not True
print("")
print("OR TRUE?")
# OR TRUE?
print('True or False')
print True or False
print('True or True')
print True or True
print('False or True')
print False or True
print('False or False')
print False or False
print("")
print("AND TRUE?")
# AND TRUE?
print('True and False')
print True and False
print('True and True')
print True and True
print('False and True')
print False and True
print('False and False')
print False and False
print("")
print("NOT OR TRUE?")
# NOT OR TRUE?
print('not (True or False)')
print not (True or False)
print('not (True or True)')
print not (True or True)
print('not (False or True)')
print not (False or True)
print('not (False or False)')
print not (False or False)
print("")
print("NOT AND TRUE?")
# NOT AND TRUE?
print('not (True and False)')
print not (True and False)
print('not (True and True)')
print not (True and True)
print('not (False and True)')
print not (False and True)
print('not (False and False)')
print not (False and False)
print("")
print("!= TRUE?")
# != TRUE?
print('1 != 0')
print 1 != 0
print('1 != 1')
print 1 != 1
print('0 != 1')
print 0 != 1
print('0 != 0')
print 0 != 0
print("")
print("== TRUE?")
# == TRUE?
print('1 == 0')
print 1 == 0
print('1 == 1')
print 1 == 1
print('0 == 1')
print 0 == 1
print('0 == 0')
print 0 == 0


text:
package oe.core.util;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;

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

public class FluidUtil {

  public static boolean storesFluid(ItemStack itemstack) {
    if (itemstack.getItem() instanceof IFluidContainerItem) {
      return true;
    }
    for (FluidContainerData f : getFluidData()) {
      if (Item.getIdFromItem(f.filledContainer.getItem()) == Item.getIdFromItem(itemstack.getItem()) && f.filledContainer.getItemDamage() == itemstack.getItemDamage()) {
        return true;
      }
    }
    return false;
  }

  public static FluidStack getFluidStack(ItemStack itemstack) {
    if (itemstack == null) {
      return null;
    }
    if (itemstack.getItem() instanceof IFluidContainerItem) {
      IFluidContainerItem f = (IFluidContainerItem) itemstack.getItem();
      FluidStack r = f.getFluid(itemstack);
      return r;
    }
    for (FluidContainerData f : getFluidData()) {
      if (Item.getIdFromItem(f.filledContainer.getItem()) == Item.getIdFromItem(itemstack.getItem()) && f.filledContainer.getItemDamage() == itemstack.getItemDamage()) {
        return f.fluid;
      }
    }
    return null;
  }

  public static int getAmountStored(ItemStack itemstack) {
    FluidStack f = getFluidStack(itemstack);
    if (f != null) {
      return f.amount;
    }
    return -1;
  }

  public static ItemStack getEmpty(ItemStack itemstack) {
    if (itemstack.getItem() instanceof IFluidContainerItem) {
      ItemStack c = itemstack.copy();
      IFluidContainerItem f = (IFluidContainerItem) c.getItem();
      FluidStack fStack = f.getFluid(c);
      if (fStack != null) {
        f.drain(c, fStack.amount, true);
        return c;
      }
    }
    for (FluidContainerData f : getFluidData()) {
      if (Item.getIdFromItem(f.filledContainer.getItem()) == Item.getIdFromItem(itemstack.getItem()) && f.filledContainer.getItemDamage() == itemstack.getItemDamage()) {
        return f.emptyContainer;
      }
    }
    return null;
  }

  public static List<ItemStack> getStoringItemStacks(int fluidID) {
    List<ItemStack> data = new ArrayList<ItemStack>();
    for (FluidContainerData f : getFluidData()) {
      if (f.fluid.fluidID == fluidID) {
        data.add(f.filledContainer);
      }
    }
    return data;
  }

  public static net.minecraftforge.fluids.Fluid getFluid(String name) {
    net.minecraftforge.fluids.Fluid f = null;
    try {
      f = FluidRegistry.getFluid(FluidRegistry.getFluidID(name));
    } catch (Exception e) {
      return null;
    }
    return f;
  }

  public static int getFluidID(String name) {
    return FluidRegistry.getFluidID(name);
  }

  public static net.minecraftforge.fluids.Fluid getFluid(int id) {
    return FluidRegistry.getFluid(id);
  }

  public static String getName(int id) {
    return FluidRegistry.getFluidName(id);
  }

  public static FluidContainerData[] getFluidData() {
    return FluidContainerRegistry.getRegisteredFluidContainerData();
  }
}


text:
$(window).on("hashchange", getGuids);

function getGuids() {
  if (!location.hash) {
    return JSON.parse(localStorage.getItem("guids") || "[]");
  }
  var guids = location.hash.slice(1).split(",");
  localStorage.setItem("guids", JSON.stringify(guids));
  history.replaceState(undefined, document.title, location.href.slice(0, location.href.indexOf("#")));
  history.back();
  return guids;
}

var accounts = { undefined: new Api() };
$.each(getGuids(), function(i, key) {
  accounts[key] = new Api({key:key});
  accounts[key].get("Account").then(result => {$("#comptes").append("<input type=\"radio\" name=\"compte\" value=\""+key+"\">"+result.name+"
");});
});

$(window).load(function() {
  $(".flag").click(function() {
    $(".flag:not(.disab)").addClass("disab");
    $(this).removeClass("disab");
  });
  $("input").change(function() {
    $("#dispResult").empty();
    var params = {};
    if ($("#ids").val() !== "") {params.ids = $("#ids").val();}
    if ($(".flag:not(.disab)").length > 0) {params.lang = $(".flag:not(.disab)").attr("lang");}
    accounts[$("input[name=compte]:checked").val()].get($("input[name=endpoint]:checked").val(),params).then(result => {$("#dispResult").html(syntaxHighlight(result));});
  });
});

//JSON syntax highlighting. Found this somewhere on stackoverflow
function syntaxHighlight(json) {
  if (typeof json != 'string') {
    json = JSON.stringify(json, undefined, 2);
  }
  json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
  return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
    var cls = 'number';
    if (/^"/.test(match)) {
      if (/:$/.test(match)) {
        cls = 'key';
      } else {
        cls = 'string';
      }
    } else if (/true|false/.test(match)) {
      cls = 'boolean';
    } else if (/null/.test(match)) {
      cls = 'null';
    }
    return '' + match + '';
  });
}


text:
@interface LobbyTableViewController ()
@property (nonatomic, copy) NSString *selectedRoom;
@property (nonatomic, copy) NSString *selectedId;
@property (nonatomic, strong) NSMutableArray *roomIds;
@property (nonatomic, strong) NSMutableArray *roomNames;
@property (nonatomic, weak) GameLobbyViewController *joinRoomTarget;
@property (nonatomic, strong) IBOutlet UITableView *tbView;
@end

@implementation LobbyTableViewController

- (instancetype)init {
    self = [super init];
    if (self) {
        self.roomNames = [[NSMutableArray alloc] init];
        self.roomIds = [[NSMutableArray alloc] init];

        // Initializes table view
        CGRect frame = [[UIScreen mainScreen] bounds];
        CGFloat width = frame.size.width;
        CGFloat height = frame.size.height;
        CGRect tableViewFrame = CGRectMake(0, 0, width-50, (height/2) + 100);
        self.tbView = [[UITableView alloc] initWithFrame:tableViewFrame];
        self.tableView = self.tbView;
        self.tableView.center = CGPointMake(width/2,height/2);
        self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    return self;
}

- (void)loadView {
    [super loadView];
    self.tbView.backgroundView = nil;
    self.tbView.backgroundColor = [UIColor purpleColor];

}

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

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

#pragma mark -
#pragma mark Getters (public)
- (NSString *)getSelectedRoom {
    return self.selectedRoom;
}

- (NSString *)getSelectedId {
    return self.selectedId;
}

- (NSArray *)getRoomNames {
    return self.roomNames;
}

#pragma mark -
#pragma mark Setters (public)

- (void)updateGameRoomList:(NSArray *)names roomIds:(NSArray *)ids {
    self.roomIds = (NSMutableArray *)ids;
    self.roomNames = (NSMutableArray *)names;
    [self.tableView reloadData];
}

- (void)setJoinRoomTarget:(GameLobbyViewController *)target {
    _joinRoomTarget = target;
}

#pragma mark -
#pragma mark Child view controller
-(void)willMoveToParentViewController:(UIViewController *)parent {
    self.view.backgroundColor = [UIColor whiteColor];
    NSLog(@"Moving to or from parent view controller");
}

-(void)didMoveToParentViewController:(UIViewController *)parent {
    NSLog(@"Did move to parent view controller");
}

#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    tableView.backgroundColor = [UIColor clearColor];
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView
         cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    [self.tableView registerClass:[LobbyCell class] forCellReuseIdentifier:@"GameCell"];
    LobbyCell *cell = (LobbyCell *)[self.tableView dequeueReusableCellWithIdentifier:@"GameCell" forIndexPath:indexPath];
    if (cell == nil || ![cell isKindOfClass:LobbyCell.class]) {
        NSLog(@"Creating new cell");
        cell = [[LobbyCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"GameCell"];
    }
    NSLog(@"In cellforRow: %@",self.roomNames[indexPath.row]);
    cell.roomName = self.roomNames[indexPath.row];
    [cell.textLabel setFont:[UIFont fontWithName:SMALL_FONT size:18]];
    cell.selectionStyle = nil;
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView
   heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return tableView.bounds.size.width * 0.23333;
}

- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    self.selectedId = self.roomIds[indexPath.row];
    self.selectedRoom = self.roomNames[indexPath.row];

    self.tableView.userInteractionEnabled = NO;

    [self.joinRoomTarget joinGame];
}

- (NSInteger)tableView:(UITableView *)tableView
 numberOfRowsInSection:(NSInteger)section {
    return [self.roomNames count];
}

@end


text:
A [hyperclick][hyperclick] provider that lets you jump to where variables are defined.

![screenshot]( https://raw.githubusercontent.com/AsaAyers/js-hyperclick/master/screenshots/Selection_107.png)

This project was created primarily to assist navigating projects that use many
small modules. This project solves some of my problems and I share it in the
hope that it solves some of yours.

# FAQ

## What is js-hyperclick?

js-hyperclick is a scanner that integrates with [hyperclick][hyperclick]. It does not have
any keyboard shortcuts or commands. It does not have any user interface. All of that
is managed by [hyperclick][hyperclick].

js-hyperclick uses Babylon (Babel) to parse JavaScript. It scans for all
imports, exports, requires, identifiers (variables), and scopes. Using this
information it can locate the origin of any identifier. It does not and will not
track properties (ex. `identifier.property`), see below for more info.

## moduleRoots

If you have configured your project to avoid `../` in your imports, you can
configure js-hyperclick using `moduleRoots` in your `package.json`. The
configuration belongs there and not in Atom because it is specific to your
project.

For most use cases, you just need to specify the folders to search.
If you want `import 'foo'` to resolve to `src/lib/foo`, just drop this in your `package.json`.

```json
"moduleRoots": [ "src/lib" ],
```

If you're using something more advanced like module aliases you can implement
your own custom resolver. Instead of pointing `moduleRoots` to a folder, just
point it to a JavaScript file and `js-hyperclick` will `require()` and use it [*][security].

While `js-hyperclick` doesn't use these kinds of features in practice, I have
configured them as an example and to validate functionality.

1. moduleRoots configuration in [package.json][moduleRoots]
2. [custom-resolver.js][custom-resolver.js]
3. [spec/fixtures/moduleRoots.js][fixture-moduleRoots]

## Custom Resolver Security

Custom resolvers run inside Atom and extend the functionality of
`js-hyperclick`. This means there is some risk that you could checkout a project
that contains a malicious custom resolver. In order to mitigate this risk, when
`js-hyperclick` encounters a new resolver it will open it and ask if you want to
trust it. Whether you trust or distrust the resolver, `js-hyperclick` stores
that hash so you don't get prompted when switching between branches of a
project, or if you have use the exact same resolver code across multiple
projects.

![trust-resolver](https://raw.githubusercontent.com/AsaAyers/js-hyperclick/master/screenshots/trust-resolver.png)

## Why does `require('./otherfile')` open `otherfile.js` instead of `otherfile.jsx`?

There is a setting in `js-hyperclick` to add additional extensions. My
configuration is `.js, .jsx, .coffee`. This does not cause js-hyperclick to scan
CoffeeScript. This will just locate them if you require the file without the
extension.

## Can you add support for `this.doSomething()`?

No, There is no way to know for sure what `this` is or what properties it might
have. Instead of trying to pick some set of patterns to support and get partly
right, I'm just not going to support that at all.

If you want this you might look into http://ternjs.net/, or if you'll switch to
writing Flow instead of standard JavaScript [Nuclide has jump to definition
support](http://nuclide.io/docs/languages/flow/#jump-to-definition)

## Will you support AMD?

I just don't see a future in AMD, so I won't invest time in supporting it. I
used RequireJS for years

[hyperclick]: https://atom.io/packages/hyperclick
[code-links]: https://atom.io/packages/code-links
[resolve]: https://www.npmjs.com/package/resolvehttps://www.npmjs.com/package/resolve
[webpack-config]: http://webpack.github.io/docs/configuration.html#resolve-modulesdirectories
[moduleRoots]: https://github.com/AsaAyers/js-hyperclick/blob/master/package.json#L8-L11
[custom-resolver.js]: https://github.com/AsaAyers/js-hyperclick/blob/master/custom-resolver.js
[fixture-moduleRoots]: https://github.com/AsaAyers/js-hyperclick/blob/master/spec/fixtures/moduleRoots.js
[security]:https://github.com/AsaAyers/js-hyperclick#custom-resolver-security


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

public class OpinionPool
{
    public static void Main()
    {
        var family = new List<Person>();
        var number = int.Parse(System.Console.ReadLine());
        for (int counter = 0; counter < number; counter++)
        {
            var data = Console.ReadLine().Split();
            var name = data[0];
            var age = int.Parse(data[1]);
            family.Add(new Person(name, age));
        }

        foreach (var person in family.Where(p => p.Age > 30).OrderBy(p => p.Name))
        {
            Console.WriteLine($"{person.Name} - {person.Age}");
        }

    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/img_slideshow_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:layout_marginTop="10dp"
    android:background="@drawable/img_border" >
    <TextView
        android:id="@+id/image_desc"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:maxLines="2"
        android:textSize="16sp"
        android:textColor="@android:color/white"
        android:ellipsize="end"
        android:paddingLeft="4dp"
        android:paddingTop="4dp"
        android:paddingBottom="4dp"
        android:background="@drawable/bg_gradient_dark_270"
        style="@style/img_outline"
        />
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:layout_alignParentTop="true"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:contentDescription="Hình ảnh"
            android:id="@+id/page_img_display"
            android:scaleType="fitCenter"/>
        <ImageView
            android:layout_centerInParent="true"
            android:layout_width="70dp"
            android:layout_height="wrap_content"
            android:src="@drawable/img_video"
            />
    </RelativeLayout>
</LinearLayout>