text:
"""The fsl module provides classes for interfacing with the `FSL
<http://www.fmrib.ox.ac.uk/fsl/index.html>`_ command line tools.  This
was written to work with FSL version 4.1.4.

These are the base tools for working with FSL.
Preprocessing tools are found in fsl/preprocess.py
Model tools are found in fsl/model.py
DTI tools are found in fsl/dti.py

XXX Make this doc current!

Currently these tools are supported:

* BET v2.1: brain extraction
* FAST v4.1: segmentation and bias correction
* FLIRT v5.5: linear registration
* MCFLIRT: motion correction
* FNIRT v1.0: non-linear warp

Examples
--------
See the docstrings of the individual classes for examples.

"""

from glob import glob
import os
import warnings

from nipype.utils.filemanip import fname_presuffix
from nipype.interfaces.base import CommandLine, traits, CommandLineInputSpec
from nipype.utils.misc import isdefined

warn = warnings.warn
warnings.filterwarnings('always', category=UserWarning)

class Info(object):
    """Handle fsl output type and version information.

    version refers to the version of fsl on the system

    output type refers to the type of file fsl defaults to writing
    eg, NIFTI, NIFTI_GZ

    """

    ftypes = {'NIFTI': '.nii',
              'NIFTI_PAIR': '.img',
              'NIFTI_GZ': '.nii.gz',
              'NIFTI_PAIR_GZ': '.img.gz'}

    @staticmethod
    def version():
        """Check for fsl version on system

        Parameters
        ----------
        None

        Returns
        -------
        version : str
           Version number as string or None if FSL not found

        """
        # find which fsl being used....and get version from
        # /path/to/fsl/etc/fslversion
        clout = CommandLine(command='which', args='fsl').run()

        if clout.runtime.returncode is not 0:
            return None

        out = clout.runtime.stdout
        basedir = os.path.split(os.path.split(out)[0])[0]
        clout = CommandLine(command='cat',
                            args='%s/etc/fslversion' % (basedir)).run()
        out = clout.runtime.stdout
        return out.strip('\n')

    @classmethod
    def output_type_to_ext(cls, output_type):
        """Get the file extension for the given output type.

        Parameters
        ----------
        output_type : {'NIFTI', 'NIFTI_GZ', 'NIFTI_PAIR', 'NIFTI_PAIR_GZ'}
            String specifying the output type.

        Returns
        -------
        extension : str
            The file extension for the output type.
        """

        try:
            return cls.ftypes[output_type]
        except KeyError:
            msg = 'Invalid FSLOUTPUTTYPE: ', output_type
            raise KeyError(msg)

    @classmethod
    def output_type(cls):
        """Get the global FSL output file type FSLOUTPUTTYPE.

        This returns the value of the environment variable
        FSLOUTPUTTYPE.  An exception is raised if it is not defined.

        Returns
        -------
        fsl_ftype : string
            Represents the current environment setting of FSLOUTPUTTYPE
        """
        try:
            return os.environ['FSLOUTPUTTYPE']
        except KeyError:
            raise Exception('FSL environment variables not set')

    @staticmethod
    def standard_image(img_name=None):
        '''Grab an image from the standard location.

        Returns a list of standard images if called without arguments.

        Could be made more fancy to allow for more relocatability'''
        try:
            fsldir = os.environ['FSLDIR']
        except KeyError:
            raise Exception('FSL environment variables not set')
        stdpath = os.path.join(fsldir, 'data','standard')
        if img_name is None:
            return [filename.replace(stdpath+'/','') for filename in glob(os.path.join(stdpath,'*nii*'))]
        return os.path.join(stdpath, img_name)

class FSLCommandInputSpec(CommandLineInputSpec):
    """
    Base Input Specification for all FSL Commands

    All command support specifying FSLOUTPUTTYPE dynamically
    via output_type.

    Example
    -------
    fsl.ExtractRoi(tmin=42, tsize=1, output_type='NIFTI')
    """
    output_type =  traits.Enum('NIFTI', Info.ftypes.keys(),
                              desc='FSL output type')

class FSLCommand(CommandLine):
    """Base support for FSL commands.

    """

    input_spec = FSLCommandInputSpec
    _output_type = None

    def __init__(self, **inputs):
        super(FSLCommand, self).__init__(**inputs)
        self.inputs.on_trait_change(self._output_update, 'output_type')

        if self._output_type is None:
            self._output_type = Info.output_type()

        if not isdefined(self.inputs.output_type):
            self.inputs.output_type = self._output_type
        else:
            self._output_update()

    def _output_update(self):
        self._output_type = self.inputs.output_type
        self.inputs.environ.update({'FSLOUTPUTTYPE': self.inputs.output_type})

    @classmethod
    def set_default_output_type(cls, output_type):
        """Set the default output type for FSL classes.

        This method is used to set the default output type for all fSL
        subclasses.  However, setting this will not update the output
        type for any existing instances.  For these, assign the
        <instance>.inputs.output_type.
        """

        if output_type in Info.ftypes:
            cls._output_type = output_type
        else:
            raise AttributeError('Invalid FSL output_type: %s' % output_type)

    def _gen_fname(self, basename, cwd=None, suffix=None, change_ext=True, ext=None):
        """Generate a filename based on the given parameters.

        The filename will take the form: cwd/basename<suffix><ext>.
        If change_ext is True, it will use the extentions specified in
        <instance>intputs.output_type.

        Parameters
        ----------
        basename : str
            Filename to base the new filename on.
        cwd : str
            Path to prefix to the new filename. (default is os.getcwd())
        suffix : str
            Suffix to add to the `basename`.  (defaults is '' )
        change_ext : bool
            Flag to change the filename extension to the FSL output type.
            (default True)

        Returns
        -------
        fname : str
            New filename based on given parameters.

        """

        if basename == '':
            msg = 'Unable to generate filename for command %s. ' % self.cmd
            msg += 'basename is not set!'
            raise ValueError(msg)
        if cwd is None:
            cwd = os.getcwd()
        if ext is None:
            ext = Info.output_type_to_ext(self.inputs.output_type)
        if change_ext:
            if suffix:
                suffix = ''.join((suffix, ext))
            else:
                suffix = ext
        fname = fname_presuffix(basename, suffix = suffix,
                                use_ext = False, newpath = cwd)
        return fname

def check_fsl():
    ver = Info.version()
    if ver:
        return 0
    else:
        return 1

def no_fsl():
    """Checks if FSL is NOT installed
    used with skipif to skip tests that will
    fail if FSL is not installed"""

    if Info.version() == None:
        return True
    else:
        return False


text:
/// <reference path="../app.ts" />
/// <reference path="../../typings/tsd.d.ts" />
/// <reference path="../models/Property.ts" />
/// <reference path="../models/DataObject.ts" />
/// <reference path="../models/Model.ts" />
/// <reference path="../models/DataRow.ts" />
/// <reference path="PreferencesService.ts" />
/// <reference path="EventListener.ts" />
/// <reference path="EvalService.ts" />

module DbApp.Services {

    declare var fs : any;
    declare var path : any;

    export interface IDbTable<T extends Models.IDataObject> {
        listenFor(eventName:string, callback:(data?:any) => void);

        onSaving(callback:(data:T) => void);

        onLoaded(callback:(data:T) => void);
        onSaved(callback:(data:T) => void);
        onDeleted(callback:(data:T) => void);

        loadFile() : ng.IPromise<T[]>;
        saveFile(data:T[]) : ng.IPromise<boolean>;

        load(id:string) : ng.IPromise<T>;
        save(obj:T) : ng.IPromise<T>;
        delete(obj:T) : ng.IPromise<boolean>;
        deleteAll() : ng.IPromise<T[]>;
        loadAll() : ng.IPromise<T[]>;
        saveAll(data:T[]) : ng.IPromise<T[]>;
    }

    export class DbTable<T extends Models.IDataObject> implements IDbTable<T>, EventListener {
        listeners : {[eventName:string]:Array<(data?:any) => void>} = {};
        listenFor : (eventName:string, callback:(data?:any) => void) => void;
        fire : (eventName:string, data?:any) => void;

        constructor(protected $q : ng.IQService,
                    protected getFilename : () => string,
                    protected funcToObject: (data:any) => T) {
        }

        onSaving(callback:(data:T) => void) { this.listenFor("SAVING", callback); }

        onLoaded(callback:(data:T) => void) { this.listenFor("LOADED", callback); }
        onSaved(callback:(data:T) => void) { this.listenFor("SAVED", callback); }
        onDeleted(callback:(data:T) => void) { this.listenFor("DELETED", callback); }

        loadFile() : ng.IPromise<T[]> {
            return this.$q((resolve, reject) => {
                fs.exists(this.getFilename(), (exists) => {
                    if (exists) {
                        fs.readJson(this.getFilename(), (err, data) => {
                            if (err) throw err;
                            resolve(data);
                        });
                    }
                    else {
                        resolve([]);
                    }
                });
            });
        }

        saveFile(data:T[]) : ng.IPromise<boolean> {
            return this.$q((resolve, reject) => {
                var filename = this.getFilename();

                fs.ensureFileSync(filename);

                var json = _.map(data, o => o.toDataObject());

                fs.writeJson(filename, json, {flag: "w"}, (err) => {
                    if (err) throw err;
                    resolve(true);
                });
            });
        }

        protected deleteFile() : ng.IPromise<boolean> {
            return this.$q((resolve, reject) => {
               fs.unlink(this.getFilename(), (err) => {
                  if (err) throw err;

                  resolve(true);
               });
            });
        }

        load(id:string) : ng.IPromise<T> {
            return this.$q((resolve, reject) => {
                return this.loadAll().then((result) => {
                    var data = _.find(result, {_id: id});
                    if (data === undefined) {
                        resolve(undefined);
                    }
                    else {
                        resolve(this.funcToObject(data));
                        this.fire("LOADED", data);
                    }
                })
                .catch((err) => {
                    return reject(err);
                });
            });
        }

        save(obj:T) : ng.IPromise<T> {

            // TODO: Setup a save queue incase this is called multiple times in succession

            return this.$q((resolve, reject) => {
                this.loadAll().then((data) => {
                    var item = _.find(data, {_id:obj._id});
                    if (item === undefined) {
                        item = obj;
                        item._id = this.uuid();
                        data.push(item);
                    }
                    else {
                        item.update(obj);
                    }

                    this.fire("SAVING", item);

                    return data;

                }).then((data) => {
                    this.saveFile(data).then((result) => {
                        resolve(obj);
                        this.fire("SAVED", obj);
                    });
                })
                .catch((err) => {
                    return reject(err);
                });
            });
        }

        delete(obj:T) : ng.IPromise<boolean> {
            return this.$q((resolve, reject) => {
                this.loadAll().then<T[]>((file) => {
                    var dataItem = _.find(file, {_id:obj._id});
                    if (dataItem === undefined) {
                        return undefined;
                    }
                    else {
                        _.remove(file, {_id: dataItem._id});
                        return file;
                    }
                })
                .then((file) => {
                    if (file === undefined) {
                        resolve(false);
                    }
                    else {
                        this.saveFile(file).then((result) => {
                            resolve(true);
                            this.fire("DELETED", obj);
                        });
                    }
                })
                .catch((err) => {
                    return reject(err);
                });
            });
        }

        deleteAll() : ng.IPromise<T[]> {
            return this.$q((resolve, reject) => {
                this.deleteFile().then(() => {
                    resolve([]);
                });
            });
        }

        loadAll() : ng.IPromise<T[]>{
            return this.$q((resolve, reject) => {
                this.loadFile().then((result) => {
                    resolve(_.map(result, o => this.funcToObject(o)));
                })
            });
        }

        saveAll(data:T[]) : ng.IPromise<T[]> {
            return this.$q((resolve, reject) => {
                this.loadAll().then((result) => {

                    data.forEach(dataItem => {
                       var item = _.find(result, {_id:dataItem._id});
                       if (item === undefined) {
                           dataItem._id = this.uuid();
                           result.push(dataItem);
                       }
                       else {
                           item.update(dataItem);
                       }

                       this.fire("SAVING", item);
                    });

                    this.saveFile(result).then(() => {
                        resolve(result);
                    });
                })
                .catch((err) => {
                   reject(err);
                });
            });
        }

        protected uuid() : string {
            var i, random;
            var result = "";

            for (i = 0; i < 32; i++) {
                random = Math.random() * 16 | 0;
                if (i === 8 || i === 12 || i === 16 || i === 20) {
                    result += "-";
                }
                result += (i === 12 ? 4 : (i === 16 ? (random & 3 | 8) : random))
                    .toString(16);
            }

            return result;
        };
    }

    applyMixins(DbTable, [EventListener]);

    export interface IModelDbTable extends IDbTable<Models.Model> {
    }

    export class ModelDbTable extends DbTable<Models.Model> implements IModelDbTable {
        constructor($q:ng.IQService, settings:Models.ISettings) {
            super($q, () => path.join(settings.saveLocation, "models.json"), obj => new Models.Model(obj));
        }
    }

    export interface IDataDbTable extends IDbTable<Models.DataRow> {
        deleteFolder() : ng.IPromise<boolean>;
        updateFieldName(oldName:string, newName:string) : ng.IPromise<boolean>;
        saveResource(file:string, filename?:string);
        getResourceUrl(resourceName:string) : string;
    }

    export class DataDbTable extends DbTable<Models.DataRow> implements IDataDbTable {
        constructor($q:ng.IQService, model:Models.Model, settings:Models.ISettings) {
            super($q, () => path.join(settings.saveLocation, model._id, "data.json"), obj => new Models.DataRow(obj));
        }

        updateFieldName(oldName:string, newName:string) : ng.IPromise<boolean> {
            return this.loadAll().then((rows) => {
                _.each(rows, row => {
                    row.data[newName] = row.data[oldName];
                    delete row.data[oldName];
                });

                return this.saveFile(rows);
            });
        }

        deleteFolder() : ng.IPromise<boolean> {
            return this.$q((resolve, reject) => {

               fs.remove(path.join(this.getFilename(), "../"), (err) => {
                  if (err) throw err;

                  resolve(true);
               });
            });
        }

        saveResource(file:string, filename?:string) : ng.IPromise<string> {
            return this.$q((resolve, reject) => {
                var sourceFolder = path.join(file, "../");
                var destinationFolder = path.join(this.getFilename(), "../resources/");

                if (sourceFolder === destinationFolder) {
                    resolve(path.basename(file));
                    return;
                }

                filename = filename || this.uuid() + path.extname(file);
                var destinationPath = path.join(destinationFolder, filename);

                fs.copy(file, destinationPath, (err) => {
					if (err) {
						reject(err);
					}
					else {
						resolve(filename);
					}
				});
            });
        }

        getResourceUrl(resourceName:string) : string {
            return "file:///" + path.join(this.getFilename(), "../resources", resourceName);
        }
    }

    export interface IDb {
        settings : Models.Settings;
        model : IModelDbTable;
        data(model:Models.Model) : IDataDbTable;
        backup() : ng.IPromise<string>;
        chooseFolder(startLocation:string) : ng.IPromise<string>;
    }

    export class Db implements IDb {
        private dataTables : {[modelId:string] : DataDbTable} = {};

        settings : Models.Settings;
        model : ModelDbTable;

        /**
         *
         */
        constructor(private $q : ng.IQService,
                    private evalService:IEvalService,
                    private preferenceService:IPreferencesService) {
            this.settings = preferenceService.loadSettings();

            fs.ensureDirSync(this.settings.saveLocation);

            this.model = new ModelDbTable($q, this.settings);
            this.model.onSaved((model) => {
                model.fields.forEach((field) => {
                   var p = field.getProperty(p => p.name);

                   if (p.hasChanged()) {
                       this.data(model).updateFieldName(p.oldValue, p.getValue());
                   }
                });
            });
            this.model.onDeleted((model) => {
               this.data(model).deleteFolder();
            });
        }

        data(model:Models.Model) : IDataDbTable {
            var table = this.dataTables[model._id];
            if (table === undefined) {
                table = this.dataTables[model._id] = new DataDbTable(this.$q, model, this.settings);
                table.onSaving((data) => {
                    this.evalService.eval(model.scripts.saveRecord, {
                        $data: data.data
                    });
                });
            }

            return table;
        }

        backup() : ng.IPromise<string> {
            return this.$q((resolve, reject) => {
                var sourceDir = this.settings.saveLocation;
                var destDir = this.settings.backupLocation;

                if (destDir === undefined || destDir === "") {
                    reject("A backup location has not been specified");
                    return;
                }

                var filename = new Date().toISOString().substring(0, 19).replace(/:/g, "-").replace(/T/g, "-") + ".zip";
                var destFilename = path.join(destDir, filename);

                var output = fs.createWriteStream(destFilename);
                var archive = archiver("zip");

                archive.pipe(output);
                archive.on("close", () => resolve(destFilename));
                archive.on("error", (err) => reject(err))
                archive.bulk([
                   { expand: true, cwd: sourceDir, src: ["**"] }
                ]);
                archive.finalize();
            });
        }

        chooseFolder(startLocation:string) : ng.IPromise<string> {
            return this.$q((resolve, reject) => {
                dialog.showOpenDialog({
                    defaultPath: startLocation,
                    properties: ['openDirectory']
                }, (result) => {
                    if (_.isArray(result) && result.length === 1) {
                        resolve(result[0]);
                    }
                });
            });
        }
    }

    angular.module("DbApp").service("Db", ["$q", "EvalService", "PreferencesService", Db]);
}

redpajama_set_name: RedPajamaGithub


text:
puremvc.define(
{
    name: "controller.StartupCommand",
    parent: puremvc.SimpleCommand
},
{
    execute: function(notification) {
        var app = notification.getBody();
        this.facade.registerMediator(new view.ApplicationMediator(app));
    }
},
{
}
);


text:
layout: post
title: ! "\uFEFFThe Cabbage seller"
date: 2010-04-16 16:11:28.000000000 +05:30
categories:
- essays
- random
tags: []
status: publish
type: post
published: true
meta:
  _edit_last: '1'
author:
  login: admin
  email: anil.verve@gmail.com
  display_name: admin
  first_name: ''
  last_name: ''
---

I stepped out of my office. The power cuts were getting worse, and the heat had gotten to me. I needed a breath of fresh air.

As I stepped out, a vegetable-seller was going past in his cycle. A bamboo container filled with cabbages was placed behind the bicycle seat.

He motioned to me.. asking if I wanted to buy cabbages. I shook my head. He continued looking (perhaps pleadingly, but he had a face that suggested he was always in this state).. and asked if he could speak. I went to him.

"Kannada baratta", he asked. ("Do you speak Kannada")

"Swalpa", I replied ("Yes, a little")

"Do you speak English"

"Yes"

"I need help with my daughters' education"

I shrunk back. This is one of those money grabbing stunts, I thought. Something else told me to continue listening, and not walk away. He pulled out a sheet of paper.. it had a list of textbooks and authors.

"She got 92% in her finals.. and is now preparing for her MBA". I don't exactly recall what he said next, except that it was genuine pleading (atleast sounded genuine). The gist was that he needed help with getting those books for her daughter.

What struck me most was his English. I have friends who abuse the language and grammar, what is termed locally as Hinglish (a mixture of Hindi and English). Yet this wretched man seemed to speak in an almost perfect grammar. He didn't use big words, but what he said was simple and correct.

I now looked at the numbers on the list.. books listed at 275, 300, 150. The college asked for the "latest editions", he said. This could be construed to mean he'd rather have cash, than the books themselves, in case I had any. But having experienced this "latest edition" gimmick in college myself, I gave him the benefit of the doubt.

The suspicion that I was being suckered never fully left me as I stood there listening to him. Perhaps the previous experienced with being cheated still left a bad taste.

Then I mulled, So what if I was being tricked. The man stood there.. in worn-out clothes. He was educated (by his good English). He was going from door to door, on a dilapidated cycle, trying to trick people by pretending to be a cabbage seller. Isn't that a bad enough state to be in? To be forced to seek charity as a way of life. Where begging, rather than being a state of last resort, is instead the common state.

I'd decided to give him 100 Rs (I spend that on coffee with friends). He didn't thank me.. but said something else. I think it was in Kannada, to the effect "can it be 200?", but I'm not sure. I answered "Sorry, that's it". His expression said "Thank you". He handed me a cabbage. We both knew that was not a fair trade. Was it a gesture of thanks, or simply a ploy to convert the act that took place from charity to a trade. What misery was his, to be put in such a position?

I refused the cabbage, asking him to keep it. He cycled forward, looking for the next person to sell to. I went back into the office, back to being concerned about the summer heat.


text:
<?php

namespace PHPExiftool\Driver\Tag\MOBI;

use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;

/**
 * @ExclusionPolicy("all")
 */
class SubjectCode extends AbstractTag
{

    protected $Id = 110;

    protected $Name = 'SubjectCode';

    protected $FullName = 'Palm::EXTH';

    protected $GroupName = 'MOBI';

    protected $g0 = 'Palm';

    protected $g1 = 'MOBI';

    protected $g2 = 'Document';

    protected $Type = 'string';

    protected $Writable = false;

    protected $Description = 'Subject Code';

}


text:
package com.wialon.core;

public interface EventHandler {
	/**
	 * Method which calls when listener receiving event
	 * @param event enum event constant
	 * @param object object which fired event, maybe null
	 * @param oldData old data of event content
	 * @param newData new data of event content
	 */
	public void onEvent(Enum event, Object object, Object oldData, Object newData);
}


text:
using System;

namespace SizSelCsZzz.Other
{
    public class JQueryNotInstalledException : Exception
    {
    }
}


text:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class DynamicTextCreationForm
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()>
    Private Sub InitializeComponent()
        Me.btnSubmit = New System.Windows.Forms.Button()
        Me.DynamicFormCreation1 = New LampClient.DynamicFormCreation()
        Me.btnCancel = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'btnSubmit
        '
        Me.btnSubmit.Location = New System.Drawing.Point(1145, 668)
        Me.btnSubmit.Name = "btnSubmit"
        Me.btnSubmit.Size = New System.Drawing.Size(75, 23)
        Me.btnSubmit.TabIndex = 1
        Me.btnSubmit.Text = "Submit"
        Me.btnSubmit.UseVisualStyleBackColor = True
        '
        'DynamicFormCreation1
        '
        Me.DynamicFormCreation1.AutoScroll = True
        Me.DynamicFormCreation1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.DynamicFormCreation1.Location = New System.Drawing.Point(0, 0)
        Me.DynamicFormCreation1.Name = "DynamicFormCreation1"
        Me.DynamicFormCreation1.Padding = New System.Windows.Forms.Padding(0, 0, 17, 0)
        Me.DynamicFormCreation1.Size = New System.Drawing.Size(1232, 703)
        Me.DynamicFormCreation1.TabIndex = 0
        '
        'btnCancel
        '
        Me.btnCancel.Location = New System.Drawing.Point(1038, 668)
        Me.btnCancel.Name = "btnCancel"
        Me.btnCancel.Size = New System.Drawing.Size(75, 23)
        Me.btnCancel.TabIndex = 2
        Me.btnCancel.Text = "Cancel"
        Me.btnCancel.UseVisualStyleBackColor = True
        '
        'DynamicTextCreationForm
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(1232, 703)
        Me.Controls.Add(Me.btnCancel)
        Me.Controls.Add(Me.btnSubmit)
        Me.Controls.Add(Me.DynamicFormCreation1)
        Me.Name = "DynamicTextCreationForm"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "DynamicTextCreationForm"
        Me.ResumeLayout(False)

    End Sub

    Friend WithEvents DynamicFormCreation1 As DynamicFormCreation
    Friend WithEvents btnSubmit As Button
    Friend WithEvents btnCancel As Button
End Class


text:
<?xml version="1.0" encoding="utf-8"?>
<geo:GeodesyML gml:id="KHAJ00RUS" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:geo="urn:xml-gov-au:icsm:egeodesy:0.4" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <geo:siteLog gml:id="khaj_20121007.log">
        <geo:formInformation>
            <geo:preparedBy>Robert Khachikyan</geo:preparedBy>
            <geo:datePrepared>2012-10-07</geo:datePrepared>
            <geo:reportType>UPDATE</geo:reportType>
        </geo:formInformation>
        <geo:siteIdentification>
            <geo:siteName>Khabarovsk</geo:siteName>
            <geo:fourCharacterID>KHAJ</geo:fourCharacterID>
            <geo:monumentInscription></geo:monumentInscription>
            <geo:iersDOMESNumber>12361M001</geo:iersDOMESNumber>
            <geo:cdpNumber>(A4)</geo:cdpNumber>
            <geo:monumentDescription codeSpace="urn:ga-gov-au:monument-description-type">East GPS/GLONASS Geodynamical Mark</geo:monumentDescription>
            <geo:heightOfTheMonument>15.0</geo:heightOfTheMonument>
            <geo:monumentFoundation>Pillar on the roof</geo:monumentFoundation>
            <geo:foundationDepth>3.0</geo:foundationDepth>
            <geo:markerDescription>Metal bolt with chiseled point</geo:markerDescription>
            <geo:dateInstalled>2001-07-18</geo:dateInstalled>
            <geo:geologicCharacteristic codeSpace="urn:ga-gov-au:geologic-characteristic-type">(BEDROCK/CLAY/CONGLOMERATE/GRAVEL/SAND/etc)</geo:geologicCharacteristic>
            <geo:bedrockType>(IGNEOUS/METAMORPHIC/SEDIMENTARY)</geo:bedrockType>
            <geo:bedrockCondition>(FRESH/JOINTED/WEATHERED)</geo:bedrockCondition>
            <geo:fractureSpacing>(1-10 cm/11-50 cm/51-200 cm/over 200 cm)</geo:fractureSpacing>
            <geo:faultZonesNearby codeSpace="urn:ga-gov-au:fault-zones-type">(YES/NO/Name of the zone)</geo:faultZonesNearby>
            <geo:notes></geo:notes>
        </geo:siteIdentification>
        <geo:siteLocation>
            <geo:city>Khabarovsk</geo:city>
            <geo:state></geo:state>
            <geo:countryCodeISO codeList="http://xml.gov.au/icsm/geodesyml/codelists/antenna-receiver-codelists.xml#GeodesyML_CountryTypeCode" codeListValue="RUSSIA" codeSpace="urn:xml-gov-au:icsm:egeodesy:0.4">RUSSIA</geo:countryCodeISO>
            <geo:tectonicPlate codeSpace="urn:ga-gov-au:plate-type">Eurasian Plate, Siberian Platform</geo:tectonicPlate>
            <geo:approximatePositionITRF>
                <geo:cartesianPosition>
                    <gml:Point gml:id="itrf_cartesian" srsName="EPSG:7789">
                        <gml:pos>-2995266.4 2990444.7 4755576.0</gml:pos>
                    </gml:Point>
                </geo:cartesianPosition>
                <geo:geodeticPosition>
                    <gml:Point gml:id="itrf_geodetic" srsName="EPSG:7912">
                        <gml:pos>48.5214555556 135.046152778 130.6</gml:pos>
                    </gml:Point>
                </geo:geodeticPosition>
            </geo:approximatePositionITRF>
            <geo:notes></geo:notes>
        </geo:siteLocation>
        <geo:gnssReceiver>
            <geo:GnssReceiver gml:id="gnss-receiver-1">
                <geo:manufacturerSerialNumber>2079</geo:manufacturerSerialNumber>
                <geo:igsModelCode codeList="http://xml.gov.au/icsm/geodesyml/codelists/antenna-receiver-codelists.xml#GeodesyML_GNSSReceiverTypeCode" codeListValue="JPS LEGACY" codeSpace="urn:xml-gov-au:icsm:egeodesy:0.4">JPS LEGACY</geo:igsModelCode>
                <geo:satelliteSystem>GPS+GLO</geo:satelliteSystem>
                <geo:firmwareVersion>2.2</geo:firmwareVersion>
                <geo:elevationCutoffSetting>5.0</geo:elevationCutoffSetting>
                <geo:dateInstalled>2001-07-18</geo:dateInstalled>
                <geo:dateRemoved></geo:dateRemoved>
                <geo:temperatureStabilization xsi:nil="true"></geo:temperatureStabilization>
            </geo:GnssReceiver>
            <geo:dateInserted>2001-07-18</geo:dateInserted>
        </geo:gnssReceiver>
        <geo:gnssReceiver>
            <geo:GnssReceiver gml:id="gnss-receiver-2">
                <geo:manufacturerSerialNumber>0</geo:manufacturerSerialNumber>
                <geo:igsModelCode codeList="http://xml.gov.au/icsm/geodesyml/codelists/antenna-receiver-codelists.xml#GeodesyML_GNSSReceiverTypeCode" codeListValue="TPS E_GGD" codeSpace="urn:xml-gov-au:icsm:egeodesy:0.4">TPS E_GGD</geo:igsModelCode>
                <geo:satelliteSystem>GPS+GLO</geo:satelliteSystem>
                <geo:firmwareVersion>2.6.0 APR,18,2007</geo:firmwareVersion>
                <geo:elevationCutoffSetting>0.0</geo:elevationCutoffSetting>
                <geo:dateInstalled>2007-11-01</geo:dateInstalled>
                <geo:dateRemoved></geo:dateRemoved>
                <geo:temperatureStabilization xsi:nil="true"></geo:temperatureStabilization>
            </geo:GnssReceiver>
            <geo:dateInserted>2007-11-01</geo:dateInserted>
        </geo:gnssReceiver>
        <geo:gnssAntenna>
            <geo:GnssAntenna gml:id="gnss-antenna-1">
                <geo:notes>Antenna type listed in this section retro-
actively changed from JPSREGANT_SD_E to
JPSREGANT_SD_E1 starting with log file
khaj_20121007.log. See IGSMAIL-6662 and
IGSMAIL-6663 for details.</geo:notes>
                <geo:manufacturerSerialNumber>RA0032</geo:manufacturerSerialNumber>
                <geo:igsModelCode codeList="http://xml.gov.au/icsm/geodesyml/codelists/antenna-receiver-codelists.xml#GeodesyML_GNSSAntennaTypeCode" codeListValue="JPSREGANT_SD_E1 NONE" codeSpace="urn:xml-gov-au:icsm:egeodesy:0.4">JPSREGANT_SD_E1 NONE</geo:igsModelCode>
                <geo:antennaReferencePoint codeSpace="urn:ga-gov-au:antenna-reference-point-type">BPA</geo:antennaReferencePoint>
                <geo:marker-arpUpEcc.>0.0</geo:marker-arpUpEcc.>
                <geo:marker-arpNorthEcc.>0.0</geo:marker-arpNorthEcc.>
                <geo:marker-arpEastEcc.>0.0</geo:marker-arpEastEcc.>
                <geo:alignmentFromTrueNorth>0.0</geo:alignmentFromTrueNorth>
                <geo:antennaRadomeType codeSpace="urn:igs-org:gnss-radome-model-code">NONE</geo:antennaRadomeType>
                <geo:radomeSerialNumber></geo:radomeSerialNumber>
                <geo:antennaCableType>ANLI DX-10A MIL-C-17D UVR</geo:antennaCableType>
                <geo:antennaCableLength>30.0</geo:antennaCableLength>
                <geo:dateInstalled>2001-07-18</geo:dateInstalled>
                <geo:dateRemoved></geo:dateRemoved>
            </geo:GnssAntenna>
            <geo:dateInserted>2001-07-18</geo:dateInserted>
        </geo:gnssAntenna>
        <geo:frequencyStandard>
            <geo:FrequencyStandard gml:id="frequency-standard-1">
                <geo:standardType codeSpace="urn:ga-gov-au:frequency-standard-type">EXTERNAL H-MASER</geo:standardType>
                <geo:inputFrequency>5.0</geo:inputFrequency>
                <gml:validTime>
                    <gml:TimePeriod gml:id="frequency-standard-1--time-period-1">
                        <gml:beginPosition>1989-01-01</gml:beginPosition>
                        <gml:endPosition></gml:endPosition>
                    </gml:TimePeriod>
                </gml:validTime>
                <geo:notes></geo:notes>
            </geo:FrequencyStandard>
            <geo:dateInserted>1989-01-01</geo:dateInserted>
        </geo:frequencyStandard>
        <geo:siteContact gml:id="agency-1">
            <gmd:MD_SecurityConstraints>
                <gmd:classification gco:nilReason="missing"/>
            </gmd:MD_SecurityConstraints>
            <gmd:CI_ResponsibleParty>
                <gmd:individualName>
                    <gco:CharacterString>Gennady Aprishkin</gco:CharacterString>
                </gmd:individualName>
                <gmd:organisationName>
                    <gco:CharacterString>Russian Research Institute for
Phisicotechnical Measurement  "Dalstandart"</gco:CharacterString>
                </gmd:organisationName>
                <gmd:contactInfo>
                    <gmd:CI_Contact>
                        <gmd:phone>
                            <gmd:CI_Telephone>
                                <gmd:voice>
                                    <gco:CharacterString>+7-421-274-8088</gco:CharacterString>
                                </gmd:voice>
                                <gmd:facsimile>
                                    <gco:CharacterString>+7-421-234-1015</gco:CharacterString>
                                </gmd:facsimile>
                            </gmd:CI_Telephone>
                        </gmd:phone>
                        <gmd:address>
                            <gmd:CI_Address>
                                <gmd:deliveryPoint>
                                    <gco:CharacterString>62, Saltykov-Shedrin Str.,
Khabarovsk, Russia, 680016</gco:CharacterString>
                                </gmd:deliveryPoint>
                                <gmd:city>
                                    <gco:CharacterString></gco:CharacterString>
                                </gmd:city>
                                <gmd:postalCode>
                                    <gco:CharacterString></gco:CharacterString>
                                </gmd:postalCode>
                                <gmd:country>
                                    <gco:CharacterString></gco:CharacterString>
                                </gmd:country>
                                <gmd:electronicMailAddress>
                                    <gco:CharacterString>root@dst.khabarovsk.su</gco:CharacterString>
                                </gmd:electronicMailAddress>
                            </gmd:CI_Address>
                        </gmd:address>
                    </gmd:CI_Contact>
                </gmd:contactInfo>
                <gmd:role>
                    <gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact"></gmd:CI_RoleCode>
                </gmd:role>
            </gmd:CI_ResponsibleParty>
        </geo:siteContact>
        <geo:siteMetadataCustodian gml:id="agency-2">
            <gmd:MD_SecurityConstraints>
                <gmd:classification gco:nilReason="missing"/>
            </gmd:MD_SecurityConstraints>
            <gmd:CI_ResponsibleParty>
                <gmd:individualName>
                    <gco:CharacterString></gco:CharacterString>
                </gmd:individualName>
                <gmd:organisationName>
                    <gco:CharacterString>Russian Research Institute for
Phisicotechnical Measurement  "Dalstandart"</gco:CharacterString>
                </gmd:organisationName>
                <gmd:contactInfo>
                    <gmd:CI_Contact>
                        <gmd:phone>
                            <gmd:CI_Telephone>
                                <gmd:voice>
                                    <gco:CharacterString></gco:CharacterString>
                                </gmd:voice>
                                <gmd:facsimile>
                                    <gco:CharacterString></gco:CharacterString>
                                </gmd:facsimile>
                            </gmd:CI_Telephone>
                        </gmd:phone>
                        <gmd:address>
                            <gmd:CI_Address>
                                <gmd:deliveryPoint>
                                    <gco:CharacterString>62, Saltykov-Shedrin Str.,
Khabarovsk, Russia, 680016</gco:CharacterString>
                                </gmd:deliveryPoint>
                                <gmd:city>
                                    <gco:CharacterString></gco:CharacterString>
                                </gmd:city>
                                <gmd:postalCode>
                                    <gco:CharacterString></gco:CharacterString>
                                </gmd:postalCode>
                                <gmd:country>
                                    <gco:CharacterString></gco:CharacterString>
                                </gmd:country>
                                <gmd:electronicMailAddress>
                                    <gco:CharacterString></gco:CharacterString>
                                </gmd:electronicMailAddress>
                            </gmd:CI_Address>
                        </gmd:address>
                    </gmd:CI_Contact>
                </gmd:contactInfo>
                <gmd:role>
                    <gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact"></gmd:CI_RoleCode>
                </gmd:role>
            </gmd:CI_ResponsibleParty>
        </geo:siteMetadataCustodian>
        <geo:moreInformation>
            <geo:dataCenter></geo:dataCenter>
            <geo:dataCenter></geo:dataCenter>
            <geo:urlForMoreInformation></geo:urlForMoreInformation>
            <geo:siteMap>N</geo:siteMap>
            <geo:siteDiagram>N</geo:siteDiagram>
            <geo:horizonMask>N</geo:horizonMask>
            <geo:monumentDescription>N</geo:monumentDescription>
            <geo:sitePictures>N</geo:sitePictures>
            <geo:notes>N</geo:notes>
            <geo:antennaGraphicsWithDimensions></geo:antennaGraphicsWithDimensions>
            <geo:insertTextGraphicFromAntenna></geo:insertTextGraphicFromAntenna>
            <geo:DOI codeSpace="urn:ga-gov-au:self.moreInformation-type">TODO</geo:DOI>
        </geo:moreInformation>
    </geo:siteLog>
</geo:GeodesyML>


text:
' Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.VisualBasic.Extensions
Imports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery
Imports System.Threading

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Extensions
    Public Class StatementSyntaxExtensionTests

        Private Sub TestStatementDeclarationWithPublicModifier(Of T As StatementSyntax)(node As T)
            Dim modifierList = SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.PublicKeyword))
            Dim newNode = DirectCast(node.WithModifiers(modifierList), T)
            Dim actual = newNode.GetModifiers().First().ToString()
            Assert.Equal("Public", actual)
        End Sub

        Private Sub VerifyTokenName(Of T As DeclarationStatementSyntax)(code As String, expectedName As String)
            Dim node = SyntaxFactory.ParseCompilationUnit(code).DescendantNodes.OfType(Of T).First()
            Dim actualNameToken = node.GetNameToken()
            Assert.Equal(expectedName, actualNameToken.ToString())
        End Sub

        <Fact>
        Public Sub MethodReturnType()
            Dim methodDeclaration = SyntaxFactory.FunctionStatement(attributeLists:=Nothing,
                                                              modifiers:=Nothing,
                                                              identifier:=SyntaxFactory.Identifier("F1"),
                                                              typeParameterList:=Nothing,
                                                              parameterList:=Nothing,
                                                              asClause:=SyntaxFactory.SimpleAsClause(SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.IntegerKeyword))),
                                                              handlesClause:=Nothing,
                                                              implementsClause:=Nothing)
            Assert.True(methodDeclaration.HasReturnType())

            Dim result = methodDeclaration.GetReturnType()
            Dim returnTypeName = result.ToString()
            Assert.Equal("Integer", returnTypeName)
        End Sub

        <Fact>
        Public Sub PropertyReturnType()
            Dim propertyDeclaration = SyntaxFactory.PropertyStatement(attributeLists:=Nothing,
                                                               modifiers:=Nothing,
                                                               identifier:=SyntaxFactory.Identifier("P1"),
                                                               parameterList:=Nothing,
                                                               asClause:=SyntaxFactory.SimpleAsClause(SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.ByteKeyword))),
                                                               initializer:=Nothing,
                                                               implementsClause:=Nothing)
            Assert.True(propertyDeclaration.HasReturnType())

            Dim result = propertyDeclaration.GetReturnType()
            Dim returnTypeName = result.ToString()
            Assert.Equal("Byte", returnTypeName)
        End Sub

        Private Sub TestTypeBlockWithPublicModifier(Of T As TypeBlockSyntax)(code As String)
            Dim node = SyntaxFactory.ParseCompilationUnit(code).Members.First()
            Dim modifierList = SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.PublicKeyword))
            Dim newNode = DirectCast(node.WithModifiers(modifierList), T)
            Dim actual = newNode.GetModifiers().First().ToString()
            Assert.Equal("Public", actual)
        End Sub

        <Fact>
        Public Sub GetClassStatementModifiers()
            Dim code = <String>Public Class C</String>.Value
            Dim node = SyntaxFactory.ParseCompilationUnit(code).DescendantNodes.OfType(Of ClassStatementSyntax).First()
            Dim actualModifierName = node.Modifiers().First().ToString()
            Assert.Equal("Public", actualModifierName)
        End Sub

        <Fact>
        Public Sub GetEnumStatementModifiers()
            Dim code = <String>Public Enum E</String>.Value
            Dim node = SyntaxFactory.ParseCompilationUnit(code).DescendantNodes.OfType(Of EnumStatementSyntax).First()
            Dim actualModifierName = node.Modifiers().First().ToString()
            Assert.Equal("Public", actualModifierName)
        End Sub

        <Fact>
        Public Sub InterfaceBlockWithPublicModifier()
            Dim code = <String>Interface I
End Interface</String>.Value

            TestTypeBlockWithPublicModifier(Of InterfaceBlockSyntax)(code)
        End Sub

        <Fact>
        Public Sub ModuleBlockWithPublicModifier()
            Dim code = <String>Module M
End Module</String>.Value

            TestTypeBlockWithPublicModifier(Of ModuleBlockSyntax)(code)
        End Sub

        <Fact>
        Public Sub StructureBlockWithPublicModifier()
            Dim code = <string>Structure S
End Structure</string>.Value

            TestTypeBlockWithPublicModifier(Of StructureBlockSyntax)(code)
        End Sub

        <Fact>
        Public Sub EnumBlockWithPublicModifier()
            Dim code = <String>Enum E
End Enum</String>.Value

            Dim node = DirectCast(SyntaxFactory.ParseCompilationUnit(code).Members.First(), EnumBlockSyntax)
            TestStatementDeclarationWithPublicModifier(node)
        End Sub

        <Fact>
        Public Sub ClassStatementWithPublicModifier()
            Dim node = SyntaxFactory.ClassStatement(SyntaxFactory.Identifier("C"))
            TestStatementDeclarationWithPublicModifier(node)
        End Sub

        <Fact>
        Public Sub EnumStatementWithPublicModifier()
            Dim node = SyntaxFactory.EnumStatement(SyntaxFactory.Identifier("E"))
            TestStatementDeclarationWithPublicModifier(node)
        End Sub

        <Fact>
        Public Sub FieldDeclarationWithPublicModifier()
            Dim code = <String>Class C
    dim _field as Integer = 1
End Class</String>.Value
            Dim node = SyntaxFactory.ParseCompilationUnit(code).DescendantNodes.OfType(Of FieldDeclarationSyntax).First()
            TestStatementDeclarationWithPublicModifier(node)
        End Sub

        <Fact>
        Public Sub EventBlockWithPublicModifier()
            Dim code = <String>Custom Event E As EventHandler
End Event</String>.Value
            Dim node = SyntaxFactory.ParseCompilationUnit(code).DescendantNodes.OfType(Of EventBlockSyntax).First()
            TestStatementDeclarationWithPublicModifier(node)
        End Sub

        <Fact>
        Public Sub EventStatementWithPublicModifier()
            Dim node = SyntaxFactory.EventStatement(SyntaxFactory.Identifier("E"))
            TestStatementDeclarationWithPublicModifier(node)
        End Sub

        <Fact>
        Public Sub PropertyBlockWithPublicModifier()
            Dim code = <String>Property P as Integer
End Property</String>.Value
            Dim node = SyntaxFactory.ParseCompilationUnit(code).DescendantNodes.OfType(Of PropertyBlockSyntax).First()
            TestStatementDeclarationWithPublicModifier(node)
        End Sub

        <Fact>
        Public Sub SubBlockWithPublicModifier()
            Dim code = <String>Sub Goo
End Sub</String>.Value
            Dim node = SyntaxFactory.ParseCompilationUnit(code).DescendantNodes.OfType(Of MethodBlockSyntax).First()
            TestStatementDeclarationWithPublicModifier(node)
        End Sub

        <Fact>
        Public Sub VerifyClassNameToken()
            Dim code = <String>Class C
End Class</String>.Value
            VerifyTokenName(Of ClassBlockSyntax)(code, "C")
        End Sub

        <Fact>
        Public Sub VerifyInterfaceNameToken()
            Dim code = <String>Interface I
End Interface</String>.Value
            VerifyTokenName(Of InterfaceBlockSyntax)(code, "I")
        End Sub

        <Fact>
        Public Sub VerifyStructureNameToken()
            Dim code = <String>Structure S
End Structure</String>.Value
            VerifyTokenName(Of StructureBlockSyntax)(code, "S")
        End Sub

        <Fact>
        Public Sub VerifyModuleNameToken()
            Dim code = <String>Module M
End Module</String>.Value
            VerifyTokenName(Of ModuleBlockSyntax)(code, "M")
        End Sub

        <Fact>
        Public Sub VerifyStructureStatementNameToken()
            Dim code = <String>Structure SS
</String>.Value
            VerifyTokenName(Of StructureStatementSyntax)(code, "SS")
        End Sub

        <Fact>
        Public Sub VerifyConstructorNameTokenIsNothing()
            Dim code = <String>Class C
    Sub New()
End Class</String>.Value
            VerifyTokenName(Of SubNewStatementSyntax)(code, "")
        End Sub

        <Fact, WorkItem(552823, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/552823")>
        Public Sub TestIsInStatementBlockOfKindForBrokenCode()
            Dim code = <String>End Sub
End Module
End Namespace
d</String>.Value

            Dim tree = SyntaxFactory.ParseSyntaxTree(code)

            Dim token = tree.GetRoot() _
                            .DescendantTokens() _
                            .Where(Function(t) t.Kind = SyntaxKind.NamespaceKeyword) _
                            .First()

            For position = token.SpanStart To token.Span.End
                Dim targetToken = tree.GetTargetToken(position, CancellationToken.None)
                tree.IsInStatementBlockOfKind(position, targetToken, CancellationToken.None)
            Next
        End Sub
    End Class
End Namespace


text:
package org.jetbrains.jps.incremental.scala
package local

import java.io.File

import org.jetbrains.plugins.scala.compiler.data.{CompilerData, CompilerJars, SbtData}
import sbt.internal.inc.AnalyzingCompiler
import xsbti.compile.AnalysisStore

trait CompilerFactory {
  def createCompiler(compilerData: CompilerData, client: Client, fileToStore: File => AnalysisStore): Compiler

  def getScalac(sbtData: SbtData, compilerJars: Option[CompilerJars], client: Client): Option[AnalyzingCompiler]
}