text:
import * as app from './app.component'
import * as spreadsheetView from './spreadsheet-view.component'
import * as mapView from './map-view.component'
import * as printView from './print-view.component'
import * as progressBar from './progress-bar.component'
import * as notificationOverlay from './notification-overlay.component'
import * as notification from './notification.component'
import * as geocodeProgress from './geocode-progress.component'

export default {
  app,
  spreadsheetView,
  mapView,
  printView,
  progressBar,
  notificationOverlay,
  notification,
  geocodeProgress
}


text:
These documents are out of date

Please visit the page on the new documentation site for up to date information.

# Location

Your configuration file is called `truffle.js` and is located at the root of your project directory. This file is a Javascript file and can execute any code necessary to create your configuration. It must export an object representing your project configuration like the example below.

### Resolving Naming Conflicts on Windows

When using the Command Prompt on Windows, the default configuration file name can cause a conflict with the `truffle` executable. If this is the case, we recommend using Windows PowerShell or [Git BASH](https://git-for-windows.github.io/) as these shells do not have this conflict. Alternatively, you can rename the configuration file to `truffle-config.js` to avoid this conflict.

# Example

```javascript
module.exports = {
  build: {
    "index.html": "index.html",
    "app.js": [
      "javascripts/app.js"
    ],
    "app.css": [
      "stylesheets/app.css"
    ],
    "images/": "images/"
  },
  rpc: {
    host: "localhost",
    port: 8545
  }
};
```

The default configuration ships with two options specified: `build` and `rpc`. These options as well as non-default options are detailed below.

# Options

### build

Build configuration of your frontend. By default this configuration invokes the default builder, described in the [Build](/getting_started/build) section, but you can use custom build processes as well. See the [advanced build processes](/advanced/build_processes) section for details.

**Example:**

```javascript
build: {
  "index.html": "index.html",
  "app.js": [
    "javascripts/app.js"
  ],
  "app.css": [
    "stylesheets/app.css"
  ],
  "images/": "images/"
}
```

### networks

Specifies which networks are available for deployment during migrations. When compiling and running migrations on a specific network, contract artifacts will be saved and recorded for later use. When your contract abstractions detect that your Ethereum client is connected to a specific network, they'll use the contract artifacts associated that network to simplify app deployment. Networks are identified through Ethereum's `net_version` RPC call.

The `networks` object, shown below, is keyed by a network name and contains a corresponding object that defines the parameters of the network. The `networks` option is not required, but if specified, each network it defines must specify a corresponding `network_id`. If you'd like a specific network configuration to be associated with every network that *doesn't* match any other network in the list, use a `network_id` of "default". However, there should only be one default network. Traditionally, the default network is used during development, where contract artifacts don't matter long-term and the network id continuously changes, for instance, if the TestRPC is restarted.

The network name is used for user interface purposes, such as when running your migrations on a specific network:

```bash
$ truffle migrate --network live
```

You can optionally specify rpc information for each network. Examples below.

**Example:**

```javascript
networks: {
  "live": {
    network_id: 1, // Ethereum public network
    // optional config values
    // host - defaults to "localhost"
    // port - defaults to 8545
    // gas
    // gasPrice
    // from - default address to use for any transaction Truffle makes during migrations
  },
  "morden": {
    network_id: 2,        // Official Ethereum test network
    host: "178.25.19.88", // Random IP for example purposes (do not use)
    port: 80
  },
  "staging": {
    network_id: 1337 // custom private network
    // use default rpc settings
  },
  "development": {
    network_id: "default"
  }
}
```

### rpc

Details about how to connect to your ethereum client. The `host` and `port` keys are required. However, a few other keys are available:

* `host`: Hostname pointing to the network location of your Ethereum client (usually "localhost" for development).
* `port`: Port number where your Etheruem client accepts requests. Default is `8545`.
* `gas`: Gas limit used for deploys. Default is `4712388`.
* `gasPrice`: Gas price used for deploys. Default is `100000000000` (100 Shannon).
* `from`: From address used during migrations. If not specified, defaults to the first available account provided by your Ethereum client.

**Example:**

```javascript
rpc: {
  host: "localhost",
  port: 8545
}
```

### mocha

Configuration options for the [MochaJS](http://mochajs.org/) testing framework. This configuration expects an object as detailed in Mocha's [documentation](https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options).

**Example:**

```javascript
mocha: {
  useColors: true
}
```

redpajama_set_name: RedPajamaGithub


text:
using namespace RetroEnd::Model;
using namespace RetroEnd::View;
using namespace RetroEnd::Controller;

OptionsListView::OptionsListView() : BaseView(), mMoving(0), mLastCheck(0), mStartedMoving(0)
{
	mTitleColor = 0x000000FF;
	mSelectedTitleColor = 0xFFFFFFFF;
	mRowBackgroundColor = 0x00000000;
	mSelectedRowBackgroundColor = 0x1d1d1d99;
	mRowHeight = 50;
	mSelectedIndex = 0;
	Focusable = true;

	firstRow = 0;
	lastRow = 0;
}

void OptionsListView::addRow(string description, BaseView* child, int index)
{
	if(index > -1)
		mItems.insert(mItems.begin() + index, pair<string, BaseView*>(description, child));
	else
		mItems.push_back(pair<string, BaseView*>(description, child));

	//update id pushed before current selected item
	if(mSelectedIndex <= index && mSelectedIndex != 0)
	{
		setSelectedIndex(mSelectedIndex + 1);
	}

	//select the item if size is one
	if(mItems.size() == 1) setSelectedIndex(0);
}

void OptionsListView::removeRow(int index)
{
	mItems.erase(mItems.begin() + index);

	if(mSelectedIndex >= index && mSelectedIndex != 0)
	{
		setSelectedIndex(mSelectedIndex - 1);
	}
}

void OptionsListView::removeAllRows()
{
	mItems.clear();
	mSelectedIndex = 0;
}

void OptionsListView::setAllRows(vector<pair<string, BaseView*>>* values)
{
	mItems.clear();

	for(Uint32 i = 0; values && i < values->size(); i++)
	{
		mItems.push_back(values->at(i));
	}

	setSelectedIndex(0);
}

unsigned int OptionsListView::countRow()
{
	return mItems.size();
}

void OptionsListView::setSelectedIndex(int index)
{
	//unfocus prev selected row
	if(mItems[mSelectedIndex].second && mItems[mSelectedIndex].second->Focusable) mItems[mSelectedIndex].second->Focused = false;

	if(index >= (int) mItems.size())
		mSelectedIndex = 0;
	else if (index < 0)
		mSelectedIndex = mItems.size() - 1;
	else
		mSelectedIndex = index;

	//focus new selected row
	if(mItems[mSelectedIndex].second && mItems[mSelectedIndex].second->Focusable) mItems[mSelectedIndex].second->Focused = true;
}

unsigned int OptionsListView::getSelectedIndex()
{
	return mSelectedIndex;
}

void OptionsListView::draw()
{
	BaseView::draw();

	shared_ptr<Font> font = Font::getDefaultFont();

	Eigen::Vector3f absPos = getAbsolutePosition();

	if(mItems.size() == 0)
	{
		//draw text
		font->drawText("None", Eigen::Vector2f(
			(int)(absPos.x() + ( ( mSize.x() - font->sizeText("None").x()) / 2)),
			(int)(absPos.y() + ( ( mSize.y() - font->sizeText("None").y()) / 2))),
			mTitleColor);
	}
	else
	{
		//compute the number of visible rows
		int visibleRows = (int) mSize.y() / mRowHeight;

		//first and last visible row
		if(lastRow == 0) lastRow = firstRow + visibleRows - 1;

		//if selected row is not complete visible move shown rows
		while(mSelectedIndex > lastRow)  { firstRow++; lastRow ++; }
		while(mSelectedIndex < firstRow) { firstRow--; lastRow --; }

		for(Uint32 i = 0; i < mItems.size(); i++)
		{
			//draw only visible rows (partial rows too -> from firstRow-1 TO lastRow+1)
			if(firstRow != 0 && (int)i < firstRow-1) continue;
			if((int)i > lastRow +1) continue;

			float rowYPosition = (float) i - firstRow;

			//compute the text align offset
			int xTextOffset = (int)absPos.x();

			//draw background
			if(mSelectedIndex == i)
			{
				Uint32 selectedBack = mSelectedRowBackgroundColor;
				//make SelectedTitleColor more transparent if list is not focused
				if (! Focused ) selectedBack = (mSelectedRowBackgroundColor>>8<<8) | 0x00000055;

				RenderController::drawRect( (int)absPos.x(), (int)(absPos.y() + rowYPosition*mRowHeight), (int)mSize.x(), mRowHeight, selectedBack );
			}
			else
			{
				RenderController::drawRect( (int)absPos.x(), (int)(absPos.y() + rowYPosition*mRowHeight), (int)mSize.x(), mRowHeight, mRowBackgroundColor );
			}

			//draw text
			font->drawText(mItems.at(i).first, Eigen::Vector2f(
				xTextOffset,
				absPos.y() + (rowYPosition)*mRowHeight + (mRowHeight - font->sizeText(mItems.at(i).first).y())/2),
				i == mSelectedIndex? mSelectedTitleColor : mTitleColor, (int)mSize.x());

			//draw component
			BaseView* control = mItems.at(i).second;
			if(control)
			{
				control->setPosition(absPos.x() + mSize.x() - control->getSize().x(), (absPos.y() + rowYPosition*mRowHeight));
				control->draw();
			}
		}
	}
}

void OptionsListView::startMoving(int direction)
{
	mLastCheck = clock();
	mStartedMoving = clock();
	mMoving = direction;
}

void OptionsListView::stopMoving()
{
	mMoving = 0;
	clock_t now = clock();
	if(mStartedMoving && now - mStartedMoving > MOVE_DELAY)
	{
		onSelectedItemChanged(mSelectedIndex);
		mStartedMoving = 0;
	}
}

bool OptionsListView::input(Input input)
{
	if(Focused && input.Semantic == InputSemantic::DOWN)
	{
		if( input.Value == SDL_PRESSED )
		{
			//down
			setSelectedIndex( getSelectedIndex() + 1 );
			startMoving(1);
		}
		else
		{
			//up
			stopMoving();
		}
		return true;
	}

	if(Focused && input.Semantic == InputSemantic::UP)
	{
		if( input.Value == SDL_PRESSED )
		{
			//down
			setSelectedIndex( getSelectedIndex() - 1 );
			startMoving(-1);
		}
		else
		{
			//up
			stopMoving();
		}
		return true;
	}

	if(mMoving) return false;

	//send input to control of selected row (is any)
	if(mItems.at(mSelectedIndex).second && mItems.at(mSelectedIndex).second->input(input))
	{
		return true;
	}

	//only if input control of selected row ignore button press we send the event
	if(Focused && input.Semantic == InputSemantic::BUTTON_A && input.Value != SDL_RELEASED )
	{
		onItemPressed(mSelectedIndex);
		return true;
	}

	return false;
}

void OptionsListView::update(unsigned int deltaTime)
{
	//call father method
	BaseView::update(deltaTime);

	//check if we need to move the list for long pressure
	clock_t now = clock();
	if(Focused)
	{
		if(mMoving != 0 && now - mLastCheck > MOVE_DELAY)
		{
			setSelectedIndex( getSelectedIndex() + mMoving);
			mLastCheck = now;
			onFastMoved(mSelectedIndex);
		}
	}
	else
	{
		//if focus change while we are moving stop moving
		if(mMoving) stopMoving();
	}
}


text:
/**
  @file
  @author Stefan Frings
*/

#ifndef HTTPSESSIONSTORE_H
#define HTTPSESSIONSTORE_H

#include <QObject>
#include <QMap>
#include <QTimer>
#include <QMutex>
#include "httpglobal.h"
#include "httpsession.h"
#include "httpresponse.h"
#include "httprequest.h"

/**
  Stores HTTP sessions and deletes them when they have expired.
  The following configuration settings are required in the config file:

  expirationTime=3600000
  cookieName=sessionid

  The following additional configurations settings are optionally:

  cookiePath=/
  cookieComment=Session ID
  ;cookieDomain=stefanfrings.de

*/

class DECLSPEC HttpSessionStore : public QObject {
    Q_OBJECT
    Q_DISABLE_COPY(HttpSessionStore)
public:

    /** Constructor. */
    HttpSessionStore(QSettings* settings, QObject* parent=NULL);

    /** Destructor */
    virtual ~HttpSessionStore();

    /**
       Get the ID of the current HTTP session, if it is valid.
       This method is thread safe.
       @warning Sessions may expire at any time, so subsequent calls of
       getSession() might return a new session with a different ID.
       @param request Used to get the session cookie
       @param response Used to get and set the new session cookie
       @return Empty string, if there is no valid session.
    */
    QByteArray getSessionId(HttpRequest& request, HttpResponse& response);

    /**
       Get the session of a HTTP request, eventually create a new one.
       This method is thread safe. New sessions can only be created before
       the first byte has been written to the HTTP response.
       @param request Used to get the session cookie
       @param response Used to get and set the new session cookie
       @param allowCreate can be set to false, to disable the automatic creation of a new session.
       @return If autoCreate is disabled, the function returns a null session if there is no session.
       @see HttpSession::isNull()
    */
    HttpSession getSession(HttpRequest& request, HttpResponse& response, bool allowCreate=true);

    /**
       Get a HTTP session by it's ID number.
       This method is thread safe.
       @return If there is no such session, the function returns a null session.
       @param id ID number of the session
       @see HttpSession::isNull()
    */
    HttpSession getSession(const QByteArray id);

    /** Delete a session */
    void removeSession(HttpSession session);

private:

    /** Configuration settings */
    QSettings* settings;

    /** Storage for the sessions */
    QMap<QByteArray,HttpSession> sessions;

    /** Timer to remove expired sessions */
    QTimer cleanupTimer;

    /** Name of the session cookie */
    QByteArray cookieName;

    /** Time when sessions expire (in ms)*/
    int expirationTime;

    /** Used to synchronize threads */
    QMutex mutex;

private slots:

    /** Called every minute to cleanup expired sessions. */
    void timerEvent();
};

#endif // HTTPSESSIONSTORE_H


text:
require 'spec_helper'

describe Puppet::Type.type(:dsc_xsppasswordchangesettings) do

  let :dsc_xsppasswordchangesettings do
    Puppet::Type.type(:dsc_xsppasswordchangesettings).new(
      :name     => 'foo',
      :dsc_mailaddress => 'foo',
    )
  end

  it 'should allow all properties to be specified' do
    expect { Puppet::Type.type(:dsc_xsppasswordchangesettings).new(
      :name     => 'foo',
      :dsc_mailaddress => 'foo',
      :dsc_daysbeforeexpiry => 32,
      :dsc_passwordchangewaittimeseconds => 32,
      :dsc_numberofretries => 32,
      :dsc_installaccount => {"user"=>"user", "password"=>"password"},
    )}.to_not raise_error
  end

  it "should stringify normally" do
    expect(dsc_xsppasswordchangesettings.to_s).to eq("Dsc_xsppasswordchangesettings[foo]")
  end

  it 'should require that dsc_mailaddress is specified' do
    #dsc_xsppasswordchangesettings[:dsc_mailaddress]
    expect { Puppet::Type.type(:dsc_xsppasswordchangesettings).new(
      :name     => 'foo',
    )}.to raise_error(Puppet::Error, /dsc_mailaddress is a required attribute/)
  end

  it 'should not accept array for dsc_mailaddress' do
    expect{dsc_xsppasswordchangesettings[:dsc_mailaddress] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError)
  end

  it 'should not accept boolean for dsc_mailaddress' do
    expect{dsc_xsppasswordchangesettings[:dsc_mailaddress] = true}.to raise_error(Puppet::ResourceError)
  end

  it 'should not accept int for dsc_mailaddress' do
    expect{dsc_xsppasswordchangesettings[:dsc_mailaddress] = -16}.to raise_error(Puppet::ResourceError)
  end

  it 'should not accept uint for dsc_mailaddress' do
    expect{dsc_xsppasswordchangesettings[:dsc_mailaddress] = 16}.to raise_error(Puppet::ResourceError)
  end

  it 'should not accept array for dsc_daysbeforeexpiry' do
    expect{dsc_xsppasswordchangesettings[:dsc_daysbeforeexpiry] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError)
  end

  it 'should not accept boolean for dsc_daysbeforeexpiry' do
    expect{dsc_xsppasswordchangesettings[:dsc_daysbeforeexpiry] = true}.to raise_error(Puppet::ResourceError)
  end

  it 'should accept uint for dsc_daysbeforeexpiry' do
    dsc_xsppasswordchangesettings[:dsc_daysbeforeexpiry] = 32
    expect(dsc_xsppasswordchangesettings[:dsc_daysbeforeexpiry]).to eq(32)
  end

  it 'should not accept signed (negative) value for dsc_daysbeforeexpiry' do
    value = -32
    expect(value).to be < 0
    expect{dsc_xsppasswordchangesettings[:dsc_daysbeforeexpiry] = value}.to raise_error(Puppet::ResourceError)
  end

  it 'should accept string-like uint for dsc_daysbeforeexpiry' do
    dsc_xsppasswordchangesettings[:dsc_daysbeforeexpiry] = '16'
    expect(dsc_xsppasswordchangesettings[:dsc_daysbeforeexpiry]).to eq(16)
  end

  it 'should accept string-like uint for dsc_daysbeforeexpiry' do
    dsc_xsppasswordchangesettings[:dsc_daysbeforeexpiry] = '32'
    expect(dsc_xsppasswordchangesettings[:dsc_daysbeforeexpiry]).to eq(32)
  end

  it 'should accept string-like uint for dsc_daysbeforeexpiry' do
    dsc_xsppasswordchangesettings[:dsc_daysbeforeexpiry] = '64'
    expect(dsc_xsppasswordchangesettings[:dsc_daysbeforeexpiry]).to eq(64)
  end

  it 'should not accept array for dsc_passwordchangewaittimeseconds' do
    expect{dsc_xsppasswordchangesettings[:dsc_passwordchangewaittimeseconds] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError)
  end

  it 'should not accept boolean for dsc_passwordchangewaittimeseconds' do
    expect{dsc_xsppasswordchangesettings[:dsc_passwordchangewaittimeseconds] = true}.to raise_error(Puppet::ResourceError)
  end

  it 'should accept uint for dsc_passwordchangewaittimeseconds' do
    dsc_xsppasswordchangesettings[:dsc_passwordchangewaittimeseconds] = 32
    expect(dsc_xsppasswordchangesettings[:dsc_passwordchangewaittimeseconds]).to eq(32)
  end

  it 'should not accept signed (negative) value for dsc_passwordchangewaittimeseconds' do
    value = -32
    expect(value).to be < 0
    expect{dsc_xsppasswordchangesettings[:dsc_passwordchangewaittimeseconds] = value}.to raise_error(Puppet::ResourceError)
  end

  it 'should accept string-like uint for dsc_passwordchangewaittimeseconds' do
    dsc_xsppasswordchangesettings[:dsc_passwordchangewaittimeseconds] = '16'
    expect(dsc_xsppasswordchangesettings[:dsc_passwordchangewaittimeseconds]).to eq(16)
  end

  it 'should accept string-like uint for dsc_passwordchangewaittimeseconds' do
    dsc_xsppasswordchangesettings[:dsc_passwordchangewaittimeseconds] = '32'
    expect(dsc_xsppasswordchangesettings[:dsc_passwordchangewaittimeseconds]).to eq(32)
  end

  it 'should accept string-like uint for dsc_passwordchangewaittimeseconds' do
    dsc_xsppasswordchangesettings[:dsc_passwordchangewaittimeseconds] = '64'
    expect(dsc_xsppasswordchangesettings[:dsc_passwordchangewaittimeseconds]).to eq(64)
  end

  it 'should not accept array for dsc_numberofretries' do
    expect{dsc_xsppasswordchangesettings[:dsc_numberofretries] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError)
  end

  it 'should not accept boolean for dsc_numberofretries' do
    expect{dsc_xsppasswordchangesettings[:dsc_numberofretries] = true}.to raise_error(Puppet::ResourceError)
  end

  it 'should accept uint for dsc_numberofretries' do
    dsc_xsppasswordchangesettings[:dsc_numberofretries] = 32
    expect(dsc_xsppasswordchangesettings[:dsc_numberofretries]).to eq(32)
  end

  it 'should not accept signed (negative) value for dsc_numberofretries' do
    value = -32
    expect(value).to be < 0
    expect{dsc_xsppasswordchangesettings[:dsc_numberofretries] = value}.to raise_error(Puppet::ResourceError)
  end

  it 'should accept string-like uint for dsc_numberofretries' do
    dsc_xsppasswordchangesettings[:dsc_numberofretries] = '16'
    expect(dsc_xsppasswordchangesettings[:dsc_numberofretries]).to eq(16)
  end

  it 'should accept string-like uint for dsc_numberofretries' do
    dsc_xsppasswordchangesettings[:dsc_numberofretries] = '32'
    expect(dsc_xsppasswordchangesettings[:dsc_numberofretries]).to eq(32)
  end

  it 'should accept string-like uint for dsc_numberofretries' do
    dsc_xsppasswordchangesettings[:dsc_numberofretries] = '64'
    expect(dsc_xsppasswordchangesettings[:dsc_numberofretries]).to eq(64)
  end

  it "should not accept empty password for dsc_installaccount" do
    expect{dsc_xsppasswordchangesettings[:dsc_installaccount] = {"user"=>"user", "password"=>""}}.to raise_error(Puppet::ResourceError)
  end

  it 'should not accept array for dsc_installaccount' do
    expect{dsc_xsppasswordchangesettings[:dsc_installaccount] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError)
  end

  it 'should not accept boolean for dsc_installaccount' do
    expect{dsc_xsppasswordchangesettings[:dsc_installaccount] = true}.to raise_error(Puppet::ResourceError)
  end

  it 'should not accept int for dsc_installaccount' do
    expect{dsc_xsppasswordchangesettings[:dsc_installaccount] = -16}.to raise_error(Puppet::ResourceError)
  end

  it 'should not accept uint for dsc_installaccount' do
    expect{dsc_xsppasswordchangesettings[:dsc_installaccount] = 16}.to raise_error(Puppet::ResourceError)
  end

  # Configuration PROVIDER TESTS

  describe "powershell provider tests" do

    it "should successfully instanciate the provider" do
      described_class.provider(:powershell).new(dsc_xsppasswordchangesettings)
    end

    before(:each) do
      @provider = described_class.provider(:powershell).new(dsc_xsppasswordchangesettings)
    end

    describe "when dscmeta_module_name existing/is defined " do

      it "should compute powershell dsc test script with Invoke-DscResource" do
        expect(@provider.ps_script_content('test')).to match(/Invoke-DscResource/)
      end

      it "should compute powershell dsc test script with method Test" do
        expect(@provider.ps_script_content('test')).to match(/Method\s+=\s*'test'/)
      end

      it "should compute powershell dsc set script with Invoke-DscResource" do
        expect(@provider.ps_script_content('set')).to match(/Invoke-DscResource/)
      end

      it "should compute powershell dsc test script with method Set" do
        expect(@provider.ps_script_content('set')).to match(/Method\s+=\s*'set'/)
      end

    end

    describe "when dsc_resource has credentials" do

      it "should convert credential hash to a pscredential object" do
        expect(@provider.ps_script_content('test')).to match(/| new-pscredential'/)
      end

    end

  end
end


text:
FCKLang.TableSort = "Sort Table..." ;
FCKLang.DlgTableSortAlphanumeric = "Alphanumeric" ;
FCKLang.DlgTableSortBody = "Sort the BODY of the table" ;
FCKLang.DlgTableSortBy = "Sort by" ;
FCKLang.DlgTableSortDate = "Date" ;
FCKLang.DlgTableSortFoot = "Sort the FOOT of the table" ;
FCKLang.DlgTableSortHead = "Sort the HEAD of the table" ;
FCKLang.DlgTableSortNumeric = "Numeric" ;
FCKLang.DlgTableSortOrder = "Sort order" ;
FCKLang.DlgTableSortTitle = "Sort Table" ;
FCKLang.DlgTableSortType = "Sort type" ;
FCKLang.DlgTableSortAsc = "Ascending" ;
FCKLang.DlgTableSortDesc = "Descending" ;


text:
package org.fandev.lang.fan.psi.stubs;

import org.fandev.lang.fan.psi.api.statements.typeDefs.FanReferenceList;
import com.intellij.psi.stubs.StubElement;

/**
 * Date: Mar 18, 2009
 * Time: 10:56:18 PM
 *
 * @author Dror Bereznitsky
 */
public interface FanReferenceListStub extends StubElement<FanReferenceList>
{
	String[] getBaseClasses();
}


text:
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [MagicalRecord setupCoreDataStack];

    return YES;
}

@end


text:
package main

import (
	"context"
	"os"
	"path/filepath"
	"time"

	"golang.org/x/crypto/acme"
)

var (
	cmdWho = &command{
		run:       runWhoami,
		UsageLine: "whoami [-c config]",
		Short:     "display info about the key holder",
		Long: `
Whoami makes a request to the ACME server signed with a private key
found in the config file and displays the formatted results.

It is a simple way to verify the validity of an account key.

Default location of the config dir is {{.ConfigDir}}.
		`,
	}
)

func runWhoami([]string) {
	uc, err := readConfig()
	if err != nil {
		fatalf("read config: %v", err)
	}
	if uc.key == nil {
		fatalf("no key found for %s", uc.URI)
	}

	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
	defer cancel()

	client := acme.Client{Key: uc.key}
	a, err := client.GetReg(ctx, uc.URI)
	if err != nil {
		fatalf(err.Error())
	}
	printAccount(os.Stdout, a, filepath.Join(configDir, accountKey))
}


text:
package bitseq

import (
	"fmt"
	"sync"

	"github.com/docker/libnetwork/datastore"
	"github.com/docker/libnetwork/netutils"
)

// Block Sequence constants
// If needed we can think of making these configurable
const (
	blockLen      = 32
	blockBytes    = blockLen / 8
	blockMAX      = 1<<blockLen - 1
	blockFirstBit = 1 << (blockLen - 1)
)

// Handle contains the sequece representing the bitmask and its identifier
type Handle struct {
	bits       uint32
	unselected uint32
	head       *Sequence
	app        string
	id         string
	dbIndex    uint64
	dbExists   bool
	store      datastore.DataStore
	sync.Mutex
}

// NewHandle returns a thread-safe instance of the bitmask handler
func NewHandle(app string, ds datastore.DataStore, id string, numElements uint32) (*Handle, error) {
	h := &Handle{
		app:        app,
		id:         id,
		store:      ds,
		bits:       numElements,
		unselected: numElements,
		head: &Sequence{
			Block: 0x0,
			Count: getNumBlocks(numElements),
		},
	}

	if h.store == nil {
		return h, nil
	}

	// Register for status changes
	h.watchForChanges()

	// Get the initial status from the ds if present.
	err := h.store.GetObject(datastore.Key(h.Key()...), h)
	if err != datastore.ErrKeyNotFound {
		return nil, err
	}

	return h, err
}

// Sequence reresents a recurring sequence of 32 bits long bitmasks
type Sequence struct {
	Block uint32    // block representing 4 byte long allocation bitmask
	Count uint32    // number of consecutive blocks
	Next  *Sequence // next sequence
}

// NewSequence returns a sequence initialized to represent a bitmaks of numElements bits
func NewSequence(numElements uint32) *Sequence {
	return &Sequence{Block: 0x0, Count: getNumBlocks(numElements), Next: nil}
}

// String returns a string representation of the block sequence starting from this block
func (s *Sequence) String() string {
	var nextBlock string
	if s.Next == nil {
		nextBlock = "end"
	} else {
		nextBlock = s.Next.String()
	}
	return fmt.Sprintf("(0x%x, %d)->%s", s.Block, s.Count, nextBlock)
}

// GetAvailableBit returns the position of the first unset bit in the bitmask represented by this sequence
func (s *Sequence) GetAvailableBit() (bytePos, bitPos int) {
	if s.Block == blockMAX || s.Count == 0 {
		return -1, -1
	}
	bits := 0
	bitSel := uint32(blockFirstBit)
	for bitSel > 0 && s.Block&bitSel != 0 {
		bitSel >>= 1
		bits++
	}
	return bits / 8, bits % 8
}

// GetCopy returns a copy of the linked list rooted at this node
func (s *Sequence) GetCopy() *Sequence {
	n := &Sequence{Block: s.Block, Count: s.Count}
	pn := n
	ps := s.Next
	for ps != nil {
		pn.Next = &Sequence{Block: ps.Block, Count: ps.Count}
		pn = pn.Next
		ps = ps.Next
	}
	return n
}

// Equal checks if this sequence is equal to the passed one
func (s *Sequence) Equal(o *Sequence) bool {
	this := s
	other := o
	for this != nil {
		if other == nil {
			return false
		}
		if this.Block != other.Block || this.Count != other.Count {
			return false
		}
		this = this.Next
		other = other.Next
	}
	// Check if other is longer than this
	if other != nil {
		return false
	}
	return true
}

// ToByteArray converts the sequence into a byte array
// TODO (aboch): manage network/host order stuff
func (s *Sequence) ToByteArray() ([]byte, error) {
	var bb []byte

	p := s
	for p != nil {
		bb = append(bb, netutils.U32ToA(p.Block)...)
		bb = append(bb, netutils.U32ToA(p.Count)...)
		p = p.Next
	}

	return bb, nil
}

// FromByteArray construct the sequence from the byte array
// TODO (aboch): manage network/host order stuff
func (s *Sequence) FromByteArray(data []byte) error {
	l := len(data)
	if l%8 != 0 {
		return fmt.Errorf("cannot deserialize byte sequence of lenght %d (%v)", l, data)
	}

	p := s
	i := 0
	for {
		p.Block = netutils.ATo32(data[i : i+4])
		p.Count = netutils.ATo32(data[i+4 : i+8])
		i += 8
		if i == l {
			break
		}
		p.Next = &Sequence{}
		p = p.Next
	}

	return nil
}

// GetFirstAvailable returns the byte and bit position of the first unset bit
func (h *Handle) GetFirstAvailable() (int, int, error) {
	h.Lock()
	defer h.Unlock()
	return GetFirstAvailable(h.head)
}

// CheckIfAvailable checks if the bit correspondent to the specified ordinal is unset
// If the ordinal is beyond the Sequence limits, a negative response is returned
func (h *Handle) CheckIfAvailable(ordinal int) (int, int, error) {
	h.Lock()
	defer h.Unlock()
	return CheckIfAvailable(h.head, ordinal)
}

// PushReservation pushes the bit reservation inside the bitmask.
func (h *Handle) PushReservation(bytePos, bitPos int, release bool) error {
	// Create a copy of the current handler
	h.Lock()
	nh := &Handle{
		app:      h.app,
		id:       h.id,
		store:    h.store,
		dbIndex:  h.dbIndex,
		head:     h.head.GetCopy(),
		dbExists: h.dbExists,
	}
	h.Unlock()

	nh.head = PushReservation(bytePos, bitPos, nh.head, release)

	err := nh.writeToStore()
	if err == nil {
		// Commit went through, save locally
		h.Lock()
		h.head = nh.head
		if release {
			h.unselected++
		} else {
			h.unselected--
		}
		// Can't use SetIndex() since we're locked.
		h.dbIndex = nh.Index()
		h.dbExists = true
		h.Unlock()
	}

	return err
}

// Destroy removes from the datastore the data belonging to this handle
func (h *Handle) Destroy() {
	h.deleteFromStore()
}

// ToByteArray converts this handle's data into a byte array
func (h *Handle) ToByteArray() ([]byte, error) {
	ba := make([]byte, 8)

	h.Lock()
	defer h.Unlock()
	copy(ba[0:4], netutils.U32ToA(h.bits))
	copy(ba[4:8], netutils.U32ToA(h.unselected))
	bm, err := h.head.ToByteArray()
	if err != nil {
		return nil, fmt.Errorf("failed to serialize head: %s", err.Error())
	}
	ba = append(ba, bm...)

	return ba, nil
}

// FromByteArray reads his handle's data from a byte array
func (h *Handle) FromByteArray(ba []byte) error {
	if ba == nil {
		return fmt.Errorf("nil byte array")
	}

	nh := &Sequence{}
	err := nh.FromByteArray(ba[8:])
	if err != nil {
		return fmt.Errorf("failed to deserialize head: %s", err.Error())
	}

	h.Lock()
	h.head = nh
	h.bits = netutils.ATo32(ba[0:4])
	h.unselected = netutils.ATo32(ba[4:8])
	h.Unlock()

	return nil
}

// Bits returns the length of the bit sequence
func (h *Handle) Bits() uint32 {
	return h.bits
}

// Unselected returns the number of bits which are not selected
func (h *Handle) Unselected() uint32 {
	h.Lock()
	defer h.Unlock()
	return h.unselected
}

// GetFirstAvailable looks for the first unset bit in passed mask
func GetFirstAvailable(head *Sequence) (int, int, error) {
	byteIndex := 0
	current := head
	for current != nil {
		if current.Block != blockMAX {
			bytePos, bitPos := current.GetAvailableBit()
			return byteIndex + bytePos, bitPos, nil
		}
		byteIndex += int(current.Count * blockBytes)
		current = current.Next
	}
	return -1, -1, fmt.Errorf("no bit available")
}

// CheckIfAvailable checks if the bit correspondent to the specified ordinal is unset
// If the ordinal is beyond the Sequence limits, a negative response is returned
func CheckIfAvailable(head *Sequence, ordinal int) (int, int, error) {
	bytePos := ordinal / 8
	bitPos := ordinal % 8

	// Find the Sequence containing this byte
	current, _, _, inBlockBytePos := findSequence(head, bytePos)

	if current != nil {
		// Check whether the bit corresponding to the ordinal address is unset
		bitSel := uint32(blockFirstBit >> uint(inBlockBytePos*8+bitPos))
		if current.Block&bitSel == 0 {
			return bytePos, bitPos, nil
		}
	}

	return -1, -1, fmt.Errorf("requested bit is not available")
}

// Given the byte position and the sequences list head, return the pointer to the
// sequence containing the byte (current), the pointer to the previous sequence,
// the number of blocks preceding the block containing the byte inside the current sequence.
// If bytePos is outside of the list, function will return (nil, nil, 0, -1)
func findSequence(head *Sequence, bytePos int) (*Sequence, *Sequence, uint32, int) {
	// Find the Sequence containing this byte
	previous := head
	current := head
	n := bytePos
	for current.Next != nil && n >= int(current.Count*blockBytes) { // Nil check for less than 32 addresses masks
		n -= int(current.Count * blockBytes)
		previous = current
		current = current.Next
	}

	// If byte is outside of the list, let caller know
	if n >= int(current.Count*blockBytes) {
		return nil, nil, 0, -1
	}

	// Find the byte position inside the block and the number of blocks
	// preceding the block containing the byte inside this sequence
	precBlocks := uint32(n / blockBytes)
	inBlockBytePos := bytePos % blockBytes

	return current, previous, precBlocks, inBlockBytePos
}

// PushReservation pushes the bit reservation inside the bitmask.
// Given byte and bit positions, identify the sequence (current) which holds the block containing the affected bit.
// Create a new block with the modified bit according to the operation (allocate/release).
// Create a new Sequence containing the new Block and insert it in the proper position.
// Remove current sequence if empty.
// Check if new Sequence can be merged with neighbour (previous/Next) sequences.
//
//
// Identify "current" Sequence containing block:
//                                      [prev seq] [current seq] [Next seq]
//
// Based on block position, resulting list of sequences can be any of three forms:
//
//        Block position                        Resulting list of sequences
// A) Block is first in current:         [prev seq] [new] [modified current seq] [Next seq]
// B) Block is last in current:          [prev seq] [modified current seq] [new] [Next seq]
// C) Block is in the middle of current: [prev seq] [curr pre] [new] [curr post] [Next seq]
func PushReservation(bytePos, bitPos int, head *Sequence, release bool) *Sequence {
	// Store list's head
	newHead := head

	// Find the Sequence containing this byte
	current, previous, precBlocks, inBlockBytePos := findSequence(head, bytePos)
	if current == nil {
		return newHead
	}

	// Construct updated block
	bitSel := uint32(blockFirstBit >> uint(inBlockBytePos*8+bitPos))
	newBlock := current.Block
	if release {
		newBlock &^= bitSel
	} else {
		newBlock |= bitSel
	}

	// Quit if it was a redundant request
	if current.Block == newBlock {
		return newHead
	}

	// Current Sequence inevitably looses one block, upadate Count
	current.Count--

	// Create new sequence
	newSequence := &Sequence{Block: newBlock, Count: 1}

	// Insert the new sequence in the list based on block position
	if precBlocks == 0 { // First in sequence (A)
		newSequence.Next = current
		if current == head {
			newHead = newSequence
			previous = newHead
		} else {
			previous.Next = newSequence
		}
		removeCurrentIfEmpty(&newHead, newSequence, current)
		mergeSequences(previous)
	} else if precBlocks == current.Count-2 { // Last in sequence (B)
		newSequence.Next = current.Next
		current.Next = newSequence
		mergeSequences(current)
	} else { // In between the sequence (C)
		currPre := &Sequence{Block: current.Block, Count: precBlocks, Next: newSequence}
		currPost := current
		currPost.Count -= precBlocks
		newSequence.Next = currPost
		if currPost == head {
			newHead = currPre
		} else {
			previous.Next = currPre
		}
		// No merging or empty current possible here
	}

	return newHead
}

// Removes the current sequence from the list if empty, adjusting the head pointer if needed
func removeCurrentIfEmpty(head **Sequence, previous, current *Sequence) {
	if current.Count == 0 {
		if current == *head {
			*head = current.Next
		} else {
			previous.Next = current.Next
			current = current.Next
		}
	}
}

// Given a pointer to a Sequence, it checks if it can be merged with any following sequences
// It stops when no more merging is possible.
// TODO: Optimization: only attempt merge from start to end sequence, no need to scan till the end of the list
func mergeSequences(seq *Sequence) {
	if seq != nil {
		// Merge all what possible from seq
		for seq.Next != nil && seq.Block == seq.Next.Block {
			seq.Count += seq.Next.Count
			seq.Next = seq.Next.Next
		}
		// Move to Next
		mergeSequences(seq.Next)
	}
}

func getNumBlocks(numBits uint32) uint32 {
	numBlocks := numBits / blockLen
	if numBits%blockLen != 0 {
		numBlocks++
	}
	return numBlocks
}


text:
@class NSMutableArray;

@interface WCDeviceWifiStateLogic : MMObject <PBMessageObserverDelegate>
{
    NSMutableArray *m_devices;
    id <WCDeviceWifiStateLogicDelegate> _delegate;
}

@property(nonatomic) __weak id <WCDeviceWifiStateLogicDelegate> delegate; // @synthesize delegate=_delegate;
- (void).cxx_destruct;
- (void)MessageReturn:(id)arg1 Event:(unsigned int)arg2;
- (id)getSubscribingWithDeviceType:(id)arg1 andDieviceID:(id)arg2;
- (_Bool)isDeviceSubscribing:(id)arg1;
- (void)handleWCDeviceWifiStateSubscribeResopnse:(id)arg1;
- (void)handleWifiStateUpdateMsg:(id)arg1;
- (void)sendWCDeviceWifiStatusSubscribeForDeviceID:(id)arg1 AndDeviceType:(id)arg2 AndReqType:(unsigned int)arg3;
- (int)getWCDeviceWifiState:(id)arg1;
- (void)sendWCDeviceWifiStateSubscribe:(id)arg1 ReqType:(unsigned int)arg2;
- (void)dealloc;
- (id)init;

@end


text:
package io.datakernel.common.tuple;

import io.datakernel.common.parse.ParseException;

@FunctionalInterface
public interface TupleParser0<R> {
	R create() throws ParseException;
}


text:
cd $HOME

if [ -n "$ASSIGNMENTS_REPO_URL" ]; then
    if [ ! -d "$ASSIGNMENTS_REPO_NAME" ]; then
        git clone $ASSIGNMENTS_REPO_CLONE_URL
        cd $ASSIGNMENTS_REPO_NAME
        git remote rm origin
        git remote add origin $ASSIGNMENTS_REPO_URL
        pip install --user -r requirements.txt
        cd $HOME
    fi
fi

cd "$NOTEBOOK_URL_PREFIX"
/opt/conda/bin/nbgrader formgrade $@


text:
Ti=Confidentiality

Engage.Ti=Engagements

Include.Ti=Specifically Included Information

Exclude.Ti=Specifically Excluded Information

Except.Ti=Exceptions to the {_Confidentiality_Engagements}

Copy.Ti=Copies of {_Confidential_Information}

Life.Ti=Life of the {_Confidentiality_Engagements}


text:
        {% if title %}
            <title>{{ title }} - Guess That Song</title>
        {% else %}
            <title>Guess That Song</title>
        {% endif %}

    Correct: {{correctcounter}}

    Wrong: {{wrongcounter}}

    Total: {{correctcounter + wrongcounter}}

    <form action='/clearscore'>
        <input type='submit' value='Reset Score'/>
    </form>

        Guess That Song:
        {% block content %}{% endblock %}


text:
<?php

	function autoload($className)
	{

       		if ( class_exists($className) )
       			return true;

       		$fileName = str_replace('\\', DS, $className).".php";
			$combined = BASE_PATH . DS . $fileName;

			if ( file_exists($combined) )
			{

				include_once ($combined);

				return true;

			}

		throw new Exception("{$class} not found");

	}

	spl_autoload_register('autoload');


text:
////////////////////////////////////////////////////////////////////////////////
// PromiseException

var ss_PromiseException = function#? DEBUG PromiseException##(args, message, innerException) {
	ss_Exception.call(this, message || (args.length && args[0] ? args[0].toString() : 'An error occurred'), innerException);
	this.arguments = ss.arrayClone(args);
};
ss_PromiseException.prototype = {
	get_arguments: function#? DEBUG PromiseException$get_arguments##() {
		return this._arguments;
	}
};

ss_PromiseException.__typeName = 'ss.PromiseException';
ss.PromiseException = ss_PromiseException;
ss.initClass(ss_PromiseException, ss_Exception);


text:
using UnityEngine;

/// @cond
namespace Gvr.Internal {
  /// Factory that provides a concrete implementation of IControllerProvider for the
  /// current platform.
  static class ControllerProviderFactory {
    /// Provides a concrete implementation of IControllerProvider appropriate for the current
    /// platform. This method never returns null. In the worst case, it might return a dummy
    /// provider if the platform is not supported.
    static internal IControllerProvider CreateControllerProvider(GvrController owner) {
#if UNITY_EDITOR || UNITY_STANDALONE
      // Use the Controller Emulator.
      return new EmulatorControllerProvider(owner.emulatorConnectionMode);
#elif UNITY_ANDROID
      // Use the GVR C API.
      return new AndroidNativeControllerProvider();
#else
      // Platform not supported.
      Debug.LogWarning("No controller support on this platform.");
      return new DummyControllerProvider();
#endif  // UNITY_EDITOR || UNITY_STANDALONE
    }
  }
}
/// @endcond

#endif  // UNITY_HAS_GOOGLEVR && (UNITY_ANDROID || UNITY_EDITOR)


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

package main

import (
	"encoding/xml"
	"net/http"
	"time"
)

const (
	timeFormatAMZ  = "2006-01-02T15:04:05.000Z" // Reply date format
	maxObjectList  = 1000                       // Limit number of objects in a listObjectsResponse.
	maxUploadsList = 1000                       // Limit number of uploads in a listUploadsResponse.
	maxPartsList   = 1000                       // Limit number of parts in a listPartsResponse.
)

// LocationResponse - format for location response.
type LocationResponse struct {
	XMLName  xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LocationConstraint" json:"-"`
	Location string   `xml:",chardata"`
}

// ListObjectsResponse - format for list objects response.
type ListObjectsResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResult" json:"-"`

	CommonPrefixes []CommonPrefix
	Contents       []Object

	Delimiter string

	// Encoding type used to encode object keys in the response.
	EncodingType string

	// A flag that indicates whether or not ListObjects returned all of the results
	// that satisfied the search criteria.
	IsTruncated bool
	Marker      string
	MaxKeys     int
	Name        string

	// When response is truncated (the IsTruncated element value in the response
	// is true), you can use the key name in this field as marker in the subsequent
	// request to get next set of objects. Server lists objects in alphabetical
	// order Note: This element is returned only if you have delimiter request parameter
	// specified. If response does not include the NextMaker and it is truncated,
	// you can use the value of the last Key in the response as the marker in the
	// subsequent request to get the next set of object keys.
	NextMarker string
	Prefix     string
}

// Part container for part metadata.
type Part struct {
	PartNumber   int
	ETag         string
	LastModified string
	Size         int64
}

// ListPartsResponse - format for list parts response.
type ListPartsResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListPartsResult" json:"-"`

	Bucket   string
	Key      string
	UploadID string `xml:"UploadId"`

	Initiator Initiator
	Owner     Owner

	// The class of storage used to store the object.
	StorageClass string

	PartNumberMarker     int
	NextPartNumberMarker int
	MaxParts             int
	IsTruncated          bool

	// List of parts.
	Parts []Part `xml:"Part"`
}

// ListMultipartUploadsResponse - format for list multipart uploads response.
type ListMultipartUploadsResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListMultipartUploadsResult" json:"-"`

	Bucket             string
	KeyMarker          string
	UploadIDMarker     string `xml:"UploadIdMarker"`
	NextKeyMarker      string
	NextUploadIDMarker string `xml:"NextUploadIdMarker"`
	EncodingType       string
	MaxUploads         int
	IsTruncated        bool
	Uploads            []Upload `xml:"Upload"`
	Prefix             string
	Delimiter          string
	CommonPrefixes     []CommonPrefix
}

// ListBucketsResponse - format for list buckets response
type ListBucketsResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListAllMyBucketsResult" json:"-"`
	// Container for one or more buckets.
	Buckets struct {
		Buckets []Bucket `xml:"Bucket"`
	} // Buckets are nested
	Owner Owner
}

// Upload container for in progress multipart upload
type Upload struct {
	Key          string
	UploadID     string `xml:"UploadId"`
	Initiator    Initiator
	Owner        Owner
	StorageClass string
	Initiated    string
}

// CommonPrefix container for prefix response in ListObjectsResponse
type CommonPrefix struct {
	Prefix string
}

// Bucket container for bucket metadata
type Bucket struct {
	Name         string
	CreationDate string // time string of format "2006-01-02T15:04:05.000Z"
}

// Object container for object metadata
type Object struct {
	ETag         string
	Key          string
	LastModified string // time string of format "2006-01-02T15:04:05.000Z"
	Size         int64

	Owner Owner

	// The class of storage used to store the object.
	StorageClass string
}

// CopyObjectResponse container returns ETag and LastModified of the
// successfully copied object
type CopyObjectResponse struct {
	XMLName      xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopyObjectResult" json:"-"`
	ETag         string
	LastModified string // time string of format "2006-01-02T15:04:05.000Z"
}

// Initiator inherit from Owner struct, fields are same
type Initiator Owner

// Owner - bucket owner/principal
type Owner struct {
	ID          string
	DisplayName string
}

// InitiateMultipartUploadResponse container for InitiateMultiPartUpload response, provides uploadID to start MultiPart upload
type InitiateMultipartUploadResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ InitiateMultipartUploadResult" json:"-"`

	Bucket   string
	Key      string
	UploadID string `xml:"UploadId"`
}

// CompleteMultipartUploadResponse container for completed multipart upload response
type CompleteMultipartUploadResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CompleteMultipartUploadResult" json:"-"`

	Location string
	Bucket   string
	Key      string
	ETag     string
}

// PostResponse container for completed post upload response
type PostResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ PostResponse" json:"-"`

	Location string
	Bucket   string
	Key      string
	ETag     string
}

// DeleteError structure.
type DeleteError struct {
	Code    string
	Message string
	Key     string
}

// DeleteObjectsResponse container for multiple object deletes.
type DeleteObjectsResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ DeleteResult" json:"-"`

	// Collection of all deleted objects
	DeletedObjects []ObjectIdentifier `xml:"Deleted,omitempty"`

	// Collection of errors deleting certain objects.
	Errors []DeleteError `xml:"Error,omitempty"`
}

// getLocation get URL location.
func getLocation(r *http.Request) string {
	return r.URL.Path
}

// getObjectLocation gets the relative URL for an object
func getObjectLocation(bucketName string, key string) string {
	return "/" + bucketName + "/" + key
}

// takes an array of Bucketmetadata information for serialization
// input:
// array of bucket metadata
//
// output:
// populated struct that can be serialized to match xml and json api spec output
func generateListBucketsResponse(buckets []BucketInfo) ListBucketsResponse {
	var listbuckets []Bucket
	var data = ListBucketsResponse{}
	var owner = Owner{}

	owner.ID = "minio"
	owner.DisplayName = "minio"

	for _, bucket := range buckets {
		var listbucket = Bucket{}
		listbucket.Name = bucket.Name
		listbucket.CreationDate = bucket.Created.Format(timeFormatAMZ)
		listbuckets = append(listbuckets, listbucket)
	}

	data.Owner = owner
	data.Buckets.Buckets = listbuckets

	return data
}

// generates an ListObjects response for the said bucket with other enumerated options.
func generateListObjectsResponse(bucket, prefix, marker, delimiter string, maxKeys int, resp ListObjectsInfo) ListObjectsResponse {
	var contents []Object
	var prefixes []CommonPrefix
	var owner = Owner{}
	var data = ListObjectsResponse{}

	owner.ID = "minio"
	owner.DisplayName = "minio"

	for _, object := range resp.Objects {
		var content = Object{}
		if object.Name == "" {
			continue
		}
		content.Key = object.Name
		content.LastModified = object.ModTime.UTC().Format(timeFormatAMZ)
		if object.MD5Sum != "" {
			content.ETag = "\"" + object.MD5Sum + "\""
		}
		content.Size = object.Size
		content.StorageClass = "STANDARD"
		content.Owner = owner
		contents = append(contents, content)
	}
	// TODO - support EncodingType in xml decoding
	data.Name = bucket
	data.Contents = contents

	data.Prefix = prefix
	data.Marker = marker
	data.Delimiter = delimiter
	data.MaxKeys = maxKeys

	data.NextMarker = resp.NextMarker
	data.IsTruncated = resp.IsTruncated
	for _, prefix := range resp.Prefixes {
		var prefixItem = CommonPrefix{}
		prefixItem.Prefix = prefix
		prefixes = append(prefixes, prefixItem)
	}
	data.CommonPrefixes = prefixes
	return data
}

// generateCopyObjectResponse
func generateCopyObjectResponse(etag string, lastModified time.Time) CopyObjectResponse {
	return CopyObjectResponse{
		ETag:         "\"" + etag + "\"",
		LastModified: lastModified.UTC().Format(timeFormatAMZ),
	}
}

// generateInitiateMultipartUploadResponse
func generateInitiateMultipartUploadResponse(bucket, key, uploadID string) InitiateMultipartUploadResponse {
	return InitiateMultipartUploadResponse{
		Bucket:   bucket,
		Key:      key,
		UploadID: uploadID,
	}
}

// generateCompleteMultipartUploadResponse
func generateCompleteMultpartUploadResponse(bucket, key, location, etag string) CompleteMultipartUploadResponse {
	return CompleteMultipartUploadResponse{
		Location: location,
		Bucket:   bucket,
		Key:      key,
		ETag:     etag,
	}
}

// generateListPartsResult
func generateListPartsResponse(partsInfo ListPartsInfo) ListPartsResponse {
	// TODO - support EncodingType in xml decoding
	listPartsResponse := ListPartsResponse{}
	listPartsResponse.Bucket = partsInfo.Bucket
	listPartsResponse.Key = partsInfo.Object
	listPartsResponse.UploadID = partsInfo.UploadID
	listPartsResponse.StorageClass = "STANDARD"
	listPartsResponse.Initiator.ID = "minio"
	listPartsResponse.Initiator.DisplayName = "minio"
	listPartsResponse.Owner.ID = "minio"
	listPartsResponse.Owner.DisplayName = "minio"

	listPartsResponse.MaxParts = partsInfo.MaxParts
	listPartsResponse.PartNumberMarker = partsInfo.PartNumberMarker
	listPartsResponse.IsTruncated = partsInfo.IsTruncated
	listPartsResponse.NextPartNumberMarker = partsInfo.NextPartNumberMarker

	listPartsResponse.Parts = make([]Part, len(partsInfo.Parts))
	for index, part := range partsInfo.Parts {
		newPart := Part{}
		newPart.PartNumber = part.PartNumber
		newPart.ETag = "\"" + part.ETag + "\""
		newPart.Size = part.Size
		newPart.LastModified = part.LastModified.UTC().Format(timeFormatAMZ)
		listPartsResponse.Parts[index] = newPart
	}
	return listPartsResponse
}

// generateListMultipartUploadsResponse
func generateListMultipartUploadsResponse(bucket string, multipartsInfo ListMultipartsInfo) ListMultipartUploadsResponse {
	listMultipartUploadsResponse := ListMultipartUploadsResponse{}
	listMultipartUploadsResponse.Bucket = bucket
	listMultipartUploadsResponse.Delimiter = multipartsInfo.Delimiter
	listMultipartUploadsResponse.IsTruncated = multipartsInfo.IsTruncated
	listMultipartUploadsResponse.EncodingType = multipartsInfo.EncodingType
	listMultipartUploadsResponse.Prefix = multipartsInfo.Prefix
	listMultipartUploadsResponse.KeyMarker = multipartsInfo.KeyMarker
	listMultipartUploadsResponse.NextKeyMarker = multipartsInfo.NextKeyMarker
	listMultipartUploadsResponse.MaxUploads = multipartsInfo.MaxUploads
	listMultipartUploadsResponse.NextUploadIDMarker = multipartsInfo.NextUploadIDMarker
	listMultipartUploadsResponse.UploadIDMarker = multipartsInfo.UploadIDMarker
	listMultipartUploadsResponse.CommonPrefixes = make([]CommonPrefix, len(multipartsInfo.CommonPrefixes))
	for index, commonPrefix := range multipartsInfo.CommonPrefixes {
		listMultipartUploadsResponse.CommonPrefixes[index] = CommonPrefix{
			Prefix: commonPrefix,
		}
	}
	listMultipartUploadsResponse.Uploads = make([]Upload, len(multipartsInfo.Uploads))
	for index, upload := range multipartsInfo.Uploads {
		newUpload := Upload{}
		newUpload.UploadID = upload.UploadID
		newUpload.Key = upload.Object
		newUpload.Initiated = upload.Initiated.UTC().Format(timeFormatAMZ)
		listMultipartUploadsResponse.Uploads[index] = newUpload
	}
	return listMultipartUploadsResponse
}

// generate multi objects delete response.
func generateMultiDeleteResponse(quiet bool, deletedObjects []ObjectIdentifier, errs []DeleteError) DeleteObjectsResponse {
	deleteResp := DeleteObjectsResponse{}
	if !quiet {
		deleteResp.DeletedObjects = deletedObjects
	}
	deleteResp.Errors = errs
	return deleteResp
}

// writeSuccessResponse write success headers and response if any.
func writeSuccessResponse(w http.ResponseWriter, response []byte) {
	setCommonHeaders(w)
	if response == nil {
		w.WriteHeader(http.StatusOK)
		return
	}
	w.Write(response)
	w.(http.Flusher).Flush()
}

// writeSuccessNoContent write success headers with http status 204
func writeSuccessNoContent(w http.ResponseWriter) {
	setCommonHeaders(w)
	w.WriteHeader(http.StatusNoContent)
}

// writeErrorRespone write error headers
func writeErrorResponse(w http.ResponseWriter, req *http.Request, errorCode APIErrorCode, resource string) {
	error := getAPIError(errorCode)
	// generate error response
	errorResponse := getAPIErrorResponse(error, resource)
	encodedErrorResponse := encodeResponse(errorResponse)
	// set common headers
	setCommonHeaders(w)
	// write Header
	w.WriteHeader(error.HTTPStatusCode)
	// HEAD should have no body, do not attempt to write to it
	if req.Method != "HEAD" {
		// write error body
		w.Write(encodedErrorResponse)
		w.(http.Flusher).Flush()
	}
}


text:
<?php
/**
 * Created by PhpStorm.
 * User: thanh
 * Date: 06/04/2015
 * Time: 10:05
 */

namespace MediaEmbed;

/**
 * Class ZingMp3
 * @package MediaEmbed
 */
class ZingMp3 extends Media
{

    protected $songWidth = 460;
    protected $songHeight = 100;

    protected $playlistWidth = 460;
    protected $playlistHeight = 225;

    protected $videoWidth = 460;
    protected $videoHeight = 362;

    /**
     * Provider Alias
     * @var string
     */
    protected $alias = 'mp3';

    /**
     * Get type of embed in url path
     * @return bool|string
     */
    public function getEmbedType()
    {
        switch ($this->getType()) {
            case self::SONG:
                return 'song';
            case self::PLAYLIST:
                return 'album';
            case self::VIDEO:
                return 'video';
        }
        return false;
    }

    /**
     * Get embed code
     * @return string
     */
    public function getHTML()
    {
        return '<iframe width="' . $this->width . '" height="' . $this->height . '" src="http://mp3.zing.vn/embed/' . $this->getEmbedType() . '/' . $this->getId() . '?autostart=false" frameborder="0" allowfullscreen="true"></iframe>';
    }

}


text:
package org.deeplearning4j.eval;

/**
 * The averaging approach for binary valuation measures when applied to multiclass classification problems.
 * Macro averaging: weight each class equally

 * Micro averaging: weight each example equally

 * Generally, macro averaging is preferred for imbalanced datasets
 *
 * @author Alex Black
 */
public enum EvaluationAveraging {
    Macro, Micro
}


text:
/* This is script-generated code (for the most part).  */
/* See l3FilePutSingleBuf.h for a description of this API call.*/

#include "l3FilePutSingleBuf.h"
#include "rodsLog.h"
#include "dataPut.h"
#include "filePut.h"
#include "dataObjOpen.h"
#include "dataObjPut.h"
#include "rsGlobalExtern.hpp"
#include "rcGlobalExtern.h"
#include "rsApiHandler.hpp"
#include "objMetaOpr.hpp"
#include "getRemoteZoneResc.h"

int
rsL3FilePutSingleBuf( rsComm_t *rsComm, int *l1descInx,
                      bytesBuf_t *dataObjInBBuf ) {
    int bytesWritten;

    if ( dataObjInBBuf->len >= 0 ) {
        if ( L1desc[*l1descInx].remoteZoneHost != NULL ) {
            bytesWritten = rcL3FilePutSingleBuf(
                               L1desc[*l1descInx].remoteZoneHost->conn,
                               L1desc[*l1descInx].remoteL1descInx, dataObjInBBuf );
        }
        else {
            bytesWritten = l3FilePutSingleBuf( rsComm, *l1descInx, dataObjInBBuf );
        }
    }
    else {
        bytesWritten = 0;
    }

    return bytesWritten;
}


text:
layout: page
title: Resources
permalink: /resources/
---
Please take a moment to review the important documents below designed to provide a detailed explanation of patient rights and responsibilities and our policies. If this information does not completely address your specific situation, or if you have further questions, please [contact our Albany Office]({{ site.url }}{{ site.baseurl }}/locations/#contact) to speak with our Practice Administrator.

[Patient Rights and Responsibilities]({{ site.url }}{{ site.baseurl }}/assets/resources/rights_responsibilities.pdf)

[Nondiscrimination Notice]({{ site.url }}{{ site.baseurl }}/assets/resources/nondiscrimination_accessibility.pdf)


text:
@interface PBApplication (PBApplicationTesting)
- (void)_startResumeTestNamed:(id)arg1 options:(id)arg2;	// IMP=0x000000010004d55c
- (void)_startLaunchTestNamed:(id)arg1 options:(id)arg2;	// IMP=0x000000010004d1ec
- (void)_retryLaunchTestWithOptions:(id)arg1;	// IMP=0x000000010004d114
- (void)_activateApplication:(id)arg1 suspended:(_Bool)arg2 forTest:(id)arg3;	// IMP=0x000000010004cf74
- (void)_markUserLaunchInitiationTimeForTest:(id)arg1;	// IMP=0x000000010004cea8
- (_Bool)_isAppExecutableRunning:(id)arg1;	// IMP=0x000000010004ce04
- (_Bool)runTest:(id)arg1 options:(id)arg2;	// IMP=0x000000010004ccbc
@end


text:
from __future__ import unicode_literals

import json
from time import time

import requests
import sys
import cgi

from xml.dom import minidom

from pyfeld.xmlHelper import XmlHelper
from pyfeld.didlInfo import DidlInfo

user_agent = "xrf/1.0"

class UpnpCommand:

    def __init__(self, host):
        self.host = host
        self.verbose = False

    @staticmethod
    def overwrite_user_agent(new_user_agent):
        global user_agent
        user_agent = new_user_agent

    def host_send(self, action, control_path, control_name, action_args):
        if self.host is None:
            print("Serious problem, no host defined!")
            return None
        if self.host.startswith("http://"):
            control_url = self.host + control_path
            host_name = self.host[7:]
        else:
            control_url = "http://" + self.host + control_path
            host_name = self.host

        body = '<?xml version="1.0"?>'
        body += '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" '
        body += 'SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'
        body += '<SOAP-ENV:Body>'
        body += '	<m:'+action+' xmlns:m="urn:schemas-upnp-org:service:'+control_name+':1">'
        body += action_args
        body += '	</m:'+action+'>'
        body += '</SOAP-ENV:Body>'
        body += '</SOAP-ENV:Envelope>'
        if self.verbose:
            print(body)
        global user_agent
        headers = {'Host': host_name,
                   'User-Agent': user_agent,
                   'Content-Type': 'text/xml; charset="utf-8"',
                   'Content-Length': str(len(body)),
                   'SOAPAction': '"urn:schemas-upnp-org:service:'+control_name+':1#'+action+'"'}
        try:
            t = time()
            if self.verbose:
                print(str(control_url), str(body), str(headers))
            response = requests.post(control_url, data=body, headers=headers, verify=False)
            if response.status_code < 300:
                if self.verbose:
                    print(response.content)
                result = minidom.parseString(response.content)
                if self.verbose:
                    print(result.toprettyxml())
                return result
            else:
                if self.verbose:
                    print("query {0} returned status_code:{1}".format(control_url, response.status_code))
        except Exception as e:
            if self.verbose:
                print("warning! host send error {0}".format(e))
        return None

    def device_send_rendering(self, action, action_args):
        return self.host_send(action,
                              "/RenderingControl/ctrl",
                              "RenderingControl",
                              action_args)

    def host_send_rendering(self, action, action_args):
        return self.host_send(action,
                              "/RenderingService/Control",
                              "RenderingControl",
                              action_args)

    def host_send_transport(self, action, action_args):
        return self.host_send(action,
                              "/TransportService/Control",
                              "AVTransport",
                              action_args)

    def host_send_contentdirectory(self, action, action_args):
        return self.host_send(action,
                          "/cd/Control",
                          "ContentDirectory",
                          action_args)

    def play(self):
        xml_root = self.host_send_transport("Play",  '<InstanceID>0</InstanceID><Speed>1</Speed>')
        return xml_root.toprettyxml()

    def stop(self):
        xml_root = self.host_send_transport("Stop",  '<InstanceID>0</InstanceID>')
        return xml_root.toprettyxml()

    def pause(self):
        xml_root = self.host_send_transport("Pause",  '<InstanceID>0</InstanceID>')
        return xml_root.toprettyxml()

    def seek(self, value):
        xml_root = self.host_send_transport("Seek",
                                           '<InstanceID>0</InstanceID><Unit>ABS_TIME</Unit>'
                                           '<Target>' + value + '</Target>')
        return xml_root.toprettyxml()

    def previous(self):
        xml_root = self.host_send_transport("Previous", '<InstanceID>0</InstanceID>')
        return xml_root.toprettyxml()

    def next(self):
        xml_root = self.host_send_transport("Next", '<InstanceID>0</InstanceID>')
        return xml_root.toprettyxml()

    def get_state_var(self):
        xml_root = self.host_send_rendering("GetStateVariables",
                                           '<InstanceID>0</InstanceID><'
                                           'StateVariableList>TransportStatus</StateVariableList>')
        return xml_root.toprettyxml()

    def get_position_info(self):
        xml_root = self.host_send_transport("GetPositionInfo",  '<InstanceID>0</InstanceID>')
        return XmlHelper.xml_extract_dict(xml_root, ['Track',
                                                    'TrackDuration',
                                                    'TrackMetaData',
                                                    'TrackURI',
                                                    'RelTime',
                                                    'AbsTime',
                                                    'RelCount',
                                                    'AbsCount'])

    def get_transport_setting(self):
        xml_root = self.host_send_transport("GetTransportSettings",  '<InstanceID>0</InstanceID>')
        return XmlHelper.xml_extract_dict(xml_root, ['PlayMode'])

    def get_media_info(self):
        xml_root = self.host_send_transport("GetMediaInfo",  '<InstanceID>0</InstanceID>')
        return XmlHelper.xml_extract_dict(xml_root, ['PlayMedium', 'NrTracks', 'CurrentURI', 'CurrentURIMetaData'])

    def set_transport_uri(self, data):
        print("CurrentURI:\n" + data['CurrentURI'])
        print("CurrentURIMetaData:\n" + data['CurrentURIMetaData'])
        send_data = '<InstanceID>0</InstanceID>'
        add_uri = data['CurrentURI']
        if 'raumfeldname' in data:
            if data['raumfeldname'] == 'Station':
                if 'TrackURI' in data:
                    add_uri = data['TrackURI']

        send_data += "<CurrentURI><![CDATA[" + add_uri + "]]></CurrentURI>"
        send_data += "<CurrentURIMetaData>" + cgi.escape(data['CurrentURIMetaData']) + "</CurrentURIMetaData>"
        # + cgi.escape(data['CurrentURIMetaData']) +
        print(send_data)
        xml_root = self.host_send_transport("SetAVTransportURI", send_data)
        return XmlHelper.xml_extract_dict(xml_root, ['SetAVTransportURI'])

    '''Rendering service'''

    def get_volume(self, format='plain'):
        xml_root = self.host_send_rendering("GetVolume", '<InstanceID>0</InstanceID><Channel>Master</Channel>')
        dict = XmlHelper.xml_extract_dict(xml_root, ['CurrentVolume'])
        if format == 'json':
            return '{ "CurrentVolume": "'+dict['CurrentVolume'] + '"}'
        else:
            return dict['CurrentVolume']

    def set_volume(self, value):
        xml_root = self.host_send_rendering("SetVolume",
                                           '<InstanceID>0</InstanceID><Channel>Master</Channel>' +
                                           '<DesiredVolume>' + str(value) + '</DesiredVolume>')
        return xml_root.toprettyxml()

    def get_volume_by_udn(self, format='plain'):
        xml_root = self.device_send_rendering("GetVolume", '<InstanceID>0</InstanceID><Channel>Master</Channel>')
        dict = XmlHelper.xml_extract_dict(xml_root, ['CurrentVolume'])
        if format == 'json':
            return '{ "CurrentVolume": "'+dict['CurrentVolume'] + '"}'
        else:
            return dict['CurrentVolume']

    def set_volume_by_udn(self, value):
        xml_root = self.device_send_rendering("SetVolume",
                                           '<InstanceID>0</InstanceID><Channel>Master</Channel>' +
                                           '<DesiredVolume>' + str(value) + '</DesiredVolume>')
        return xml_root.toprettyxml()

    def get_room_volume(self, uuid, format='plain'):
        xml_root = self.host_send_rendering("GetRoomVolume", '<InstanceID>0</InstanceID>'
                                           '<Room>' + uuid + '</Room>')
        dict = XmlHelper.xml_extract_dict(xml_root, ['CurrentVolume'])
        if format == 'json':
            return '{ "CurrentVolume": "'+dict['CurrentVolume'] + '"}'
        else:
            return dict['CurrentVolume']

    def set_room_volume(self, uuid, value):
        xml_root = self.host_send_rendering("SetRoomVolume",
                                           '<InstanceID>0</InstanceID><Channel>Master</Channel>' +
                                           '<DesiredVolume>' + str(value) + '</DesiredVolume>' +
                                           '<Room>' + uuid + '</Room>')
        return None

    def get_mute(self, format='plain'):
        xml_root = self.host_send_rendering("GetMute", '<InstanceID>0</InstanceID><Channel>Master</Channel>')
        dict = XmlHelper.xml_extract_dict(xml_root, ['CurrentMute'])
        if format == 'json':
            return '{ "CurrentMute": "'+dict['CurrentMute'] + '"}'
        else:
            return dict['CurrentMute']

    def set_mute(self, value):
        xml_root = self.host_send_rendering("SetMute",
                                           '<InstanceID>0</InstanceID><Channel>Master</Channel>' +
                                           '<DesiredMute>' + str(value) + '</DesiredMute>')
        return xml_root.toprettyxml()

    def get_room_mute(self, uuid, format='plain'):
        xml_root = self.host_send_rendering("GetRoomMute", '<InstanceID>0</InstanceID>'
                                           '<Room>' + uuid + '</Room>')
        dict = XmlHelper.xml_extract_dict(xml_root, ['CurrentMute'])
        if format == 'json':
            return '{ "CurrentMute": "'+dict['CurrentMute'] + '"}'
        else:
            return dict['CurrentMute']

    def set_room_mute(self, uuid, value):
        xml_root = self.host_send_rendering("SetRoomMute",
                                           '<InstanceID>0</InstanceID><Channel>Master</Channel>' +
                                           '<DesiredMute>' + str(value) + '</DesiredMute>' +
                                           '<Room>' + uuid + '</Room>')
        return None

    """
    device stuff
    """
    def get_setting(self, setting_name, output_format='plain'):
        xml_root = self.device_send_rendering("GetDeviceSetting", '<InstanceID>0</InstanceID>' +
                                              '<Name>' + str(setting_name) + '</Name>')
        dict_result = XmlHelper.xml_extract_dict(xml_root, ['Value'])
        if output_format == 'json':
            return '{ "Value": "' + dict_result['Value'] + '"}'
        else:
            return dict_result['Value']

    def set_setting(self, setting_name, value):
        xml_root = self.device_send_rendering("SetDeviceSetting", '<InstanceID>0</InstanceID>' +
                                              '<Name>' + str(setting_name) + '</Name>' +
                                              '<Value>' + str(value) + '</Value>')
        return xml_root.toprettyxml()

    def get_filter(self, output_format='plain'):
        xml_root = self.device_send_rendering("GetFilter", '<InstanceID>0</InstanceID>')
        dict_result = XmlHelper.xml_extract_dict(xml_root, ['LowDB', 'MidDB', 'HighDB'])
        if output_format == 'json':
            return '{ "LowDB": "'+dict_result['LowDB'] + '",  "MidDB": "'+dict_result['MidDB'] + '",  "HighDB": "'+dict_result['HighDB'] + '"}'
        elif output_format == 'list':
            return dict_result
        else:
            return dict_result['LowDB'] + " " + dict_result['MidDB'] + " " + dict_result['HighDB']

    def set_filter(self, valueLow, valueMid, valueHigh):
        xml_root = self.device_send_rendering("SetFilter",
                                               '<InstanceID>0</InstanceID><Channel>Master</Channel>' +
                                               '<LowDB>' + str(valueLow) + '</LowDB>' +
                                               '<MidDB>' + str(valueMid) + '</MidDB>' +
                                               '<HighDB>' + str(valueHigh) + '</HighDB>'
                                              )
        return None

    def get_balance(self, output_format='plain'):
        xml_root = self.device_send_rendering("GetBalance", '<InstanceID>0</InstanceID>')
        dict_result = XmlHelper.xml_extract_dict(xml_root, ['CurrentBalance'])
        if output_format == 'json':
            return '{ "CurrentBalance": "'+dict_result['CurrentBalance'] + '"}'
        else:
            return dict_result['CurrentBalance']

    def set_balance(self, value):
        xml_root = self.device_send_rendering("SetBalance",
                                           '<InstanceID>0</InstanceID><Channel>Master</Channel>' +
                                           '<DesiredBalance>' + str(value) + '</DesiredBalance>'
                                           )
        return None

    def get_browse_capabilites(self):
        xml_root = self.host_send_contentdirectory("GetSearchCapabilities", '')
        return XmlHelper.xml_extract_dict(xml_root, ['SearchCaps'])

    def search(self, path, search_string, format="plain"):
        browse_data = "<ContainerID>" + path + "</ContainerID>" \
                     + "<SearchCriteria>" + search_string + "</SearchCriteria>" \
                     + "<Filter>*</Filter>" \
                     + "<StartingIndex>0</StartingIndex>" \
                     + "<RequestedCount>0</RequestedCount>" \
                     + "<SortCriteria>dc:title</SortCriteria>"
        xml_root = self.host_send_contentdirectory("Search", browse_data)
        result = XmlHelper.xml_extract_dict(xml_root, ['Result', 'TotalMatches', 'NumberReturned'])
        return self.scan_browse_result(result, 0, format)

    def browse(self, path, startIndex=0, requestCount=0):
        browse_data = "<ObjectID>" + path +"</ObjectID>" \
            + "<BrowseFlag>BrowseMetadata</BrowseFlag>" \
            + "<Filter>*</Filter>" \
            + "<StartingIndex>" + str(startIndex) + "</StartingIndex>" \
            + "<RequestedCount>" + str(requestCount) + "</RequestedCount>" \
            + "<SortCriteria>dc:title</SortCriteria>"
        xml_root = self.host_send_contentdirectory("Browse", browse_data)
        return XmlHelper.xml_extract_dict(xml_root, ['Result', 'TotalMatches', 'NumberReturned'])

    def browsechildren(self, path, startIndex=0, requestCount=0):
        browse_data = "<ObjectID>" + path + "</ObjectID>" \
            + "<BrowseFlag>BrowseDirectChildren</BrowseFlag>" \
            + "<Filter>*</Filter>" \
            + "<StartingIndex>" + str(startIndex) + "</StartingIndex>" \
            + "<RequestedCount>" + str(requestCount) + "</RequestedCount>" \
            + "<SortCriteria>dc:title</SortCriteria>"
        xml_root = self.host_send_contentdirectory("Browse", browse_data)
        if xml_root is None:
            return None
        return XmlHelper.xml_extract_dict(xml_root, ['Result', 'TotalMatches', 'NumberReturned'])

    def get_node_element(self, node, tag):
        element = node.getElementsByTagName(tag)
        if element[0].firstChild is not None:
            title = element[0].firstChild.nodeValue

    def scan_browse_result(self, result, level, output_format='plain'):
        if output_format == 'plain':
            s = ""
            xml_root = minidom.parseString(result['Result'].encode('utf-8'))
            container_list = xml_root.getElementsByTagName("container")
            for container in container_list:
                dict = DidlInfo.extract_from_node(container, True)
                npath = dict["idPath"]
                adds = "C " + npath + " * " + dict["title"] + "\n"
                s += adds
                if int(level) > 0:
                     self.browse_recursive_children(npath, int(level) - 1, output_format)
            item_list = xml_root.getElementsByTagName("item")
            for item in item_list:
                dict = DidlInfo.extract_from_node(item, True)
                npath = dict["idPath"]
                s += "+ " + npath + " * " + dict["title"] + "\n"
            return s
        else:
            s = "["
            xml_root = minidom.parseString(result['Result'])
            container_list = xml_root.getElementsByTagName("container")
            for container in container_list:
                dict = DidlInfo.extract_from_node(container, True)
                s += json.dumps(dict)
                s += ","
            item_list = xml_root.getElementsByTagName("item")
            for item in item_list:
                dict = DidlInfo.extract_from_node(item, True)
                s += json.dumps(dict)
                s += ","
            if len(s) > 2:
                s = s[:-1]
            s += "]"
            return s

    def browse_recursive_children(self, path, level=3, output_format='plain', startIndex=0, requestCount=0):
        if int(level) < 0:
            return "error on level < 0"
        if path == '0/RadioTime':
            UpnpCommand.overwrite_user_agent('RaumfeldControl')
        result = self.browsechildren(path, startIndex, requestCount)
        if result is None:
            result = self.browse(path, startIndex, requestCount)

        if len(result) == 0:
            return ""
        return self.scan_browse_result(result, int(level), output_format)

"""
#for testing
"""
def usage(argv):
    print("Usage: " + argv[0] + " ip:port [COMMAND|INFO] {args}")
    print("COMMAND: ")
    print("  play                  play last stuff")
    print("  stop                  stop current playing")
    print("  setv vol              set volume args=0..100")
    print("  seek pos              seek to position args=00:00:00 ... 99:59:59")
    print("INFO: ")
    print("  getv                  get volume info")
    print("  position              GetPositionInfo ")
    print("  getsetting id            GetSetting")
    print("  media                 GetMediaInfo")
    print("  transport             GetTransportSettings ")
    print("  allinfo               all infos in one call ")
    print("BROWSE: ")
    print("  cap                   get browse capabilities")
    print("  browse path           Browse for data")
    print("  browsechildren path   Browse for data append /* for recursive")

def main(argv):
    if len(sys.argv) < 3:
        usage(sys.argv)
        sys.exit(2)

    host = sys.argv[1]
    uc = UpnpCommand(host)
    operation = sys.argv[2]
    result = None
    if operation == 'play':
        result = uc.play()
    elif operation == 'stop':
        result = uc.stop()
    elif operation == 'getv':
        result = uc.get_volume()
    elif operation == 'getfilter':
        result = uc.get_filter()
    elif operation == 'setv':
        result = uc.set_volume(sys.argv[3])
    elif operation == 'seek':
        result = uc.seek(sys.argv[3])
    elif operation == 'prev':
        result = uc.previous()
    elif operation == 'next':
        result = uc.next()
    elif operation == 'position':
        result = uc.get_position_info()
    elif operation == 'transport':
        result = uc.get_transport_setting()
    elif operation == 'getstatevar':
        result = uc.get_state_var()
    elif operation == 'getsetting':
        result = uc.get_setting(sys.argv[3])
    elif operation == 'media':
        result = uc.get_media_info()
        result += uc.get_position_info()
    elif operation == 'allinfo':
        result = uc.get_volume()
        result += uc.get_position_info()
        result += uc.get_transport_setting()
        result += uc.get_media_info()
    elif operation == 'cap':
        result = uc.get_browse_capabilites()
    elif operation == 'browse':
        result = uc.browse(argv[3])
        xml_root = minidom.parseString(result['Result'])
        print(xml_root.toprettyxml(indent="\t"))
    elif operation == 'browsechildren':
        if argv[3].endswith('/*'):
            result = uc.browse_recursive_children(argv[3][:-2])
            print(result)
        else:
            result = uc.browsechildren(argv[3])
            xml_root = minidom.parseString(result['Result'])
            print(xml_root.toprettyxml(indent="\t"))
        return

    else:
        usage(sys.argv)
    print(result)

if __name__ == "__main__":
    main(sys.argv)


text:
ActiveRecord::Schema.define(version: 20160425042136) do

  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"

  create_table "comments", force: :cascade do |t|
    t.string   "name"
    t.string   "email"
    t.text     "content"
    t.integer  "post_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "labels", force: :cascade do |t|
    t.string   "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "labels_posts", id: false, force: :cascade do |t|
    t.integer "label_id"
    t.integer "post_id"
  end

  create_table "likes", force: :cascade do |t|
    t.integer  "post_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "photos", force: :cascade do |t|
    t.string   "image"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "posts", force: :cascade do |t|
    t.string   "title"
    t.text     "content"
    t.integer  "visited_count", default: 0
    t.datetime "created_at",                null: false
    t.datetime "updated_at",                null: false
  end

  create_table "subscribes", force: :cascade do |t|
    t.string   "email"
    t.boolean  "enable",     default: true
    t.datetime "created_at",                null: false
    t.datetime "updated_at",                null: false
  end

end


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.Azure.EventHubs
{
    using System;

    /// Represents the approximate receiver runtime information for a logical partition of an Event Hub.
    public class ReceiverRuntimeInformation
    {
        ///
        /// Construct a new instance for the given partition.
        ///
        /// <param name="partitionId"></param>
        public ReceiverRuntimeInformation(string partitionId)
        {
            this.PartitionId = partitionId;
        }

        /// Gets the partition ID for a logical partition of an Event Hub.
        /// <value>The partition identifier.</value>
        public string PartitionId { get; internal set; }

        /// Gets the last sequence number of the event within the partition stream of the Event Hub.
        /// <value>The logical sequence number of the event.</value>
        public long LastSequenceNumber { get; internal set; } = -1L;

        /// Gets the enqueued UTC time of the last event.
        /// <value>The enqueued time of the last event.</value>
        public DateTime LastEnqueuedTimeUtc { get; internal set; }

        /// Gets the offset of the last enqueued event.
        /// <value>The offset of the last enqueued event.</value>
        public string LastEnqueuedOffset { get; internal set; }

        /// Gets the time of when the runtime info was retrieved.
        /// <value>The enqueued time of the last event.</value>
        public DateTime RetrievalTime { get; internal set; }

        ///
        /// Update the properties of this instance with the values from the given event.
        ///
        /// <param name="updateFrom"></param>
        public void Update(EventData updateFrom)
        {
            this.LastSequenceNumber = updateFrom.LastSequenceNumber;
            this.LastEnqueuedOffset = updateFrom.LastEnqueuedOffset;
            this.LastEnqueuedTimeUtc = updateFrom.LastEnqueuedTime;
            this.RetrievalTime = updateFrom.RetrievalTime;
        }
    }
}