分类
关于股票基本知识书籍

FinRL 入门指南

Adventure

A simple multiplayer text adventure game inspired by old-fashioned, text-based adventure games.

Instructions:

  1. Build Adventure.sln
  2. Start your local Silo from a command window using command file #1.
  3. The game map initialization script, #2
  4. Start the client #3
  5. Reminisce about the good old days before graphical user interfaces

Overview

The AdventureSetup program reads a game description (“map”) from AdventureConfig.txt.

It sets up a series of “rooms” e.g. forest, beach, caves, a clearing etc . These locations are connected to other rooms to model the places and layout of the game. The sample configuration describes only a handful of locations.

Rooms can contain “things” such as keys, swords etc.

The AdventureClient program sets up your player and provides a simple text based user interface to allow you to play the game.

You can move around rooms and interact with things using a simple command language, saying things such as “go north” or “take brass key”.

Why Orleans?

Orleans allows the game to be described via very simple C# code while allowing it to scale to a massive multiplayer game. For this motivation to be meaningful, the labyrinth of rooms needs to be very large and need to support a large number of simultaneous players. One value of Orleans is that the service can be designed for growth, the overhead of running it at a small scale is not significant, and you can remain confident that it will scale if the need arises.

How is it modeled?

Player and Rooms are modeled as grains. These grains allow us to distribute the game with each grain modelling state and functionality.

Things such as keys are modeled as plain old objects - they are really FinRL 入门指南 just simple immutable data structures that move around rooms and among players; they don’t need to be grains.

Things for you to do if you are so inclined

  1. Make the map much, much, bigger
  2. Make the brass key unlock something
  3. Allow players to message each other
  4. Make eating food and drinking water possible and meaningful

© 2016 Microsoft FinRL 入门指南 Research with help from Jekyll Bootstrap and Twitter Bootstrap

Documentation guidelines

The Orleans documentation is built in Markdown. We use a few simple conventions to ensure a homogeneous style throughout the full set of documents.

These standards are being introduced. If you have issues with these guidelines then raise an issue or a Pull Request. If you find documentation that fails to meet the guidelines, then make a fix and submit a pull request. Also if you are using windows 10 you can go to the store and find free MarkDown editors like this

Structure

Language

The documentation FinRL 入门指南 will follow US-English spelling. Desktop tools like http://markdownpad.com have spell checking features.

Paragraph structure

Each sentence should be written on a single line, and only one sentence per line. This makes merging changes easier and also helps identify verbose language.

Paragraphs in Markdown are just one or more lines of consecutive text followed by one or more blank lines.

Headings

Heading should be used to structure a document. Avoid using other emphasis features like ALLCAPS, Italics or bold to identify a new topic. Using a header is not only more consistent, but also allows linking to the header.

Footers

At the end of a page, it is helpful to link to the next logical page in the documentation. If the page is the last in a sub-section then linking back to the index page is useful.

Styles

Code formatting

Blocks of example code should be formatted with the triple back tick format followed by the FinRL 入门指南 language

Which will render as

Inline code should be marked with a single backtick (`).

This include references to:

  • type names e.g. Task
  • variable names e.g. game
  • namespaces e.g. Orleans.Storage.AzureTableStorage

If showing text that is an output (e.g. text file content or console output) you can either use the triple back tick without specifying a language or you can indent the content. For example:

File names and paths

When referencing a filename, directory/folder or URI then use standard italics to format. This can be done by surrounding the string with either with a single asterisk ( * ) or a single underscore ( _ )

  • OrleansRuntimeInterfaces.dll
  • C:\Binaries
  • ../src/Grain.cs

Tables

Markdown supports tabular data. Tables could be used to structure data so that is is easily consumable for the reader.

Suffix Unit
ms millisecond(s)
s second(s)
m minute(s)

Links

When referencing another concept, the concept should be linked to. Forward and backward references with in a page can be linked to via the header. e.g. link back to Structure Links to other documents can either link to the page, or a sub-section/header within the page. External links should be exposed as a the full link e.g. https://github.com/dotnet/roslyn

Contribution

The Orleans documentation is managed as Markdown files in a Git repository hosted on GitHub in the gh-pages branch. See the GitHub Pages documentation on how to use the gh-pages branch convention for “Project site” documents.

© 2016 Microsoft Research with help from Jekyll Bootstrap and Twitter Bootstrap

Azure Web Sample

Important note: Worker and web role instances are not automatically removed or disabled, even when they go unused for a long time. To avoid a nasty surprise when your Azure bill comes, make sure to delete the instances after you have finished testing the application!

This sample is almost the same as the Hello World sample, except that it hosts the grains in an Azure Worker Role instead of in the client process itself.

While the communication interface and grain implementation are identical, three projects replace the client:

  • OrleansAzureSample, which is the FinRL 入门指南 Azure configuration project.
  • OrleansAzureSilos, the Worker Role integration logic that hosts the Orleans silo in the cloud.
  • FinRL 入门指南
  • WebRole, which provides a simple HTML UI for the Orleans backend.

Run AzureWebSample Locally

The sample is configured to run FinRL 入门指南 FinRL 入门指南 FinRL 入门指南 inside of the Azure Compute Emulator on your desktop by default, so make sure that OrleansAzureSample is set as the Startup Project in this solution and just press F5 to build and run the sample locally.

You do not need to start Visual Studio with administrative privileges to run this sample in the emulator - it is designed to use both IIS Express and Express Emulator, so make sure these options are selected in OrleansAzureSample->Properties->Web. You may also need to select the “Use IIS Express for web sites and projects” in Tools->Options->Projects and Solutions->Web Projects.

Run AzureWebSample in Azure Cloud

To get the sample running in the Azure cloud, open the ServiceConfiguration.Cloud.cscfg file in the OrleansAzureSample project.

Edit the connection strings, replacing MYACCOUNTNAME and MYACCOUNTKEY with data you get from the FinRL 入门指南 Azure portal, logged in to your account. It may be useful to set up a new storage account within your subscription just for samples testing. All four connection strings will look exactly the same.

In the file ServiceDefinition.csdef , the configuration sets up all instances as ExtraSmall to avoid any unpleasant surprises. If you want something else, modify the settings as you see fit.

Then, build the solution with Visual Studio and right-click on the OrleansAzureSample project, selecting ‘Publish.’ Visual Studio will take you through the process of publishing your project to Azure, which FinRL 入门指南 will take a few minutes.

If things work out, you should see something like this:

This means that the FinRL 入门指南 site and its backend are ready. Start a web browser and navigate to the link that VS displayed (or just click on it). You will be greeted by this screen:

Click on “Ask Orleans it’s details” and wait for the response. The first time you interact with the site, it may take a few seconds, since the whole system need to warm up. After that first message, it should go quickly.

© 2016 Microsoft Research FinRL 入门指南 FinRL 入门指南 with help from Jekyll Bootstrap and Twitter Bootstrap

PowerShell Client Module

The Orleans PowerShell Client Module is a set of FinRL 入门指南 PowerShell Cmdlets that wraps GrainClient in a set of convenient commands making possible to interact with not just ManagementGrain but any IGrain just as a regular Orleans application can by using Powershell scripts.

These Cmdlets enable a series of scenarions from start maintenance tasks, tests, monitoring or any other kind of automation by leveraging Powershel scripts.

Here is how to use it:

Installing the module

From Source

You can build from source the OrleansPSUtils project and just import it with:

Althought you can do that, there is a much easier and interesting way for doing that by installing it from PowerShell Galery.

From PowerShell Galery

Powershell modules today are easily shared just as Nuget packages but instead of nuget.org, they are hosted on PowerShell Gallery.

  • To install it on a specific folder just run:
  • To install it on your PowerShell modules path (the recommended way), just run:

Using the module

Regardless of the way you decide to install it, the first thing you need to do in order to actually use it is import the module on the current PowerShell session so the Cmdlets get available by running this:

Note: In case of building from source, you must import it as suggested on the Install section by using the path to the .psd1 instead of using the module name since it will not be on the $env:PSModulePath PowerShell runtime variable. Again, it is highly recommended that you install from PowerShell Gallery instead.

After the module is imported (which means it is loaded on PowerShell session), you will have the following Cmdlets available:

  • Start-GrainClient
  • Stop-GrainClient
  • FinRL 入门指南
  • Get-Grain

Start-GrainClient

This module is a wrapper around GrainClient.Initialize() and its overloads.

Usage:

Start-GrainClient

  • The same as call GrainClient.Initialize() which will look for the known Orleans Client configuration file names

Start-GrainClient [-ConfigFilePath] [[-Timeout] ]

  • Will use the provided file path as in GrainClient.Initialize(filePath)

Start-GrainClient [-ConfigFile] [[-Timeout] ]

  • Use an instance of the System.FileInfo class representing the config file just as GrainClient.Initialize(fileInfo)
  • Use an instance of a Orleans.Runtime.Configuration.ClientConfiguration like in GrainClient.Initialize(config)

Start-GrainClient [-GatewayAddress] [[-OverrideConfig] ] [[-Timeout] ]

  • Takes a Orleans Cluster Gateway Address Endpoint

Note: The Timeout parameter is optional and if it is informed and greater than System.TimeSpan.Zero , it will call Orleans.GrainClient.SetResponseTimeout(Timeout) internally.

Stop-GrainClient

Takes no parameters and when called, if the GrainClient is initialized will gracefuly uninitialize.

Get-Grain

Wrapper around GrainClient.GrainFactory.GetGrain() and its overloads.

The mandatory parameter is -GrainType and the -XXXKey for the current Grain key types supported by Orleans ( string , Guid , long ) and also the -KeyExrension that can be used on Grains with compound keys.

This Cmdlet return a grain reference of the type FinRL 入门指南 passed by as parameter on -GrainType .

Example:

A simple example on calling MyInterfacesNamespace.IMyGrain.SayHeloTo grain method:

Thats it for now. We plan to update this page as we introduce more Cmdlets like use Observers, Streams and other FinRL 入门指南 Orleans core features more natively on Powershell. We hope that this help people as a starting point for automation. As always, this is a work-in-progress and we love contributions! :)

Please note that the intent is not to reimplement the whole client on PowerShell but instead, give IT and DevOps teams a way to interact with the Grains without need to implement a .Net application.

© 2016 Microsoft Research with help from Jekyll Bootstrap and Twitter Bootstrap