text:
def all_messages():
    """
    keep all messages in id

    Returns:
        all messages in JSON
    """
    return \
        {
            "scan_started": "Mesin Nettacker mulai ...",
            "options": "python nettacker.py [opsi]",
            "help_menu": "Tampilkan Menu Bantuan Nettacker",
            "license": "Harap baca lisensi dan perjanjian https://github.com/zdresearch/OWASP-Nettacker",
            "engine": "Mesin",
            "engine_input": "Opsi masukan mesin",
            "select_language": "pilih bahasa {0}",
            "range": "pindai semua IP dalam rentang",
            "subdomains": "cari dan pindai subdomain",
            "thread_number_connections": "nomor utas untuk koneksi ke host",
            "thread_number_hosts": "nomor utas untuk host pemindaian",
            "save_logs": "simpan semua log dalam file (results.txt, results.html, results.json)",
            "target": "Target",
            "target_input": "Opsi masukan target",
            "target_list": "daftar target (s), terpisah dengan \",\"",
            "read_target": "baca target (s) dari file",
            "scan_method_options": "Pindai opsi metode",
            "choose_scan_method": "pilih metode pemindaian {0}",
            "exclude_scan_method": "pilih metode pemindaian untuk mengecualikan {0}",
            "username_list": "daftar nama pengguna (s), terpisah dengan \",\"",
            "username_from_file": "baca nama pengguna (s) dari file",
            "password_seperator": "daftar kata sandi, terpisah dengan \",\"",
            "read_passwords": "baca kata sandi (s) dari file",
            "port_seperator": "daftar port (s), terpisah dengan \",\"",
            "time_to_sleep": "waktu untuk tidur di antara setiap permintaan",
            "error_target": "Tidak dapat menentukan target (s)",
            "error_target_file": "Tidak dapat menentukan target (s), tidak dapat membuka file: {0}",
            "thread_number_warning": "lebih baik menggunakan nomor utas lebih rendah dari 100, BTW kami terus ...",
            "set_timeout": "mengatur waktu tunggu hingga {0} detik, itu terlalu besar, bukan? "
                           "dengan cara kita melanjutkan ...",
            "scan_module_not_found": "modul pemindaian ini [{0}] tidak ditemukan!",
            "error_exclude_all": "Anda tidak dapat mengecualikan semua metode pemindaian",
            "exclude_module_error": "{0} modul yang Anda pilih untuk dikecualikan tidak ditemukan!",
            "method_inputs": "masukkan input metode, contoh: ftp_brute_users = test, admin & "
                             "ftp_brute_passwds = baca_from_file: /tmp/pass.txt&ftp_brute_port=21",
            "error_reading_file": "tidak bisa membaca file {0}",
            "error_username": "Tidak dapat menentukan nama pengguna (s), tidak dapat membuka file: {0}",
            "found": "{0} ditemukan! ({1}: {2})",
            "error_password_file": "Tidak dapat menentukan kata sandi (s), tidak dapat membuka file: {0}",
            "file_write_error": "file \"{0}\" tidak dapat ditulis!",
            "scan_method_select": "silakan pilih metode pemindaian Anda!",
            "remove_temp": "menghapus file temp!",
            "sorting_results": "hasil penyortiran!",
            "done": "selesai!",
            "start_attack": "mulai menyerang {0}, {1} dari {2}",
            "module_not_available": "modul ini \"{0}\" tidak tersedia",
            "error_platform": "sayangnya versi perangkat lunak ini hanya bisa dijalankan di linux / osx / windows.",
            "python_version_error": "Versi Python Anda tidak didukung!",
            "skip_duplicate_target": "lewati target duplikat (beberapa subdomain / domain mungkin "
                                     "memiliki IP dan Rentang yang sama)",
            "unknown_target": "jenis target yang tidak diketahui [{0}]",
            "checking_range": "memeriksa {0} rentang ...",
            "checking": "memeriksa {0} ...",
            "HOST": "TUAN RUMAH",
            "USERNAME": "NAMA PENGGUNA",
            "PASSWORD": "KATA SANDI",
            "PORT": "PELABUHAN",
            "TYPE": "MENGETIK",
            "DESCRIPTION": "DESKRIPSI",
            "verbose_level": "tingkat modus verbose (0-5) (default 0)",
            "software_version": "tampilkan versi perangkat lunak",
            "check_updates": "memeriksa pembaruan",
            "outgoing_proxy": "proxy koneksi keluar (kaus kaki). contoh kaus kaki5: 127.0.0.1:9050, "
                              "kaus kaki: //127.0.0.1: 9050 kaus kaki5: //127.0.0.1: 9050 atau kaus "
                              "kaki4: kaus kaki4: //127.0.0.1: 9050, autentikasi: kaus kaki: // "
                              "namapengguna: kata sandi @ 127.0.0.1, socks4: // username: password@127.0.0.1, "
                              "socks5: // username: password@127.0.0.1",
            "valid_socks_address": "masukkan alamat dan port kaus kaki yang valid. contoh kaus kaki5: "
                                   "127.0.0.1:9050, kaus kaki: //127.0.0.1: 9050, kaus kaki5: //127.0.0.1:"
                                   " 9050 atau kaus kaki4: kaus kaki4: //127.0.0.1: 9050, autentikasi: kaus"
                                   " kaki: // namapengguna: kata sandi @ 127.0.0.1, socks4: // username: "
                                   "password@127.0.0.1, socks5: // username: password@127.0.0.1",
            "connection_retries": "Retries ketika batas waktu koneksi (default 3)",
            "ftp_connection_timeout": "koneksi ftp ke {0}: {1} timeout, skipping {2}: {3}",
            "login_successful": "DITERUKAN SECARA SUKSES!",
            "login_list_error": "DITERUKAN SECARA SUKSES, IZIN DITOLAK UNTUK DAFTAR!",
            "ftp_connection_failed": "koneksi ftp ke {0}: {1} gagal, melewati seluruh langkah [proses {2} "
                                     "{3}]! akan ke langkah berikutnya",
            "input_target_error": "target input untuk {0} modul harus DOMAIN, HTTP atau SINGLE_IPv4, skipping {1}",
            "user_pass_found": "pengguna: {0} lulus: {1} host: {2} port: {3} ditemukan!",
            "file_listing_error": "(TIDAK ADA IZIN UNTUK DAFTAR DAFTAR)",
            "trying_message": "mencoba {0} dari {1} dalam proses {2} dari {3} {4}: {5} ({6})",
            "smtp_connection_timeout": "koneksi smtp ke {0}: {1} timeout, skipping {2}: {3}",
            "smtp_connection_failed": "koneksi smtp ke {0}: {1} gagal, melewati seluruh langkah [proses {2} {3}]! "
                                      "akan ke langkah berikutnya",
            "ssh_connection_timeout": "koneksi ssh ke {0}: {1} timeout, skipping {2}: {3}",
            "ssh_connection_failed": "koneksi ssh ke {0}: {1} gagal, melewati seluruh langkah [proses {2} {3}]!"
                                     " akan ke langkah berikutnya",
            "port/type": "{0} / {1}",
            "port_found": "host: {0} port: {1} ({2}) ditemukan!",
            "target_submitted": "target {0} dikirimkan!",
            "current_version": "Anda menjalankan OWASP Nettacker versi {0} {1} {2} {6} dengan nama kode {3} {4} {5}",
            "feature_unavailable": "fitur ini belum tersedia! silakan jalankan \"git clone "
                                   "https://github.com/zdresearch/OWASP-Nettacker.git atau install pip -U"
                                   " OWASP-Nettacker untuk mendapatkan versi terakhir.",
            "available_graph": "membangun grafik dari semua aktivitas dan informasi, Anda harus menggunakan "
                               "output HTML. grafik yang tersedia: {0}",
            "graph_output": "untuk menggunakan fitur grafik, nama file output Anda harus diakhiri dengan "
                            "\".html\" atau \".htm\"!",
            "build_graph": "membangun grafik ...",
            "finish_build_graph": "selesaikan grafik bangunan!",
            "pentest_graphs": "Grafik Pengujian Penetrasi",
            "graph_message": "Grafik ini dibuat oleh OWASP Nettacker. Grafik berisi semua kegiatan modul, "
                             "peta jaringan, dan informasi sensitif. Jangan bagikan file ini dengan siapa pun "
                             "jika tidak dapat diandalkan.",
            "nettacker_report": "Laporan OWASP Nettacker",
            "nettacker_version_details": "Detail Perangkat Lunak: OWASP Nettacker versi {0} [{1}] di {2}",
            "no_open_ports": "tidak ada port terbuka ditemukan!",
            "no_user_passwords": "tidak ada pengguna / kata sandi yang ditemukan!",
            "loaded_modules": "{0} modul dimuat ...",
            "graph_module_404": "modul grafik ini tidak ditemukan: {0}",
            "graph_module_unavailable": "modul grafik ini \"{0}\" tidak tersedia",
            "ping_before_scan": "ping sebelum memindai host",
            "skipping_target": "melewatkan seluruh target {0} dan metode pemindaian {1} karena "
                               "--ping-before-scan adalah benar dan tidak ada respon!",
            "not_last_version": "Anda tidak menggunakan versi terakhir OWASP Nettacker, harap perbarui.",
            "cannot_update": "tidak dapat memeriksa pembaruan, periksa koneksi internet Anda.",
            "last_version": "Anda menggunakan versi terakhir OWASP Nettacker ...",
            "directoy_listing": "daftar direktori ditemukan di {0}",
            "insert_port_message": "tolong masukkan port melalui switch -g atau --methods-args sebagai ganti url",
            "http_connection_timeout": "koneksi http {0} timeout!",
            "wizard_mode": "mulai mode wizard",
            "directory_file_404": "tidak ada direktori atau file yang ditemukan untuk {0} di port {1}",
            "open_error": "tidak dapat membuka {0}",
            "dir_scan_get": "nilai dir_scan_http_method harus GET atau HEAD, atur default ke GET.",
            "list_methods": "daftar semua metode args",
            "module_args_error": "tidak bisa mendapatkan argumen modul {0}",
            "trying_process": "mencoba {0} dari {1} dalam proses {2} dari {3} pada {4} ({5})",
            "domain_found": "domain ditemukan: {0}",
            "TIME": "WAKTU",
            "CATEGORY": "KATEGORI",
            "module_pattern_404": "tidak dapat menemukan modul apa pun dengan pola {0}!",
            "enter_default": "masukkan {0} | Default [{1}]>",
            "enter_choices_default": "masukkan {0} | pilihan [{1}] | Default [{2}]>",
            "all_targets": "targetnya",
            "all_thread_numbers": "nomor utas",
            "out_file": "nama file keluaran",
            "all_scan_methods": "metode pemindaian",
            "all_scan_methods_exclude": "metode pemindaian untuk dikecualikan",
            "all_usernames": "nama pengguna",
            "all_passwords": "kata sandi",
            "timeout_seconds": "batas waktu detik",
            "all_ports": "nomor port",
            "all_verbose_level": "tingkat verbose",
            "all_socks_proxy": "proxy kaus kaki",
            "retries_number": "nomor retries",
            "graph": "sebuah grafik",
            "subdomain_found": "subdomain ditemukan: {0}",
            "select_profile": "pilih profil {0}",
            "profile_404": "profil \"{0}\" tidak ditemukan!",
            "waiting": "menunggu {0}",
            "vulnerable": "rentan terhadap {0}",
            "target_vulnerable": "target {0}: {1} rentan terhadap {2}!",
            "no_vulnerability_found": "tidak ditemukan kerentanan! ({0})",
            "Method": "metode",
            "API": "API",
            "API_options": "Opsi API",
            "start_API": "memulai layanan API",
            "API_host": "Alamat host API",
            "API_port": "Nomor port API",
            "API_debug": "Mode debug API",
            "API_access_key": "Kunci akses API",
            "white_list_API": "cukup izinkan host daftar putih untuk terhubung ke API",
            "define_whie_list": "mendefinisikan host daftar putih, terpisah dengan, (contoh: 127.0.0.1, "
                                "192.168.0.1/24, 10.0.0.1-10.0.0.255)",
            "gen_API_access_log": "menghasilkan log akses API",
            "API_access_log_file": "Nama file log akses API",
            "API_port_int": "Port API harus berupa bilangan bulat!",
            "unknown_ip_input": "jenis masukan tidak dikenal, jenis yang diterima adalah "
                                "SINGLE_IPv4, RANGE_IPv4, CIDR_IPv4",
            "API_key": "* Kunci API: {0}",
            "ports_int": "port harus berupa bilangan bulat! (mis. 80 || 80,1080 || 80,1080-1300,9000,12000-15000)",
            "through_API": "Melalui API OWASP Nettacker",
            "API_invalid": "kunci API tidak valid",
            "unauthorized_IP": "IP Anda tidak diotorisasi",
            "not_found": "Tidak ditemukan!",
            "no_subdomain_found": "subdomain_scan: tidak ada subdomain yang ditemukan!",
            "viewdns_domain_404": "viewdns_reverse_ip_lookup_scan: tidak ada domain yang ditemukan!",
            "browser_session_valid": "sesi browser Anda valid",
            "browser_session_killed": "sesi browser Anda terbunuh",
            "updating_database": "memperbarui basis data ...",
            "database_connect_fail": "tidak bisa terhubung ke database!",
            "inserting_report_db": "memasukkan laporan ke database",
            "inserting_logs_db": "memasukkan log ke database",
            "removing_logs_db": "menghapus log lama dari db",
            "len_subdomain_found": "{0} subdomain (s) ditemukan!",
            "len_domain_found": "{0} domain (s) ditemukan!",
            "phpmyadmin_dir_404": "tidak ada dir phpmyadmin ditemukan!",
            "DOS_send": "mengirim paket DoS ke {0}",
            "host_up": "{0} sudah habis! Waktu yang diambil untuk melakukan ping kembali adalah {1}",
            "host_down": "Tidak bisa melakukan ping {0}!",
            "root_required": "ini harus dijalankan sebagai root",
            "admin_scan_get": "admin_scan_http_method value harus GET atau HEAD, atur default ke GET.",
            "telnet_connection_timeout": "koneksi telnet ke {0}: {1} timeout, skipping {2}: {3}",
            "telnet_connection_failed": "koneksi telnet ke {0}: {1} gagal, melewati seluruh langkah [proses "
                                        "{2} dari {3}]! akan ke langkah berikutnya",
            "http_auth_success": "sukses otentikasi dasar http - host: {2}: {3}, pengguna: {0}, lulus: {1} ditemukan!",
            "http_auth_failed": "Otentikasi dasar http gagal {0}: {3} menggunakan {1}: {2}",
            "http_form_auth_success": "keberhasilan otentikasi bentuk http - host: {2}: {3},"
                                      " pengguna: {0}, lulus: {1} ditemukan!",
            "http_form_auth_failed": "Otentikasi bentuk http gagal {0}: {3} menggunakan {1}: {2}",
            "http_ntlm_success": "Keberhasilan autentikasi ntlm http: host: {2}: {3}, pengguna: "
                                 "{0}, lulus: {1} ditemukan!",
            "http_ntlm_failed": "Otentikasi ntlm http gagal {0}: {3} menggunakan {1}: {2}",
            "no_response": "tidak bisa mendapatkan respons dari target",
            "category_framework": "kategori: {0}, kerangka kerja: {1} ditemukan!",
            "nothing_found": "tidak ditemukan apa pun di {0} dalam {1}!",
            "no_auth": "Tidak ada auth yang ditemukan pada {0}: {1}"
        }


text:
describe('ScrollHook', function () {
  'use strict';

  var scrollToPosition = window.scrollToPosition;
  var scrollViewBottomTo = window.scrollViewBottomTo;
  var createBuffer = window.createBuffer;
  var scrollHook = window.scrollHook;
  var bufferSection
  var testEl;

  beforeEach(function() {
    bufferSection = createBuffer();
    document.body.appendChild(bufferSection);
  })

  afterEach(function() {
    scrollToPosition(0);
    document.body.removeChild(testEl);
    document.body.removeChild(bufferSection);
  });

  it('transitions classes when element is scrolled into view', function () {
    var initialState = 'foo';
    var expectedFinalState = 'bar';

    testEl = document.createElement('div');
    testEl.className = initialState;
    testEl.style.height = '400px';
    document.body.appendChild(testEl);

    scrollHook.register(testEl, {
      initialStates: initialState,
      finalStates: expectedFinalState
    });

    scrollHook.start();

    // 1008 is where the element is naturally (webkit adds 8px margins).
    scrollViewBottomTo(1008);
    expect(testEl.className).to.equal(expectedFinalState);
  });

  it('can transition classes dependent on a specified position', function () {
    var initialState = 'foo';
    var expectedFinalState = 'bar';
    var expectedPosition = 1100;

    testEl = document.createElement('div');
    testEl.className = initialState;
    testEl.style.height = '400px';
    document.body.appendChild(testEl);

    scrollHook.register(testEl, {
      position: expectedPosition,     // transition class at specific position
      initialStates: initialState,
      finalStates: expectedFinalState
    });

    scrollHook.start();

    scrollViewBottomTo(1008);        // Event normally would have fired here
    expect(testEl.className).to.equal(initialState);

    scrollViewBottomTo(expectedPosition);
    expect(testEl.className).to.equal(expectedFinalState);
  });

  it('can just remove initialStates, making finalStates optional', function () {
    var initialState = 'foo';

    testEl = document.createElement('div');
    testEl.className = initialState;
    testEl.style.height = '400px';
    document.body.appendChild(testEl);

    scrollHook.register(testEl, {
      initialStates: initialState
    });

    scrollHook.start();

    scrollViewBottomTo(1008);
    expect(testEl.className).to.equal('');
  });

  it('can remove multiple initialStates', function () {
    testEl = document.createElement('div');
    testEl.classList.add('one', 'two');
    testEl.style.height = '400px';
    document.body.appendChild(testEl);

    scrollHook.register(testEl, {
      initialStates: [ 'one', 'two' ]
    });

    scrollHook.start();

    expect(testEl.className).to.equal('one two');

    scrollViewBottomTo(1008);
    expect(testEl.className).to.equal('');
  });

  it('can just add finalStates, making initialStates optional', function () {
    var expectedFinalState = 'bar';

    testEl = document.createElement('div');
    testEl.style.height = '400px';
    document.body.appendChild(testEl);

    scrollHook.register(testEl, {
      finalStates: expectedFinalState
    });

    scrollHook.start();

    scrollViewBottomTo(1008);
    expect(testEl.className).to.equal(expectedFinalState);
  });

  it('can add multiple finalStates', function () {
    testEl = document.createElement('div');
    testEl.style.height = '400px';
    document.body.appendChild(testEl);

    scrollHook.register(testEl, {
      finalStates: ['three', 'four']
    });

    scrollHook.start();

    expect(testEl.className).to.equal('');

    scrollViewBottomTo(1008);
    expect(testEl.className).to.equal('three four');
  });

  it('removes positions to listen for as they are triggered', function () {
    var expectedPosition = 1100;

    testEl = document.createElement('div');
    testEl.style.height = '400px';
    document.body.appendChild(testEl);

    scrollHook.register(testEl, {
      position: expectedPosition,
      finalStates: ['three', 'four']
    });

    scrollHook.start();

    expect(scrollHook._positions).to.contain(expectedPosition);
    expect(scrollHook._events).to.include.keys(String(expectedPosition));

    scrollViewBottomTo(1100);
    expect(testEl.className).to.equal('three four');
    expect(scrollHook._positions).to.not.contain(expectedPosition);
    expect(scrollHook._events).to.not.include.keys(String(expectedPosition));
  });
});

redpajama_set_name: RedPajamaGithub


text:
@(experimment: levar.Experiment)

<h1>@{experimment.name.getOrElse(experimment.id)}</h1>


text:
@media (min-width: 1200px) {
  .post-container,
  .sidebar-container {
    padding-right: 5%;
  }
}
@media (min-width: 768px) {
  .post-container {
    padding-right: 5%;
  }
}
.sidebar-container {
  color: #bfbfbf;
  font-size: 14px;
}
.sidebar-container h5 {
  color: #808080;
  padding-bottom: 1em;
}
.sidebar-container h5 a {
  color: #808080 !important;
  text-decoration: none;
}
.sidebar-container a {
  color: #bfbfbf !important;
}
.sidebar-container a:hover,
.sidebar-container a:active {
  color: #0085a1 !important;
}
.sidebar-container .tags a {
  border-color: #bfbfbf;
}
.sidebar-container .tags a:hover,
.sidebar-container .tags a:active {
  border-color: #0085a1;
}
.sidebar-container .short-about img {
  width: 80%;
  display: block;
  border-radius: 5px;
}
.sidebar-container .short-about p {
  margin: 20px 0;
}
.sidebar-container .short-about .list-inline > li {
  padding-left: 0px;
}
body {
  /* Hux learn from
     *     TypeIsBeautiful,
     *     [This Post](http://zhuanlan.zhihu.com/ibuick/20186806) etc.
     */
  font-family: -apple-system, "Helvetica Neue", "Arial", "PingFang SC", "Hiragino Sans GB", "STHeiti", "Microsoft YaHei", "Microsoft JhengHei", "Source Han Sans SC", "Noto Sans CJK SC", "Source Han Sans CN", "Noto Sans SC", "Source Han Sans TC", "Noto Sans CJK TC", "WenQuanYi Micro Hei", SimSun, sans-serif;
  line-height: 1.7;
  font-size: 16px;
  color: #000;
  overflow-x: hidden;
}
p {
  margin: 30px 0;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  /* Hux learn from
     *     TypeIsBeautiful,
     *     [This Post](http://zhuanlan.zhihu.com/ibuick/20186806) etc.
     */
  font-family: -apple-system, "Helvetica Neue", "Arial", "PingFang SC", "Hiragino Sans GB", "STHeiti", "Microsoft YaHei", "Microsoft JhengHei", "Source Han Sans SC", "Noto Sans CJK SC", "Source Han Sans CN", "Noto Sans SC", "Source Han Sans TC", "Noto Sans CJK TC", "WenQuanYi Micro Hei", SimSun, sans-serif;
  line-height: 1.7;
  line-height: 1.1;
  font-weight: bold;
}
h4 {
  font-size: 21px;
}
a {
  color: #404040;
}
a:hover,
a:focus {
  color: #0085a1;
}
a img:hover,
a img:focus {
  cursor: zoom-in;
}
article {
  overflow-x: hidden;
}
blockquote {
  color: #808080;
  font-style: italic;
  font-size: 16px;
  margin: 20px 0 20px;
}
blockquote p {
  margin: 0;
}
small.img-hint {
  display: block;
  margin-top: -20px;
  text-align: center;
}
br + small.img-hint {
  margin-top: -40px;
}
img.shadow {
  box-shadow: rgba(0, 0, 0, 0.258824) 0px 2px 5px 0px;
}
@media screen and (max-width: 768px) {
  select {
    -webkit-appearance: none;
    margin-top: 15px;
    color: #337ab7;
    border-color: #337ab7;
    padding: 0em 0.4em;
    background: white;
  }
}
.table th,
.table td {
  border: 1px solid #eee !important;
}
hr.small {
  max-width: 100px;
  margin: 15px auto;
  border-width: 4px;
  border-color: white;
}
pre,
.table-responsive {
  -webkit-overflow-scrolling: touch;
}
pre code {
  display: block;
  width: auto;
  white-space: pre;
  word-wrap: normal;
}
.post-container a {
  color: #337ab7;
  font-weight: bold;
}
.post-container a:hover,
.post-container a:focus {
  color: #0085a1;
}
.post-container h1,
.post-container h2,
.post-container h3,
.post-container h4,
.post-container h5,
.post-container h6 {
  margin: 30px 0 10px;
}
.post-container h5 {
  font-size: 19px;
  font-weight: 600;
  color: gray;
}
.post-container h5 + p {
  margin-top: 5px;
}
.post-container h6 {
  font-size: 16px;
  font-weight: 600;
  color: gray;
}
.post-container h6 + p {
  margin-top: 5px;
}
.post-container ul,
.post-container ol {
  margin-bottom: 40px;
}
@media screen and (max-width: 768px) {
  .post-container ul,
  .post-container ol {
    padding-left: 30px;
  }
}
@media screen and (max-width: 500px) {
  .post-container ul,
  .post-container ol {
    padding-left: 20px;
  }
}
.post-container ol ol,
.post-container ol ul,
.post-container ul ol,
.post-container ul ul {
  margin-bottom: 5px;
}
.post-container li p {
  margin: 0;
  margin-bottom: 5px;
}
.post-container li h1,
.post-container li h2,
.post-container li h3,
.post-container li h4,
.post-container li h5,
.post-container li h6 {
  line-height: 2;
  margin-top: 20px;
}
@media only screen and (max-width: 767px) {
  .navbar-default .navbar-collapse {
    border: none;
    background: white;
    box-shadow: 0px 5px 10px 2px rgba(0, 0, 0, 0.2);
    box-shadow: rgba(0, 0, 0, 0.117647) 0px 1px 6px, rgba(0, 0, 0, 0.239216) 0px 1px 4px;
    border-radius: 2px;
    width: 170px;
    float: right;
    margin: 0px;
  }
  #huxblog_navbar {
    opacity: 0;
    transform: scaleX(0);
    transform-origin: top right;
    transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
    -webkit-transform: scaleX(0);
    -webkit-transform-origin: top right;
    -webkit-transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
  }
  #huxblog_navbar a {
    font-size: 12px;
    line-height: 24px;
  }
  #huxblog_navbar .navbar-collapse {
    height: 0px;
    transform: scaleY(0);
    transform-origin: top right;
    transition: transform 500ms cubic-bezier(0.23, 1, 0.32, 1);
    -webkit-transform: scaleY(0);
    -webkit-transform-origin: top right;
    -webkit-transition: -webkit-transform 500ms cubic-bezier(0.23, 1, 0.32, 1);
  }
  #huxblog_navbar li {
    opacity: 0;
    transition: opacity 450ms cubic-bezier(0.23, 1, 0.32, 1) 205ms;
    -webkit-transition: opacity 450ms cubic-bezier(0.23, 1, 0.32, 1) 205ms;
  }
  #huxblog_navbar.in {
    transform: scaleX(1);
    -webkit-transform: scaleX(1);
    opacity: 1;
  }
  #huxblog_navbar.in .navbar-collapse {
    transform: scaleY(1);
    -webkit-transform: scaleY(1);
  }
  #huxblog_navbar.in li {
    opacity: 1;
  }
}
.navbar-custom {
  background: none;
  border: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 3;
  /* Hux learn from
     *     TypeIsBeautiful,
     *     [This Post](http://zhuanlan.zhihu.com/ibuick/20186806) etc.
     */
  font-family: -apple-system, "Helvetica Neue", "Arial", "PingFang SC", "Hiragino Sans GB", "STHeiti", "Microsoft YaHei", "Microsoft JhengHei", "Source Han Sans SC", "Noto Sans CJK SC", "Source Han Sans CN", "Noto Sans SC", "Source Han Sans TC", "Noto Sans CJK TC", "WenQuanYi Micro Hei", SimSun, sans-serif;
  line-height: 1.7;
}
.navbar-custom .navbar-brand {
  font-weight: 800;
  color: white;
  height: 56px;
  line-height: 25px;
}
.navbar-custom .navbar-brand:hover {
  color: rgba(255, 255, 255, 0.8);
}
.navbar-custom .nav li a {
  text-transform: uppercase;
  font-size: 12px;
  line-height: 20px;
  font-weight: 800;
  letter-spacing: 1px;
}
.navbar-custom .nav li a:active {
  background: rgba(0, 0, 0, 0.12);
}
@media only screen and (min-width: 768px) {
  .navbar-custom {
    background: transparent;
    border-bottom: 1px solid transparent;
  }
  .navbar-custom body {
    font-size: 20px;
  }
  .navbar-custom .navbar-brand {
    color: white;
    padding: 20px;
    line-height: 20px;
  }
  .navbar-custom .navbar-brand:hover,
  .navbar-custom .navbar-brand:focus {
    color: rgba(255, 255, 255, 0.8);
  }
  .navbar-custom .nav li a {
    color: white;
    padding: 20px;
  }
  .navbar-custom .nav li a:hover,
  .navbar-custom .nav li a:focus {
    color: rgba(255, 255, 255, 0.8);
  }
  .navbar-custom .nav li a:active {
    background: none;
  }
}
@media only screen and (min-width: 1170px) {
  .navbar-custom {
    -webkit-transition: background-color 0.3s;
    -moz-transition: background-color 0.3s;
    transition: background-color 0.3s;
    /* Force Hardware Acceleration in WebKit */
    -webkit-transform: translate3d(0, 0, 0);
    -moz-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    -o-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  .navbar-custom.is-fixed {
    /* when the user scrolls down, we hide the header right above the viewport */
    position: fixed;
    top: -61px;
    background-color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid #f2f2f2;
    -webkit-transition: -webkit-transform 0.3s;
    -moz-transition: -moz-transform 0.3s;
    transition: transform 0.3s;
  }
  .navbar-custom.is-fixed .navbar-brand {
    color: #404040;
  }
  .navbar-custom.is-fixed .navbar-brand:hover,
  .navbar-custom.is-fixed .navbar-brand:focus {
    color: #0085a1;
  }
  .navbar-custom.is-fixed .nav li a {
    color: #404040;
  }
  .navbar-custom.is-fixed .nav li a:hover,
  .navbar-custom.is-fixed .nav li a:focus {
    color: #0085a1;
  }
  .navbar-custom.is-visible {
    /* if the user changes the scrolling direction, we show the header */
    -webkit-transform: translate3d(0, 100%, 0);
    -moz-transform: translate3d(0, 100%, 0);
    -ms-transform: translate3d(0, 100%, 0);
    -o-transform: translate3d(0, 100%, 0);
    transform: translate3d(0, 100%, 0);
  }
}
.intro-header {
  background: no-repeat center center;
  background-color: #808080;
  background-attachment: scroll;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  background-size: cover;
  -o-background-size: cover;
  margin-bottom: 0px;
  /* 0 on mobile, modify by Hux */
}
@media only screen and (min-width: 768px) {
  .intro-header {
    margin-bottom: 20px;
    /* response on desktop */
  }
}
.intro-header .site-heading,
.intro-header .post-heading,
.intro-header .page-heading {
  padding: 85px 0 55px;
  color: white;
}
@media only screen and (min-width: 768px) {
  .intro-header .site-heading,
  .intro-header .post-heading,
  .intro-header .page-heading {
    padding: 150px 0;
  }
}
.intro-header .site-heading {
  padding: 95px 0 70px;
}
@media only screen and (min-width: 768px) {
  .intro-header .site-heading {
    padding: 150px 0;
  }
}
.intro-header .site-heading,
.intro-header .page-heading {
  text-align: center;
}
.intro-header .site-heading h1,
.intro-header .page-heading h1 {
  margin-top: 0;
  font-size: 38px;
}
.intro-header .site-heading .subheading,
.intro-header .page-heading .subheading {
  /* Hux learn from
     *     TypeIsBeautiful,
     *     [This Post](http://zhuanlan.zhihu.com/ibuick/20186806) etc.
     */
  font-family: -apple-system, "Helvetica Neue", "Arial", "PingFang SC", "Hiragino Sans GB", "STHeiti", "Microsoft YaHei", "Microsoft JhengHei", "Source Han Sans SC", "Noto Sans CJK SC", "Source Han Sans CN", "Noto Sans SC", "Source Han Sans TC", "Noto Sans CJK TC", "WenQuanYi Micro Hei", SimSun, sans-serif;
  line-height: 1.7;
  font-size: 18px;
  line-height: 1.1;
  display: block;
  font-weight: 300;
  margin: 10px 0 0;
}
@media only screen and (min-width: 768px) {
  .intro-header .site-heading h1,
  .intro-header .page-heading h1 {
    font-size: 80px;
  }
}
.intro-header .post-heading h1 {
  font-size: 30px;
  margin-bottom: 24px;
}
.intro-header .post-heading .subheading,
.intro-header .post-heading .meta {
  line-height: 1.1;
  display: block;
}
.intro-header .post-heading .subheading {
  /* Hux learn from
     *     TypeIsBeautiful,
     *     [This Post](http://zhuanlan.zhihu.com/ibuick/20186806) etc.
     */
  font-family: -apple-system, "Helvetica Neue", "Arial", "PingFang SC", "Hiragino Sans GB", "STHeiti", "Microsoft YaHei", "Microsoft JhengHei", "Source Han Sans SC", "Noto Sans CJK SC", "Source Han Sans CN", "Noto Sans SC", "Source Han Sans TC", "Noto Sans CJK TC", "WenQuanYi Micro Hei", SimSun, sans-serif;
  line-height: 1.7;
  font-size: 17px;
  line-height: 1.4;
  font-weight: normal;
  margin: 10px 0 30px;
  margin-top: -5px;
}
.intro-header .post-heading .meta {
  font-family: 'Lora', 'Times New Roman', serif;
  font-style: italic;
  font-weight: 300;
  font-size: 18px;
}
.intro-header .post-heading .meta a {
  color: white;
}
@media only screen and (min-width: 768px) {
  .intro-header .post-heading h1 {
    font-size: 55px;
  }
  .intro-header .post-heading .subheading {
    font-size: 30px;
  }
  .intro-header .post-heading .meta {
    font-size: 20px;
  }
}
.post-preview > a {
  color: #404040;
}
.post-preview > a:hover,
.post-preview > a:focus {
  text-decoration: none;
  color: #0085a1;
}
.post-preview > a > .post-title {
  font-size: 21px;
  line-height: 1.3;
  margin-top: 30px;
  margin-bottom: 8px;
  color: #0085a1;
}
.post-preview > a > .post-subtitle {
  font-size: 15px;
  line-height: 1.3;
  margin: 0;
  font-weight: 500;
  margin-bottom: 10px;
}
.post-preview > .post-meta {
  font-family: 'Lora', 'Times New Roman', serif;
  color: #808080;
  font-size: 15px;
  font-style: italic;
  margin-top: 0;
}
.post-preview > .post-meta > a {
  text-decoration: none;
  color: #404040;
}
.post-preview > .post-meta > a:hover,
.post-preview > .post-meta > a:focus {
  color: #0085a1;
  text-decoration: underline;
}
@media only screen and (min-width: 768px) {
  .post-preview > a > .post-title {
    font-size: 26px;
    line-height: 1.3;
    margin-bottom: 10px;
	color: #0085a1;
  }
  .post-preview > a > .post-subtitle {
    font-size: 18px;
  }
  .post-preview .post-meta {
    font-size: 18px;
  }
}
.post-content-preview {
  font-size: 13px;
  font-style: italic;
  color: #a3a3a3;
  font-weight: 300;
}
.post-content-preview:hover {
  color: #0085a1;
}
@media only screen and (min-width: 768px) {
  .post-content-preview {
    font-size: 14px;
  }
}
.section-heading {
  font-size: 36px;
  margin-top: 60px;
  font-weight: 700;
}
.caption {
  text-align: center;
  font-size: 14px;
  padding: 10px;
  font-style: italic;
  margin: 0;
  display: block;
  border-bottom-right-radius: 5px;
  border-bottom-left-radius: 5px;
}
footer {
  font-size: 20px;
  padding: 50px 0 65px;
}
footer .list-inline {
  margin: 0;
  padding: 0;
}
footer .copyright {
  font-size: 14px;
  text-align: center;
  margin-bottom: 0;
}
footer .copyright a {
  color: #337ab7;
}
footer .copyright a:hover,
footer .copyright a:focus {
  color: #0085a1;
}
.floating-label-form-group {
  font-size: 14px;
  position: relative;
  margin-bottom: 0;
  padding-bottom: 0.5em;
  border-bottom: 1px solid #eeeeee;
}
.floating-label-form-group input,
.floating-label-form-group textarea {
  z-index: 1;
  position: relative;
  padding-right: 0;
  padding-left: 0;
  border: none;
  border-radius: 0;
  font-size: 1.5em;
  background: none;
  box-shadow: none !important;
  resize: none;
}
.floating-label-form-group label {
  display: block;
  z-index: 0;
  position: relative;
  top: 2em;
  margin: 0;
  font-size: 0.85em;
  line-height: 1.764705882em;
  vertical-align: middle;
  vertical-align: baseline;
  opacity: 0;
  -webkit-transition: top 0.3s ease,opacity 0.3s ease;
  -moz-transition: top 0.3s ease,opacity 0.3s ease;
  -ms-transition: top 0.3s ease,opacity 0.3s ease;
  transition: top 0.3s ease,opacity 0.3s ease;
}
.floating-label-form-group::not(:first-child) {
  padding-left: 14px;
  border-left: 1px solid #eeeeee;
}
.floating-label-form-group-with-value label {
  top: 0;
  opacity: 1;
}
.floating-label-form-group-with-focus label {
  color: #0085a1;
}
form .row:first-child .floating-label-form-group {
  border-top: 1px solid #eeeeee;
}
.btn {
  /* Hux learn from
     *     TypeIsBeautiful,
     *     [This Post](http://zhuanlan.zhihu.com/ibuick/20186806) etc.
     */
  font-family: -apple-system, "Helvetica Neue", "Arial", "PingFang SC", "Hiragino Sans GB", "STHeiti", "Microsoft YaHei", "Microsoft JhengHei", "Source Han Sans SC", "Noto Sans CJK SC", "Source Han Sans CN", "Noto Sans SC", "Source Han Sans TC", "Noto Sans CJK TC", "WenQuanYi Micro Hei", SimSun, sans-serif;
  line-height: 1.7;
  text-transform: uppercase;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  border-radius: 0;
  padding: 15px 25px;
}
.btn-lg {
  font-size: 16px;
  padding: 25px 35px;
}
.btn-default:hover,
.btn-default:focus {
  background-color: #0085a1;
  border: 1px solid #0085a1;
  color: white;
}
.pager {
  margin: 20px 0 0 !important;
  padding: 0px !important;
}
.pager li > a,
.pager li > span {
  /* Hux learn from
     *     TypeIsBeautiful,
     *     [This Post](http://zhuanlan.zhihu.com/ibuick/20186806) etc.
     */
  font-family: -apple-system, "Helvetica Neue", "Arial", "PingFang SC", "Hiragino Sans GB", "STHeiti", "Microsoft YaHei", "Microsoft JhengHei", "Source Han Sans SC", "Noto Sans CJK SC", "Source Han Sans CN", "Noto Sans SC", "Source Han Sans TC", "Noto Sans CJK TC", "WenQuanYi Micro Hei", SimSun, sans-serif;
  line-height: 1.7;
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 10px;
  background-color: white;
  border-radius: 0;
}
@media only screen and (min-width: 768px) {
  .pager li > a,
  .pager li > span {
    font-size: 14px;
    padding: 15px 25px;
  }
}
.pager li > a {
  color: #404040;
}
.pager li > a:hover,
.pager li > a:focus {
  color: white;
  background-color: #0085a1;
  border: 1px solid #0085a1;
}
.pager .disabled > a,
.pager .disabled > a:hover,
.pager .disabled > a:focus,
.pager .disabled > span {
  color: #808080;
  background-color: #404040;
  cursor: not-allowed;
}
::-moz-selection {
  color: white;
  text-shadow: none;
  background: #0085a1;
}
::selection {
  color: white;
  text-shadow: none;
  background: #0085a1;
}

img::selection {
  color: white;
  background: transparent;
}
img::-moz-selection {
  color: white;
  background: transparent;
}
body {
  webkit-tap-highlight-color: #0085a1;
}

/* Hux make all img responsible in post-container */
.post-container img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5em auto 1.6em auto;
}
/* Hux Optimize UserExperience */
.navbar-default .navbar-toggle:focus,
.navbar-default .navbar-toggle:hover {
  background-color: inherit;
}
.navbar-default .navbar-toggle:active {
  background-color: rgba(255, 255, 255, 0.25);
}
/* Hux customize Style for navBar button */
.navbar-default .navbar-toggle {
  border-color: transparent;
  padding: 19px 16px;
  margin-top: 2px;
  margin-right: 2px;
  margin-bottom: 2px;
  border-radius: 50%;
}
.navbar-default .navbar-toggle .icon-bar {
  width: 18px;
  border-radius: 0px;
  background-color: white;
}
.navbar-default .navbar-toggle .icon-bar + .icon-bar {
  margin-top: 3px;
}
/* Hux customize Style for Duoshuo */
.comment {
  margin-top: 20px;
}
.comment #ds-thread #ds-reset a.ds-like-thread-button {
  border: 1px solid #ddd;
  border-radius: 0px;
  background: white;
  box-shadow: none;
  text-shadow: none;
}
.comment #ds-thread #ds-reset li.ds-tab a.ds-current {
  border: 1px solid #ddd;
  border-radius: 0px;
  background: white;
  box-shadow: none;
  text-shadow: none;
}
.comment #ds-thread #ds-reset .ds-textarea-wrapper {
  background: none;
}
.comment #ds-thread #ds-reset .ds-gradient-bg {
  background: none;
}
#ds-smilies-tooltip ul.ds-smilies-tabs li a {
  background: white !important;
}
.page-fullscreen .intro-header {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}
.page-fullscreen #tag-heading {
  position: fixed;
  left: 0;
  top: 0;
  padding-bottom: 150px;
  width: 100%;
  height: 100%;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-box-pack: center;
  -webkit-box-align: center;
  display: -webkit-flex;
  -webkit-align-items: center;
  -webkit-justify-content: center;
  -webkit-flex-direction: column;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.page-fullscreen footer {
  position: absolute;
  width: 100%;
  bottom: 0;
  padding-bottom: 20px;
  opacity: 0.6;
  color: #fff;
}
.page-fullscreen footer .copyright {
  color: #fff;
}
.page-fullscreen footer .copyright a {
  color: #fff;
}
.page-fullscreen footer .copyright a:hover {
  color: #ddd;
}

/* BruceZhao customize */
/* 标签、分类页图标底色 */
.badge { background: #0085a1; }
/* anchorJs css */
a.anchorjs-link {
    text-decoration: none;
    -webkit-font-smoothing: antialiased;
}

/* back-top */
#back-top {
  position: fixed;
  bottom: 110px;
  right: 2em;
}
#back-top a {
  background: rgba(0, 0, 0, 0.45);
  -webkit-border-radius: 7px;
  -moz-border-radius: 7px;
  -webkit-transition: 1s;
  -moz-transition: 1s;
  transition: 1s;
  width: 40px;
  height: 40px;
  display: block;
  font-size: 36px;
  color: #fff;
  text-align: center;
  border-radius: 3px 3px;
  text-decoration: none;
}
#back-top a:hover {
  background-color: #0085a1;
}

#back-top i {
    font-size: 24px;
    line-height: 40px;
    vertical-align: top;
}
/* 向上图标透明白色 */
.fa-chevron-up:before {
    color: rgba(252,252,252,0.81);
}

/* Archive 更好的显示效果 */
legend {
    font-size: 24px;
	font-weight: bold;
    line-height: inherit;
    color: #000;
    border-bottom: 2px solid #e5e5e5;
}

/* categories更好的显示效果 */
.tab-content a {color: #337ab7;font-weight: bold;}
.tab-content a:hover {color: #0085a1;}

/* 字体更好的手机端显示效果 */
@media only screen and (max-width: 768px) {
	/* 返回顶部贴右边 */
	#back-top {
	right: 0em;
	}
	/* 文章左右两边留白 */
	.row {
		padding-left: 10px;
		padding-right: 10px;
		}
	/* 字号统一调小 */
	.post-container p {font-size: 14px}
	.post-container li {font-size: 14px}
	.post-container h2, h2 {font-size: 20px}
	.post-container h3, h3 {font-size: 16px}
	.post-container h4, h4 {font-size: 15px}
	.MathJax span {font-size: 15px;}
	legend { font-size: 20px;}
	.tab-content a{ font-size: 14px}
	.badge { font-size: 10px }
	.text-muted {color: #bfbfbf;font-size: 14px;}
}

/* for anchorJs */
.anchorjs-link {
  transition: all .25s linear;
}
*:hover > .anchorjs-link {
  margin-left: -1.125em !important;
}

/* for emoj  */
img.emoji {
    display: inline-block;
    margin: auto;
}

/* for pager previous&next */
.post-container .pager li>a>span {
    color: gray;
    font-weight: 400;
    letter-spacing: .5px;
}
.post-container .pager li {
  width: 48%;
}
.post-container .pager li.next {
  float: right;
}
.post-container .pager li.previous {
  float: left;
}
.post-container .pager li > a {
  width: 100%;
}
.post-container .pager li > a > span {
  color: #808080;
  font-weight: normal;
  letter-spacing: 0.5px;
}
.pager li>a:hover>span, .pager li>a:focus>span {
    color: #fff;
}

.post-container .pager li.home {
  width: 30%;
}
.pager li>span.page_number {
    width: 30%;
}
.pager li > a > span {
    text-transform: capitalize;
}


text:
**DEPRECATED** This project is based on webAudio [ScriptProcessorNode](https://www.w3.org/TR/webaudio/#the-scriptprocessornode-interface---deprecated) that has been deprecated.

Please have a look at [Modular](https://github.com/cstoquer/modular) which implements the same functionnalities and more using plain webAudio.

# oodio-js

Modular synthesizer. Based on WebAudio's `createScriptProcessor` for audio rendering.

Demo is [here](http://cstoquer.github.io/oodio-js).

## Modules

### Oscillator
 - OscSaw: simple sawtooth wave generator.
 - OscRamp-B: sawtooth wave generator.
 - OscPulse: pulse wave generator with PWM.
 - OscTri: triangle wave generator.
 - NES Noise: 1-bit pseudo noise generator. Based on NES's 2A03 chipset noise channel.

### Filter
 - FastFilter: simple one pole 6db/oct filter
 - RCFilter: Resistor-Capacitor type filter.

### Enveloppe
 - EnvDecay: Simple logarithmic decay enveloppe.

### Amplification
 - Gain
 - Clipper
 - Mix1-1A

### Effect
 - FreeVerb: reverberation based on FreeVerb implementation.

### Sequencer
 - ClockGen: Clock pulse generator
 - SeqNote: Simple note sequencer


text:
(async function() {
  TestRunner.addResult(
      `Test filtering in Bottom-Up Timeline Tree View panel.\n`);
  await TestRunner.loadLegacyModule('timeline'); await TestRunner.loadTestModule('performance_test_runner');
  await TestRunner.showPanel('timeline');

  var sessionId = '4.20';
  var mainThread = 1;
  var pid = 100;

  var testData = [
    {
      'args': {
        'data': {
          'sessionId': sessionId,
          'frames':
              [{'frame': 'frame1', 'url': 'frameurl', 'name': 'frame-name'}]
        }
      },
      'cat': 'disabled-by-default-devtools.timeline',
      'name': 'TracingStartedInPage',
      'ph': 'I',
      'pid': pid,
      'tid': mainThread,
      'ts': 100,
    },
    {
      'name': 'top level event name',
      'ts': 1000000,
      'ph': 'B',
      'tid': mainThread,
      'pid': pid,
      'cat': 'toplevel',
      'args': {}
    },
    {
      'name': 'TimeStamp',
      'ts': 1010000,
      'ph': 'B',
      'tid': mainThread,
      'pid': pid,
      'cat': 'disabled-by-default-devtools.timeline',
      'args': {'data': {'message': 'AAA'}}
    },
    {
      'name': 'TimeStamp',
      'ts': 1020000,
      'ph': 'B',
      'tid': mainThread,
      'pid': pid,
      'cat': 'disabled-by-default-devtools.timeline',
      'args': {'data': {'message': 'BBB'}}
    },
    {
      'name': 'TimeStamp',
      'ts': 1100000,
      'ph': 'E',
      'tid': mainThread,
      'pid': pid,
      'cat': 'disabled-by-default-devtools.timeline',
      'args': {}
    },
    {
      'name': 'TimeStamp',
      'ts': 1110000,
      'ph': 'E',
      'tid': mainThread,
      'pid': pid,
      'cat': 'disabled-by-default-devtools.timeline',
      'args': {}
    },
    {
      'name': 'top level event name',
      'ts': 1120000,
      'ph': 'E',
      'tid': mainThread,
      'pid': pid,
      'cat': 'toplevel',
      'args': {}
    }
  ];

  var model = PerformanceTestRunner.createPerformanceModelWithEvents(testData);
  const tabbedPane = UI.panels.timeline.flameChart.detailsView.tabbedPane;
  tabbedPane.selectTab(Timeline.TimelineDetailsView.Tab.BottomUp);
  const view = tabbedPane.visibleView;

  view.setModel(model, PerformanceTestRunner.mainTrack());
  view.updateContents(Timeline.TimelineSelection.fromRange(
      model.timelineModel().minimumRecordTime(),
      model.timelineModel().maximumRecordTime()));
  function printEventMessage(event, level, node) {
    const text = event.args['data'] && event.args['data']['message'] ?
        event.args['data']['message'] + ' selfTime: ' + node.selfTime :
        event.name;
    TestRunner.addResult(' '.repeat(level) + text);
  }

  async function dumpRecords() {
    await PerformanceTestRunner.walkTimelineEventTreeUnderNode(
        printEventMessage, view.root);
    TestRunner.addResult('');
  }

  TestRunner.addResult('Initial:');
  await dumpRecords();

  TestRunner.addResult(`Filtered by 'AAA':`);
  view.textFilterUI.setValue('AAA', true);
  await dumpRecords();

  TestRunner.addResult(`Filtered by 'BBB':`);
  view.textFilterUI.setValue('BBB', true);
  await dumpRecords();

  TestRunner.completeTest();
})();


text:
from apscheduler.triggers.cron import CronTrigger
from apscheduler.triggers.interval import IntervalTrigger
from apscheduler.triggers.simple import SimpleTrigger


text:
package net.sf.mmm.search.api.config;

/**
 * This is the interface for the configuration of a {@link net.sf.mmm.search.api.SearchEntry#getField(String)
 * field}.
 *
 * @author Joerg Hohwiller (hohwille at users.sourceforge.net)
 * @since 1.0.0
 */
public interface SearchFieldConfiguration {

  /**
   * This method gets the name of the {@link net.sf.mmm.search.api.SearchEntry#getField(String) field}. It is
   * used as key to identify the field.
   *
   * @return the field-name.
   */
  String getName();

  /**
   * This method gets the {@link SearchFieldType type} of the according
   * {@link net.sf.mmm.search.api.SearchEntry#getField(String) field}.
   *
   * @see net.sf.mmm.search.api.SearchEntry#getField(String, Class)
   *
   * @return the field-type.
   */
  SearchFieldType getType();

  /**
   * This method gets the {@link SearchFieldMode mode} of the
   * {@link net.sf.mmm.search.api.SearchEntry#getField(String) field}.
   *
   * @return the {@link SearchFieldMode}.
   */
  SearchFieldMode getMode();

  /**
   * This method determines if the represented {@link net.sf.mmm.search.api.SearchEntry#getField(String)
   * field} shall be hidden in the view. This means it is NOT displayed in the details of a
   * {@link net.sf.mmm.search.engine.api.SearchHit}. The default is false.
   *
   * @return true if hidden, false otherwise.
   */
  boolean isHidden();

}


text:
package panel

import (
	"net/http"
	"path/filepath"

	log "github.com/Sirupsen/logrus"
	"github.com/flosch/pongo2"
	"github.com/gorilla/mux"
	"github.com/slok/monf/configuration"
	"github.com/spf13/viper"
)

var (
	templatesPrefix string

	// Precompiled templates are faster
	tplRoot *pongo2.Template
)

func init() {
	// Load varialbes with the settings loaded
	templatesPrefix = filepath.Join(viper.GetString(configuration.TemplatesPath), "panel")
	tplRoot = pongo2.Must(pongo2.FromFile(filepath.Join(templatesPrefix, "root.html")))
}

func logHandler(r *http.Request, handler string, params map[string]string, queryParams map[string][]string) {
	log.WithFields(log.Fields{
		"url":     r.RequestURI,
		"handler": handler,
		"method":  r.Method,
		"params":  params,
		"Query":   queryParams,
	}).Debug("Calling handler")
}

// RootHandler processes the logic of the root panel
func RootHandler(w http.ResponseWriter, r *http.Request) {
	params := mux.Vars(r)

	// Headers
	w.WriteHeader(http.StatusOK) // 200

	// body
	err := tplRoot.ExecuteWriter(nil, w)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}

	logHandler(r, "RootHandler", params, nil)
}


text:
define(['ko', 'text!app/components/chaplin-hat/template.html'], function (ko, htmlString) {

    function MarioHat(model) {
        var self = this;
    };

    return {
        viewModel: MarioHat,
        template: htmlString
    };
});


text:
title: Media support
type: major
---


text:
/**
 * Generic interface for simple, reliable remote function and method invocation.
 */

export interface TransportClient {
  invoke(functionName: string, encodedReq: string): Promise<string>;
}

export type EncodedRequestHandler = (encodedReq: string) => Promise<string>;

export interface TransportServer {
  registerInvokeHandler(
    functionName: string,
    handler: EncodedRequestHandler
  ): void;
}


text:
    module.exports =

## HashMapCollision

A `HashMapCollision` is a terminal node in a `HashMap` that represents a
**collision list** of alternating `... key, value, ...` pairs, where all of the
keys contained therein share a single  **common hash**.

The containing parent `HashMapNode` slot stores the integer value of the common
hash and the `HashMapCollision` together as a pair of adjacent elements in the
parent `HashMapNode`'s `table`.

Operations over the collision list are linear-time.

    class HashMapCollision

      constructor: ( @table ) ->

      copy: -> new HashMapCollision @table.slice()

      indexOf: ( key ) ->
        return unless table = @table
        i = 0; while i < table.length
          return i if table[i] is key
          i += 2
        return

      add: ( key, value ) ->
        table = @table ?= []
        if ( i = @indexOf key )?
          table[ i + 1 ] = value
          0
        else
          table.push key, value
          1

      remove: ( key ) ->
        table = @table
        length = table.length

        # never allow a collision to contain fewer than two pairs
        throw new RangeError if length < 6

        if ( index = @indexOf key )?
          lastIndex           = length - 2
          table[ index ]      = table[ lastIndex ]
          table[ index + 1 ]  = table[ lastIndex + 1 ]
          table.length        = lastIndex
          1
        else
          0


text:
import sys
import argparse
import logging
from neutronclient.neutron import client

STATE_OK = 0
STATE_WARNING = 1
STATE_CRITICAL = 2
STATE_UNKNOWN = 3

logging.basicConfig(level=logging.INFO)
#logging.basicConfig(level=logging.DEBUG)

parser = argparse.ArgumentParser(description='Check OpenStack Neutron agent status')
parser.add_argument('--auth-url', metavar='URL', type=str,
                    required=True,
                    help='Keystone URL')
parser.add_argument('--username', metavar='username', type=str,
                    required=True,
                    help='username for authentication')
parser.add_argument('--password', metavar='password', type=str,
                    required=True,
                    help='password for authentication')
parser.add_argument('--tenant', metavar='tenant', type=str,
                    required=True,
                    help='tenant name for authentication')
parser.add_argument('--region_name', metavar='region', type=str,
                    help='Region to select for authentication')
parser.add_argument('--host', metavar='host', type=str,
                    help='filter by specific host')
parser.add_argument('--agent-type', metavar='type', type=str,
                    help='filter by specific agent type')
parser.add_argument('--warn-disabled', action='store_true',
                    default=False,
                    help='warn if any agents administratively disabled')
args = parser.parse_args()

try:
    c = client.Client('2.0',
                      username=args.username,
                      tenant_name=args.tenant,
                      password=args.password,
                      auth_url=args.auth_url,
                      region_name=args.region_name)
    params = {}
    if args.host: params['host'] = args.host
    if args.agent_type: params['agent_type'] = args.agent_type
    agents = c.list_agents(**params)
except Exception as e:
    print str(e)
    sys.exit(STATE_CRITICAL)

agents_down = []
agents_disabled = []
messages = []
exit_state = STATE_OK
for a in agents['agents']:
    if a['admin_state_up'] and not a['alive']:
        agents_down.append(a)
    elif not a['admin_state_up']:
        agents_disabled.append(a)

if agents_down:
    for a in agents_down:
        messages.append("{agent_type} on {host} is down".format(agent_type=a['agent_type'], host=a['host']))
        exit_state = STATE_CRITICAL

if args.warn_disabled and agents_disabled:
    for a in agents_disabled:
        messages.append("{agent_type} on {host} is {alive} and disabled"
                        .format(agent_type=a['agent_type'],
                                host=a['host'],
                                alive='alive' if a['alive'] else 'down'))
    if exit_state != STATE_CRITICAL: exit_state = STATE_WARNING

if len(messages) == 1:
     print "Neutron agent status: {status}".format(status=messages[0])
else:
    print "Neutron agent status {agents} total / {agents_down} down / {agents_disabled} disabled".format(agents=len(agents['agents']),
                                                                        agents_down=len(agents_down),
                                                                        agents_disabled=len(agents_disabled))

if len(messages) > 1: print "\n".join(messages)
exit(exit_state)


text:
define(["Tone/component/Compressor", "helper/Basic", "helper/PassAudio", "helper/PassAudioStereo", "Test"],
function (Compressor, Basic, PassAudio, PassAudioStereo, Test) {
	describe("Compressor", function(){

		Basic(Compressor);

		context("Compression", function(){

			it("handles input and output connections", function(){
				var comp = new Compressor();
				Test.connect(comp);
				comp.connect(Test);
				comp.dispose();
			});

			it("passes the incoming signal through", function(done){
				var comp;
				PassAudio(function(input, output){
					comp = new Compressor();
					input.connect(comp);
					comp.connect(output);
				}, function(){
					comp.dispose();
					done();
				});
			});

			it("passes the incoming stereo signal through", function(done){
				var comp;
				PassAudioStereo(function(input, output){
					comp = new Compressor();
					input.connect(comp);
					comp.connect(output);
				}, function(){
					comp.dispose();
					done();
				});
			});

			it("can be get and set through object", function(){
				var comp = new Compressor();
				var values = {
					"ratio" : 22,
					"threshold" : -30,
					"release" : 0.5,
					"attack" : 0.03,
					"knee" : 20
				};
				comp.set(values);
				expect(comp.get()).to.have.keys(["ratio", "threshold", "release", "attack", "ratio"]);
				comp.dispose();
			});

			it("can get/set all interfaces", function(){
				var comp = new Compressor();
				var values = {
					"ratio" : 22,
					"threshold" : -30,
					"release" : 0.5,
					"attack" : 0.03,
					"knee" : 20
				};
				comp.ratio.value = values.ratio;
				comp.threshold.value = values.threshold;
				comp.release.value = values.release;
				comp.attack.value = values.attack;
				comp.knee.value = values.knee;
				expect(comp.ratio.value).to.equal(values.ratio);
				expect(comp.threshold.value).to.equal(values.threshold);
				expect(comp.release.value).to.equal(values.release);
				expect(comp.attack.value).to.be.closeTo(values.attack, 0.01);
				expect(comp.knee.value).to.equal(values.knee);
				comp.dispose();
			});
		});
	});
});


text:
#import "NSObject.h"

#import "CUTPowerMonitorDelegate-Protocol.h"
#import "PCLoggingDelegate-Protocol.h"

@class NSString, PCSimpleTimer;

@interface PCPersistentTimer : NSObject <PCLoggingDelegate, CUTPowerMonitorDelegate>
{
    double _fireTime;
    double _startTime;
    unsigned long long _guidancePriority;
    double _minimumEarlyFireProportion;
    _Bool _triggerOnGMTChange;
    _Bool _disableSystemWaking;
    NSString *_serviceIdentifier;
    id _target;
    SEL _selector;
    id _userInfo;
    PCSimpleTimer *_simpleTimer;
}

+ (void)_updateTime:(double)arg1 forGuidancePriority:(unsigned long long)arg2;
+ (double)_currentGuidanceTime;
+ (double)currentMachTimeInterval;
+ (id)lastSystemWakeDate;
@property(readonly, nonatomic) NSString *loggingIdentifier; // @synthesize loggingIdentifier=_serviceIdentifier;
@property(nonatomic) _Bool disableSystemWaking; // @synthesize disableSystemWaking=_disableSystemWaking;
@property(nonatomic) double minimumEarlyFireProportion; // @synthesize minimumEarlyFireProportion=_minimumEarlyFireProportion;
- (id)debugDescription;
- (double)_nextForcedAlignmentAbsoluteTime;
- (void)interfaceManagerInternetReachabilityChanged:(id)arg1;
- (void)interfaceManagerWWANInterfaceChangedPowerState:(id)arg1;
- (void)interfaceManagerWWANInterfaceStatusChanged:(id)arg1;
- (void)cutPowerMonitorBatteryConnectedStateDidChange:(id)arg1;
- (void)_fireTimerFired;
- (void)_updateTimers;
- (double)_earlyFireTime;
- (id)userInfo;
- (_Bool)firingIsImminent;
- (_Bool)isValid;
@property(readonly, nonatomic) double fireTime;
- (void)invalidate;
- (void)scheduleInRunLoop:(id)arg1 inMode:(id)arg2;
- (void)scheduleInRunLoop:(id)arg1;
- (void)dealloc;
- (id)_initWithAbsoluteTime:(double)arg1 serviceIdentifier:(id)arg2 guidancePriority:(unsigned long long)arg3 target:(id)arg4 selector:(SEL)arg5 userInfo:(id)arg6 triggerOnGMTChange:(_Bool)arg7;
- (id)initWithTimeInterval:(double)arg1 serviceIdentifier:(id)arg2 guidancePriority:(unsigned long long)arg3 target:(id)arg4 selector:(SEL)arg5 userInfo:(id)arg6;
- (id)initWithTimeInterval:(double)arg1 serviceIdentifier:(id)arg2 target:(id)arg3 selector:(SEL)arg4 userInfo:(id)arg5;
- (id)initWithFireDate:(id)arg1 serviceIdentifier:(id)arg2 target:(id)arg3 selector:(SEL)arg4 userInfo:(id)arg5;

@end


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

#ifndef LIGHT_CLUSTER_BUILDER_H
#define LIGHT_CLUSTER_BUILDER_H

#include "servers/rendering/rasterizer_rd/rasterizer_storage_rd.h"

class LightClusterBuilder {
public:
	enum LightType {
		LIGHT_TYPE_OMNI,
		LIGHT_TYPE_SPOT
	};

	enum ItemType {
		ITEM_TYPE_OMNI_LIGHT,
		ITEM_TYPE_SPOT_LIGHT,
		ITEM_TYPE_REFLECTION_PROBE,
		ITEM_TYPE_DECAL,
		ITEM_TYPE_MAX //should always be 4
	};

	enum {
		COUNTER_SHIFT = 20, //one million total ids
		POINTER_MASK = (1 << COUNTER_SHIFT) - 1,
		COUNTER_MASK = 0xfff // 4096 items per cell
	};

private:
	struct LightData {
		float position[3];
		uint32_t type;
		float radius;
		float spot_aperture;
		uint32_t pad[2];
	};

	uint32_t light_count = 0;
	uint32_t light_max = 0;
	LightData *lights = nullptr;

	struct OrientedBoxData {
		float position[3];
		uint32_t pad;
		float x_axis[3];
		uint32_t pad2;
		float y_axis[3];
		uint32_t pad3;
		float z_axis[3];
		uint32_t pad4;
	};

	uint32_t refprobe_count = 0;
	uint32_t refprobe_max = 0;
	OrientedBoxData *refprobes = nullptr;

	uint32_t decal_count = 0;
	uint32_t decal_max = 0;
	OrientedBoxData *decals = nullptr;

	struct Item {
		AABB aabb;
		ItemType type;
		uint32_t index;
	};

	Item *items = nullptr;
	uint32_t item_count = 0;
	uint32_t item_max = 0;

	uint32_t width = 0;
	uint32_t height = 0;
	uint32_t depth = 0;

	struct Cell {
		uint32_t item_pointers[ITEM_TYPE_MAX];
	};

	Vector<uint8_t> cluster_data;
	RID cluster_texture;

	struct SortID {
		uint32_t cell_index;
		uint32_t item_index;
		ItemType item_type;
	};

	SortID *sort_ids = nullptr;
	Vector<uint32_t> ids;
	uint32_t sort_id_count = 0;
	uint32_t sort_id_max = 0;
	RID items_buffer;

	Transform view_xform;
	CameraMatrix projection;
	float z_far = 0;
	float z_near = 0;

	_FORCE_INLINE_ void _add_item(const AABB &p_aabb, ItemType p_type, uint32_t p_index) {
		if (unlikely(item_count == item_max)) {
			item_max = nearest_power_of_2_templated(item_max + 1);
			items = (Item *)memrealloc(items, sizeof(Item) * item_max);
		}

		Item &item = items[item_count];
		item.aabb = p_aabb;
		item.index = p_index;
		item.type = p_type;
		item_count++;
	}

public:
	void begin(const Transform &p_view_transform, const CameraMatrix &p_cam_projection);

	_FORCE_INLINE_ void add_light(LightType p_type, const Transform &p_transform, float p_radius, float p_spot_aperture) {
		if (unlikely(light_count == light_max)) {
			light_max = nearest_power_of_2_templated(light_max + 1);
			lights = (LightData *)memrealloc(lights, sizeof(LightData) * light_max);
		}

		LightData &ld = lights[light_count];
		ld.type = p_type;
		ld.position[0] = p_transform.origin.x;
		ld.position[1] = p_transform.origin.y;
		ld.position[2] = p_transform.origin.z;
		ld.radius = p_radius;
		ld.spot_aperture = p_spot_aperture;

		Transform xform = view_xform * p_transform;

		ld.radius *= xform.basis.get_uniform_scale();

		AABB aabb;

		switch (p_type) {
			case LIGHT_TYPE_OMNI: {
				aabb.position = xform.origin;
				aabb.size = Vector3(ld.radius, ld.radius, ld.radius);
				aabb.position -= aabb.size;
				aabb.size *= 2.0;

				_add_item(aabb, ITEM_TYPE_OMNI_LIGHT, light_count);
			} break;
			case LIGHT_TYPE_SPOT: {
				float r = ld.radius;
				real_t len = Math::tan(Math::deg2rad(ld.spot_aperture)) * r;

				aabb.position = xform.origin;
				aabb.expand_to(xform.xform(Vector3(len, len, -r)));
				aabb.expand_to(xform.xform(Vector3(-len, len, -r)));
				aabb.expand_to(xform.xform(Vector3(-len, -len, -r)));
				aabb.expand_to(xform.xform(Vector3(len, -len, -r)));
				_add_item(aabb, ITEM_TYPE_SPOT_LIGHT, light_count);
			} break;
		}

		light_count++;
	}

	_FORCE_INLINE_ void add_reflection_probe(const Transform &p_transform, const Vector3 &p_half_extents) {
		if (unlikely(refprobe_count == refprobe_max)) {
			refprobe_max = nearest_power_of_2_templated(refprobe_max + 1);
			refprobes = (OrientedBoxData *)memrealloc(refprobes, sizeof(OrientedBoxData) * refprobe_max);
		}

		Transform xform = view_xform * p_transform;

		OrientedBoxData &rp = refprobes[refprobe_count];
		Vector3 origin = xform.origin;
		rp.position[0] = origin.x;
		rp.position[1] = origin.y;
		rp.position[2] = origin.z;

		Vector3 x_axis = xform.basis.get_axis(0) * p_half_extents.x;
		rp.x_axis[0] = x_axis.x;
		rp.x_axis[1] = x_axis.y;
		rp.x_axis[2] = x_axis.z;

		Vector3 y_axis = xform.basis.get_axis(1) * p_half_extents.y;
		rp.y_axis[0] = y_axis.x;
		rp.y_axis[1] = y_axis.y;
		rp.y_axis[2] = y_axis.z;

		Vector3 z_axis = xform.basis.get_axis(2) * p_half_extents.z;
		rp.z_axis[0] = z_axis.x;
		rp.z_axis[1] = z_axis.y;
		rp.z_axis[2] = z_axis.z;

		AABB aabb;

		aabb.position = origin + x_axis + y_axis + z_axis;
		aabb.expand_to(origin + x_axis + y_axis - z_axis);
		aabb.expand_to(origin + x_axis - y_axis + z_axis);
		aabb.expand_to(origin + x_axis - y_axis - z_axis);
		aabb.expand_to(origin - x_axis + y_axis + z_axis);
		aabb.expand_to(origin - x_axis + y_axis - z_axis);
		aabb.expand_to(origin - x_axis - y_axis + z_axis);
		aabb.expand_to(origin - x_axis - y_axis - z_axis);

		_add_item(aabb, ITEM_TYPE_REFLECTION_PROBE, refprobe_count);

		refprobe_count++;
	}

	_FORCE_INLINE_ void add_decal(const Transform &p_transform, const Vector3 &p_half_extents) {
		if (unlikely(decal_count == decal_max)) {
			decal_max = nearest_power_of_2_templated(decal_max + 1);
			decals = (OrientedBoxData *)memrealloc(decals, sizeof(OrientedBoxData) * decal_max);
		}

		Transform xform = view_xform * p_transform;

		OrientedBoxData &dc = decals[decal_count];

		Vector3 origin = xform.origin;
		dc.position[0] = origin.x;
		dc.position[1] = origin.y;
		dc.position[2] = origin.z;

		Vector3 x_axis = xform.basis.get_axis(0) * p_half_extents.x;
		dc.x_axis[0] = x_axis.x;
		dc.x_axis[1] = x_axis.y;
		dc.x_axis[2] = x_axis.z;

		Vector3 y_axis = xform.basis.get_axis(1) * p_half_extents.y;
		dc.y_axis[0] = y_axis.x;
		dc.y_axis[1] = y_axis.y;
		dc.y_axis[2] = y_axis.z;

		Vector3 z_axis = xform.basis.get_axis(2) * p_half_extents.z;
		dc.z_axis[0] = z_axis.x;
		dc.z_axis[1] = z_axis.y;
		dc.z_axis[2] = z_axis.z;

		AABB aabb;

		aabb.position = origin + x_axis + y_axis + z_axis;
		aabb.expand_to(origin + x_axis + y_axis - z_axis);
		aabb.expand_to(origin + x_axis - y_axis + z_axis);
		aabb.expand_to(origin + x_axis - y_axis - z_axis);
		aabb.expand_to(origin - x_axis + y_axis + z_axis);
		aabb.expand_to(origin - x_axis + y_axis - z_axis);
		aabb.expand_to(origin - x_axis - y_axis + z_axis);
		aabb.expand_to(origin - x_axis - y_axis - z_axis);

		_add_item(aabb, ITEM_TYPE_DECAL, decal_count);

		decal_count++;
	}

	void bake_cluster();

	void setup(uint32_t p_width, uint32_t p_height, uint32_t p_depth);

	RID get_cluster_texture() const;
	RID get_cluster_indices_buffer() const;

	LightClusterBuilder();
	~LightClusterBuilder();
};

#endif // LIGHT_CLUSTER_BUILDER_H


text:
/* eslint-env mocha */
/* eslint-disable func-names, prefer-arrow-callback */

import loginPage from '../../pageobjects/login.page';
import mainContent from '../../pageobjects/main-content.page';

// test data imports
import { username, email, password } from '../../data/user.js';

// Basic usage test start
describe('[User Creation]', function() {
	this.retries(2);

	before(() => {
		loginPage.open();
		// This Can Cause Timeouts erros if the server is slow so it should have a big wait
		loginPage.emailOrUsernameField.waitForVisible(15000);
	});

	it('it should create user', () => {
		loginPage.gotToRegister();

		loginPage.registerNewUser({ username, email, password });

		loginPage.inputUsername.waitForExist(5000);

		loginPage.submitButton.click();

		mainContent.mainContent.waitForExist(5000);
	});
});


text:
'use strict';
// This tests setTimeout() by having multiple clients connecting and sending
// data in random intervals. Clients are also randomly disconnecting until there
// are no more clients left. If no false timeout occurs, this test has passed.
const common = require('../common');
const http = require('http');
const server = http.createServer();
let connections = 0;

server.on('request', function(req, res) {
  req.socket.setTimeout(1000);
  req.socket.on('timeout', function() {
    throw new Error('Unexpected timeout');
  });
  req.on('end', function() {
    connections--;
    res.writeHead(200);
    res.end('done\n');
    if (connections === 0) {
      server.close();
    }
  });
  req.resume();
});

server.listen(common.PORT, '127.0.0.1', function() {
  for (let i = 0; i < 10; i++) {
    connections++;

    setTimeout(function() {
      const request = http.request({
        port: common.PORT,
        method: 'POST',
        path: '/'
      });

      function ping() {
        const nextPing = (Math.random() * 900).toFixed();
        if (nextPing > 600) {
          request.end();
          return;
        }
        request.write('ping');
        setTimeout(ping, nextPing);
      }
      ping();
    }, i * 50);
  }
});


text:
class CreateEcmSeminarsEvents < ActiveRecord::Migration
  def change
    create_table :ecm_seminars_events do |t|
      t.string :locale
      t.timestamp :begins_at
      t.timestamp :ends_at
      t.text :description
      t.integer :capacity
      t.timestamp :close_registrations_at

      # associations
      t.integer :registrations_count, :default => 0, :null => false
      t.references :ecm_seminars_location
      t.references :ecm_seminars_seminar

      # friendly id
      t.string :slug

      t.timestamps
    end
  end
end


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

const DuplicationError = require('../lib/exceptions/DuplicationError');
const LinkingModels = require('sails-linking-models');
const ModelHelpers = require('../lib/ModelHelpers');

const operations = {
  OPERATION_CHECK_IN: 'check in',
  OPERATION_CHECK_OUT: 'check out',
  OPERATION_REINSTATEMENT: 'reinstatement',
  OPERATION_INTER_SITE_TRANSFER: 'inter site transfer',
  OPERATION_UPDATE: 'update individual'
};

const model = {
  schema: true,
  attributes: {
    centre: {
      model: "centres",
      required: true
    },
    detainee: {
      model: "detainee",
      required: true
    },
    operation: {
      type: 'string',
      required: true,
      enum: Object.keys(operations).map((k) => operations[k])
    },
    timestamp: {
      type: 'datetime',
      required: true
    },
    active: {
      type: "boolean",
      defaultsTo: true
    }
  },

  afterValidate: (values, cb) =>
    Event.find({
      centre: values.centre,
      detainee: values.detainee,
      operation: values.operation,
      timestamp: values.timestamp
    })
      .then(events => {
        if (events.length > 0) {
          return cb(new DuplicationError("Duplicate event"));
        }
        cb();
      })

};

Object.assign(model, operations);
module.exports = LinkingModels.mixin(ModelHelpers.mixin(model));


text:
<!DOCTYPE html>

<meta charset="utf-8">
<title>Documentation Brython</title>
<link rel="stylesheet" href="../doc_brython.css">


text:
<?php
// Generated by ZF2's ./bin/classmap_generator.php
return array(
    'Comments\Module'                        => __DIR__ . '/Module.php',
    'Comments\Controller\CommentsController' => __DIR__ . '/src/Comments/Controller/CommentsController.php',
    'CommentsTest\Framework\TestCase'        => __DIR__ . '/tests/Comments/Framework/TestCase.php',
    'CommentsTest\SampleTest'                => __DIR__ . '/tests/Comments/SampleTest.php',
);


text:
#ifndef IVW_BASELIGHT_H
#define IVW_BASELIGHT_H

#include <inviwo/core/common/inviwocoredefine.h>
#include <inviwo/core/common/inviwo.h>
#include <inviwo/core/datastructures/spatialdata.h>

namespace inviwo {

namespace LightSourceType {
enum Enum { LIGHT_AREA = 0, LIGHT_CONE, LIGHT_POINT, LIGHT_DIRECTIONAL };
}
// TODO: Change/add transformation and size information to meters instead of texture space.

class IVW_CORE_API LightSource : public SpatialEntity<3> {
public:
    LightSource() : fieldOfView_(static_cast<float>(0.5 * M_PI)){};
    virtual ~LightSource(){};

    virtual float getArea() const = 0;

    /**
     * Get radiant flux (color) of light source.
     * @return Radiant flux in watt.
     */
    virtual vec3 getPower() const = 0;

    /**
     * Get the intensity (color) from the light source given in watt per steradian (flux density per
     *solid angle, W*s*r^-1).
     *
     * @return Flux density per solid angle, W*s*r^-1
     */
    const vec3 getIntensity() const { return intensity_; }

    /**
     * Set the intensity (color) from the light source given in watt per steradian (flux density per
     *solid angle, W*s*r^-1).
     *
     * @param intensity
     */
    void setIntensity(const vec3& intensity) { intensity_ = intensity; }

    virtual LightSourceType::Enum getLightSourceType() const = 0;

    /**
     * Return field of view in radians.
     *
     * @return Field of view in radians
     */
    float getFieldOfView() const { return fieldOfView_; }

    void setFieldOfView(float FOVInRadians) { fieldOfView_ = FOVInRadians; }

    /**
     * Get width and height in world space.
     *
     * @return
     */
    const vec2& getSize() const { return size_; }

    /**
     * Set width and height in texture space.
     *
     * @param newSize
     */
    void setSize(const vec2& newSize) { size_ = newSize; }

    /**
     * Get is enabled.
     *
     * @return
     */
    bool isEnabled() const { return enabled_; }

    /**
     * Set if enabled.
     *
     * @param enable
     */
    void setEnabled(bool enable) { enabled_ = enable; }

    virtual std::string getDataInfo() const { return "LightSource"; }

    static uvec3 COLOR_CODE;

protected:
    vec3 intensity_;     // Color of light source, flux density per solid angle (given in watt per
                         // steradian W*s*r^-1)
    float fieldOfView_;  // Field of view in radians
    vec2 size_;          // width, height in world space
    bool enabled_;
};

/**
 * \brief Encodes the position and direction in a matrix.
 *
 * Light source position is extracted using:
 * p = M * vec4(0, 0, 0, 1)
 * And the light source direction using:
 * d = normalize(M * vec4(0, 0, 1, 0))
 * @param vec3 pos Light source position.
 * @param vec3 dir Light source direction.
 * @return IVW_CORE_API mat4 Transformation from light source model space to world space.
 */
IVW_CORE_API mat4 getLightTransformationMatrix(vec3 pos, vec3 dir);

}  // namespace inviwo

#endif  // IVW_BASELIGHT_H


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

<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <include layout="@layout/padded_action_bar" />

        <!-- As the main content view, the view below consumes the entire
             space available using match_parent in both dimensions. -->
        <FrameLayout
            android:id="@+id/content_primary"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </LinearLayout>

    <!-- android:layout_gravity="start" tells DrawerLayout to treat
         this as a sliding drawer on the left side for left-to-right
         languages and on the right side for right-to-left languages.
         If you're not building against API 17 or higher, use
         android:layout_gravity="left" instead. -->
    <!-- The drawer is given a fixed width in dp and extends the full height of
         the container. -->
    <fragment android:id="@+id/navigation_drawer"
        android:layout_width="@dimen/navigation_drawer_width"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:name="ninja.mpnguyen.bisque.NavigationDrawerFragment"
        tools:layout="@layout/fragment_navigation_drawer1" />

</android.support.v4.widget.DrawerLayout>


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Reflection.Metadata;

namespace Microsoft.DiaSymReader.PortablePdb
{
    internal sealed class DocumentMap
    {
        private struct DocumentNameAndHandle
        {
            public readonly DocumentHandle Handle;
            public readonly string FileName;

            public DocumentNameAndHandle(DocumentHandle handle, string fileName)
            {
                Handle = handle;
                FileName = fileName;
            }
        }

        private readonly MetadataReader _reader;

        // { last part of document name -> one or many document handles that have the part in commmon }
        private readonly IReadOnlyDictionary<string, KeyValuePair<DocumentNameAndHandle, ImmutableArray<DocumentNameAndHandle>>> _map;

        public DocumentMap(MetadataReader reader)
        {
            _reader = reader;

            // group ignoring case, we will match the case within the group
            _map = GetDocumentsByFileName(reader).GroupBy(StringComparer.OrdinalIgnoreCase);
        }

        private static IEnumerable<KeyValuePair<string, DocumentNameAndHandle>> GetDocumentsByFileName(MetadataReader reader)
        {
            foreach (var documentHandle in reader.Documents)
            {
                string fileName = GetFileName(reader, documentHandle);

                // invalid metadata: document doesn't have a name
                if (fileName == null)
                {
                    continue;
                }

                yield return new KeyValuePair<string, DocumentNameAndHandle>(fileName, new DocumentNameAndHandle(documentHandle, fileName));
            }
        }

        private static string GetFileName(MetadataReader reader, DocumentHandle documentHandle)
        {
            var document = reader.GetDocument(documentHandle);

            if (document.Name.IsNil)
            {
                return null;
            }

            var nameReader = reader.GetBlobReader(document.Name);

            int separator = nameReader.ReadByte();
            if (!FileNameUtilities.IsDirectorySeparator((char)separator))
            {
                return FileNameUtilities.GetFileName(reader.GetString(document.Name));
            }

            // find the last part handle:
            BlobHandle partHandle = default(BlobHandle);
            while (nameReader.RemainingBytes > 0)
            {
                partHandle = nameReader.ReadBlobHandle();
            }

            if (partHandle.IsNil)
            {
                return string.Empty;
            }

            var partReader = reader.GetBlobReader(partHandle);
            var part = partReader.ReadUTF8(partReader.Length);
            if (part.IndexOf('\0') >= 0)
            {
                // bad metadata
                return null;
            }

            // it is valid to encode document name so that the parts contain directory separators:
            return FileNameUtilities.GetFileName(part);
        }

        internal bool TryGetDocument(string fullPath, out DocumentHandle documentHandle)
        {
            var fileName = FileNameUtilities.GetFileName(fullPath);

            KeyValuePair<DocumentNameAndHandle, ImmutableArray<DocumentNameAndHandle>> documents;
            if (!_map.TryGetValue(fileName, out documents))
            {
                documentHandle = default(DocumentHandle);
                return false;
            }

            // SymReader first attempts to find the document by the full path, then by file name with extension.

            if (documents.Key.FileName != null)
            {
                // There is only one document with the specified file name.
                // SymReader returns the document regardless of whether the path matches the name.
                documentHandle = documents.Key.Handle;
                return true;
            }

            Debug.Assert(documents.Value.Length > 1);

            // We have multiple candidates with the same file name. Find the one whose name matches the specified full path.
            // If none does return the first one. It will be the one with the smallest handle, due to the multi-map construction implementation.

            // First try to find candidate whose full name is exactly matching.
            foreach (DocumentNameAndHandle candidate in documents.Value)
            {
                if (_reader.StringComparer.Equals(_reader.GetDocument(candidate.Handle).Name, fullPath, ignoreCase: false))
                {
                    documentHandle = candidate.Handle;
                    return true;
                }
            }

            // Then try to find candidate whose full name is matching ignoring case.
            foreach (DocumentNameAndHandle candidate in documents.Value)
            {
                if (_reader.StringComparer.Equals(_reader.GetDocument(candidate.Handle).Name, fullPath, ignoreCase: true))
                {
                    documentHandle = candidate.Handle;
                    return true;
                }
            }

            // Then try to find candidate whose file name is matching exactly.
            foreach (DocumentNameAndHandle candidate in documents.Value)
            {
                if (candidate.FileName == fileName)
                {
                    documentHandle = candidate.Handle;
                    return true;
                }
            }

            documentHandle = documents.Value[0].Handle;
            return true;
        }
    }
}


text:
> An approach to efficient state-driven realtime data synchronization.

## Design goals

* Transfer diffs
* Realtime synchronization
* Universal JavaScript
* Utilize HTTP 2.0

## Motivation

We want to react on data changes as fast as possible (aka realtime). It does not matter if a change occurs on the client or server side.
We do only want to transfer actual changes.
We want to persist states on client and server side.
We do want to have something more efficient than REST API's for web clients.
We want to have a solid but still straightforward solution for relationships

## Inspiration

* [The Importance of Being Textual](http://www.catb.org/~esr/writings/taoup/html/ch05s01.html)
* [HTTP Compression – GZIP](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/optimize-encoding-and-transfer?hl=en)
* [HTTP Compression – SDCH](https://groups.google.com/forum/#!forum/SDCH)
* [MessagePack](http://msgpack.org/)
* [CouchDB](http://couchdb.apache.org/)
* [PouchDB](http://pouchdb.com/)
* [Websockets](http://www.w3.org/TR/websockets/)
* [virtual-dom](https://github.com/Matt-Esch/virtual-dom)
* [Apache Kafka](http://kafka.apache.org/)
* [PostgREST](https://github.com/begriffs/postgrest)
* [Narayana](http://narayana.io/)

## Bibliography

* [MongoDB stale reads](https://aphyr.com/posts/322-call-me-maybe-mongodb-stale-reads)
* [Starbucks Does Not Use Two-Phase Commits](http://www.enterpriseintegrationpatterns.com/ramblings/18_starbucks.html)
* [Strong consistency models](https://aphyr.com/posts/313-strong-consistency-models)
* [You Can't Sacrifice Partition Tolerance](http://codahale.com/you-cant-sacrifice-partition-tolerance/)
* [Please stop calling databases CP or AP](https://martin.kleppmann.com/2015/05/11/please-stop-calling-databases-cp-or-ap.html)
* [Notes on Distributed Systems for Young Bloods](http://www.somethingsimilar.com/2013/01/14/notes-on-distributed-systems-for-young-bloods/)
* [The Eight Fallacies of Distributed Computing](https://blogs.oracle.com/jag/resource/Fallacies.html)

## People

* [Kyle Kingsbury](https://aphyr.com/posts)


text:
import { init } from "./classEditor";
import { init as serverInit } from "./server";
import { configureToasts } from "./toast";

configureToasts({
    topOrigin: -48
});

window.addEventListener("load", () => {

    serverInit(data => init(data));

});


text:
package com.javarush.test.level16.lesson13.bonus02;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/* Клубок
1. Создай 5 различных своих нитей c отличным от Thread типом:
1.1. нить 1 должна бесконечно выполняться;
1.2. нить 2 должна выводить "InterruptedException" при возникновении исключения InterruptedException;
1.3. нить 3 должна каждые полсекунды выводить "Ура";
1.4. нить 4 должна реализовать интерфейс Message, при вызове метода showWarning нить должна останавливаться;
1.5. нить 5 должна читать с консоли цифры пока не введено слово "N", а потом вывести в консоль сумму введенных цифр.
2. В статическом блоке добавь свои нити в List<Thread> threads в перечисленном порядке.
3. Нити не должны стартовать автоматически.
*/

public class Solution {
    public static List<Thread> threads = new ArrayList<Thread>(5);

    static {
        threads.add(new Thread1());
        threads.add(new Thread2());
        threads.add(new Thread3());
        threads.add(new Thread4());
        threads.add(new Thread5());
    }

    public static class Thread1 extends Thread {
        public void run () {
            while (true) {}
        }
    }
    public static class Thread2 extends Thread {
        public void run () {
            try{
                while (!isInterrupted())
                {

                }
                throw new InterruptedException();
            }catch (InterruptedException e)
            {
                System.out.println("InterruptedException");
            }
        }
    }
    public static class Thread3 extends Thread {
        public void run () {
            while (true) {
                try {
                    System.out.println("Ура");
                    Thread.sleep(500);
                } catch (InterruptedException ignore) {/*NOP*/}
            }
        }
    }
    public static class Thread4 extends Thread implements Message {
        public void showWarning() {
            this.interrupt();
            try
            {
                this.join();
            }
            catch(InterruptedException ignore)
            {/*NOP*/}
        }
        public void run () {
            Thread current = currentThread();
            while (!current.isInterrupted()) {}
        }
    }
    public static class Thread5 extends Thread {
        private int sum;
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        private String a;
        public void run () {
            while (!isInterrupted()) {
                try
                {
                    if ((a = reader.readLine()).equals("N"))
                    {
                        System.out.println(sum);
                        this.interrupt();
                        continue;
                    }
                    sum = sum + Integer.parseInt(a);
                } catch (IOException ignore) {/*NOP*/}
            }
        }
    }
}


text:
/** @file gridfs.h
 *
 *  @brief GridFS declarations
 *
 * */

/*    Copyright 2009-2012 10gen Inc.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

#include "mongodb/mongo.h"

#ifndef MONGO_GRIDFS_H_
#define MONGO_GRIDFS_H_

MONGO_EXTERN_C_START

enum {DEFAULT_CHUNK_SIZE = 256 * 1024};

typedef uint64_t gridfs_offset;

/* A GridFS represents a single collection of GridFS files in the database. */
typedef struct {
    mongo *client; /**> The client to db-connection. */
    const char *dbname; /**> The root database name */
    const char *prefix; /**> The prefix of the GridFS's collections, default is NULL */
    const char *files_ns; /**> The namespace where the file's metadata is stored */
    const char *chunks_ns; /**. The namespace where the files's data is stored in chunks */
} gridfs;

/* A GridFile is a single GridFS file. */
typedef struct {
    gridfs *gfs;        /**> The GridFS where the GridFile is located */
    bson *meta;         /**> The GridFile's bson object where all its metadata is located */
    gridfs_offset pos;  /**> The position is the offset in the file */
    bson_oid_t id;      /**> The files_id of the gridfile */
    char *remote_name;  /**> The name of the gridfile as a string */
    char *content_type; /**> The gridfile's content type */
    gridfs_offset length; /**> The length of this gridfile */
    int chunk_num;      /**> The number of the current chunk being written to */
    char *pending_data; /**> A buffer storing data still to be written to chunks */
    int pending_len;    /**> Length of pending_data buffer */
} gridfile;

MONGO_EXPORT gridfs* gridfs_create();
MONGO_EXPORT void gridfs_dispose(gridfs* gfs);
MONGO_EXPORT gridfile* gridfile_create();
MONGO_EXPORT void gridfile_dispose(gridfile* gf);
MONGO_EXPORT void gridfile_get_descriptor(gridfile* gf, bson* out);

/**
 *  Initializes a GridFS object
 *  @param client - db connection
 *  @param dbname - database name
 *  @param prefix - collection prefix, default is fs if NULL or empty
 *  @param gfs - the GridFS object to initialize
 *
 *  @return - MONGO_OK or MONGO_ERROR.
 */
MONGO_EXPORT int gridfs_init( mongo *client, const char *dbname,
                 const char *prefix, gridfs *gfs );

/**
 * Destroys a GridFS object. Call this when finished with
 * the object..
 *
 * @param gfs a grid
 */
MONGO_EXPORT void gridfs_destroy( gridfs *gfs );

/**
 *  Initializes a gridfile for writing incrementally with gridfs_write_buffer.
 *  Once initialized, you can write any number of buffers with gridfs_write_buffer.
 *  When done, you must call gridfs_writer_done to save the file metadata.
 *
 */
MONGO_EXPORT void gridfile_writer_init( gridfile *gfile, gridfs *gfs, const char *remote_name,
                           const char *content_type );

/**
 *  Write to a GridFS file incrementally. You can call this function any number
 *  of times with a new buffer each time. This allows you to effectively
 *  stream to a GridFS file. When finished, be sure to call gridfs_writer_done.
 *
 */
MONGO_EXPORT void gridfile_write_buffer( gridfile *gfile, const char *data,
                            gridfs_offset length );

/**
 *  Signal that writing of this gridfile is complete by
 *  writing any buffered chunks along with the entry in the
 *  files collection.
 *
 *  @return - MONGO_OK or MONGO_ERROR.
 */
MONGO_EXPORT int gridfile_writer_done( gridfile *gfile );

/**
 *  Store a buffer as a GridFS file.
 *  @param gfs - the working GridFS
 *  @param data - pointer to buffer to store in GridFS
 *  @param length - length of the buffer
 *  @param remotename - filename for use in the database
 *  @param contenttype - optional MIME type for this object
 *
 *  @return - MONGO_OK or MONGO_ERROR.
 */
MONGO_EXPORT int gridfs_store_buffer( gridfs *gfs, const char *data, gridfs_offset length,
                          const char *remotename,
                          const char *contenttype );

/**
 *  Open the file referenced by filename and store it as a GridFS file.
 *  @param gfs - the working GridFS
 *  @param filename - local filename relative to the process
 *  @param remotename - optional filename for use in the database
 *  @param contenttype - optional MIME type for this object
 *
 *  @return - MONGO_OK or MONGO_ERROR.
 */
MONGO_EXPORT int gridfs_store_file( gridfs *gfs, const char *filename,
                        const char *remotename, const char *contenttype );

/**
 *  Removes the files referenced by filename from the db
 *  @param gfs - the working GridFS
 *  @param filename - the filename of the file/s to be removed
 */
MONGO_EXPORT void gridfs_remove_filename( gridfs *gfs, const char *filename );

/**
 *  Find the first file matching the provided query within the
 *  GridFS files collection, and return the file as a GridFile.
 *
 *  @param gfs - the working GridFS
 *  @param query - a pointer to the bson with the query data
 *  @param gfile - the output GridFile to be initialized
 *
 *  @return MONGO_OK if successful, MONGO_ERROR otherwise
 */
MONGO_EXPORT int gridfs_find_query( gridfs *gfs, bson *query, gridfile *gfile );

/**
 *  Find the first file referenced by filename within the GridFS
 *  and return it as a GridFile
 *  @param gfs - the working GridFS
 *  @param filename - filename of the file to find
 *  @param gfile - the output GridFile to be intialized
 *
 *  @return MONGO_OK or MONGO_ERROR.
 */
MONGO_EXPORT int gridfs_find_filename( gridfs *gfs, const char *filename, gridfile *gfile );

/**
 *  Initializes a GridFile containing the GridFS and file bson
 *  @param gfs - the GridFS where the GridFile is located
 *  @param meta - the file object
 *  @param gfile - the output GridFile that is being initialized
 *
 *  @return - MONGO_OK or MONGO_ERROR.
 */
MONGO_EXPORT int gridfile_init( gridfs *gfs, bson *meta, gridfile *gfile );

/**
 *  Destroys the GridFile
 *
 *  @param oGridFIle - the GridFile being destroyed
 */
MONGO_EXPORT void gridfile_destroy( gridfile *gfile );

/**
 *  Returns whether or not the GridFile exists
 *  @param gfile - the GridFile being examined
 */
MONGO_EXPORT bson_bool_t gridfile_exists( gridfile *gfile );

/**
 *  Returns the filename of GridFile
 *  @param gfile - the working GridFile
 *
 *  @return - the filename of the Gridfile
 */
MONGO_EXPORT const char *gridfile_get_filename( gridfile *gfile );

/**
 *  Returns the size of the chunks of the GridFile
 *  @param gfile - the working GridFile
 *
 *  @return - the size of the chunks of the Gridfile
 */
MONGO_EXPORT int gridfile_get_chunksize( gridfile *gfile );

/**
 *  Returns the length of GridFile's data
 *
 *  @param gfile - the working GridFile
 *
 *  @return - the length of the Gridfile's data
 */
MONGO_EXPORT gridfs_offset gridfile_get_contentlength( gridfile *gfile );

/**
 *  Returns the MIME type of the GridFile
 *
 *  @param gfile - the working GridFile
 *
 *  @return - the MIME type of the Gridfile
 *            (NULL if no type specified)
 */
MONGO_EXPORT const char *gridfile_get_contenttype( gridfile *gfile );

/**
 *  Returns the upload date of GridFile
 *
 *  @param gfile - the working GridFile
 *
 *  @return - the upload date of the Gridfile
 */
MONGO_EXPORT bson_date_t gridfile_get_uploaddate( gridfile *gfile );

/**
 *  Returns the MD5 of GridFile
 *
 *  @param gfile - the working GridFile
 *
 *  @return - the MD5 of the Gridfile
 */
MONGO_EXPORT const char *gridfile_get_md5( gridfile *gfile );

/**
 *  Returns the field in GridFile specified by name
 *
 *  @param gfile - the working GridFile
 *  @param name - the name of the field to be returned
 *
 *  @return - the data of the field specified
 *            (NULL if none exists)
 */
const char *gridfile_get_field( gridfile *gfile,
                                const char *name );

/**
 *  Returns a boolean field in GridFile specified by name
 *  @param gfile - the working GridFile
 *  @param name - the name of the field to be returned
 *
 *  @return - the boolean of the field specified
 *            (NULL if none exists)
 */
bson_bool_t gridfile_get_boolean( gridfile *gfile,
                                  const char *name );

/**
 *  Returns the metadata of GridFile
 *  @param gfile - the working GridFile
 *
 *  @return - the metadata of the Gridfile in a bson object
 *            (an empty bson is returned if none exists)
 */
MONGO_EXPORT void gridfile_get_metadata( gridfile *gfile, bson* out );

/**
 *  Returns the number of chunks in the GridFile
 *  @param gfile - the working GridFile
 *
 *  @return - the number of chunks in the Gridfile
 */
MONGO_EXPORT int gridfile_get_numchunks( gridfile *gfile );

/**
 *  Returns chunk n of GridFile
 *  @param gfile - the working GridFile
 *
 *  @return - the nth chunk of the Gridfile
 */
MONGO_EXPORT void gridfile_get_chunk( gridfile *gfile, int n, bson* out );

/**
 *  Returns a mongo_cursor of *size* chunks starting with chunk *start*
 *
 *  @param gfile - the working GridFile
 *  @param start - the first chunk in the cursor
 *  @param size - the number of chunks to be returned
 *
 *  @return - mongo_cursor of the chunks (must be destroyed after use)
 */
MONGO_EXPORT mongo_cursor *gridfile_get_chunks( gridfile *gfile, int start, int size );

/**
 *  Writes the GridFile to a stream
 *
 *  @param gfile - the working GridFile
 *  @param stream - the file stream to write to
 */
MONGO_EXPORT gridfs_offset gridfile_write_file( gridfile *gfile, FILE *stream );

/**
 *  Reads length bytes from the GridFile to a buffer
 *  and updates the position in the file.
 *  (assumes the buffer is large enough)
 *  (if size is greater than EOF gridfile_read reads until EOF)
 *
 *  @param gfile - the working GridFile
 *  @param size - the amount of bytes to be read
 *  @param buf - the buffer to read to
 *
 *  @return - the number of bytes read
 */
MONGO_EXPORT gridfs_offset gridfile_read( gridfile *gfile, gridfs_offset size, char *buf );

/**
 *  Updates the position in the file
 *  (If the offset goes beyond the contentlength,
 *  the position is updated to the end of the file.)
 *
 *  @param gfile - the working GridFile
 *  @param offset - the position to update to
 *
 *  @return - resulting offset location
 */
MONGO_EXPORT gridfs_offset gridfile_seek( gridfile *gfile, gridfs_offset offset );

MONGO_EXTERN_C_END

#endif