text:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
    android:background="@drawable/background"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

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

        <!-- Gender -->
        <LinearLayout
            android:id="@+id/linearLayoutGender"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/background_drawable_settings"
            android:orientation="vertical"
            android:padding="10dp">

            <TextView
                android:id="@+id/textViewLabelGender"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:textColor="@android:color/white"
                android:textSize="20sp" />

            <RadioGroup
                android:id="@+id/radioGroupGender"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:orientation="horizontal"
                android:padding="10dp">

                <RadioButton
                    android:id="@+id/radioButtonMale"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

                <RadioButton
                    android:id="@+id/radioButtonFemale"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />
            </RadioGroup>
        </LinearLayout>

        <!-- Weight -->
        <LinearLayout
            android:id="@+id/linearLayoutWeight"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:background="@drawable/background_drawable_settings"
            android:orientation="vertical"
            android:padding="10dp">

            <TextView
                android:id="@+id/textViewLabelWeight"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/radioGroupGender"
                android:layout_marginLeft="10dp"
                android:textColor="@android:color/white"
                android:textSize="20sp" />

            <com.gc.materialdesign.views.Slider
                android:id="@+id/slider"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/colorPrimary"
                materialdesign:max="250"
                materialdesign:min="0" />

            <TextView
                android:id="@+id/chosenWeightLabel"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="20dp"
                android:gravity="end"
                android:text="0"
                android:textSize="20sp"
                android:textStyle="bold" />

        </LinearLayout>

        <!-- Language -->
        <LinearLayout
            android:id="@+id/linearLayoutLanguage"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:background="@drawable/background_drawable_settings"
            android:orientation="vertical"
            android:padding="10dp">

            <TextView
                android:id="@+id/textViewLabelLanguage"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:textColor="@android:color/white"
                android:textSize="20sp" />

            <LinearLayout
                android:id="@+id/linearLayoutFlags"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:orientation="horizontal">

                <ImageButton
                    android:id="@+id/imageButtonFlagMk"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="10dp"
                    android:background="@null"
                    android:src="@drawable/icon_flag_mk" />

                <ImageButton
                    android:id="@+id/imageButtonFlagUk"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="10dp"
                    android:background="@null"
                    android:src="@drawable/icon_flag_uk" />
            </LinearLayout>
        </LinearLayout>

        <!-- Driving License -->
        <LinearLayout
            android:id="@+id/linearLayoutDrivingLicense"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:background="@drawable/background_drawable_settings"
            android:orientation="vertical"
            android:padding="10dp">

            <TextView
                android:id="@+id/textViewLabelDrivingLicense"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:textColor="@android:color/white"
                android:textSize="20sp" />

            <RadioGroup
                android:id="@+id/radioGroupDrivingLicense"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:orientation="horizontal"
                android:padding="10dp">

                <RadioButton
                    android:id="@+id/radioButtonDrivingLicenseLess"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

                <RadioButton
                    android:id="@+id/radioButtonDrivingLicenseMore"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />
            </RadioGroup>
        </LinearLayout>

    </LinearLayout>
</ScrollView>


text:
title: Align an Item Vertically using align-self
---
## Align an Item Vertically using align-self

This is a stub. Help our community expand it.

This quick style guide will help ensure your pull request gets accepted.

redpajama_set_name: RedPajamaGithub


text:
package org.apache.shindig.common.cache;

import com.google.inject.ImplementedBy;

/**
 * Interface for Shindig caches.
 */
@ImplementedBy(LruCacheProvider.class)
public interface CacheProvider {
  /**
   * Create a named single instance cache in this cache manager, if the cache
   * already exists, return it if the name is null, a new anonymous cache is
   * created
   *
   * @param <K>  The Key type for the cache
   * @param <V>  The pay-load type
   * @param name The non-null name of the cache.
   * @return A Cache configured to the required specification.
   */
  <K, V> Cache<K, V> createCache(String name);
}


text:
require 'rex/post/meterpreter'

module Rex
module Post
module Meterpreter
module Ui

###
#
# The user interface portion of the standard API extension.
#
###
class Console::CommandDispatcher::Stdapi::Ui

  Klass = Console::CommandDispatcher::Stdapi::Ui

  include Console::CommandDispatcher

  #
  # List of supported commands.
  #
  def commands
    all = {
      "enumdesktops"  => "List all accessible desktops and window stations",
      "getdesktop"    => "Get the current meterpreter desktop",
      "idletime"      => "Returns the number of seconds the remote user has been idle",
      "keyscan_dump"  => "Dump the keystroke buffer",
      "keyscan_start" => "Start capturing keystrokes",
      "keyscan_stop"  => "Stop capturing keystrokes",
      "screenshot"    => "Grab a screenshot of the interactive desktop",
      "setdesktop"    => "Change the meterpreters current desktop",
      "uictl"         => "Control some of the user interface components"
      #  not working yet
      # "unlockdesktop" => "Unlock or lock the workstation (must be inside winlogon.exe)",
    }

    reqs = {
      "enumdesktops"  => [ "stdapi_ui_desktop_enum" ],
      "getdesktop"    => [ "stdapi_ui_desktop_get" ],
      "idletime"      => [ "stdapi_ui_get_idle_time" ],
      "keyscan_dump"  => [ "stdapi_ui_get_keys" ],
      "keyscan_start" => [ "stdapi_ui_start_keyscan" ],
      "keyscan_stop"  => [ "stdapi_ui_stop_keyscan" ],
      "screenshot"    => [ "stdapi_ui_desktop_screenshot" ],
      "setdesktop"    => [ "stdapi_ui_desktop_set" ],
      "uictl"         => [
        "stdapi_ui_enable_mouse",
        "stdapi_ui_enable_keyboard"
      ]
    }

    all.delete_if do |cmd, desc|
      del = false
      reqs[cmd].each do |req|
        next if client.commands.include? req
        del = true
        break
      end

      del
    end

    all
  end

  #
  # Name for this dispatcher.
  #
  def name
    "Stdapi: User interface"
  end

  #
  # Executes a command with some options.
  #
  def cmd_idletime(*args)
    seconds = client.ui.idle_time

    print_line(
      "User has been idle for: #{Rex::ExtTime.sec_to_s(seconds)}")

    return true
  end

  #
  # Enables/disables user interface mice and keyboards on the remote machine.
  #
  def cmd_uictl(*args)
    if (args.length < 2)
      print_line(
        "Usage: uictl [enable/disable] [keyboard/mouse]")
      return true
    end

    case args[0]
      when 'enable'
        case args[1]
          when 'keyboard'
            print_line("Enabling keyboard...")
            client.ui.enable_keyboard
          when 'mouse'
            print_line("Enabling mouse...")
            client.ui.enable_mouse
          else
            print_error("Unsupported user interface device: #{args[1]}")
        end
      when 'disable'
        case args[1]
          when 'keyboard'
            print_line("Disabling keyboard...")
            client.ui.disable_keyboard
          when 'mouse'
            print_line("Disabling mouse...")
            client.ui.disable_mouse
          else
            print_error("Unsupported user interface device: #{args[1]}")
        end
      else
        print_error("Unsupported command: #{args[0]}")
    end

    return true
  end

  #
  # Grab a screenshot of the current interactive desktop.
  #
  def cmd_screenshot( *args )
    path    = Rex::Text.rand_text_alpha(8) + ".jpeg"
    quality = 50
    view    = false

    screenshot_opts = Rex::Parser::Arguments.new(
      "-h" => [ false, "Help Banner." ],
      "-q" => [ true, "The JPEG image quality (Default: '#{quality}')" ],
      "-p" => [ true, "The JPEG image path (Default: '#{path}')" ],
      "-v" => [ true, "Automatically view the JPEG image (Default: '#{view}')" ]
    )

    screenshot_opts.parse( args ) { | opt, idx, val |
      case opt
        when "-h"
          print_line( "Usage: screenshot [options]\n" )
          print_line( "Grab a screenshot of the current interactive desktop." )
          print_line( screenshot_opts.usage )
          return
        when "-q"
          quality = val.to_i
        when "-p"
          path = val
        when "-v"
          view = false if ( val =~ /^(f|n|0)/i )
      end
    }

    data = client.ui.screenshot( quality )

    if( data )
      ::File.open( path, 'wb' ) do |fd|
        fd.write( data )
      end

      path = ::File.expand_path( path )

      print_line( "Screenshot saved to: #{path}" )

      Rex::Compat.open_file( path ) if view
    end

    return true
  end

  #
  # Enumerate desktops
  #
  def cmd_enumdesktops(*args)
    print_line( "Enumerating all accessible desktops" )

    desktops = client.ui.enum_desktops

    desktopstable = Rex::Ui::Text::Table.new(
      'Header'  => "Desktops",
      'Indent'  => 4,
      'Columns' => [	"Session",
              "Station",
              "Name"
            ]
    )

    desktops.each { | desktop |
      session = desktop['session'] == 0xFFFFFFFF ? '' : desktop['session'].to_s
      desktopstable << [ session, desktop['station'], desktop['name'] ]
    }

    if( desktops.length == 0 )
      print_line( "No accessible desktops were found." )
    else
      print( "\n" + desktopstable.to_s + "\n" )
    end

    return true
  end

  #
  # Get the current meterpreter desktop.
  #
  def cmd_getdesktop(*args)

    desktop = client.ui.get_desktop

    session = desktop['session'] == 0xFFFFFFFF ? '' : "Session #{desktop['session'].to_s}\\"

    print_line( "#{session}#{desktop['station']}\\#{desktop['name']}" )

    return true
  end

  #
  # Change the meterpreters current desktop.
  #
  def cmd_setdesktop( *args )

    switch   = false
    dsession = -1
    dstation = 'WinSta0'
    dname    = 'Default'

    setdesktop_opts = Rex::Parser::Arguments.new(
      "-h" => [ false, "Help Banner." ],
      #"-s" => [ true, "The session (Default: '#{dsession}')" ],
      "-w" => [ true, "The window station (Default: '#{dstation}')" ],
      "-n" => [ true, "The desktop name (Default: '#{dname}')" ],
      "-i" => [ true, "Set this desktop as the interactive desktop (Default: '#{switch}')" ]
    )

    setdesktop_opts.parse( args ) { | opt, idx, val |
      case opt
        when "-h"
          print_line( "Usage: setdesktop [options]\n" )
          print_line( "Change the meterpreters current desktop." )
          print_line( setdesktop_opts.usage )
          return
        #when "-s"
        #  dsession = val.to_i
        when "-w"
          dstation = val
        when "-n"
          dname = val
        when "-i"
          switch = true if ( val =~ /^(t|y|1)/i )
      end
    }

    if( client.ui.set_desktop( dsession, dstation, dname, switch ) )
      print_line( "#{ switch ? 'Switched' : 'Changed' } to desktop #{dstation}\\#{dname}" )
    else
      print_line( "Failed to #{ switch ? 'switch' : 'change' } to desktop #{dstation}\\#{dname}" )
    end

    return true
  end

  #
  # Unlock or lock the desktop
  #
  def cmd_unlockdesktop(*args)
    mode = 0
    if(args.length > 0)
      mode = args[0].to_i
    end

    if(mode == 0)
      print_line("Unlocking the workstation...")
      client.ui.unlock_desktop(true)
    else
      print_line("Locking the workstation...")
      client.ui.unlock_desktop(false)
    end

    return true
  end

  #
  # Start the keyboard sniffer
  #
  def cmd_keyscan_start(*args)
    print_line("Starting the keystroke sniffer...")
    client.ui.keyscan_start
    return true
  end

  #
  # Stop the keyboard sniffer
  #
  def cmd_keyscan_stop(*args)
    print_line("Stopping the keystroke sniffer...")
    client.ui.keyscan_stop
    return true
  end

  #
  # Dump captured keystrokes
  #
  def cmd_keyscan_dump(*args)
    print_line("Dumping captured keystrokes...")
    data = client.ui.keyscan_dump
    print_line(client.ui.keyscan_extract(data))

    return true
  end

end

end
end
end
end


text:
package filter_test

import (
	"testing"
	"time"

	"github.com/lxc/lxd/lxd/filter"
	"github.com/lxc/lxd/shared/api"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func TestMatch_Instance(t *testing.T) {
	instance := api.Instance{
		InstancePut: api.InstancePut{
			Architecture: "x86_64",
			Config: map[string]string{
				"image.os": "BusyBox",
			},
			Stateful: false,
		},
		CreatedAt: time.Date(2020, 1, 29, 11, 10, 32, 0, time.UTC),
		Name:      "c1",
		ExpandedConfig: map[string]string{
			"image.os": "BusyBox",
		},
		ExpandedDevices: map[string]map[string]string{
			"root": {
				"path": "/",
				"pool": "default",
				"type": "disk",
			},
		},
		Status: "Running",
	}
	cases := map[string]interface{}{
		"architecture eq x86_64":                                         true,
		"architecture eq i686":                                           false,
		"name eq c1 and status eq Running":                               true,
		"config.image.os eq BusyBox and expanded_devices.root.path eq /": true,
		"name eq c2 or status eq Running":                                true,
		"name eq c2 or name eq c3":                                       false,
	}
	for s := range cases {
		t.Run(s, func(t *testing.T) {
			f, err := filter.Parse(s)
			require.NoError(t, err)
			match := filter.Match(instance, f)
			assert.Equal(t, cases[s], match)
		})
	}

}

func TestMatch_Image(t *testing.T) {
	image := api.Image{
		ImagePut: api.ImagePut{
			Public: true,
			Properties: map[string]string{
				"os": "Ubuntu",
			},
		},
		Architecture: "i686",
	}
	cases := map[string]interface{}{
		"properties.os eq Ubuntu": true,
		"architecture eq x86_64":  false,
	}
	for s := range cases {
		t.Run(s, func(t *testing.T) {
			f, err := filter.Parse(s)
			require.NoError(t, err)
			match := filter.Match(image, f)
			assert.Equal(t, cases[s], match)
		})
	}

}


text:
package org.robolectric.shadows;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertSame;
import static org.robolectric.Shadows.shadowOf;

import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.TestRunners;

@RunWith(TestRunners.MultiApiSelfTest.class)
public class ShadowScaleGestureDetectorTest {

  private ScaleGestureDetector detector;
  private MotionEvent motionEvent;

  @Before
  public void setUp() throws Exception {
    detector = new ScaleGestureDetector(RuntimeEnvironment.application, null);
    motionEvent = MotionEvent.obtain(-1, -1, MotionEvent.ACTION_UP, 100, 30, -1);
  }

  @Test
  public void test_getOnTouchEventMotionEvent() throws Exception {
    detector.onTouchEvent(motionEvent);
    assertSame(motionEvent, shadowOf(detector).getOnTouchEventMotionEvent());
  }

  @Test
  public void test_getScaleFactor() throws Exception {
    shadowOf(detector).setScaleFactor(2.0f);
    assertEquals(detector.getScaleFactor(), 2.0f);
  }

  @Test
  public void test_getFocusXY() throws Exception {
    shadowOf(detector).setFocusXY(2.0f, 3.0f);
    assertEquals(detector.getFocusX(), 2.0f);
    assertEquals(detector.getFocusY(), 3.0f);
  }

  @Test
  public void test_getListener() throws Exception {
    TestOnGestureListener listener = new TestOnGestureListener();
    assertSame(listener, shadowOf(new ScaleGestureDetector(RuntimeEnvironment.application, listener)).getListener());
  }

  @Test
  public void test_reset() throws Exception {
    assertDefaults();

    detector.onTouchEvent(motionEvent);
    shadowOf(detector).setFocusXY(3f, 3f);
    shadowOf(detector).setScaleFactor(4f);
    assertSame(motionEvent, shadowOf(detector).getOnTouchEventMotionEvent());

    shadowOf(detector).reset();

    assertDefaults();
  }

  private void assertDefaults() {
    assertNull(shadowOf(detector).getOnTouchEventMotionEvent());
    assertEquals(detector.getScaleFactor(), 1f);
    assertEquals(detector.getFocusX(), 0f);
    assertEquals(detector.getFocusY(), 0f);
  }

  private static class TestOnGestureListener implements ScaleGestureDetector.OnScaleGestureListener {
    @Override
    public boolean onScale(ScaleGestureDetector detector) {
      return false;
    }

    @Override
    public boolean onScaleBegin(ScaleGestureDetector detector) {
      return false;
    }

    @Override
    public void onScaleEnd(ScaleGestureDetector detector) {
    }
  }
}


text:
exports.User = require('./User')
exports.Permission = require('./Permission')
exports.Role = require('./Role')
exports.Resource = require('./Resource')
exports.UserUpload = require('./UserUpload')
exports.UserRole = require('./UserRole')
exports.UserItem = require('./UserItem')


text:
/* 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 org.flowable.content.engine.impl.test;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.flowable.content.api.ContentManagementService;
import org.flowable.content.api.ContentService;
import org.flowable.content.engine.ContentEngine;
import org.flowable.content.engine.ContentEngineConfiguration;
import org.flowable.content.engine.impl.util.CommandContextUtil;
import org.flowable.engine.common.impl.db.DbSchemaManager;
import org.flowable.engine.common.impl.interceptor.Command;
import org.flowable.engine.common.impl.interceptor.CommandConfig;
import org.flowable.engine.common.impl.interceptor.CommandContext;
import org.flowable.engine.common.impl.interceptor.CommandExecutor;
import org.junit.Assert;

import junit.framework.AssertionFailedError;

/**
 * @author Tom Baeyens
 * @author Joram Barrez
 */
public abstract class AbstractFlowableTestCase extends AbstractContentTestCase {

    private static final List<String> TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK = new ArrayList<>();

    static {
        TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK.add("ACT_CO_DATABASECHANGELOG");
        TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK.add("ACT_CO_DATABASECHANGELOGLOCK");
    }

    protected ContentEngine contentEngine;

    protected Throwable exception;

    protected ContentEngineConfiguration contentEngineConfiguration;
    protected ContentManagementService managementService;
    protected ContentService contentService;

    protected abstract void initializeContentEngine();

    // Default: do nothing
    protected void closeDownContentEngine() {
    }

    protected void nullifyServices() {
        contentEngineConfiguration = null;
        managementService = null;
        contentService = null;
    }

    @Override
    public void runBare() throws Throwable {
        initializeContentEngine();
        if (contentService == null) {
            initializeServices();
        }

        try {

            super.runBare();

        } catch (AssertionFailedError e) {
            LOGGER.error(EMPTY_LINE);
            LOGGER.error("ASSERTION FAILED: {}", e, e);
            exception = e;
            throw e;

        } catch (Throwable e) {
            LOGGER.error(EMPTY_LINE);
            LOGGER.error("EXCEPTION: {}", e, e);
            exception = e;
            throw e;

        } finally {

            assertAndEnsureCleanDb();
            contentEngineConfiguration.getClock().reset();

            // Can't do this in the teardown, as the teardown will be called as part of the super.runBare
            closeDownContentEngine();
        }
    }

    /**
     * Each test is assumed to clean up all DB content it entered. After a test method executed, this method scans all tables to see if the DB is completely clean. It throws AssertionFailed in case
     * the DB is not clean. If the DB is not clean, it is cleaned by performing a create a drop.
     */
    protected void assertAndEnsureCleanDb() throws Throwable {
        LOGGER.debug("verifying that db is clean after test");
        Map<String, Long> tableCounts = managementService.getTableCount();
        StringBuilder outputMessage = new StringBuilder();
        for (String tableName : tableCounts.keySet()) {
            String tableNameWithoutPrefix = tableName.replace(contentEngineConfiguration.getDatabaseTablePrefix(), "");
            if (!TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK.contains(tableNameWithoutPrefix)) {
                Long count = tableCounts.get(tableName);
                if (count != 0L) {
                    outputMessage.append("  ").append(tableName).append(": ").append(count).append(" record(s) ");
                }
            }
        }

        if (outputMessage.length() > 0) {
            outputMessage.insert(0, "DB NOT CLEAN: \n");
            LOGGER.error(EMPTY_LINE);
            LOGGER.error(outputMessage.toString());

            LOGGER.info("dropping and recreating db");

            CommandExecutor commandExecutor = contentEngine.getContentEngineConfiguration().getCommandExecutor();
            CommandConfig config = new CommandConfig().transactionNotSupported();
            commandExecutor.execute(config, new Command<Object>() {
                public Object execute(CommandContext commandContext) {
                    DbSchemaManager dbSchemaManager = CommandContextUtil.getContentEngineConfiguration(commandContext).getDbSchemaManager();
                    dbSchemaManager.dbSchemaDrop();
                    dbSchemaManager.dbSchemaCreate();
                    return null;
                }
            });

            if (exception != null) {
                throw exception;
            } else {
                Assert.fail(outputMessage.toString());
            }
        } else {
            LOGGER.info("database was clean");
        }
    }

    protected void initializeServices() {
        contentEngineConfiguration = contentEngine.getContentEngineConfiguration();
        managementService = contentEngine.getContentManagementService();
        contentService = contentEngine.getContentService();
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>io.yaktor</groupId>
        <artifactId>dsl-xtext-parent</artifactId>
        <version>0.55.0-SNAPSHOT</version>
    </parent>
    <name>${project.groupId}:${project.artifactId}</name>
    <description>A command-line code generator that reads Yaktor's DSLs and produces Node.js Yaktor applications.
    </description>
    <groupId>io.yaktor</groupId>
    <artifactId>xtext-dsl-cli</artifactId>
    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>conversation-xtext-dsl</artifactId>
            <version>${project.version}</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>domain-xtext-dsl</artifactId>
            <version>${project.version}</version>
            <type>pom</type>
        </dependency>
    </dependencies>
    <properties>
        <cli.basename>yaktor-xtext-dsl-cli</cli.basename>
        <cli.fake.basename>xtext-dsl-cli</cli.fake.basename>
        <eclipse.libdir>${basedir}/.eclipse_lib</eclipse.libdir>
        <eclipse.download.url>https://raw.githubusercontent.com/SciSpike/build-support/master/xtext
        </eclipse.download.url>
        <jardir>${project.build.directory}</jardir>
    </properties>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>build-dsl-cli-jars</id>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <ant antfile="build-cli-jars.xml"/>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>fake-javadoc</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/assembly/javadoc.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                    <execution>
                        <id>fake-sources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/assembly/sources.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-install-plugin</artifactId>
                <version>2.5.2</version>
                <executions>
                    <execution>
                        <id>install-xtext-dsl-cli-jar-light</id>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <file>${project.build.directory}/${cli.basename}-light.jar</file>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>${cli.basename}</artifactId>
                            <packaging>jar</packaging>
                            <version>${project.version}</version>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-xtext-dsl-cli-jar-with-deps</id>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <file>${project.build.directory}/${cli.basename}-heavy.jar</file>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>${cli.basename}</artifactId>
                            <classifier>heavy</classifier>
                            <packaging>jar</packaging>
                            <version>${project.version}</version>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>prepare-npm-module-source</id>
                        <phase>install</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/npm</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/npm</directory>
                                    <filtering>true</filtering>
                                </resource>
                                <resource>
                                    <directory>
                                        ${settings.localRepository}/io/yaktor/${cli.basename}/${project.version}
                                    </directory>
                                    <filtering>false</filtering>
                                    <includes>
                                        <include>${cli.basename}-${project.version}.jar</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.0.1</version>
                <configuration>
                    <skipSource>true</skipSource>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>


text:
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Annotation Demo - Redlink GmbH</title>

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Redlink Annotation Demo" />
    <meta name="author" content="RedLink GmbH" />

    <link rel="stylesheet" href="css/stylesheets/redlink-annotation-tool.css">

    <link href="http://fonts.googleapis.com/css?family=Roboto:400,300,700" rel="stylesheet" type="text/css">
    <link href="http://dev.redlink.io/resources/css/bootplus.css" rel="stylesheet" />
    <link href="http://dev.redlink.io/resources/css/bootplus-responsive.css" rel="stylesheet" />
    <link href="http://dev.redlink.io/resources/css/font-awesome.css" rel="stylesheet" />

    <link href="http://dev.redlink.io/resources/css/prettify.css" rel="stylesheet" />
    <link href="http://dev.redlink.io/resources/css/redlink.css" rel="stylesheet" />

    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="http://dev.redlink.io/resources/ico/redlink-apple-touch-icon-144.png" />
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://dev.redlink.io/resources/redlink-ico/apple-touch-icon-114.png" />
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="http://dev.redlink.io/resources/redlink-ico/apple-touch-icon-72.png" />
    <link rel="apple-touch-icon-precomposed" href="http://dev.redlink.io/resources/ico/redlink-apple-touch-icon-57.png" />
    <link rel="shortcut icon" href="http://dev.redlink.io/resources/ico/favicon.png" />

Home

API

SDK

Plugins

Demos

FAQ

Contact

Redlink Annotation Demo

                      Give Redlink a try! Add content and watch the annotations appear. This demo will use Redlink
                      enhancement engine over your custom datasets bound to the provided API key.
                      So please, feel free to signup
                      to access a more advanced experience.

                        API Key:
                        <input type="password" id="api_key" style="border-radius: 5px; background-color: #eeeeee; width: 400px; margin: 0 0 0.3em 0.5em;" />

                        API Key is required!

                        Analyses: <select id="analyses"><option value="">-</option></select>
                        <input style="margin-left: 2em;" type="checkbox" id="hide_key" checked /> Hide key

            This demo uses the Redlink Analysis API
            to annotate content with the custom datasets bound to the API key provided.
            If you have any question, please, do not hesitate to
            contact us.


text:
using System;
using System.Reflection;

using ZDevTools.XamarinForms;

namespace Microsoft.Extensions.Logging
{
    internal static class HostingLoggerExtensions
    {
        public static void ApplicationError(this ILogger logger, EventId eventId, string message, Exception exception)
        {
            var reflectionTypeLoadException = exception as ReflectionTypeLoadException;
            if (reflectionTypeLoadException != null)
            {
                foreach (var ex in reflectionTypeLoadException.LoaderExceptions)
                {
                    message = message + Environment.NewLine + ex.Message;
                }
            }

            logger.LogCritical(
                eventId: eventId,
                message: message,
                exception: exception);
        }

        public static void Sleeping(this ILogger logger)
        {
            if (logger.IsEnabled(LogLevel.Debug))
            {
                logger.LogDebug(
                   eventId: LoggerEventIds.Sleeping,
                   message: "Application sleeping");
            }
        }

        public static void Resuming(this ILogger logger)
        {
            if (logger.IsEnabled(LogLevel.Debug))
            {
                logger.LogDebug(
                    eventId: LoggerEventIds.Resuming,
                    message: "Application resuming");
            }
        }

        public static void StoppedWithException(this ILogger logger, Exception ex)
        {
            if (logger.IsEnabled(LogLevel.Debug))
            {
                logger.LogDebug(
                    eventId: LoggerEventIds.StoppedWithException,
                    exception: ex,
                    message: "Hosting shutdown exception");
            }
        }
    }
}


text:
<?php

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Select control.
 */
class Kirki_Control_FontAwesome extends Kirki_Control_Base {

	/**
	 * The control type.
	 *
	 * @access public
	 * @var string
	 */
	public $type = 'kirki-fontawesome';

	/**
	 * Enqueue control related scripts/styles.
	 *
	 * @access public
	 */
	public function enqueue() {
		parent::enqueue();

		wp_enqueue_style( 'kirki-fontawesome-font-css', trailingslashit( Kirki::$url ) . 'assets/vendor/fontawesome/css/font-awesome.min.css', array(), KIRKI_VERSION );

		ob_start();
		$json_path = wp_normalize_path( Kirki::$path . '/assets/vendor/fontawesome/fontawesome.json' );
		include( $json_path );
		$font_awesome_json = ob_get_clean();

		wp_localize_script( 'kirki-script', 'fontAwesomeJSON', $font_awesome_json );
	}

	/**
	 * An Underscore (JS) template for this control's content (but not its container).
	 *
	 * Class variables for this control class are available in the `data` JS object;
	 * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
	 *
	 * @see WP_Customize_Control::print_template()
	 *
	 * @access protected
	 */
	protected function content_template() {
		?>

			<# if ( data.label ) { #>{{ data.label }}<# } #>
			<# if ( data.description ) { #>{{{ data.description }}}<# } #>
			<select {{{ data.inputAttrs }}} {{{ data.link }}}></select>

		<?php
	}
}


text:
package io.vertx.ext.web.impl;

import io.netty.handler.codec.http.HttpResponseStatus;
import io.vertx.core.Handler;
import io.vertx.core.impl.logging.Logger;
import io.vertx.core.impl.logging.LoggerFactory;
import io.vertx.ext.web.Route;
import io.vertx.ext.web.RoutingContext;
import io.vertx.ext.web.handler.HttpException;

import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author Tim Fox
 */
public abstract class RoutingContextImplBase implements RoutingContextInternal {

  protected static final Logger LOG = LoggerFactory.getLogger(RoutingContext.class);

  private final Set<RouteImpl> routes;

  protected final String mountPoint;
  private final AtomicInteger currentRouteNextHandlerIndex;
  private final AtomicInteger currentRouteNextFailureHandlerIndex;
  protected Iterator<RouteImpl> iter;
  protected RouteState currentRoute;
  // When Route#matches executes, if it returns != 0 this flag is configured
  // to write the correct status code at the end of routing process
  int matchFailure;
  // the current path matched string
  int matchRest = -1;
  boolean matchNormalized;
  // internal runtime state
  private volatile long seen;

  RoutingContextImplBase(String mountPoint, Set<RouteImpl> routes) {
    this.mountPoint = mountPoint;
    this.routes = routes;
    this.iter = routes.iterator();
    this.currentRouteNextHandlerIndex = new AtomicInteger(0);
    this.currentRouteNextFailureHandlerIndex = new AtomicInteger(0);
    resetMatchFailure();
  }

  @Override
  public synchronized RoutingContextInternal visitHandler(int id) {
    seen |= id;
    return this;
  }

  @Override
  public boolean seenHandler(int id) {
    return (seen & id) != 0;
  }

  @Override
  public synchronized RoutingContextInternal setMatchFailure(int matchFailure) {
    this.matchFailure = matchFailure;
    return this;
  }

  @Override
  public String mountPoint() {
    return mountPoint;
  }

  @Override
  public Route currentRoute() {
    if (currentRoute == null) {
      return null;
    }
    return currentRoute.getRoute();
  }

  int currentRouteNextHandlerIndex() {
    return currentRouteNextHandlerIndex.intValue();
  }

  int currentRouteNextFailureHandlerIndex() {
    return currentRouteNextFailureHandlerIndex.intValue();
  }

  void restart() {
    this.iter = routes.iterator();
    currentRoute = null;
    next();
  }

  boolean iterateNext() {
    boolean failed = failed();
    if (currentRoute != null) { // Handle multiple handlers inside route object
      try {
        if (!failed && currentRoute.hasNextContextHandler(this)) {
          currentRouteNextHandlerIndex.incrementAndGet();
          resetMatchFailure();
          currentRoute.handleContext(this);
          return true;
        } else if (failed && currentRoute.hasNextFailureHandler(this)) {
          currentRouteNextFailureHandlerIndex.incrementAndGet();
          currentRoute.handleFailure(this);
          return true;
        }
      } catch (Throwable t) {
        handleInHandlerRuntimeFailure(currentRoute.getRouter(), failed, t);
        return true;
      }
    }
    // Search for more handlers
    while (iter.hasNext()) {
      // state is locked at this moment
      RouteState routeState = iter.next().state();

      currentRouteNextHandlerIndex.set(0);
      currentRouteNextFailureHandlerIndex.set(0);
      try {
        int matchResult = routeState.matches(this, mountPoint(), failed);
        if (matchResult == 0) {
          if (LOG.isTraceEnabled()) {
            LOG.trace("Route matches: " + routeState);
          }
          resetMatchFailure();
          try {
            currentRoute = routeState;
            request().routed(currentRoute.getName());
            if (LOG.isTraceEnabled()) {
              LOG.trace("Calling the " + (failed ? "failure" : "") + " handler");
            }
            if (failed && currentRoute.hasNextFailureHandler(this)) {
              currentRouteNextFailureHandlerIndex.incrementAndGet();
              routeState.handleFailure(this);
            } else if (currentRoute.hasNextContextHandler(this)) {
              currentRouteNextHandlerIndex.incrementAndGet();
              routeState.handleContext(this);
            } else {
              continue;
            }
          } catch (Throwable t) {
            handleInHandlerRuntimeFailure(routeState.getRouter(), failed, t);
          }
          return true;
        } else if (matchResult == 405) {
          // invalid method match, means that
          // we should "update" the failure if not found to be invalid method
          if (this.matchFailure == 404) {
            this.matchFailure = matchResult;
          }
        } else if (matchResult != 404) {
          this.matchFailure = matchResult;
        }
      } catch (Throwable e) {
        if (LOG.isTraceEnabled()) {
          LOG.trace("IllegalArgumentException thrown during iteration", e);
        }
        // Failure in matches algorithm (If the exception is instanceof IllegalArgumentException probably is a QueryStringDecoder error!)
        if (!this.response().ended()) {
          unhandledFailure((e instanceof IllegalArgumentException) ? 400 : -1, e, routeState.getRouter());
        }
        return true;
      }
    }
    return false;
  }

  private void handleInHandlerRuntimeFailure(RouterImpl router, boolean failed, Throwable t) {
    LOG.error("Unhandled exception in router", t);

    if (!failed) {
      if (LOG.isTraceEnabled()) {
        LOG.trace("Failing the routing");
      }
      fail(t);
    } else {
      // Failure in handling failure!
      if (LOG.isTraceEnabled()) {
        LOG.trace("Failure in handling failure");
      }
      unhandledFailure(-1, t, router);
    }
  }

  protected void unhandledFailure(int statusCode, Throwable failure, RouterImpl router) {
    int code = statusCode != -1 ?
      statusCode :
      (failure instanceof HttpException) ?
        ((HttpException) failure).getStatusCode() :
        500;

    Handler<RoutingContext> errorHandler = router.getErrorHandlerByStatusCode(code);
    if (errorHandler != null) {
      try {
        errorHandler.handle(this);
      } catch (Throwable t) {
        LOG.error("Error in error handler", t);
      }
    }

    if (!response().ended() && !response().closed()) {
      try {
        response().setStatusCode(code);
      } catch (IllegalArgumentException e) {
        // means that there are invalid chars in the status message
        response()
            .setStatusMessage(HttpResponseStatus.valueOf(code).reasonPhrase())
            .setStatusCode(code);
      }
      response().end(response().getStatusMessage());
    }
  }

  private void resetMatchFailure() {
    this.matchFailure = 404;
  }
}


text:
#include "SdkSample.h"

#ifndef __SSAO_H__
#define __SSAO_H__

using namespace Ogre;
using namespace OgreBites;

#define SSAO_GUI_WIDTH 250
#define SSAO_GUI_TRACK_WIDTH 100
#define SSAO_GUI_VALUE_BOX_WIDTH 50

const String SSAO_OBJECT_MENU_NAME = "ObjectType";
const String SSAO_CAMERA_MENU_NAME = "Camera";

const String SSAO_COMPOSITOR_MENU_NAME = "Compositor";
const String SSAO_POST_MENU_NAME = "Post";
const String SSAO_CREASE_MINIMUM_NAME = "CreaseMinimum";
const String SSAO_CREASE_RANGE_NAME = "mCreaseRange";
const String SSAO_CREASE_BIAS_NAME = "mCreaseBias";
const String SSAO_CREASE_AVERAGER_NAME = "mCreaseAverager";
const String SSAO_CREASE_KERNELSIZE_NAME = "mCreaseKernelsize";

const String SSAO_SAMPLE_SPACE_NAME = "sampleSpace";
const String SSAO_SAMPLE_LENGTH_SCREENSPACE = "sampleScreenSpace";
const String SSAO_SAMPLE_LENGTH_WORLDSPACE = "sampleWorldSpace";
const String SSAO_SAMPLE_LENGTH_EXPONENT_NAME = "sampleLengthExponent";

const String SSAO_ANGLE_BIAS_NAME = "angleBias";

const String SSAO_CRYTEK_OFFSET_SCALE_NAME = "offsetScale";
const String SSAO_CRYTEK_EDGE_HIGHLIGHT_NAME = "edgeHighlight";
const String SSAO_CRYTEK_DEFAULT_ACCESSIBILITY_NAME = "defaultOcclusion";

const String SSAO_UNSHARP_KERNEL_BIAS_NAME = "kernelBias";
const String SSAO_UNSHARP_LAMBDA_NAME = "lambda";

const String SSAO_BILATERAL_PHOTOMETRIC_EXPONENT = "photometricExponent";

const String SSAO_USER_CAMERA_ITEM = "User Camera";
const String SSAO_CAMERA_SIBENIK = "Sibenik";
const String SSAO_CAMERA_CORNELL = "Cornell Box";

class _OgreSampleClassExport Sample_SSAO : public SdkSample
{
private:
	std::vector<String> mMeshNames;
	std::vector<Entity*> mMeshes;
	int mCurrentMeshIndex;

	std::vector<String> mCompositorNames;
	String mCurrentCompositor;

	std::vector<String> mPostNames;
	String mCurrentPost;

	std::vector<Widget *> mCreasePanel;
	std::vector<Widget *> mUnsharpPanel;
	std::vector<Widget *> mBilateralPanel;

	CheckBox* mSamplingCheckbox;
	Slider* mScreenSpaceSlider;
	Slider* mWorldSpaceSlider;

	Slider* mSampleLengthExponent;

	Slider* mAngleBiasSlider;
	Slider* mOffsetStepSlider;
	Slider* mEdgeHighlight;
	Slider* mDefaultAccessibility;

	SelectMenu* mCameraMenu;

	/**
	 * Show all the widgets in the panel
	 * @see Sample_SSAO::showWidget
	 */
    void showPanel(std::vector<Widget *> panel)
    {
        for (unsigned int i = 0; i < panel.size(); i++)
        {
            mTrayMgr->moveWidgetToTray(panel[i], TL_TOPLEFT);
            panel[i]->show();
        }
    }

	/**
	 * Hide all the widgets in the panel
	 * @see Sample_SSAO::hideWidget
	 */
    void hidePanel(std::vector<Widget *> panel)
    {
        for (unsigned int i = 0; i < panel.size(); i++)
        {
            mTrayMgr->removeWidgetFromTray(panel[i]);
            panel[i]->hide();
        }
    }

	/**
	 * Show the given widget. This sets it visible and re-adds it to the panel
	 */
    void showWidget(Widget* widget)
    {
        mTrayMgr->moveWidgetToTray(widget, TL_TOPLEFT);
        widget->show();
    }

	/**
	 * Hide the given widget. This sets it to not visible and also removes it
	 * from the panel.
	 */
    void hideWidget(Widget* widget)
    {
        mTrayMgr->removeWidgetFromTray(widget);
        widget->hide();
    }
public:
	Sample_SSAO()
    {
        mInfo["Title"] = "SSAO Techniques";
        mInfo["Description"] = "A demo of several Screen Space Ambient Occlusion (SSAO) shading techniques using compositors.";
        mInfo["Thumbnail"] = "thumb_ssao.png";
        mInfo["Category"] = "Lighting";

        mMeshNames.push_back("sibenik");
        mMeshNames.push_back("cornell");

        mCompositorNames.push_back("SSAO/HemisphereMC");
        mCompositorNames.push_back("SSAO/Volumetric");
        mCompositorNames.push_back("SSAO/HorizonBased");
        mCompositorNames.push_back("SSAO/Crytek");
        mCompositorNames.push_back("SSAO/CreaseShading");
        mCompositorNames.push_back("SSAO/UnsharpMask");
        mCompositorNames.push_back("SSAO/ShowDepth");
        mCompositorNames.push_back("SSAO/ShowNormals");
        mCompositorNames.push_back("SSAO/ShowViewPos");

        mPostNames.push_back("SSAO/Post/NoFilter");
        mPostNames.push_back("SSAO/Post/CrossBilateralFilter");
        mPostNames.push_back("SSAO/Post/SmartBoxFilter");
        mPostNames.push_back("SSAO/Post/BoxFilter");

        mCurrentCompositor = mCompositorNames[0];
        mCurrentPost = mPostNames[0];
    }

    StringVector getRequiredPlugins()
    {
        StringVector names;
        names.push_back("Cg Program Manager");
        return names;
    }

    void testCapabilities(const RenderSystemCapabilities* caps)
    {
        if (!caps->hasCapability(RSC_VERTEX_PROGRAM) || !caps->hasCapability(RSC_FRAGMENT_PROGRAM))
        {
            OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "Your graphics card does not support vertex and fragment"
                        " programs, so you cannot run this sample. Sorry!", "Sample_SSAO::testCapabilities");
        }
    }

protected:
	/**
	 * Setup the compositors to be used.
	 */
    void setupCompositors()
    {

        if (CompositorManager::getSingleton().addCompositor(mViewport, "SSAO/GBuffer"))
            CompositorManager::getSingleton().setCompositorEnabled(mViewport, "SSAO/GBuffer", true);
        else
            LogManager::getSingleton().logMessage("Sample_SSAO: Failed to add GBuffer compositor\n");

        for (unsigned int i = 0; i < mCompositorNames.size(); i++)
        {
            if (CompositorManager::getSingleton().addCompositor(mViewport, mCompositorNames[i]))
                CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCompositorNames[i], false);
            else
                LogManager::getSingleton().logMessage("Sample_SSAO: Failed to add compositor: " + mCompositorNames[i] + "\n");
        }

        for (unsigned int i = 0; i < mPostNames.size(); i++)
        {

            if (CompositorManager::getSingleton().addCompositor(mViewport, mPostNames[i]))
                CompositorManager::getSingleton().setCompositorEnabled(mViewport, mPostNames[i], false);
            else
                LogManager::getSingleton().logMessage("Sample_SSAO: Failed to add " + mPostNames[i] + " compositor\n");
        }

        CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCurrentCompositor, true);
        CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCurrentPost, true);
    }

	/**
	 * Setup the controls, ie. the gui elements.
	 */
    void setupControls(void)
    {
        // --- select mesh menu ---
        SelectMenu* objectType = mTrayMgr->createThickSelectMenu(TL_TOPLEFT, SSAO_OBJECT_MENU_NAME, "Object: ", SSAO_GUI_WIDTH, 16);
        for (unsigned int i = 0; i < mMeshNames.size(); i++)
            objectType->addItem(mMeshNames[i]);

        // --- select camera menu ---
        mCameraMenu = mTrayMgr->createThickSelectMenu(TL_TOPLEFT, SSAO_CAMERA_MENU_NAME, "Camera Position", SSAO_GUI_WIDTH, 16);
        mCameraMenu->addItem(SSAO_USER_CAMERA_ITEM);
        mCameraMenu->addItem(SSAO_CAMERA_CORNELL);
        mCameraMenu->addItem(SSAO_CAMERA_SIBENIK);

        // --- select compositor menu ---
        SelectMenu* compositor = mTrayMgr->createThickSelectMenu(TL_TOPLEFT, SSAO_COMPOSITOR_MENU_NAME, "Compositor: ", SSAO_GUI_WIDTH, 16);
        for (unsigned int i = 0; i < mCompositorNames.size(); i++)
            compositor->addItem(mCompositorNames[i]);

        // --- select post filter menu ---
        SelectMenu * post = mTrayMgr->createThickSelectMenu(TL_TOPLEFT, SSAO_POST_MENU_NAME, "Post Filter: ", SSAO_GUI_WIDTH, 16);
        for (unsigned int i = 0; i < mPostNames.size(); i++)
            post->addItem(mPostNames[i]);

        // --- hemisphere MC sample length exponent --- //
        mSampleLengthExponent = mTrayMgr->createThickSlider(TL_TOPLEFT,
                                                            SSAO_SAMPLE_LENGTH_EXPONENT_NAME,
                                                            "Sample Length Exponent",
                                                            SSAO_GUI_WIDTH,
                                                            SSAO_GUI_VALUE_BOX_WIDTH,
                                                            0,
                                                            5,
                                                            501); // snaps ???

        // --- bilateral photometric exponent ---
        Slider* photometricExponent = mTrayMgr->createThickSlider(TL_TOPLEFT,
                                                                  SSAO_BILATERAL_PHOTOMETRIC_EXPONENT,
                                                                  "Photometric Exponent",
                                                                  SSAO_GUI_WIDTH,
                                                                  SSAO_GUI_VALUE_BOX_WIDTH,
                                                                  0,
                                                                  50,
                                                                  501); // snaps ???
        mBilateralPanel.push_back(photometricExponent);

        // --- crease shading options ---
        Slider* mCreaseMinimumSlider = mTrayMgr->createThickSlider(TL_TOPLEFT,
                                                                   SSAO_CREASE_MINIMUM_NAME,
                                                                   "Minimum Crease",
                                                                   SSAO_GUI_WIDTH,
                                                                   SSAO_GUI_VALUE_BOX_WIDTH,
                                                                   0,
                                                                   1,
                                                                   101); // snaps ???
        mCreasePanel.push_back(mCreaseMinimumSlider);

        Slider* mCreaseRange = mTrayMgr->createThickSlider(TL_TOPLEFT,
                                                           SSAO_CREASE_RANGE_NAME,
                                                           "Crease Range",
                                                           SSAO_GUI_WIDTH,
                                                           SSAO_GUI_VALUE_BOX_WIDTH,
                                                           0,
                                                           10,
                                                           101); // snaps ???
        mCreasePanel.push_back(mCreaseRange);

        Slider* mCreaseBias = mTrayMgr->createThickSlider(TL_TOPLEFT,
                                                          SSAO_CREASE_BIAS_NAME,
                                                          "Bias",
                                                          SSAO_GUI_WIDTH,
                                                          SSAO_GUI_VALUE_BOX_WIDTH,
                                                          0,
                                                          2,
                                                          101); // snaps ???
        mCreasePanel.push_back(mCreaseBias);

        Slider* mCreaseAverager = mTrayMgr->createThickSlider(TL_TOPLEFT,
                                                              SSAO_CREASE_AVERAGER_NAME,
                                                              "Averager",
                                                              SSAO_GUI_WIDTH,
                                                              SSAO_GUI_VALUE_BOX_WIDTH,
                                                              0,
                                                              100,
                                                              101); // snaps ???
        mCreasePanel.push_back(mCreaseAverager);

        Slider* mCreaseKernelsize = mTrayMgr->createThickSlider(TL_TOPLEFT,
                                                                SSAO_CREASE_KERNELSIZE_NAME,
                                                                "Kernel Size Bias",
                                                                SSAO_GUI_WIDTH,
                                                                SSAO_GUI_VALUE_BOX_WIDTH,
                                                                0,
                                                                10,
                                                                101); // snaps ???
        mCreasePanel.push_back(mCreaseKernelsize);

        // --- sample length parameter ---
        mTrayMgr->createSeparator(TL_TOPLEFT, "sep");
        mSamplingCheckbox = mTrayMgr->createCheckBox(TL_TOPLEFT, SSAO_SAMPLE_SPACE_NAME, "Sample in Screen Space", SSAO_GUI_WIDTH);
        mScreenSpaceSlider = mTrayMgr->createThickSlider(TL_TOPLEFT,
                                                         SSAO_SAMPLE_LENGTH_SCREENSPACE,
                                                         "Screen space length (in %)",
                                                         SSAO_GUI_WIDTH,
                                                         SSAO_GUI_VALUE_BOX_WIDTH,
                                                         0,
                                                         100,
                                                         10001);

        mWorldSpaceSlider = mTrayMgr->createThickSlider(TL_TOPLEFT,
                                                        SSAO_SAMPLE_LENGTH_WORLDSPACE,
                                                        "World Space Length (units)",
                                                        SSAO_GUI_WIDTH,
                                                        SSAO_GUI_VALUE_BOX_WIDTH,
                                                        0,
                                                        10,
                                                        10001);

        // --- angle bias ---
        mAngleBiasSlider = mTrayMgr->createThickSlider(TL_TOPLEFT,
                                                       SSAO_ANGLE_BIAS_NAME,
                                                       "Angle Bias (radians)",
                                                       SSAO_GUI_WIDTH,
                                                       SSAO_GUI_VALUE_BOX_WIDTH,
                                                       0,
                                                       Math::HALF_PI,
                                                       1001);

        // --- offset length ---
        mOffsetStepSlider = mTrayMgr->createThickSlider(TL_TOPLEFT,
                                                        SSAO_CRYTEK_OFFSET_SCALE_NAME,
                                                        "Offset Scale (% of sample length)",
                                                        SSAO_GUI_WIDTH,
                                                        SSAO_GUI_VALUE_BOX_WIDTH,
                                                        0,
                                                        100,
                                                        10001);

        // --- crytek edge highlight ---
        mEdgeHighlight = mTrayMgr->createThickSlider(TL_TOPLEFT,
                                                     SSAO_CRYTEK_EDGE_HIGHLIGHT_NAME,
                                                     "Edge Highlight Factor",
                                                     SSAO_GUI_WIDTH,
                                                     SSAO_GUI_VALUE_BOX_WIDTH,
                                                     0,
                                                     1,
                                                     101);

        // --- crytek default accesibility value for invalid samples ---
        mDefaultAccessibility = mTrayMgr->createThickSlider(TL_TOPLEFT,
                                                            SSAO_CRYTEK_DEFAULT_ACCESSIBILITY_NAME,
                                                            "Default Accessibility",
                                                            SSAO_GUI_WIDTH,
                                                            SSAO_GUI_VALUE_BOX_WIDTH,
                                                            0,
                                                            1,
                                                            101);

        // --- unsharp mask kernel bias ---
        Slider* mUnsharpKernelBias = mTrayMgr->createThickSlider(TL_TOPLEFT,
                                                                 SSAO_UNSHARP_KERNEL_BIAS_NAME,
                                                                 "Kernel Size Bias",
                                                                 SSAO_GUI_WIDTH,
                                                                 SSAO_GUI_VALUE_BOX_WIDTH,
                                                                 0,
                                                                 10,
                                                                 101); // snaps ???
        mUnsharpPanel.push_back(mUnsharpKernelBias);

        // --- unsharp mask lambda ---
        Slider* mUnsharpLambda = mTrayMgr->createThickSlider(TL_TOPLEFT,
                                                             SSAO_UNSHARP_LAMBDA_NAME,
                                                             "Unsharp Lambda",
                                                             SSAO_GUI_WIDTH,
                                                             SSAO_GUI_VALUE_BOX_WIDTH,
                                                             0,
                                                             10,
                                                             101); // snaps ???
        mUnsharpPanel.push_back(mUnsharpLambda);

        // setup values
        mCreaseMinimumSlider->setValue(0.2);
        mCreaseRange->setValue(1.0f);
        mCreaseBias->setValue(1.0f);
        mCreaseAverager->setValue(24);
        mCreaseKernelsize->setValue(3.0f);

        mSamplingCheckbox->setChecked(false);
        mScreenSpaceSlider->setValue(6.0f);
        mWorldSpaceSlider->setValue(2.0f);
        mAngleBiasSlider->setValue(0.2f);
        mOffsetStepSlider->setValue(1.0f);
        mEdgeHighlight->setValue(0.0f);
        mDefaultAccessibility->setValue(0.5f);

        mUnsharpKernelBias->setValue(1.0f);
        mUnsharpLambda->setValue(5.0f);

        photometricExponent->setValue(10.0f);

        mSampleLengthExponent->setValue(1.0f);

        mTrayMgr->showCursor();
    }

	/**
	 * Create the scene and load the content.
	 */
    void setupContent()
    {
        mViewport->setBackgroundColour(ColourValue(0.5, 0.5, 0.5, 1));

        // set our camera to orbit around the origin and show cursor
        mCameraMan->setStyle(CS_FREELOOK);
        mCamera->move(Vector3(0, 10, 0));
        mCamera->setFOVy(Radian(Degree(45).valueRadians())); // i.e. 60deg * 1.3.. maya and ogre use fovX and fovY
        mCamera->setFarClipDistance(400);
        mCamera->setNearClipDistance(0.1);
        mTrayMgr->showCursor();

        // sibenik
        mCamera->setPosition(27, 9, -2);
        mCamera->lookAt(Vector3(-6, 2, 1));;

        // setup all meshes
        for (unsigned int i = 0; i < mMeshNames.size(); i++) {
            Entity* ent = mSceneMgr->createEntity(mMeshNames[i], mMeshNames[i] + ".mesh");
            ent->setVisible(false);
            ent->setMaterialName("SSAO/GBuffer");

            mSceneMgr->getRootSceneNode()->attachObject(ent);
            mMeshes.push_back(ent);
        }
        mCurrentMeshIndex = 0;
        mMeshes[mCurrentMeshIndex]->setVisible(true);

        setupCompositors();

        setupControls();

        changeCompositor(mCompositorNames[0]);
        changePost(mPostNames[0]);
    }

	/**
	 * Change the current displayed mesh to the new mesh identified by its index.
	 * @param index The index of the new mesh in the mesh vector.
	 */
    void changeMesh(int index)
    {
        mMeshes[mCurrentMeshIndex]->setVisible(false);
        mMeshes[index]->setVisible(true);
        mCurrentMeshIndex = index;
    }

	/**
	 * Change the compositor to be used.
	 * @param compositor The name of the compositor
	 */
    void changeCompositor(Ogre::String compositor)
    {
        CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCurrentCompositor, false);
        mCurrentCompositor = compositor;
        CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCurrentCompositor, true);

        if (compositor == "SSAO/CreaseShading")
            showPanel(mCreasePanel);
        else
            hidePanel(mCreasePanel);

        if (compositor == "SSAO/UnsharpMask")
            showPanel(mUnsharpPanel);
        else
            hidePanel(mUnsharpPanel);

        if (compositor == "SSAO/Crytek" || compositor == "SSAO/HorizonBased" || compositor == "SSAO/HemisphereMC" || compositor == "SSAO/Volumetric")
        {
            showWidget(mSamplingCheckbox);
            mSamplingCheckbox->setChecked(mSamplingCheckbox->isChecked()); // easy way to update the sliders...
        }
        else
        {
            hideWidget(mSamplingCheckbox);
            hideWidget(mScreenSpaceSlider);
            hideWidget(mWorldSpaceSlider);
        }

        if (compositor == "SSAO/HemisphereMC")
            showWidget(mSampleLengthExponent);
        else
            hideWidget(mSampleLengthExponent);

        if (compositor == "SSAO/HorizonBased")
            showWidget(mAngleBiasSlider);
        else
            hideWidget(mAngleBiasSlider);

        if (compositor == "SSAO/Crytek")
        {
            showWidget(mOffsetStepSlider);
            showWidget(mEdgeHighlight);
            showWidget(mDefaultAccessibility);
        }
        else
        {
            hideWidget(mOffsetStepSlider);
            hideWidget(mEdgeHighlight);
            hideWidget(mDefaultAccessibility);
        }
    }

	/**
	 * Change the post filter to be used.
	 * @param post The name of the new post processing filter.
	 */
    void changePost(Ogre::String post)
    {
        CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCurrentPost, false);
        mCurrentPost = post;
        CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCurrentPost, true);

        if (post == "SSAO/Post/CrossBilateralFilter")
            showPanel(mBilateralPanel);
        else
            hidePanel(mBilateralPanel);
    }

	// sdkTray listener callbacks
    void itemSelected(SelectMenu* menu)
    {
        if (menu->getName() == SSAO_OBJECT_MENU_NAME)
            changeMesh(menu->getSelectionIndex());

        else if (menu->getName() == SSAO_COMPOSITOR_MENU_NAME)
            changeCompositor(menu->getSelectedItem());

        else if (menu->getName() == SSAO_POST_MENU_NAME)
            changePost(menu->getSelectedItem());

        else if (menu->getName() == SSAO_CAMERA_MENU_NAME)
        {
            if (menu->getSelectedItem() == SSAO_CAMERA_SIBENIK)
            {
                mCamera->setPosition(27, 9, -2);
                mCamera->lookAt(Vector3(-6, 2, 1));
            }
            else if (menu->getSelectedItem() == SSAO_CAMERA_CORNELL)
            {
                mCamera->setPosition(0, 5, 20);
                mCamera->lookAt(Vector3(0, 5, 0));
            }
        }
    }

    void sliderMoved(Slider* slider)
    {
        if (slider->getName() == SSAO_CREASE_MINIMUM_NAME)
            setUniform("SSAO/CreaseShading", "SSAO/CreaseShading", "cMinimumCrease", slider->getValue(), false, 1);

        else if (slider->getName() == SSAO_CREASE_BIAS_NAME)
            setUniform("SSAO/CreaseShading", "SSAO/CreaseShading", "cBias", slider->getValue(), false, 1);

        else if (slider->getName() == SSAO_CREASE_AVERAGER_NAME)
            setUniform("SSAO/CreaseShading", "SSAO/CreaseShading", "cAverager", slider->getValue(), false, 1);

        else if (slider->getName() == SSAO_CREASE_RANGE_NAME)
            setUniform("SSAO/CreaseShading", "SSAO/CreaseShading", "cRange", slider->getValue() * slider->getValue(), false, 1);

        else if (slider->getName() == SSAO_CREASE_KERNELSIZE_NAME)
            setUniform("SSAO/CreaseShading", "SSAO/CreaseShading", "cKernelSize", slider->getValue(), false, 1);

        else if (slider->getName() == SSAO_SAMPLE_LENGTH_SCREENSPACE)
        {
            setUniform("SSAO/Crytek", "SSAO/Crytek", "cSampleLengthScreenSpace", slider->getValue()/100.0f, false, 1);
            setUniform("SSAO/HorizonBased", "SSAO/HorizonBased", "cSampleLengthScreenSpace", slider->getValue()/100.0f, false, 1);
            setUniform("SSAO/HemisphereMC", "SSAO/HemisphereMC", "cSampleLengthScreenSpace", slider->getValue()/100.0f, false, 1);
            setUniform("SSAO/Volumetric", "SSAO/Volumetric", "cSampleLengthScreenSpace", slider->getValue()/100.0f, false, 1);
        }
        else if (slider->getName() == SSAO_SAMPLE_LENGTH_WORLDSPACE)
        {
            setUniform("SSAO/Crytek", "SSAO/Crytek", "cSampleLengthWorldSpace", slider->getValue(), false, 1);
            setUniform("SSAO/HorizonBased", "SSAO/HorizonBased", "cSampleLengthWorldSpace", slider->getValue(), false, 1);
            setUniform("SSAO/HemisphereMC", "SSAO/HemisphereMC", "cSampleLengthWorldSpace", slider->getValue(), false, 1);
            setUniform("SSAO/Volumetric", "SSAO/Volumetric", "cSampleLengthWorldSpace", slider->getValue(), false, 1);
        }

        else if (slider->getName() == SSAO_ANGLE_BIAS_NAME)
            setUniform("SSAO/HorizonBased", "SSAO/HorizonBased", "cAngleBias", slider->getValue(), false, 1);

        else if (slider->getName() == SSAO_CRYTEK_OFFSET_SCALE_NAME)
            setUniform("SSAO/Crytek", "SSAO/Crytek", "cOffsetScale", slider->getValue()/100, false, 1);

        else if (slider->getName() == SSAO_CRYTEK_EDGE_HIGHLIGHT_NAME)
            setUniform("SSAO/Crytek", "SSAO/Crytek", "cEdgeHighlight", 2.0f - slider->getValue(), false, 1);

        else if (slider->getName() == SSAO_CRYTEK_DEFAULT_ACCESSIBILITY_NAME)
            setUniform("SSAO/Crytek", "SSAO/Crytek", "cDefaultAccessibility", slider->getValue(), false, 1);

        else if (slider->getName() == SSAO_UNSHARP_KERNEL_BIAS_NAME)
        {
            setUniform("SSAO/UnsharpMask", "SSAO/UnsharpMask/GaussianBlurY", "cKernelWidthBias", slider->getValue(), false, 1);
            setUniform("SSAO/UnsharpMask", "SSAO/UnsharpMask/GaussianBlurX", "cKernelWidthBias", slider->getValue(), false, 1);
        }

        else if (slider->getName() == SSAO_UNSHARP_LAMBDA_NAME)
            setUniform("SSAO/UnsharpMask", "SSAO/UnsharpMask", "cLambda", slider->getValue() * slider->getValue(), false, 1);

        else if (slider->getName() == SSAO_BILATERAL_PHOTOMETRIC_EXPONENT)
        {
            setUniform("SSAO/Post/CrossBilateralFilter", "SSAO/HorizonBased/CrossBilateralFilter/X", "cPhotometricExponent", slider->getValue(), false);
            setUniform("SSAO/Post/CrossBilateralFilter", "SSAO/HorizonBased/CrossBilateralFilter/Y", "cPhotometricExponent", slider->getValue(), false);
        }

        else if(slider->getName() == SSAO_SAMPLE_LENGTH_EXPONENT_NAME)
            setUniform("SSAO/HemisphereMC", "SSAO/HemisphereMC", "cSampleLengthExponent", slider->getValue(), false, 1);

        CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCurrentCompositor, true);
        CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCurrentPost, true);
    }

    void checkBoxToggled(OgreBites::CheckBox *box)
    {
        if (box->getName() == SSAO_SAMPLE_SPACE_NAME)
        {
            setUniform("SSAO/Crytek", "SSAO/Crytek", "cSampleInScreenspace", box->isChecked(), false, 1);
            setUniform("SSAO/HorizonBased", "SSAO/HorizonBased", "cSampleInScreenspace", box->isChecked(), false, 1);
            setUniform("SSAO/HemisphereMC", "SSAO/HemisphereMC", "cSampleInScreenspace", box->isChecked(), false, 1);
            setUniform("SSAO/Volumetric", "SSAO/Volumetric", "cSampleInScreenspace", box->isChecked(), false, 1);
            CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCurrentCompositor, true);

            if (box->isChecked()) // we sample in screen space
            {
                mTrayMgr->removeWidgetFromTray(mWorldSpaceSlider);
                mWorldSpaceSlider->hide();
                mTrayMgr->moveWidgetToTray(mScreenSpaceSlider, TL_TOPLEFT);
                mScreenSpaceSlider->show();
            }
            else
            {
                mTrayMgr->removeWidgetFromTray(mScreenSpaceSlider);
                mScreenSpaceSlider->hide();
                mTrayMgr->moveWidgetToTray(mWorldSpaceSlider, TL_TOPLEFT);
                mWorldSpaceSlider->show();
            }
        }
    }

	// The following three methods are for mouse input
	/** @see Sample::mousePressed. */
#if (OGRE_PLATFORM != OGRE_PLATFORM_APPLE_IOS) && (OGRE_PLATFORM != OGRE_PLATFORM_ANDROID)

    bool mousePressed( const OIS::MouseEvent& evt, OIS::MouseButtonID id )
    {
        if (mTrayMgr->injectMouseDown(evt, id))
            return true;
        if (id == OIS::MB_Left)
            mTrayMgr->hideCursor();  // hide the cursor if user left-clicks in the scene

        return true;
    }

	/** @see Sample::mouseReleased. */
    bool mouseReleased( const OIS::MouseEvent& evt, OIS::MouseButtonID id )
    {
        if (mTrayMgr->injectMouseUp(evt, id))
            return true;
        if (id == OIS::MB_Left)
            mTrayMgr->showCursor();  // unhide the cursor if user lets go of LMB

        return true;
    }

	/** @see Sample::mouseMoved. */
    bool mouseMoved( const OIS::MouseEvent& evt )
    {
        // only rotate the camera if cursor is hidden
        if (mTrayMgr->isCursorVisible())
            mTrayMgr->injectMouseMove(evt);
        else
        {
            mCameraMan->injectMouseMove(evt);
            mCameraMenu->selectItem(SSAO_USER_CAMERA_ITEM);
        }

        return true;
    }
#endif
	/**
	 * Set the uniform value in the compositor
	 * @param compositor The name of the compositor
	 * @param material The material that contains the uniform
	 * @param uniform The name of the uniform parameter
	 * @param value The value
	 * @param setVisible Whether to set the compositor to visible or not.
	 * @param position The position at which the compositor should be added again.
	 * defaults to -1, which means that the compositor is readded at the end of the chain.
	 */
    void setUniform(Ogre::String compositor, Ogre::String material, Ogre::String uniform, float value, bool setVisible, int position = -1)
    {
        // remove compositor first???
        CompositorManager::getSingleton().removeCompositor(mViewport, compositor);

        (static_cast<MaterialPtr>(MaterialManager::getSingleton().getByName(material)))->getTechnique(0)->
            getPass(0)->getFragmentProgramParameters()->setNamedConstant(uniform, value);

        // adding again
        CompositorManager::getSingleton().addCompositor(mViewport, compositor, position);
        CompositorManager::getSingleton().setCompositorEnabled(mViewport, compositor, setVisible);
    }
};

#endif /* __SSAO_H__ */


text:
from .base import *

DEBUG = True
COMPRESS_ENABLED = True

env = os.environ.copy()
SECRET_KEY = env['SECRET_KEY']

# DEFAULT_FILE_STORAGE = 'storages.backends.dropbox.DropBoxStorage'
#
# DROPBOX_OAUTH2_TOKEN = env['DROPBOX_OAUTH2_TOKEN']
# DROPBOX_ROOT_PATH = '/masterbrick/'

# Parse database configuration from $DATABASE_URL
import dj_database_url
DATABASES['default'] =  dj_database_url.config()

STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

WAGTAILSEARCH_BACKENDS = {
    'default': {
        'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch',
        'INDEX': 'wagtaildemo'
    }
}

CACHES = {
    'default': {
        'BACKEND': 'redis_cache.cache.RedisCache',
        'LOCATION': '127.0.0.1:6379',
        'KEY_PREFIX': 'wagtaildemo',
        'OPTIONS': {
            'CLIENT_CLASS': 'redis_cache.client.DefaultClient',
        }
    }
}

# Use the cached template loader
TEMPLATE_LOADERS = (
    ('django.template.loaders.cached.Loader', (
        'django.template.loaders.filesystem.Loader',
        'django.template.loaders.app_directories.Loader',
    )),
)

try:
    from .local import *
except ImportError:
    pass


text:
from pyvisdk.base.managed_object_types import ManagedObjectTypes

from pyvisdk.mo.extensible_managed_object import ExtensibleManagedObject

import logging

########################################
# Automatically generated, do not edit.
########################################

log = logging.getLogger(__name__)

class HostVMotionSystem(ExtensibleManagedObject):
    '''The VMotionSystem managed object describes the VMotion configuration of the
    host.'''

    def __init__(self, core, name=None, ref=None, type=ManagedObjectTypes.HostVMotionSystem):
        super(HostVMotionSystem, self).__init__(core, name=name, ref=ref, type=type)

    @property
    def ipConfig(self):
        '''IP configuration of the VMotion VirtualNic.'''
        return self.update('ipConfig')
    @property
    def netConfig(self):
        '''VMotion network configuration.'''
        return self.update('netConfig')

    def DeselectVnic(self):
        '''Indicate that no VirtualNic should be used for VMotion.

        '''
        return self.delegate("DeselectVnic")()

    def SelectVnic(self, device):
        '''Select the VirtualNic to be used for VMotion.

        :param device: The device that uniquely identifies the VirtualNic.

        '''
        return self.delegate("SelectVnic")(device)

    def UpdateIpConfig(self, ipConfig):
        '''Update the IP configuration of VMotion VirtualNic.

        :param ipConfig:

        '''
        return self.delegate("UpdateIpConfig")(ipConfig)


text:
<?php

namespace SMW\Maintenance;

use SMWExportController as ExportController;
use SMWRDFXMLSerializer as RDFXMLSerializer;

$basePath = getenv( 'MW_INSTALL_PATH' ) !== false ? getenv( 'MW_INSTALL_PATH' ) : __DIR__ . '/../../..';

require_once $basePath . '/maintenance/Maintenance.php';

/**
 * Usage:
 * php dumpRDF.php [options...]
 *
 * --file (-o) <file> Export everything to given output file, stdout is used if omitted;
 *                    file output is generally better and strongly recommended for large wikis
 * --categories       Export only categories
 * --concepts         Export only concepts
 * --classes          Export only concepts and categories
 * --properties       Export only properties
 * --types            Export only types
 * --individuals      Export only pages that are no categories, properties, or types
 * --page <pagelist>  Export only pages included in the <pagelist> with | being used as a separator.
 *                    Example: --page "Page 1|Page 2", -e, -file, -d are ignored if --page is given.
 * -d <delay>         Slows down the export in order to stress the server less,
 *                    sleeping for <delay> milliseconds every now and then
 * -e <each>          After how many exported entities should the process take a nap?
 * --server=<server>  The protocol and server name to as base URLs, e.g.
 *                    https://en.wikipedia.org. This is sometimes necessary because
 *                    server name detection may fail in command line scripts.
 *
 * @ingroup SMWMaintenance
 *
 * @license GNU GPL v2+
 * @since 2.0
 *
 * @author Markus Krötzsch
 * @author mwjames
 */
class DumpRdf extends \Maintenance {

	private $delay = 0;
	private $delayeach = 0;

	/**
	 * @var boolean|array
	 */
	private $restrictNamespaceTo = false;

	/**
	 * @var array
	 */
	private $pages = array();

	/**
	 * @since 2.0
	 */
	public function __construct() {
		parent::__construct();

		$this->addDescription( "\n" ."Complete RDF export of existing triples. \n" );
		$this->addDefaultParams();
	}

	/**
	 * @see Maintenance::addDefaultParams
	 *
	 * @since 2.0
	 */
	protected function addDefaultParams() {

		$this->addOption( 'd', '<delay> Wait for this many milliseconds after processing, useful for limiting server load.', false, true );
		$this->addOption( 'e', '<each> after how many exported entities should the process take a nap.', false, true );
		$this->addOption( 'file', '<file> output file.', false, true, 'o' );

		$this->addOption( 'categories', 'Export only categories', false );
		$this->addOption( 'concepts', 'Export only concepts', false );
		$this->addOption( 'classes', 'Export only classes', false );
		$this->addOption( 'properties', 'Export only properties', false );
		$this->addOption( 'types', 'Export only types', false );
		$this->addOption( 'individuals', 'Export only individuals', false );

		$this->addOption( 'page', 'Export only pages included in the <pagelist> with | being used as a separator. ' .
								'Example: --page "Page 1|Page 2", -e, -file, -d are ignored if --page is given.', false, true );

		$this->addOption( 'server', '<server> The protocol and server name to as base URLs, e.g. http://en.wikipedia.org. ' .
								'This is sometimes necessary because server name detection may fail in command line scripts.', false, true );

		$this->addOption( 'quiet', 'Do not give any output', false, false, 'q' );
	}

	/**
	 * @see Maintenance::execute
	 *
	 * @since 2.0
	 */
	public function execute() {

		if ( !defined( 'SMW_VERSION' ) ) {
			$this->output( "You need to have SMW enabled in order to use this maintenance script!\n\n" );
			exit;
		}

		$this->reportMessage( "\nWriting OWL/RDF dump to " . $this->getOption( 'file' ) . " ...\n" );
		$this->setParameters()->exportRdfToOutputChannel();

		return true;
	}

	/**
	 * @see Maintenance::reportMessage
	 *
	 * @since 2.0
	 *
	 * @param string $message
	 */
	public function reportMessage( $message ) {
		$this->output( $message );
	}

	private function setParameters() {

		if ( $this->hasOption( 'd' ) ) {
			$this->delay = intval( $this->getOption( 'd' ) ) * 1000;
		}

		$this->delayeach = ( $this->delay === 0 ) ? 0 : 1;

		if ( $this->hasOption( 'e' ) ) {
			$this->delayeach = intval( $this->getOption( 'e' )  );
		}

		if ( $this->hasOption( 'categories' ) ) {
			$this->restrictNamespaceTo = NS_CATEGORY;
		} elseif ( $this->hasOption( 'concepts' ) ) {
			$this->restrictNamespaceTo = SMW_NS_CONCEPT;
		} elseif ( $this->hasOption( 'classes' ) ) {
			$this->restrictNamespaceTo = array( NS_CATEGORY, SMW_NS_CONCEPT );
		} elseif ( $this->hasOption( 'properties' ) ) {
			$this->restrictNamespaceTo = SMW_NS_PROPERTY;
		} elseif ( $this->hasOption( 'types' ) ) {
			$this->restrictNamespaceTo = SMW_NS_TYPE;
		} elseif ( $this->hasOption( 'individuals' ) ) {
			$this->restrictNamespaceTo = - 1;
		}

		if ( $this->hasOption( 'page' ) ) {
			$this->pages = explode( '|', $this->getOption( 'page' ) );
		}

		if ( $this->hasOption( 'server' ) ) {
			$GLOBALS['wgServer'] = $this->getOption( 'server' );
		}

		return $this;
	}

	private function exportRdfToOutputChannel() {

		$exportController = new ExportController( new RDFXMLSerializer() );

		if ( $this->pages !== array() ) {
			return $exportController->printPages(
				$this->pages
			);
		}

		if ( $this->hasOption( 'file' ) ) {
			return $exportController->printAllToFile(
				$this->getOption( 'file' ),
				$this->restrictNamespaceTo,
				$this->delay,
				$this->delayeach
			);
		}

		$exportController->printAllToOutput(
			$this->restrictNamespaceTo,
			$this->delay,
			$this->delayeach
		);
	}

}

$maintClass = 'SMW\Maintenance\DumpRdf';
require_once ( RUN_MAINTENANCE_IF_MAIN );


text:
@interface DCData_FriendListInfo : NSObject
@property (nonatomic, assign) NSInteger fid; //好友id
@property (nonatomic, strong) NSString *nickname; //昵称
@property (nonatomic, strong) NSString *icon; //头像url
@property (nonatomic, assign) NSInteger sex; //性别 1=男;2=女
@property (nonatomic, strong) NSString  *tel; //电话号码
@property (nonatomic, strong) NSString *email;
@property (nonatomic, strong) NSString *username;
@property (nonatomic, assign) bool  isFriend;

@end

@interface DCData_FriendList : HDNetServiceObject
@property (nonatomic, strong) NSArray *friendArray;
@end

@interface DCData_FriendListParam : NSObject
@property (nonatomic, strong) DriveCloudUser *user;
@property (nonatomic, strong) NSString *fkey; //搜索关键字
@property (nonatomic, assign) int flag; //查询方式,0=所有人1=好友
@property (nonatomic, assign) int pageNumber; //页码
@end

@interface DCDataCtrl_FriendList : HDNetServiceCtrl
@property (nonatomic, strong, readonly) DCData_FriendList *data;
@property (nonatomic, strong, readonly) DCData_FriendListParam *param;
@end


text:
package repo

import (
	"context"
	"fmt"
	"net/url"
	"path"

	"code.gitea.io/gitea/models/db"
	"code.gitea.io/gitea/modules/setting"
	"code.gitea.io/gitea/modules/storage"
	"code.gitea.io/gitea/modules/timeutil"
	"code.gitea.io/gitea/modules/util"
)

// Attachment represent a attachment of issue/comment/release.
type Attachment struct {
	ID            int64  `xorm:"pk autoincr"`
	UUID          string `xorm:"uuid UNIQUE"`
	RepoID        int64  `xorm:"INDEX"`           // this should not be zero
	IssueID       int64  `xorm:"INDEX"`           // maybe zero when creating
	ReleaseID     int64  `xorm:"INDEX"`           // maybe zero when creating
	UploaderID    int64  `xorm:"INDEX DEFAULT 0"` // Notice: will be zero before this column added
	CommentID     int64
	Name          string
	DownloadCount int64              `xorm:"DEFAULT 0"`
	Size          int64              `xorm:"DEFAULT 0"`
	CreatedUnix   timeutil.TimeStamp `xorm:"created"`
}

func init() {
	db.RegisterModel(new(Attachment))
}

// IncreaseDownloadCount is update download count + 1
func (a *Attachment) IncreaseDownloadCount() error {
	// Update download count.
	if _, err := db.GetEngine(db.DefaultContext).Exec("UPDATE `attachment` SET download_count=download_count+1 WHERE id=?", a.ID); err != nil {
		return fmt.Errorf("increase attachment count: %w", err)
	}

	return nil
}

// AttachmentRelativePath returns the relative path
func AttachmentRelativePath(uuid string) string {
	return path.Join(uuid[0:1], uuid[1:2], uuid)
}

// RelativePath returns the relative path of the attachment
func (a *Attachment) RelativePath() string {
	return AttachmentRelativePath(a.UUID)
}

// DownloadURL returns the download url of the attached file
func (a *Attachment) DownloadURL() string {
	return setting.AppURL + "attachments/" + url.PathEscape(a.UUID)
}

//    _____   __    __                .__                           __
//   /  _  \_/  |__/  |______    ____ |  |__   _____   ____   _____/  |_
//  /  /_\  \   __\   __\__  \ _/ ___\|  |  \ /     \_/ __ \ /    \   __\
// /    |    \  |  |  |  / __ \\  \___|   Y  \  Y Y  \  ___/|   |  \  |
// \____|__  /__|  |__| (____  /\___  >___|  /__|_|  /\___  >___|  /__|
//         \/                \/     \/     \/      \/     \/     \/

// ErrAttachmentNotExist represents a "AttachmentNotExist" kind of error.
type ErrAttachmentNotExist struct {
	ID   int64
	UUID string
}

// IsErrAttachmentNotExist checks if an error is a ErrAttachmentNotExist.
func IsErrAttachmentNotExist(err error) bool {
	_, ok := err.(ErrAttachmentNotExist)
	return ok
}

func (err ErrAttachmentNotExist) Error() string {
	return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
}

func (err ErrAttachmentNotExist) Unwrap() error {
	return util.ErrNotExist
}

// GetAttachmentByID returns attachment by given id
func GetAttachmentByID(ctx context.Context, id int64) (*Attachment, error) {
	attach := &Attachment{}
	if has, err := db.GetEngine(ctx).ID(id).Get(attach); err != nil {
		return nil, err
	} else if !has {
		return nil, ErrAttachmentNotExist{ID: id, UUID: ""}
	}
	return attach, nil
}

// GetAttachmentByUUID returns attachment by given UUID.
func GetAttachmentByUUID(ctx context.Context, uuid string) (*Attachment, error) {
	attach := &Attachment{}
	has, err := db.GetEngine(ctx).Where("uuid=?", uuid).Get(attach)
	if err != nil {
		return nil, err
	} else if !has {
		return nil, ErrAttachmentNotExist{0, uuid}
	}
	return attach, nil
}

// GetAttachmentsByUUIDs returns attachment by given UUID list.
func GetAttachmentsByUUIDs(ctx context.Context, uuids []string) ([]*Attachment, error) {
	if len(uuids) == 0 {
		return []*Attachment{}, nil
	}

	// Silently drop invalid uuids.
	attachments := make([]*Attachment, 0, len(uuids))
	return attachments, db.GetEngine(ctx).In("uuid", uuids).Find(&attachments)
}

// ExistAttachmentsByUUID returns true if attachment exists with the given UUID
func ExistAttachmentsByUUID(ctx context.Context, uuid string) (bool, error) {
	return db.GetEngine(ctx).Where("`uuid`=?", uuid).Exist(new(Attachment))
}

// GetAttachmentsByIssueID returns all attachments of an issue.
func GetAttachmentsByIssueID(ctx context.Context, issueID int64) ([]*Attachment, error) {
	attachments := make([]*Attachment, 0, 10)
	return attachments, db.GetEngine(ctx).Where("issue_id = ? AND comment_id = 0", issueID).Find(&attachments)
}

// GetAttachmentsByCommentID returns all attachments if comment by given ID.
func GetAttachmentsByCommentID(ctx context.Context, commentID int64) ([]*Attachment, error) {
	attachments := make([]*Attachment, 0, 10)
	return attachments, db.GetEngine(ctx).Where("comment_id=?", commentID).Find(&attachments)
}

// GetAttachmentByReleaseIDFileName returns attachment by given releaseId and fileName.
func GetAttachmentByReleaseIDFileName(ctx context.Context, releaseID int64, fileName string) (*Attachment, error) {
	attach := &Attachment{ReleaseID: releaseID, Name: fileName}
	has, err := db.GetEngine(ctx).Get(attach)
	if err != nil {
		return nil, err
	} else if !has {
		return nil, err
	}
	return attach, nil
}

// DeleteAttachment deletes the given attachment and optionally the associated file.
func DeleteAttachment(a *Attachment, remove bool) error {
	_, err := DeleteAttachments(db.DefaultContext, []*Attachment{a}, remove)
	return err
}

// DeleteAttachments deletes the given attachments and optionally the associated files.
func DeleteAttachments(ctx context.Context, attachments []*Attachment, remove bool) (int, error) {
	if len(attachments) == 0 {
		return 0, nil
	}

	ids := make([]int64, 0, len(attachments))
	for _, a := range attachments {
		ids = append(ids, a.ID)
	}

	cnt, err := db.GetEngine(ctx).In("id", ids).NoAutoCondition().Delete(attachments[0])
	if err != nil {
		return 0, err
	}

	if remove {
		for i, a := range attachments {
			if err := storage.Attachments.Delete(a.RelativePath()); err != nil {
				return i, err
			}
		}
	}
	return int(cnt), nil
}

// DeleteAttachmentsByIssue deletes all attachments associated with the given issue.
func DeleteAttachmentsByIssue(issueID int64, remove bool) (int, error) {
	attachments, err := GetAttachmentsByIssueID(db.DefaultContext, issueID)
	if err != nil {
		return 0, err
	}

	return DeleteAttachments(db.DefaultContext, attachments, remove)
}

// DeleteAttachmentsByComment deletes all attachments associated with the given comment.
func DeleteAttachmentsByComment(commentID int64, remove bool) (int, error) {
	attachments, err := GetAttachmentsByCommentID(db.DefaultContext, commentID)
	if err != nil {
		return 0, err
	}

	return DeleteAttachments(db.DefaultContext, attachments, remove)
}

// UpdateAttachmentByUUID Updates attachment via uuid
func UpdateAttachmentByUUID(ctx context.Context, attach *Attachment, cols ...string) error {
	if attach.UUID == "" {
		return fmt.Errorf("attachment uuid should be not blank")
	}
	_, err := db.GetEngine(ctx).Where("uuid=?", attach.UUID).Cols(cols...).Update(attach)
	return err
}

// UpdateAttachment updates the given attachment in database
func UpdateAttachment(ctx context.Context, atta *Attachment) error {
	sess := db.GetEngine(ctx).Cols("name", "issue_id", "release_id", "comment_id", "download_count")
	if atta.ID != 0 && atta.UUID == "" {
		sess = sess.ID(atta.ID)
	} else {
		// Use uuid only if id is not set and uuid is set
		sess = sess.Where("uuid = ?", atta.UUID)
	}
	_, err := sess.Update(atta)
	return err
}

// DeleteAttachmentsByRelease deletes all attachments associated with the given release.
func DeleteAttachmentsByRelease(ctx context.Context, releaseID int64) error {
	_, err := db.GetEngine(ctx).Where("release_id = ?", releaseID).Delete(&Attachment{})
	return err
}

// CountOrphanedAttachments returns the number of bad attachments
func CountOrphanedAttachments(ctx context.Context) (int64, error) {
	return db.GetEngine(ctx).Where("(issue_id > 0 and issue_id not in (select id from issue)) or (release_id > 0 and release_id not in (select id from `release`))").
		Count(new(Attachment))
}

// DeleteOrphanedAttachments delete all bad attachments
func DeleteOrphanedAttachments(ctx context.Context) error {
	_, err := db.GetEngine(ctx).Where("(issue_id > 0 and issue_id not in (select id from issue)) or (release_id > 0 and release_id not in (select id from `release`))").
		Delete(new(Attachment))
	return err
}