text:
exports.level = {
  "goalTreeString": "{\"branches\":{\"master\":{\"target\":\"C3\",\"id\":\"master\",\"remoteTrackingBranchID\":\"o/master\",\"localBranchesThatTrackThis\":null},\"o/master\":{\"target\":\"C3\",\"id\":\"o/master\",\"remoteTrackingBranchID\":null,\"localBranchesThatTrackThis\":[\"master\"]}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C2\"],\"id\":\"C3\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"},\"originTree\":{\"branches\":{\"master\":{\"target\":\"C3\",\"id\":\"master\",\"remoteTrackingBranchID\":null,\"localBranchesThatTrackThis\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C2\"],\"id\":\"C3\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"}}}",
  "solutionCommand": "git clone;git commit;git commit;git push",
  "startTree": "{\"branches\":{\"master\":{\"target\":\"C1\",\"id\":\"master\",\"remoteTrackingBranchID\":null,\"localBranchesThatTrackThis\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"}}",
  "name": {
    "en_US": "Git Pushin'",
    "zh_CN": "Git Push",
    "zh_TW": "git push",
    "es_AR": "git push",
    "pt_BR": "Git Push",
    "de_DE": "Git Push",
    "ja"   : "Git Push",
    "fr_FR": "Git push",
    "ru_RU": "Git push"
  },
  "hint": {
    "en_US": "Remember you have to clone before you can push!",
    "zh_CN": "push 之前你需要先 clone.",
    "zh_TW": "push 之前你需要先 clone",
    "es_AR": "¡Acordate que tenés que clonar antes de pushear!",
    "pt_BR": "Lembre-se de clonar antes de fazer o push!",
    "de_DE": "Denk dran, dass du einen Clone brauchst bevor du Pushen kannst!",
    "ja"   : "Pushができるようになるには、まずリポジトリをcloneする必要があるのをお忘れなく",
    "fr_FR": "Rappelez-vous que vous devez cloner avant de pouvoir faire un push !",
    "ru_RU": "Помните, что прежде чем push-ить вам нужно сколнировать репозиторий!"
  },
  "startDialog": {
    "en_US": {
      "childViews": [
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "## Git Push",
              "",
              "Ok, so I've fetched changes from remote and incorporated them into my work locally. That's great and all... but how do I share _my_ awesome work with everyone else?",
              "",
              "Well, the way to upload shared work is the opposite of downloading shared work. And what's the opposite of `git pull`? `git push`!",
              "",
              "`git push` is responsible for uploading _your_ changes to a specified remote and updating that remote to incorporate your new commits. Once `git push` completes, all your friends can then download  your work from the remote.",
              "",
              "You can think of `git push` as a command to \"publish\" your work. It has a bunch of subtleties that we will get into shortly, but let's start with baby steps...",
              "",
              "*note -- the behavior of `git push` with no arguments varies depending on one of git's settings called `push.default`. The default value for this setting depends on the version of git you're using, but we are going to use the `upstream` value in our lessons. This isn't a huge deal, but it's worth checking your settings before pushing in your own projects.*"
            ]
          }
        },
        {
          "type": "GitDemonstrationView",
          "options": {
            "beforeMarkdowns": [
              "Here we have some changes that the remote does not have. Let's upload them!"
            ],
            "afterMarkdowns": [
              "There we go -- the remote received commit `C2`, the branch `master` on the remote was updated to point at `C2`, and our *own* reflection of the remote (`o/master`) was updated as well. Everything is in sync!"
            ],
            "command": "git push",
            "beforeCommand": "git clone; git commit"
          }
        },
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "To finish this level, simply share two new commits with the remote. Strap in though, because these lessons are about to get a lot harder!"
            ]
          }
        }
      ]
    },
    "fr_FR": {
      "childViews": [
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "## Git Push",
              "",
              "Ok, donc j'ai rapatrié les changements du dépôt distant et je les ai incorporés dans mon travail local. C'est super... mais comment je partage _mon_ travail génial avec tous les autres ?",
              "",
              "En fait, la manière d'envoyer du travail à partager fonctionne à l'opposé du téléchargement de travail partagé. Et quel est l'opposé de `git pull` (tire) ? `git push` (pousse) !",
              "",
              "`git push` est responsable de l'envoi de _vos_ changements vers un dépôt distant et de la mise à jour de ce dépôt pour incorporer vos commits. Une fois `git push` terminé, tous vos amis peuvent télécharger votre travail depuis le dépôt distant.",
              "",
              "Vous pouvez voir `git push` comme une commande qui \"publie\" votre travail. Elle présente quelques subtilités que nous allons voir rapidement, mais commençons par le B.A.-BA...",
              "",
              "*Note : le comportement de `git push` avec aucun argument varie avec l'un des réglages de configuration de git nommé `push.default`. La valeur par défaut de ce réglage dépend de la version de git utilisée, mais nous allons utiliser la valeur `upstream` dans nos leçons. Cela ne change pas grand chose pour ces exercices, mais vérifiez tout de même vos réglages avant de pusher vos propres projets.*"
            ]
          }
        },
        {
          "type": "GitDemonstrationView",
          "options": {
            "beforeMarkdowns": [
              "Nous avons fait ici quelques changements que le dépôt distant n'a pas. Envoyons-les !"
            ],
            "afterMarkdowns": [
              "Et voilà : le dépôt distant a reçu le commit `C2`, la branche `master` a été mise à jour sur `C2`, et votre *propre* représentation de la branche distante (`o/master`) a aussi été mise à jour. Tout est synchronisé !"
            ],
            "command": "git push",
            "beforeCommand": "git clone; git commit"
          }
        },
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "Pour finir ce niveau, partagez simplement deux nouveaux commits avec le dépôt distant. Accrochez-vous, parce que ces leçons vont devenir beaucoup plus difficiles !"
            ]
          }
        }
      ]
    },
    "es_AR": {
      "childViews": [
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "## git push",
              "",
              "Ok, entonces ya bajé los cambios de un repositorio remoto y los integré en mi trabajo localmente. Esto es genial y todo... pero ¿cómo comparto _mis_ cambios con el resto?",
              "",
              "Bueno, la forma de subir el trabajo compartido es la opuesta a cómo descargar trabajo. Y ¿qué es lo opuesto a `git pull`? ¡`git push`!",
              "",
              "`git push` es el responsable de subir _tus_ cambios a un remoto específico y de actualizar ese remoto para incluir tus nuevos commits. Cuando `git push` termina, todos tus amigos pueden descargar tu trabajo del remoto.",
              "",
              "Podés pensar en `git push` como un comando para \"publicar\" tu trabajo. Tiene un par de sutilezas con las que vamos a meternos pronto, pero empecemos de a poco."
            ]
          }
        },
        {
          "type": "GitDemonstrationView",
          "options": {
            "beforeMarkdowns": [
              "Acá tenemos algunos cambios que nuestro remoto no tiene. ¡Subámoslos!"
            ],
            "afterMarkdowns": [
              "Ahí está: el remoto recibió el commit `C2`, la rama `master` de ese remoto se actualizó para apuntar a `C2`, y nuestro *propio* reflejo del remoto (`o/master`) también fue actualizado. ¡Todo está en sincronía!"
            ],
            "command": "git push",
            "beforeCommand": "git clone; git commit"
          }
        },
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "Para completar este nivel, simplemente compartí dos nuevos commits con el remoto. Igual, no te confíes, ¡ya se van a complicar las lecciones!"
            ]
          }
        }
      ]
    },
    "pt_BR": {
      "childViews": [
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "## Git Push",
              "",
              "Ok, então vimos como baixar mudanças do repositório remoto e incorporá-las à árvore local. Isso é ótimo e tal... mas como eu faço para compartilhar o _meu_ trabalho sensacional com as outras pessoas?",
              "",
              "Bem, a forma de subir trabalho a ser compartilhado é a oposta daquela de baixar trabalho que foi compartilhado. E qual o oposto de `git pull` (puxar)? É `git push` (empurrar)!",
              "",
              "O `git push` é responsável por subir as _suas_ mudanças para um repositório remoto especificado, e atualizar esse remoto para incorporar seus novos commits. Uma vez que o `git push` se completa, todos os seus amigos podem baixar o seu trabalho do repositório remoto.",
              "",
              "Você pode pensar no `git push` como um comando para \"publicar\" o seu trabalho. Ele tem uma série de nuances que vamos abordar em breve, mas comecemos com passos curtos...",
              "",
              "*Nota -- o comportamento de `git push` sem argumentos varia dependendo da configuração `push.default` do Git. O valor padrão para essa configuração depende da versão do Git que você estiver usando, mas vamos assumir o valor `upstream` nestas lições. Isso não é um grande problema, mas vale a pena verificar suas configurações antes de fazer push nos seus próprios projetos.*"
            ]
          }
        },
        {
          "type": "GitDemonstrationView",
          "options": {
            "beforeMarkdowns": [
              "Aqui temos algumas mudanças que o repositório remoto não contém. Vamos subi-las!"
            ],
            "afterMarkdowns": [
              "Aqui vamos nós -- o repositório remoto recebeu o commit `C2`, o ramo `master` no repositório remoto foi atualizado para apontar para `C2`, e a *nossa* reflexão do remoto (`o/master`) foi atualizada também. Está tudo sincronizado!"
            ],
            "command": "git push",
            "beforeCommand": "git clone; git commit"
          }
        },
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "Para completar este nível, simplesmente compartilhe dois novos commits com o repositório remoto. No entanto, segure-se no seu assento, pois estas lições estão prestes a ficar mais difíceis!"
            ]
          }
        }
      ]
    },
    "zh_TW": {
      "childViews": [
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "## Git Push",
              "",
              "ok,現在我已經從 remote 下載了一些更新,並且把它們 merge 到我的 local 上面的 branch,這聽起來實在太讚了...,但是我要如何分享_我_所做的更新給其它人呢?",
              "",
              "喔,其實上傳並且分享更新跟下載更新並且 merge 是相反的兩件事情,那什麼是 `git pull` 的相反呢? 那就是 `git push`!",
              "",
              "`git push` 負責上傳_你的_ commit 到特定 remote 上面並且做出相對應的更新,只要做完了 `git push`,所有你的朋友都可以從 remote 上面下載你所送出去的 commit。",
              "",
              "你可以把 `git push` 當作是一個\"發佈\"你的工作進度的指令,還有一些我們即將要講到的細節,但是先讓我們從一些簡單的步驟開始。"
            ]
          }
        },
        {
          "type": "GitDemonstrationView",
          "options": {
            "beforeMarkdowns": [
              "這裡我們有了一些 remote 所沒有的 commit。讓我們來上傳它們吧!"
            ],
            "afterMarkdowns": [
              "我說的沒錯吧!remote 收到了 commit `C2`,同時在 remote 上的 `master` branch 也一起更新並且指向 `C2`,同時我們*自己的* `o/master` 也一併更新了!"
            ],
            "command": "git push",
            "beforeCommand": "git clone; git commit"
          }
        },
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "要完成這個關卡,只要上傳兩個新的 commit 給 remote,不要太得意忘形喔!因為這些課程將會愈來愈難!"
            ]
          }
        }
      ]
    },
    "zh_CN":{
      "childViews": [
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "## Git Push",
              "",
              "太棒了, 我们已经学习了从远端获取|合并工作到我们的本地工作.但是我们如果分享工作呢?",
              "",
              "好吧, 上载工作正好同下载工作相反, 那与`git pull`相反的命令是什么? `git push`! ",
              "",
              "`git push` 负责将你的提交上传到远端, 一旦`git push`完成, 你的朋友就可以在远端下载你的工作了! ",
              "",
              "你可以将`git push`视为发布你工作的命令. 它有一些特别的地方, 稍后我们会了解到, 我们开始吧."
            ]
          }
        },
        {
          "type": "GitDemonstrationView",
          "options": {
            "beforeMarkdowns": [
              "这里我们有一个变更, 而远端却没有, 我们先上传吧!"
            ],
            "afterMarkdowns": [
              "到了, 远端收到的了`C2`提交, 远端的`master`分支 也被更新并指到了`C2`,我们的远端代表(o/master)也同样被更新了. 所有的东西都被同步了!"
            ],
            "command": "git push",
            "beforeCommand": "git clone; git commit"
          }
        },
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "要完成本节, 需要向远端分享两个提交. 戒骄戒躁,课程还会更难哦! "
            ]
          }
        }
      ]
    },
    "de_DE": {
      "childViews": [
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "## Git Push",
              "",
              "Nun hab ich also Änderungen vom entfernten Server geholt und in meine lokale Arbeit integriert. Das ist schön und gut ... aber wie teile ich _meine_ Wahnsinns-Entwicklungen mit allen anderen?",
              "",
              "Naja, das Hochladen von Zeug ist das Gegenteil zum Herunterladen von Zeug. Und was ist das Gegenteil von `git pull`? Genau, `git push`!",
              "",
              "`git push` ist dafür verantwortlich _deine_ Änderungen zu einem bestimmten entfernten Server hochzuladen und dort zu integrieren. Sobald das `git push` durch ist, können alle deine Freunde diese Änderungen zu sich herunterladen.",
              "",
              "Du kannst dir `git push` als einen Befehl zum \"Veröffentlichen\" deiner Arbeit vorstellen. Es gibt da noch ein paar Feinheiten, aber lass uns mal mit kleinen Schritten anfangen."
            ]
          }
        },
        {
          "type": "GitDemonstrationView",
          "options": {
            "beforeMarkdowns": [
              "Hier haben wir ein paar Änderungen, die auf dem Remote noch fehlen. Und hoch damit!"
            ],
            "afterMarkdowns": [
              "Na bitte -- das Remote hat den Commit `C2` bekommen, der `master` auf dem Remote ist entsprechend aktualisiert worden und unsere *eigene* Abbildung des `master` auf dem Remote namens `o/master` wurde auch aktualisiert. Alles im Lot!"
            ],
            "command": "git push",
            "beforeCommand": "git clone; git commit"
          }
        },
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "Um diesen Level zu schaffen musst du einfach nur zwei neue Commits auf das Remote bringen. Aber stell dich schon mal darauf ein, dass die nächsten Level anspruchsvoller werden!"
            ]
          }
        }
      ]
    },
    "ru_RU": {
      "childViews": [
          {
              "type": "ModalAlert",
              "options": {
                  "markdowns": [
                      "## Git Push",
                      "",
                      "Хорошо, мы скачали изменения с удалённого репозитория и включили их в наши локальные наработки. Всё это замечательно, но, как нам поделиться _своими_ наработками и изменениями с другими участниками проекта?",
                      "",
                      "Способ, которым мы воспользуемся, является противоположным тому способу, которым мы пользовались ранее для скачивания наработок (`git pull`). Этот способ - использование комманды `git push`!",
                      "",
                      "Комманда `git push` отвечает за загрузку _Ваших_ изменений в указанный удалённый репозиторий, а также включение Ваших коммитов в состав удалённого репозитория. По окончанию работы комманды `git push` все Ваши друзья смогут скачать себе все сделанные Вами наработки.",
                      "",
                      "Вы можете рассматривать комманду `git push` как \"публикацию\" своей работы. Эта комманда скрывает в себе множество тонкостей и ньюансов, с которыми мы познакомимся в ближайшее время, а пока что давайте начнём с малого...",
                      "",
                      "*замечание -- поведение комманды `git push` без аргументов варьируется в зависимости он значения `push.default`,указанной в настройках git-а. Значение по-умолчанию зависит от версии git, которую Вы используете, однако в наших уроках мы будем использовать значение `upstream`. Лучше всегда проверят эту опцию прежде чем push-ить Ваши настоящие проекты.*"
                  ]
              }
          },
          {
              "type": "GitDemonstrationView",
              "options": {
                  "beforeMarkdowns": [
                      "Здесь у нас имеются изменения, которых нету в удалённом репозитории. Давайте же закачаем их туда!"
                  ],
                  "afterMarkdowns": [
                      "Вот так -- удалённый репозиторий получил новый коммит `C2`, ветка `master` на удалённом репозитории теперь указывает на `C2`, и наше *собственное* локальное отображение удалённого репозитория (`o/master`) изменилось соответственно. Всё синхронизировалось!"
                  ],
                  "command": "git push",
                  "beforeCommand": "git clone; git commit"
              }
          },
          {
              "type": "ModalAlert",
              "options": {
                  "markdowns": [
                      "Чтобы выполнить задачу этого упражнения, просто поделитесь своими двумя новыми коммитами с удалённым репозиторием. Соберитесь, потому что все последующие уроки будут намного сложнее предыдущих!"
                  ]
              }
          }
      ]
    },
    "ja": {
      "childViews": [
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "## Git Push",
              "",
              "さて、私たちは変更をリモートからダウンロードしてきて、ローカルの自分の作業に取り込むことができるようになりました。それは素晴らしいことですが、例えば他の誰かに_自分の_作業を共有する場合はどうすればいいでしょう?",
              "",
              "そうですね、共有する作業をアップロードする方法は作業をダウンロードするものと対照的です。`git pull`の反対はなんでしょう? `git push`です!",
              "",
              "`git push`は_あなたの_変更をリモートに対話的にアップロードし、リモートにあなたの新しい変更を取り込みます。`git push`が完了すれば、全ての友人たちがあなたの作業をリモートからダウンロードすることができます。",
              "",
              "`git push`は、あなたの作業を「公開する」コマンドと考えることができます。このコマンドは微妙な点をいくつか持っていますが、とりあえずは初歩から始めてみましょう。。。",
              "",
              "*注:引数なしの`git push`の挙動は、`push.default`と呼ばれるgitの設定値によって異なります。この設定のデフォルト値は、使用しているgitのバージョンに依存しますが、私たちのレッスンでは`upstream`という値を使用します。これはあまり大きな問題ではありませんが、あなたのプロジェクトにプッシュする前にあなたのgitの設定を確認する価値はあるでしょう。*"
            ]
          }
        },
        {
          "type": "GitDemonstrationView",
          "options": {
            "beforeMarkdowns": [
              "ここにリモートにはないいくつかの変更点があります。これをアップロードしてみましょう!"
            ],
            "afterMarkdowns": [
              "さて、いってみましょう -- リモートはコミット`C2`を受け取り、リモート上の`master`ブランチは`C2`の位置に更新され、私たち*自身*のリモートブランチ(`o/master`)も良い具合に更新されました。全てが同期されました!"
            ],
            "command": "git push",
            "beforeCommand": "git clone; git commit"
          }
        },
        {
          "type": "ModalAlert",
          "options": {
            "markdowns": [
              "このレベルを終えるには、単純に二つの新しいコミットをリモートに共有してください。けれども覚悟しておいてください。なぜなら、レッスンは少々難しいことを取り扱っているからです。"
            ]
          }
        }
      ]
    }
  }
};


text:
var EventManager = {
    subscribe: function(event, fn) {
        DEBUG && console.log("Subscribe " + event);
        $(this).bind(event, fn);
    },
    unsubscribe: function(event, fn) {
        DEBUG && console.log("Unsubscribe " + event);
        $(this).unbind(event, fn);
    },
    publish: function(event, data) {
        DEBUG && console.log("Publish " + event);
        $(this).trigger(event, data);
    }
};

redpajama_set_name: RedPajamaGithub


text:
package test.integration.runners;

import org.jbehave.core.junit.JUnitStories;
import test.integration.steps.PlacingOrderWithDiscountSteps;

import java.util.Arrays;
import java.util.List;

/**
 * Created by Marek on 2015-04-23.
 */
public class PlacingOrderStepsWithDiscountRunner extends JUnitStories {

    public PlacingOrderStepsWithDiscountRunner() {
        super();
        this.configuredEmbedder().candidateSteps().add(new PlacingOrderWithDiscountSteps());
    }

    @Override
    protected List<String> storyPaths() {
        return Arrays.asList("test/integration/stories/PlacingOrderWithDiscountStory.story");
    }
}


text:
'use strict';

var types = require('ast-types');

var kindShorthands = ['class', 'constant', 'event', 'external', 'file',
  'function', 'member', 'mixin', 'module', 'namespace', 'typedef'];

/**
 * Infers a `kind` tag from other tags or from the context.
 *
 * @name inferKind
 * @param {Object} comment parsed comment
 * @returns {Object} comment with kind inferred
 */
module.exports = function () {
  return function inferKind(comment) {
    if (comment.kind) {
      return comment;
    }

    for (var i = 0; i < kindShorthands.length; i++) {
      var kind = kindShorthands[i];
      if (kind in comment) {
        comment.kind = kind;
        // only allow a comment to have one kind
        return comment;
      }
    }

    types.visit(comment.context.ast, {
      visitClassDeclaration: function () {
        comment.kind = 'class';
        this.abort();
      },
      visitFunction: function (path) {
        if (path.value && path.value.id && path.value.id.name && !!/^[A-Z]/.exec(path.value.id.name)) {
          comment.kind = 'class';
          this.abort();
        } else {
          comment.kind = 'function';
          this.abort();
        }
      },
      visitTypeAlias: function () {
        comment.kind = 'typedef';
        this.abort();
      },
      visitVariableDeclaration: function (path) {
        if (path.value.kind === 'const') {
          comment.kind = 'constant';
          this.abort();
        } else {
          this.traverse(path);
        }
      }
    });

    return comment;
  };
};


text:
layout: post
title:  "White's test"
date:   2016-03-28 22:44:01
categories: statistics
---

Similar to the [Breusch-Pagan test](breusch-pagan-test.html) this tests for `homoscedasticity`, i.e. constant variance of the residuals in a regression test.


text:
/*
 * settings.h
 *
 * Declaration of #defines used in the iSAC codec
 *
 */

#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_SETTINGS_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_SETTINGS_H_

/* sampling frequency (Hz) */
#define FS                                      16000

/* number of samples per frame (either 320 (20ms), 480 (30ms) or 960 (60ms)) */
#define INITIAL_FRAMESAMPLES     960

#define MAXFFTSIZE 2048
#define NFACTOR 11

/* do not modify the following; this will have to be modified if we
 * have a 20ms framesize option */
/**********************************************************************/
/* miliseconds */
#define FRAMESIZE                               30
/* number of samples per frame processed in the encoder, 480 */
#define FRAMESAMPLES                            480 /* ((FRAMESIZE*FS)/1000) */
#define FRAMESAMPLES_HALF      240
#define FRAMESAMPLES_QUARTER                    120
/**********************************************************************/

/* max number of samples per frame (= 60 ms frame) */
#define MAX_FRAMESAMPLES      960
#define MAX_SWBFRAMESAMPLES                     (MAX_FRAMESAMPLES * 2)
/* number of samples per 10ms frame */
#define FRAMESAMPLES_10ms                       ((10*FS)/1000)
#define SWBFRAMESAMPLES_10ms                    (FRAMESAMPLES_10ms * 2)
/* number of samples in 30 ms frame */
#define FRAMESAMPLES_30ms            480
/* number of subframes */
#define SUBFRAMES                               6
/* length of a subframe */
#define UPDATE                                  80
/* length of half a subframe (low/high band) */
#define HALF_SUBFRAMELEN                        (UPDATE/2)
/* samples of look ahead (in a half-band, so actually
 * half the samples of look ahead @ FS) */
#define QLOOKAHEAD                              24    /* 3 ms */
/* order of AR model in spectral entropy coder */
#define AR_ORDER                                6
/* order of LP model in spectral entropy coder */
#define LP_ORDER                                0

/* window length (masking analysis) */
#define WINLEN                                  256
/* order of low-band pole filter used to approximate masking curve */
#define ORDERLO                                 12
/* order of hi-band pole filter used to approximate masking curve */
#define ORDERHI                                 6

#define UB_LPC_ORDER                            4
#define UB_LPC_VEC_PER_FRAME                    2
#define UB16_LPC_VEC_PER_FRAME                  4
#define UB_ACTIVE_SUBFRAMES                     2
#define UB_MAX_LPC_ORDER                        6
#define UB_INTERPOL_SEGMENTS                    1
#define UB16_INTERPOL_SEGMENTS                  3
#define LB_TOTAL_DELAY_SAMPLES                 48
enum ISACBandwidth {isac8kHz = 8, isac12kHz = 12, isac16kHz = 16};
enum ISACBand {kIsacLowerBand = 0, kIsacUpperBand12 = 1, kIsacUpperBand16 = 2};
enum IsacSamplingRate {kIsacWideband = 16,  kIsacSuperWideband = 32};
#define UB_LPC_GAIN_DIM                 SUBFRAMES
#define FB_STATE_SIZE_WORD32                    6

/* order for post_filter_bank */
#define POSTQORDER                              3
/* order for pre-filterbank */
#define QORDER                                  3
/* another order */
#define QORDER_ALL                              (POSTQORDER+QORDER-1)
/* for decimator */
#define ALLPASSSECTIONS                         2

/* array size for byte stream in number of bytes. */
/* The old maximum size still needed for the decoding */
#define STREAM_SIZE_MAX     600
#define STREAM_SIZE_MAX_30  200 /* 200 bytes=53.4 kbps @ 30 ms.framelength */
#define STREAM_SIZE_MAX_60  400 /* 400 bytes=53.4 kbps @ 60 ms.framelength */

/* storage size for bit counts */
#define BIT_COUNTER_SIZE                        30
/* maximum order of any AR model or filter */
#define MAX_AR_MODEL_ORDER                      12//50

/* For pitch analysis */
#define PITCH_FRAME_LEN                         (FRAMESAMPLES_HALF) /* 30 ms  */
#define PITCH_MAX_LAG                           140     /* 57 Hz  */
#define PITCH_MIN_LAG                           20              /* 400 Hz */
#define PITCH_MAX_GAIN                          0.45
#define PITCH_MAX_GAIN_06                       0.27  /* PITCH_MAX_GAIN*0.6 */
#define PITCH_MAX_GAIN_Q12      1843
#define PITCH_LAG_SPAN2                     (PITCH_MAX_LAG/2-PITCH_MIN_LAG/2+5)
#define PITCH_CORR_LEN2                         60     /* 15 ms  */
#define PITCH_CORR_STEP2                        (PITCH_FRAME_LEN/4)
#define PITCH_BW        11     /* half the band width of correlation surface */
#define PITCH_SUBFRAMES                         4
#define PITCH_GRAN_PER_SUBFRAME                 5
#define PITCH_SUBFRAME_LEN        (PITCH_FRAME_LEN/PITCH_SUBFRAMES)
#define PITCH_UPDATE              (PITCH_SUBFRAME_LEN/PITCH_GRAN_PER_SUBFRAME)
/* maximum number of peaks to be examined in correlation surface */
#define PITCH_MAX_NUM_PEAKS                  10
#define PITCH_PEAK_DECAY               0.85
/* For weighting filter */
#define PITCH_WLPCORDER                   6
#define PITCH_WLPCWINLEN               PITCH_FRAME_LEN
#define PITCH_WLPCASYM                   0.3         /* asymmetry parameter */
#define PITCH_WLPCBUFLEN               PITCH_WLPCWINLEN
/* For pitch filter */
/* Extra 50 for fraction and LP filters */
#define PITCH_BUFFSIZE                   (PITCH_MAX_LAG + 50)
#define PITCH_INTBUFFSIZE               (PITCH_FRAME_LEN+PITCH_BUFFSIZE)
/* Max rel. step for interpolation */
#define PITCH_UPSTEP                1.5
/* Max rel. step for interpolation */
#define PITCH_DOWNSTEP                   0.67
#define PITCH_FRACS                             8
#define PITCH_FRACORDER                         9
#define PITCH_DAMPORDER                         5
#define PITCH_FILTDELAY                         1.5f
/* stepsize for quantization of the pitch Gain */
#define PITCH_GAIN_STEPSIZE                     0.125

/* Order of high pass filter */
#define HPORDER                                 2

/* some mathematical constants */
/* log2(exp) */
#define LOG2EXP                                 1.44269504088896
#define PI                                      3.14159265358979

/* Maximum number of iterations allowed to limit payload size */
#define MAX_PAYLOAD_LIMIT_ITERATION             5

/* Redundant Coding */
#define RCU_BOTTLENECK_BPS                      16000
#define RCU_TRANSCODING_SCALE                   0.40f
#define RCU_TRANSCODING_SCALE_INVERSE           2.5f

#define RCU_TRANSCODING_SCALE_UB                0.50f
#define RCU_TRANSCODING_SCALE_UB_INVERSE        2.0f

#define SIZE_RESAMPLER_STATE  6

/* Define Error codes */
/* 6000 General */
#define ISAC_MEMORY_ALLOCATION_FAILED    6010
#define ISAC_MODE_MISMATCH       6020
#define ISAC_DISALLOWED_BOTTLENECK     6030
#define ISAC_DISALLOWED_FRAME_LENGTH    6040
#define ISAC_UNSUPPORTED_SAMPLING_FREQUENCY         6050

/* 6200 Bandwidth estimator */
#define ISAC_RANGE_ERROR_BW_ESTIMATOR    6240
/* 6400 Encoder */
#define ISAC_ENCODER_NOT_INITIATED     6410
#define ISAC_DISALLOWED_CODING_MODE     6420
#define ISAC_DISALLOWED_FRAME_MODE_ENCODER   6430
#define ISAC_DISALLOWED_BITSTREAM_LENGTH            6440
#define ISAC_PAYLOAD_LARGER_THAN_LIMIT              6450
#define ISAC_DISALLOWED_ENCODER_BANDWIDTH           6460
/* 6600 Decoder */
#define ISAC_DECODER_NOT_INITIATED     6610
#define ISAC_EMPTY_PACKET       6620
#define ISAC_DISALLOWED_FRAME_MODE_DECODER   6630
#define ISAC_RANGE_ERROR_DECODE_FRAME_LENGTH  6640
#define ISAC_RANGE_ERROR_DECODE_BANDWIDTH   6650
#define ISAC_RANGE_ERROR_DECODE_PITCH_GAIN   6660
#define ISAC_RANGE_ERROR_DECODE_PITCH_LAG   6670
#define ISAC_RANGE_ERROR_DECODE_LPC     6680
#define ISAC_RANGE_ERROR_DECODE_SPECTRUM   6690
#define ISAC_LENGTH_MISMATCH      6730
#define ISAC_RANGE_ERROR_DECODE_BANDWITH            6740
#define ISAC_DISALLOWED_BANDWIDTH_MODE_DECODER      6750
#define ISAC_DISALLOWED_LPC_MODEL                   6760
/* 6800 Call setup formats */
#define ISAC_INCOMPATIBLE_FORMATS     6810

#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_SETTINGS_H_ */


text:
package roles

import "github.com/gophercloud/gophercloud"

const (
	rolePath = "roles"
)

func listURL(client *gophercloud.ServiceClient) string {
	return client.ServiceURL(rolePath)
}

func getURL(client *gophercloud.ServiceClient, roleID string) string {
	return client.ServiceURL(rolePath, roleID)
}

func createURL(client *gophercloud.ServiceClient) string {
	return client.ServiceURL(rolePath)
}

func updateURL(client *gophercloud.ServiceClient, roleID string) string {
	return client.ServiceURL(rolePath, roleID)
}

func deleteURL(client *gophercloud.ServiceClient, roleID string) string {
	return client.ServiceURL(rolePath, roleID)
}

func listAssignmentsURL(client *gophercloud.ServiceClient) string {
	return client.ServiceURL("role_assignments")
}

func listAssignmentsOnResourceURL(client *gophercloud.ServiceClient, targetType, targetID, actorType, actorID string) string {
	return client.ServiceURL(targetType, targetID, actorType, actorID, rolePath)
}

func assignURL(client *gophercloud.ServiceClient, targetType, targetID, actorType, actorID, roleID string) string {
	return client.ServiceURL(targetType, targetID, actorType, actorID, rolePath, roleID)
}


text:
namespace content {

namespace {

typedef base::Callback<void(bool,
#if defined(OS_ANDROID)
                            base::ScopedFD,
#endif
                            base::Process)> NotifyCallback;

void RecordHistogramsOnLauncherThread(base::TimeDelta launch_time) {
  DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER);
  // Log the launch time, separating out the first one (which will likely be
  // slower due to the rest of the browser initializing at the same time).
  static bool done_first_launch = false;
  if (done_first_launch) {
    UMA_HISTOGRAM_TIMES("MPArch.ChildProcessLaunchSubsequent", launch_time);
  } else {
    UMA_HISTOGRAM_TIMES("MPArch.ChildProcessLaunchFirst", launch_time);
    done_first_launch = true;
  }
}

#if defined(OS_ANDROID)
// TODO(sievers): Remove this by defining better what happens on what
// thread in the corresponding Java code.
void OnChildProcessStartedAndroid(const NotifyCallback& callback,
                                  BrowserThread::ID client_thread_id,
                                  const base::TimeTicks begin_launch_time,
                                  base::ScopedFD ipcfd,
                                  base::ProcessHandle handle) {
  // This can be called on the launcher thread or UI thread.
  base::TimeDelta launch_time = base::TimeTicks::Now() - begin_launch_time;
  BrowserThread::PostTask(
      BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
      base::Bind(&RecordHistogramsOnLauncherThread, launch_time));

  base::Closure callback_on_client_thread(
      base::Bind(callback, false, base::Passed(&ipcfd),
                 base::Passed(base::Process(handle))));
  if (BrowserThread::CurrentlyOn(client_thread_id)) {
    callback_on_client_thread.Run();
  } else {
    BrowserThread::PostTask(
        client_thread_id, FROM_HERE, callback_on_client_thread);
 }
}
#endif

void LaunchOnLauncherThread(const NotifyCallback& callback,
                            BrowserThread::ID client_thread_id,
                            int child_process_id,
                            SandboxedProcessLauncherDelegate* delegate,
#if defined(OS_ANDROID)
                            base::ScopedFD ipcfd,
#endif
                            base::CommandLine* cmd_line) {
  DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER);
  scoped_ptr<SandboxedProcessLauncherDelegate> delegate_deleter(delegate);
#if defined(OS_WIN)
  bool use_zygote = false;
  bool launch_elevated = delegate->ShouldLaunchElevated();
#elif defined(OS_MACOSX)
  bool use_zygote = false;
  base::EnvironmentMap env = delegate->GetEnvironment();
  base::ScopedFD ipcfd = delegate->TakeIpcFd();
#elif defined(OS_POSIX) && !defined(OS_ANDROID)
  bool use_zygote = delegate->ShouldUseZygote();
  base::EnvironmentMap env = delegate->GetEnvironment();
  base::ScopedFD ipcfd = delegate->TakeIpcFd();
#endif
  scoped_ptr<base::CommandLine> cmd_line_deleter(cmd_line);
  base::TimeTicks begin_launch_time = base::TimeTicks::Now();

  base::Process process;
#if defined(OS_WIN)
  if (launch_elevated) {
    base::LaunchOptions options;
    options.start_hidden = true;
    process = base::LaunchElevatedProcess(*cmd_line, options);
  } else {
    process = StartSandboxedProcess(delegate, cmd_line);
  }
#elif defined(OS_POSIX)
  std::string process_type =
      cmd_line->GetSwitchValueASCII(switches::kProcessType);
  scoped_ptr<FileDescriptorInfo> files_to_register(
      FileDescriptorInfoImpl::Create());

#if defined(OS_ANDROID)
  files_to_register->Share(kPrimaryIPCChannel, ipcfd.get());
#else
  files_to_register->Transfer(kPrimaryIPCChannel, ipcfd.Pass());
#endif
#endif

#if defined(OS_ANDROID)
  // Android WebView runs in single process, ensure that we never get here
  // when running in single process mode.
  CHECK(!cmd_line->HasSwitch(switches::kSingleProcess));

  GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess(
      *cmd_line, child_process_id, files_to_register.get());

  StartChildProcess(
      cmd_line->argv(), child_process_id, files_to_register.Pass(),
      base::Bind(&OnChildProcessStartedAndroid, callback, client_thread_id,
                 begin_launch_time, base::Passed(&ipcfd)));

#elif defined(OS_POSIX)
  // We need to close the client end of the IPC channel to reliably detect
  // child termination.

#if !defined(OS_MACOSX)
  GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess(
      *cmd_line, child_process_id, files_to_register.get());
  if (use_zygote) {
    base::ProcessHandle handle = ZygoteHostImpl::GetInstance()->ForkRequest(
        cmd_line->argv(), files_to_register.Pass(), process_type);
    process = base::Process(handle);
  } else
  // Fall through to the normal posix case below when we're not zygoting.
#endif  // !defined(OS_MACOSX)
  {
    // Convert FD mapping to FileHandleMappingVector
    base::FileHandleMappingVector fds_to_map =
        files_to_register->GetMappingWithIDAdjustment(
            base::GlobalDescriptors::kBaseDescriptor);

#if !defined(OS_MACOSX)
    if (process_type == switches::kRendererProcess) {
      const int sandbox_fd =
          RenderSandboxHostLinux::GetInstance()->GetRendererSocket();
      fds_to_map.push_back(std::make_pair(
          sandbox_fd,
          GetSandboxFD()));
    }
#endif  // defined(OS_MACOSX)

    // Actually launch the app.
    base::LaunchOptions options;
    options.environ = env;
    options.fds_to_remap = &fds_to_map;

#if defined(OS_MACOSX)
    // Hold the MachBroker lock for the duration of LaunchProcess. The child
    // will send its task port to the parent almost immediately after startup.
    // The Mach message will be delivered to the parent, but updating the
    // record of the launch will wait until after the placeholder PID is
    // inserted below. This ensures that while the child process may send its
    // port to the parent prior to the parent leaving LaunchProcess, the
    // order in which the record in MachBroker is updated is correct.
    MachBroker* broker = MachBroker::GetInstance();
    broker->GetLock().Acquire();

    // Make sure the MachBroker is running, and inform it to expect a
    // check-in from the new process.
    broker->EnsureRunning();

    const int bootstrap_sandbox_policy = delegate->GetSandboxType();
    if (ShouldEnableBootstrapSandbox() &&
        bootstrap_sandbox_policy != SANDBOX_TYPE_INVALID) {
      options.replacement_bootstrap_name =
          GetBootstrapSandbox()->server_bootstrap_name();
      GetBootstrapSandbox()->PrepareToForkWithPolicy(
          bootstrap_sandbox_policy);
    }
#endif  // defined(OS_MACOSX)

    process = base::LaunchProcess(*cmd_line, options);

#if defined(OS_MACOSX)
    if (ShouldEnableBootstrapSandbox() &&
        bootstrap_sandbox_policy != SANDBOX_TYPE_INVALID) {
      GetBootstrapSandbox()->FinishedFork(process.Handle());
    }

    if (process.IsValid())
      broker->AddPlaceholderForPid(process.Pid(), child_process_id);

    // After updating the broker, release the lock and let the child's
    // messasge be processed on the broker's thread.
    broker->GetLock().Release();
#endif  // defined(OS_MACOSX)
  }
#endif  // else defined(OS_POSIX)
#if !defined(OS_ANDROID)
  if (process.IsValid()) {
    RecordHistogramsOnLauncherThread(base::TimeTicks::Now() -
                                     begin_launch_time);
  }
  BrowserThread::PostTask(client_thread_id, FROM_HERE,
                          base::Bind(callback,
                                     use_zygote,
                                     base::Passed(&process)));
#endif  // !defined(OS_ANDROID)
}

void TerminateOnLauncherThread(bool zygote, base::Process process) {
  DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER);
#if defined(OS_ANDROID)
  VLOG(1) << "ChromeProcess: Stopping process with handle "
          << process.Handle();
  StopChildProcess(process.Handle());
#else
  // Client has gone away, so just kill the process.  Using exit code 0
  // means that UMA won't treat this as a crash.
  process.Terminate(RESULT_CODE_NORMAL_EXIT, false);
  // On POSIX, we must additionally reap the child.
#if defined(OS_POSIX)
#if !defined(OS_MACOSX)
  if (zygote) {
    // If the renderer was created via a zygote, we have to proxy the reaping
    // through the zygote process.
    ZygoteHostImpl::GetInstance()->EnsureProcessTerminated(process.Handle());
  } else
#endif  // !OS_MACOSX
  base::EnsureProcessTerminated(process.Pass());
#endif  // OS_POSIX
#endif  // defined(OS_ANDROID)
}

void SetProcessBackgroundedOnLauncherThread(base::Process process,
                                            bool background) {
  DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER);
#if defined(OS_MACOSX)
  MachBroker* broker = MachBroker::GetInstance();
  mach_port_t task_port = broker->TaskForPid(process.Pid());
  if (task_port != TASK_NULL) {
    process.SetProcessBackgrounded(task_port, background);
  }
#else
  process.SetProcessBackgrounded(background);
#endif  // defined(OS_MACOSX)
#if defined(OS_ANDROID)
  SetChildProcessInForeground(process.Handle(), !background);
#endif
}

}  // anonymous namespace

ChildProcessLauncher::ChildProcessLauncher(
    SandboxedProcessLauncherDelegate* delegate,
    base::CommandLine* cmd_line,
    int child_process_id,
    Client* client,
    bool terminate_on_shutdown)
    : client_(client),
      termination_status_(base::TERMINATION_STATUS_NORMAL_TERMINATION),
      exit_code_(RESULT_CODE_NORMAL_EXIT),
      zygote_(false),
      starting_(true),
#if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER) ||  \
    defined(MEMORY_SANITIZER) || defined(THREAD_SANITIZER) || \
    defined(UNDEFINED_SANITIZER)
      terminate_child_on_shutdown_(false),
#else
      terminate_child_on_shutdown_(terminate_on_shutdown),
#endif
      weak_factory_(this) {
  DCHECK(CalledOnValidThread());
  CHECK(BrowserThread::GetCurrentThreadIdentifier(&client_thread_id_));
  Launch(delegate, cmd_line, child_process_id);
}

ChildProcessLauncher::~ChildProcessLauncher() {
  DCHECK(CalledOnValidThread());
  if (process_.IsValid() && terminate_child_on_shutdown_) {
    // On Posix, EnsureProcessTerminated can lead to 2 seconds of sleep!  So
    // don't this on the UI/IO threads.
    BrowserThread::PostTask(BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
                            base::Bind(&TerminateOnLauncherThread, zygote_,
                                       base::Passed(&process_)));
  }
}

void ChildProcessLauncher::Launch(
    SandboxedProcessLauncherDelegate* delegate,
    base::CommandLine* cmd_line,
    int child_process_id) {
  DCHECK(CalledOnValidThread());

#if defined(OS_ANDROID)
  // Android only supports renderer, sandboxed utility and gpu.
  std::string process_type =
      cmd_line->GetSwitchValueASCII(switches::kProcessType);
  CHECK(process_type == switches::kGpuProcess ||
        process_type == switches::kRendererProcess ||
        process_type == switches::kUtilityProcess)
      << "Unsupported process type: " << process_type;

  // Non-sandboxed utility or renderer process are currently not supported.
  DCHECK(process_type == switches::kGpuProcess ||
         !cmd_line->HasSwitch(switches::kNoSandbox));

  // We need to close the client end of the IPC channel to reliably detect
  // child termination. We will close this fd after we create the child
  // process which is asynchronous on Android.
  base::ScopedFD ipcfd(delegate->TakeIpcFd().release());
#endif
  NotifyCallback reply_callback(base::Bind(&ChildProcessLauncher::DidLaunch,
                                           weak_factory_.GetWeakPtr(),
                                           terminate_child_on_shutdown_));
  BrowserThread::PostTask(
      BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
      base::Bind(&LaunchOnLauncherThread, reply_callback, client_thread_id_,
                 child_process_id, delegate,
#if defined(OS_ANDROID)
                 base::Passed(&ipcfd),
#endif
                 cmd_line));
}

void ChildProcessLauncher::UpdateTerminationStatus(bool known_dead) {
  DCHECK(CalledOnValidThread());
#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
  if (zygote_) {
    termination_status_ = ZygoteHostImpl::GetInstance()->
        GetTerminationStatus(process_.Handle(), known_dead, &exit_code_);
  } else if (known_dead) {
    termination_status_ =
        base::GetKnownDeadTerminationStatus(process_.Handle(), &exit_code_);
  } else {
#elif defined(OS_MACOSX)
  if (known_dead) {
    termination_status_ =
        base::GetKnownDeadTerminationStatus(process_.Handle(), &exit_code_);
  } else {
#elif defined(OS_ANDROID)
  if (IsChildProcessOomProtected(process_.Handle())) {
    termination_status_ = base::TERMINATION_STATUS_OOM_PROTECTED;
  } else {
#else
  {
#endif
    termination_status_ =
      base::GetTerminationStatus(process_.Handle(), &exit_code_);
  }
}

void ChildProcessLauncher::SetProcessBackgrounded(bool background) {
  DCHECK(CalledOnValidThread());
  base::Process to_pass = process_.Duplicate();
  BrowserThread::PostTask(BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
                          base::Bind(&SetProcessBackgroundedOnLauncherThread,
                                     base::Passed(&to_pass), background));
}

void ChildProcessLauncher::DidLaunch(
    base::WeakPtr<ChildProcessLauncher> instance,
    bool terminate_on_shutdown,
    bool zygote,
#if defined(OS_ANDROID)
    base::ScopedFD ipcfd,
#endif
    base::Process process) {
  if (!process.IsValid())
    LOG(ERROR) << "Failed to launch child process";

  // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/465841
  // is fixed.
  tracked_objects::ScopedTracker tracking_profile1(
      FROM_HERE_WITH_EXPLICIT_FUNCTION(
          "465841 ChildProcessLauncher::Context::Notify::Start"));

  if (instance.get()) {
    instance->Notify(zygote,
#if defined(OS_ANDROID)
                     ipcfd.Pass(),
#endif
                     process.Pass());
  } else {
    // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/465841
    // is fixed.
    tracked_objects::ScopedTracker tracking_profile4(
        FROM_HERE_WITH_EXPLICIT_FUNCTION(
            "465841 ChildProcessLauncher::Context::Notify::ProcessTerminate"));
    if (process.IsValid() && terminate_on_shutdown) {
      // On Posix, EnsureProcessTerminated can lead to 2 seconds of sleep!  So
      // don't this on the UI/IO threads.
      BrowserThread::PostTask(BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
                              base::Bind(&TerminateOnLauncherThread, zygote,
                                         base::Passed(&process)));
    }
  }
}

void ChildProcessLauncher::Notify(
    bool zygote,
#if defined(OS_ANDROID)
    base::ScopedFD ipcfd,
#endif
    base::Process process) {
  DCHECK(CalledOnValidThread());
  starting_ = false;
  process_ = process.Pass();

#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
  zygote_ = zygote;
#endif
  if (process_.IsValid()) {
    // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/465841
    // is fixed.
    tracked_objects::ScopedTracker tracking_profile2(
        FROM_HERE_WITH_EXPLICIT_FUNCTION(
            "465841 ChildProcessLauncher::Context::Notify::ProcessLaunched"));
    client_->OnProcessLaunched();
  } else {
    // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/465841
    // is fixed.
    tracked_objects::ScopedTracker tracking_profile3(
        FROM_HERE_WITH_EXPLICIT_FUNCTION(
            "465841 ChildProcessLauncher::Context::Notify::ProcessFailed"));
    client_->OnProcessLaunchFailed();
  }
}

bool ChildProcessLauncher::IsStarting() {
  // TODO(crbug.com/469248): This fails in some tests.
  // DCHECK(CalledOnValidThread());
  return starting_;
}

const base::Process& ChildProcessLauncher::GetProcess() const {
  // TODO(crbug.com/469248): This fails in some tests.
  // DCHECK(CalledOnValidThread());
  return process_;
}

base::TerminationStatus ChildProcessLauncher::GetChildTerminationStatus(
    bool known_dead,
    int* exit_code) {
  DCHECK(CalledOnValidThread());
  if (!process_.IsValid()) {
    // Process is already gone, so return the cached termination status.
    if (exit_code)
      *exit_code = exit_code_;
    return termination_status_;
  }

  UpdateTerminationStatus(known_dead);
  if (exit_code)
    *exit_code = exit_code_;

  // POSIX: If the process crashed, then the kernel closed the socket
  // for it and so the child has already died by the time we get
  // here. Since GetTerminationStatus called waitpid with WNOHANG,
  // it'll reap the process.  However, if GetTerminationStatus didn't
  // reap the child (because it was still running), we'll need to
  // Terminate via ProcessWatcher. So we can't close the handle here.
  if (termination_status_ != base::TERMINATION_STATUS_STILL_RUNNING)
    process_.Close();

  return termination_status_;
}

ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest(
    Client* client) {
  Client* ret = client_;
  client_ = client;
  return ret;
}

}  // namespace content


text:
package com.rarchives.ripme.ripper.rippers;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;

import com.rarchives.ripme.ripper.AbstractHTMLRipper;
import com.rarchives.ripme.utils.Http;

public class ViewcomicRipper extends AbstractHTMLRipper {

    public ViewcomicRipper(URL url) throws IOException {
        super(url);
    }

        @Override
        public String getHost() {
            return "view-comic";
        }

        @Override
        public String getDomain() {
            return "view-comic.com";
        }

        @Override
        public String getAlbumTitle(URL url) throws MalformedURLException {
            try {
                // Attempt to use album title as GID
                String titleText = getFirstPage().select("title").first().text();
                String title = titleText.replace("Viewcomic reading comics online for free", "");
                title = title.replace("_", "");
                title = title.replace("|", "");
                title = title.replace("…", "");
                title = title.replace(".", "");
                return getHost() + "_" + title.trim();
            } catch (IOException e) {
                // Fall back to default album naming convention
                LOGGER.info("Unable to find title at " + url);
            }
            return super.getAlbumTitle(url);
        }

        @Override
        public String getGID(URL url) throws MalformedURLException {
            Pattern p = Pattern.compile("https?://view-comic.com/([a-zA-Z1-9_-]*)/?$");
            Matcher m = p.matcher(url.toExternalForm());
            if (m.matches()) {
                return m.group(1);
            }
            throw new MalformedURLException("Expected view-comic URL format: " +
                            "view-comic.com/COMIC_NAME - got " + url + " instead");
        }

        @Override
        public Document getFirstPage() throws IOException {
            // "url" is an instance field of the superclass
            return Http.url(url).get();
        }

        @Override
        public List<String> getURLsFromPage(Document doc) {
            List<String> result = new ArrayList<String>();
                for (Element el : doc.select("div.pinbin-copy > a > img")) {
                    result.add(el.attr("src"));
                }
            return result;
        }

        @Override
        public void downloadURL(URL url, int index) {
            addURLToDownload(url, getPrefix(index));
        }
    }


text:
#include <stdio.h>
#include "Ogre.h"
#include "OgreDistanceLodStrategy.h"
#include "OgreDefaultHardwareBufferManager.h"
#include "OgreFileSystem.h"
#include "OgreArchiveManager.h"
#include "MeshWithoutIndexDataTests.h"
#include "OgreLodStrategyManager.h"
#include "OgreLodConfig.h"

#ifdef OGRE_BUILD_COMPONENT_MESHLODGENERATOR
#include "OgreMeshLodGenerator.h"
#endif

// Register the test suite

//--------------------------------------------------------------------------
void MeshWithoutIndexDataTests::SetUp()
{
    OGRE_NEW ResourceGroupManager();
    OGRE_NEW LodStrategyManager();
    mBufMgr = OGRE_NEW DefaultHardwareBufferManager();
    mMeshMgr = OGRE_NEW MeshManager();
    mArchiveMgr = OGRE_NEW ArchiveManager();
    mArchiveMgr->addArchiveFactory(OGRE_NEW FileSystemArchiveFactory());

    MaterialManager* matMgr = OGRE_NEW MaterialManager();
    matMgr->initialise();
}
//--------------------------------------------------------------------------
void MeshWithoutIndexDataTests::TearDown()
{
    OGRE_DELETE MaterialManager::getSingletonPtr();
    OGRE_DELETE mArchiveMgr;
    OGRE_DELETE mMeshMgr;
    OGRE_DELETE mBufMgr;
    OGRE_DELETE LodStrategyManager::getSingletonPtr();
    OGRE_DELETE ResourceGroupManager::getSingletonPtr();
}
//--------------------------------------------------------------------------
TEST_F(MeshWithoutIndexDataTests,CreateSimpleLine)
{
    ManualObject* line = OGRE_NEW ManualObject("line");
    line->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_LIST);
    line->position(0, 50, 0);
    line->position(50, 100, 0);
    line->end();
    String fileName = "line.mesh";
    MeshPtr lineMesh = line->convertToMesh(fileName);
    OGRE_DELETE line;

    EXPECT_TRUE(lineMesh->getNumSubMeshes() == 1);
    EXPECT_TRUE(lineMesh->getSubMesh(0)->indexData->indexCount == 0);
    RenderOperation rop;
    lineMesh->getSubMesh(0)->_getRenderOperation(rop);
    EXPECT_TRUE(rop.useIndexes == false);
    EXPECT_TRUE(lineMesh->getSubMesh(0)->vertexData->vertexCount == 2);

    MeshSerializer meshWriter;
    meshWriter.exportMesh(lineMesh.get(), fileName);

    mMeshMgr->remove(fileName, "General");

    ResourceGroupManager::getSingleton().addResourceLocation(".", "FileSystem");
    MeshPtr loadedLine = mMeshMgr->load(fileName, "General");

    remove(fileName.c_str());

    EXPECT_TRUE(loadedLine->getNumSubMeshes() == 1);
    EXPECT_TRUE(loadedLine->getSubMesh(0)->indexData->indexCount == 0);
    loadedLine->getSubMesh(0)->_getRenderOperation(rop);
    EXPECT_TRUE(rop.useIndexes == false);
    EXPECT_TRUE(lineMesh->getSubMesh(0)->vertexData->vertexCount == 2);

    mMeshMgr->remove(fileName, "General");
}
//--------------------------------------------------------------------------
TEST_F(MeshWithoutIndexDataTests,CreateLineList)
{
    ManualObject* lineList = OGRE_NEW ManualObject("line");
    lineList->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_LIST);
    lineList->position(0, 50, 0);
    lineList->position(50, 100, 0);
    lineList->position(50, 50, 0);
    lineList->position(100, 100, 0);
    lineList->position(0, 50, 0);
    lineList->position(50, 50, 0);
    lineList->end();
    String fileName = "lineList.mesh";
    MeshPtr lineListMesh = lineList->convertToMesh(fileName);
    OGRE_DELETE lineList;

    EXPECT_TRUE(lineListMesh->getNumSubMeshes() == 1);
    EXPECT_TRUE(lineListMesh->getSubMesh(0)->indexData->indexCount == 0);
    RenderOperation rop;
    lineListMesh->getSubMesh(0)->_getRenderOperation(rop);
    EXPECT_TRUE(rop.useIndexes == false);
    EXPECT_TRUE(lineListMesh->getSubMesh(0)->vertexData->vertexCount == 6);

    MeshSerializer meshWriter;
    meshWriter.exportMesh(lineListMesh.get(), fileName);

    mMeshMgr->remove(fileName, "General");

    ResourceGroupManager::getSingleton().addResourceLocation(".", "FileSystem");
    MeshPtr loadedLineList = mMeshMgr->load(fileName, "General");

    remove(fileName.c_str());

    EXPECT_TRUE(loadedLineList->getNumSubMeshes() == 1);
    EXPECT_TRUE(loadedLineList->getSubMesh(0)->indexData->indexCount == 0);
    loadedLineList->getSubMesh(0)->_getRenderOperation(rop);
    EXPECT_TRUE(rop.useIndexes == false);
    EXPECT_TRUE(loadedLineList->getSubMesh(0)->vertexData->vertexCount == 6);

    mMeshMgr->remove(fileName, "General");
}
//--------------------------------------------------------------------------
TEST_F(MeshWithoutIndexDataTests,CreateLineStrip)
{
    ManualObject* lineStrip = OGRE_NEW ManualObject("line");
    lineStrip->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_STRIP);
    lineStrip->position(50, 100, 0);
    lineStrip->position(0, 50, 0);
    lineStrip->position(50, 50, 0);
    lineStrip->position(100, 100, 0);
    lineStrip->end();
    String fileName = "lineStrip.mesh";
    MeshPtr lineStripMesh = lineStrip->convertToMesh(fileName);
    OGRE_DELETE lineStrip;

    EXPECT_TRUE(lineStripMesh->getNumSubMeshes() == 1);
    EXPECT_TRUE(lineStripMesh->getSubMesh(0)->indexData->indexCount == 0);
    RenderOperation rop;
    lineStripMesh->getSubMesh(0)->_getRenderOperation(rop);
    EXPECT_TRUE(rop.useIndexes == false);
    EXPECT_TRUE(lineStripMesh->getSubMesh(0)->vertexData->vertexCount == 4);

    MeshSerializer meshWriter;
    meshWriter.exportMesh(lineStripMesh.get(), fileName);

    mMeshMgr->remove(fileName, "General");

    ResourceGroupManager::getSingleton().addResourceLocation(".", "FileSystem");
    MeshPtr loadedLineStrip = mMeshMgr->load(fileName, "General");

    remove(fileName.c_str());

    EXPECT_TRUE(loadedLineStrip->getNumSubMeshes() == 1);
    EXPECT_TRUE(loadedLineStrip->getSubMesh(0)->indexData->indexCount == 0);
    loadedLineStrip->getSubMesh(0)->_getRenderOperation(rop);
    EXPECT_TRUE(rop.useIndexes == false);
    EXPECT_TRUE(loadedLineStrip->getSubMesh(0)->vertexData->vertexCount == 4);

    mMeshMgr->remove(fileName, "General");
}
//--------------------------------------------------------------------------
TEST_F(MeshWithoutIndexDataTests,CreatePointList)
{
    ManualObject* pointList = OGRE_NEW ManualObject("line");
    pointList->begin("BaseWhiteNoLighting", RenderOperation::OT_POINT_LIST);
    pointList->position(50, 100, 0);
    pointList->position(0, 50, 0);
    pointList->position(50, 50, 0);
    pointList->position(100, 100, 0);
    pointList->end();
    String fileName = "pointList.mesh";
    MeshPtr pointListMesh = pointList->convertToMesh(fileName);
    OGRE_DELETE pointList;

    EXPECT_TRUE(pointListMesh->getNumSubMeshes() == 1);
    EXPECT_TRUE(pointListMesh->getSubMesh(0)->indexData->indexCount == 0);
    RenderOperation rop;
    pointListMesh->getSubMesh(0)->_getRenderOperation(rop);
    EXPECT_TRUE(rop.useIndexes == false);
    EXPECT_TRUE(pointListMesh->getSubMesh(0)->vertexData->vertexCount == 4);

    MeshSerializer meshWriter;
    meshWriter.exportMesh(pointListMesh.get(), fileName);

    mMeshMgr->remove(fileName, "General");

    ResourceGroupManager::getSingleton().addResourceLocation(".", "FileSystem");
    MeshPtr loadedPointList = mMeshMgr->load(fileName, "General");

    remove(fileName.c_str());

    EXPECT_TRUE(loadedPointList->getNumSubMeshes() == 1);
    EXPECT_TRUE(loadedPointList->getSubMesh(0)->indexData->indexCount == 0);
    loadedPointList->getSubMesh(0)->_getRenderOperation(rop);
    EXPECT_TRUE(rop.useIndexes == false);
    EXPECT_TRUE(loadedPointList->getSubMesh(0)->vertexData->vertexCount == 4);

    mMeshMgr->remove(fileName, "General");
}
//--------------------------------------------------------------------------
TEST_F(MeshWithoutIndexDataTests,CreateLineWithMaterial)
{
    String matName = "lineMat";
    MaterialPtr matPtr = MaterialManager::getSingleton().create(matName, "General");
    Pass* pass = matPtr->getTechnique(0)->getPass(0);
    pass->setDiffuse(1.0, 0.1, 0.1, 0);

    ManualObject* line = OGRE_NEW ManualObject("line");
    line->begin(matName, RenderOperation::OT_LINE_LIST);
    line->position(0, 50, 0);
    line->position(50, 100, 0);
    line->end();
    String fileName = "lineWithMat.mesh";
    MeshPtr lineMesh = line->convertToMesh(fileName);
    OGRE_DELETE line;

    EXPECT_TRUE(lineMesh->getNumSubMeshes() == 1);
    EXPECT_TRUE(lineMesh->getSubMesh(0)->indexData->indexCount == 0);
    RenderOperation rop;
    lineMesh->getSubMesh(0)->_getRenderOperation(rop);
    EXPECT_TRUE(rop.useIndexes == false);
    EXPECT_TRUE(lineMesh->getSubMesh(0)->vertexData->vertexCount == 2);

    MeshSerializer meshWriter;
    meshWriter.exportMesh(lineMesh.get(), fileName);
    MaterialSerializer matWriter;
    matWriter.exportMaterial(
        MaterialManager::getSingleton().getByName(matName),
        matName + ".material");

    mMeshMgr->remove(fileName, "General");

    ResourceGroupManager::getSingleton().addResourceLocation(".", "FileSystem");
    MeshPtr loadedLine = mMeshMgr->load(fileName, "General");

    remove(fileName.c_str());
    remove((matName + ".material").c_str());

    EXPECT_TRUE(loadedLine->getNumSubMeshes() == 1);
    EXPECT_TRUE(loadedLine->getSubMesh(0)->indexData->indexCount == 0);
    loadedLine->getSubMesh(0)->_getRenderOperation(rop);
    EXPECT_TRUE(rop.useIndexes == false);
    EXPECT_TRUE(lineMesh->getSubMesh(0)->vertexData->vertexCount == 2);

    mMeshMgr->remove(fileName, "General");
}
//--------------------------------------------------------------------------
static void createMeshWithMaterial(String fileName)
{
    String matFileNameSuffix = ".material";
    String matName1 = "red";
    String matFileName1 = matName1 + matFileNameSuffix;
    MaterialPtr matPtr = MaterialManager::getSingleton().create(matName1, "General");
    Pass* pass = matPtr->getTechnique(0)->getPass(0);
    pass->setDiffuse(1.0, 0.1, 0.1, 0);

    String matName2 = "green";
    String matFileName2 = matName2 + matFileNameSuffix;
    matPtr = MaterialManager::getSingleton().create(matName2, "General");
    pass = matPtr->getTechnique(0)->getPass(0);
    pass->setDiffuse(0.1, 1.0, 0.1, 0);

    String matName3 = "blue";
    String matFileName3 = matName3 + matFileNameSuffix;
    matPtr = MaterialManager::getSingleton().create(matName3, "General");
    pass = matPtr->getTechnique(0)->getPass(0);
    pass->setDiffuse(0.1, 0.1, 1.0, 0);

    String matName4 = "yellow";
    String matFileName4 = matName4 + matFileNameSuffix;
    matPtr = MaterialManager::getSingleton().create(matName4, "General");
    pass = matPtr->getTechnique(0)->getPass(0);
    pass->setDiffuse(1.0, 1.0, 0.1, 0);

    ManualObject* manObj = OGRE_NEW ManualObject("mesh");
    manObj->begin(matName1, RenderOperation::OT_TRIANGLE_LIST);
    manObj->position(0, 50, 0);
    manObj->position(50, 50, 0);
    manObj->position(0, 100, 0);
    manObj->triangle(0, 1, 2);
    manObj->position(50, 100, 0);
    manObj->position(0, 100, 0);
    manObj->position(50, 50, 0);
    manObj->triangle(3, 4, 5);
    manObj->end();
    manObj->begin(matName2, RenderOperation::OT_LINE_LIST);
    manObj->position(0, 100, 0);
    manObj->position(-50, 50, 0);
    manObj->position(-50, 0, 0);
    manObj->position(-50, 50, 0);
    manObj->position(-100, 0, 0);
    manObj->position(-50, 0, 0);
    manObj->end();
    manObj->begin(matName3, RenderOperation::OT_LINE_STRIP);
    manObj->position(50, 100, 0);
    manObj->position(100, 50, 0);
    manObj->position(100, 0, 0);
    manObj->position(150, 0, 0);
    manObj->end();
    manObj->begin(matName4, RenderOperation::OT_POINT_LIST);
    manObj->position(50, 0, 0);
    manObj->position(0, 0, 0);
    manObj->end();
    manObj->convertToMesh(fileName);
    OGRE_DELETE manObj;
}
//--------------------------------------------------------------------------
TEST_F(MeshWithoutIndexDataTests,CreateMesh)
{
    String fileName = "indexMix.mesh";
    createMeshWithMaterial(fileName);
    MeshPtr mesh = mMeshMgr->getByName(fileName, "General");

    EXPECT_TRUE(mesh->getNumSubMeshes() == 4);
    RenderOperation rop;
    for (int i=0; i<4; ++i)
    {
        mesh->getSubMesh(i)->_getRenderOperation(rop);
        // First submesh has indexes, the others does not.
        EXPECT_TRUE( rop.useIndexes == (i == 0) );
    }

    MeshSerializer meshWriter;
    meshWriter.exportMesh(mesh.get(), fileName);

    mMeshMgr->remove(fileName, "General");

    ResourceGroupManager::getSingleton().addResourceLocation(".", "FileSystem");
    MeshPtr loadedMesh = mMeshMgr->load(fileName, "General");

    remove(fileName.c_str());

    EXPECT_TRUE(loadedMesh->getNumSubMeshes() == 4);

    mMeshMgr->remove(fileName, "General");
}
//--------------------------------------------------------------------------
TEST_F(MeshWithoutIndexDataTests,CloneMesh)
{
    String originalName = "toClone.mesh";
    createMeshWithMaterial(originalName);
    MeshPtr mesh = mMeshMgr->getByName(originalName, "General");

    String fileName = "clone.mesh";
    MeshPtr clone = mesh->clone(fileName);
    EXPECT_TRUE(mesh->getNumSubMeshes() == 4);

    MeshSerializer meshWriter;
    meshWriter.exportMesh(mesh.get(), fileName);

    mMeshMgr->remove(fileName, "General");

    ResourceGroupManager::getSingleton().addResourceLocation(".", "FileSystem");
    MeshPtr loadedMesh = mMeshMgr->load(fileName, "General");

    remove(fileName.c_str());

    EXPECT_TRUE(loadedMesh->getNumSubMeshes() == 4);

    mMeshMgr->remove(fileName, "General");
}
//--------------------------------------------------------------------------
TEST_F(MeshWithoutIndexDataTests,EdgeList)
{
    String fileName = "testEdgeList.mesh";
    ManualObject* line = OGRE_NEW ManualObject("line");
    line->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_LIST);
    line->position(0, 50, 0);
    line->position(50, 100, 0);
    line->end();
    MeshPtr mesh = line->convertToMesh(fileName);
    OGRE_DELETE line;

    // whole mesh must not contain index data, for this test
    EXPECT_TRUE(mesh->getNumSubMeshes() == 1);
    EXPECT_TRUE(mesh->getSubMesh(0)->indexData->indexCount == 0);

    mesh->buildEdgeList();
    MeshSerializer meshWriter;
    // if it does not crash here, test is passed
    meshWriter.exportMesh(mesh.get(), fileName);

    remove(fileName.c_str());

    mMeshMgr->remove(fileName, "General");
}
//--------------------------------------------------------------------------
TEST_F(MeshWithoutIndexDataTests,GenerateExtremes)
{
    String fileName = "testGenerateExtremes.mesh";
    createMeshWithMaterial(fileName);
    MeshPtr mesh = mMeshMgr->getByName(fileName, "General");

    const size_t NUM_EXTREMES = 4;
    for (ushort i = 0; i < mesh->getNumSubMeshes(); ++i)
    {
        mesh->getSubMesh(i)->generateExtremes(NUM_EXTREMES);
    }
    for (ushort i = 0; i < mesh->getNumSubMeshes(); ++i)
    {
        SubMesh* subMesh = mesh->getSubMesh(i);
        // According to generateExtremes, extremes are built based upon the bounding box indices.
        // But it also creates indices for all bounding boxes even if the mesh does not have any.
        // So...there should always be some extremity points. The number of which may vary.
        if (subMesh->indexData->indexCount > 0)
        {
            EXPECT_TRUE(subMesh->extremityPoints.size() == NUM_EXTREMES);
        }
    }

    mMeshMgr->remove(fileName, "General");
}
//--------------------------------------------------------------------------
TEST_F(MeshWithoutIndexDataTests,BuildTangentVectors)
{
    String fileName = "testBuildTangentVectors.mesh";
    createMeshWithMaterial(fileName);
    MeshPtr mesh = mMeshMgr->getByName(fileName, "General");

    EXPECT_THROW(mesh->buildTangentVectors(), InvalidParametersException);

    mMeshMgr->remove(fileName, "General");
}
//--------------------------------------------------------------------------
TEST_F(MeshWithoutIndexDataTests,GenerateLodLevels)
{
#ifdef OGRE_BUILD_COMPONENT_MESHLODGENERATOR
    String fileName = "testGenerateLodLevels.mesh";
    createMeshWithMaterial(fileName);
    MeshPtr mesh = mMeshMgr->getByName(fileName, "General");

    LodConfig lodConfig(mesh);
    lodConfig.createGeneratedLodLevel(600, 2, LodLevel::VRM_CONSTANT);
    MeshLodGenerator().generateLodLevels(lodConfig);
    // It may be less then 2, when two levels have the same vertex count it will be optimized out and lodLevel.outSkipped=true
    EXPECT_TRUE(mesh->getNumLodLevels() == 2);
    for (ushort i = 0; i < mesh->getNumSubMeshes(); ++i)
    {
        SubMesh* subMesh = mesh->getSubMesh(i);
        for (ushort j = 0; j < mesh->getNumLodLevels() - 1; ++j)
        {
            if (subMesh->indexData->indexCount > 0)
            {
                // This may not be true for all meshes, but in this test we don't have reduced to 0.
                EXPECT_TRUE(subMesh->mLodFaceList[j]->indexCount > 0);
            }
            else
            {
                // Should be 3 because of the dummy triangle being generated
                EXPECT_TRUE(subMesh->mLodFaceList[j]->indexCount == 3);
            }
        }
    }

    MeshSerializer meshWriter;
    meshWriter.exportMesh(mesh.get(), fileName);

    remove(fileName.c_str());

    mMeshMgr->remove(fileName, "General");
#endif
}
//--------------------------------------------------------------------------//--------------------------------------------------------------------------


text:
/*!
 * (C) Ionic http://ionicframework.com - MIT License
 * Built with http://stenciljs.com
 */
.button ion-icon {
  pointer-events: none;
}

ion-icon[slot="start"] {
  font-size: 1.4em;
  line-height: 0.67;
  pointer-events: none;
  margin: 0;
  padding-right: 0.3em;
}

ion-icon[slot="end"] {
  font-size: 1.4em;
  line-height: 0.67;
  pointer-events: none;
  margin: 0;
  padding-left: 0.4em;
}

ion-icon[slot="icon-only"] {
  padding: 0;
  font-size: 1.8em;
  line-height: .67;
}

.button {
  text-align: center;
  -moz-appearance: none;
  -ms-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 0;
  display: inline-block;
  border: 0;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
  cursor: pointer;
  vertical-align: top;
  vertical-align: -webkit-baseline-middle;
  visibility: visible;
  transition: background-color, opacity 100ms linear;
  font-kerning: none;
  user-select: none;
  contain: content;
}

.button-inner {
  display: flex;
  flex-flow: row nowrap;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

[ion-button] {
  text-decoration: none;
}

a[disabled],
button[disabled],
[ion-button][disabled] {
  cursor: default;
  opacity: .4;
  pointer-events: none;
}

.button-block {
  display: block;
  clear: both;
  width: 100%;
  contain: strict;
}

.button-block::after {
  clear: both;
}

.button-full {
  display: block;
  width: 100%;
  contain: strict;
}

.button-full.button-outline {
  border-radius: 0;
  border-right-width: 0;
  border-left-width: 0;
}

.button-ios {
  border-radius: 4px;
  height: 2.8em;
  font-size: 1.6rem;
  color: #fff;
  background-color: #327eff;
  margin: 0.4rem 0.2rem;
  padding: 0 1em;
}

.button-ios.activated {
  background-color: #2e74eb;
  opacity: 1;
}

.button-ios:hover:not(.disable-hover) {
  opacity: 0.8;
}

.button-large-ios {
  height: 2.8em;
  font-size: 2rem;
  padding: 0 1em;
}

.button-small-ios {
  height: 2.1em;
  font-size: 1.3rem;
  padding: 0 0.9em;
}

.button-small-ios ion-icon[slot="icon-only"] {
  font-size: 1.3em;
}

.button-block-ios {
  margin-left: 0;
  margin-right: 0;
}

.button-full-ios {
  margin-left: 0;
  margin-right: 0;
  border-radius: 0;
  border-right-width: 0;
  border-left-width: 0;
}

.button-outline-ios {
  border-radius: 4px;
  border-width: 1px;
  border-style: solid;
  border-color: #327eff;
  color: #327eff;
  background-color: transparent;
}

.button-outline-ios.activated {
  color: #fff;
  background-color: #327eff;
  opacity: 1;
}

.button-clear-ios {
  border-color: transparent;
  color: #327eff;
  background-color: transparent;
}

.button-clear-ios.activated {
  background-color: transparent;
  opacity: 0.4;
}

.button-clear-ios:hover:not(.disable-hover) {
  color: #327eff;
  opacity: 0.6;
}

.button-round-ios {
  border-radius: 64px;
  padding: 0 2.6rem;
}

.button-ios-primary {
  color: #fff;
  background-color: #327eff;
}

.button-ios-primary.activated {
  background-color: #2e74eb;
}

.button-outline-ios-primary {
  border-color: #327eff;
  color: #327eff;
  background-color: transparent;
}

.button-outline-ios-primary.activated {
  color: #fff;
  background-color: #327eff;
}

.button-clear-ios-primary {
  border-color: transparent;
  color: #327eff;
  background-color: transparent;
}

.button-clear-ios-primary.activated {
  opacity: 0.4;
}

.button-clear-ios-primary:hover:not(.disable-hover) {
  color: #327eff;
}

.button-ios-secondary {
  color: #fff;
  background-color: #32db64;
}

.button-ios-secondary.activated {
  background-color: #2ec95c;
}

.button-outline-ios-secondary {
  border-color: #32db64;
  color: #32db64;
  background-color: transparent;
}

.button-outline-ios-secondary.activated {
  color: #fff;
  background-color: #32db64;
}

.button-clear-ios-secondary {
  border-color: transparent;
  color: #32db64;
  background-color: transparent;
}

.button-clear-ios-secondary.activated {
  opacity: 0.4;
}

.button-clear-ios-secondary:hover:not(.disable-hover) {
  color: #32db64;
}

.button-ios-danger {
  color: #fff;
  background-color: #f53d3d;
}

.button-ios-danger.activated {
  background-color: #e13838;
}

.button-outline-ios-danger {
  border-color: #f53d3d;
  color: #f53d3d;
  background-color: transparent;
}

.button-outline-ios-danger.activated {
  color: #fff;
  background-color: #f53d3d;
}

.button-clear-ios-danger {
  border-color: transparent;
  color: #f53d3d;
  background-color: transparent;
}

.button-clear-ios-danger.activated {
  opacity: 0.4;
}

.button-clear-ios-danger:hover:not(.disable-hover) {
  color: #f53d3d;
}

.button-ios-light {
  color: #000;
  background-color: #f4f4f4;
}

.button-ios-light.activated {
  background-color: #e0e0e0;
}

.button-outline-ios-light {
  border-color: #f4f4f4;
  color: #f4f4f4;
  background-color: transparent;
}

.button-outline-ios-light.activated {
  color: #000;
  background-color: #f4f4f4;
}

.button-clear-ios-light {
  border-color: transparent;
  color: #f4f4f4;
  background-color: transparent;
}

.button-clear-ios-light.activated {
  opacity: 0.4;
}

.button-clear-ios-light:hover:not(.disable-hover) {
  color: #f4f4f4;
}

.button-ios-dark {
  color: #fff;
  background-color: #222;
}

.button-ios-dark.activated {
  background-color: #343434;
}

.button-outline-ios-dark {
  border-color: #222;
  color: #222;
  background-color: transparent;
}

.button-outline-ios-dark.activated {
  color: #fff;
  background-color: #222;
}

.button-clear-ios-dark {
  border-color: transparent;
  color: #222;
  background-color: transparent;
}

.button-clear-ios-dark.activated {
  opacity: 0.4;
}

.button-clear-ios-dark:hover:not(.disable-hover) {
  color: #222;
}

.button-strong-ios {
  font-weight: 600;
}

ion-icon {
  display: inline-block;
  font-size: 1.2em;
}

ion-icon svg {
  width: 1em;
  height: 1em;
}

ion-icon[small] {
  min-height: 1.1em;
  font-size: 1.1em;
}

.icon-ios-primary {
  fill: #327eff;
}

.icon-ios-secondary {
  fill: #32db64;
}

.icon-ios-danger {
  fill: #f53d3d;
}

.icon-ios-light {
  fill: #f4f4f4;
}

.icon-ios-dark {
  fill: #222;
}

ion-button.💎,
ion-buttons.💎,
ion-icon.💎 {
  visibility: inherit;
}


text:
import sys
from os import path
from shutil import rmtree

sys.path.append(".")

from igor.publisher import Publisher
from igor.documents import Post

def test_publisher(project):
    context = {}
    destination = "/tmp/blog.test"
    file = path.join(project, "_posts/welcome.txt")
    template_dir = path.join(project, "_templates")

    post = Post(file)
    p = Publisher([post], destination, template_dir, context)
    assert(p.publish())
    assert(path.exists(path.join(destination, post.publish_directory())))
    rmtree(destination)


text:
package decoder

import (
	"encoding/json"
	"strings"

	"github.com/ArdanStudios/go-common/helper"
	"github.com/goinggo/mapstructure"
	"github.com/goinggo/tracelog"
)

// IsArrayResponse validates if the specified JSON document
// is an array or slice
func IsArrayResponse(doc []byte) bool {
	tracelog.STARTED("utils", "IsArrayResponse")

	docString := string(doc)
	docSlice := strings.TrimLeft(docString, " ")

	if len(docSlice) > 0 && string(docSlice[0]) == "[" {
		tracelog.COMPLETEDf("utils", "IsArrayReponse", "Doc is Array")
		return true
	}

	tracelog.COMPLETEDf("utils", "IsArrayResponse", "Doc is not Array")
	return false
}

// DecodeMap decodes a JSON document into a Go native object
func DecodeMap(docMap map[string]interface{}, obj interface{}) error {
	if err := mapstructure.DecodePath(docMap, obj); err != nil {
		tracelog.ERROR(err, "utils", "Decode, Decoding Mapped Doc")
		return err
	}

	if tracelog.LogLevel() == tracelog.LEVEL_TRACE {
		helper.LogModel(obj, true)
	}

	return nil
}

// Decode takes a JSON document and decodes that into a Go native object
func Decode(doc []byte, obj interface{}) error {
	tracelog.STARTED("utils", "Decode")
	docMap := map[string]interface{}{}

	if err := json.Unmarshal(doc, &docMap); err != nil {
		tracelog.ERROR(err, "utils", "Decode, Building Mapped Doc")
		return err
	}

	return DecodeMap(docMap, obj)
}

// DecodeSlice decodes a JSON document array into a slice of Go native objects
func DecodeSlice(doc []byte, sliceObj interface{}, obj interface{}) (bool, error) {
	tracelog.STARTED("utils", "DecodeSlice")

	if IsArrayResponse(doc) == false {
		//decode as struct
		if err := Decode(doc, obj); err != nil {
			tracelog.ERROR(err, "utils", "DecodeSlice, Item Not Array, Unable to decode as struct")
			return false, err
		}

		//return false since not an array
		return false, nil
	}

	sliceMap := []map[string]interface{}{}

	if err := json.Unmarshal(doc, &sliceMap); err != nil {
		tracelog.ERROR(err, "utils", "DecodeSlice")
		return false, err
	}

	if err := mapstructure.DecodeSlicePath(sliceMap, sliceObj); err != nil {
		tracelog.ERROR(err, "utils", "DecodeSlice, Decoding Slice Object")
		return false, err
	}

	tracelog.COMPLETED("utils", "DecodeSlice")
	return true, nil
}


text:
package combinatoric

import (
	"errors"
	"math/big"
)

// PermutationIterator implements an Iterator to generate all
// permutations of a given slice.
//
// PermutationIterator is not threadsafe, and should always be
// initialized through Permutations. Return values from First and Next
// share the same memory address. Use copy if the value must persist
// between iterations.
type PermutationIterator struct {
	pool    []interface{}
	n       int
	r       int
	cycles  []int
	indices []int

	max   uint64
	iters uint64

	res []interface{}
}

// First resets the iterator to its starting state and returns the first
// permutation.
func (iter *PermutationIterator) First() []interface{} {
	iter.Reset()
	return iter.Next()
}

// Next returns the next value in the iterator or returns nil.
func (iter *PermutationIterator) Next() []interface{} {
	if !iter.HasNext() {
		return nil
	}

	if iter.res[0] != nil {
		for i := iter.r - 1; i > -1; i-- {
			iter.cycles[i] -= 1
			if iter.cycles[i] == 0 {
				for x := i; x < iter.n-1; x++ {
					v := iter.indices[x]
					iter.indices[x] = iter.indices[x+1]
					iter.indices[x+1] = v
				}
				iter.cycles[i] = iter.n - i
			} else {
				x := iter.indices[i]
				iter.indices[i] = iter.indices[iter.n-iter.cycles[i]]
				iter.indices[iter.n-iter.cycles[i]] = x
				break
			}
		}
	}

	for i := 0; i < iter.r; i++ {
		iter.res[i] = iter.pool[iter.indices[i]]
	}

	iter.iters += 1

	return iter.res
}

// HasNext returns true if the iterator is not yet exhausted.
func (iter *PermutationIterator) HasNext() bool {
	return iter.iters < iter.max
}

// Reset returns the iterator to its starting state.
func (iter *PermutationIterator) Reset() {
	iter.iters = 0

	iter.indices = make([]int, iter.n)
	for i := range iter.indices {
		iter.indices[i] = i
	}

	iter.cycles = make([]int, iter.n-(iter.n-iter.r))
	for i := range iter.cycles {
		iter.cycles[i] = iter.n - i
	}

	iter.res = make([]interface{}, iter.r, iter.r)
}

// Len returns the maximum iterations.
func (iter *PermutationIterator) Len() uint64 {
	return iter.max
}

func lenPermutations(n int, r int) uint64 {
	n64 := int64(n)
	r64 := int64(r)

	if n < r {
		return 0
	}

	total := big.NewInt(0)

	total.Div(
		factorial(big.NewInt(n64)),
		factorial(big.NewInt(n64-r64)),
	)

	return total.Uint64()
}

// Permutations creates a new PermutationIterator for a given slice and
// desired output size.
func Permutations(pool []interface{}, r int) (*PermutationIterator, error) {
	n := len(pool)

	if r > n {
		return nil, errors.New("Result size is larger than input")
	}

	iter := &PermutationIterator{
		pool: pool,
		n:    n,
		r:    r,
		res:  make([]interface{}, r, r),
		max:  lenPermutations(n, r),
	}

	iter.Reset()

	return iter, nil
}

// Type casting to insure PermutationIterator implements Iterator.
var _ Iterator = (*PermutationIterator)(nil)


text:
function getAndroidSDK(){
  export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$PATH"

  DEPS="$ANDROID_HOME/installed-dependencies"

  if [ ! -e $DEPS ]; then
    cp -r /usr/local/android-sdk-linux $ANDROID_HOME &&
    echo y | android update sdk -u -a -t android-22 &&
    echo y | android update sdk -u -a -t platform-tools &&
    echo y | android update sdk -u -a -t build-tools-23.0.2 &&
    echo y | android update sdk -u -a -t sys-img-x86-android-22 &&
    #echo y | android update sdk -u -a -t addon-google_apis-google-18 &&
    echo no | android create avd -n testAVD -f -t android-22 --abi default/x86 &&
    touch $DEPS
  fi
}

function waitForAVD {
    (
    local bootanim=""
    export PATH=$(dirname $(dirname $(which android)))/platform-tools:$PATH
    until [[ "$bootanim" =~ "stopped" ]]; do
      sleep 5
      bootanim=$(adb -e shell getprop init.svc.bootanim 2>&1)
      echo "emulator status=$bootanim"
    done
    )
}


text:
<ion-view view-title="Create Guideline">
	<ion-nav-buttons side="right">

    </ion-nav-buttons>
    <ion-content class="padding">

                Keywords (eg: a,b,c,d):
                <input ng-model="tguidelines.keyword" type="text">

                Task Guidelines:

                Data Structure:
                <input ng-model="tguidelines.dataStructure" type="text">

                Data Type:
                <input ng-model="tguidelines.dataType" type="text">

                Control Structure:
                <input ng-model="tguidelines.controlStructure" type="text">

                Arithmetic Expression:
                <textarea ng-model="tguidelines.arithmeticExpression" type="text"></textarea>

            <button class="button button-full button-positive" ng-click="createGuideline(tguidelines)">Create Guideline</button>

    </ion-content>
</ion-view>


text:
@implementation Weather

- (instancetype)initWithDictionary:(NSDictionary *)dict {
    if (self = [super init]) {
        _city = [dict objectForKey:@"city"];
        _cityId = [dict objectForKey:@"cityid"];
        _temp = @([[dict objectForKey:@"temp"] integerValue]);
        _updateTime = [dict objectForKey:@"time"];
    }

    return self;
}

@end


text:
define(['bumpslide/loggable', 'underscore'], function (loggable, _)
{

    test('bumpslide.loggable', function () {

        var called = 0;

        var logger = loggable();
        ok(logger.logEnabled===false, 'Log should be disabled by default.');

        logger = loggable(true);
        ok(logger.logEnabled===true, 'Log should be enabled if you pass true into the constructor.');

        //logger.log('Hello, World. From the logger.');

        // add a custom log function that counts logs
        logger.logFunction = function () {
            called++;
        };

        // test that log function is called
        logger.log('Hello');
        ok(called===1, "Log function should have been called if log was enabled.");

        // disable and log again
        logger.logEnabled = false;
        logger.log('Hi, Again');
        ok(called===1, "Log function should not have been called if log was disabled.");

    });

});


text:
using System;

namespace EventSpike.Approval.Messages.Events
{
    public class ApprovalPartiallyAccepted
    {
        public Guid Id { get; set; }
        public string ReferenceNumber { get; set; }
    }
}


text:
cask 'itubedownloader' do
  version '6.5.7'
  sha256 'd84cf9ae84eefbdd3ab61c8287d51b524b209421d6404a23a3c1d8baea3681c9'

  # dl.devmate.com/com.AlphaSoft.iTubeDownloader was verified as official when first introduced to the cask
  url 'https://dl.devmate.com/com.AlphaSoft.iTubeDownloader/iTubeDownloader.dmg'
  appcast 'https://updates.devmate.com/com.AlphaSoft.iTubeDownloader.xml'
  name 'iTubeDownloader'
  homepage 'https://alphasoftware.co/'

  depends_on macos: '>= :yosemite'

  app 'iTubeDownloader.app'
end


text:
package foobar.log;

import org.apache.log4j.Logger;

/**
 * Hello world!
 */
public class App {
    private static final Logger logger = Logger.getLogger(App.class);
    private static final Logger filterLogger = Logger.getLogger("filterLogger");

    public static void main(String[] args) {
        logger.debug("Hello World!");
        filterLogger.debug("Hi filter.");
        filterLogger.debug("Hi diagnostic");
    }
}


text:
extern crate cdrs;

use cdrs::client::CDRS;
use cdrs::query::QueryBuilder;
use cdrs::authenticators::NoneAuthenticator;
use cdrs::compression::Compression;
use cdrs::consistency::Consistency;
use cdrs::transport::TransportTcp;
// default credentials
const _ADDR: &'static str = "127.0.0.1:9042";

#[test]
#[cfg(not(feature = "appveyor"))]
fn connect_to_cassandra() {
    const _ADDR: &'static str = "127.0.0.1:9042";
    let authenticator = NoneAuthenticator;
    let tcp_transport = TransportTcp::new(_ADDR);
    assert_eq!(tcp_transport.is_ok(), true);

    let client = CDRS::new(tcp_transport.unwrap(), authenticator);
    let mut session = client.start(Compression::None).unwrap();

    let select_peers = "SELECT peer,data_center,rack,tokens,rpc_address,release_version FROM \
                        system.peers";
    let with_tracing = false;
    let with_warnings = false;

    let select_peers_query = QueryBuilder::new(select_peers)
        .consistency(Consistency::One)
        .finalize();

    let select_peers_query_result = session.query(select_peers_query, with_tracing, with_warnings);

    assert_eq!(select_peers_query_result.is_ok(), true);

    match select_peers_query_result {
        Ok(ref res) => println!("peers Selected: {:?}", res.get_body()),
        Err(ref err) => println!("Error occured: {:?}", err),
    }

}