text:
class vrpn_Sound_Server_ASM;
class ASMSound;

typedef struct{
	char m_ASMSoundName[80];
	int	 m_iSoundNum;
} SoundMap;

typedef struct{
	ASMSound*	m_pSound;
	int			repeat;
	float		m_fPos[3];
	float		m_fOri[3];
	wavFt*		wavefile;
	float		m_fMinDist;
} Sound;

typedef struct{
	float		m_fPos[3];
	float		m_fOri[3];
} Listener;

// Macros
#define SAFE_DELETE(p)       { if(p) { delete (p);     (p)=NULL; } }
#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p);   (p)=NULL; } }
#define SAFE_RELEASE(p)      { if(p) { (p)->Release(); (p)=NULL; } }
#define DEG2RAD(x) (x * (PI / 180.0f)) // Converts degrees to radians
#define RAD2DEG(x) (x * (180.0f / PI)) // Converts radians to degrees

class vrpn_Sound_Server_ASM : public vrpn_Sound_Server {

public:
	vrpn_Sound_Server_ASM(const char * name, vrpn_Connection * c );

	~vrpn_Sound_Server_ASM();

	void		playSound(vrpn_SoundID id, vrpn_int32 repeat, vrpn_SoundDef soundDef);
	void		stopSound(vrpn_SoundID id);

	void		loadSoundLocal(char* filename, vrpn_SoundID id, vrpn_SoundDef soundDef);
	void		loadSoundRemote(char* file, vrpn_SoundID id, vrpn_SoundDef soundDef); // not supported
	void		unloadSound(vrpn_SoundID id);
	void		changeSoundStatus(vrpn_SoundID id, vrpn_SoundDef soundDef);

	void		setListenerPose(vrpn_PoseDef pose);
	void		setListenerVelocity(vrpn_float64 *velocity);

	void		setSoundPose(vrpn_SoundID id, vrpn_PoseDef pose);
	void		setSoundVelocity(vrpn_SoundID id, vrpn_float64 *velocity);
	void		setSoundDistInfo(vrpn_SoundID id, vrpn_float64 *distinfo);
	void		setSoundConeInfo(vrpn_SoundID id, vrpn_float64 *coneinfo);

	void		setSoundDoplerFactor(vrpn_SoundID id, vrpn_float64 doplerfactor);
	void		setSoundEqValue(vrpn_SoundID id, vrpn_float64 eqvalue); // not supported
	void		setSoundPitch(vrpn_SoundID id, vrpn_float64 pitch);
	void		setSoundVolume(vrpn_SoundID id, vrpn_float64 volume);

	void		GetSoundList(void);

	// These are not supported
	void		loadModelLocal(const char * filename);
	void		loadModelRemote();	// not supported
	void		loadPolyQuad(vrpn_QuadDef * quad);
	void		loadPolyTri(vrpn_TriDef * tri);
	void		loadMaterial(vrpn_MaterialDef * material, vrpn_int32 id);
	void		setPolyQuadVertices(vrpn_float64 vertices[4][3], const vrpn_int32 id);
	void		setPolyTriVertices(vrpn_float64 vertices[3][3], const vrpn_int32 id);
	void		setPolyOF(vrpn_float64 OF, vrpn_int32 tag);
	void		setPolyMaterial(const char * material, vrpn_int32 tag);
	// end of unsupported functions

	void		mainloop();
	bool		noSounds(void);
	void		stopAllSounds();
	void		shutDown();

	vrpn_float64 GetCurrentVolume(const vrpn_int32 CurrentSoundId);
	vrpn_int32   GetCurrentPlaybackRate(const vrpn_int32 CurrentSoundId);
	void         GetCurrentPosition(const vrpn_int32 CurrentSoundId, float* X_val, float* Y_val, float* Z_val);
	void         GetListenerPosition(float* X_val, float* Y_val, float* Z_val);
	void         GetCurrentDistances(const vrpn_int32 CurrentSoundId, float* FMin, float* FMax);
	void         GetListenerOrientation(float* yaw, float *pitch, float *roll);
	void         GetCurrentOrientation(const vrpn_int32 CurrentSoundId,float *yaw, float *pitch, float *roll);

	vrpn_int32  LastSoundId;		//ID of last played sound

private:

	// the idea of a map is to have a way to go from the unique id being passed in
	// by the user to an internal identifier...

	HRESULT        lasterror;
	vrpn_int32     maxSounds;
	vrpn_int32     numSounds;
	SoundMap	   g_soundMap[MAX_NUMBER_SOUNDS];
	vrpn_int32     numconnections; // number of times server has been connected to..
};

class ASMSound
{

public:
    wavFt*	m_pWav;
  	float	m_fVolume;
	float		m_fPos[3];
	float		m_fOri[3];
	float	m_fMinDist;

	ASMSound( wavFt* pWav );
    virtual ~ASMSound();
    void Play(int id, int repeat, float fVolume = 0);
    void Stop(int id);
    void Reset(int id);
    BOOL    IsSoundPlaying(int id);
};

#endif //_WIN32
#endif


text:
package com.mossle.user.web.user;

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

import com.mossle.api.scope.ScopeHolder;

import com.mossle.core.export.Exportor;
import com.mossle.core.export.TableModel;
import com.mossle.core.hibernate.PropertyFilter;
import com.mossle.core.mapper.BeanMapper;
import com.mossle.core.page.Page;
import com.mossle.core.struts2.BaseAction;

import com.mossle.user.persistence.domain.UserRepo;
import com.mossle.user.persistence.manager.UserRepoManager;

import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Preparable;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import org.springframework.context.MessageSource;
import org.springframework.context.support.MessageSourceAccessor;

@Results({ @Result(name = UserRepoAction.RELOAD, location = "user-repo.do?operationMode=RETRIEVE", type = "redirect") })
public class UserRepoAction extends BaseAction implements
        ModelDriven<UserRepo>, Preparable {
    public static final String RELOAD = "reload";
    private UserRepoManager userRepoManager;
    private MessageSourceAccessor messages;
    private Page page = new Page();
    private UserRepo model;
    private long id;
    private List<Long> selectedItem = new ArrayList<Long>();
    private Exportor exportor = new Exportor();
    private BeanMapper beanMapper = new BeanMapper();

    public String execute() {
        return list();
    }

    public String list() {
        List<PropertyFilter> propertyFilters = PropertyFilter
                .buildFromHttpRequest(ServletActionContext.getRequest());
        propertyFilters.add(new PropertyFilter("EQS_scopeId", ScopeHolder
                .getScopeId()));
        page = userRepoManager.pagedQuery(page, propertyFilters);

        return SUCCESS;
    }

    public void prepareSave() {
        model = new UserRepo();
    }

    public String save() {
        UserRepo dest = null;

        if (id > 0) {
            dest = userRepoManager.get(id);
            beanMapper.copy(model, dest);
        } else {
            dest = model;
        }

        if (id == 0) {
            dest.setScopeId(ScopeHolder.getScopeId());
        }

        userRepoManager.save(dest);

        addActionMessage(messages.getMessage("core.success.save", "保存成功"));

        return RELOAD;
    }

    public String removeAll() {
        List<UserRepo> userRepos = userRepoManager.findByIds(selectedItem);

        boolean success = true;

        for (UserRepo userRepo : userRepos) {
            if (userRepo.getUserSchemas().isEmpty()) {
                userRepoManager.remove(userRepo);
            } else {
                success = false;
                addActionMessage("无法删除" + userRepo.getName());
            }
        }

        if (success) {
            addActionMessage(messages.getMessage("core.success.delete", "删除成功"));
        }

        return RELOAD;
    }

    public String input() {
        if (id > 0) {
            model = userRepoManager.get(id);
        }

        return INPUT;
    }

    public void exportExcel() throws Exception {
        List<PropertyFilter> propertyFilters = PropertyFilter
                .buildFromHttpRequest(ServletActionContext.getRequest());
        page = userRepoManager.pagedQuery(page, propertyFilters);

        List<UserRepo> userRepos = (List<UserRepo>) page.getResult();
        TableModel tableModel = new TableModel();
        tableModel.setName("user-repo");
        tableModel.addHeaders("id", "name", "type", "repoCode", "reference",
                "descn");
        tableModel.setData(userRepos);
        exportor.exportExcel(ServletActionContext.getResponse(), tableModel);
    }

    // ~ ======================================================================
    public void prepare() {
    }

    public UserRepo getModel() {
        return model;
    }

    public void setUserRepoManager(UserRepoManager userRepoManager) {
        this.userRepoManager = userRepoManager;
    }

    public void setMessageSource(MessageSource messageSource) {
        this.messages = new MessageSourceAccessor(messageSource);
    }

    // ~ ======================================================================
    public void setId(long id) {
        this.id = id;
    }

    public Page getPage() {
        return page;
    }

    public void setSelectedItem(List<Long> selectedItem) {
        this.selectedItem = selectedItem;
    }
}

redpajama_set_name: RedPajamaGithub


text:
{-# LANGUAGE FlexibleContexts #-}

module Propellor.Property.SiteSpecific.GitAnnexBuilder where

import Propellor
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.User as User
import qualified Propellor.Property.Cron as Cron
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Systemd as Systemd
import qualified Propellor.Property.Chroot as Chroot
import Propellor.Property.Cron (Times)

builduser :: UserName
builduser = "builder"

homedir :: FilePath
homedir = "/home/builder"

gitbuilderdir :: FilePath
gitbuilderdir = homedir </> "gitbuilder"

builddir :: FilePath
builddir = gitbuilderdir </> "build"

type TimeOut = String -- eg, 5h

autobuilder :: Architecture -> Times -> TimeOut -> Property HasInfo
autobuilder arch crontimes timeout = combineProperties "gitannexbuilder" $ props
	& Apt.serviceInstalledRunning "cron"
	& Cron.niceJob "gitannexbuilder" crontimes (User builduser) gitbuilderdir
		("git pull ; timeout " ++ timeout ++ " ./autobuild")
	& rsyncpassword
  where
	context = Context ("gitannexbuilder " ++ arch)
	pwfile = homedir </> "rsyncpassword"
	-- The builduser account does not have a password set,
	-- instead use the password privdata to hold the rsync server
	-- password used to upload the built image.
	rsyncpassword = withPrivData (Password builduser) context $ \getpw ->
		property "rsync password" $ getpw $ \pw -> do
			oldpw <- liftIO $ catchDefaultIO "" $
				readFileStrict pwfile
			if pw /= oldpw
				then makeChange $ writeFile pwfile pw
				else noChange

tree :: Architecture -> Property HasInfo
tree buildarch = combineProperties "gitannexbuilder tree" $ props
	& Apt.installed ["git"]
	& File.dirExists gitbuilderdir
	& File.ownerGroup gitbuilderdir (User builduser) (Group builduser)
	& gitannexbuildercloned
	& builddircloned
  where
	gitannexbuildercloned = check (not <$> (doesDirectoryExist (gitbuilderdir </> ".git"))) $
		userScriptProperty (User builduser)
			[ "git clone git://git.kitenet.net/gitannexbuilder " ++ gitbuilderdir
			, "cd " ++ gitbuilderdir
			, "git checkout " ++ buildarch
			]
			`describe` "gitbuilder setup"
	builddircloned = check (not <$> doesDirectoryExist builddir) $ userScriptProperty (User builduser)
		[ "git clone git://git-annex.branchable.com/ " ++ builddir
		]

buildDepsApt :: Property HasInfo
buildDepsApt = combineProperties "gitannexbuilder build deps" $ props
	& Apt.buildDep ["git-annex"]
	& buildDepsNoHaskellLibs
	& Apt.buildDepIn builddir
		`describe` "git-annex source build deps installed"

buildDepsNoHaskellLibs :: Property NoInfo
buildDepsNoHaskellLibs = Apt.installed
	["git", "rsync", "moreutils", "ca-certificates",
	"debhelper", "ghc", "curl", "openssh-client", "git-remote-gcrypt",
	"liblockfile-simple-perl", "cabal-install", "vim", "less",
	-- needed by haskell libs
	"libxml2-dev", "libidn11-dev", "libgsasl7-dev", "libgnutls28-dev",
	"alex", "happy", "c2hs"
	]

haskellPkgsInstalled :: String -> Property NoInfo
haskellPkgsInstalled dir = flagFile go ("/haskellpkgsinstalled")
  where
	go = userScriptProperty (User builduser)
		[ "cd " ++ builddir ++ " && ./standalone/" ++ dir ++ "/install-haskell-packages"
		]

-- Installs current versions of git-annex's deps from cabal, but only
-- does so once.
cabalDeps :: Property NoInfo
cabalDeps = flagFile go cabalupdated
	where
		go = userScriptProperty (User builduser) ["cabal update && cabal install git-annex --only-dependencies || true"]
		cabalupdated = homedir </> ".cabal" </> "packages" </> "hackage.haskell.org" </> "00-index.cache"

autoBuilderContainer :: (System -> Property HasInfo) -> System -> Times -> TimeOut -> Systemd.Container
autoBuilderContainer mkprop osver@(System _ arch) crontime timeout =
	Systemd.container name bootstrap
		& mkprop osver
		& buildDepsApt
		& autobuilder arch crontime timeout
  where
	name = arch ++ "-git-annex-builder"
	bootstrap = Chroot.debootstrapped osver mempty

standardAutoBuilder :: System -> Property HasInfo
standardAutoBuilder osver@(System _ arch) =
	propertyList "standard git-annex autobuilder" $ props
		& os osver
		& Apt.stdSourcesList
		& Apt.unattendedUpgrades
		& User.accountFor (User builduser)
		& tree arch

armAutoBuilder :: System -> Property HasInfo
armAutoBuilder osver =
	propertyList "arm git-annex autobuilder" $ props
		& standardAutoBuilder osver
		& buildDepsNoHaskellLibs
		-- Works around ghc crash with parallel builds on arm.
		& (homedir </> ".cabal" </> "config")
			`File.lacksLine` "jobs: $ncpus"
		-- Install patched haskell packages for portability to
		-- arm NAS's using old kernel versions.
		& haskellPkgsInstalled "linux"

androidAutoBuilderContainer :: Times -> TimeOut -> Systemd.Container
androidAutoBuilderContainer crontimes timeout =
	androidContainer "android-git-annex-builder" (tree "android") builddir
		& Apt.unattendedUpgrades
		& buildDepsNoHaskellLibs
		& autobuilder "android" crontimes timeout

-- Android is cross-built in a Debian i386 container, using the Android NDK.
androidContainer
	:: (IsProp (Property (CInfo NoInfo i)), (Combines (Property NoInfo) (Property i)))
	=> Systemd.MachineName
	-> Property i
	-> FilePath
	-> Systemd.Container
androidContainer name setupgitannexdir gitannexdir = Systemd.container name bootstrap
	& os osver
	& Apt.stdSourcesList
	& User.accountFor (User builduser)
	& File.dirExists gitbuilderdir
	& File.ownerGroup homedir (User builduser) (Group builduser)
	& flagFile chrootsetup ("/chrootsetup")
		`requires` setupgitannexdir
	& haskellPkgsInstalled "android"
  where
	-- Use git-annex's android chroot setup script, which will install
	-- ghc-android and the NDK, all build deps, etc, in the home
	-- directory of the builder user.
	chrootsetup = scriptProperty
		[ "cd " ++ gitannexdir ++ " && ./standalone/android/buildchroot-inchroot"
		]
	osver = System (Debian (Stable "jessie")) "i386"
	bootstrap = Chroot.debootstrapped osver mempty


text:
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Management.StreamAnalytics;
using Microsoft.Azure.Management.StreamAnalytics.Models;

namespace Microsoft.Azure.Management.StreamAnalytics
{
    public static partial class JobOperationsExtensions
    {
        /// <summary>
        /// Delete a stream analytics job.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        public static LongRunningOperationResponse BeginDelete(this IJobOperations operations, string resourceGroupName, string jobName)
        {
            return Task.Factory.StartNew((object s) =>
            {
                return ((IJobOperations)s).BeginDeleteAsync(resourceGroupName, jobName);
            }
            , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
        }

        /// <summary>
        /// Delete a stream analytics job.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        public static Task<LongRunningOperationResponse> BeginDeleteAsync(this IJobOperations operations, string resourceGroupName, string jobName)
        {
            return operations.BeginDeleteAsync(resourceGroupName, jobName, CancellationToken.None);
        }

        /// <summary>
        /// Start a stream analytics job. Asynchronous call.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        public static LongRunningOperationResponse BeginStart(this IJobOperations operations, string resourceGroupName, string jobName)
        {
            return Task.Factory.StartNew((object s) =>
            {
                return ((IJobOperations)s).BeginStartAsync(resourceGroupName, jobName);
            }
            , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
        }

        /// <summary>
        /// Start a stream analytics job. Asynchronous call.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        public static Task<LongRunningOperationResponse> BeginStartAsync(this IJobOperations operations, string resourceGroupName, string jobName)
        {
            return operations.BeginStartAsync(resourceGroupName, jobName, CancellationToken.None);
        }

        /// <summary>
        /// Stop a stream analytics job. Asynchronous call.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        public static LongRunningOperationResponse BeginStop(this IJobOperations operations, string resourceGroupName, string jobName)
        {
            return Task.Factory.StartNew((object s) =>
            {
                return ((IJobOperations)s).BeginStopAsync(resourceGroupName, jobName);
            }
            , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
        }

        /// <summary>
        /// Stop a stream analytics job. Asynchronous call.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        public static Task<LongRunningOperationResponse> BeginStopAsync(this IJobOperations operations, string resourceGroupName, string jobName)
        {
            return operations.BeginStopAsync(resourceGroupName, jobName, CancellationToken.None);
        }

        /// <summary>
        /// Create or update a stream analytics job.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// Required. The parameters required to create or update a stream
        /// analytics job.
        /// </param>
        /// <returns>
        /// The response of the create stream analytics job operation.
        /// </returns>
        public static JobCreateOrUpdateResponse CreateOrUpdate(this IJobOperations operations, string resourceGroupName, JobCreateOrUpdateParameters parameters)
        {
            return Task.Factory.StartNew((object s) =>
            {
                return ((IJobOperations)s).CreateOrUpdateAsync(resourceGroupName, parameters);
            }
            , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
        }

        /// <summary>
        /// Create or update a stream analytics job.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// Required. The parameters required to create or update a stream
        /// analytics job.
        /// </param>
        /// <returns>
        /// The response of the create stream analytics job operation.
        /// </returns>
        public static Task<JobCreateOrUpdateResponse> CreateOrUpdateAsync(this IJobOperations operations, string resourceGroupName, JobCreateOrUpdateParameters parameters)
        {
            return operations.CreateOrUpdateAsync(resourceGroupName, parameters, CancellationToken.None);
        }

        /// <summary>
        /// Create or update a stream analytics job. The raw json content will
        /// be used.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// Required. The parameters required to create or update a stream
        /// analytics job.
        /// </param>
        /// <returns>
        /// The response of the create stream analytics job operation.
        /// </returns>
        public static JobCreateOrUpdateResponse CreateOrUpdateWithRawJsonContent(this IJobOperations operations, string resourceGroupName, string jobName, JobCreateOrUpdateWithRawJsonContentParameters parameters)
        {
            return Task.Factory.StartNew((object s) =>
            {
                return ((IJobOperations)s).CreateOrUpdateWithRawJsonContentAsync(resourceGroupName, jobName, parameters);
            }
            , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
        }

        /// <summary>
        /// Create or update a stream analytics job. The raw json content will
        /// be used.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// Required. The parameters required to create or update a stream
        /// analytics job.
        /// </param>
        /// <returns>
        /// The response of the create stream analytics job operation.
        /// </returns>
        public static Task<JobCreateOrUpdateResponse> CreateOrUpdateWithRawJsonContentAsync(this IJobOperations operations, string resourceGroupName, string jobName, JobCreateOrUpdateWithRawJsonContentParameters parameters)
        {
            return operations.CreateOrUpdateWithRawJsonContentAsync(resourceGroupName, jobName, parameters, CancellationToken.None);
        }

        /// <summary>
        /// Delete a stream analytics job.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. A unique stream analytics job name.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        public static LongRunningOperationResponse Delete(this IJobOperations operations, string resourceGroupName, string jobName)
        {
            return Task.Factory.StartNew((object s) =>
            {
                return ((IJobOperations)s).DeleteAsync(resourceGroupName, jobName);
            }
            , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
        }

        /// <summary>
        /// Delete a stream analytics job.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. A unique stream analytics job name.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        public static Task<LongRunningOperationResponse> DeleteAsync(this IJobOperations operations, string resourceGroupName, string jobName)
        {
            return operations.DeleteAsync(resourceGroupName, jobName, CancellationToken.None);
        }

        /// <summary>
        /// Get a stream analytics job.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// Required. The parameters required to get a stream analytics job.
        /// </param>
        /// <returns>
        /// The response of the get stream analytics job operation.
        /// </returns>
        public static JobGetResponse Get(this IJobOperations operations, string resourceGroupName, string jobName, JobGetParameters parameters)
        {
            return Task.Factory.StartNew((object s) =>
            {
                return ((IJobOperations)s).GetAsync(resourceGroupName, jobName, parameters);
            }
            , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
        }

        /// <summary>
        /// Get a stream analytics job.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// Required. The parameters required to get a stream analytics job.
        /// </param>
        /// <returns>
        /// The response of the get stream analytics job operation.
        /// </returns>
        public static Task<JobGetResponse> GetAsync(this IJobOperations operations, string resourceGroupName, string jobName, JobGetParameters parameters)
        {
            return operations.GetAsync(resourceGroupName, jobName, parameters, CancellationToken.None);
        }

        /// <summary>
        /// List all the stream analytics jobs in the given resource group.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// Required. The parameters required to list all the stream analytics
        /// job in the same resource group.
        /// </param>
        /// <returns>
        /// The response of the list stream analytics job operation.
        /// </returns>
        public static JobListResponse ListJobsInResourceGroup(this IJobOperations operations, string resourceGroupName, JobListParameters parameters)
        {
            return Task.Factory.StartNew((object s) =>
            {
                return ((IJobOperations)s).ListJobsInResourceGroupAsync(resourceGroupName, parameters);
            }
            , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
        }

        /// <summary>
        /// List all the stream analytics jobs in the given resource group.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// Required. The parameters required to list all the stream analytics
        /// job in the same resource group.
        /// </param>
        /// <returns>
        /// The response of the list stream analytics job operation.
        /// </returns>
        public static Task<JobListResponse> ListJobsInResourceGroupAsync(this IJobOperations operations, string resourceGroupName, JobListParameters parameters)
        {
            return operations.ListJobsInResourceGroupAsync(resourceGroupName, parameters, CancellationToken.None);
        }

        /// <summary>
        /// List all the stream analytics jobs in the given subscription.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='parameters'>
        /// Required. The parameters required to list all the stream analytics
        /// job in the same subscription.
        /// </param>
        /// <returns>
        /// The response of the list stream analytics job operation.
        /// </returns>
        public static JobListResponse ListJobsInSubscription(this IJobOperations operations, JobListParameters parameters)
        {
            return Task.Factory.StartNew((object s) =>
            {
                return ((IJobOperations)s).ListJobsInSubscriptionAsync(parameters);
            }
            , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
        }

        /// <summary>
        /// List all the stream analytics jobs in the given subscription.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='parameters'>
        /// Required. The parameters required to list all the stream analytics
        /// job in the same subscription.
        /// </param>
        /// <returns>
        /// The response of the list stream analytics job operation.
        /// </returns>
        public static Task<JobListResponse> ListJobsInSubscriptionAsync(this IJobOperations operations, JobListParameters parameters)
        {
            return operations.ListJobsInSubscriptionAsync(parameters, CancellationToken.None);
        }

        /// <summary>
        /// Start a stream analytics job.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        public static LongRunningOperationResponse Start(this IJobOperations operations, string resourceGroupName, string jobName)
        {
            return Task.Factory.StartNew((object s) =>
            {
                return ((IJobOperations)s).StartAsync(resourceGroupName, jobName);
            }
            , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
        }

        /// <summary>
        /// Start a stream analytics job.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        public static Task<LongRunningOperationResponse> StartAsync(this IJobOperations operations, string resourceGroupName, string jobName)
        {
            return operations.StartAsync(resourceGroupName, jobName, CancellationToken.None);
        }

        /// <summary>
        /// Stop a stream analytics job.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        public static LongRunningOperationResponse Stop(this IJobOperations operations, string resourceGroupName, string jobName)
        {
            return Task.Factory.StartNew((object s) =>
            {
                return ((IJobOperations)s).StopAsync(resourceGroupName, jobName);
            }
            , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
        }

        /// <summary>
        /// Stop a stream analytics job.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <returns>
        /// A standard service response for long running operations.
        /// </returns>
        public static Task<LongRunningOperationResponse> StopAsync(this IJobOperations operations, string resourceGroupName, string jobName)
        {
            return operations.StopAsync(resourceGroupName, jobName, CancellationToken.None);
        }

        /// <summary>
        /// Update a stream analytics job.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// Required. The parameters required to update a stream analytics job.
        /// </param>
        /// <returns>
        /// The response of the patch job operation.
        /// </returns>
        public static JobPatchResponse Update(this IJobOperations operations, string resourceGroupName, string jobName, JobPatchParameters parameters)
        {
            return Task.Factory.StartNew((object s) =>
            {
                return ((IJobOperations)s).UpdateAsync(resourceGroupName, jobName, parameters);
            }
            , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
        }

        /// <summary>
        /// Update a stream analytics job.
        /// </summary>
        /// <param name='operations'>
        /// Reference to the
        /// Microsoft.Azure.Management.StreamAnalytics.IJobOperations.
        /// </param>
        /// <param name='resourceGroupName'>
        /// Required. The resource group name of the stream analytics job.
        /// </param>
        /// <param name='jobName'>
        /// Required. The name of the stream analytics job.
        /// </param>
        /// <param name='parameters'>
        /// Required. The parameters required to update a stream analytics job.
        /// </param>
        /// <returns>
        /// The response of the patch job operation.
        /// </returns>
        public static Task<JobPatchResponse> UpdateAsync(this IJobOperations operations, string resourceGroupName, string jobName, JobPatchParameters parameters)
        {
            return operations.UpdateAsync(resourceGroupName, jobName, parameters, CancellationToken.None);
        }
    }
}


text:
<?php

namespace App\Model;

use App\Record\HistoryRecord;

class History extends BaseModel
{
    private $package;

    public function __construct(Package $package, $downloads, $stars)
    {
        parent::__construct(new HistoryRecord());
        $this->record['package_id'] = $package->getId();
        $this->record['downloads'] = $package->getDownloads();
        $this->record['stars'] = $package->getStars();
        $this->record['new_downloads'] = $downloads;
        $this->record['new_stars'] = $stars;
        $this->record->setTimestampField('date', new \DateTime());
    }

    public static function createFromRecord(HistoryRecord $record)
    {
        return parent::constructFromRecord($record);
    }

    public function setPackage(Package $package)
    {
        if ($package->getId() !== $this->getPackageId()) {
            throw new \InvalidArgumentException('Wrong owner package provided');
        }

        $this->package = $package;
    }

    public function getPackage()
    {
        if (!isset($this->package)) {
            throw new \RuntimeException('Owner package has not been set');
        }

        return $this->package;
    }

    public function getId()
    {
        return (int) $this->record['id'];
    }

    public function getPackageId()
    {
        return (int) $this->record['package_id'];
    }

    public function getDownloads()
    {
        return (int) $this->record['downloads'];
    }

    public function getNewDownloads()
    {
        $value = $this->record['new_downloads'];
        return $value === null ? null : (int) $value;
    }

    public function getStars()
    {
        return (int) $this->record['stars'];
    }

    public function getNewStars()
    {
        $value = $this->record['new_stars'];
        return $value === null ? null : (int) $value;
    }

    public function getDate()
    {
        return $this->record->getTimestampField('date');
    }
}


text:
using FinancialData;
using FinancialData.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TaLib.Extension;

namespace Indices.Elder.Research {
  public class BullPower {
    public List<IInstantValue<double>> InstantValues { get; private set; }
    public int FirstValidSample { get; private set; }
    public int Count { get { return InstantValues.Count; } }
    public BullPower(List<IBar> bars, int period) {
      InstantValues = new List<IInstantValue<double>>();
      TaResult ema = bars.EMA(period);
      int count = ema.Count;
      if (count != bars.Count) {
        throw new Exception("Samples count can't be different");
      }
      FirstValidSample = ema.FirstValidSample;
      for (int i = 0; i < count; i++) {
        DateTime dateTime = bars[i].DateTime;
        double bullPower = 0;
        if (i >= FirstValidSample) {
          double high = (double)bars[i].High;
          double emaValue = ema.InstantValues[i].Value;
          bullPower = high - emaValue;
        }
        InstantValues.Add(new InstantValue<double>(dateTime, bullPower));
      }
    }
  }
}


text:
<?php
$TRANSLATIONS = array(
"Version not found" => "Non se atopa a versión",
"Upgrade is not possible. Your web server does not have permission to remove the following directory:" => "A actualización non é posible. O seu servidor non ten permiso para eliminar o seguinte directorio:",
"Update permissions on this directory and its content or remove it manually first." => "Actualice os permisos deste directorio e o seu contido ou retíreo manualmente antes.",
"Update failed." => "Non foi posíbel facer a actualización.",
"The update was unsuccessful. Please check logs at admin page and report this issue to the ownCloud community." => "A actualización non foi satisfactoria. Comprobe os rexistros na páxina de administración e informe deste problema á  comunidade de ownCloud.",
"Server error. Please check web server log file for details" => "Erro no servidor. Por favor comprobe o ficheiro de rexistro do servidor para máis detalles.",
"Retry" => "Tentar de novo",
"Here is your backup:" => "Aquí está a sua copia de respaldo:",
"Proceed" => "Proceder",
"All done. Click to the link below to start database upgrade." => "Feito todo. Prema na ligazón de embaixo para comezar a actualización da base de datos.",
"Please ask your server administrator to enable PHP zip extension." => "Por favor pídalle ao seu administrador de sistema que habilite a extensión PHP zip.",
"Not possible to update %s to %s. Downgrading or skipping major releases is not supported." => "Non é posible actualizar %s a %s. Regresións ou saltar lanzamentos maiores non está soportado.",
"Make sure that your web server has read access to the following files and directories:" => "Asegúrese de que o seu servidor web ten acceso de lectura aos seguintes ficheiros e directorios:",
"Make sure that your web server has write access to the following files and directories:" => "Asegúrese de que o seu servidor web ten acceso de escritura aos seguintes ficheiros e directorios:",
"Updater" => "Actualizador",
"Open Update Center" => "Abrir centro de actualizacións",
"Updates" => "Actualizacións",
"A new version is available: %s" => "Unha nova versión está dispoñible: %s",
"Up to date. Checked on %s" => "Actualizado. Comprobado o %s",
"1. Check & Backup" => "1. Comprobar & Respaldar",
"2. Download & Extract" => "2. Descargar & Extraer",
"3. Replace" => "3. Substituír",
"Update" => "Actualizar",
"Backups" => "Respaldos",
"Backup directory" => "Directorio das copias de seguranza",
"No backups found" => "Non se atoparon copias de seguranza",
"Backup" => "Copia de seguranza",
"Done on" => "Feito o",
"Download" => "Descargar",
"Delete" => "Eliminar"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";


text:
namespace ash {
namespace test {

TestSessionStateDelegate::TestSessionStateDelegate()
    : has_active_user_(true),
      active_user_session_started_(true),
      can_lock_screen_(true),
      screen_locked_(false) {
}

TestSessionStateDelegate::~TestSessionStateDelegate() {
}

bool TestSessionStateDelegate::HasActiveUser() const {
  return has_active_user_;
}

bool TestSessionStateDelegate::IsActiveUserSessionStarted() const {
  return active_user_session_started_;
}

bool TestSessionStateDelegate::CanLockScreen() const {
  return has_active_user_ && can_lock_screen_;
}

bool TestSessionStateDelegate::IsScreenLocked() const {
  return screen_locked_;
}

void TestSessionStateDelegate::LockScreen() {
  if (CanLockScreen())
    screen_locked_ = true;
}

void TestSessionStateDelegate::UnlockScreen() {
  screen_locked_ = false;
}

void TestSessionStateDelegate::SetHasActiveUser(bool has_active_user) {
  has_active_user_ = has_active_user;
  if (!has_active_user)
    active_user_session_started_ = false;
}

void TestSessionStateDelegate::SetActiveUserSessionStarted(
    bool active_user_session_started) {
  active_user_session_started_ = active_user_session_started;
  if (active_user_session_started)
    has_active_user_ = true;
}

void TestSessionStateDelegate::SetCanLockScreen(bool can_lock_screen) {
  can_lock_screen_ = can_lock_screen;
}

}  // namespace test
}  // namespace ash


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel;
using System.Runtime.Serialization;

namespace ASPPatterns.Chap9.PeriodicRefresh.Service
{
    [DataContract]
    public class Commentary
    {
        [DataMember]
        public int Id { get; set; }
        [DataMember]
        public string Time { get; set; }
        [DataMember]
        public DateTime RealTime { get; set; }
        [DataMember]
        public string Text { get; set; }
    }
}


text:
// MQTT Thing Accessory plugin for Homebridge
// MQTT Library

'use strict'; // eslint-disable-line

const mqtt = require( "mqtt" );
const path = require( "path" );
const fs = require( "fs" );
const jsonpath = require( "jsonpath" );

var mqttlib = new function() {

    function makeCodecPath( codec, homebridgePath ) {
        let codecPath = codec;
        // if it doesn't start with a '/' (i.e. not fully-qualified)...
        if( codecPath[ 0 ] != '/' ) {
            if( codecPath.substr( codecPath.length - 3 ) !== '.js' ) {
                // no js extension - assume it's an internal codec
                codecPath = path.join( __dirname, '../codecs/', codecPath + '.js' );
            } else {
                // relative external codec is relative to homebridge userdata
                codecPath = path.join( homebridgePath, codecPath );
            }
        }
        return codecPath;
    }

    function optimizedPublish( topic, message, ctx ) {
        const { config, log, mqttClient } = ctx;
        const messageString = message.toString();
        if( config.optimizePublishing && ctx.lastPubValues ) {
            if( ctx.lastPubValues[ topic ] == messageString ) {
                // optimized - don't publish
                return;
            }
            // store what we're about to publish
            ctx.lastPubValues[ topic ] = messageString;
        }
        if( config.logMqtt ) {
            log( 'Publishing MQTT: ' + topic + ' = ' + messageString );
        }
        mqttClient.publish( topic, messageString, config.mqttPubOptions );
    }

    //! Initialise MQTT. Requires context ( { log, config } ).
    //! Context populated with mqttClient and mqttDispatch, and if publishing optimization is enabled lastPubValues.
    this.init = function( ctx ) {
        // MQTT message dispatch
        let mqttDispatch = ctx.mqttDispatch = {}; // map of topic to [ function( topic, message ) ] to handle
        let propDispatch = ctx.propDispatch = {}; // map of property to [ rawhandler( topic, message ) ]

        let { config, log } = ctx;

        // create cache of last-published values for publishing optimization
        if( config.optimizePublishing ) {
            ctx.lastPubValues = {};
        }

        let logmqtt = config.logMqtt;
        var clientId = 'mqttthing_' + config.name.replace(/[^\x20-\x7F]/g, "") + '_' + Math.random().toString(16).substr(2, 8);

        // Load any codec
        if( config.codec ) {
            let codecPath = makeCodecPath( config.codec, ctx.homebridgePath );
            if( fs.existsSync( codecPath ) ) {
                // load codec
                log( 'Loading codec from ' + codecPath );
                let codecMod = require( codecPath );
                if( typeof codecMod.init === "function" ) {

                    // direct publishing
                    let directPub = function( topic, message ) {
                        optimizedPublish( topic, message, ctx );
                    };

                    // notification by property
                    let notifyByProp = function( property, message ) {
                        let handlers = propDispatch[ property ];
                        if( handlers ) {
                            for( let i = 0; i < handlers.length; i++ ) {
                                handlers[ i ]( '_prop-' + property, message );
                            }
                        }
                    };

                    // initialise codec
                    let codec = ctx.codec = codecMod.init( { log, config, publish: directPub, notify: notifyByProp } );
                    if( codec ) {
                        // encode/decode must be functions
                        if( typeof codec.encode !== "function" ) {
                            log.warn( 'No codec encode() function' );
                            codec.encode = null;
                        }
                        if( typeof codec.decode !== "function" ) {
                            log.warn( 'No codec decode() function' );
                            codec.decode = null;
                        }
                    }
                } else {
                    // no initialisation function
                    log.error( 'ERROR: No codec initialisation function returned from ' + codecPath );
                }
            } else {
                log.error( 'ERROR: Codec file [' + codecPath + '] does not exist' );
            }
        }

        // start with any configured options object
        var options = config.mqttOptions || {};

        // standard options set by mqtt-thing
        var myOptions = {
            keepalive: 10,
            clientId: clientId,
            protocolId: 'MQTT',
            protocolVersion: 4,
            clean: true,
            reconnectPeriod: 1000,
            connectTimeout: 30 * 1000,
            will: {
                topic: 'WillMsg',
                payload: 'mqtt-thing [' + ctx.config.name + '] has stopped',
                qos: 0,
                retain: false
            },
            username: config.username || process.env.MQTTTHING_USERNAME,
            password: config.password || process.env.MQTTTHING_PASSWORD,
            rejectUnauthorized: false
        };

        // copy standard options into options unless already set by user
        for( var opt in myOptions ) {
            if( myOptions.hasOwnProperty( opt ) && ! options.hasOwnProperty( opt ) ) {
                options[ opt ] = myOptions[ opt ];
            }
        }

        // load ca/cert/key files
        if( options.cafile ) {
            options.ca = fs.readFileSync( options.cafile );
        }
        if( options.certfile ) {
            options.cert = fs.readFileSync( options.certfile );
        }
        if( options.keyfile ) {
            options.key = fs.readFileSync( options.keyfile );
        }

        // insecure
        if( options.insecure ) {
            options.checkServerIdentity = function( /* servername, cert */ ) {
                return undefined; /* servername and certificate are verified */
            };
        }

        // add protocol to url string, if not yet available
        let brokerUrl = config.url || process.env.MQTTTHING_URL;
        if( brokerUrl && ! brokerUrl.includes( '://' ) ) {
            brokerUrl = 'mqtt://' + brokerUrl;
        }

        // log MQTT settings
        if( logmqtt ) {
            log( 'MQTT URL: ' + brokerUrl );
            log( 'MQTT options: ' + JSON.stringify( options, function( k, v ) {
                if( k == "password" ) {
                    return undefined; // filter out
                }
                return v;
            } ) );
        }

        // create MQTT client
        var mqttClient = mqtt.connect(brokerUrl, options);
        mqttClient.on('error', function (err) {
            log('MQTT Error: ' + err);
        });

        mqttClient.on('message', function (topic, message) {
            if (logmqtt) {
                log("Received MQTT: " + topic + " = " + message);
            }
            let handlers = mqttDispatch[topic];
            if (handlers) {
                for( let i = 0; i < handlers.length; i++ ) {
                    handlers[ i ]( topic, message );
                }
            } else {
                log('Warning: No MQTT dispatch handler for topic [' + topic + ']');
            }
        });

        ctx.mqttClient = mqttClient;
        return mqttClient;
    };

    function getApplyState( ctx, property ) {
        if( ! ctx.hasOwnProperty( 'applyState' ) ) {
            ctx.applyState = { props: {}, global: {} };
        }
        if( ! ctx.applyState.props.hasOwnProperty( property ) ) {
            ctx.applyState.props[ property ] = { global: ctx.applyState.global };
        }
        return ctx.applyState.props[ property ];
    }

    function getCodecFunction( codec, property, functionName ) {
        if( codec ) {
            let fn;
            if( codec.properties && codec.properties[ property ] ) {
                fn = codec.properties[ property ][ functionName ];
            }
            if( fn === undefined ) {
                fn = codec[ functionName ];
            }
            return fn;
        }
    }

    // Subscribe
    this.subscribe = function( ctx, topic, property, handler ) {
        let rawHandler = handler;
        let { mqttDispatch, log, mqttClient, codec, propDispatch, config } = ctx;
        if( ! mqttClient ) {
            log( 'ERROR: Call mqttlib.init() before mqttlib.subscribe()' );
            return;
        }

        // debounce
        if( config.debounceRecvms ) {
            let origHandler = handler;
            let debounceTimeout = null;
            handler = function( intopic, message ) {
                if( debounceTimeout ) {
                    clearTimeout( debounceTimeout );
                }
                debounceTimeout = setTimeout( function() {
                    origHandler( intopic, message );
                }, config.debounceRecvms );
            };
        }

        let extendedTopic = null;
        // send through any apply function
        if (typeof topic != 'string') {
            extendedTopic = topic;
            topic = extendedTopic.topic;
            if (extendedTopic.hasOwnProperty('apply')) {
                let previous = handler;
                let applyFn = Function( "message", "state", extendedTopic['apply'] ); //eslint-disable-line
                handler = function (intopic, message) {
                    let decoded;
                    try {
                        decoded = applyFn( message, getApplyState( ctx, property ) );
                        if( config.logMqtt ) {
                            log( 'apply() function decoded message to [' + decoded + ']' );
                        }
                    } catch( ex ) {
                        log( 'Decode function apply( message) { ' + extendedTopic.apply + ' } failed for topic ' + topic + ' with message ' + message + ' - ' + ex );
                    }
                    if( decoded !== undefined ) {
                        return previous( intopic, decoded );
                    }
                };
            }
        }

        // send through codec's decode function
        let codecDecode = getCodecFunction( codec, property, 'decode' );
        if( codecDecode ) {
            let realHandler = handler;
            let output = function( message ) {
                return realHandler( topic, message );
            };
            handler = function( intopic, message ) {
                let decoded = codecDecode( message, { topic, property, extendedTopic }, output );
                if( config.logMqtt ) {
                    log( 'codec decoded message to [' + decoded + ']' );
                }
                if( decoded !== undefined ) {
                    return output( decoded );
                }
            };
        }

        // register property dispatch (codec only)
        if( codec ) {
            if( propDispatch.hasOwnProperty( property ) ) {
                // new handler for existing property
                propDispatch[ property ].push( rawHandler );
            } else {
                // new property
                propDispatch[ property ] = [ rawHandler ];
                if( ctx.config.logMqtt ) {
                    log( 'Avalable codec notification property: ' + property );
                }
            }
        }

        // JSONPath
        const jsonpathIndex = topic?.indexOf( '$' ) ?? -1;
        if( jsonpathIndex > 0 ) {
            let jsonpathQuery = topic.substring( jsonpathIndex );
            topic = topic.substring( 0, jsonpathIndex );

            const lastHandler = handler;
            handler = function( intopic, message ) {
                const json = JSON.parse( message );
                const values = jsonpath.query( json, jsonpathQuery );
                const output = values.shift();
                if( config.logMqtt ) {
                    log( `jsonpath ${jsonpathQuery} decoded message to [${output}]` );
                }
                return lastHandler( topic, output );
            };
        }

        // register MQTT dispatch and subscribe
        if( mqttDispatch.hasOwnProperty( topic ) ) {
            // new handler for existing topic
            mqttDispatch[ topic ].push( handler );
        } else {
            // new topic
            mqttDispatch[ topic ] = [ handler ];
            mqttClient.subscribe(topic);
        }
    };

    // Publish
    this.publish = function( ctx, topic, property, message ) {
        let { log, mqttClient, codec } = ctx;
        if( ! mqttClient ) {
            log( 'ERROR: Call mqttlib.init() before mqttlib.publish()' );
            return;
        }

        if( message === null || topic === undefined ) {
            return; // don't publish if message is null or topic is undefined
        }

        let extendedTopic = null;
        // first of all, pass message through any user-supplied apply() function
        if (typeof topic != 'string') {
            // encode data with user-supplied apply() function
            extendedTopic = topic;
            topic = extendedTopic.topic;
            if (extendedTopic.hasOwnProperty('apply')) {
                var applyFn = Function( "message", "state", extendedTopic['apply'] ); //eslint-disable-line
                try {
                    message = applyFn( message, getApplyState( ctx, property ) );
                } catch( ex ) {
                    log( 'Encode function apply( message ) { ' + extendedTopic.apply + ' } failed for topic ' + topic + ' with message ' + message + ' - ' + ex );
                    message = null; // stop publish
                }
                if( message === null || message === undefined ) {
                    return;
                }
            }
        }

        function publishImpl( finalMessage ) {
            optimizedPublish( topic, finalMessage, ctx );
        }

        // publish directly or through codec
        let codecEncode = getCodecFunction( codec, property, 'encode' );
        if( codecEncode ) {
            // send through codec's encode function
            let encoded = codecEncode( message, { topic, property, extendedTopic }, publishImpl );
            if( encoded !== undefined ) {
                publishImpl( encoded );
            }
        } else {
            // publish as-is
            publishImpl( message );
        }
    };

    // Confirmed publisher
    this.makeConfirmedPublisher = function( ctx, setTopic, getTopic, property, makeConfirmed ) {

        let { state, config, log } = ctx;

        // if confirmation isn't being used, just return a simple publishing function
        if( ! config.confirmationPeriodms || ! getTopic || ! makeConfirmed ) {
            // no confirmation - return generic publishing function
            return function( message ) {
                mqttlib.publish( ctx, setTopic, property, message );
            };
        }

        var timer = null;
        var expected = null;
        var indicatedOffline = false;
        var retriesRemaining = 0;

        // subscribe to our get topic
        mqttlib.subscribe( ctx, getTopic, property, function( topic, message ) {
            if( ( message === expected || message == ( expected + '' ) ) && timer ) {
                clearTimeout( timer );
                timer = null;
            }
            if( indicatedOffline && ! timer ) {
                // if we're not waiting (or no-longer waiting), a message clears the offline state
                state.online = true;
                indicatedOffline = false;
                log( 'Setting accessory state to online' );
            }
        } );

        // return enhanced publishing function
        return function( message ) {
            // clear any existing confirmation timer
            if( timer ) {
                clearTimeout( timer );
                timer = null;
            }

            // confirmation timeout function
            function confirmationTimeout() {
                // confirmation period has expired
                timer = null;
                // indicate offline (unless accessory is publishing this explicitly - overridden with confirmationIndicateOffline)
                if( config.confirmationIndicateOffline !== false && ( ! config.topics.getOnline || config.confirmationIndicateOffline === true ) && ! indicatedOffline ) {
                    state.online = false;
                    indicatedOffline = true;
                    log( 'Setting accessory state to offline' );
                }

                // retry
                if( retriesRemaining > 0 ) {
                    --retriesRemaining;
                    publish();
                } else {
                    log( 'Unresponsive - no confirmation message received on ' + getTopic + ". Expecting [" + expected + "]." );
                }
            }

            function publish() {
                // set confirmation timer
                timer = setTimeout( confirmationTimeout, config.confirmationPeriodms );

                // publish
                expected = message;
                mqttlib.publish( ctx, setTopic, property, message );
            }

            // initialise retry counter
            retriesRemaining = ( config.retryLimit === undefined ) ? 3 : config.retryLimit;

            // initial publish
            publish();
        };
    };

};

module.exports = mqttlib;


text:
module app.services {
    'use strict';

    export interface ICommonServices {
        getBlog(max?:number, permalink?:string): ng.IPromise<any>;
        getRandomWord(): ng.IPromise<any>;
    }

    class CommonServices implements ICommonServices {
        blogs: any[];

        static $inject = ['$http', '$q'];

        constructor(private $http:ng.IHttpService, private $q:ng.IQService) {
            this.blogs = [];
        }

        getBlog(max?:number, permalink?:string):ng.IPromise<any> {
            var _this = this;
            var limit = max || 10;
            var q = _this.$q.defer();

            if (_this.blogs.length === 0){
                _this.$http.get('/api/blogs?limit=' + limit + '&permalink=' + permalink)
                .then((res: any) => {
                    _this.blogs = res.data;
                    q.resolve(_this.blogs);
                });

                return q.promise;
            }

            q.resolve(_this.blogs);

            return q.promise;
        }

        getRandomWord():ng.IPromise<any> {
            var _this = this;
            var q = _this.$q.defer();

            _this.$http.get('/api/quotes').then(res => { q.resolve(res.data); });

            return q.promise;
        }

    }

    angular.module('app.services')
        .service('CommonServices', CommonServices);
}


text:
'use strict';

describe('MessageActionCreators', function() {
  var action;

  beforeEach(function() {
    action = require('actions/MessageActionCreators.js');
  });

  it('should be defined', function() {
    expect(action).toBeDefined();
  });
});


text:
class Adm::UsersController < ApplicationController
  before_action :access_foward_if_not_logged
  before_action :set_adm_user, only: [:show, :edit, :update, :destroy]

  layout "corporate"

  # GET /adm/users
  # GET /adm/users.json
  def index
    if @current_user.user_access.name == "emp"
      @adm_users = Adm::User.where( corporate_id: @current_user.corporate_id )
    end

    if @current_user.user_access.name == "opr"
      @adm_users = Adm::User.where( id: @current_user.id)
    end

    if @current_user.user_access.name == "adm"
      @adm_users = Adm::User.all
      render 'adm/users/index_adm'
      return
    end

  end

  # GET /adm/users/1
  # GET /adm/users/1.json
  def show
  end

  # GET /adm/users/new
  def new
    @adm_user = Adm::User.new
    @adm_access = Adm::UserAccess.all
  end

  # GET /adm/users/1/edit
  def edit
  end

  # POST /adm/users
  # POST /adm/users.json
  def create
    @adm_user = Adm::User.new(adm_user_params)

    if @adm_user.user_access_id == 1
      @adm_user.corporate_id = nil
    end

    respond_to do |format|
      if @adm_user.save
        #if @current_user.user_access.name == "emp"
        #  Util::UserMailer.welcome_email_corp(@adm_user).deliver
        #else
        #  Util::UserMailer.welcome_email(@adm_user).deliver
        #end
        format.html { redirect_to adm_users_path, notice: 'Usuário criado com sucesso.' }
        format.json { render action: 'show', status: :created, location: @adm_user }
      else
        format.html { render action: 'new' }
        format.json { render json: @adm_user.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /adm/users/1
  # PATCH/PUT /adm/users/1.json
  def update

		if @adm_user.user_access_id == 1
			@adm_user.corporate_id = nil
		end

    respond_to do |format|
      if @adm_user.update(adm_user_params)
        format.html { redirect_to adm_users_path, notice: 'Usuário alterado com sucesso.' }
        format.json { head :no_content }
      else
        format.html { render action: 'edit' }
        format.json { render json: @adm_user.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /adm/users/1
  # DELETE /adm/users/1.json
  def destroy
    @adm_user.destroy
    respond_to do |format|
      format.html { redirect_to adm_users_url }
      format.json { head :no_content }
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_adm_user
      @adm_user = Adm::User.find(params[:id])
      @adm_access = Adm::UserAccess.all
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def adm_user_params
      params.require(:adm_user).permit(:name, :email, :password_confirmation, :password,
        :password_digest, :user_access_id, :corporate_id)
    end

    # Before filters

    def signed_in_user
      redirect_to signin_url, notice: "Please sign in." unless signed_in?
    end

    def correct_user
      @user = User.find(params[:id])
      redirect_to(root_url) unless current_user?(@user)
    end

end


text:
package com.solidnw.gametimer.model;

import java.util.ArrayList;
import java.util.Collections;

/**
 * @author  SickSta
 * @since   21:21:59 - 21.01.2013
 * @project AndroidGameTimer
 */
public class Group {

	private String mName;
	private ArrayList<Player> mPlayers;
	private ArrayList<String> mPlayerNames;
	private Player mCurrentPlayer;

	public Group(String name, ArrayList<Player> players, Time gameTime, String gameMode) {
		mName = name;
		mPlayers = players;

		if(mPlayers != null) {
			if(mPlayers.size() != 0) {
				mCurrentPlayer = mPlayers.get(0);
			}
		}

		setPlayersInfo(gameTime, gameMode);
	}

	public void addPlayer(Player player) {
		if(player != null) {
			mPlayers.add(player);
			mPlayerNames.add(player.getName());
			// ask if this should be persisted in the database
		}
	}

	public void removePlayer(Player player) {
		if(player != null) {
			mPlayers.remove(player);
			mPlayerNames.remove(player.getName());
			// ask if this should be persisted in the database
		}
	}

	public void nextPlayer() {
		if(mPlayers != null) {
			int indexCurrent = mPlayers.indexOf(mCurrentPlayer);
			if( indexCurrent < (mPlayers.size() - 1) ) {
				mCurrentPlayer = mPlayers.get(indexCurrent + 1);
			}
			else {
				if(indexCurrent != -1) {
					mCurrentPlayer = mPlayers.get(0);
				}
			}
		}
	}

	public void reverseDirection() {
		Collections.reverse(mPlayers);
		nextPlayer();
	}

	public Player getPreviousPlayer() {
		if(mPlayers != null) {
			int indexCurrent = mPlayers.indexOf(mCurrentPlayer);
			if( indexCurrent > 0 ) {
				return mPlayers.get(indexCurrent - 1);
			}
			else {
				if(indexCurrent == 0 && mPlayers.size() != 0) {
					return mPlayers.get(mPlayers.size() - 1);
				}
			}
		}
		return null;
	}

	public Player getNextPlayer() {
		if(mPlayers != null) {
			int indexCurrent = mPlayers.indexOf(mCurrentPlayer);
			if( indexCurrent < (mPlayers.size() - 1) ) {
				return mPlayers.get(indexCurrent + 1);
			}
			else {
				if(indexCurrent != -1) {
					return mPlayers.get(0);
				}
			}
		}
		return null;
	}

	private void setPlayersInfo(Time gameTime, String gameMode) {
		for(Player player : mPlayers) {
			player.initializeTime(gameTime);
			player.initializeMode(gameMode);
		}
	}

	// ===========================================================
	// Getter & Setter
	// ===========================================================
	/**
	 * @return the name
	 */
	public String getName() {
		return mName;
	}

	/**
	 * @return the players
	 */
	public ArrayList<Player> getPlayers() {
		return mPlayers;
	}

	/**
	 * @retun the playerNames
	 */
	public ArrayList<String> getPlayerNames() {
		return mPlayerNames;
	}

	/**
	 * @return the currentPlayer
	 */
	public Player getCurrentPlayer() {
		return mCurrentPlayer;
	}

	/**
	 * @param currentPlayer the currentPlayer to set
	 */
	public void setCurrentPlayer(Player currentPlayer) {
		mCurrentPlayer = currentPlayer;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		mName = name;
	}

	/**
	 * @param players the players to set
	 */
	public void setPlayers(ArrayList<Player> players) {
		if(players != null)
		{
			mPlayers = players;
			mPlayerNames.clear();
			for(int i = 0; i < players.size(); i++)
			{
				mPlayerNames.add(players.get(i).getName());
			}
		}
	}

	// ===========================================================
	// Inner and Anonymous Classes
	// ===========================================================
}


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

  angular.module('myApp.about')

  .factory('pages', pages);
  pages.$inject = ['$q', '$http', 'myConfig'];

  function pages($q, $http, myConfig) {

  var service = {};

  service.getPages = function getPages() {
    var deferred = $q.defer();

    $http.get(myConfig.wordpressPages)
    .then(function(data) {
      deferred.resolve(data);
    },
    function(error) {
      deferred.reject(error);
    });

    return deferred.promise;
  };

  return service;
  }
})();


text:
package nl.astraeus.jdbc.web.page;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;

import nl.astraeus.jdbc.JdbcLogger;
import nl.astraeus.jdbc.util.Util;
import nl.astraeus.web.page.Page;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * User: rnentjes
 * Date: 4/12/12
 * Time: 9:16 PM
 */
public class LiveOverview extends StatsPage {
    private static Logger logger = LoggerFactory.getLogger(LiveOverview.class);

    boolean sortTotalCalls = true;
    boolean sortAvgTime = false;
    boolean sortTotalTime = false;

    @Override
    public void get() {
        Page result = this;

//        if ("select".equals(action)) {
//            return new QueryDetail(this, Integer.parseInt(value));
//        }

//        return result;
    }

/*
    public Page processRequest(HttpServletRequest request) {
        if ("sortTotalCalls".equals(request.getParameter("action"))) {
            sortTotalCalls = true;
            sortAvgTime = false;
            sortTotalTime = false;
        } else if ("sortAvgTime".equals(request.getParameter("action"))) {
            sortTotalCalls = false;
            sortAvgTime = true;
            sortTotalTime = false;
        } else if ("sortTotalTime".equals(request.getParameter("action"))) {
            sortTotalCalls = false;
            sortAvgTime = false;
            sortTotalTime = true;
        } else if ("clear".equals(request.getParameter("action"))) {
            JdbcLogger.get().clear();
        }

        return this;
    }
*/

    public void set() {
        List<JdbcLogger.LogEntry> entries = JdbcLogger.get(getServerInfo().port).getEntries();

        long fromTime = System.currentTimeMillis();
        long toTime = System.currentTimeMillis();
        long avgTime = 0;

        Map<Integer, JdbcLogger.LogEntry> condensed = new HashMap<Integer, JdbcLogger.LogEntry>();
        List<JdbcLogger.LogEntry> list;

        if (!entries.isEmpty()) {
            fromTime = entries.get(0).getTimestamp();
            toTime = entries.get(entries.size()-1).getTimestamp();

            long total = 0;

            for (JdbcLogger.LogEntry le : entries) {
                total += le.getNano();

                JdbcLogger.LogEntry entry = condensed.get(le.getHash());

                if (entry == null) {
                    entry = new JdbcLogger.LogEntry(le);
                    condensed.put(entry.getHash(), entry);
                } else {
                    entry.addCount(le);
                }
            }

            avgTime = total / entries.size();
        }

        list = new LinkedList<JdbcLogger.LogEntry>(condensed.values());

        if (sortTotalCalls) {
            Collections.sort(list, new Comparator<JdbcLogger.LogEntry>() {
                public int compare(JdbcLogger.LogEntry o1, JdbcLogger.LogEntry o2) {
                    return o2.getCount() - o1.getCount();
                }
            });
        } else if (sortAvgTime) {
            Collections.sort(list, new Comparator<JdbcLogger.LogEntry>() {
                public int compare(JdbcLogger.LogEntry o1, JdbcLogger.LogEntry o2) {
                    long n1 = o1.getNano() / o1.getCount();
                    long n2 = o2.getNano() / o2.getCount();

                    if (n2 > n1) {
                        return 1;
                    } else if (n2 < n1) {
                        return -1;
                    } else {
                        return 0;
                    }
                }
            });
        } else if (sortTotalTime) {
            Collections.sort(list, new Comparator<JdbcLogger.LogEntry>() {
                public int compare(JdbcLogger.LogEntry o1, JdbcLogger.LogEntry o2) {
                    if (o2.getNano() > o1.getNano()) {
                        return 1;
                    } else if (o2.getNano() < o1.getNano()) {
                        return -1;
                    } else {
                        return 0;
                    }
                }
            });
        }

        set("queries", list);
        set("count", entries.size());

        set("sortTotalCalls", sortTotalCalls);
        set("sortAvgTime", sortAvgTime);
        set("sortTotalTime", sortTotalTime);

        DateFormat dateFormatter = new SimpleDateFormat("HH:mm:ss.SSS");

        set("fromTime", dateFormatter.format(new Date(fromTime)));
        set("toTime", dateFormatter.format(new Date(toTime)));

        dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));

        set("deltaTime", dateFormatter.format(new Date(toTime-fromTime)));
        set("avgTime", Util.formatNano(avgTime));

        set("test", getTest());
    }

    public String getTest() {
        return "Test HaHa";
    }
}


text:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>FTGU Ajax-1</title>
    <script src="ajaxTest.js" type="text/javascript"></script>
</head>
<body>
    <div id="ajaxContent">
        This is a sample text
    </div>
    <button onclick="changeAjaxContent()">Click me!</button>
</body>
</html>


text:
namespace MLearn{

	namespace Utility{

		namespace DataInterface{

			template < 	typename ScalarType,
						typename IndexType,
						typename DERIVED_DATA_INTERFACE >
			class SequentialDataInterface{
			public:
				const Eigen::Ref< const MLMatrix<ScalarType> > getInput( IndexType idx ) const{
					return static_cast<const DERIVED_DATA_INTERFACE*>(this)->getInput(idx);
				}
				const Eigen::Ref< const MLMatrix<ScalarType> > getOutput( IndexType idx ) const{
					return static_cast<const DERIVED_DATA_INTERFACE*>(this)->getOutput(idx);
				}
				size_t getNSamples() const{
					return info.cols();
				}
				IndexType getDelay( IndexType idx ) const{
					return info(delay_idx,idx);
				}
				IndexType getNOutputSteps( IndexType idx ) const{
					return info(n_outputs_idx,idx);
				}
				bool getReset( IndexType idx ) const{
					return bool(info(reset_idx,idx));
				}
				void setInfo( const Eigen::Ref< const MLMatrix<IndexType> > refInfo ){
					info.resize(refInfo.rows(),refInfo.cols());
					info = refInfo;
				}
			protected:
				SequentialDataInterface(const MLMatrix< IndexType >& _info): info(_info){}
				// info contains the information to parse the dataset
				// it's a matrix 4xN, where N is the number of samples
				// the 0th element indicates the start, in the inputs data, of the sample point
				// the first (row) element indicates the number of inputs elements to consider for the sequence
				// the second indicates the index of the first output element in the output matrix
				// the third is the number of data points in the output sequence
				// the 4th element is the delay between the number of timesteps to wait before starting to output
				// the 5th element indicates if the hidden state, if any, has to be reset
				// example:
				// 		info.col(7) = (5,3,6,2,4)
				//	then,
				//		the input sequence of the 7th sample point starts from column 5 of the input dataset
				//		3 elements are taken for the input sequence
				//		after 2 timesteps of the sequence (e.g. forward step for a RNN), the
				//			model is expected to start to output the data points from the 6th column of the output dataset
				//	i.e.
				// 		t = 0:   input[5]  ->
				// 		t = 1:   input[6]  ->
				// 		t = 2:   input[7]  ->
				// 		t = 3:   		   ->  				(in a RNN, this timestep is considering only his hidden state)
				// 		t = 4:   		   ->	output[6]
				// 		t = 5:   		   ->  	output[7]
				//
				MLMatrix< IndexType > info;
				const IndexType start_in_idx = 0;
				const IndexType n_inputs_idx = 1;
				const IndexType start_out_idx = 2;
				const IndexType n_outputs_idx = 3;
				const IndexType delay_idx = 4;
				const IndexType reset_idx = 5;
			public:
				static const IndexType n_info_fields;
			};

			template < 	typename ScalarType,
						typename IndexType,
						typename DERIVED_DATA_INTERFACE >
			const IndexType SequentialDataInterface<ScalarType,IndexType,DERIVED_DATA_INTERFACE>::n_info_fields = IndexType(6);

		}

	}

}

#endif


text:
#include "ObserverWidget.h"

#include <Wt/WApplication>
#include <Wt/WText>

using namespace Wt;

class BufferViewWidget : public WContainerWidget
{
public:
  BufferViewWidget()
  {
    setStyleClass("viewer");

    WApplication::instance()->require("prettify/prettify.min.js");
    WApplication::instance()->useStyleSheet("prettify/prettify.css");

    new WText("File: ", this);
    bufferName_ = new WText(this);

    bufferText_ = new WText(this);
    bufferText_->setInline(false);
    bufferText_->setStyleClass("prettyprint");
  }

  void setName(const WString& name) {
    bufferName_->setText(name);
  }

  void setText(const WString& text) {
    WApplication::instance()->doJavaScript
      (bufferText_->jsRef() + ".innerHTML="
       "'
' + prettyPrintOne("
       + text.jsStringLiteral() + ", " + bufferText_->jsRef()
       + ") + '
';");
  }

private:
  WText *bufferName_;
  WText *bufferText_;
};

ObserverWidget::ObserverWidget(const std::string& id)
{
  WApplication::instance()->enableUpdates(true);

  session_ = CodeSession::addObserver
    (id, boost::bind(&ObserverWidget::updateBuffer, this, _1, _2));

  if (session_) {
    std::vector<CodeSession::Buffer> buffers = session_->buffers();

    for (unsigned i = 0; i < buffers.size(); ++i)
      insertBuffer(buffers[i], i);
  }
}

ObserverWidget::~ObserverWidget()
{
  if (session_)
    session_->removeObserver();

  WApplication::instance()->enableUpdates(false);
}

void ObserverWidget::insertBuffer(const CodeSession::Buffer& buffer, int i)
{
  BufferViewWidget *w = new BufferViewWidget();
  w->setName(buffer.name);
  w->setText(buffer.text);

  insertWidget(i, w);
}

void ObserverWidget::updateBuffer(int buffer, CodeSession::BufferUpdate update)
{
  switch (update) {
  case CodeSession::Inserted:
    insertBuffer(session_->buffer(buffer), buffer);
    break;
  case CodeSession::Deleted:
    delete widget(buffer);
    break;
  case CodeSession::Changed:
    {
      BufferViewWidget *w = dynamic_cast<BufferViewWidget *>(widget(buffer));
      w->setName(session_->buffer(buffer).name);
      w->setText(session_->buffer(buffer).text);
    }
  }

  WApplication::instance()->triggerUpdate();
}


text:
'use strict';

var tap = require('tap');
//var proxyquire = require('proxyquire');
var path = require('path');
var wrench = require('wrench');
var temp = require('temp').track();
var Startik = require('../lib/startik');

tap.test('Loads shit', function(test){
  temp.mkdir('startik-test', function(err, dirPath) {
    test.error(err);
    var testingDataPath = path.resolve(__dirname, './testing-data/');
    wrench.copyDirSyncRecursive(testingDataPath, dirPath);
    var startik = new Startik();
    startik.readDirectoryPromise(path.join(dirPath, '/testing-data'))
      .then(function(){
        test.end();
      })
      .error(function(error){
        test.error(error);
      });

  });

});


text:
Manage SSH Access for {{title}}

{{errorMsg}}

  <form class="form-horizontal">

      Add:

        <input type="text" ng-model="sshGrant" ng-model-options="modelOptions" uib-typeahead="r as r.title for r in sshEntries | filter:$viewValue" class="form-control" autofocus="true">

        <button class="btn btn-primary" type="button" ng-click="add()">Add</button>

      SSH Entries:

            {{e.title}}
            <button class="btn btn-sm btn-primary" type="button" ng-click="remove(e)"></button>

  </form>

  <button class="btn btn-primary" type="button" ng-click="save()">Save</button>
  <button class="btn btn-warning" type="button" ng-click="cancel()">Cancel</button>


text:
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * vim:expandtab:shiftwidth=2:tabstop=2:cin:
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsLocalHandlerApp.h"
#include "nsIURI.h"
#include "nsIProcess.h"

// XXX why does nsMIMEInfoImpl have a threadsafe nsISupports?  do we need one
// here too?
NS_IMPL_ISUPPORTS2(nsLocalHandlerApp, nsILocalHandlerApp, nsIHandlerApp)

////////////////////////////////////////////////////////////////////////////////
//// nsIHandlerApp

NS_IMETHODIMP nsLocalHandlerApp::GetName(nsAString& aName)
{
  if (mName.IsEmpty() && mExecutable) {
    // Don't want to cache this, just in case someone resets the app
    // without changing the description....
    mExecutable->GetLeafName(aName);
  } else {
    aName.Assign(mName);
  }

  return NS_OK;
}

NS_IMETHODIMP nsLocalHandlerApp::SetName(const nsAString & aName)
{
  mName.Assign(aName);

  return NS_OK;
}

NS_IMETHODIMP
nsLocalHandlerApp::SetDetailedDescription(const nsAString & aDescription)
{
  mDetailedDescription.Assign(aDescription);

  return NS_OK;
}

NS_IMETHODIMP
nsLocalHandlerApp::GetDetailedDescription(nsAString& aDescription)
{
  aDescription.Assign(mDetailedDescription);

  return NS_OK;
}

NS_IMETHODIMP
nsLocalHandlerApp::Equals(nsIHandlerApp *aHandlerApp, bool *_retval)
{
  NS_ENSURE_ARG_POINTER(aHandlerApp);

  *_retval = false;

  // If the handler app isn't a local handler app, then it's not the same app.
  nsCOMPtr <nsILocalHandlerApp> localHandlerApp = do_QueryInterface(aHandlerApp);
  if (!localHandlerApp)
    return NS_OK;

  // If either handler app doesn't have an executable, then they aren't
  // the same app.
  nsCOMPtr<nsIFile> executable;
  nsresult rv = localHandlerApp->GetExecutable(getter_AddRefs(executable));
  if (NS_FAILED(rv))
    return rv;

  // Equality for two empty nsIHandlerApp
  if (!executable && !mExecutable) {
    *_retval = true;
    return NS_OK;
  }

  // At least one is set so they are not equal
  if (!mExecutable || !executable)
    return NS_OK;

  // Check the command line parameter list lengths
  uint32_t len;
  localHandlerApp->GetParameterCount(&len);
  if (mParameters.Length() != len)
    return NS_OK;

  // Check the command line params lists
  for (uint32_t idx = 0; idx < mParameters.Length(); idx++) {
    nsAutoString param;
    if (NS_FAILED(localHandlerApp->GetParameter(idx, param)) ||
        !param.Equals(mParameters[idx]))
      return NS_OK;
  }

  return executable->Equals(mExecutable, _retval);
}

NS_IMETHODIMP
nsLocalHandlerApp::LaunchWithURI(nsIURI *aURI,
                                 nsIInterfaceRequestor *aWindowContext)
{
  // pass the entire URI to the handler.
  nsAutoCString spec;
  aURI->GetAsciiSpec(spec);
  return LaunchWithIProcess(spec);
}

nsresult
nsLocalHandlerApp::LaunchWithIProcess(const nsCString& aArg)
{
  nsresult rv;
  nsCOMPtr<nsIProcess> process = do_CreateInstance(NS_PROCESS_CONTRACTID, &rv);
  if (NS_FAILED(rv))
    return rv;

  if (NS_FAILED(rv = process->Init(mExecutable)))
    return rv;

  const char *string = aArg.get();

  return process->Run(false, &string, 1);
}

////////////////////////////////////////////////////////////////////////////////
//// nsILocalHandlerApp

/* attribute nsIFile executable; */
NS_IMETHODIMP
nsLocalHandlerApp::GetExecutable(nsIFile **aExecutable)
{
  NS_IF_ADDREF(*aExecutable = mExecutable);
  return NS_OK;
}

NS_IMETHODIMP
nsLocalHandlerApp::SetExecutable(nsIFile *aExecutable)
{
  mExecutable = aExecutable;
  return NS_OK;
}

/* readonly attribute unsigned long parameterCount; */
NS_IMETHODIMP
nsLocalHandlerApp::GetParameterCount(uint32_t *aParameterCount)
{
  *aParameterCount = mParameters.Length();
  return NS_OK;
}

/* void clearParameters (); */
NS_IMETHODIMP
nsLocalHandlerApp::ClearParameters()
{
  mParameters.Clear();
  return NS_OK;
}

/* void appendParameter (in AString param); */
NS_IMETHODIMP
nsLocalHandlerApp::AppendParameter(const nsAString & aParam)
{
  mParameters.AppendElement(aParam);
  return NS_OK;
}

/* AString getParameter (in unsigned long parameterIndex); */
NS_IMETHODIMP
nsLocalHandlerApp::GetParameter(uint32_t parameterIndex, nsAString & _retval)
{
  if (mParameters.Length() <= parameterIndex)
    return NS_ERROR_INVALID_ARG;

  _retval.Assign(mParameters[parameterIndex]);
  return NS_OK;
}

/* boolean parameterExists (in AString param); */
NS_IMETHODIMP
nsLocalHandlerApp::ParameterExists(const nsAString & aParam, bool *_retval)
{
  *_retval = mParameters.Contains(aParam);
  return NS_OK;
}


text:
namespace P09.MelrahShake
{
    using System;

    public class StartUp
    {
        public static void Main(string[] args)
        {

            string input = Console.ReadLine();
            string pattern = Console.ReadLine();

            while (pattern.Length > 0)
            {
                int firstIndex = input.IndexOf(pattern);
                int lastIndex = input.LastIndexOf(pattern);
                if (firstIndex >= 0 && lastIndex >= 0 || firstIndex != lastIndex)
                {
                    input = input.Remove(lastIndex, pattern.Length);
                    input = input.Remove(firstIndex, pattern.Length);
                    Console.WriteLine("Shaked it.");
                }
                else
                {
                    break;
                }
                pattern = pattern.Remove(pattern.Length / 2, 1);
            }
            Console.WriteLine("No shake.");
            Console.WriteLine(input);
        }
    }
}


text:
from __future__ import division, absolute_import, unicode_literals

__version__ = '0.6.1'

__author__ = 'Daniel Greenfeld & Contributors'

VERSION = __version__  # synonym

# Default datetime input and output formats
ISO_8601 = 'iso-8601'

from . import core
from . import types

default = core.Admin2()
ModelAdmin2 = types.ModelAdmin2
Admin2TabularInline = types.Admin2TabularInline
Admin2StackedInline = types.Admin2StackedInline

# Utility to make migration between versions easier
sites = default
ModelAdmin = ModelAdmin2
AdminInline = Admin2TabularInline
Admin2Inline = Admin2TabularInline


text:
<?php
	defined('C5_EXECUTE') or die("Access Denied.");
	// basically a stub that includes some other files
	$u = new User();
	$uID=$u->getUserID();
?>

    <?php  if ($controller->hasVoted()) { ?>

<?php  echo t("You've voted on this survey.")?>

            <?php  //available chart colors are duplicated in content/surveys.php
            $availableChartColors=array('00CCdd','cc3333','330099','FF6600','9966FF','dd7700','66DD00','6699FF','FFFF33','FFCC33','00CCdd','cc3333','330099','FF6600','9966FF','dd7700','66DD00','6699FF','FFFF33','FFCC33');
            $options = $controller->getPollOptions();
            $optionNames=array();
            $optionResults=array();
            $graphColors=array();
            $i = 1;
            $totalVotes=0;
            foreach($options as $opt) {
                $optionNamesAbbrev[] = $i;
                $optionResults[]=$opt->getResults();
                $i++;
                $graphColors[]=array_pop($availableChartColors);
                $totalVotes+=intval($opt->getResults());
            }
            foreach ($optionResults as &$value){
                if($totalVotes) {
                    $value=round($value/$totalVotes*100,0);
                }
            }
            ?>

<?php  echo t("Question")?>: <?php  echo $controller->getQuestion()?>

                    <?php  	$i = 1;
                        foreach($options as $opt) { ?>

                                <div class="surveySwatch" style="background:#<?php  echo $graphColors[$i-1]?>">
 <?php  echo ($totalVotes>0)?round($opt->getResults() / $totalVotes * 100):0 ?>%
                                <?php  echo $opt->getOptionName() ?>

                            <?php   $i++; ?>
                    <?php   } ?>

                <?php  echo t2('%d Vote', '%d Votes', intval($totalVotes), intval($totalVotes))?>

            <?php  if(count($optionNamesAbbrev) && !$_GET['dontGraphPoll'] && $totalVotes>0){ ?>

<img border="" src="//chart.apis.google.com/chart?cht=bvg&chd=t:<?php  echo join(',',$optionResults)?>&chs=180x180&chf=bg,s,FFFFFF00&chof=png&chco=<?php  echo join(',',$graphColors)?>" alt="<?php   echo t('survey results');?>" />

            <?php   } ?>

            <?php   if($_GET['dontGraphPoll']){ ?>

<a class="arrow" href="<?php  echo DIR_REL?>/?cID=<?php  echo $b->getBlockCollectionID() ?>"><?php  echo t('View Full Results')?>

            <?php   } ?>

    <?php   } else { ?>
        <form class="form-horizontal" method="post" action="<?php  echo $this->action('form_save_vote', '#survey-form-'.$controller->bID)?>">
            <legend><?php  echo $controller->getQuestion()?></legend>
            <?php   $c = Page::getCurrentPage(); ?>
                <input type="hidden" name="rcID" value="<?php  echo $c->getCollectionID()?>" />

                <?php  $options = $controller->getPollOptions();
                foreach($options as $opt) { ?>

                        <input type="radio" name="optionID" value="<?php  echo $opt->getOptionID()?>" />
                        <?php  echo $opt->getOptionName() ?>

                <?php   } ?>

                <?php   if(!$controller->requiresRegistration() || intval($uID) > 0) { ?>
                    <input class="btn" type="submit" name="submit" value="<?php  echo t('Vote')?>" />
                <?php   }else{ ?>

<?php  echo t('Please Login to Vote')?>

                <?php   } ?>

        </form>
    <?php   } ?>