text:
<?php

namespace Th3Mouk\CMSSiteplanBundle\Menu;

use Knp\Menu\FactoryInterface;
use Sonata\PageBundle\Model\PageInterface;
use Sonata\PageBundle\Model\PageManagerInterface;
use Sonata\PageBundle\Site\SiteSelectorInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Th3Mouk\CMSSiteplanBundle\Event\MenuPlanEvent;

class BasePlanBuilder
{
    /**
     * @var FactoryInterface
     */
    protected $factory;

    /**
     * @var SiteSelectorInterface
     */
    protected $site_selector;

    /**
     * @var PageManagerInterface
     */
    protected $page_manager;

    /**
     * @var EventDispatcherInterface
     */
    protected $event_dispatcher;

    /**
     * @param FactoryInterface $factory
     */
    public function __construct(
        FactoryInterface $factory,
        SiteSelectorInterface $site_selector,
        PageManagerInterface $page_manager,
        EventDispatcherInterface $event_dispatcher
    ) {
        $this->factory = $factory;
        $this->site_selector = $site_selector;
        $this->page_manager = $page_manager;
        $this->event_dispatcher = $event_dispatcher;
    }

    public function createPlanMenu()
    {
        $menu = $this->factory->createItem('root');

        $this->event_dispatcher->dispatch(
            MenuPlanEvent::BEFORE_GENERATION,
            new MenuPlanEvent($this->factory, $menu)
        );

        $this->generatePageMenu($menu);

        $this->event_dispatcher->dispatch(
            MenuPlanEvent::AFTER_GENERATION,
            new MenuPlanEvent($this->factory, $menu)
        );

        return $menu;
    }

    public function generatePageMenu($menu)
    {
        $site = $this->site_selector->retrieve();
        $page = $this->page_manager->getPageByUrl($site, '/');

        $menu->addChild($page->getName(), array(
            'route' => $page->getRouteName(),
            'routeParameters' => array('path' => $page->getUrl()),
        ));

        if (!$page) {
            return false;
        }

        $this->iterate($menu[$page->getName()], $page);
    }

    public function iterate($menu, PageInterface $page)
    {
        foreach ($page->getChildren() as $page) {
            if ($page->isHybrid() || !$page->getUrl()) {
                continue;
            }

            $menu->addChild($page->getName(), array(
                'route' => $page->getRouteName(),
                'routeParameters' => array('path' => $page->getUrl()),
            ));

            if ($page->getChildren()) {
                $this->iterate($menu[$page->getName()], $page);
            }
        }
    }
}


text:
/**
 * @author cdr
 */
package com.intellij.packaging.impl.ui.actions;

import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.application.Result;
import com.intellij.openapi.compiler.CompilerBundle;
import com.intellij.openapi.compiler.CompilerManager;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Clock;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.WindowManager;
import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.impl.artifacts.ArtifactBySourceFileFinder;
import com.intellij.util.text.SyncDateFormat;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class PackageFileAction extends AnAction {
  private static final SyncDateFormat TIME_FORMAT = new SyncDateFormat(new SimpleDateFormat("h:mm:ss a"));

  public PackageFileAction() {
    super(CompilerBundle.message("action.name.package.file"), CompilerBundle.message("action.description.package.file"), null);
  }

  @Override
  public void update(AnActionEvent e) {
    boolean visible = false;
    final Project project = e.getData(PlatformDataKeys.PROJECT);
    if (project != null) {
      final List<VirtualFile> files = getFilesToPackage(e, project);
      if (!files.isEmpty()) {
        visible = true;
        e.getPresentation().setText(files.size() == 1 ? CompilerBundle.message("action.name.package.file") : CompilerBundle.message("action.name.package.files"));
      }
    }

    e.getPresentation().setVisible(visible);
  }

  @NotNull
  private static List<VirtualFile> getFilesToPackage(@NotNull AnActionEvent e, @NotNull Project project) {
    final VirtualFile[] files = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
    if (files == null) return Collections.emptyList();

    List<VirtualFile> result = new ArrayList<VirtualFile>();
    ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
    final CompilerManager compilerManager = CompilerManager.getInstance(project);
    for (VirtualFile file : files) {
      if (file == null || file.isDirectory() ||
          fileIndex.isInSourceContent(file) && compilerManager.isCompilableFileType(file.getFileType())) {
        return Collections.emptyList();
      }
      final Collection<? extends Artifact> artifacts = ArtifactBySourceFileFinder.getInstance(project).findArtifacts(file);
      for (Artifact artifact : artifacts) {
        if (!StringUtil.isEmpty(artifact.getOutputPath())) {
          result.add(file);
          break;
        }
      }
    }
    return result;
  }

  @Override
  public void actionPerformed(AnActionEvent event) {
    final Project project = event.getData(PlatformDataKeys.PROJECT);
    if (project == null) return;

    FileDocumentManager.getInstance().saveAllDocuments();
    final List<VirtualFile> files = getFilesToPackage(event, project);
    ProgressManager.getInstance().run(new Task.Backgroundable(project, "Packaging Files") {
      @Override
      public void run(@NotNull ProgressIndicator indicator) {
        for (final VirtualFile file : files) {
          indicator.checkCanceled();
          new ReadAction() {
            protected void run(final Result result) {
              try {
                PackageFileWorker.packageFile(file, project);
              }
              catch (IOException e) {
                Notifications.Bus.notify(
                  new Notification("Package File", "Cannot package file", CompilerBundle.message("message.tect.package.file.io.error", e.toString()),
                                   NotificationType.ERROR));
              }
            }
          }.execute();
        }
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          public void run() {
            setStatusText(project, files);
          }
        });
      }
    });
  }

  private static void setStatusText(Project project, List<VirtualFile> files) {
    if (!files.isEmpty()) {
      StringBuilder fileNames = new StringBuilder();
      for (VirtualFile file : files) {
        if (fileNames.length() != 0) fileNames.append(", ");
        fileNames.append("'").append(file.getName()).append("'");
      }
      String time = TIME_FORMAT.format(Clock.getTime());
      final String statusText = CompilerBundle.message("status.text.file.has.been.packaged", files.size(), fileNames, time);
      WindowManager.getInstance().getStatusBar(project).setInfo(statusText);
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
SRC_DIR=.

all: clean sloc test flakes lint clone

# almost direct translation of travis script
before_install:
	apt-get update;
	if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
	wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
	elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
	wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
	elif [[ "$TRAVIS_OS_NAME" == "osx" && "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
	wget https://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh -O miniconda.sh;
	elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
	wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
	else
	echo "Invalid combination of OS ($TRAVIS_OS_NAME) and Python version ($TRAVIS_PYTHON_VERSION)";
	fi
	chmod +x miniconda.sh
	bash miniconda.sh -b -p $HOME/miniconda
	export PATH="$HOME/miniconda/bin:$PATH"
	hash -r
	conda config --set always_yes yes --set changeps1 no
	conda update -q conda
	# Useful for debugging any issues with conda
	conda info -a
	# The next lines fix a crash with multiprocessing on Travis and are not specific to using Miniconda
	sudo rm -rf /dev/shm
	sudo ln -s /run/shm /dev/shm
	# starts gui support, see https://docs.travis-ci.com/user/gui-and-headless-browsers/
	# and https://github.com/travis-ci/travis-ci/issues/7313#issuecomment-279914149 (for MacOSX)
	# formerly "sh -e sudo Xvfb :99 -ac -screen 0 1024x768x8";
	export DISPLAY=":99.0"
	if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
	sh -e /etc/init.d/xvfb start;
	fi
	if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
	Xvfb :98 -ac -screen 0 1024x768x8;
	fi &
	# give it some time to start
	sleep 3
	conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy paramiko pandas nose pip pyqt qtpy
	source activate test-environment
	# convert readme file to rst for PyPI
	conda install pandoc
	pandoc --from=markdown --to=rst --output=README.rst README.md
	# overwrite default global config file with a custom one for travis (allows slower communication time)
	\cp ./travis_global_config.yml ./pyrpl/config/global_config.yml
	# packages for coverage reports
	conda install --yes -c conda-forge coveralls
	pip install coverage codecov
	# install pyrpl
	python setup.py install

script:
	if [[ "$TRAVIS_PYTHON_VERSION" == "3.5" && "$TRAVIS_OS_NAME" == "osx" ]]; then
	cd ..;
	git clone https://www.github.com/lneuhaus/pyinstaller.git -b develop;
	cd pyinstaller;
	git status;
	python setup.py develop;
	cd ..;
	cd pyrpl;
	pyinstaller pyrpl.spec;
	mv dist/pyrpl ./pyrpl-mac-develop;
	python .deploy_to_sourceforge.py pyrpl-mac-develop;
	chmod 755 pyrpl-mac-develop;
	(./pyrpl-mac-develop config=test_osx hostname=_FAKE_ &);
	PYRPL_PID=$!;
	sleep 30;
	killall -9 pyrpl-mac-develop;
	fi
	if [[ "$TRAVIS_PYTHON_VERSION" == "3.4" && "$TRAVIS_OS_NAME" == "linux" ]]; then
	cd ..;
	git clone https://www.github.com/lneuhaus/pyinstaller.git -b develop;
	cd pyinstaller;
	git status;
	python setup.py develop;
	cd ..;
	cd pyrpl;
	pyinstaller pyrpl.spec;
	mv dist/pyrpl ./pyrpl-linux-develop;
	python .deploy_to_sourceforge.py pyrpl-linux-develop;
	chmod 755 pyrpl-linux-develop;
	(./pyrpl-linux-develop config=test_linux hostname=_FAKE_ &);
	PYRPL_PID=$!;
	sleep 30;
	killall pyrpl-linux-develop;
	fi
	- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" &&  "$TRAVIS_OS_NAME" == "linux" ]] || [[ "$TRAVIS_PYTHON_VERSION" == "3.5" &&  "$TRAVIS_OS_NAME" == "osx" ]] || [[ "$TRAVIS_PYTHON_VERSION" == "3.6" && "$TRAVIS_OS_NAME" == "linux" ]]; then
	echo "NOSETESTS ARE ENABLED";
	nosetests;
	fi

after_script:
	if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" &&  "$TRAVIS_OS_NAME" == "linux" ]] || [[ "$TRAVIS_PYTHON_VERSION" == "3.5" &&  "$TRAVIS_OS_NAME" == "linux" ]] || [[ "$TRAVIS_PYTHON_VERSION" == "3.6" && "$TRAVIS_OS_NAME" == "osx" ]]; then
	codecov;
	fi

# automatic release when a new tag is created: before_deploy, deploy, and after_deploy
before_deploy:
	echo Deploy
	source activate test-environment

deploy:
	provider: pypi
	user: lneuhaus
	password: $PYPI_PASSWORD
	skip_cleanup: true
	on:
	  tags: true

distributions: "sdist bdist_wheel --universal"

# make an executable for linux and upload to sourceforge in python 3.4
# same for macos
# put windows executable into the right directory (at last such that "latest" points to windows .exe)
after_deploy:
	source activate test-environment
	if [[ "$TRAVIS_PYTHON_VERSION" == "3.5" && "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_TEST_RESULT" == 0 ]]; then
	pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip;
	export QT_QPA_PLATFORM_PLUGIN_PATH=$HOME/miniconda/envs/test-environment/plugins/platforms;
	pyinstaller pyrpl.spec;
	mv dist/pyrpl ./pyrpl-linux;
	python .deploy_to_sourceforge.py pyrpl-linux;
	fi
	if [[ "$TRAVIS_PYTHON_VERSION" == "3.5" && "$TRAVIS_OS_NAME" == "osx" && "$TRAVIS_TEST_RESULT" == 0 ]]; then
	pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip;
	export QT_QPA_PLATFORM_PLUGIN_PATH=$HOME/miniconda/envs/test-environment/plugins/platforms;
	pyinstaller pyrpl.spec;
	mv dist/pyrpl ./pyrpl-mac;
	python .deploy_to_sourceforge.py pyrpl-mac;
	fi
	wget wget https://sourceforge.net/projects/pyrpl/files/pyrpl-windows.exe -O pyrpl-windows.exe
	python .deploy_to_sourceforge.py pyrpl-windows.exe

sloc:
	sloccount --duplicates --wide --details $(SRC_DIR) | fgrep -v .git > sloccount.sc || :

test:
	cd $(SRC_DIR) && nosetests --verbose --with-xunit --xunit-file=../xunit.xml --with-xcoverage --xcoverage-file=../coverage.xml || :

flakes:
	find $(SRC_DIR) -name *.py|egrep -v '^./tests/'|xargs pyflakes  > pyflakes.log || :

lint:
	find $(SRC_DIR) -name *.py|egrep -v '^./tests/' | xargs pylint --output-format=parseable --reports=y > pylint.log || :

clone:
	clonedigger --cpd-output $(SRC_DIR) || :

clean:
	rm -f pyflakes.log
	rm -f pylint.log
	rm -f sloccount.sc
	rm -f output.xml
	rm -f coverage.xml
	rm -f xunit.xml


text:
package logic;

import java.io.IOException;

import account.AccountManager;
import twitter4j.Status;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.TwitterStream;
import twitter4j.TwitterStreamFactory;
import twitter4j.UserStreamAdapter;
import twitter4j.conf.Configuration;

public class UserStream extends Thread {
    Twitter twitter;
    TwitterStream twitterStream;
    UserStreamAdapter usAdapter;

    public UserStream() throws IOException {
        Configuration conf = AccountManager.getConfig();
        Twitter twitter = new TwitterFactory(conf).getInstance();
        TwitterStream twitterStream = new TwitterStreamFactory(conf).getInstance();

        UpdateName un = new UpdateName(twitter);
        UpdateLocation ul = new UpdateLocation(twitter);

        usAdapter = new UserStreamAdapter() {
            public void onStatus(Status status) {
                try {
                    un.reciever(status);
                    ul.reciever(status);
                } catch (TwitterException e) {
                    e.printStackTrace();
                }
            };
        };
    }

    public void ConnectUserStream() throws IllegalStateException, TwitterException, IOException {
        twitterStream.addListener(usAdapter);
        twitterStream.user();
    }

    @Override
    public void run() {
        try {
            ConnectUserStream();
        } catch (IllegalStateException | TwitterException | IOException e) {
            e.printStackTrace();
        }
    }

}


text:
An automatic meeting transcription app.

# Status
A rough version of the speaker recognition system is currently working, with near-100% accuracy when I test it with two client computers. After cleaning up the speaker recognition code I will start on the speech recognition integration.

# Testing it
To test Scribe, simply download the repository, start a web server, and browse to the `index.html` page. The setup process is currently somewhat confusing, so follow these steps:

### For the host:
1. Press "I'm starting a new meeting" on the first prompt and enter your name
2. Send the meeting code to others in your meeting
3. Once all attendees have joined, ask everyone to stay silent and press "Start Calibration." After about 10 seconds, press "Stop Calibration"
4. Press "Start Speaker Recognition Demo" to start the speaker recognition demo

### For the clients/other attendees:
1. Press "I have a meeting code" on the first prompt to indicate you would like to join an existing meeting
2. Enter the meeting code provided by the meeting host along with your name
3. Press "Join Meeting" and follow the prompts until the meeting begins

# Issues & Workarounds
- Speech recognition from far-field microphones (the 'have a mic on the table' approach) is notoriously difficult and error-prone. Scribe will side-step this problem by making the practical assumption that all meeting attendees have a laptop or other device in front them, and then use the microphone from that device to provide a closer/slightly less noisy recording of their speech.
- Automatic speaker recognition can actually get very accurate, yet there are no 100% accuracy systems. Again, making the assumption that all attendees have a microphone facing them allows us to use the loudness data from the different microphones to determine much more accurately where a sound is most likely coming from.
- Communication will happen peer to peer over WebRTC/peer.js, with the thought that meeting recordings are private and thus probably shouldn't use a centralized server. For simplicity it will use peer.js, in the future I might do a more custom WebRTC implementation.


text:
import 'babel/polyfill';
import _ from 'underscore';
import fs from 'fs';
import path from 'path';
import express from 'express';
import { staticPath } from './utilities/static/StaticPath';

const server = express();

const DEVELOPMENT = process.env.NODE_ENV !== 'production';
if (DEVELOPMENT === true) {
  server.set('port', (process.env.PORT || 5000));
} else {
  server.set('port', (process.env.PORT || 15767));
}

server.use(express.static(path.join(__dirname, 'public')));

//
// Register server-side rendering middleware
// -----------------------------------------------------------------------------

server.get('*', async (req, res, next) => {
  try {
    // The top-level React component + HTML template for it
    const templateFile = path.join(__dirname, 'templates/index.html');
    const template = _.template(fs.readFileSync(templateFile, 'utf8'));

    let data = {
      title: 'Toni Karttunen',
      description: 'Toni Karttunen is a Finnish user experience designer ' +
                   'and software developer.',
      body: '',
      css: '',
      staticPath: staticPath
    };

    let html = template(data);
    res.send(html);
  } catch (err) {
    next(err);
  }
});

// 500 internal server error handler
server.use(function(error, req, res, next) {
  try {
    const templateFile = path.join(__dirname, 'templates/ErrorView.html');
    const template = _.template(fs.readFileSync(templateFile, 'utf8'));

    const data = {
      'title': 'Something Went Wrong'
    };

    const html = template(data);
    res.status(500).send(html);
  } catch (err) {
    next(err);
  }
});

//
// Launch the server
// -----------------------------------------------------------------------------

server.listen(server.get('port'), () => {
  if (process.send) {
    process.send('online');
  } else {
    console.log('The server is running at http://localhost:' + server.get('port'));
  }
});


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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>keycloak-misc-parent</artifactId>
        <groupId>org.keycloak</groupId>
        <version>999-SNAPSHOT</version>
    </parent>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-test-helper</artifactId>
    <name>keycloak-test-helper</name>
    <description>Helper library to test application using Keycloak.</description>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-client-registration-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-admin-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-client</artifactId>
            <version>${resteasy.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson2-provider</artifactId>
            <version>${resteasy.version}</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-services</artifactId>
        </dependency>
    </dependencies>
</project>


text:
package de.plushnikov.intellij.plugin.inspection;

import com.intellij.codeInspection.InspectionProfileEntry;
import com.siyeh.ig.style.FieldMayBeFinalInspection;

public class FieldMayBeFinalInspectionTest extends LombokInspectionTest {

  @Override
  protected String getTestDataPath() {
    return TEST_DATA_INSPECTION_DIRECTORY + "/canBeFinalInspection";
  }

  @Override
  protected InspectionProfileEntry getInspection() {
    return new FieldMayBeFinalInspection();
  }

  public void testClassNormal() {
    doTest();
  }

  public void testClassWithData() {
    doTest();
  }

  public void testClassWithFieldSetter() {
    doTest();
  }

  public void testClassWithGetter() {
    doTest();
  }

  public void testClassWithSetter() {
    doTest();
  }

  public void testClassWithValue() {
    doTest();
  }

}


text:
window.$ = window.jQuery = require('jquery')
window._ = require('lodash')
//window.$.toast = require('../../bower_components/jquery-toast-plugin/src/jquery.toast.js')
// require('bootstrap-sass/assets/javascripts/bootstrap.js')
require('materialize-css/dist/js/materialize.js')
window.filterous = require('../../bower_components/jquery-toast-plugin/src/jquery.toast.js')
// require('jquery-validation/dist/jquery.validate.js')

module.exports = $;


text:
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
    <title>ISoundSource Members</title>
    <xml>
    </xml>
    <link rel="stylesheet" type="text/css" href="MSDN.css" />

            IrrKlang.NET

ISoundSource Members

        ISoundSource overview

Public Instance Constructors

              ISoundSource Constructor

Public Instance Properties

AudioFormat	 Returns informations about the sound source: channel count (mono/stereo), frame count, sample rate, etc. Returns the structure filled with 0 or negative values if not known for this sound for example because because the file could not be opened or similar. Note: If the sound never has been played before, the sound engine will have to open the file and try to get the play lenght from there, so this call could take a bit depending on the type of file.

DefaultMaxDistance	 Sets or gets the default maximal distance for 3D sounds played from this source. This value influences how loud a sound is heard based on its distance. See ISound::setMaxDistance() for details about what the max distance is. This method only influences the initial distance value of sounds. For changing the distance after the sound has been started to play, use ISound::setMaxDistance() and ISound::setMaxDistance().

DefaultMinDistance	 Sets or gets the default minimal distance for 3D sounds played from this source. This value influences how loud a sound is heard based on its distance. See ISound::setMinDistance() for details about what the min distance is. This method only influences the initial distance value of sounds. For changing the distance after the sound has been started to play, use ISound::setMinDistance() and ISound::setMaxDistance().

DefaultVolume	 Sets or gets the default volume for a sound played from this source. The default value of this is 1.0f. Note that the default volume is being multiplied with the master volume of ISoundEngine, change this via ISoundEngine::setSoundVolume(). The volume is a value between 0 (silent) and 1.0f (full volume).

ForcedStreamingThreshold

IsSeekingSupported	 Returns if sounds played from this source will support seeking via ISound::setPlayPosition(). If a sound is seekable depends on the file type and the audio format. For example MOD files cannot be seeked currently. Returns true of the sound source supports setPlayPosition() and false if not. Note: If the sound never has been played before, the sound engine will have to open the file and try to get the information from there, so this call could take a bit depending on the type of file.

Name	 Returns the name of the sound source (usually, this is the file name)

PlayLength	 Returns the play length of the sound in milliseconds. Returns -1 if not known for this sound for example because its decoder does not support lenght reporting or it is a file stream of unknown size. Note: If the sound never has been played before, the sound engine will have to open the file and try to get the play lenght from there, so this call could take a bit depending on the type of file.

SampleData

StreamMode	 Sets or returns the stream mode which is used for a sound played from this source. Note that if this is set to ESM_NO_STREAMING, the engine still might decide to stream the sound if it is too big. The threashold for this can be adjusted using ISoundSource::setForcedStreamingThreshold(). Note: If the returned type is ESM_AUTO_DETECT, this mode will change after the sound has been played the first time.

Public Instance Methods

Dispose

Equals (inherited from Object)
        Determines whether the specified Object is equal to the current Object.

ForceReloadAtNextUse	 Forces the sound to be reloaded at next replay. Sounds which are not played as streams are buffered to make it possible to replay them without much overhead. If the sound file is altered after the sound has been played the first time, the engine won't play the changed file then. Calling this method makes the engine reload the file before the file is played the next time.

GetHashCode (inherited from Object)
        Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.

getNativeSoundSource	 for internal use only

GetType (inherited from Object)
        Gets the Type of the current instance.

ToString (inherited from Object)
        Returns a String that represents the current Object.

Protected Instance Methods

Finalize	 Destructor

MemberwiseClone (inherited from Object)
        Creates a shallow copy of the current Object.

See Also

        ISoundSource Class | IrrKlang Namespace

      <object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e" viewastext="true" style="display: none;">
        <param name="Keyword" value="ISoundSource class">
        </param>
        <param name="Keyword" value="IrrKlang.ISoundSource class">
        </param>
        <param name="Keyword" value="ISoundSource class, all members">
        </param>
      </object>

          The irrKlang Sound Engine Documentation © 2003-2010 by Nikolaus Gebhardt.


text:
namespace WebBlocks.Types.Pages
{
    public class PageReferenceModel
    {
        public string Title { get; set; }
        public string Url { get; set; }
    }
}


text:
<?php

/**
 * Parallel diff renderer for HTML tables with original text on left,
 * new text on right, and changed text highlighted with appropriate classes.
 */
class Text_Diff_Renderer_parallel extends Text_Diff_Renderer
{
    /** String header for left column */
    var $original = 'Original';
    /** String header for right column */
    var $final    = 'Final';
    var $_leading_context_lines = 10000; // these are big to ensure entire string is output
    var $_trailing_context_lines = 10000;
    function _blockHeader() {}
    function _startDiff() {
        return '

'. $this->original .'	'. $this->final .'

';
    }
    function _endDiff() {
        return '

';
    }
    function _context($lines) {
        return '

'. htmlspecialchars(implode("\n", $lines)) .'

'. htmlspecialchars(implode("\n", $lines)) .'

';
    }
    function _added($lines) {
        return '

'. htmlspecialchars(implode("\n", $lines)) .'

';
    }
    function _deleted($lines) {
        return '

'. htmlspecialchars(implode("\n", $lines)) .'

';
    }
    function _changed($orig, $final) {
        return '

'. htmlspecialchars(implode("\n", $orig)) .'

'. htmlspecialchars(implode("\n", $final)) .'

';
    }
}


text:
""" Crawling the geocode.

File: geocoder.py
Author: SpaceLis
Email: Wen.Li@tudelft.nl
GitHub: http://github.com/spacelis
Description:

"""
from gevent import monkey
monkey.patch_all()

import sys
import re
import requests
from pyproj import Proj

from crawler.actors import Controller
from crawler.readers import CSVReader
from crawler.writers import FileWriter

import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger("requests").setLevel(logging.WARNING)

COORD = re.compile(r'<gml:pos dimension="2">([\d.]+ [\d.]+)</gml:pos>')
RESTURL = 'http://geodata.nationaalgeoregister.nl/geocoder/Geocoder'
PROJ = Proj(init='EPSG:28992')

def parsecoord(text):
    """ Parse coordinates from the returns. """
    x, y = [float(i) for i in COORD.search(text).group(1).split(' ')]
    return ','.join([str(i) for i in PROJ(x, y, inverse=True)][::-1])

class Worker(object):

    """ A worker. """

    def __init__(self, _):
        """@todo: to be defined1.

        :args: @todo

        """
        pass

    def work_on(self, x):
        """@todo: Docstring for work_on.

        :x: A dict holding rows in csv
        :returns: The coordinates.

        """
        if ('Straatnaam' not in x) and ('address' in x):
            q = {'zoekterm': x['address']}
            try:
                ret = requests.get(RESTURL, params=q)
                return ','.join([x['Meldings nummer'], parsecoord(ret.text)])
            except Exception as e:
                logging.exception(e)
                print '%s,"%s"' % (x['Meldings nummer'], x['address'])
                return ''
        else:
            s = x['Straatnaam']
            n = ('' if x['Huisnummer Melding'] == '0'
                 else str(x['Huisnummer Melding']))
            q = {'zoekterm': ' '.join([s, n, 'Rotterdam'])}
            try:
                ret = requests.get(RESTURL, params=q)
                return ','.join([s, n, parsecoord(ret.text)])
            except Exception as e:
                logging.exception(e)
                print ','.join([s, n])
                return ''

def test():
    """ test """
    w = Worker('')
    print w.work_on({'Straatnaam': 'FEIJENOORDHAVEN',
                     'Huisnummer Melding': '44'})
    print w.work_on({'Straatnaam': 'FEIJENOORDHAVEN',
                     'Huisnummer Melding': '0'})
    print w.work_on({'Meldings nummer': '1',
                     'address': 'Science Park Amsterdam'})

def console():
    """ running in console
    :returns: @todo

    """
    if len(sys.argv) != 3:
        print >> sys.stderr, 'Usage: tweet_crawler.py <input> <output>'
        sys.exit()

    controller = Controller.start(Worker, [1],
                                  CSVReader(sys.argv[1]),
                                  FileWriter(sys.argv[2]),
                                  poolsize=15)
    controller.actor_stopped.wait()

if __name__ == '__main__':
    console()
    # test()


text:
using MetricsTaskEnvironment = web::WebTaskEnvironment;
#else  // !BUILDFLAG(IS_IOS)
#include "content/public/test/browser_task_environment.h"
using MetricsTaskEnvironment = content::BrowserTaskEnvironment;
#endif  // BUILDFLAG(IS_IOS)

namespace metrics {

class NetworkMetricsProviderTest : public testing::Test {
 public:
  NetworkMetricsProviderTest(const NetworkMetricsProviderTest&) = delete;
  NetworkMetricsProviderTest& operator=(const NetworkMetricsProviderTest&) =
      delete;

 protected:
  NetworkMetricsProviderTest()
      : task_environment_(MetricsTaskEnvironment::IO_MAINLOOP) {}
  ~NetworkMetricsProviderTest() override {}

 private:
  MetricsTaskEnvironment task_environment_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
  chromeos::NetworkHandlerTestHelper network_handler_test_helper_;
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)
};

// Verifies that the effective connection type is correctly set.
TEST_F(NetworkMetricsProviderTest, EffectiveConnectionType) {
  NetworkMetricsProvider network_metrics_provider(
      network::TestNetworkConnectionTracker::CreateAsyncGetter());
  base::RunLoop().RunUntilIdle();

  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN,
            network_metrics_provider.effective_connection_type_);
  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN,
            network_metrics_provider.min_effective_connection_type_);
  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN,
            network_metrics_provider.max_effective_connection_type_);
  SystemProfileProto system_profile;
  network_metrics_provider.ProvideSystemProfileMetrics(&system_profile);
  EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_UNKNOWN,
            system_profile.network().min_effective_connection_type());
  EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_UNKNOWN,
            system_profile.network().max_effective_connection_type());

  network_metrics_provider.OnEffectiveConnectionTypeChanged(
      net::EFFECTIVE_CONNECTION_TYPE_2G);
  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_2G,
            network_metrics_provider.effective_connection_type_);
  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_2G,
            network_metrics_provider.min_effective_connection_type_);
  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_2G,
            network_metrics_provider.max_effective_connection_type_);
  network_metrics_provider.ProvideSystemProfileMetrics(&system_profile);
  EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_2G,
            system_profile.network().min_effective_connection_type());
  EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_2G,
            system_profile.network().max_effective_connection_type());

  network_metrics_provider.OnEffectiveConnectionTypeChanged(
      net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G);
  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G,
            network_metrics_provider.effective_connection_type_);
  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G,
            network_metrics_provider.min_effective_connection_type_);
  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_2G,
            network_metrics_provider.max_effective_connection_type_);
  network_metrics_provider.ProvideSystemProfileMetrics(&system_profile);
  // Effective connection type changed from 2G to SLOW_2G during the lifetime of
  // the log. Minimum value of ECT must be different from the maximum value.
  EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_SLOW_2G,
            system_profile.network().min_effective_connection_type());
  EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_2G,
            system_profile.network().max_effective_connection_type());

  // Getting the system profile again should return the current effective
  // connection type.
  network_metrics_provider.ProvideSystemProfileMetrics(&system_profile);
  EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_SLOW_2G,
            system_profile.network().min_effective_connection_type());
  EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_SLOW_2G,
            system_profile.network().max_effective_connection_type());
}

// Verifies that the effective connection type is not set to UNKNOWN when there
// is a change in the connection type.
TEST_F(NetworkMetricsProviderTest, ECTAmbiguousOnConnectionTypeChange) {
  NetworkMetricsProvider network_metrics_provider(
      network::TestNetworkConnectionTracker::CreateAsyncGetter());
  base::RunLoop().RunUntilIdle();

  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN,
            network_metrics_provider.effective_connection_type_);
  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN,
            network_metrics_provider.min_effective_connection_type_);
  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN,
            network_metrics_provider.max_effective_connection_type_);

  network_metrics_provider.OnEffectiveConnectionTypeChanged(
      net::EFFECTIVE_CONNECTION_TYPE_2G);
  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_2G,
            network_metrics_provider.effective_connection_type_);
  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_2G,
            network_metrics_provider.min_effective_connection_type_);
  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_2G,
            network_metrics_provider.max_effective_connection_type_);

  // There is no change in the connection type. Effective connection types
  // should be reported as 2G.
  SystemProfileProto system_profile;
  network_metrics_provider.ProvideSystemProfileMetrics(&system_profile);
  EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_2G,
            system_profile.network().min_effective_connection_type());
  EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_2G,
            system_profile.network().max_effective_connection_type());

  // Even with change in the connection type, effective connection types
  // should be reported as 2G.
  network_metrics_provider.OnConnectionChanged(
      network::mojom::ConnectionType::CONNECTION_2G);
  network_metrics_provider.ProvideSystemProfileMetrics(&system_profile);
  EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_2G,
            system_profile.network().min_effective_connection_type());
  EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_2G,
            system_profile.network().max_effective_connection_type());
}

// Verifies that the effective connection type is not set to UNKNOWN when the
// connection type is OFFLINE.
TEST_F(NetworkMetricsProviderTest, ECTNotAmbiguousOnUnknownOrOffline) {
  for (net::EffectiveConnectionType force_ect :
       {net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN,
        net::EFFECTIVE_CONNECTION_TYPE_OFFLINE}) {
    NetworkMetricsProvider network_metrics_provider(
        network::TestNetworkConnectionTracker::CreateAsyncGetter());
    base::RunLoop().RunUntilIdle();

    network_metrics_provider.OnEffectiveConnectionTypeChanged(
        net::EFFECTIVE_CONNECTION_TYPE_2G);

    SystemProfileProto system_profile;
    network_metrics_provider.ProvideSystemProfileMetrics(&system_profile);

    network_metrics_provider.OnEffectiveConnectionTypeChanged(force_ect);

    network_metrics_provider.ProvideSystemProfileMetrics(&system_profile);
    EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_2G,
              system_profile.network().min_effective_connection_type());
    EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_2G,
              system_profile.network().max_effective_connection_type());

    network_metrics_provider.OnEffectiveConnectionTypeChanged(
        net::EFFECTIVE_CONNECTION_TYPE_4G);
    network_metrics_provider.ProvideSystemProfileMetrics(&system_profile);
    EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_4G,
              system_profile.network().min_effective_connection_type());
    EXPECT_EQ(SystemProfileProto::Network::EFFECTIVE_CONNECTION_TYPE_4G,
              system_profile.network().max_effective_connection_type());
  }
}

// Verifies that the connection type is ambiguous boolean is correctly set.
TEST_F(NetworkMetricsProviderTest, ConnectionTypeIsAmbiguous) {
  NetworkMetricsProvider network_metrics_provider(
      network::TestNetworkConnectionTracker::CreateAsyncGetter());

  EXPECT_EQ(network::mojom::ConnectionType::CONNECTION_UNKNOWN,
            network_metrics_provider.connection_type_);
  EXPECT_FALSE(network_metrics_provider.connection_type_is_ambiguous_);
  EXPECT_FALSE(
      network_metrics_provider.network_connection_tracker_initialized_);

  // When a connection type change callback is received, network change notifier
  // should be marked as initialized.
  network_metrics_provider.OnConnectionChanged(
      network::mojom::ConnectionType::CONNECTION_2G);
  EXPECT_EQ(network::mojom::ConnectionType::CONNECTION_2G,
            network_metrics_provider.connection_type_);
  // Connection type should not be marked as ambiguous when a delayed connection
  // type change callback is received due to delayed initialization of the
  // network change notifier.
  EXPECT_FALSE(network_metrics_provider.connection_type_is_ambiguous_);
  EXPECT_TRUE(network_metrics_provider.network_connection_tracker_initialized_);

  // On collection of the system profile, |connection_type_is_ambiguous_| should
  // stay false, and |network_connection_tracker_initialized_| should remain
  // true.
  SystemProfileProto system_profile;
  network_metrics_provider.ProvideSystemProfileMetrics(&system_profile);
  EXPECT_FALSE(network_metrics_provider.connection_type_is_ambiguous_);
  EXPECT_TRUE(network_metrics_provider.network_connection_tracker_initialized_);
  EXPECT_FALSE(system_profile.network().connection_type_is_ambiguous());
  EXPECT_EQ(SystemProfileProto::Network::CONNECTION_2G,
            system_profile.network().connection_type());

  network_metrics_provider.OnConnectionChanged(
      network::mojom::ConnectionType::CONNECTION_3G);
  EXPECT_TRUE(network_metrics_provider.connection_type_is_ambiguous_);
  EXPECT_TRUE(network_metrics_provider.network_connection_tracker_initialized_);

  // On collection of the system profile, |connection_type_is_ambiguous_| should
  // be reset to false, and |network_connection_tracker_initialized_| should
  // remain true.
  network_metrics_provider.ProvideSystemProfileMetrics(&system_profile);
  EXPECT_FALSE(network_metrics_provider.connection_type_is_ambiguous_);
  EXPECT_TRUE(network_metrics_provider.network_connection_tracker_initialized_);
  EXPECT_TRUE(system_profile.network().connection_type_is_ambiguous());
  EXPECT_EQ(SystemProfileProto::Network::CONNECTION_3G,
            system_profile.network().connection_type());
}

}  // namespace metrics


text:
<!DOCTYPE HTML>
<script src="../resources/gc.js"></script>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../http/tests/resources/permissions-helper.js"></script>
<script src="resources/aom-helper.js"></script>

<!--

Accessibility Object Model
Explainer: https://github.com/WICG/aom/blob/gh-pages/explainer.md
Spec: https://wicg.github.io/aom/spec/

-->
<script>
test(function(t) {
    assert_true(internals.runtimeFlags.accessibilityObjectModelEnabled);
}, "Make sure that Accessibility Object Model is enabled");
</script>

<input id="focus_target">

<script>
async_test(function(t) {
  enableAccessibilityEventsPermission().then(function() {
    var target = document.getElementById("focus_target");
    var axTarget = accessibilityController.accessibleElementById("focus_target");

    var gotAccessibleEvent = false;
    target.accessibleNode.onaccessiblefocus = function() {
      gotAccessibleEvent = true;
    };
    axTarget.takeFocus();

    assert_true(gotAccessibleEvent);
    assert_equals(document.activeElement, target);
    t.done();
  });
}, "AccessibleNode.onaccessiblefocus");
</script>


text:
package ti.modules.titanium.media;

public interface TiPlaybackListener
{
	public void onStartPlayback();

	public void onPausePlayback();

	public void onStopPlayback();

	public void onPlayingPlayback();

	public void onSeekingBackward();

	public void onSeekingForward();
}


text:
package de.motivational.stairs.rest.api.v1.game;

/**
 * Created by Florian on 11.07.2016.
 */

import de.motivational.stairs.database.entity.GameEntity;
import de.motivational.stairs.database.service.GameService;
import de.motivational.stairs.database.service.HighscoreService;
import de.motivational.stairs.rest.dto.GameDto;
import de.motivational.stairs.rest.dto.GameStartDto;
import de.motivational.stairs.rest.dto.GameStartResponseDto;
import de.motivational.stairs.rest.dto.HighscoreDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Optional;

@RestController
@RequestMapping(value="/api/v1.0/game")
public class GameServiceREST {

    @Autowired
    GameService gameService;

    @RequestMapping(value="/", method= RequestMethod.GET)
    @ResponseBody GameDto[] getAll() {
        return gameService
                .findAll().stream()
                .map(GameDto::new)
                .toArray(GameDto[]::new);
    }

    @RequestMapping(value="/{gameId}", method= RequestMethod.GET)
    @ResponseBody GameDto getOneById(@PathVariable int gameId) {
        Optional<GameDto> gameDto = gameService.findOne(gameId).map(GameDto::new);
        return gameDto.isPresent()?gameDto.get():null;
    }

    @RequestMapping(value="/", method= RequestMethod.POST)
    @ResponseBody Optional<GameEntity> create(@RequestBody GameDto gameDto) {
        return gameService.create(gameDto);
    }

    //TODO TEST ONLY...
    @RequestMapping(value="/quit", method= RequestMethod.POST)
    @ResponseBody void create() {
        gameService.quitGame();
    }

    @RequestMapping(value="/{gameId}", method= RequestMethod.DELETE)
    @ResponseBody void delete(@PathVariable int gameId) {
        gameService.delete(gameId);
    }

    @RequestMapping(value="/start", method= RequestMethod.POST)
    @ResponseBody GameStartResponseDto start(@RequestBody GameStartDto gameDto) {
        return gameService.startGame(gameDto);
    }

    @RequestMapping(value="/redeem/{ticketId}", method= RequestMethod.GET)
    @ResponseBody boolean redeem(@PathVariable String ticketId) {
        return gameService.redeemTicket(ticketId);
    }

    @RequestMapping(value="/abort/{ticketId}", method= RequestMethod.GET)
    @ResponseBody void abort(@PathVariable String ticketId) {
        gameService.abortTicket(ticketId);
    }

    @RequestMapping(value="/queue", method= RequestMethod.GET)
    @ResponseBody String[] getPlayerQueue() {
        return this.gameService.getPlayerQueue();
    }

}


text:
using UnityEngine;
using System.Collections;
using MiddleVR_Unity3D;
using System;

[RequireComponent(typeof(CharacterMotor))]
public class KeyboardNavigation : MonoBehaviour
{
	public string ReferenceNode = "WandNode";

	private bool  m_SearchedRefNode = false;

	// Use this for initialization
	/*void Start()
	{

		GameObject Wand = GameObject.Find("VRWand");

		if (Wand != null)
		{
			Wand.GetComponent<VRWandNavigation>().enabled = false;
			MiddleVRTools.Log("[ ] VRFPSInputController deactivated VRWandNavigation. Make sure you set the VR Root Node to the First Person Controller.");
		}
	}*/

	void FixedUpdate()
	{
		CharacterMotor motor = GetComponent<CharacterMotor>();

		vrKeyboard keyb = null;

		if (MiddleVR.VRDeviceMgr.GetKeyboard() != null)
		{
			keyb = MiddleVR.VRDeviceMgr.GetKeyboard();
		}

		GameObject refNode = GameObject.Find(ReferenceNode);

		float speed = 0.0f;
		float speedR = 0.0f;
		float forward = 0.0f;

		// Choosing active vertical axis, later ones will overwrite previous ones

		// First test Unity's inputs
		if (Math.Abs(Input.GetAxis("Vertical")) > 0)
		{
			forward = Input.GetAxis("Vertical");
		}

		// Then test MiddleVR's keyboard
		//If MiddleVR is correctly tracking the keyboard, ie keyb != null, this will overwrite forward
		if (keyb != null)
		{
			if (keyb.IsKeyPressed(MiddleVR.VRK_UP) || keyb.IsKeyPressed(MiddleVR.VRK_Z))
			{
				forward = 1.0f;
			}

			if (keyb.IsKeyPressed(MiddleVR.VRK_DOWN) || keyb.IsKeyPressed(MiddleVR.VRK_S))
			{
				forward = -1.0f;
			}
		}

		// Computing speed
		if (Math.Abs(forward) > 0.1) speed = forward * Time.deltaTime * 30;

		//print("Speed: " + speed);

		// Choosing active horizontal axis
		float rotation = 0.0f;

		// First test Unity's inputs
		if (Math.Abs(Input.GetAxis("Horizontal")) > 0)
		{
			rotation = Input.GetAxis("Horizontal");
		}

		// Then test MiddleVR's keyboard
		if (keyb != null)
		{
			if (keyb.IsKeyPressed(MiddleVR.VRK_LEFT) || keyb.IsKeyPressed(MiddleVR.VRK_Q))
			{
				rotation = -1.0f;
			}

			if (keyb.IsKeyPressed(MiddleVR.VRK_RIGHT) || keyb.IsKeyPressed(MiddleVR.VRK_D))
			{
				rotation = 1.0f;
			}
		}

		if (Math.Abs(rotation) > 0.1) speedR = rotation * Time.deltaTime * 50;

		Vector3 directionVector = new Vector3(speedR, 0, speed);

		if (refNode == null)
		{
			if (m_SearchedRefNode == false)
			{
				MiddleVRTools.Log("[ ] Didn't find reference node " + ReferenceNode);
				m_SearchedRefNode = true;
			}

			motor.inputMoveDirection = directionVector;
		}
		else
		{
			motor.inputMoveDirection = refNode.transform.TransformDirection(directionVector);

			//print(motor.inputMoveDirection);
		}

		bool jump = false;
		if (Input.GetButton("Jump") == true)
		{
			jump = true;
		}

		if (keyb != null)
		{
			if (keyb.IsKeyPressed(MiddleVR.VRK_SPACE))
			{
				jump = true;
			}
		}

		if (MiddleVR.VRDeviceMgr.IsWandButtonToggled(1) == true)
		{
			jump = true;
		}

		motor.inputJump = jump;
	}

}


text:
require 'base64'
def calculate_resized_image_b64(resize_str)
  base_image = MiniMagick::Image.open(File.expand_path("../../fixtures/basic-app/source/images/original.jpg", __dir__))
  base_image.resize(resize_str)
  Base64.strict_encode64(base_image.to_blob)
end

image10x10 = "")+"\" class=\"image-resized-to10x10\" />"

image5x5 = ""

srcset20x20 = "<source srcset=\"data:image/jpeg;base64,"+calculate_resized_image_b64("20x20")+"\" media=\"(min-width: 900px)\">"

srcset15x15 = "<source srcset=\"data:image/jpeg;base64,"+calculate_resized_image_b64("15x15")+"\" media=\"(min-width: 900px)\">"

Given(/^there is no cache directory yet$/) do
  if directory? MiddlemanSimpleThumbnailer::Extension.config.cache_dir
    remove MiddlemanSimpleThumbnailer::Extension.config.cache_dir
  end
end

Then(/^I should see base64ed thumbnails of the images$/) do
  step %Q{I should see '#{image10x10}'}
  step %Q{I should see '#{image5x5}'}
end

Then(/^I should see base64ed thumbnails and srcset of the images$/) do
  step %Q{I should see '#{image10x10}'}
  step %Q{I should see '#{image5x5}'}
  step %Q{I should see '#{srcset20x20}'}
  step %Q{I should see '#{srcset15x15}'}
end

Then(/^the cache directory should exist (?:at "([^"]+)" )?with the following files$/) do |cache_dir, files|
  cache_dir ||= MiddlemanSimpleThumbnailer::Extension.config.cache_dir
  check_directory_presence([cache_dir], true)
  cd cache_dir
  files.raw.map{|file_row| file_row[0]}.each { |f| expect(f).to be_existing_file }
end

Then(/^I should see base64ed data of the cached thumbnails with image path$/) do
  # data that won't ever be generated by resizing an actual image
  cached_10x10_data = "foo"
  cached_5x5_data   = "bar"
  cached_15x15_data = "hello"
  cached_20x20_data = "world"
  cachedimage10x10 = ""
  cachedimage5x5 = ""
  cachedsrcset20x20 = "<source srcset=\"data:image/jpeg;base64,#{Base64.strict_encode64(cached_20x20_data)}\" media=\"(min-width: 900px)\">"
  cachedsrcset15x15 = "<source srcset=\"data:image/jpeg;base64,#{Base64.strict_encode64(cached_15x15_data)}\" media=\"(min-width: 900px)\">"
  step %Q{I should see '#{cachedimage10x10}'}
  step %Q{I should see '#{cachedimage5x5}'}
  step %Q{I should see '#{cachedsrcset20x20}'}
  step %Q{I should see '#{cachedsrcset15x15}'}
end

Then(/^I should see base64ed data of the cached thumbnails$/) do
  # data that won't ever be generated by resizing an actual image
  cached_10x10_data = "foo"
  cached_5x5_data   = "bar"
  cachedimage10x10 = ""
  cachedimage5x5 = ""
  step %Q{I should see '#{cachedimage10x10}'}
  step %Q{I should see '#{cachedimage5x5}'}
end

Then(/^the following images should exist:$/) do |table|
  table.hashes.each do |row|
    in_current_dir do
      image = MiniMagick::Image.open(row["filename"])
      expect(image.dimensions).to eq row["dimensions"].split("x").map(&:to_i)
    end
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
Author:       Sam Ruby <rubys@intertwingly.net>
-->

<!--
Description:  a feed with two atom:entry elements with the same atom:id and same atom:updated values produces a warning.
Expect:       !MissingElement{parent:feed,element:author}
-->

<feed xmlns="http://www.w3.org/2005/Atom">

  <title>Example Feed</title>
  <link href="http://example.org/"/>
  <updated>2003-12-13T18:30:02Z</updated>
  <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>

</feed>


text:
package io.vertx.ext.apex.templ;

import io.vertx.core.http.HttpMethod;
import io.vertx.ext.apex.handler.TemplateHandler;
import io.vertx.ext.apex.ApexTestBase;
import org.junit.Test;

/**
 *
 * @author Tim Fox
 */
public class ThymeleafTemplateTest extends ApexTestBase {

  @Test
  public void testTemplateHandlerOnClasspath() throws Exception {
    TemplateEngine engine = ThymeleafTemplateEngine.create();
    testTemplateHandler(engine, "somedir", "test-thymeleaf-template2.html");
  }

  @Test
  public void testTemplateHandlerOnFileSystem() throws Exception {
    TemplateEngine engine = ThymeleafTemplateEngine.create();
    testTemplateHandler(engine, "src/test/filesystemtemplates", "test-thymeleaf-template3.html");
  }

  private void testTemplateHandler(TemplateEngine engine, String directoryName, String templateName) throws Exception {
    router.route().handler(context -> {
      context.put("foo", "badger");
      context.put("bar", "fox");
      context.next();
    });
    router.route().handler(TemplateHandler.create(engine, directoryName, "text/html"));
    String expected =
      "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" +
        "\n" +
        "\n" +
        "\n" +
        "  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n" +
        "\n" +
        "\n" +
        "
badger
\n" +
        "
fox
\n" +
        "
/" + templateName + "
\n" +
        "
blah
\n" +
        "
wibble
\n" +
        "\n" +
        "";

    testRequest(HttpMethod.GET, "/" + templateName + "?param1=blah&param2=wibble", 200, "OK", expected);
  }

  @Test
  public void testNoSuchTemplate() throws Exception {
    TemplateEngine engine = ThymeleafTemplateEngine.create();
    router.route().handler(TemplateHandler.create(engine, "nosuchtemplate.html", "text/html"));
    testRequest(HttpMethod.GET, "/foo.html", 500, "Internal Server Error");
  }

  @Test
  public void testGetThymeLeafTemplateEngine() throws Exception {
    ThymeleafTemplateEngine engine = ThymeleafTemplateEngine.create();
    assertNotNull(engine.getThymeleafTemplateEngine());
  }

}


text:
Changelog
=========

0.3.0
-----
* Updated to use Android SDK 23
* Support adding form elements dynamically

0.2.2
-----
* Use same timezone of the specified SimpleDateFormat for DatePickerController.

0.2.1
-----
* Fixed crash in drop-down selection field in Android API 21+.

0.2.0
-----
* Refactored out form management into FormController. Form management is no longer dependent Activity base class.
* Reliably detect text changes of EditText.
* Fixed issue where apps depending on NexusDialog complain about AndroidManifest.xml conflicts.
* Updated project structure to use latest android-gradle.
* Sources are now published to Maven repo too.

0.1.1
-----
* Fixed incorrect packaging name in maven artifact.

0.1.0
-----
* Initial release.


text:
package org.kuali.kfs.module.purap.util;

/**
 *
 * Expired or Closed Account
 */
public class ExpiredOrClosedAccount {

    private String chartOfAccountsCode;
    private String accountNumber;
    private String subAccountNumber;
    private boolean closedIndicator;
    private boolean expiredIndicator;
    private boolean continuationAccountMissing;

    /**
     *
     * Default constructor
     */
    public ExpiredOrClosedAccount() {
    }

    /**
     *
     * Constructs an Expired Or Closed Account consisting of the following attributes.
     * @param chartOfAccountsCode chart
     * @param accountNumber account
     * @param subAccountNumber subAccount
     */
    public ExpiredOrClosedAccount(String chartOfAccountsCode, String accountNumber, String subAccountNumber) {
        setChartOfAccountsCode(chartOfAccountsCode);
        setAccountNumber(accountNumber);
        setSubAccountNumber(subAccountNumber);
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public String getChartOfAccountsCode() {
        return chartOfAccountsCode;
    }

    public void setChartOfAccountsCode(String chartOfAccountsCode) {
        this.chartOfAccountsCode = chartOfAccountsCode;
    }

    public boolean isClosedIndicator() {
        return closedIndicator;
    }

    public void setClosedIndicator(boolean closedIndicator) {
        this.closedIndicator = closedIndicator;
    }

    public boolean isContinuationAccountMissing() {
        return continuationAccountMissing;
    }

    public void setContinuationAccountMissing(boolean continuationAccountMissing) {
        this.continuationAccountMissing = continuationAccountMissing;
    }

    public boolean isExpiredIndicator() {
        return expiredIndicator;
    }

    public void setExpiredIndicator(boolean expiredIndicator) {
        this.expiredIndicator = expiredIndicator;
    }

    public String getSubAccountNumber() {
        return subAccountNumber;
    }

    public void setSubAccountNumber(String subAccountNumber) {
        this.subAccountNumber = subAccountNumber;
    }

    /**
     * This is a helper method to return the account as a string in the format chart-account-subaccount.
     *
     * @return account string representation
     */
    public String getAccountString() {
        StringBuffer accountStr = new StringBuffer("");

        if (getChartOfAccountsCode() != null) {
            accountStr.append(getChartOfAccountsCode());
        }

        if (getAccountNumber() != null) {
            accountStr.append("-");
            accountStr.append(getAccountNumber());
        }

        if (getSubAccountNumber() != null) {
            accountStr.append("-");
            accountStr.append(getSubAccountNumber());
        }

        return accountStr.toString();
    }
}


text:
package org.apache.hadoop.hdfs.test.system;

import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.security.KerberosInfo;
import org.apache.hadoop.test.system.DaemonProtocol;

/**
 * Client side API exposed from Namenode.
 * Actual implementations are likely to be injected
 *
 * The protocol has to be annotated so KerberosInfo can be filled in during
 * creation of a ipc.Client connection
 */
@KerberosInfo(
    serverPrincipal = DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY)
public interface NNProtocol extends DaemonProtocol {
  public static final long versionID = 1L;
}


text:
namespace base {
namespace win {

// Utility class to read, write and manipulate the Windows Registry.
// Registry vocabulary primer: a "key" is like a folder, in which there
// are "values", which are <name, data> pairs, with an associated data type.
//
// Note:
//  * ReadValue family of functions guarantee that the out-parameter
//    is not touched in case of failure.
//  * Functions returning LONG indicate success as ERROR_SUCCESS or an
//    error as a (non-zero) win32 error code.
class BASE_EXPORT RegKey {
 public:
  // Called from the MessageLoop when the key changes.
  using ChangeCallback = OnceCallback<void()>;

  RegKey();
  explicit RegKey(HKEY key);
  RegKey(HKEY rootkey, const wchar_t* subkey, REGSAM access);
  RegKey(RegKey&& other) noexcept;
  RegKey& operator=(RegKey&& other);
  ~RegKey();

  LONG Create(HKEY rootkey, const wchar_t* subkey, REGSAM access);

  LONG CreateWithDisposition(HKEY rootkey,
                             const wchar_t* subkey,
                             DWORD* disposition,
                             REGSAM access);

  // Creates a subkey or open it if it already exists.
  LONG CreateKey(const wchar_t* name, REGSAM access);

  // Opens an existing reg key.
  LONG Open(HKEY rootkey, const wchar_t* subkey, REGSAM access);

  // Opens an existing reg key, given the relative key name.
  LONG OpenKey(const wchar_t* relative_key_name, REGSAM access);

  // Closes this reg key.
  void Close();

  // Replaces the handle of the registry key and takes ownership of the handle.
  void Set(HKEY key);

  // Transfers ownership away from this object.
  HKEY Take();

  // Returns false if this key does not have the specified value, or if an error
  // occurrs while attempting to access it.
  bool HasValue(const wchar_t* value_name) const;

  // Returns the number of values for this key, or 0 if the number cannot be
  // determined.
  DWORD GetValueCount() const;

  // Determines the nth value's name.
  LONG GetValueNameAt(int index, std::wstring* name) const;

  // True while the key is valid.
  bool Valid() const { return key_ != nullptr; }

  // Kills a key and everything that lives below it; please be careful when
  // using it.
  LONG DeleteKey(const wchar_t* name);

  // Deletes an empty subkey.  If the subkey has subkeys or values then this
  // will fail.
  LONG DeleteEmptyKey(const wchar_t* name);

  // Deletes a single value within the key.
  LONG DeleteValue(const wchar_t* name);

  // Getters:

  // Reads a REG_DWORD (uint32_t) into |out_value|. If |name| is null or empty,
  // reads the key's default value, if any.
  LONG ReadValueDW(const wchar_t* name, DWORD* out_value) const;

  // Reads a REG_QWORD (int64_t) into |out_value|. If |name| is null or empty,
  // reads the key's default value, if any.
  LONG ReadInt64(const wchar_t* name, int64_t* out_value) const;

  // Reads a string into |out_value|. If |name| is null or empty, reads
  // the key's default value, if any.
  LONG ReadValue(const wchar_t* name, std::wstring* out_value) const;

  // Reads a REG_MULTI_SZ registry field into a vector of strings. Clears
  // |values| initially and adds further strings to the list. Returns
  // ERROR_CANTREAD if type is not REG_MULTI_SZ.
  LONG ReadValues(const wchar_t* name, std::vector<std::wstring>* values);

  // Reads raw data into |data|. If |name| is null or empty, reads the key's
  // default value, if any.
  LONG ReadValue(const wchar_t* name,
                 void* data,
                 DWORD* dsize,
                 DWORD* dtype) const;

  // Setters:

  // Sets an int32_t value.
  LONG WriteValue(const wchar_t* name, DWORD in_value);

  // Sets a string value.
  LONG WriteValue(const wchar_t* name, const wchar_t* in_value);

  // Sets raw data, including type.
  LONG WriteValue(const wchar_t* name,
                  const void* data,
                  DWORD dsize,
                  DWORD dtype);

  // Starts watching the key to see if any of its values have changed.
  // The key must have been opened with the KEY_NOTIFY access privilege.
  // Returns true on success.
  // To stop watching, delete this RegKey object. To continue watching the
  // object after the callback is invoked, call StartWatching again.
  bool StartWatching(ChangeCallback callback);

  HKEY Handle() const { return key_; }

 private:
  class Watcher;

  // Recursively deletes a key and all of its subkeys.
  static LONG RegDelRecurse(HKEY root_key, const wchar_t* name, REGSAM access);

  HKEY key_ = nullptr;  // The registry key being iterated.
  REGSAM wow64access_ = 0;
  std::unique_ptr<Watcher> key_watcher_;

  DISALLOW_COPY_AND_ASSIGN(RegKey);
};

// Iterates the entries found in a particular folder on the registry.
class BASE_EXPORT RegistryValueIterator {
 public:
  // Constructs a Registry Value Iterator with default WOW64 access.
  RegistryValueIterator(HKEY root_key, const wchar_t* folder_key);

  // Constructs a Registry Key Iterator with specific WOW64 access, one of
  // KEY_WOW64_32KEY or KEY_WOW64_64KEY, or 0.
  // Note: |wow64access| should be the same access used to open |root_key|
  // previously, or a predefined key (e.g. HKEY_LOCAL_MACHINE).
  // See http://msdn.microsoft.com/en-us/library/windows/desktop/aa384129.aspx.
  RegistryValueIterator(HKEY root_key,
                        const wchar_t* folder_key,
                        REGSAM wow64access);

  ~RegistryValueIterator();

  DWORD ValueCount() const;

  // True while the iterator is valid.
  bool Valid() const;

  // Advances to the next registry entry.
  void operator++();

  const wchar_t* Name() const { return name_.c_str(); }
  const wchar_t* Value() const { return value_.data(); }
  // ValueSize() is in bytes.
  DWORD ValueSize() const { return value_size_; }
  DWORD Type() const { return type_; }

  int Index() const { return index_; }

 private:
  // Reads in the current values.
  bool Read();

  void Initialize(HKEY root_key, const wchar_t* folder_key, REGSAM wow64access);

  // The registry key being iterated.
  HKEY key_;

  // Current index of the iteration.
  int index_;

  // Current values.
  std::wstring name_;
  std::vector<wchar_t> value_;
  DWORD value_size_;
  DWORD type_;

  DISALLOW_COPY_AND_ASSIGN(RegistryValueIterator);
};

class BASE_EXPORT RegistryKeyIterator {
 public:
  // Constructs a Registry Key Iterator with default WOW64 access.
  RegistryKeyIterator(HKEY root_key, const wchar_t* folder_key);

  // Constructs a Registry Value Iterator with specific WOW64 access, one of
  // KEY_WOW64_32KEY or KEY_WOW64_64KEY, or 0.
  // Note: |wow64access| should be the same access used to open |root_key|
  // previously, or a predefined key (e.g. HKEY_LOCAL_MACHINE).
  // See http://msdn.microsoft.com/en-us/library/windows/desktop/aa384129.aspx.
  RegistryKeyIterator(HKEY root_key,
                      const wchar_t* folder_key,
                      REGSAM wow64access);

  ~RegistryKeyIterator();

  DWORD SubkeyCount() const;

  // True while the iterator is valid.
  bool Valid() const;

  // Advances to the next entry in the folder.
  void operator++();

  const wchar_t* Name() const { return name_; }

  int Index() const { return index_; }

 private:
  // Reads in the current values.
  bool Read();

  void Initialize(HKEY root_key, const wchar_t* folder_key, REGSAM wow64access);

  // The registry key being iterated.
  HKEY key_;

  // Current index of the iteration.
  int index_;

  wchar_t name_[MAX_PATH];

  DISALLOW_COPY_AND_ASSIGN(RegistryKeyIterator);
};

}  // namespace win
}  // namespace base

#endif  // BASE_WIN_REGISTRY_H_


text:
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.sdk.internal.v8native.protocol.output;

import org.chromium.sdk.internal.v8native.DebuggerCommand;

/**
 * Represents a "source" V8 request message.
 */
public class SourceMessage extends ContextlessDebuggerMessage {

  /**
   * @param frame number. Nullable, default is the selected frame
   * @param fromLine nullable start line within the source. Default is line 0
   * @param toLine nullable end line within the source (this line is not included in the
   *        result). Default is the number of lines in the script
   */
  public SourceMessage(Integer frame, Integer fromLine, Integer toLine) {
    super(DebuggerCommand.SOURCE.value);
    putArgument("frame", frame);
    putArgument("fromLine", fromLine);
    putArgument("toLine", toLine);
  }
}


text: module.exports = require('./dist/index').FileRef;


text:
namespace extensions {

// Represents a file entry that a user has given an app permission to
// access. Must be serializable for persisting to disk.
struct SavedFileEntry {
  SavedFileEntry();

  SavedFileEntry(const std::string& id,
                 const base::FilePath& path,
                 bool is_directory,
                 int sequence_number);

  // The opaque id of this file entry.
  std::string id;

  // The path to a file entry that the app had permission to access.
  base::FilePath path;

  // Whether or not the entry refers to a directory.
  bool is_directory;

  // The sequence number in the LRU of the file entry. The value 0 indicates
  // that the entry is not in the LRU.
  int sequence_number;
};

}  // namespace extensions

#endif  // EXTENSIONS_BROWSER_API_FILE_SYSTEM_SAVED_FILE_ENTRY_H_


text:
package com.cdsf.tag;

/**
 * 标签结构:

{@literal

模糊匹配:

		<input class="checkbox1" type="checkbox" name="" value="" data-fuzzy-ids="#id1, #id2" />

}

 * @author hedingliang
 */
@SuppressWarnings("serial")
public class Fuzzy extends Checkbox {
	private String dataFuzzyIds;

	public String getMore() {
		return getDataFuzzyIds();
	}

	public String getDataFuzzyIds() {
		if (dataFuzzyIds != null) {
			return " data-fuzzy-ids=\"" + dataFuzzyIds + "\"";
		}else {
			return "";
		}
	}
	public void setDataFuzzyIds(String dataFuzzyIds) {
		this.dataFuzzyIds = dataFuzzyIds;
	}
}


text:
from hashlib import md5
from app import app
from app import oid,lm,db
from flask import render_template, flash, redirect, session, url_for, request, g
from flask.ext.login import login_user, logout_user, current_user, login_required
from forms import LoginForm
from models import User, ROLE_USER, ROLE_ADMIN
from flask import render_template
from forms import *

@app.route('/')
@app.route('/index/')
@login_required
def index():
	user = g.user
	posts = [
	{'author':{'nickname':'John'},
	 'body':'Beautiful day in Portland!'
	},
	{'author':{'nickname':'Susan'},
	 'body':'Think in java'
	}
	]
	return render_template(
	'index.html',
	title = 'Home',
	user = user,
	posts = posts,
	)

@app.route('/logout/')
def logout():
	logout_user()
	return redirect(url_for('index'))

@app.before_request
def before_request():
	g.user = current_user
	if g.user.is_authenticated():
		g.user.last_seen = datetime.utcnow()
        db.session.add(g.user)
        db.session.commit()

@app.route('/login/',methods = ['GET','POST'])
@oid.loginhandler
def login():
	if g.user is not None and g.user.is_authenticated():
		return redirect(url_for('index'))
	form = LoginForm()

	if form.validate_on_submit():
		session['remember_me'] = form.remember_me.data
		#flash('Login requested for OpenID="'+form.openid.data+'" remberme :'+str(form.remember_me.data))
		return oid.try_login(form.openid.data,ask_for = ['nickname','email'])

	return render_template('login.html',
	title = 'SignIn',
	form = form,
	providers = app.config['OPENID_PROVIDERS'])

@lm.user_loader
def load_user(id):
	return User.query.get(int(id))

@app.route('/edit/',methods = ['GET','POST'])
@login_required
def edit():
	form = EditForm()
	if form.validate_on_submit():
		g.user.nickname = form.nickname.data
		g.user.about_me = from.about_me.data
		db.session.add(g.user)
		db.session.commit()
		flash('Your changes have be saved')
		return redirect(url_for('edit'))
	else:
		form.nickname.data = g.user.nickname
		form.about_me.data = g.about.me
	return render_template('edit.html',
	form = form,
	)

@oid.after_login
def after_login(resp):
	if resp.email is None or resp.email == "":
		flash('Invalid login.Please try again.')
		redirect(url_for('login'))
	user = User.query.filter_by(email = resp.email).first()
	if user is None:
		nickname = resp.nickname
		if nickname is None or nickname =="":
			nickname = resp.email.split('@')[0]
		user = User(nickname = nickname,email = resp.email,role = ROLE_USER)
		db.session.add(user)
		db.session.commit()
	remember_me = False
	if 'remember_me' in session:
		remember_me = session['remember_me']
		session.pop('remember_me',None)
	login_user(user,remember = remember_me)
	return redirect(request.args.get('next') or url_for('index'))

@app.route('/user/<nickname>')
@login_required
def user(nickname):
	user = User.query.filter_by(nickname = nickname).first()
	if user == None:
		flash('不存在用户:'+nickname+'!')
		return redirect(url_for('index'))
	posts = [
	{'author':user,
	 'body':'Beautiful day in Portland!'
	},
	{'author':user,
	 'body':'Think in java'
	}
	]
	return render_template(
	'user.html',
	user = user,
	posts = posts,
	)