text:
+++
date = "Sat Feb 23 02:47:59 UTC 2019"
title = "Robolectric + JetpackでActivityのonActivityResultメソッドをテストする"
tags = ["android", "test", "jetpack", "robolectric", "espresso"]
blogimport = true
type = "post"
+++

Robolectric4.xからユニットテスト環境で、android testと(ほぼ?)同じテストコードを動かすことが可能になりました。
まだ、完全に互換性があるとはいえませんが、Espressoライブラリが動く、`AndroidJUnit4`ランナーが使えるなど、かなりの部分が共通化出来ます。

この記事では、ユニットテストで`Activity.onActivityResult`のテストをどこまでandroid testのように書けるかを検証します。

## テスト対象コード

まず最初に、テスト対象コードは次のようになっています。

```kotlin
class MainActivity : AppCompatActivity() {
  ...
  override fun onCreate(savedInstanceState: Bundle?) {
    ...

    button.setOnClickListener {
      startActivityForResult(
        Intent(this, Sub2Activity::class.java).apply {
          putExtra("fuga", "hoge")
        },
        1
      )
    }
  }

  override fun onActivityResult(
    requestCode: Int,
    resultCode: Int,
    data: Intent?
  ) {
    super.onActivityResult(requestCode, resultCode, data)
    if (requestCode == 1) {
      if (resultCode == Activity.RESULT_OK) {
        val value = data!!.getIntExtra("test", -1)
        button.text = value.toString()
      }
    }
  }
}
```

```kotlin
class Sub2Activity : AppCompatActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.sub_act)

    button.setOnClickListener {
      val intent = Intent()
      intent.putExtra("test", 10)
      setResult(Activity.RESULT_OK, intent)
      finish()
    }
  }
}
```

これはMainActivityで`startActivityForResult`がコールされ、Sub2Activityで`setResult`で値をセットし、MainActivityの`onActivityResult`で結果を受け取るサンプルコードになります。

では、テストを書いていきます。

## テストコード

以下が、今回書いたテストコードになります。

```kotlin
@RunWith(AndroidJUnit4::class)
internal class MainActivityTest {
  @get:Rule val intentsTestRule = IntentsTestRule(MainActivity::class.java)

  @Test
  fun onActivityResultTest() {
    val expectCode = 10

    // assertion setResult
    val scenario = ActivityScenario.launch(Sub2Activity::class.java)
    scenario.onActivity {
      it.findViewById<View>(R.id.button).performClick()
    }

    // assertion resultCode
    val result = scenario.result
    assertThat(result.resultCode).isEqualTo(Activity.RESULT_OK)

    // assertion intent params
    val bundleSubject = IntentSubject.assertThat(result.resultData).extras()
    bundleSubject.integer("test").isEqualTo(expectCode)

    scenario.close()

    Intents
      .intending(
        IntentMatchers.hasComponent(
          ComponentName(
            ApplicationProvider.getApplicationContext<Application>(),
            Sub2Activity::class.java
          )
        )
      )
      .respondWith(result)

    val main = ActivityScenario.launch(MainActivity::class.java)
    main.onActivity {
      it.findViewById<View>(R.id.button).performClick()

      // assertion intent for startActivity(ForResult)
      val name = ComponentName(
        ApplicationProvider.getApplicationContext<Application>(),
        Sub2Activity::class.java
      )
      Intents.intended(IntentMatchers.hasComponent(name))
      Intents.intended(IntentMatchers.hasExtra("fuga", "hoge"))

      // assertion onActivityResult behaves
      Espresso
        .onView(ViewMatchers.withId(R.id.button))
        .check(ViewAssertions.matches(ViewMatchers.withText(expectCode.toString())))
    }
  }
}
```

上から順番に重要な部分を説明していきます。

```kotlin
@get:Rule val intentsTestRule = IntentsTestRule(MainActivity::class.java)
```

これは、Espresso-Intentsを使うときに必要なルールです。`Intens.intended`、`intending`を使うために必要なルールになります。

```kotlin
val scenario = ActivityScenario.launch(Sub2Activity::class.java)
scenario.onActivity {
    it.findViewById<View>(R.id.button).performClick()
}
```

ActivityScenarioはActivityを起動するためのクラスです。これはSub2Activityを起動して、ボタンをクリックするという意味になります。
ボタンがクリックされると、Sub2Activityで`setResult`が発火するようになっています。

```kotlin
val result = scenario.result
assertThat(result.resultCode).isEqualTo(Activity.RESULT_OK)

val bundleSubject = IntentSubject.assertThat(result.resultData).extras()
bundleSubject.integer("test").isEqualTo(expectCode)
```

ActivityScenarioでは、ActivityResultクラスから結果を取得することが出来ます。このクラスにはresultCodeと、resultDataがセットされており、それらの値をTruthを使いチェックします。この場合、`setResult`で、resultcodeに`Activity.RESULT_OK`が、resultdataにはキー名`test`、値10がセットされていることを確認してします。

ここまでで、Sub2ActivityのsetResultで正しい値をセットしていることがテスト出来ます。

では次に、MainActivityで上記の値を受け取れることをテストしていきます。

```kotlin
Intents
  .intending(
    IntentMatchers.hasComponent(
      ComponentName(
        ApplicationProvider.getApplicationContext<Application>(),
        Sub2Activity::class.java
      )
    )
  )
  .respondWith(result)
```

`Intents.intending`はマッチしたIntentが発行されたときに、onActivityResultに結果を返すAPIになります。
MainActivityのonActivityResultに、先ほどのSub2Activityの結果を渡すという意味になります。

```kotlin
val main = ActivityScenario.launch(MainActivity::class.java)
main.onActivity {
  it.findViewById<View>(R.id.button).performClick()

  val name = ComponentName(
    ApplicationProvider.getApplicationContext<Application>(),
    Sub2Activity::class.java
  )
  Intents.intended(IntentMatchers.hasComponent(name))
  Intents.intended(IntentMatchers.hasExtra("fuga", "hoge"))

  Espresso
    .onView(ViewMatchers.withId(R.id.button))
    .check(ViewAssertions.matches(ViewMatchers.withText(expectCode.toString())))
}
```

まずは、クリックイベントを発火し、`startActivityForResult`をコールします。渡したIntentを`Intents.intended`で正しいことを確認します。最後に、Espressoを使って、`onActivityResult`の結果を正しく反映されているかを確認します。

これで、テスト完了です😃
2つのActivityに関連するonActivityResultのテストが無事に出来ました!!

## 補足

Espressoにはご存知、clickをするためのAPIがあるのですが、うまく動きませんでした。

```kotlin
// not working!!
Espresso
  .onView(ViewMatchers.withId(R.id.button))
  .perform(ViewActions.click())
```

調べたんですが、原因がわかりませんでした😂分かり次第追記します。

## まとめ

- 上記のテストくらいなら、ユニットテストで書ける。すごい😃
  - onActivityResultみたいな、クラス間のつながりが弱い部分は意図せず壊れやすいので、テストを書いておくと安心かも😋

今回の検証に用いたサンプルコードは[satoshun-android-example/Tests](https://github.com/satoshun-android-example/Tests/blob/master/app/src/test/java/com/github/satoshun/example/tests/lifecycle/MainActivityTest.kt)にあります。

もっと良い書き方を知っているよと言う人は教えて頂けるととても嬉しいです😃😃😃


text:
package uk.gov.hmrc.ct.computations

import uk.gov.hmrc.ct.box.{CtBoxIdentifier, CtOptionalInteger, Linked}

case class CP290d(value: Option[Int]) extends CtBoxIdentifier(name = "Post 1/4/17 main land losses brought forward against Northern Ireland TP") with CtOptionalInteger

object CP290d extends Linked[CP283d, CP290d] {
  def apply(source: CP283d): CP290d = CP290d(source.value)
}

redpajama_set_name: RedPajamaGithub


text:
import {combineReducers} from 'redux'

class RelieverRegistry {
  constructor() {
    if (!RelieverRegistry.instance) {
      this.modules = {}
      this.modulesRootReducerKey = undefined
      this.reducerConstructed = false
      RelieverRegistry.instance = this
      this.plugins = []
    }
    return RelieverRegistry.instance
  }

  setupStore(store) {
    this.plugins.forEach(plugin => plugin.instance.setupStore(store, plugin.options))
  }

  use(plugin, options) {
    this.plugins.push({instance: new plugin(), options})
    return this
  }

  register(reliever, moduleName, {reducerKey} = {}) {
    if (this.reducerConstructed) console.warn('You are registering a new module but the modules reducer has already been built. This should not happen.')
    const relievedComponent = new reliever()
    const reducer = relievedComponent.reducer.bind(relievedComponent)
    const actions = relievedComponent.getActions()
    reducerKey = reducerKey || moduleName
    this.modules[moduleName] = {reliever: relievedComponent, reducer, reducerKey, actions, name: moduleName}
  }

  changeModuleReducerKey(moduleName, reducerKey) {
    if (this.reducerConstructed) console.warn("Changing the modules reducer's keys after it has been built has no effect.")
    this.modules[moduleName].reducerKey = reducerKey
  }

  buildRootReducer(rootReducer = {}, modulesRootReducerKey = undefined) {
    if (this.reducerConstructed) console.warn('The reducer has already been built. This should not happen.')
    this.reducerConstructed = true
    const moduleReducers = Object.values(this.modules).reduce((r, m) => ({...r, [m.reducerKey]: m.reducer}), {})
    if (modulesRootReducerKey !== undefined) {
      this.modulesRootReducerKey = modulesRootReducerKey
      return combineReducers({...rootReducer, [modulesRootReducerKey]: combineReducers(moduleReducers)})
    }
    return combineReducers({...moduleReducers, ...rootReducer})
  }

  moduleState(moduleName, state) {
    if (this.modulesRootReducerKey) return state[this.modulesRootReducerKey][this.modules[moduleName].reducerKey]
    return state[this.modules[moduleName].reducerKey]
  }

  moduleActions(moduleName) {
    return this.modules[moduleName].actions
  }

  middlewares() {
    return this.plugins
      .map(plugin => {
        return Object.keys(this.modules)
          .map(key => this.modules[key])
          .map(module => plugin.instance.createMiddleware(module.reliever, plugin.options, module))
          .filter(middleware => middleware)
      })
      .reduce((p, c) => [...p, ...c], [])
  }
}

export default new RelieverRegistry()


text:
<TITLE>Review for Down to You (2000)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Down to You (2000)

reviewed by
Berge Garabedian

DOWN TO YOU
RATING: 6.5 /10 --> So-so

For more reviews and movie trivia quizzes, visit http://www.joblo.com/

Teen flicks. Can a film still be considered a "teen flick" when it is set in
college, speaks of "true love", the path of one's professional career and
reflective issues such as pregnancy, cheating on one's mate and
long-distance relationships? Of course! Especially when it stars two of the
hot young actors from last year's teen flick hits, SHE'S ALL THAT (6.5/10)
and 10 THINGS I HATE ABOUT YOU (7/10), Freddie Prinze Jr. and Julia Stiles,
respectively.

PLOT:
A young man set to begin his life after college, ponders the moments that
led to his first true love, their misadventures within the world of the
tingles, and the happy and sad times of their topsy-turvy relationship.

CRITIQUE:
Kinda cute, kinda sweet, kinda corny, kinda predictable, kinda romantic,
kinda funny, kinda dramatic and kinda forgettable...and ultimately, kinda
so-so. I've generally given greater points to these predictable "teen
flicks" when they come saddled with a couple of charming stars who can hold
my attention for the entire 90 minutes, and this one had just that, with
Freddie Prinze coming through once again as the shy, goofy, romantic lead,
and Julia Stiles, as the cute, ambitious, engaging co-star. Does the film
offer us any new insights into those loopy men from Mars or women from
Venus? Well, not really, but I suppose I just happened to be in the mood for
a light, romantic, easy-going drama with a couple of laughs (The "Cooks!" TV
show was pretty funny), and I guess this movie offered me just that with not
much else. Truth is, this film is probably more of a "video movie" than
anything else. Rent it with your better half, cuddle up next to a
wood-burning fire, warm up some nachos and get jiggy with it for the rest of
the nite. You might also want to bring a date to this film, seeing as it has
a lot to do with people meeting and getting to know each other better, and
be prepared to jostle over the film's depth for a maximum of five minutes
afterwards.

You'll also be happy to know that there are no fart, poop or vomit jokes in
the entire film (Although those types of jokes do have a place in some
movies), and that the two sing-a-long sequences from the respective stars,
despite lacking originality, were quite lovey-dovey and adorable in their
own sugar-coated, manufactured way. I have to admit that I didn't much care
for the exaggerated side characters in the film, especially Selma Blair and
Zak Orth, who just seemed to be there as "bizarre" distractions to the main
cute couple. All in all, I guess it would help if you were in a relationship
yourself when you see this movie, or at least have savored a touch of the
big L sometime in your lifetime. Otherwise, suck in all the sap and goofy
romance still rolling around in your grey ol' heart, and enjoy this light
feather of a film for nothing more than what it is: the simple love story of
a couple of cute kids.

Little Known Facts about this film and its stars:
One of Freddie Prinze Jr's earliest roles was playing the role of "Tough
Guy" on the February 10, 1995 episode of TV's "Family Matters". He had a
four-line part playing some punk kid who brought a gun to school. He then
went on to star in several after-school specials, including one called
"Detention: Siege at Johnson High", co-starring the man who plays his dad in
this picture, Henry Winkler.
Some of you might remember Julia Stiles from one of her earliest roles as
Bridget O'Meara, daughter of Tom O'Meara, played by Harrison Ford, in 1997's
THE DEVIL'S OWN.
Selma Blair is probably best known for her "shocking" french-kissing scene
with Sarah Michelle Gellar in 1999's CRUEL INTENTIONS (7.5/10). Ironically,
Selma herself once auditioned for the role of Buffy the Vampire Slayer, a
role which Gellar has owned since the show's debut in 1997.
This is director Kris Isacsson's first feature film. In 1996, he was
credited as being Barbra Streisand's "assistant" for the film THE MIRROR HAS
TWO FACES (7/10).

Review Date: January 23, 2000
Director: Kris Isacsson
Writer: Kris Isacsson
Producers: Jason Kliot and Joana Vicente
Actors: Freddie Prinze Jr. as Al Connelly
Julia Stiles as Imogen
Genre: Romantic comedy
Year of Release: 2000
-------------------------------------
JoBlo's Movie Emporium
http://www.joblo.com/
-------------------------------------
(c) 2000 Berge Garabedian

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
/*
http://www.cgsoso.com/forum-211-1.html

CG搜搜 Unity3d 每日Unity3d插件免费更新 更有VIP资源!

CGSOSO 主打游戏开发,影视设计等CG资源素材。

插件如若商用,请务必官网购买!

daily assets update for try.

U should buy the asset from home store if u use it in your project!
*/

#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)

namespace Org.BouncyCastle.Math.EC.Multiplier
{
	/**
	* Interface for classes storing precomputation data for multiplication
	* algorithms. Used as a Memento (see GOF patterns) for
	* WNafMultiplier.
	*/
	public interface PreCompInfo
	{
	}
}

#endif


text:
from PySide import QtCore, QtGui

class Ui_FileWindow(object):
    def setupUi(self, FileWindow):
        FileWindow.setObjectName("FileWindow")
        FileWindow.resize(1124, 894)
        self.centralwidget = QtGui.QWidget(FileWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.widget = QtGui.QWidget(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.widget.sizePolicy().hasHeightForWidth())
        self.widget.setSizePolicy(sizePolicy)
        self.widget.setObjectName("widget")
        self.horizontalLayout.addWidget(self.widget)
        FileWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(FileWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1124, 21))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtGui.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        self.menuAction = QtGui.QMenu(self.menubar)
        self.menuAction.setObjectName("menuAction")
        FileWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(FileWindow)
        self.statusbar.setObjectName("statusbar")
        FileWindow.setStatusBar(self.statusbar)
        self.toolBar = QtGui.QToolBar(FileWindow)
        self.toolBar.setObjectName("toolBar")
        FileWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
        self.actionSave = QtGui.QAction(FileWindow)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/standard_icons/save.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSave.setIcon(icon)
        self.actionSave.setObjectName("actionSave")
        self.actionDelete = QtGui.QAction(FileWindow)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/standard_icons/delete.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        icon1.addPixmap(QtGui.QPixmap(":/standard_icons/delete.png"), QtGui.QIcon.Active, QtGui.QIcon.On)
        self.actionDelete.setIcon(icon1)
        self.actionDelete.setObjectName("actionDelete")
        self.actionMergePurge = QtGui.QAction(FileWindow)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(":/standard_icons/merge.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionMergePurge.setIcon(icon2)
        self.actionMergePurge.setObjectName("actionMergePurge")
        self.actionSuppress = QtGui.QAction(FileWindow)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(":/standard_icons/suppress.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSuppress.setIcon(icon3)
        self.actionSuppress.setObjectName("actionSuppress")
        self.actionRename = QtGui.QAction(FileWindow)
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(":/standard_icons/rename.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionRename.setIcon(icon4)
        self.actionRename.setObjectName("actionRename")
        self.actionExecuteScript = QtGui.QAction(FileWindow)
        self.actionExecuteScript.setObjectName("actionExecuteScript")
        self.actionEditFields = QtGui.QAction(FileWindow)
        self.actionEditFields.setIcon(icon4)
        self.actionEditFields.setObjectName("actionEditFields")
        self.actionSplit = QtGui.QAction(FileWindow)
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap(":/standard_icons/split.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSplit.setIcon(icon5)
        self.actionSplit.setObjectName("actionSplit")
        self.actionAnalyze = QtGui.QAction(FileWindow)
        icon6 = QtGui.QIcon()
        icon6.addPixmap(QtGui.QPixmap(":/standard_icons/count.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionAnalyze.setIcon(icon6)
        self.actionAnalyze.setObjectName("actionAnalyze")
        self.actionNormalize = QtGui.QAction(FileWindow)
        icon7 = QtGui.QIcon()
        icon7.addPixmap(QtGui.QPixmap(":/standard_icons/normalize.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionNormalize.setIcon(icon7)
        self.actionNormalize.setObjectName("actionNormalize")
        self.actionSaveAs = QtGui.QAction(FileWindow)
        icon8 = QtGui.QIcon()
        icon8.addPixmap(QtGui.QPixmap(":/standard_icons/saveas.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSaveAs.setIcon(icon8)
        self.actionSaveAs.setObjectName("actionSaveAs")
        self.actionTranspose = QtGui.QAction(FileWindow)
        icon9 = QtGui.QIcon()
        icon9.addPixmap(QtGui.QPixmap(":/standard_icons/transpose.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionTranspose.setIcon(icon9)
        self.actionTranspose.setObjectName("actionTranspose")
        self.actionDropNaN = QtGui.QAction(FileWindow)
        self.actionDropNaN.setObjectName("actionDropNaN")
        self.menuFile.addAction(self.actionSave)
        self.menuFile.addAction(self.actionSaveAs)
        self.menuFile.addAction(self.actionDelete)
        self.menuAction.addAction(self.actionAnalyze)
        self.menuAction.addAction(self.actionEditFields)
        self.menuAction.addAction(self.actionExecuteScript)
        self.menuAction.addAction(self.actionMergePurge)
        self.menuAction.addAction(self.actionNormalize)
        self.menuAction.addAction(self.actionSplit)
        self.menuAction.addAction(self.actionSuppress)
        self.menuAction.addAction(self.actionTranspose)
        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuAction.menuAction())
        self.toolBar.addAction(self.actionSave)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.actionMergePurge)
        self.toolBar.addAction(self.actionSplit)
        self.toolBar.addAction(self.actionNormalize)
        self.toolBar.addAction(self.actionEditFields)
        self.toolBar.addAction(self.actionAnalyze)
        self.toolBar.addAction(self.actionTranspose)
        self.toolBar.addAction(self.actionDropNaN)

        self.retranslateUi(FileWindow)
        QtCore.QMetaObject.connectSlotsByName(FileWindow)

    def retranslateUi(self, FileWindow):
        FileWindow.setWindowTitle(QtGui.QApplication.translate("FileWindow", "MyFile", None, QtGui.QApplication.UnicodeUTF8))
        self.menuFile.setTitle(QtGui.QApplication.translate("FileWindow", "File", None, QtGui.QApplication.UnicodeUTF8))
        self.menuAction.setTitle(QtGui.QApplication.translate("FileWindow", "Action", None, QtGui.QApplication.UnicodeUTF8))
        self.toolBar.setWindowTitle(QtGui.QApplication.translate("FileWindow", "toolBar", None, QtGui.QApplication.UnicodeUTF8))
        self.actionSave.setText(QtGui.QApplication.translate("FileWindow", "Save", None, QtGui.QApplication.UnicodeUTF8))
        self.actionSave.setToolTip(QtGui.QApplication.translate("FileWindow", "Save the file to disk.", None, QtGui.QApplication.UnicodeUTF8))
        self.actionSave.setShortcut(QtGui.QApplication.translate("FileWindow", "Ctrl+S", None, QtGui.QApplication.UnicodeUTF8))
        self.actionDelete.setText(QtGui.QApplication.translate("FileWindow", "Delete", None, QtGui.QApplication.UnicodeUTF8))
        self.actionDelete.setToolTip(QtGui.QApplication.translate("FileWindow", "Deletes the current file from the program and disk!", None, QtGui.QApplication.UnicodeUTF8))
        self.actionMergePurge.setText(QtGui.QApplication.translate("FileWindow", "Merge/Purge", None, QtGui.QApplication.UnicodeUTF8))
        self.actionMergePurge.setShortcut(QtGui.QApplication.translate("FileWindow", "Ctrl+M", None, QtGui.QApplication.UnicodeUTF8))
        self.actionSuppress.setText(QtGui.QApplication.translate("FileWindow", "Suppress", None, QtGui.QApplication.UnicodeUTF8))
        self.actionRename.setText(QtGui.QApplication.translate("FileWindow", "Rename Headers", None, QtGui.QApplication.UnicodeUTF8))
        self.actionRename.setShortcut(QtGui.QApplication.translate("FileWindow", "Ctrl+R", None, QtGui.QApplication.UnicodeUTF8))
        self.actionExecuteScript.setText(QtGui.QApplication.translate("FileWindow", "Execute Script", None, QtGui.QApplication.UnicodeUTF8))
        self.actionEditFields.setText(QtGui.QApplication.translate("FileWindow", "Edit Fields", None, QtGui.QApplication.UnicodeUTF8))
        self.actionEditFields.setShortcut(QtGui.QApplication.translate("FileWindow", "Ctrl+F", None, QtGui.QApplication.UnicodeUTF8))
        self.actionSplit.setText(QtGui.QApplication.translate("FileWindow", "Split", None, QtGui.QApplication.UnicodeUTF8))
        self.actionAnalyze.setText(QtGui.QApplication.translate("FileWindow", "Analyze", None, QtGui.QApplication.UnicodeUTF8))
        self.actionAnalyze.setToolTip(QtGui.QApplication.translate("FileWindow", "View statistics on each column.", None, QtGui.QApplication.UnicodeUTF8))
        self.actionAnalyze.setShortcut(QtGui.QApplication.translate("FileWindow", "Ctrl+A", None, QtGui.QApplication.UnicodeUTF8))
        self.actionNormalize.setText(QtGui.QApplication.translate("FileWindow", "Normalize", None, QtGui.QApplication.UnicodeUTF8))
        self.actionNormalize.setToolTip(QtGui.QApplication.translate("FileWindow", "Normalize data", None, QtGui.QApplication.UnicodeUTF8))
        self.actionNormalize.setShortcut(QtGui.QApplication.translate("FileWindow", "Ctrl+N", None, QtGui.QApplication.UnicodeUTF8))
        self.actionSaveAs.setText(QtGui.QApplication.translate("FileWindow", "Save As", None, QtGui.QApplication.UnicodeUTF8))
        self.actionSaveAs.setToolTip(QtGui.QApplication.translate("FileWindow", "Save the file to another path on the disk.", None, QtGui.QApplication.UnicodeUTF8))
        self.actionTranspose.setText(QtGui.QApplication.translate("FileWindow", "Transpose", None, QtGui.QApplication.UnicodeUTF8))
        self.actionTranspose.setToolTip(QtGui.QApplication.translate("FileWindow", "Convert rows to columns & vice versa (150 rows max)", None, QtGui.QApplication.UnicodeUTF8))
        self.actionTranspose.setShortcut(QtGui.QApplication.translate("FileWindow", "Ctrl+T", None, QtGui.QApplication.UnicodeUTF8))
        self.actionDropNaN.setText(QtGui.QApplication.translate("FileWindow", "Drop NaN", None, QtGui.QApplication.UnicodeUTF8))
        self.actionDropNaN.setToolTip(QtGui.QApplication.translate("FileWindow", "Replaces \'nan\' values with blanks on string fields.", None, QtGui.QApplication.UnicodeUTF8))

from zeex.icons import icons_rc


text:
CREATE PROCEDURE [dbo].[People_Update]
	  @Id int
	, @FirstName nvarchar(50)
	, @MiddleInitial nchar(1) = null
	, @LastName nvarchar(50)
	, @ModifiedBy nvarchar(128)
AS
/*
DECLARE
	  @_id INT = 1
	, @_firstName nvarchar(50) = 'Billy'
	, @_middleInitial nchar(1) = 'B'
	, @_lastName nvarchar(50) = 'Johnson'
	, @_modifiedBy nvarchar(128) = 'Patty'

EXECUTE [dbo].[People_Update]
	  @_id, @_firstName, @_middleInitial, @_lastName, @_modifiedBy

SELECT * FROM dbo.People WHERE Id = @_id;
*/
BEGIN
	DECLARE
		@ModifiedDate datetime2 = getutcdate()
	UPDATE [dbo].[People]
	SET
		  FirstName = @FirstName
		, MiddleInitial = @MiddleInitial
		, LastName = @LastName
		, ModifiedDate = @ModifiedDate
		, ModifiedBy = @ModifiedBy
	WHERE Id = @Id
END


text:
<?php

namespace WebHemiTest\TestService;

use WebHemi\Data\Entity\EntityInterface as DataEntityInterface;
use WebHemi\Data\Storage\AbstractStorage as AbstractDataStorage;

/**
 * Class EmptyStorage.
 *
 */
class EmptyStorage extends AbstractDataStorage
{
    /** @var string */
    protected $dataGroup;
    /** @var string */
    protected $idKey;

    /**
     * Populates an entity with storage data.
     *
     * @param DataEntityInterface $entity
     * @param array               $data
     * @return void
     */
    protected function populateEntity(DataEntityInterface &$entity, array $data) : void
    {
        foreach ($data as $key => $value) {
            $method = 'set' . ucfirst($key);
            $entity->{$method}($value);
        }
    }

    /**
     * Get data from an entity.
     *
     * @param DataEntityInterface $entity
     * @return array
     */
    protected function getEntityData(DataEntityInterface $entity) : array
    {
        /** @var EmptyEntity $entity */
        return $entity->storage;
    }

    /**
     * Sets id key fir the storage. Only for unit test.
     *
     * @param string $idKey
     *
     * @return EmptyStorage
     */
    public function setIdKey($idKey)
    {
        $this->idKey = $idKey;
        return $this;
    }

    /**
     * Sets data group for the storage. Only for unit test.
     *
     * @param string $dataGroup
     *
     * @return EmptyStorage
     */
    public function setDataGroup($dataGroup)
    {
        $this->dataGroup = $dataGroup;
        return $this;
    }
}


text:
#ifndef LIBSPIDER_H_
# define LIBSPIDER_H_                   1

# include "libcrawl.h"
# include "libcluster.h"

/* This header contains the interface used by crawler plug-ins */

typedef struct spider_struct SPIDER;
typedef struct processor_struct PROCESSOR;
typedef struct queue_struct QUEUE;
typedef struct spider_policy_struct SPIDERPOLICY;
typedef struct spider_callbacks_v2_struct SPIDERCALLBACKS;

#ifndef SPIDER_STRUCT_DEFINED
struct spider_struct
{
	struct spider_api_struct *api;
};
#endif

struct spider_api_struct
{
	void *reserved;
	unsigned long (*addref)(SPIDER *me);
	unsigned long (*release)(SPIDER *me);
	/* Set and obtain app-specific data */
	int (*set_userdata)(SPIDER *me, void *data);
	void *(*userdata)(SPIDER *me);
	/* Set the local 0-based thread index for this instance */
	int (*set_local_index)(SPIDER *me, int index);
	/* Set the base thread index for this process */
	int (*set_base)(SPIDER *me, int base);
	/* Inform the instance of the total number of threads in the cluster */
	int (*set_threads)(SPIDER *me, int threads);
	/* Obtain the numeric crawler ID */
	int (*crawler_id)(SPIDER *me);
	/* Obtain the local 0-based thread index */
	int (*local_index)(SPIDER *me);
	/* Obtain the total number of threads */
	int (*threads)(SPIDER *me);
	/* Obtain the encapsulated crawler instance */
	CRAWL *(*crawler)(SPIDER *me);
	/* Set the queue implementation (including by URI or URI-string) */
	int (*set_queue)(SPIDER *me, QUEUE *queue);
	int (*set_queue_uristr)(SPIDER *me, const char *uri);
	int (*set_queue_uri)(SPIDER *me, URI *uri);
	/* Obtain the queue object */
	QUEUE *(*queue)(SPIDER *me);
	/* Set the processor implementation by name */
	int (*set_processor)(SPIDER *me, PROCESSOR *processor);
	int (*set_processor_name)(SPIDER *me, const char *name);
	PROCESSOR *(*processor)(SPIDER *me);
	/* Obtain configuration values (allocated string, integer, boolean) */
	char *(*config_geta)(SPIDER *me, const char *key, const char *defval);
	int (*config_get_int)(SPIDER *me, const char *key, int defval);
	int (*config_get_bool)(SPIDER *me, const char *key, int defval);
	/* Mark this thread as terminated */
	int (*terminate)(SPIDER *me);
	/* Determine if this thread has been terminated */
	int (*terminated)(SPIDER *me);
	/* Set this thread to be in one-shot mode */
	int (*set_oneshot)(SPIDER *me);
	/* Determine if this thread is in one-shot mode */
	int (*oneshot)(SPIDER *me);
	/* Set the cluster object used by this instance (overrides
	 * any previously-set thread indices
	 */
	int (*set_cluster)(SPIDER *me, CLUSTER *cluster);
	/* Obtain the cluster object used by this instance */
	CLUSTER *(*cluster)(SPIDER *me);
	/* Log a formatted message */
	int (*log)(SPIDER *me, int level, const char *format, ...);
	int (*vlog)(SPIDER *me, int level, const char *format, va_list ap);
	/* Perform a single dequeue-fetch-process operation */
	int (*perform)(SPIDER *me);
	/* Attach this instance to a newly-created crawl thread */
	int (*attach)(SPIDER *me);
	/* Detach this instance from a crawl thread which is terminating */
	int (*detach)(SPIDER *me);
	/* Determine whether this instance has been attached or not */
	int (*attached)(SPIDER *me);
	/* Add a policy handler to this instance */
	int (*add_policy)(SPIDER *me, SPIDERPOLICY *policy);
	int (*add_policy_name)(SPIDER *me, const char *policyname);
};

/* A set of callbacks supplied when creating a spider instance */

# define SPIDER_CALLBACKS_VERSION       2

struct spider_callbacks_v1_struct
{
	int version;
	void (*logger)(int level, const char *format, va_list args);
};

struct spider_callbacks_v2_struct
{
	int version;
	void (*logger)(int level, const char *format, va_list args);
	char *(*config_geta)(const char *, const char *);
	int (*config_get_int)(const char *, int);
	int (*config_get_bool)(const char *, int);
};

#ifndef QUEUE_STRUCT_DEFINED
struct queue_struct
{
	struct queue_api_struct *api;
};
#endif

struct queue_api_struct
{
	void *reserved;
	unsigned long (*addref)(QUEUE *me);
	unsigned long (*release)(QUEUE *me);
	int (*next)(QUEUE *me, URI **next, CRAWLSTATE *state);
	int (*add)(QUEUE *me, URI *uri, const char *uristr);
	int (*updated_uri)(QUEUE *me, URI *uri, time_t updated, time_t last_modified, int status, time_t ttl, CRAWLSTATE state);
	int (*updated_uristr)(QUEUE *me, const char *uri, time_t updated, time_t last_modified, int status, time_t ttl, CRAWLSTATE state);
	int (*unchanged_uri)(QUEUE *me, URI *uri, int error);
	int (*unchanged_uristr)(QUEUE *me, const char *uri, int error);
	int (*force_add)(QUEUE *me, URI *uri, const char *uristr);
	int (*set_crawlers)(QUEUE *me, int count);
	int (*set_caches)(QUEUE *me, int count);
	int (*set_crawler)(QUEUE *me, int id);
	int (*set_cache)(QUEUE *me, int id);
};

#ifndef PROCESSOR_STRUCT_DEFINED
struct processor_struct
{
	struct processor_api_struct *api;
};
#endif

struct processor_api_struct
{
	void *reserved;
	unsigned long (*addref)(PROCESSOR *me);
	unsigned long (*release)(PROCESSOR *me);
	CRAWLSTATE (*process)(PROCESSOR *me, CRAWLOBJ *obj, const char *uri, const char *content_type);
};

#ifndef SPIDER_POLICY_STRUCT_DEFINED
struct spider_policy_struct
{
	struct spider_policy_api_struct *api;
};
#endif

struct spider_policy_api_struct
{
	void *reserved;
	unsigned long (*addref)(SPIDERPOLICY *me);
	unsigned long (*release)(SPIDERPOLICY *me);
	CRAWLSTATE (*uri)(SPIDERPOLICY *me, URI *uri, const char *uristr);
	CRAWLSTATE (*checkpoint)(SPIDERPOLICY *me, CRAWLOBJ *object, int *status);
};

/* Return values from SPIDER::perform() */

# define SPIDER_PERFORM_SUSPENDED       -2 /* Current crawler is (now) suspended */
# define SPIDER_PERFORM_ERROR           -1 /* A hard error occurred */
# define SPIDER_PERFORM_AGAIN           0  /* No items available to dequeue */
# define SPIDER_PERFORM_COMPLETE        1  /* Deqeued and processed */

/* Log messages */

# define SPIDER_MSG_NAME(type, component, key) \
	MSG_##type##_##component##_##key
# define SPIDER_MSG_PREFIX(type, component, key) \
	"%%ANANSI-" #type "-" #key ": "

# define SPIDER_MSG(type, component, key) \
	SPIDER_MSG_NAME(type, component, key) \
	SPIDER_MSG_PREFIX(type, component, key)

/* crawld and utilities */
# define MSG_E_CRAWL_LINETOOLONG        "%%ANANSI-E-2000: line too long, skipping"
# define MSG_E_CRAWL_URIPARSE           "%%ANANSI-E-2001: failed to parse URI"
# define MSG_C_CRAWL_URIPARSE           "%%ANANSI-C-2001: failed to parse URI"
# define MSG_E_CRAWL_ADDFAILED          "%%ANANSI-E-2002: failed to add URI to crawl queue"
# define MSG_C_CRAWL_ADDFAILED          "%%ANANSI-E-2002: failed to add URI to crawl queue"
# define MSG_N_CRAWL_UPDATED            "%%ANANSI-N-2003: crawler queue updated"
# define MSG_C_CRAWL_FORK               "%%ANANSI-C-2004: failed to fork child process"
# define MSG_C_CRAWL_PIDWRITE           "%%ANANSI-C-2005: failed to open PID file for writing"
# define MSG_C_CRAWL_SETSID             "%%ANANSI-C-2006: failed to create new process group"
# define MSG_C_CRAWL_CWD                "%%ANANSI-C-2007: failed to change working directory"
# define MSG_C_CRAWL_DEVNULL            "%%ANANSI-C-2008: failed to open /dev/null for reading and writing"
# define MSG_N_CRAWL_TERMINATE          "%%ANANSI-N-2009: received request to terminate"
# define MSG_N_CRAWL_TESTMODE           "%%ANANSI-N-2010: test mode enabled: ignoring cluster configuration"
# define MSG_N_CRAWL_REBALANCED         "%%ANANSI-N-2011: cluster has re-balanced"
# define MSG_C_CRAWL_INSTANCE           "%%ANANSI-N-2012: failed to create crawler instance"
# define MSG_I_CRAWL_SCHEMENOTWHITE     "%%ANANSI-I-2013: URI has a scheme which is not whitelisted"
# define MSG_I_CRAWL_SCHEMEBLACK        "%%ANANSI-I-2014: URI has a scheme which is blacklisted"
# define MSG_C_CRAWL_PROCESSORCONFIG    "%%ANANSI-C-2015: the [processor] configuration section is missing a 'name' option"
# define MSG_C_CRAWL_PROCESSORUNKNOWN   "%%ANANSI-C-2016: the specified processing engine is not registered"
# define MSG_C_CRAWL_PROCESSORINIT      "%%ANANSI-C-2017: failed to initialise the processing engine"
# define MSG_E_CRAWL_DEADREDIRECT       "%%ANANSI-E-2018: received a redirect response with no Location header to follow"
# define MSG_I_CRAWL_ACCEPTED           "%%ANANSI-I-2019: ACCEPTED"
# define MSG_C_CRAWL_QUEUECONFIG        "%%ANANSI-C-2020: the [queue] configuration section is missing a 'name' option"
# define MSG_C_CRAWL_QUEUEUNKNOWN       "%%ANANSI-C-2021: the specified queue engine is not registered"
# define MSG_C_CRAWL_QUEUEINIT          "%%ANANSI-C-2022: failed to initialise the queue engine"
# define MSG_C_CRAWL_URIUNPARSE         "%%ANANSI-C-2023: failed to re-compose URI as a string"
# define MSG_C_CRAWL_NOMEM              "%%ANANSI-C-2024: memory allocation failure"
# define MSG_C_CRAWL_THREADCREATE       "%%ANANSI-C-2025: failed to spawn new thread"
# define MSG_N_CRAWL_TERMINATETHREADS   "%%ANANSI-N-2026: terminating crawl threads..."
# define MSG_I_CRAWL_TERMINATEWAIT      "%%ANANSI-I-2027: waiting for crawl threads to terminate..."
# define MSG_N_CRAWL_STOPPED            "%%ANANSI-N-2028: all crawl threads have stopped"
# define MSG_N_CRAWL_READY              "%%ANANSI-N-2029: new crawl thread ready"
# define MSG_N_CRAWL_SUSPENDED          "%%ANANSI-N-2030: crawl thread suspended due to re-balancing"
# define MSG_N_CRAWL_RESUMING           "%%ANANSI-N-2031: crawl thread resuming"
# define MSG_C_CRAWL_FAILED             "%%ANANSI-C-2032: crawl operation failed"
# define MSG_I_CRAWL_THREADBALANCED     "%%ANANSI-I-2033: crawl thread re-balanced"
/*# define SPIDER_MSG(I, CRAWL, THREADBALANCED) "crawl thread re-balanced"*/

# define MSG_N_CRAWL_TERMINATING        "%%ANANSI-N-2034: crawl thread terminating"
# define MSG_C_CRAWL_CLUSTERSTATE       "%%ANANSI-C-2035: failed to obtain current cluster state"
# define MSG_C_CRAWL_NOTATTACHED        "%%ANANSI-C-2036: cannot perform a crawl pass when not attached to a thread"

/* RDBMS queue */
# define MSG_C_DB_CONNECT               "%%ANANSI-C-5000: failed to connect to database"
# define MSG_C_DB_MIGRATE               "%%ANANSI-C-5001: database migration failed"
# define MSG_N_DB_MIGRATEONLY           "%%ANANSI-N-5002: performing schema migration only"
# define MSG_N_DB_TESTURI               "%%ANANSI-N-5003: using test URI"
# define MSG_C_DB_URIPARSE              "%%ANANSI-C-5004: failed to parse URI"
# define MSG_E_DB_URIPARSE              "%%ANANSI-E-5004: failed to parse URI"
# define MSG_E_DB_SQL                   "%%ANANSI-E-5005: SQL error"
# define MSG_C_DB_SQL                   "%%ANANSI-C-5005: SQL error"
# define MSG_N_DB_MIGRATING             "%%ANANSI-N-5006: migrating database schema"
# define MSG_C_DB_INVALIDROOT           "%%ANANSI-C-5007: invalid root key"
# define MSG_E_DB_URIROOT               "%%ANANSI-E-5004: failed to derive root from URI"
# define MSG_I_DB_PARTUPDATED           "%%ANANSI-I-5008: partition updated"

/* Object constructors */

SPIDER *spider_create(const SPIDERCALLBACKS *callbacks);

QUEUE *spider_queue_create_uri(SPIDER *spider, URI *uri);

PROCESSOR *spider_processor_create_name(SPIDER *spider, const char *name);

SPIDERPOLICY *spider_policy_create_name(SPIDER *spider, const char *name);

# ifndef SPIDER_DEPRECATED_APIS
int queue_add_uristr(CRAWL *crawler, const char *str);
int queue_add_uri(CRAWL *crawler, URI *uri);
# endif

#endif /*!LIBSPIDER_H_*/


text:
using System.Collections.Generic;
using Azure.Core;

namespace Azure.ResourceManager.Compute.Models
{
    /// <summary> disk encryption set update resource. </summary>
    public partial class DiskEncryptionSetUpdate
    {
        /// <summary> Initializes a new instance of DiskEncryptionSetUpdate. </summary>
        public DiskEncryptionSetUpdate()
        {
            Tags = new ChangeTrackingDictionary<string, string>();
        }

        /// <summary> Resource tags. </summary>
        public IDictionary<string, string> Tags { get; }
        /// <summary> The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. </summary>
        public EncryptionSetIdentity Identity { get; set; }
        /// <summary> The type of key used to encrypt the data of the disk. </summary>
        public DiskEncryptionSetType? EncryptionType { get; set; }
        /// <summary> Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots. </summary>
        public KeyForDiskEncryptionSet ActiveKey { get; set; }
        /// <summary> Set this flag to true to enable auto-updating of this disk encryption set to the latest key version. </summary>
        public bool? RotationToLatestKeyVersionEnabled { get; set; }
    }
}


text:
// NOTE: This file was generated by the ServiceGenerator.

// ----------------------------------------------------------------------------
// API:
//   Cloud Resource Manager API (cloudresourcemanager/v3)
// Description:
//   Creates, reads, and updates metadata for Google Cloud Platform resource
//   containers.
// Documentation:
//   https://cloud.google.com/resource-manager

#import <GoogleAPIClientForREST/GTLRService.h>

#if GTLR_RUNTIME_VERSION != 3000
#error This file was generated by a different version of ServiceGenerator which is incompatible with this GTLR library source.
#endif

// Generated comments include content from the discovery document; avoid them
// causing warnings since clang's checks are some what arbitrary.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"

NS_ASSUME_NONNULL_BEGIN

// ----------------------------------------------------------------------------
// Authorization scopes

/**
 *  Authorization scope: See, edit, configure, and delete your Google Cloud data
 *  and see the email address for your Google Account.
 *
 *  Value "https://www.googleapis.com/auth/cloud-platform"
 */
FOUNDATION_EXTERN NSString * const kGTLRAuthScopeCloudResourceManagerCloudPlatform;
/**
 *  Authorization scope: View your data across Google Cloud services and see the
 *  email address of your Google Account
 *
 *  Value "https://www.googleapis.com/auth/cloud-platform.read-only"
 */
FOUNDATION_EXTERN NSString * const kGTLRAuthScopeCloudResourceManagerCloudPlatformReadOnly;

// ----------------------------------------------------------------------------
//   GTLRCloudResourceManagerService
//

/**
 *  Service for executing Cloud Resource Manager API queries.
 *
 *  Creates, reads, and updates metadata for Google Cloud Platform resource
 *  containers.
 */
@interface GTLRCloudResourceManagerService : GTLRService

// No new methods

// Clients should create a standard query with any of the class methods in
// GTLRCloudResourceManagerQuery.h. The query can the be sent with GTLRService's
// execute methods,
//
//   - (GTLRServiceTicket *)executeQuery:(GTLRQuery *)query
//                     completionHandler:(void (^)(GTLRServiceTicket *ticket,
//                                                 id object, NSError *error))handler;
// or
//   - (GTLRServiceTicket *)executeQuery:(GTLRQuery *)query
//                              delegate:(id)delegate
//                     didFinishSelector:(SEL)finishedSelector;
//
// where finishedSelector has a signature of:
//
//   - (void)serviceTicket:(GTLRServiceTicket *)ticket
//      finishedWithObject:(id)object
//                   error:(NSError *)error;
//
// The object passed to the completion handler or delegate method
// is a subclass of GTLRObject, determined by the query method executed.

@end

NS_ASSUME_NONNULL_END

#pragma clang diagnostic pop


text:
package org.ScripterRon.BitcoinCore;

import java.io.EOFException;
import java.nio.ByteBuffer;

/**
 *
The 'tx' message contains a transaction which is not yet in a block.  The transaction
 * will be held in the memory pool for a period of time to allow other peers to request
 * the transaction.

 *
 *
Transaction Message

 *

 *   Size           Field               Description
 *   ====           =====               ===========
 *   4 bytes        Version             Transaction version
 *   VarInt         InputCount          Number of inputs
 *   Variable       InputList           Inputs
 *   VarInt         OutputCount         Number of outputs
 *   Variable       OutputList          Outputs
 *   4 bytes        LockTime            Transaction lock time
 *

 */
public class TransactionMessage {

    /**
     * Build a 'tx' message
     *
     * @param       peer                    The destination peer or null for a broadcast message
     * @param       tx                      Transaction to be sent
     * @return                              'tx' message
     */
    public static Message buildTransactionMessage(Peer peer, Transaction tx) {
        ByteBuffer buffer = MessageHeader.buildMessage("tx", tx.getBytes());
        return new Message(buffer, peer, MessageHeader.MessageCommand.TX);
    }

    /**
     * Build a 'tx' message
     *
     * @param       peer                    The destination peer or null for a broadcast message
     * @param       txData                  Serialized transaction
     * @return                              'tx' message
     */
    public static Message buildTransactionMessage(Peer peer, byte[] txData) {
        ByteBuffer buffer = MessageHeader.buildMessage("tx", txData);
        return new Message(buffer, peer, MessageHeader.MessageCommand.TX);
    }

    /**
     * Processes a 'tx' message
     *
     * @param       msg                     Message
     * @param       inBuffer                Input buffer
     * @param       msgListener             Message listener
     * @throws      EOFException            Serialized data is too short
     * @throws      VerificationException   Transaction verification failed
     */
    public static void processTransactionMessage(Message msg, SerializedBuffer inBuffer, MessageListener msgListener)
                                            throws EOFException, VerificationException {
        //
        // Get the transaction
        //
        Transaction tx = new Transaction(inBuffer);
        //
        // Notify the message listener that a transaction is ready for processing
        //
        msgListener.processTransaction(msg, tx);
    }
}


text:
move
pickBeeper
move


text:
\documentclass[border=10pt]{standalone}
\usepackage{tkz-graph}
\GraphInit[vstyle = Classic]
\tikzset{
  LabelStyle/.style = { rectangle, rounded corners,
                        fill = white!50,
                        text = black, font = \small\bfseries },
  VertexStyle/.append style = { fill=white,thick, minimum size=25pt, font = \Large\bfseries, thick},
  EdgeStyle/.append style = {-> , font=\bfseries} }
\thispagestyle{empty}
\begin{document}
\begin{tikzpicture}
  \SetGraphUnit{45pt}
  \node[VertexStyle](B2) at (0,1.5) {$+1$};
  \node[VertexStyle](B1) at (-3,1.5){$+1$};
  \node[VertexStyle](X1) at (-3,0){$x_1$};
  \node[VertexStyle](X2) at (-3,-1.5){$x_2$};
  \node[draw=none, thick, font=\Large\bfseries](END) at (5.5,0){$h_\Theta(x)$};

\tikzset{ VertexStyle/.append style = { fill = purple }}
  \node[VertexStyle](NAND) at (0,0) {$\uparrow$};
\tikzset{ VertexStyle/.append style = { fill = olive }}
  \node[VertexStyle](OR) at (0,-1.5) {$\lor$};
\tikzset{ VertexStyle/.append style = { fill = teal }}
  \node[VertexStyle](AND2) at (3,0){$\land$};

  \Edge[](AND2)(END)

\tikzset{EdgeStyle/.append style = {teal},
	LabelStyle/.append style = {text= teal}}
  \Edge[label=-30](B2)(AND2)
  \Edge[label=20](NAND)(AND2)
  \Edge[label=20](OR)(AND2)

\tikzset{EdgeStyle/.append style = {purple},
	LabelStyle/.append style = {text = purple}}
  \Edge[label=30 ](B1)(NAND)
\tikzset{EdgeStyle/.append style = {purple},
	LabelStyle/.append style = {text = purple,left,xshift=-6pt}}
  \Edge[label=-20](X1)(NAND)
\tikzset{EdgeStyle/.append style = {purple},
	LabelStyle/.append style = {text = purple,left,yshift=-6pt}}
  \Edge[label=-20](X2)(NAND)

\tikzset{EdgeStyle/.append style = {olive},
	LabelStyle/.append style = {text = olive, right,xshift=-5pt,yshift=6pt}}
  \Edge[label=20](X2)(OR)
\tikzset{EdgeStyle/.append style = {olive},
	LabelStyle/.append style = {text = olive,yshift=-7pt,xshift=15pt}}
  \Edge[label=20](X1)(OR)
\tikzset{EdgeStyle/.append style = {olive},
	LabelStyle/.append style = {text = olive,yshift=24pt,xshift=-34}}
  \Edge[label=-10](B1)(OR)

\end{tikzpicture}
\end{document}


text:
| Q             | A
| ------------- | ---
| Branch?       | "master"
| Bug fix?      | yes/no
| New feature?  | yes/no
| BC breaks?    | yes/no
| Deprecations? | yes/no
| Tests pass?   | yes/no
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any
| License       | MIT
| Doc PR        | reference to the documentation PR, if any


text:
multiselect
===========

jQuery multiselect plugin with two sides. The user can select one or more items and send them to the other side.

# [Demo](http://crlcu.github.io/multiselect/)

## Requirements

- jQuery 1.7 or higher

## Quick start

Several quick start options are available:

- Clone the repo: `git clone https://github.com/crlcu/multiselect.git` or
- Install with [Bower](http://bower.io): `bower install multiselect-two-sides`.

### Usage example

```html
<div class="row">
	<div class="col-xs-5">
		<select name="from[]" id="multiselect" class="form-control" size="8" multiple="multiple">
			<option value="1">Item 1</option>
			<option value="3">Item 3</option>
			<option value="2">Item 2</option>
		</select>
	</div>

	<div class="col-xs-2">
		<button type="button" id="multiselect_rightAll" class="btn btn-block"><i class="glyphicon glyphicon-forward"></i></button>
		<button type="button" id="multiselect_rightSelected" class="btn btn-block"><i class="glyphicon glyphicon-chevron-right"></i></button>
		<button type="button" id="multiselect_leftSelected" class="btn btn-block"><i class="glyphicon glyphicon-chevron-left"></i></button>
		<button type="button" id="multiselect_leftAll" class="btn btn-block"><i class="glyphicon glyphicon-backward"></i></button>
	</div>

	<div class="col-xs-5">
		<select name="to[]" id="multiselect_to" class="form-control" size="8" multiple="multiple"></select>
	</div>
</div>
```

```javascript
<script type="text/javascript" src="path/to/jquery.min.js"></script>
<script type="text/javascript" src="path/to/multiselect.min.js"></script>

<script type="text/javascript">
jQuery(document).ready(function($) {
	$('#multiselect').multiselect();
});
</script>
```

## Bugs and feature requests

If your problem or idea is not [addressed](https://github.com/crlcu/multiselect/issues) yet, [please open a new issue](https://github.com/crlcu/multiselect/issues/new).

## Versioning

For transparency into release cycle and in striving to maintain backward compatibility, multiselect is maintained under [the Semantic Versioning guidelines](http://semver.org/).

## License

The multiselect plugin is open-sourced software licensed under the [the MIT license](https://github.com/crlcu/multiselect/blob/master/LICENSE).


text:
using Xamarin.Forms;
using Xamarin.Forms.Internals;

namespace Xamarin.CommunityToolkit.UI.Views
{
	[Preserve(AllMembers = true)]
	public class TabBadgeTemplate : Grid
	{
		public TabBadgeTemplate()
		{
			BatchBegin();

			HorizontalOptions = LayoutOptions.Start;
			VerticalOptions = LayoutOptions.Start;

			var badgeBorder = new Frame
			{
				HasShadow = false,
				IsClippedToBounds = false,
				Padding = 2,
				Margin = 6
			};

			var badgeText = new Label
			{
				FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)),
				HorizontalTextAlignment = TextAlignment.Center,
				HorizontalOptions = LayoutOptions.Center,
				VerticalOptions = LayoutOptions.Center
			};

			badgeBorder.SetBinding(BackgroundColorProperty, new Binding("BackgroundColor", source: RelativeBindingSource.TemplatedParent));
			badgeBorder.SetBinding(Frame.BorderColorProperty, new Binding("BorderColor", source: RelativeBindingSource.TemplatedParent));

			badgeText.BatchBegin();

			badgeText.SetBinding(Label.TextProperty, new Binding("Text", source: RelativeBindingSource.TemplatedParent));
			badgeText.SetBinding(Label.TextColorProperty, new Binding("TextColor", source: RelativeBindingSource.TemplatedParent));

			badgeBorder.Content = badgeText;

			Children.Add(badgeBorder);

			badgeText.BatchCommit();

			BatchCommit();

			INameScope nameScope = new NameScope();
			NameScope.SetNameScope(this, nameScope);
			nameScope.RegisterName(TabBadgeView.ElementBorder, badgeBorder);
			nameScope.RegisterName(TabBadgeView.ElementText, badgeText);
		}
	}
}


text:
__author__ = "Peter Molnar"
__copyright__ = "Copyright 2017-2019, Peter Molnar"
__license__ = "apache-2.0"
__maintainer__ = "Peter Molnar"
__email__ = "mail@petermolnar.net"

import re
import subprocess
import json
import os
import logging
from tempfile import gettempdir

TMPSUBDIR = "nasg"
SHM = "/dev/shm"

if os.path.isdir(SHM) and os.access(SHM, os.W_OK):
    TMPDIR = f"{SHM}/{TMPSUBDIR}"
else:
    TMPDIR = os.path.join(gettempdir(), TMPSUBDIR)

if not os.path.isdir(TMPDIR):
    os.makedirs(TMPDIR)

EXIFDATE = re.compile(
    r"^(?P<year>[0-9]{4}):(?P<month>[0-9]{2}):(?P<day>[0-9]{2})\s+"
    r"(?P<time>[0-9]{2}:[0-9]{2}:[0-9]{2})$"
)

class CachedMeta(dict):
    def __init__(self, fpath):
        self.fpath = fpath
        self.suffix = "cache"

    @property
    def cfile(self):
        fname = os.path.basename(self.fpath)
        if fname == "index.md":
            fname = os.path.basename(os.path.dirname(self.fpath))

        return os.path.join(
            TMPDIR,
            "%s.%s.%s" % (fname, self.__class__.__name__, self.suffix),
        )

    @property
    def _is_cached(self):
        if os.path.exists(self.cfile):
            mtime = os.path.getmtime(self.fpath)
            ctime = os.path.getmtime(self.cfile)
            if ctime >= mtime:
                return True
        return False

    def _read(self):
        if not self._is_cached:
            self._call_tool()
            self._cache_update()
        else:
            self._cache_read()

    def _cache_update(self):
        with open(self.cfile, "wt") as f:
            logging.debug(
                "writing cached meta file of %s to %s", self.fpath, self.cfile
            )
            f.write(json.dumps(self, indent=4, sort_keys=True))

    def _cache_read(self):
        with open(self.cfile, "rt") as f:
            data = json.loads(f.read())
            for k, v in data.items():
                self[k] = v

class Exif(CachedMeta):
    def __init__(self, fpath):
        self.fpath = fpath
        self.suffix = "json.cache"
        self._read()

    def _call_tool(self):
        """
        Why like this: the # on some of the params forces exiftool to
        display values like decimals, so the latitude / longitude params
        can be used and parsed in a sane way

        If only -json is passed, it gets everything nicely, but in the default
        format, which would require another round to parse

        """
        cmd = (
            "exiftool",
            "-sort",
            "-json",
            "-MIMEType",
            "-FileType",
            "-FileName",
            "-FileSize#",
            "-ModifyDate",
            "-CreateDate",
            "-DateTimeOriginal",
            "-ImageHeight",
            "-ImageWidth",
            "-Aperture",
            "-FOV",
            "-ISO",
            "-FocalLength",
            "-FNumber",
            "-FocalLengthIn35mmFormat",
            "-ExposureTime",
            "-Model",
            "-GPSLongitude#",
            "-GPSLatitude#",
            "-LensID",
            "-LensSpec",
            "-Lens",
            "-ReleaseDate",
            "-Description",
            "-Headline",
            "-HierarchicalSubject",
            "-Copyright",
            "-Artist",
            self.fpath,
        )

        p = subprocess.Popen(
            cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE
        )

        stdout, stderr = p.communicate()
        if stderr:
            raise OSError("Error reading EXIF:\n\t%s\n\t%s", cmd, stderr)

        exif = json.loads(stdout.decode("utf-8").strip()).pop()
        if "ReleaseDate" in exif and "ReleaseTime" in exif:
            exif["DateTimeRelease"] = "%s %s" % (
                exif.get("ReleaseDate"),
                exif.get("ReleaseTime")[:8],
            )
            del exif["ReleaseDate"]
            del exif["ReleaseTime"]

        for k, v in exif.items():
            self[k] = self.exifdate2rfc(v)

    def exifdate2rfc(self, value):
        """ converts and EXIF date string to RFC 3339 format

        :param value: EXIF date (2016:05:01 00:08:24)
        :type arg1: str
        :return: RFC 3339 string with UTC timezone 2016-05-01T00:08:24+00:00
        :rtype: str
        """
        if not isinstance(value, str):
            return value
        match = EXIFDATE.match(value)
        if not match:
            return value
        return "%s-%s-%sT%s+00:00" % (
            match.group("year"),
            match.group("month"),
            match.group("day"),
            match.group("time"),
        )


text:
<?xml version="1.0"?>
<vertical display_name="Lecture slides (PDF)">
  <html url_name="Lecture_slides__PDF__html3"/>
</vertical>


text:
FireCARES [![Build Status](https://travis-ci.org/FireCARES/firecares.svg?branch=master)](https://travis-ci.org/FireCARES/firecares)
=========
The FireCARES application

Getting Started
---------------

A quick way to get started is with Vagrant and VirtualBox.

### Docker
1.  Add `.env.local` file to project root (this file can be obtained in the 1Password account for Firecares).

2.  Run `./build.sh` to build the Docker container.

3.  Run `./run.sh` to start the Firecares app.

4.  Load snapshot of Firecares Database (if you don't have .pg_conf, consult a system
    admin for RDS host credentials)
    ```bash
    psql -h 0.0.0.0 -U firecares -p 5433 -W -c 'create database firecares'

    pg_dump -d "service=exposure" -f firecares.sql

    psql -h 0.0.0.0 -U firecares -W firecares < firecares.sql
    ```

4.  Load snapshot of NFIRS Database (if you don't have .pg_conf, consult a system
    admin for RDS host credentials)
    ```bash
    psql -h 0.0.0.0 -U firecares -p 5433 -W -c 'create database nfirs'

    pg_dump -d "service=nfirs" --schema=public -f nfirs.sql

    psql -h 0.0.0.0 -U firecares -W nfirs < nfirs.sql
    ```

5.  Finally, you should be able to open see the app in your browser by opening:
    `0.0.0.0:8000`

To make tileserver changes, see the Prominent Edge `tessera-ansible` repository, specifically the `firecares` branch

### Pre-commit configuration

We use [pre-commit](http://pre-commit.com/), see how to [install](http://pre-commit.com/#install) in your local repository.

### Unit Testing

You'll need the following commands to run all of the unit tests.  Tests are run on each commit automatically, so please run them yourself before you commit.

#### Docker
```
docker exec -it firecares_firecares_1 bash -c "python ./manage.py test
```

```bash
vagrant ssh
sudo su firecares
workon firecares
python manage.py test
```

Additionally, individual tests can be run using the full module/classname/test name path.  If not testing migrations `--keepdb` will significantly speed up the whole process:

```bash
python manage.py test firecares.firestation.tests.test_metrics:FireDepartmentMetricsTests.test_calculate_structure_counts --noinput --keepdb
```

### Generating CSS

This project uses LESS CSS pre-processor to generate CSS rules.  To make a modification to a CSS rule, follow these steps:

1. Make the modification in the appropriate LESS file.  For example: [style.less](firecares/firestation/static/firestation/theme/assets/less/style.less)
2. Use the `lessc` command to compile the CSS from LESS and pipe the output to the appropriate location `lessc style.less > ../css/style.css`.

### Running IPython/Jupyter notebooks

To assist in the transparency of the calculations and data analysis, ipython notebooks in the `/scripts` folder can be run from your vagrant machine via:

```bash
ssh -L 8888:localhost:8888 vagrant@192.168.33.15
sudo chmod a+rwx /run/user/1000
sudo su firecares
workon firecares
python manage.py shell_plus --notebook --no-browser  # follow the instructions that follow in your shell regarding logging into ipython with a token
```

### Symlinking Static Files

When developing client-side functionality for FireCARES it is often helpful to symlink client-side assets so they refresh when the browser is refreshed.

```bash
vagrant ssh
sudo sed -i '/location \/static/a sendfile off;' /etc/nginx/sites-enabled/firecares
sudo service nginx restart
sudo su firecares
workon firecares
python manage.py collectstatic --noinput -l --clear
```

### Testing osgeo importer within FireCARES

In order to test the osgeo_importer functionality within FireCARES, specifically being able to step via debugger into specific celery processes, you will need to ensure that `CELERY_ALWAYS_EAGER = True`; however, this will not yield a resulting task state other than `PENDING` so items that depend on a celery result will never finish (eg. the osgeo upload dialog will never close on its own).  Additionally, in order to support a multi-node deployment, celery results are stored using the memcached backend and the actual uploaded file is pushed/pulled to/from an S3 bucket as specified by `OSGEO_STORAGE_BUCKET_NAME` before being acted-upon by GDAL, but specifying a bucket name is not necessary for local development as the FireCARES importer and inspector can handle these tasks using a local filesystem.

----

## Building Dockerfiles:
* All images depend on Dockerfile-base.  This is built one time only; no job in Jenkins:
```
make build-base
make push-base
```


text:
declare module 'redux-rsaa-middleware' {
  declare type DispatchAPI<A> = (action: A) => A;

  declare type Dispatch<A: { type: $Subtype<string>, ... }> = DispatchAPI<A>;

  declare type MiddlewareAPI<S, A, D = Dispatch<A>> = {
    dispatch: D,
    getState(): S,
    ...
  };

  declare type Middleware<S, A, D = Dispatch<A>> =
    (api: MiddlewareAPI<S, A, D>) =>
      (next: D) => D;

  declare type Action = {
    type: string,
    payload: Object,
    ...
  };

  declare type State = Object;

  declare export var RSAAMiddleware : Middleware<State, Action, Dispatch<Action>>;

  declare export type RSAAPayload = {
    method?: string,
    path?: string,
    query?: string,
    error?: Object,
    errorTime?: string,
    response?: Object,
    failureAction?: RSAAAction,
    successAction?: RSAAAction,
    startedSendingAction?: RSAAAction,
    finishedSendingAction?: RSAAAction,
    ...
  };

  declare export type RSAAAction = {
    type: string,
    payload: RSAAPayload,
    ...
  };
}


text:
package com.dim.jit.skyearth.organization.action;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping(value="/org")
public class OrgAction {

	@RequestMapping(value="/frame.action")
	String frame(){
		return "org-frame";
	}

	@RequestMapping(value="/tree.action")
	String tree(){
		return "org-tree";
	}
}


text:
# randi

> Pseudorandom numbers having integer values.

## Usage

```javascript
var randi = require( '@stdlib/random/base/randi' );
```

#### randi()

Returns a pseudorandom number having an integer value.

```javascript
var v = randi();
// returns <number>
```

#### randi.factory( \[options] )

Returns a pseudorandom number generator (PRNG) for generating random numbers.

```javascript
var rand = randi.factory();
```

The function accepts the following `options`:

-   **name**: name of a supported pseudorandom number generator (PRNG), which will serve as the underlying source of pseudorandom numbers. The following generators are supported:

    -   [`mt19937`][@stdlib/random/base/mt19937]: 32-bit Mersenne Twister.
    -   [`minstd`][@stdlib/random/base/minstd]: linear congruential pseudorandom number generator (LCG) based on Park and Miller.
    -   [`minstd-shuffle`][@stdlib/random/base/minstd-shuffle]: linear congruential pseudorandom number generator (LCG) whose output is shuffled.

    Default: [`'mt19937'`][@stdlib/random/base/mt19937].

-   **seed**: pseudorandom number generator seed. Valid seed values vary according to the underlying PRNG.

-   **state**: pseudorandom number generator state. Valid state values vary according to the underlying PRNG. If provided, the function ignores the `seed` option.

-   **copy**: `boolean` indicating whether to copy a provided pseudorandom number generator state. Setting this option to `false` allows sharing state between two or more pseudorandom number generators. Setting this option to `true` ensures that a returned generator has exclusive control over its internal state. Default: `true`.

By default, the underlying pseudorandom number generator is [`mt19937`][@stdlib/random/base/mt19937]. To use a different PRNG, set the `name` option.

```javascript
var rand = randi.factory({
    'name': 'minstd-shuffle'
});

var v = rand();
// returns <number>
```

To seed a pseudorandom number generator, set the `seed` option.

```javascript
var rand1 = randi.factory({
    'seed': 12345
});

var r1 = rand1();
// returns <number>

var rand2 = randi.factory({
    'seed': 12345
});

var r2 = rand2();
// returns <number>

var bool = ( r1 === r2 );
// returns true
```

To return a generator having a specific initial state, set the generator `state` option.

```javascript
var rand;
var bool;
var r;
var i;

// Generate pseudorandom numbers, thus progressing the generator state:
for ( i = 0; i < 1000; i++ ) {
    r = randi();
}

// Create a new PRNG initialized to the current state of `randi`:
rand = randi.factory({
    'state': randi.state
});

// Test that the generated pseudorandom numbers are the same:
bool = ( rand() === randi() );
// returns true
```

#### randi.NAME

The generator name.

```javascript
var str = randi.NAME;
// returns 'randi'
```

#### randi.PRNG

The underlying pseudorandom number generator.

```javascript
var prng = randi.PRNG;
// returns <Function>
```

#### randi.MIN

Minimum value lower bound (specific to underlying PRNG).

```javascript
var min = randi.MIN;
// returns <number>
```

#### randi.MAX

Maximum value upper bound (specific to underlying PRNG).

```javascript
var max = randi.MAX;
// returns <number>
```

#### randi.seed

The value used to seed `randi()`.

```javascript
var rand;
var v;
var i;

// Generate pseudorandom values...
for ( i = 0; i < 100; i++ ) {
    v = randi();
}

// Generate the same pseudorandom values...
rand = randi.factory({
    'seed': randi.seed
});
for ( i = 0; i < 100; i++ ) {
    v = rand();
}
```

#### randi.seedLength

Length of generator seed.

```javascript
var len = randi.seedLength;
// returns <number>
```

#### randi.state

Writable property for getting and setting the generator state.

```javascript
var r = randi();
// returns <number>

r = randi();
// returns <number>

// ...

// Get a copy of the current state:
var state = randi.state;

r = randi();
// returns <number>

r = randi();
// returns <number>

// Reset the state:
randi.state = state;

// Replay the last two pseudorandom numbers:
r = randi();
// returns <number>

r = randi();
// returns <number>

// ...
```

#### randi.stateLength

Length of generator state.

```javascript
var len = randi.stateLength;
// returns <number>
```

#### randi.byteLength

Size (in bytes) of generator state.

```javascript
var sz = randi.byteLength;
// returns <number>
```

#### randi.toJSON()

Serializes the pseudorandom number generator as a JSON object.

```javascript
var o = randi.toJSON();
// returns { 'type': 'PRNG', 'name': '...', 'state': {...}, 'params': [] }
```

## Notes

-   **Warning**: the default underlying source of pseudorandom numbers may **change** in the future. If exact reproducibility is required, either explicitly specify a PRNG via the `name` option or use an underlying PRNG directly.
-   If PRNG state is "shared" (meaning a state array was provided during PRNG creation and **not** copied) and one sets the generator state to a state array having a different length, the PRNG does **not** update the existing shared state and, instead, points to the newly provided state array. In order to synchronize PRNG output according to the new shared state array, the state array for **each** relevant PRNG must be **explicitly** set.
-   If PRNG state is "shared" and one sets the generator state to a state array of the same length, the PRNG state is updated (along with the state of all other PRNGs sharing the PRNG's state array).

## Examples

```javascript
var randi = require( '@stdlib/random/base/randi' );

var seed;
var rand;
var i;

// Generate pseudorandom numbers...
for ( i = 0; i < 100; i++ ) {
    console.log( randi() );
}

// Create a new pseudorandom number generator...
seed = 1234;
rand = randi.factory({
    'seed': seed
});
for ( i = 0; i < 100; i++ ) {
    console.log( rand() );
}

// Create another pseudorandom number generator using a previous seed...
rand = randi.factory({
    'seed': randi.seed
});
for ( i = 0; i < 100; i++ ) {
    console.log( rand() );
}
```

* * *

## See Also

-   [`@stdlib/random/base/minstd`][@stdlib/random/base/minstd]: A linear congruential pseudorandom number generator (LCG) based on Park and Miller.
-   [`@stdlib/random/base/minstd-shuffle`][@stdlib/random/base/minstd-shuffle]: A linear congruential pseudorandom number generator (LCG) whose output is shuffled.
-   [`@stdlib/random/base/mt19937`][@stdlib/random/base/mt19937]: A 32-bit Mersenne Twister pseudorandom number generator.

[@stdlib/random/base/mt19937]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/random/base/mt19937

[@stdlib/random/base/minstd]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/random/base/minstd

[@stdlib/random/base/minstd-shuffle]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/random/base/minstd-shuffle

[@stdlib/random/base/minstd]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/random/base/minstd

[@stdlib/random/base/minstd-shuffle]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/random/base/minstd-shuffle

[@stdlib/random/base/mt19937]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/random/base/mt19937


text:
{% extends "base.html" %}

{% block title %}Verify MFA{% endblock %}

{% block content %}

Verify MFA

            Choose the device to authenticate with. Check the authentication app on the device and enter the
            authentication code below to log in to OpenRecords.

        <form id="verify-mfa" action="{{ url_for('mfa.verify') }}" method="POST" role="form">
            {{ form.csrf_token }}
            {{ form.device.label }} {{ form.device }}
            {{ form.code.label }} {{ form.code }}

            <input type="submit" class="btn btn-primary" value="Submit">
        </form>

{% endblock %}


text:
from iotronicclient.common import utils
from iotronicclient.v1 import board_shell
from iotronicclient.v1 import plugin_injection_shell
from iotronicclient.v1 import plugin_shell

COMMAND_MODULES = [
    board_shell,
    plugin_shell,
    plugin_injection_shell,
]

def enhance_parser(parser, subparsers, cmd_mapper):
    """Enhance parser with API version specific options.

    Take a basic (nonversioned) parser and enhance it with
    commands and options specific for this version of API.

    :param parser: top level parser
    :param subparsers: top level parser's subparsers collection
                       where subcommands will go
    """
    for command_module in COMMAND_MODULES:
        utils.define_commands_from_module(subparsers, command_module,
                                          cmd_mapper)


text:
using AppKit;
using Foundation;

namespace SuperPolarity
{
	[Register ("AppDelegate")]
	static class Program
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		static void Main (string[] args)
		{
			NSApplication.Init ();

			using (var p = new NSAutoreleasePool ()) {
				NSApplication.SharedApplication.Delegate = new AppDelegate ();
				NSApplication.Main (args);
			}

		}
	}

	class AppDelegate : NSApplicationDelegate
	{
		SuperPolarity superPolarity;

		public AppDelegate ()
		{
		}

		public override void DidFinishLaunching (NSNotification notification)
		{
			superPolarity = new SuperPolarity();
			superPolarity.Run ();
		}

		public override void WillTerminate (NSNotification notification)
		{
		}
	}
}


text:
import external from '\0external';

assert.equal(external, 1);


text:
'use strict';

const assert = require('./../../assert');
const common = require('./../../common');

let battle;

describe('Lansat Berry', function () {
	afterEach(function () {
		battle.destroy();
	});

	it('should apply a Focus Energy effect when consumed', function () {
		battle = common.createBattle();
		battle.join('p1', 'Guest 1', 1, [{species: 'Aggron', ability: 'sturdy', item: 'lansatberry', moves: ['sleeptalk']}]);
		battle.join('p2', 'Guest 2', 1, [{species: 'Lucario', ability: 'adaptability', moves: ['aurasphere']}]);
		const holder = battle.p1.active[0];
		battle.commitDecisions();
		assert.false.holdsItem(holder);
		assert.ok('focusenergy' in holder.volatiles);
	});

	it('should start to apply the effect even in middle of an attack', function () {
		battle = common.createBattle([
			[{species: 'Makuhita', ability: 'guts', item: 'lansatberry', moves: ['triplekick']}],
			[{species: 'Muk', ability: 'noguard', item: 'rockyhelmet', moves: ['acidarmor']}],
		]);
		const holder = battle.p1.active[0];

		let i = 0;
		let expectedRatio = [1, 1, 1, 1, 1, 3];
		battle.on('ModifyCritRatio', battle.getFormat(), -99, function (critRatio, pokemon) {
			assert.strictEqual(critRatio, expectedRatio[i++]);
		});

		battle.commitDecisions();
		battle.commitDecisions();

		assert.false.holdsItem(holder);
		assert.strictEqual(holder.hp, 3);
		assert.strictEqual(i, 6);
	});
});


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.Linq;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.Composition;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.Editor.UnitTests.Utilities
{
    public static class EditorServicesUtil
    {
        private static Lazy<IExportProviderFactory> s_exportProviderFactory = new Lazy<IExportProviderFactory>(CreateExportProviderFactory);

        public static ExportProvider ExportProvider => s_exportProviderFactory.Value.CreateExportProvider();

        private static IExportProviderFactory CreateExportProviderFactory()
        {
            var assemblies = TestExportProvider
                .GetCSharpAndVisualBasicAssemblies()
                .Concat(new[] { typeof(EditorServicesUtil).Assembly });
            return ExportProviderCache.GetOrCreateExportProviderFactory(ExportProviderCache.GetOrCreateAssemblyCatalog(assemblies, ExportProviderCache.CreateResolver()));
        }
    }
}


text:
const index = r => require.ensure([], () => r(require('@/page/index')), 'index'); // 概况

const saasUser = r => require.ensure([], () => r(require('@/page/saas/account/user.vue')), 'saasUser'); // 用户管理
const saasRole = r => require.ensure([], () => r(require('@/page/saas/account/role.vue')), 'saasRole'); // 角色管理
const saasMenu = r => require.ensure([], () => r(require('@/page/saas/account/menu.vue')), 'saasMenu'); // 导航菜单管理

// 员工 staff
const position = r => require.ensure([], () => r(require('@/page/saas/staff/position.vue')), 'position'); // 岗位管理
const level = r => require.ensure([], () => r(require('@/page/saas/staff/level.vue')), 'level'); // 等级管理
const course = r => require.ensure([], () => r(require('@/page/saas/staff/course.vue')), 'course'); // 课程管理
const courseware = r => require.ensure([], () => r(require('@/page/saas/staff/courseware.vue')), 'courseware'); // 课件管理
const testPaper = r => require.ensure([], () => r(require('@/page/saas/staff/test-paper.vue')), 'testPaper'); // 试卷管理
const question = r => require.ensure([], () => r(require('@/page/saas/staff/question.vue')), 'question'); // 考题管理

const news = r => require.ensure([], () => r(require('@/page/saas/staff/news.vue')), 'news'); // 内容管理
const newsSort = r => require.ensure([], () => r(require('@/page/saas/staff/newsSort.vue')), 'newsSort'); // 内容分类管理

// 健康
const saClass = r => require.ensure([], () => r(require('@/page/saas/health/class.vue')), 'saClass'); // 健康讲堂

// 客户端
const client = r => require.ensure([], () => r(require('@/page/saas/client/client.vue')), 'client'); // 客户端

export default {
    children: [{
        path: '/',
        component: index
    }, {
        path: '/sa-user',
        component: saasUser
    }, {
        path: '/sa-role',
        component: saasRole
    }, {
        path: '/sa-menu',
        component: saasMenu
    }, {
        path: '/sa-class',
        component: saClass
    }, {
        path: '/position',
        component: position
    }, {
        path: '/level',
        component: level
    }, {
        path: '/course',
        component: course
    }, {
        path: '/courseware',
        component: courseware
    }, {
        path: '/testPaper',
        component: testPaper
    }, {
        path: '/question',
        component: question
    }, {
        path: '/news',
        component: news
    }, {
        path: '/newsSort',
        component: newsSort
    }, {
        path: '/sa-client',
        component: client
    }]
}


text:
(function() {
  "use strict";

  QUnit.module("Hot List", {
    beforeEach: function() {
      var fixture = document.getElementById("qunit-fixture");
      var template = document.getElementById("hotlist-template");

      var html = template.innerHTML;
      fixture.innerHTML = html;
      resetGlobals();
	  addGlobalListeners();
    },
    afterEach: function() {
      var popup = document.getElementById("popup");
      if (popup) {
        popup.parentNode.removeChild(popup);
      }
    }
  });

  QUnit.test("HOTLIST - Configuration", function(assert) {
    var id = identifySoi();

    var expected = {
      blankTail: "soi",
      formFind: true,
      formMail: false,
      fullRoomName: "c",
      isChatRoom: false,
      isCork: false,
      isFtpRoom: false,
      isHot: true,
      isNickRoom: false,
      isSoi: true,
      lastLink: true
    };

    assert.validConfig(id, expected);

  });

  QUnit.test("parseHotList", function(assert) {
    var data = upgrades.hotlist.internals.parseHotList();

    /*
    data.forEach(function(a, i) {
      a.folkLen = a.folk.length;
      // Make FireFox happy...
      a.roomURL = a.roomURL.replace(/%60/g, "`");
      delete a.folk;
    });

    console.log(JSON.stringify(data));
	*/

    var result = [{
      "hideButton": "",
      "roomDesc": "General & Generic Chat",
      "roomHost": "owned by captainjohn",
      "roomLongDesc": "A place for general and generic conversation, mostly based around\n\t  the old TV show \"Love Boat\"",
      "roomName": "jhnchat@soi",
      "roomOpen": "Open to all",
      "roomURL": "http://ssomf.hyperchat.com/cgi-bin/somf.exe?EParms=ru%7Ckqw29tRmwmpkv%22ru%7Cvk9ik`wDwkm%22ru%7Cle9Rmwmpkv",
      "spiritCount": "5 spirits",
      "folkLen": 5
    }, {
      "hideButton": "<input type=\"submit\" name=\"HOT_HIDE_dkforest_bwr\" value=\"Hide\"><br>",
      "roomDesc": "Shadows and Secrets",
      "roomHost": "",
      "roomLongDesc": "A room of secret whispers. Post only to show that you are in \n        the room. No public conversations.  ",
      "roomName": "sshh@soi",
      "roomOpen": "Open to all",
      "roomURL": "http://ssomf.hyperchat.com/cgi-bin/somf.exe?EParms=ru%7Ckqw29tRmwmpkv%22ru%7Cvk9wwllDwkm%22ru%7Cle9Rmwmpkv",
      "spiritCount": "5 spirits",
      "folkLen": 5
    }, {
      "hideButton": "",
      "roomDesc": "Night Trips ",
      "roomHost": "owned by \n      Dalesandro Empire",
      "roomLongDesc": "Night Trips ~ Strip club located in the Hood ~ Part of the \n        City RPG  ",
      "roomName": "nighttri@soi",
      "roomOpen": "Citizens only",
      "roomURL": "http://ssomf.hyperchat.com/cgi-bin/somf.exe?EParms=ru%7Ckqw29tRmwmpkv%22ru%7Cvk9jmclppvmDwkm%22ru%7Cle9Rmwmpkv",
      "spiritCount": "3 spirits",
      "folkLen": 3
    }, {
      "hideButton": "",
      "roomDesc": "Luperci Headquarters [Neosaka | Exo]",
      "roomHost": "owned by Chase Stevens",
      "roomLongDesc": "A multi-loc for Luperci in Neosaka. Posting is with domain \n        permissions only. A domain of |Exo RPG|",
      "roomName": "luperci@soi",
      "roomOpen": "Open to \n      all",
      "roomURL": "http://ssomf.hyperchat.com/cgi-bin/somf.exe?EParms=ru%7Ckqw29tRmwmpkv%22ru%7Cvk9hqtavgmDwkm%22ru%7Cle9Rmwmpkv",
      "spiritCount": "2 spirits",
      "folkLen": 2
    }, {
      "hideButton": "",
      "roomDesc": "Bat Cave",
      "roomHost": "owned by \n      *username",
      "roomLongDesc": "UL REALM - Batcave - Beware of all the traps. Only those \n        allowed may enter.",
      "roomName": "batcave@soi",
      "roomOpen": "Open to all",
      "roomURL": "http://ssomf.hyperchat.com/cgi-bin/somf.exe?EParms=ru%7Ckqw29tRmwmpkv%22ru%7Cvk9fepgeraDwkm%22ru%7Cle9Rmwmpkv",
      "spiritCount": "2 spirits",
      "folkLen": 2
    }, {
      "hideButton": "",
      "roomDesc": "Nikki's Country Inn and Home",
      "roomHost": "",
      "roomLongDesc": "Entrance to the Pub, Tearoom and my Home.A place to relax, \n        and have fun. Please read the rules on the pub home page. This is not a \n        pick up room. ",
      "roomName": "apub@soi",
      "roomOpen": "Open to all",
      "roomURL": "http://ssomf.hyperchat.com/cgi-bin/somf.exe?EParms=ru%7Ckqw29tRmwmpkv%22ru%7Cvk9etqfDwkm%22ru%7Cle9Rmwmpkv",
      "spiritCount": "2 spirits",
      "folkLen": 2
    }, {
      "hideButton": "",
      "roomDesc": "Cross Penthouse",
      "roomHost": "owned \n      by gabriel cross",
      "roomLongDesc": "-The penthouse of Gabriel Cross, Part of the Temptation \n        Island Role play.\u0001",
      "roomName": "crosspen@soi",
      "roomOpen": "Citizens only",
      "roomURL": "http://ssomf.hyperchat.com/cgi-bin/somf.exe?EParms=ru%7Ckqw29tRmwmpkv%22ru%7Cvk9gvkwwtajDwkm%22ru%7Cle9Rmwmpkv",
      "spiritCount": "1 spirit",
      "folkLen": 1
    }, {
      "hideButton": "",
      "roomDesc": "The Dice Room",
      "roomHost": "owned by \n      Athelon",
      "roomLongDesc": "Multiplayer Yahtzee VERSION 2.0 -- let the computer do the \n        math.  (Room is rated PG. This is the original version of the \n      room.)",
      "roomName": "dice@soi",
      "roomOpen": "Citizens only",
      "roomURL": "http://ssomf.hyperchat.com/cgi-bin/somf.exe?EParms=ru%7Ckqw29tRmwmpkv%22ru%7Cvk9`mgaDwkm%22ru%7Cle9Rmwmpkv",
      "spiritCount": "1 spirit",
      "folkLen": 1
    }, {
      "hideButton": "",
      "roomDesc": "veronica's yahtzee",
      "roomHost": "owned \n      by veronica",
      "roomLongDesc": "",
      "roomName": "vgame@soi",
      "roomOpen": "Open to all",
      "roomURL": "http://ssomf.hyperchat.com/cgi-bin/somf.exe?EParms=ru%7Ckqw29tRmwmpkv%22ru%7Cvk9rceiaDwkm%22ru%7Cle9Rmwmpkv",
      "spiritCount": "1 spirit",
      "folkLen": 1
    }, {
      "hideButton": "",
      "roomDesc": "A Wee Pub in the Grotto",
      "roomHost": "owned by Juliana",
      "roomLongDesc": "Welcome to the Wee Pub...come soak in the hot springs...swim \n        in the lagoon...or warm yourself by the lava pit...where a stranger is \n        welcomed...and the Cheeky Little Barwench remembers your \n      drink.",
      "roomName": "apg@soi",
      "roomOpen": "Open to all",
      "roomURL": "http://ssomf.hyperchat.com/cgi-bin/somf.exe?EParms=ru%7Ckqw29tRmwmpkv%22ru%7Cvk9etcDwkm%22ru%7Cle9Rmwmpkv",
      "spiritCount": "1 spirit",
      "folkLen": 1
    }, {
      "hideButton": "",
      "roomDesc": "Imagein",
      "roomHost": "owned by \n      fadedillusion",
      "roomLongDesc": "IMITATION OF LIFE",
      "roomName": "imagein@soi",
      "roomOpen": "Citizens only",
      "roomURL": "http://ssomf.hyperchat.com/cgi-bin/somf.exe?EParms=ru%7Ckqw29tRmwmpkv%22ru%7Cvk9miecamjDwkm%22ru%7Cle9Rmwmpkv",
      "spiritCount": "1 spirit",
      "folkLen": 1
    }, {
      "hideButton": "",
      "roomDesc": "Yahtzee",
      "roomHost": "owned by \n      sumer",
      "roomLongDesc": "A non PG version of the game Yahtzee.",
      "roomName": "yahtzee2@jag",
      "roomOpen": "Citizens only",
      "roomURL": "http://ssomf.hyperchat.com/cgi-bin/somf.exe?EParms=ru%7Ckqw29tRmwmpkv%22ru%7Cvk9}elp~aa6Dwkm%22ru%7Cle9Rmwmpkv",
      "spiritCount": "1 spirit",
      "folkLen": 1
    }];

    data.forEach(function(a, i) {
      a.folkLen = a.folk.length;
      // Make FireFox happy...
      a.roomURL = a.roomURL.replace(/%60/g, "`");

      // Don't actually check the folk, since that is a list
      // of document fragments that are generated.
      // But we will make sure the number of records was found.
      assert.deepEqual(a.folk.length, result[i].folkLen, "Folk length");
      delete a.folk;

      // Just check that the hide button is thee.
      // attributes differ on browsers, so don']t do ane exact compare
      assert.deepEqual(!!data[i].hideButton, !!result[i].hideButton, "Hide button");
      delete data[i].hideButton;
      delete result[i].hideButton;

      assert.deepEqual(data[i], result[i], "Data matches expected result for room " + a.roomName);
    });
  });

  QUnit.test("parseHotList #2 - Verify we have no blank names on the list", function(assert) {
    // There is a bug where if a room appears in two different realms,
    //  the second time the room is listed, the nicknames are empty.

    upgrades.hotlist.upgrade();

    var lists = document.querySelectorAll("table li b");

    forEachNode(lists, function(n, i) {
      var txt = this.textContent;
      assert.notEqual("", txt, "Non-blank test #" + i + " passed");
    });
  });

  QUnit.test("makeRealmChecks", function(assert) {
    var expectedCount = realmList[":list:"].length;

    upgrades.hotlist.upgrade();
    //upgrades.hotlist.internals.makeRealmChecks(realmList);

    var labels = document.querySelectorAll("#realmForm label");
    var cbs = document.querySelectorAll("#realmForm label input");

    assert.strictEqual(labels.length, expectedCount, "Checkmark labels found");
    assert.strictEqual(cbs.length, expectedCount, "Checkmarks found");
  });

  QUnit.test("updateSeenTable", function(assert) {
    upgrades.hotlist.internals.createRealmForm();
    upgrades.hotlist.internals.makeRealmChecks(realmList);

    var data = upgrades.hotlist.internals.parseHotList();
    upgrades.hotlist.internals.updateSeenTable(data);

    var hotListEntries = document.querySelectorAll(".hotTable");

    var expectedCount = realmList[":list:"].length;

    assert.strictEqual(hotListEntries.length, expectedCount, "Correct number of HOT list items created");
  });

  QUnit.test("prepHotRoom == Full Test", function(assert) {
    upgrades.hotlist.upgrade();

    var expectedCount = realmList[":list:"].length;
    var cbs = document.querySelectorAll("#realmForm label input");
    var hotListEntries = document.querySelectorAll(".hotTable");
    var onlineBuddies = document.querySelectorAll("#buddypanel tr")[0].querySelectorAll(".chatPlus_nick");
    var offlineBuddies = document.querySelectorAll("#buddypanel tr")[1].querySelectorAll(".chatPlus_nick");
    var showEmptyButtons = document.querySelectorAll("[data-action='show-empty']");
    var showHiddenButtons = document.querySelectorAll("[data-action='show-hidden']");

    assert.strictEqual(showEmptyButtons.length, expectedCount, "Show Hidden button found");
    assert.strictEqual(showHiddenButtons.length, expectedCount, "Show Empty Buttons found");
    assert.strictEqual(cbs.length, expectedCount, "Checkmarks found");
    assert.strictEqual(hotListEntries.length, expectedCount + 1, "HOT list entries + Buddy View");
    assert.strictEqual(onlineBuddies.length, 1, "Correct number of online buddies");
    assert.strictEqual(offlineBuddies.length, 2, "Correct number of online buddies");
  });

  QUnit.test("prepHotRoom -- Clear Checkmark and Hide Realm", function(assert) {
    var i;
    var cb;
    upgrades.hotlist.upgrade();

    var cbs = document.querySelectorAll("#realmForm label input");
    for (i = 0; i < cbs.length; i++) {
      cb = cbs[i];
      cb.checked = true;
      doClick(cb);
    }

    var hotListEntries = document.querySelectorAll(".hotTable");
    assert.strictEqual(hotListEntries.length, 0 + 1, "Cleared checkboxes - HOT list modified");

    for (i = 0; i < cbs.length; i++) {
      cb = cbs[i];
      cb.checked = false;
      doClick(cb);
    }

    hotListEntries = document.querySelectorAll(".hotTable");
    assert.strictEqual(hotListEntries.length, cbs.length + 1, "Checked boxes - HOT list modified");
  });

  QUnit.test("Testing Realm Add/Remove button", function(assert) {
    var i;
    var cb;
    upgrades.hotlist.upgrade();

	assert.equal(realmList.favs.roomInclude.indexOf("jhnchat@soi"), -1, "jhnchat@soi was not found in `favs`");
	assert.notEqual(realmList.break1.roomInclude.indexOf("sshh@soi"), -1, "sshh@soi was found in `break1`");

	var saveRealmList = JSON.parse(JSON.stringify(realmList));

	var addTable = document.querySelector('table[data-realm-name="all"]');
	var addButton = addTable.querySelector('[data-hotlist-action="add-realm"][data-room="jhnchat@soi"]');

	var removeTable = document.querySelector('table[data-realm-name="break1"]');
	var removeButton = removeTable.querySelector('[data-hotlist-action="remove-realm"][data-room="sshh@soi"]');

	doClick(addButton);
	document.getElementById("realmSelect").value = "favs"
	doClick(document.getElementById("cp_Save Data"));
	assert.notEqual(realmList.favs.roomInclude.indexOf("jhnchat@soi"), -1, "jhnchat@soi was added to `favs`");

	doClick(removeButton);
	doClick(document.getElementById("cp_Save Data"));
	assert.equal(realmList.break1.roomInclude.indexOf("sshh@soi"), -1, "jhnchat@soi was removed from `break`");
  });

  QUnit.test("Test Active Buddy List", function(assert) {
    testNicknamePopup(assert, upgrades.hotlist.upgrade, "Aizen", "aizen@soi");
  });
}());