text:
=head1 This Week on perl5-porters (Oct 11-17 2004)

"This Week on perl5-porters" was started by Mark-Jason Dominus five
years ago on October 17, exactly five years after the release of
perl 5.000.

=head2 Debugger handles threads

Richard Foley and Yitzchak Scott-Thoennes added support for debugging
programs using C<ithreads>. This added the C<e> and C<E> commands for
displaying the current thread ID and list of thread IDs, respectively,
when -dt is specified on the command-line or C<$ENV{PERL5DB_THREADED}>
is set.

  http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2004-10/msg00187.html

=head2 Handling failure in source code filters

Steve Hay wondered what Perl source code filters should do on failure.
Perl isn't aware that there was a failure, so it's necessary to C<croak>
from the filter. A C<Perl_filter_read> comment suggests that it should
return a negative number on failure, whereas C<S_filter_gets> just
returns null, so it's not clear which should be correct.

  http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2004-10/msg00202.html

=head2 %INC caching failure-case problem

Nicholas Clark found a problem (#31924) in bleadperl:

  $ echo die >fail.pm
  $ ./perl -Ilib -e 'eval "use fail q{:std};"; $INC{"fail.pm"} = "fail.pm"'
  Modification of non-creatable hash value attempted, subscript "fail.pm"
    at -e line 1.

Rick Delaney said this is because of compile failures being cached wrongly,
and he submitted a patch to make C<keys %INC> only return names of files
successfully loaded. Yitzchak Scott-Thoennes objected to having hidden
entries in C<%INC>.

  http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2004-10/msg00142.html

=head2 Exporting constants

David Radunz offered a patch to Exporter so that it would declare constants.
Michael Schwern fears that this will make Exporter much slower and that
it might not be that useful anyway because not all constants are declared
with C<constant.pm>.

  http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2004-10/msg00064.html

=head2 Pod::Man =head1 capitalization

David Wheeler proposed having Pod::Man force uppercasing of C<=head1>
headings. Russ Allbery resisted this, because Pod::Man doesn't
necessarily only generate regular man pages, though he'd be open
to an option.

  http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2004-10/msg00230.html

=head2 ETA for 5.8.6

Nicholas Clark mentioned that he plans to go to a four month release
schedule (previously it was three months), which means a code freeze
on Halloween for 5.8.6.

  http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2004-10/msg00248.html

=head2 In brief

Craig Berry fixed a Devel::PPPort test on VMS.

Moshe Kaminsky fixed C<warnings::warn($obj, $msg)> where $obj has
overloaded stringification.

Tels made C<warnings.pm> not load C<Carp.pm> unnecessarily, saving a bit
of memory.

=head2 Reference

The thread for bug number $BUGNUM can be found at
http://rt.perl.org/rt3/Ticket/Display.html?id=$BUGNUM

=head2 About this summary

This summary was written by Scott Lanning. Summaries are published
weekly at http://use.perl.org/ and posted to a mailing list whose
subscription address is perl5-summary-subscribe@perl.org. The archive
is at http://dev.perl.org/perl5/list-summaries/. Comments and
corrections welcome.


text:
depend(['m3/core/collection'], function(collection) {

	/**
	 *
	 * @param {string} name
	 * @param {string} value
	 * @returns {lysine_L11.AttributeAdapter}
	 */
	function AttributeAdapter(element, name, value) {

		this.element  = element;
		this.name     = name;
		this.value    = value;
		this.adapters = this.makeAdapters();
		this.view     = undefined;

		this.setData  = function (data) {
			for (var i = 0; i < this.adapters.length; i++) {
				this.adapters[i].setValue(data[this.adapters[i].getName()]);
			}
		};

		this.replace  = function () {
			var str = '';

			for (var i = 0; i < this.adapters.length; i++) {
				str+= this.adapters[i].replace();
			}

			return str;
		};
	}

	AttributeAdapter.prototype = {
		hasLysine: function () {
			return this.name.search(/^data-lysine-/) !== -1;
		},

		getAttributeName: function() {
			return this.name.replace(/^data-lysine-/, '').toLowerCase();
		},

		makeAdapters: function () {
			if (!this.hasLysine()) { return []; }

			var exp1 = /\{\{([A-Za-z0-9\.\s\?\-\:]+)\}\}/g;
			var exp2 = /\{\{[A-Za-z0-9\.\s\?\-\:]+\}\}/g;

			var adapters = [];

			var pieces = this.value.split(exp2);
			var m      = exp1.exec(this.value);
			while (m) {
				adapters.push(new AttributeVariableAdapter(pieces.shift(), true));
				adapters.push(new AttributeVariableAdapter(m[1], false));
				//Continue the loop
				m = exp1.exec(this.value);
			}

			if (pieces.length > 0) { adapters.push(new AttributeVariableAdapter(pieces.shift(), true)); }

			return adapters;
		},

		for: function () {
			var ret = collection([]);

			collection(this.adapters).each(function(e) {
				if (!e.isReadOnly()) { ret.push(e.getName()); }
			});

			return ret.raw();
		},

		parent : function (view) {
			this.view = view;
			return this;
		},

		refresh : function () {
			var self = this;
			collection(this.adapters).each(function(e) {
				if (e.isReadOnly()) { return; }
				e.setValue(self.view.get(e.getName()));
			});

			this.element.setAttribute(
				this.getAttributeName(),
				this.replace()
			);
		}
	};

	function AttributeVariableAdapter(name, readonly) {
		var value = null;

		this.setValue = function (v) {
			value = v;
		};

		this.getValue = function () {
			return value;
		};

		this.getName  = function () {

			if (name.indexOf('?') !== -1) {
				return name.substr(0, name.indexOf('?'));
			}

			return name;
		};

		this.isReadOnly  = function () {
			return readonly;
		};

		this.replace  = function () {
			if (readonly) { return name; }

			if (name.indexOf('?') !== -1) {
				var expression = name.substr(name.indexOf('?') + 1).split(':');
				return value? expression[0] : expression[1];
			}
			else {
				return value;
			}
		};
	}

	var findAdapters = function (element) {

		var dataset = element.attributes,
		    i, adapters = collection([]);

		if (!dataset) {
			return adapters;
		}

		for (var i = 0; i < dataset.length; i++) {
			adapters.push(new AttributeAdapter(element, dataset[i].name, dataset[i].value));
		}

		var ret = adapters.filter(function(e) {
			return e.hasLysine();
		});

		return ret;

	};

	return {
		AttributeAdapter : AttributeAdapter,
		find : findAdapters
	};

});

redpajama_set_name: RedPajamaGithub


text:
TGT_BASE=share/$PKG_NAME-$PKG_VERSION-$PKG_BUILDNUM
TGT="$PREFIX/$TGT_BASE"
[ -d "$TGT" ] || mkdir -p "$TGT"
[ -d "${PREFIX}/bin" ] || mkdir -p "${PREFIX}/bin"

cd "${SRC_DIR}"
# Do not install Linux specific x86-acceleration libraries
cp -rvp third-party $TGT
cp RTG.jar $TGT
cp rtg $TGT

echo "RTG_TALKBACK=     # Attempt to send crash logs to realtime genomics, true to enable
RTG_USAGE=        # Enable simple usage logging, true to enable
RTG_JAVA_OPTS=    # Additional arguments passed to the JVM
RTG_JAR=/opt/anaconda1anaconda2anaconda3/${TGT_BASE}/RTG.jar" > $TGT/rtg.cfg

ln -s $TGT/rtg $PREFIX/bin
chmod 0755 "${PREFIX}/bin/rtg"


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Lepidium fasciculatum Thell.

### Remarks
null


text: PowerShell Shell Manager


text:
@implementation CDSyncRecord (CoreDataProperties)

@dynamic commitCount;
@dynamic createdAt;
@dynamic downloadCount;
@dynamic isFinished;
@dynamic objectId;
@dynamic recordMark;
@dynamic syncBeginTime;
@dynamic syncEndTime;
@dynamic syncType;
@dynamic updatedAt;
@dynamic user;

@end


text:
namespace Stripe
{
    public class SetupAttemptPaymentMethodDetailsKlarna : StripeEntity<SetupAttemptPaymentMethodDetailsKlarna>
    {
    }
}


text:
package org.wso2.carbon.logging.summarizer.utils;

public class SummarizingConstants {

    public static final String TASK_CLASS_NAME = "org.wso2.carbon.logging.summarizer.scheduler.SummaryGenerationTask";
    public static final String TASK_NAME = "logSummarizer";

    public static final String TASK_TENANT_ID_KEY = "__TENANT_ID_PROP__";

    public static final String USERNAME_KEY = "username";
    public static final String PASSWORD_KEY ="password";

}


text:
package com.flyingrhenquest.JmeterThreadGlobal;

import java.beans.PropertyDescriptor;
import org.apache.jmeter.testbeans.BeanInfoSupport;

public class ThreadGlobalPostprocessorBeanInfo extends BeanInfoSupport {

  public ThreadGlobalPostprocessorBeanInfo() {
    super(ThreadGlobalPostprocessor.class);

    createPropertyGroup("Jmeter Variable ThreadGlobal is Bound To",
                        new String[] {
                          "mapName"
                        });

    PropertyDescriptor p;
    p = property("mapName");
    p.setValue(NOT_UNDEFINED, Boolean.TRUE);
    p.setValue(DEFAULT, "ThreadGlobal");
  }

}


text:
YUI.add('file-flash', function(Y) {

    /**
     * The FileFlash class provides a wrapper for a file pointer stored in Flash. The File wrapper
     * also implements the mechanics for uploading a file and tracking its progress.
     * @module file-flash
     */
    /**
     * The class provides a wrapper for a file pointer in Flash.
     * @class FileFlash
     * @extends Base
     * @constructor
     */

    var FileFlash = function(o) {
        FileFlash.superclass.constructor.apply(this, arguments);
    };

    Y.extend(FileFlash, Y.Base, {

        initializer : function (cfg) {
            if (!this.get("id")) {
                this._set("id", Y.guid("file"));
            }
        },

        _swfEventHandler: function (event) {
          if (event.id === this.get("id")) {
          switch (event.type) {
            case "uploadstart":
                 this.fire("uploadstart", {uploader: this.get("uploader")});
                 break;
            case "uploadprogress":
                 this.fire("uploadprogress", {originEvent: event,
                                              bytesLoaded: event.bytesLoaded,
                                              bytesTotal: event.bytesTotal,
                                              percentLoaded: Math.min(100, Math.round(10000*event.bytesLoaded/event.bytesTotal)/100)
                                             });
                 this._set("bytesUploaded", event.bytesLoaded);
                 break;
            case "uploadcomplete":
                 this.fire("uploadfinished", {originEvent: event});
                 break;
            case "uploadcompletedata":
                 this.fire("uploadcomplete", {originEvent: event,
                                              data: event.data});
                 break;
            case "uploadcancel":
                 this.fire("uploadcancel", {originEvent: event});
                 break;
            case "uploaderror":
                 this.fire("uploaderror", {originEvent: event});

          }
        }
        },

   /**
    * Starts the upload of a specific file.
    *
    * @method startUpload
    * @param url {String} The URL to upload the file to.
    * @param parameters {Object} (optional) A set of key-value pairs to send as variables along with the file upload HTTP request.
    * @param fileFieldName {String} (optional) The name of the POST variable that should contain the uploaded file ('Filedata' by default)
    * @return {Boolean} This method always returns true.
    */

        startUpload: function(url, parameters, fileFieldName) {

        if (this.get("uploader")) {

            var myUploader = this.get("uploader"),
                fileField = fileFieldName || "Filedata",
                id = this.get("id"),
                params = parameters || null;

            this._set("bytesUploaded", 0);

            myUploader.on("uploadstart", this._swfEventHandler, this);
            myUploader.on("uploadprogress", this._swfEventHandler, this);
            myUploader.on("uploadcomplete", this._swfEventHandler, this);
            myUploader.on("uploadcompletedata", this._swfEventHandler, this);
            myUploader.on("uploaderror", this._swfEventHandler, this);

            myUploader.callSWF("upload", [id, url, params, fileField]);
         }

        },
   /**
    * Cancels the upload of a specific file, if currently in progress.
    *
    * @method cancelUpload
    */
        cancelUpload: function () {
         if (this.get("uploader")) {
           this.get("uploader").callSWF("cancel", [this.get("id")]);
         }
        },

    }, {

        NAME: 'file',

        TYPE: "flash",

        ATTRS: {

        id: {
            writeOnce: "initOnly",
            value: null
        },

        size: {
            writeOnce: "initOnly",
            value: 0
        },

        name: {
            writeOnce: "initOnly",
            value: null
        },

        dateCreated: {
            writeOnce: "initOnly",
            value: null
        },

        dateModified: {
            writeOnce: "initOnly",
            value: null
        },

        bytesUploaded: {
            readOnly: true,
            value: 0
        },

        type: {
            writeOnce: "initOnly",
            value: null
        },

        file: {
            writeOnce: "initOnly",
            value: null
        },

        uploader: {
            writeOnce: "initOnly",
            value: null
        },

        boundEventHandler: {
            readOnly: true,
            value: null
        }
        }
    });

    Y.FileFlash = FileFlash;

}, '@VERSION@' ,{requires:['base']});


text:
Ext.define("seava.ad.i18n.frame.JobLog_Ui", {
	/* view */
	/* menu */
	tlbLogList__ttl: "Job logs",
	tlbMsgList__ttl: "Messages",
	/* button */
	btnShowJob__lbl: "Show job",
	btnShowJob__tlp: "",
	btnShowJobContext__lbl: "Show job context",
	btnShowJobContext__tlp: "",
	btnShowJobTimer__lbl: "Show job timer",
	btnShowJobTimer__tlp: "",

	title: "Job logs"
});


text:
using Microsoft.DataTransfer.Basics;
using Microsoft.DataTransfer.WpfHost.ServiceModel;
using System;
using System.Globalization;
using System.Linq;
using System.Windows;

namespace Microsoft.DataTransfer.WpfHost.Model
{
    sealed class ErrorHandler : IErrorHandler
    {
        public void Handle(Exception error)
        {
            MessageBox.Show(
                Application.Current.MainWindow,
                String.Format(CultureInfo.CurrentUICulture, Resources.CriticalErrorFormat, GetErrorMessage(error)),
                Resources.CriticalErrorCaption, MessageBoxButton.OK, MessageBoxImage.Error);
        }

        private static string GetErrorMessage(Exception error)
        {
            if (error == null)
                return CommonResources.UnknownError;

            if (error is AggregateException)
                return String.Join(Environment.NewLine,
                    ((AggregateException)error).Flatten().InnerExceptions.Select(e => e.Message));

            return error.Message;
        }
    }
}


text:
define({
  "_widgetLabel": "Forespørgsel",
  "executeQueryTip": "Klik på et af følgende opgaveelementer for at udføre forespørgslen.",
  "invalidConfig": "Ugyldig konfiguration. Brug siden med indstillinger for forespørgsler til at rette konfigurationen.",
  "queryParams": "Indstillinger",
  "parameters": "INDSTILLINGER",
  "queries": "FORESPØRGSLER",
  "apply": "ANVEND",
  "queryResults": "Resultater",
  "clear": "Ryd",
  "noResults": "Ingen resultater fundet.",
  "queryError": "Forespørgslen mislykkedes!",
  "numberFound": "Antal objekter fundet",
  "mapExtentTip": "Begræns resultaterne til det aktuelle kortområde.",
  "noValue": "Ingen værdi",
  "and": "og",
  "stringOperatorIs": "er",
  "stringOperatorIsNot": "er ikke",
  "stringOperatorStartsWith": "starter med",
  "stringOperatorEndsWith": "slutter med",
  "stringOperatorContains": "indeholder",
  "stringOperatorDoesNotContain": "indeholder ikke",
  "stringOperatorIsBlank": "er tomt",
  "stringOperatorIsNotBlank": "er ikke tomt",
  "dateOperatorIsOn": "er d.",
  "dateOperatorIsNotOn": "er ikke d.",
  "dateOperatorIsBefore": "er før",
  "dateOperatorIsAfter": "er efter",
  "dateOperatorDays": "dage",
  "dateOperatorWeeks": "uger",
  "dateOperatorMonths": "måneder",
  "dateOperatorInTheLast": "i de seneste",
  "dateOperatorNotInTheLast": "ikke i de seneste",
  "dateOperatorIsBetween": "er mellem",
  "dateOperatorIsNotBetween": "er ikke mellem",
  "dateOperatorIsBlank": "er tomt",
  "dateOperatorIsNotBlank": "er ikke tomt",
  "numberOperatorIs": "er",
  "numberOperatorIsNot": "er ikke",
  "numberOperatorIsAtLeast": "er mindst",
  "numberOperatorIsLessThan": "er mindre end",
  "numberOperatorIsAtMost": "er højest",
  "numberOperatorIsGreaterThan": "er større end",
  "numberOperatorIsBetween": "er mellem",
  "numberOperatorIsNotBetween": "er ikke mellem",
  "numberOperatorIsBlank": "er tomt",
  "numberOperatorIsNotBlank": "er ikke tomt",
  "operationalLayerTip": "Tilføj resultat som operationelt lag",
  "queryResult": "Forespørgselsresultat",
  "specifyParamsTip": "Angiv parametrene for denne opgave",
  "useSpatialFilter": "Brug spatialt filter til at begrænse objekter",
  "useCurrentMapExtent": "Kun objekter, der gennemskærer det aktuelle kortområde",
  "drawGraphicOnMap": "Kun objekter, der gennemskærer det brugerdefinerede område",
  "specifySpatialFilterMsg": "Angiv et spatialt filter til denne opgave.",
  "clearResults": "Ryd resultater",
  "operationalTip": "Med denne indstilling markeret bevares resultaterne på kortet, indtil der klikkes på knappen \"${clearResults}\".",
  "noneQueryTip": "Der er ikke blevet konfigureret nogen forespørgselsopgave for denne widget.",
  "noPermissionsMsg": "Du har ikke adgang til denne tjeneste.",
  "attributesFromRelationship": "Attributter fra relateret tabel",
  "tasks": "Opgaver",
  "applySpatialFilterToLimitResults": "Anvend et spatialt filter til at begrænse resultaterne",
  "useCurrentExtentTip": "Returnér kun objekter inden for den aktuelle kortudstrækning",
  "useDrawGraphicTip": "Returnér kun objekter, der gennemskærer den form, der et tegnet på kortet",
  "useFeaturesTip": "Returnér kun objekter, der har en spatial relation til objekterne i et andet lag",
  "noSpatialLimitTip": "Returnér objekter inden for kortets fulde udstrækning",
  "applySearchDistance": "Anvend en søgeafstand",
  "spatialRelationship": "Spatial relation",
  "relatedLayer": "Relateret lag",
  "bufferDistance": "Bufferafstand",
  "miles": "Miles",
  "kilometers": "Kilometer",
  "feet": "Fod",
  "meters": "Meter",
  "yards": "Yards",
  "nauticalMiles": "Sømil",
  "back": "Tilbage",
  "execute": "Udfør",
  "zoomTo": "Zoom til",
  "openAttributeTable": "Åbn i AttributeTable",
  "noResult": "Intet resultat.",
  "noTask": "Ingen opgave.",
  "removeThisResult": "Fjern dette resultat",
  "attributeCriteira": "Attributkriterier",
  "spatialFilter": "Spatialt filter",
  "value": "VÆRDI",
  "noAttributeSpatialFilterTip": "Ingen filtre defineret. Alle objekter vil blive returneret.",
  "showAllRelatedRecords": "Vis alle relaterede poster"
});


text:
private: \
               className (const className& other); \
    className& operator= (const className& other);

#endif


text:
package com.gdxjam.client;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.gwt.GwtApplication;
import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration;
import com.gdxjam.Main;

public class HtmlLauncher extends GwtApplication {

	@Override
	public GwtApplicationConfiguration getConfig() {
		GwtApplicationConfiguration config = new GwtApplicationConfiguration(
				1280, 720);
		return config;
	}

	@Override
	public ApplicationListener getApplicationListener() {
		return new Main(false);
	}
}


text:
using System;
using System.Globalization;
using Xunit;

namespace System.Globalization.Tests
{
    public class DateTimeFormatInfoInvariantInfo
    {
        // PosTest1: InvariantInfo should return a read-only DateTimeFormatInfo
        [Fact]
        public void TestReadOnly()
        {
            DateTimeFormatInfo info = DateTimeFormatInfo.InvariantInfo;
            Assert.True(info.IsReadOnly);
        }
    }
}


text:
layout: post
title:  "100 Days of Code Day 57 - DSpace 7 Language"
date:   2018-10-20 15:52:00
categories: 100DaysOfCode
---

# Taking a break from language deactivation and state

At the office yesterday we were discussing persisting the change that an admin would make, when deactivating an interface language from the UI.

Initially, the list of languages can be loaded and provided from the [Environment Config File](https://github.com/DSpace/dspace-angular/blob/master/config/environment.default.js). But it wouldn't be preferable that changes to the list of activated languages would be written back to that file, because ideally the file is under version control in Git. Which would mean that the change would get lost whenever someone would execute a new build and pull the config changes back from git.

So a more desirable alternative is to persist this kind of change in the database, meaning that the DSpace 7 REST API would serve it. Even though interface language could be seen as something purely UI based, it's possible that UIs building on top of the REST API will want to store some UI related parameters in the DB. One way to move forward, would be an endpoint/structure of UI config, there the REST API can just store and serve value pairs of UI config, without really knowing or controlling any logic of what happens with those.

I'm taking a short break from this in order to focus on [feedback that came in from Art on the original language switch](https://github.com/DSpace/dspace-angular/pull/308).

# Pulling the names of the languages back OUT of i18n.

Art made a great point stating that the names of the languages themselves can NOT be translated. An end user who wants to switch language doesn't necessarily know what is language is called in another language.

So for the time being, I'm pulling the names of the languages OUT of the i18n file, and loading them from config.

# The header of the dropdown should state the active language, not the word "Language"

To make it clearer, a font awesome icon for language is added in front of it.

# Code style issues

The automated checks on my pull request were failing because of code style issues. Executing yarn run lint in the root of my project told me what they were: whitespace and " vs ' issues, and I took care of those.

# Changes shipped!

[My pull request](https://github.com/DSpace/dspace-angular/pull/308) was updated with new commits, that hopefully resolve all of the open comments.

# Day 58 Plan

Continue with implementing the actions and the reducer for the language switch.
Continue with [Egghead getting started with redux](https://egghead.io/courses/getting-started-with-redux), video 6.
Continue implementation of the action to deactivate a language.

# Future days - DSpace 7 Angular

* Build a feature where users can customize their own language tags, straight from the UI, by switching on some kind of "translator" mode, to do these changes at runtime
* UI for exporting their customized messages
* UI for enabling/disabling particular languages
* Learn how to write tests and write them for the language functionality
* [Angular Universal](https://angular.io/guide/universal) tutorial based on Tour of Heroes
* Continue where I left off in ng-book

# Future days - Analyzer.atmire.com work

* Change String based implementation of error message handling with types and objects, according to Antoine Snyers recent Atmire DevTalk.
* Change string based implementation of the different browse styles to an object, according to Antoine Snyers recent Atmire DevTalk
* Optimize my hideous methods for getItemcount and getRepoCount.
* Re-test the check if we return the right repository to a user who tries to add a new one
* Updating a repository: touch/change the base URL or not?
* Batch ingest: switch to newer add repository methods.
* WCAG testing against the start page to ensure it's accessible for people who rely on assistive tools.
* Transition from plain CSS to SASS to make it prettier and learn about SASS at the same time
* Instead of the 5 minute cron job, look into a gitlab webhook that executes the update script on prod whever something is committed to master.

# Future Days - Productivity

* Get my IntelliJ IDEA Shortcuts for comments in order

# Future days - Jekyll http://bram-atmire.github.io/ site

* Make it prettier

# Future Days - Atmire.com work

Investigate and work on search engine optimization (SEO) for the main atmire.com website.

# Future Days - Learning just for learning

* CSS: Go through the fabulous [CSS Diner](https://flukeout.github.io/)

# September sustainability challenge - Completed

[The money has been wired](https://my.charitywater.org/bram-luyten/code-for-water) and I'm closing the books on the September sustainability challenge where I was sponsored for every successful day and where I would punish myself for every missed day.

# New sustainability challenge - Finish before Christmas

With today being day 43, there are 57 days of coding left. Setting the goal to get there before Dec 25th gives me a little more flexibility while still requiring a high frequency.

In terms of positive motivator, I'm currently thinking along the lines of a big reward at the end, while at the same time still wondering about something more incremental for Oct/Nov, or to have a self-punishment system in here as well.


text:
.class public Lcn/com/smartdevices/bracelet/view/DayRepeatAdapter;
.super Lcn/com/smartdevices/bracelet/view/WeekAdapter;

# static fields
.field private static final a:Ljava/lang/String; = "DayRepeatAdapter"

# direct methods
.method public constructor <init>(Landroid/content/Context;[Ljava/lang/String;I)V
    .locals 0

    invoke-direct {p0, p1, p2, p3}, Lcn/com/smartdevices/bracelet/view/WeekAdapter;-><init>(Landroid/content/Context;[Ljava/lang/String;I)V

    return-void
.end method

# virtual methods
.method public getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
    .locals 4

    if-nez p2, :cond_0

    iget-object v0, p0, Lcn/com/smartdevices/bracelet/view/DayRepeatAdapter;->mContext:Landroid/content/Context;

    invoke-static {v0}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v0

    const v1, 0x7f03006a

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object p2

    :cond_0
    const v0, 0x7f0a0200

    invoke-virtual {p2, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iget-object v1, p0, Lcn/com/smartdevices/bracelet/view/DayRepeatAdapter;->mShowItems:[Ljava/lang/String;

    aget-object v1, v1, p1

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    iget-object v1, p0, Lcn/com/smartdevices/bracelet/view/DayRepeatAdapter;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    const v2, 0x7f090039

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getColor(I)I

    move-result v1

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setTextColor(I)V

    const v0, 0x7f0a0201

    invoke-virtual {p2, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ImageView;

    iget v1, p0, Lcn/com/smartdevices/bracelet/view/DayRepeatAdapter;->mDays:I

    sget-object v2, Lcn/com/smartdevices/bracelet/model/AlarmClockItem;->WEEK_MASK:[I

    aget v2, v2, p1

    and-int/2addr v1, v2

    if-eqz v1, :cond_1

    const/4 v1, 0x1

    :goto_0
    if-eqz v1, :cond_2

    const-string v1, "DayRepeatAdapter"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "mDays ="

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget v3, p0, Lcn/com/smartdevices/bracelet/view/DayRepeatAdapter;->mDays:I

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, ", checkbox = "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Lcn/com/smartdevices/bracelet/Debug;->i(Ljava/lang/String;Ljava/lang/String;)V

    const v1, 0x7f02004b

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setImageResource(I)V

    :goto_1
    return-object p2

    :cond_1
    const/4 v1, 0x0

    goto :goto_0

    :cond_2
    const v1, 0x7f02004c

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setImageResource(I)V

    goto :goto_1
.end method


text:
"""
Purpose

Shows how to use the AWS SDK for Python (Boto3) with Amazon Kinesis and version 2 of
the Amazon Kinesis Data Analytics API to create an application that reads data from
an input stream, uses SQL code to transform the data, and writes it to an output
stream.
"""

import logging
from pprint import pprint
import sys
import threading
import time
import boto3

from analyticsv2.analytics_application import KinesisAnalyticsApplicationV2
from streams.kinesis_stream import KinesisStream
from streams.dg_anomaly import generate

# Add relative path to include demo_tools in this code example without need for setup.
sys.path.append('../..')
from demo_tools.custom_waiter import CustomWaiter, WaitState
from demo_tools.retries import exponential_retry

logger = logging.getLogger(__name__)

class ApplicationRunningWaiter(CustomWaiter):
    """
    Waits for the application to be in a running state.
    """
    def __init__(self, client):
        super().__init__(
            'ApplicationRunning', 'DescribeApplication',
            'ApplicationDetail.ApplicationStatus',
            {'RUNNING': WaitState.SUCCESS, 'STOPPING': WaitState.FAILURE},
            client)

    def wait(self, app_name):
        self._wait(ApplicationName=app_name)

# snippet-start:[python.example_code.kinesis-analytics-v2.Scenario_SqlTransform]
def usage_demo():
    print('-'*88)
    print("Welcome to the demo of version 2 of the Amazon Kinesis Data Analytics API.")
    print('-'*88)

    logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')

    kinesis_client = boto3.client('kinesis')
    analytics_client = boto3.client('kinesisanalyticsv2')
    iam_resource = boto3.resource('iam')
    application = KinesisAnalyticsApplicationV2(analytics_client)
    app_running_waiter = ApplicationRunningWaiter(analytics_client)

    input_stream_name = 'doc-example-stream-input'
    input_prefix = 'SOURCE_SQL_STREAM'
    output_stream_name = 'doc-example-stream-output'
    app_name = 'doc-example-app'
    role_name = 'doc-example-kinesis-read-write'

    print(f"Creating input stream {input_stream_name} and output stream "
          f"{output_stream_name}.")
    input_stream = KinesisStream(kinesis_client)
    input_stream.create(input_stream_name)
    output_stream = KinesisStream(kinesis_client)
    output_stream.create(output_stream_name)

    print("Starting data generator (on a separate thread) to put data into the "
          "input stream.")
    stream_thread = threading.Thread(
        target=generate, args=(input_stream.name, kinesis_client, False), daemon=True)
    stream_thread.start()

    print(f"Creating role {role_name} to let Kinesis Analytics read from the input "
          f"stream and write to the output stream.")
    role = application.create_read_write_role(
        role_name, input_stream.arn(), output_stream.arn(), iam_resource)
    print("Waiting for role to be ready.")
    time.sleep(10)

    print(f"Creating application {app_name}.")
    # Sometimes the role is still not ready and InvalidArgumentException is raised, so
    # continue to retry if this happens.
    app_data = exponential_retry('InvalidArgumentException')(
        application.create)(app_name, role.arn)
    pprint(app_data)
    print(f"Discovering schema of input stream {input_stream.name}.")
    input_schema = application.discover_input_schema(input_stream.arn(), role.arn)
    pprint(input_schema)

    print("Adding input stream to the application.")
    input_details = application.add_input(
        input_prefix, input_stream.arn(), input_schema)
    print("Input details:")
    pprint(input_details)

    print("Uploading SQL code to the application to process the input stream.")
    with open('analyticsv2/example.sql') as code_file:
        code = code_file.read()
    application.update_code(code)

    print("Adding output stream to the application.")
    application.add_output('DESTINATION_SQL_STREAM', output_stream.arn())

    print("Starting the application.")
    application.start(input_details['InputDescriptions'][0]['InputId'])
    print("Waiting for the application to start (this may take a minute or two).")
    app_running_waiter.wait(application.name)

    print("Application started. Getting records from the output stream.")
    for records in output_stream.get_records(50):
        if len(records) > 0:
            print(*[rec['Data'].decode() for rec in records], sep='\n')

    print("Cleaning up...")
    application.delete()
    input_stream.delete()
    output_stream.delete()
    print("Deleting read/write role.")
    for policy in role.attached_policies.all():
        role.detach_policy(PolicyArn=policy.arn)
        policy.delete()
    role.delete()
    print("Thanks for watching!")
    print('-'*88)
# snippet-end:[python.example_code.kinesis-analytics-v2.Scenario_SqlTransform]

if __name__ == '__main__':
    usage_demo()


text:
package gov.va.med.srcalc.db;

import gov.va.med.srcalc.domain.model.Rule;
import gov.va.med.srcalc.domain.model.RuleDisplayNameComparator;

import java.util.Collections;
import java.util.List;

import javax.inject.Inject;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;

/**
 * DAO for {@link Rule}s.
 */
@Repository
public class RuleDao
{
    private static final Logger LOGGER = LoggerFactory.getLogger(RuleDao.class);

    private final SessionFactory fSessionFactory;

    /**
     * Constructs an instance.
     * @param sessionFactory the SessionFactory used to get the current session.
     */
    @Inject // Allow arguments to be autowired.
    public RuleDao(final SessionFactory sessionFactory)
    {
        fSessionFactory = sessionFactory;
    }

    /**
     * @see org.hibernate.SessionFactory#getCurrentSession()
     */
    protected Session getCurrentSession()
    {
        return fSessionFactory.getCurrentSession();
    }

    /**
     * Returns all of the Rules defined in the database, sorted by display
     * name (case insensitive).
     */
    public ImmutableCollection<Rule> getAllRules()
    {
        LOGGER.debug("Retrieving all Rules from the database.");
        // As far as I can tell, HQL "order by" simply translates to a SQL
        // "ORDER BY", thus making the case-insensitivity up the database's
        // responsibility. So we do the sorting as a post-processing step in
        // Java to ensure portability.
        final Query q = getCurrentSession().createQuery(
                "from Rule v order by v.displayName");
        @SuppressWarnings("unchecked") // trust Hibernate
        final List<Rule> rules = q.list();
        Collections.sort(rules, new RuleDisplayNameComparator());

        return ImmutableList.copyOf(rules);
    }

    /**
     * Returns the persistent Rule with the given display name, or null
     * if no such Rule exists.
     *
     * @return a persistent object: any changes made during the current
     * transaction will automatically be persisted
     */
    public Rule getByDisplayName(final String ruleName)
    {
        final Query q =  getCurrentSession().createQuery(
                "from Rule v where v.displayName = :ruleName");
        q.setString("ruleName", ruleName);
        return (Rule)q.uniqueResult();
    }

    /**
     * Returns the persistent Rule with the given ID, or null
     * if no such Rule exists.
     *
     * @return a persistent object: any changes made during the current
     * transaction will automatically be persisted
     */
    public Rule getById(final int ruleId)
    {
        return (Rule) getCurrentSession().get(Rule.class, ruleId);
    }

    /**
     *
Persists the given variable to the database using JPA
     * merge semantics.

     *
     *
As stated in {@link #getByDisplayName(String) getByDisplayName}, changes are usually
     * automatically persisted. Call this only to persist a brand-new object or
     * to persist changes made after the transaction in which the object was
     * loaded.

     *
     *
Note that the given object is not added to the persistence context,
     * but the returned object is. If you want to modify further state, use the
     * returned object.

     *
     * @param rule represents the state to persist
     */
    public Rule mergeRule(final Rule rule)
    {
        LOGGER.debug("Merging {} into persistence context.", rule);
        // Trust Hibernate with this cast here. (I wish it was generic.)
        return (Rule)getCurrentSession().merge(rule);
    }
}


text:
#pragma once

#include <memory>
#include <string>
#include <vector>

#include <folly/dynamic.h>

#include "mcrouter/lib/config/RouteHandleFactory.h"
#include "mcrouter/lib/fibers/AddTasks.h"
#include "mcrouter/lib/mc/msg.h"
#include "mcrouter/lib/Reply.h"
#include "mcrouter/lib/routes/NullRoute.h"

namespace facebook { namespace memcache {

/**
 * Sends the same request to all child route handles.
 * Collects replies until some result appears (half + 1) times
 * (or all results if that never happens).
 * Responds with one of the replies with the most common result.
 * Ties are broken using Reply::reduce().
 */
template <class RouteHandleIf>
class AllMajorityRoute {
 public:
  static std::string routeName() { return "all-majority"; }

  template <class Operation, class Request>
  std::vector<std::shared_ptr<RouteHandleIf>> couldRouteTo(
    const Request& req, Operation) const {

    return children_;
  }

  explicit AllMajorityRoute(std::vector<std::shared_ptr<RouteHandleIf>> rh)
      : children_(std::move(rh)) {
  }

  AllMajorityRoute(RouteHandleFactory<RouteHandleIf>& factory,
                   const folly::dynamic& json) {
    if (json.isObject()) {
      if (json.count("children")) {
        children_ = factory.createList(json["children"]);
      }
    } else {
      children_ = factory.createList(json);
    }
  }

  template <class Operation, class Request>
  typename ReplyType<Operation, Request>::type route(
    const Request& req, Operation) const {

    typedef typename ReplyType<Operation, Request>::type Reply;
    if (children_.empty()) {
      return NullRoute<RouteHandleIf>::route(req, Operation());
    }

    /* Short circuit if one destination */
    if (children_.size() == 1) {
      return children_.back()->route(req, Operation());
    }

    std::vector<std::function<Reply()>> funcs;
    funcs.reserve(children_.size());
    auto reqCopy = std::make_shared<Request>(req.clone());
    for (auto& rh : children_) {
      funcs.push_back(
        [reqCopy, rh]() {
          return rh->route(*reqCopy, Operation());
        }
      );
    }

    size_t counts[mc_nres];
    std::fill(counts, counts + mc_nres, 0);
    size_t majorityCount = 0;
    Reply majorityReply = Reply(DefaultReply, Operation());

    auto taskIt = fiber::addTasks(funcs.begin(), funcs.end());
    taskIt.reserve(children_.size() / 2 + 1);
    while (taskIt.hasNext() &&
           majorityCount < children_.size() / 2 + 1) {

      auto reply = taskIt.awaitNext();
      auto result = reply.result();

      ++counts[result];
      if ((counts[result] == majorityCount && reply.worseThan(majorityReply)) ||
          (counts[result] > majorityCount)) {
        majorityReply = std::move(reply);
        majorityCount = counts[result];
      }
    }

    return majorityReply;
  }

 private:
  std::vector<std::shared_ptr<RouteHandleIf>> children_;
};

}}


text:
var ipc = window.require('ipc');
var Reflux = require('reflux');
var _ = require('underscore');

var Actions = require('../actions/actions');
var SettingsStore = require('../stores/settings');

var SoundNotificationStore = Reflux.createStore({
  listenables: Actions,

  init: function () {
    this._previousNotifications = [];
  },

  playSound: function () {
    var audio = new Audio('sounds/digi.wav');
    audio.play();
  },

  newNotification: function (title, body) {
    var nativeNotification = new Notification(title, {
      body: body
    });
    nativeNotification.onclick = function () {
      ipc.sendChannel('reopen-window');
    };
    return nativeNotification;
  },

  showNotification: function (countNew, response, latestNotification) {
    var title = (countNew == 1 ?
      'Gitify - ' + latestNotification.full_name :
      'Gitify');
    var body = (countNew == 1 ?
      latestNotification.subject :
      'You\'ve got ' + countNew + ' notifications.');
    this.newNotification(title, body);
  },

  onIsNewNotification: function (response) {
    var self = this;
    var playSound = SettingsStore.getSettings().playSound;
    var showNotifications = SettingsStore.getSettings().showNotifications;

    if (!playSound && !showNotifications) { return; }

    // Check if notification is already in the store.
    var newNotifications = _.filter(response, function (obj) {
      return !_.contains(self._previousNotifications, obj.id);
    });

    // Play Sound / Show Notification.
    if (newNotifications && newNotifications.length) {
      if (playSound) {
        self.playSound();
      }
      if (showNotifications) {
        this.showNotification(newNotifications.length, response, {
          full_name: newNotifications[0].repository.full_name,
          subject: newNotifications[0].subject.title
        });
      }
    }

    // Now Reset the previousNotifications array.
    self._previousNotifications = _.map(response, function (obj) {
      return obj.id;
    });
  }

});

module.exports = SoundNotificationStore;


text:
This section covers the basics of standard file operations within Linux.

### Create, Copy, Move, Delete

#### Create
Create a new textfile (html, jade, sass, coffee, javascript all are text-files):
```
nano [name of your new text file]
# note we are using nano for this
```
#### Copy
Copy a file:

```sh
cp [file to copy] [directory to copy into]
```

you can add various options. A few of them are:

```sh
-n // does prevent overwriting a file
-s // creates a symbolic link instead of copying the file
```

### SymLink
To symlink a directory, type the following

```sh
sudo ln -s /pathtofolder1/child/ /pathtofolder2/parent/
```

>#### Note:
**if parent folder exists** then symlink of
`/pathtofolder2/parent/child/`
points to
`/pathtofolder1/child`

>**if parent folder does not exist** then symlink of
`pathtofolder2/parent/`
points to
`pathtofolder1/child`


text:
[Source code of released version](https://github.com/meteor/meteor/tree/master/packages/deprecated/markdown) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/deprecated/markdown)
***

This is an internal Meteor package.

[How to use it at Meteor Docs](https://docs.meteor.com/packages/markdown.html)


text:
<?php
namespace Kiku;

class DB {
    public function get_archive_list() {
        global $wpdb;

        $sql = "SELECT ID, post_title, post_date, YEAR(post_date_gmt) as post_year
                FROM $wpdb->posts
                WHERE post_status = 'publish'
                  AND post_date <= now()
                  AND post_type = 'post'
                ORDER BY post_date DESC";
        $archives = $wpdb->get_results($sql, ARRAY_A);

        return $archives;
    }
}


text:
var t = require("./test");
var assert = require("assert");
t.describe("A calculator", (function() {
  /* src/test-test.lisp:5:3 */

  t.it("should be able to add", (function() {
    /* src/test-test.lisp:6:10 */

    return assert.equal((1 + 3), 4, "two plus two is four");
  }));
  return t.it("should be able to multiply", (function() {
    /* src/test-test.lisp:8:10 */

    return assert.equal((2 * 3), 6, "two times three is 6");
  }));
}));
t.context("when dividing", (function() {
  /* src/test-test.lisp:11:3 */

  t.it("should divide positive numbers", (function() {
    /* src/test-test.lisp:12:10 */

    assert.equal((4 / 2), 2, "two divided by two is two");
    return assert.equal((7 / 4), 1.75, "seven divided by four is one and three-quarters");
  }));
  return t.it("should divide negative numbers", (function() {
    /* src/test-test.lisp:17:10 */

    return assert.equal((-4 / -2), 2, "minus four divided by minus two is two");
  }));
}));
t.reporter(console.log);


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.team1619.subsystems;

import edu.wpi.first.wpilibj.CANJaguar;
import edu.wpi.first.wpilibj.can.CANTimeoutException;
import edu.wpi.first.wpilibj.command.Subsystem;
import org.team1619.RobotMap;
import org.team1619.commands.RunChooChoo;

/**
 *
 * @author DanielHathcock
 */
public class ChooChoo extends Subsystem {
    // Put methods for controlling this subsystem
    // here. Call these from Commands.
    private CANJaguar chooChoo;

    public ChooChoo() throws CANTimeoutException
    {
        chooChoo = new CANJaguar(RobotMap.motorID_chooChoo);
    }

    public void initDefaultCommand() {
        this.setDefaultCommand(new RunChooChoo());
        // Set the default command for a subsystem here.
        //setDefaultCommand(new MySpecialCommand());
    }

    public void set(double speed) throws CANTimeoutException
    {
        chooChoo.setX(speed);
    }

    public void stop() throws CANTimeoutException
    {
        chooChoo.disableControl();
    }
}


text:
#include "celix_api.h"

typedef struct deprecated_log_writer_stdout_activator {
    //nop
} deprecated_log_writer_stdout_activator_t;

celix_status_t logWriterStdOut_start(deprecated_log_writer_stdout_activator_t* act  __attribute__((unused)), celix_bundle_context_t* ctx  __attribute__((unused))) {
    fprintf(stderr, "Celix::log_writer_stdout bundle is deprecated. Please use Celix::log_admin instead of Celix::log_service and Celix::log_writer_stdout\n");
    return CELIX_SUCCESS;
}

celix_status_t logWriterStdOut_stop(deprecated_log_writer_stdout_activator_t* act  __attribute__((unused)), celix_bundle_context_t* ctx  __attribute__((unused))) {
    //nop;
    return CELIX_SUCCESS;
}

CELIX_GEN_BUNDLE_ACTIVATOR(deprecated_log_writer_stdout_activator_t, logWriterStdOut_start, logWriterStdOut_stop)


text:
using System.Linq;

namespace TIKSN.Pushalot
{
    public class PushalotClient
    {
        private const string API_SEND_MESSAGE_URL = "https://pushalot.com/api/sendmessage";
        private const string JSON_FIELD_NAME_AUTHORIZATION_TOKEN = "AuthorizationToken";
        private const string JSON_FIELD_NAME_TITLE = "Title";
        private const string JSON_FIELD_NAME_BODY = "Body";
        private const string JSON_FIELD_NAME_LINK_TITLE = "LinkTitle";
        private const string JSON_FIELD_NAME_LINK = "Link";
        private const string JSON_FIELD_NAME_IS_IMPORTANT = "IsImportant";
        private const string JSON_FIELD_NAME_IS_SILENT = "IsSilent";
        private const string JSON_FIELD_NAME_IMAGE = "Image";
        private const string JSON_FIELD_NAME_SOURCE = "Source";
        private const string JSON_FIELD_NAME_TIME_TO_LIVE = "TimeToLive";
        private const string REQUEST_CONTENT_TYPE = "application/json";

        //private AuthorizationToken authorizationToken;

        private System.Collections.Generic.HashSet<AuthorizationToken> generalSubscribers;

        public PushalotClient()
        {
            this.generalSubscribers = new System.Collections.Generic.HashSet<AuthorizationToken>();
        }

        public bool Subscribe(AuthorizationToken authorizationToken)
        {
            return this.generalSubscribers.Add(authorizationToken);
        }

        public bool Unsubscribe(AuthorizationToken authorizationToken)
        {
            return this.generalSubscribers.Remove(authorizationToken);
        }

        public async System.Threading.Tasks.Task SendMessage(Message message)
        {
            foreach (var generalSubscriber in this.generalSubscribers)
            {
                await SendMessage(message, generalSubscriber);
            }
        }

        protected static async System.Threading.Tasks.Task SendMessage(Message message, AuthorizationToken authorizationToken)
        {
            string jsonText = GetJsonText(message, authorizationToken);

            System.Diagnostics.Debug.WriteLine("JSON: {0}", jsonText);

            using (var client = new System.Net.Http.HttpClient())
            {
                using (var content = new System.Net.Http.StringContent(jsonText, System.Text.Encoding.UTF8, REQUEST_CONTENT_TYPE))
                {
                    using (var response = await client.PostAsync(API_SEND_MESSAGE_URL, content))
                    {
                        System.Diagnostics.Debug.WriteLine("Response Message: {0}", response.Content.ReadAsStringAsync().Result);

                        switch (response.StatusCode)
                        {
                            case System.Net.HttpStatusCode.OK:
                                break;
                            case System.Net.HttpStatusCode.BadRequest:
                                throw new System.Exception("Input data validation failed. Check result information Description field for detailed information. Report about this issue by visiting https://pushalot.codeplex.com/workitem/list/basic.");
                            case System.Net.HttpStatusCode.MethodNotAllowed:
                                throw new System.Exception("Method POST is required. Report about this issue by visiting https://pushalot.codeplex.com/workitem/list/basic.");
                            case System.Net.HttpStatusCode.NotAcceptable:
                                throw new System.Exception("Message throttle limit hit. Check result information Description field for information which limit was exceeded. See limits (https://pushalot.com/api#limits) to learn more about what limits are enforced.");
                            case System.Net.HttpStatusCode.Gone:
                                throw new System.Exception("The AuthorizationToken is no longer valid and no more messages should be ever sent again using that token.");
                            case System.Net.HttpStatusCode.InternalServerError:
                                throw new System.Exception("Something is broken. Please contact Pushalot.com (https://pushalot.com/support) so we can investigate.");
                            case System.Net.HttpStatusCode.ServiceUnavailable:
                                throw new System.Exception("Pushalot.com servers are currently overloaded with requests. Try again later.");
                            default:
                                throw new System.Exception("Unknown error.");
                        }
                    }
                }
            }
        }

        private static string GetJsonText(Message message, AuthorizationToken authorizationToken)
        {
            var jsonDictionary = new System.Collections.Generic.Dictionary<string, object>();

            jsonDictionary.Add(JSON_FIELD_NAME_AUTHORIZATION_TOKEN, authorizationToken.Token);

            if (!string.IsNullOrEmpty(message.Title))
            {
                jsonDictionary.Add(JSON_FIELD_NAME_TITLE, message.Title);
            }

            jsonDictionary.Add(JSON_FIELD_NAME_BODY, message.Body);

            if (message.Link != null)
            {
                if (!string.IsNullOrEmpty(message.Link.Title))
                {
                    jsonDictionary.Add(JSON_FIELD_NAME_LINK_TITLE, message.Link.Title);
                }

                jsonDictionary.Add(JSON_FIELD_NAME_LINK, message.Link.Link.AbsoluteUri);
            }

            jsonDictionary.Add(JSON_FIELD_NAME_IS_IMPORTANT, message.IsImportant);
            jsonDictionary.Add(JSON_FIELD_NAME_IS_SILENT, message.IsSilent);

            if (message.Image != null)
            {
                jsonDictionary.Add(JSON_FIELD_NAME_IMAGE, message.Image.Image.AbsoluteUri);
            }

            if (!string.IsNullOrEmpty(message.Source))
            {
                jsonDictionary.Add(JSON_FIELD_NAME_SOURCE, message.Source);
            }

            if (message.TimeToLive.HasValue)
            {
                jsonDictionary.Add(JSON_FIELD_NAME_TIME_TO_LIVE, message.TimeToLive.Value);
            }

            string jsonText = Newtonsoft.Json.JsonConvert.SerializeObject(jsonDictionary);

            return jsonText;
        }
    }

    public class PushalotClient<T> : PushalotClient
    {
        private System.Lazy<System.Linq.ILookup<T, AuthorizationToken>> specialSubscribersLookup;
        private System.Collections.Generic.HashSet<System.Tuple<T, AuthorizationToken>> specialSubscribersSet;

        public PushalotClient()
            : base()
        {
            this.specialSubscribersSet = new System.Collections.Generic.HashSet<System.Tuple<T, AuthorizationToken>>();

            this.ResetSpecialSubscribersLookup();
        }

        public bool Subscribe(T tag, AuthorizationToken authorizationToken)
        {
            return this.specialSubscribersSet.Add(new System.Tuple<T, AuthorizationToken>(tag, authorizationToken));
        }

        public bool Unsubscribe(T tag, AuthorizationToken authorizationToken)
        {
            return this.specialSubscribersSet.Remove(new System.Tuple<T, AuthorizationToken>(tag, authorizationToken));
        }

        private void ResetSpecialSubscribersLookup()
        {
            this.specialSubscribersLookup = new System.Lazy<System.Linq.ILookup<T, AuthorizationToken>>(this.InitializeSpecialSubscribersLookup);
        }

        private System.Linq.ILookup<T, AuthorizationToken> InitializeSpecialSubscribersLookup()
        {
            return this.specialSubscribersSet.ToLookup(item => item.Item1, item => item.Item2);
        }

        public async System.Threading.Tasks.Task SendMessage(Message message, params T[] tags)
        {
            await this.SendMessage(message);

            foreach (var tag in tags)
            {
                foreach (var specialSubscriber in this.specialSubscribersLookup.Value[tag])
                {
                    await SendMessage(message, specialSubscriber);
                }
            }
        }
    }
}


text:
using System;
using Server.Network;
using Server.Items;

namespace Server.Items
{
	[FlipableAttribute( 0x27A6, 0x27F1 )]
	public class Tetsubo : BaseBashing
	{
		public override WeaponAbility PrimaryAbility{ get{ return WeaponAbility.FrenziedWhirlwind; } }
		public override WeaponAbility SecondaryAbility{ get{ return WeaponAbility.CrushingBlow; } }

		public override int AosStrengthReq{ get{ return 35; } }
		public override int AosMinDamage{ get{ return 12; } }
		public override int AosMaxDamage{ get{ return 14; } }
		public override int AosSpeed{ get{ return 45; } }
		public override float MlSpeed{ get{ return 2.50f; } }

		public override int OldStrengthReq{ get{ return 35; } }
		public override int OldMinDamage{ get{ return 12; } }
		public override int OldMaxDamage{ get{ return 14; } }
		public override int OldSpeed{ get{ return 45; } }

		public override int DefHitSound{ get{ return 0x233; } }
		public override int DefMissSound{ get{ return 0x238; } }

		public override int InitMinHits{ get{ return 60; } }
		public override int InitMaxHits{ get{ return 65; } }

		public override WeaponAnimation DefAnimation{ get{ return WeaponAnimation.Bash2H; } }

		[Constructable]
		public Tetsubo() : base( 0x27A6 )
		{
			Weight = 8.0;
			Layer = Layer.TwoHanded;
		}

		public Tetsubo( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
		}
	}
}


text:
<?php

/**
 * @global string $context
 */
namespace Ryo88c\ChatWorkApiClient;

use BEAR\Package\Bootstrap;
use Doctrine\Common\Annotations\AnnotationRegistry;

load: {
    /* @var $loader \Composer\Autoload\ClassLoader */
    $loader = require dirname(__DIR__) . '/vendor/autoload.php';
    AnnotationRegistry::registerLoader([$loader, 'loadClass']);
}

route: {
    $app = (new Bootstrap)->getApp(__NAMESPACE__, $context);
    /* @var $app AbstractApp \BEAR\Sunday\Extension\Application\AbstractApp */
    $request = $app->router->match($GLOBALS, $_SERVER);
}

try {
    // resource request
    $page = $app->resource
        ->{$request->method}
        ->uri($request->path)
        ->withQuery($request->query)
        ->request();
    /* @var $page \BEAR\Resource\Request */

    // representation transfer
    $page()->transfer($app->responder, $_SERVER);
    exit(0);
} catch (\Exception $e) {
    $app->error->handle($e, $request)->transfer();
    exit(1);
}


text:
import * as React from 'react'
import * as Kb from '../../common-adapters'
import * as Styles from '../../styles'
import * as Container from '../../util/container'
import * as RPCGen from '../../constants/types/rpc-gen'
import * as TeamsGen from '../../actions/teams-gen'
import * as SettingsGen from '../../actions/settings-gen'
import {ModalTitle, usePhoneNumberList} from '../common'

const waitingKey = 'phoneLookup'

const AddPhone = () => {
  const teamID = Container.useSelector(s => s.teams.addMembersWizard.teamID)
  const [error, setError] = React.useState('')

  const dispatch = Container.useDispatch()
  const nav = Container.useSafeNavigation()
  const onBack = () => dispatch(nav.safeNavigateUpPayload())

  const {phoneNumbers, setPhoneNumber, addPhoneNumber, removePhoneNumber} = usePhoneNumberList()
  const disabled = !phoneNumbers.length || phoneNumbers.some(pn => !pn.valid)
  const waiting = Container.useAnyWaiting(waitingKey)

  const defaultCountry = Container.useSelector(s => s.settings.phoneNumbers.defaultCountry)

  React.useEffect(() => {
    if (!defaultCountry) {
      dispatch(SettingsGen.createLoadDefaultPhoneNumberCountry())
    }
  }, [defaultCountry, dispatch])

  const emailsToAssertionsRPC = Container.useRPC(RPCGen.userSearchBulkEmailOrPhoneSearchRpcPromise)
  const onContinue = () => {
    setError('')
    emailsToAssertionsRPC(
      [{emails: '', phoneNumbers: phoneNumbers.map(pn => pn.phoneNumber)}, waitingKey],
      r =>
        r?.length
          ? dispatch(
              TeamsGen.createAddMembersWizardPushMembers({
                members: r.map(m => ({
                  ...(m.foundUser
                    ? {assertion: m.username, resolvedFrom: m.assertion}
                    : {assertion: m.assertion}),
                  role: 'writer',
                })),
              })
            )
          : setError('You must enter at least one valid phone number.'),
      err => setError(err.message)
    )
  }

  const maybeSubmit = (evt?: any) => {
    if (!disabled && evt && evt.key === 'Enter' && (evt.ctrlKey || evt.metaKey)) {
      onContinue()
    }
  }

  return (
    <Kb.Modal
      mode="DefaultFullHeight"
      header={{
        leftButton: <Kb.Icon type="iconfont-arrow-left" onClick={onBack} />,
        title: <ModalTitle teamID={teamID} title="Phone list" />,
      }}
      allowOverflow={true}
      footer={{
        content: (
          <Kb.Button
            waiting={waiting}
            fullWidth={true}
            label="Continue"
            onClick={onContinue}
            disabled={disabled}
          />
        ),
      }}
      banners={
        error
          ? [
              <Kb.Banner color="red" key="err">
                {error}
              </Kb.Banner>,
            ]
          : undefined
      }
    >
      <Kb.Box2 direction="vertical" fullWidth={true} style={styles.body} gap="tiny">
        <Kb.Text type="Body">Enter one or multiple phone numbers:</Kb.Text>
        <Kb.Box2 direction="vertical" gap="medium" fullWidth={true} alignItems="flex-start">
          {phoneNumbers.map((pn, idx) => (
            <Kb.PhoneInput
              key={pn.key}
              autoFocus={idx === 0}
              defaultCountry={defaultCountry}
              onChangeNumber={(phoneNumber, valid) => setPhoneNumber(idx, phoneNumber, valid)}
              onClear={phoneNumbers.length === 1 ? undefined : () => removePhoneNumber(idx)}
              onEnterKeyDown={maybeSubmit}
            />
          ))}
          <Kb.Button mode="Secondary" icon="iconfont-new" onClick={addPhoneNumber} />
        </Kb.Box2>
      </Kb.Box2>
    </Kb.Modal>
  )
}

const styles = Styles.styleSheetCreate(() => ({
  body: Styles.platformStyles({
    common: {
      ...Styles.padding(Styles.globalMargins.small),
      ...Styles.globalStyles.flexOne,
      backgroundColor: Styles.globalColors.blueGrey,
    },
    isMobile: {...Styles.globalStyles.flexOne},
  }),
  container: {
    padding: Styles.globalMargins.small,
  },
  wordBreak: Styles.platformStyles({
    isElectron: {
      wordBreak: 'break-all',
    },
  }),
}))

export default AddPhone


text:
'use strict'

var fs = require('fs')
var npm = require('npm')
var path = require('path')
var shell = require('shelljs')

function loadPackageJson (path, callback) {
  fs.readFile(path, function (err, data) {
    if (err) return callback(err)

    try {
      var pkg = JSON.parse(data.toString())
      callback(null, pkg)
    } catch (err) {
      return callback(err)
    }
  })
}

// Installs dependencies from package.json from mean packages into root node_modules
function packagesNpmInstall (source) {
  var packages = path.join(process.cwd(), source)
  npm.load({
    loglevel: 'error'
  }, function (err, npm) {
    if (!err) {
      fs.readdir(packages, function (err, files) {
        if (err && err.code !== 'ENOENT') throw Error(err)

        if (!files || !files.length) return
        console.log('Auto installing package dependencies')

        files.forEach(function (file) {
          var pkgPath = path.join(packages, file)

          loadPackageJson(path.join(pkgPath, 'package.json'), function (err, data) {
            if (err || !data.mean) return

            var installDeps = []

            if (data.dependencies) {
              for (var dep in data.dependencies) {
                installDeps.push(dep + '@' + data.dependencies[dep])
              }
              if (process.env === 'development' && data.devDependencies) {
                for (var devDep in data.devDependencies) {
                  installDeps.push(devDep + '@' + data.devDependencies[devDep])
                }
              }
            }
            if (installDeps.length) {
              npm.commands.install(installDeps, function (err) {
                if (err) {
                  console.log('Error: npm install failed')
                  return console.error(err)
                } else {
                  console.log('    Dependencies installed for package ' + file)
                }
              })
            }
          })
        })
      })
    }
  })
}

shell.exec('bower update', function (code) {
  console.log('    Updating Bower dependencies')
})

packagesNpmInstall('packages/contrib')
packagesNpmInstall('packages/custom')
packagesNpmInstall('packages/core')


text:
/*
    This file is part of the WebKit open source project.
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#include "config.h"
#include "JSXMLHttpRequest.h"

#include "Document.h"
#include "Event.h"
#include "EventListener.h"
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDocument.h"
#include "JSEvent.h"
#include "JSEventListener.h"
#include "JSXMLHttpRequestUpload.h"
#include "KURL.h"
#include "XMLHttpRequest.h"
#include "XMLHttpRequestUpload.h"
#include <runtime/Error.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>

using namespace JSC;

namespace WebCore {

ASSERT_CLASS_FITS_IN_CELL(JSXMLHttpRequest);

/* Hash table */
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
#else
#define THUNK_GENERATOR(generator)
#endif

static const HashTableValue JSXMLHttpRequestTableValues[17] =
{
    { "onabort", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestOnabort), (intptr_t)setJSXMLHttpRequestOnabort THUNK_GENERATOR(0) },
    { "onerror", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestOnerror), (intptr_t)setJSXMLHttpRequestOnerror THUNK_GENERATOR(0) },
    { "onload", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestOnload), (intptr_t)setJSXMLHttpRequestOnload THUNK_GENERATOR(0) },
    { "onloadstart", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestOnloadstart), (intptr_t)setJSXMLHttpRequestOnloadstart THUNK_GENERATOR(0) },
    { "onprogress", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestOnprogress), (intptr_t)setJSXMLHttpRequestOnprogress THUNK_GENERATOR(0) },
    { "onreadystatechange", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestOnreadystatechange), (intptr_t)setJSXMLHttpRequestOnreadystatechange THUNK_GENERATOR(0) },
    { "readyState", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestReadyState), (intptr_t)0 THUNK_GENERATOR(0) },
    { "withCredentials", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestWithCredentials), (intptr_t)setJSXMLHttpRequestWithCredentials THUNK_GENERATOR(0) },
    { "upload", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestUpload), (intptr_t)0 THUNK_GENERATOR(0) },
    { "responseText", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestResponseText), (intptr_t)0 THUNK_GENERATOR(0) },
    { "responseXML", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestResponseXML), (intptr_t)0 THUNK_GENERATOR(0) },
    { "responseType", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestResponseType), (intptr_t)setJSXMLHttpRequestResponseType THUNK_GENERATOR(0) },
    { "response", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestResponse), (intptr_t)0 THUNK_GENERATOR(0) },
    { "status", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestStatus), (intptr_t)0 THUNK_GENERATOR(0) },
    { "statusText", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestStatusText), (intptr_t)0 THUNK_GENERATOR(0) },
    { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
    { 0, 0, 0, 0 THUNK_GENERATOR(0) }
};

#undef THUNK_GENERATOR
static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestTable = { 35, 31, JSXMLHttpRequestTableValues, 0 };
/* Hash table for constructor */
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
#else
#define THUNK_GENERATOR(generator)
#endif

static const HashTableValue JSXMLHttpRequestConstructorTableValues[6] =
{
    { "UNSENT", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestUNSENT), (intptr_t)0 THUNK_GENERATOR(0) },
    { "OPENED", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestOPENED), (intptr_t)0 THUNK_GENERATOR(0) },
    { "HEADERS_RECEIVED", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestHEADERS_RECEIVED), (intptr_t)0 THUNK_GENERATOR(0) },
    { "LOADING", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestLOADING), (intptr_t)0 THUNK_GENERATOR(0) },
    { "DONE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestDONE), (intptr_t)0 THUNK_GENERATOR(0) },
    { 0, 0, 0, 0 THUNK_GENERATOR(0) }
};

#undef THUNK_GENERATOR
static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestConstructorTable = { 16, 15, JSXMLHttpRequestConstructorTableValues, 0 };

COMPILE_ASSERT(0 == XMLHttpRequest::UNSENT, XMLHttpRequestEnumUNSENTIsWrongUseDontCheckEnums);
COMPILE_ASSERT(1 == XMLHttpRequest::OPENED, XMLHttpRequestEnumOPENEDIsWrongUseDontCheckEnums);
COMPILE_ASSERT(2 == XMLHttpRequest::HEADERS_RECEIVED, XMLHttpRequestEnumHEADERS_RECEIVEDIsWrongUseDontCheckEnums);
COMPILE_ASSERT(3 == XMLHttpRequest::LOADING, XMLHttpRequestEnumLOADINGIsWrongUseDontCheckEnums);
COMPILE_ASSERT(4 == XMLHttpRequest::DONE, XMLHttpRequestEnumDONEIsWrongUseDontCheckEnums);

const ClassInfo JSXMLHttpRequestConstructor::s_info = { "XMLHttpRequestConstructor", &DOMConstructorObject::s_info, &JSXMLHttpRequestConstructorTable, 0 };

JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor(ExecState* exec, Structure* structure, JSDOMGlobalObject* globalObject)
    : DOMConstructorObject(structure, globalObject)
{
    ASSERT(inherits(&s_info));
    putDirect(exec->globalData(), exec->propertyNames().prototype, JSXMLHttpRequestPrototype::self(exec, globalObject), DontDelete | ReadOnly);
}

bool JSXMLHttpRequestConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSXMLHttpRequestConstructor, JSDOMWrapper>(exec, &JSXMLHttpRequestConstructorTable, this, propertyName, slot);
}

bool JSXMLHttpRequestConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
    return getStaticValueDescriptor<JSXMLHttpRequestConstructor, JSDOMWrapper>(exec, &JSXMLHttpRequestConstructorTable, this, propertyName, descriptor);
}

ConstructType JSXMLHttpRequestConstructor::getConstructData(ConstructData& constructData)
{
    constructData.native.function = constructJSXMLHttpRequest;
    return ConstructTypeHost;
}

/* Hash table for prototype */
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
#else
#define THUNK_GENERATOR(generator)
#endif

static const HashTableValue JSXMLHttpRequestPrototypeTableValues[16] =
{
    { "UNSENT", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestUNSENT), (intptr_t)0 THUNK_GENERATOR(0) },
    { "OPENED", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestOPENED), (intptr_t)0 THUNK_GENERATOR(0) },
    { "HEADERS_RECEIVED", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestHEADERS_RECEIVED), (intptr_t)0 THUNK_GENERATOR(0) },
    { "LOADING", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestLOADING), (intptr_t)0 THUNK_GENERATOR(0) },
    { "DONE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXMLHttpRequestDONE), (intptr_t)0 THUNK_GENERATOR(0) },
    { "open", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXMLHttpRequestPrototypeFunctionOpen), (intptr_t)5 THUNK_GENERATOR(0) },
    { "setRequestHeader", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXMLHttpRequestPrototypeFunctionSetRequestHeader), (intptr_t)2 THUNK_GENERATOR(0) },
    { "send", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXMLHttpRequestPrototypeFunctionSend), (intptr_t)1 THUNK_GENERATOR(0) },
    { "abort", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXMLHttpRequestPrototypeFunctionAbort), (intptr_t)0 THUNK_GENERATOR(0) },
    { "getAllResponseHeaders", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXMLHttpRequestPrototypeFunctionGetAllResponseHeaders), (intptr_t)0 THUNK_GENERATOR(0) },
    { "getResponseHeader", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXMLHttpRequestPrototypeFunctionGetResponseHeader), (intptr_t)1 THUNK_GENERATOR(0) },
    { "overrideMimeType", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXMLHttpRequestPrototypeFunctionOverrideMimeType), (intptr_t)1 THUNK_GENERATOR(0) },
    { "addEventListener", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXMLHttpRequestPrototypeFunctionAddEventListener), (intptr_t)3 THUNK_GENERATOR(0) },
    { "removeEventListener", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXMLHttpRequestPrototypeFunctionRemoveEventListener), (intptr_t)3 THUNK_GENERATOR(0) },
    { "dispatchEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsXMLHttpRequestPrototypeFunctionDispatchEvent), (intptr_t)1 THUNK_GENERATOR(0) },
    { 0, 0, 0, 0 THUNK_GENERATOR(0) }
};

#undef THUNK_GENERATOR
static JSC_CONST_HASHTABLE HashTable JSXMLHttpRequestPrototypeTable = { 37, 31, JSXMLHttpRequestPrototypeTableValues, 0 };
static const HashTable* getJSXMLHttpRequestPrototypeTable(ExecState* exec)
{
    return getHashTableForGlobalData(exec->globalData(), &JSXMLHttpRequestPrototypeTable);
}

const ClassInfo JSXMLHttpRequestPrototype::s_info = { "XMLHttpRequestPrototype", &JSC::JSObjectWithGlobalObject::s_info, 0, getJSXMLHttpRequestPrototypeTable };

JSObject* JSXMLHttpRequestPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
{
    return getDOMPrototype<JSXMLHttpRequest>(exec, globalObject);
}

bool JSXMLHttpRequestPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticPropertySlot<JSXMLHttpRequestPrototype, JSObject>(exec, getJSXMLHttpRequestPrototypeTable(exec), this, propertyName, slot);
}

bool JSXMLHttpRequestPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
    return getStaticPropertyDescriptor<JSXMLHttpRequestPrototype, JSObject>(exec, getJSXMLHttpRequestPrototypeTable(exec), this, propertyName, descriptor);
}

static const HashTable* getJSXMLHttpRequestTable(ExecState* exec)
{
    return getHashTableForGlobalData(exec->globalData(), &JSXMLHttpRequestTable);
}

const ClassInfo JSXMLHttpRequest::s_info = { "XMLHttpRequest", &JSDOMWrapper::s_info, 0, getJSXMLHttpRequestTable };

JSXMLHttpRequest::JSXMLHttpRequest(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<XMLHttpRequest> impl)
    : JSDOMWrapper(structure, globalObject)
    , m_impl(impl)
{
    ASSERT(inherits(&s_info));
}

JSObject* JSXMLHttpRequest::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
{
    return new (exec) JSXMLHttpRequestPrototype(exec->globalData(), globalObject, JSXMLHttpRequestPrototype::createStructure(globalObject->globalData(), globalObject->objectPrototype()));
}

bool JSXMLHttpRequest::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSXMLHttpRequest, Base>(exec, getJSXMLHttpRequestTable(exec), this, propertyName, slot);
}

bool JSXMLHttpRequest::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
    return getStaticValueDescriptor<JSXMLHttpRequest, Base>(exec, getJSXMLHttpRequestTable(exec), this, propertyName, descriptor);
}

JSValue jsXMLHttpRequestOnabort(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    if (EventListener* listener = imp->onabort()) {
        if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
            if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
                return jsFunction;
        }
    }
    return jsNull();
}

JSValue jsXMLHttpRequestOnerror(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    if (EventListener* listener = imp->onerror()) {
        if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
            if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
                return jsFunction;
        }
    }
    return jsNull();
}

JSValue jsXMLHttpRequestOnload(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    if (EventListener* listener = imp->onload()) {
        if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
            if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
                return jsFunction;
        }
    }
    return jsNull();
}

JSValue jsXMLHttpRequestOnloadstart(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    if (EventListener* listener = imp->onloadstart()) {
        if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
            if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
                return jsFunction;
        }
    }
    return jsNull();
}

JSValue jsXMLHttpRequestOnprogress(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    if (EventListener* listener = imp->onprogress()) {
        if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
            if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
                return jsFunction;
        }
    }
    return jsNull();
}

JSValue jsXMLHttpRequestOnreadystatechange(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    if (EventListener* listener = imp->onreadystatechange()) {
        if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
            if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
                return jsFunction;
        }
    }
    return jsNull();
}

JSValue jsXMLHttpRequestReadyState(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    JSValue result = jsNumber(imp->readyState());
    return result;
}

JSValue jsXMLHttpRequestWithCredentials(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    JSValue result = jsBoolean(imp->withCredentials());
    return result;
}

JSValue jsXMLHttpRequestUpload(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->upload()));
    return result;
}

JSValue jsXMLHttpRequestResponseText(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    return castedThis->responseText(exec);
}

JSValue jsXMLHttpRequestResponseXML(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    ExceptionCode ec = 0;
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->responseXML(ec)));
    setDOMException(exec, ec);
    return result;
}

JSValue jsXMLHttpRequestResponseType(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    JSValue result = jsString(exec, imp->responseType());
    return result;
}

JSValue jsXMLHttpRequestResponse(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    return castedThis->response(exec);
}

JSValue jsXMLHttpRequestStatus(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    ExceptionCode ec = 0;
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    JSC::JSValue result = jsNumber(imp->status(ec));
    setDOMException(exec, ec);
    return result;
}

JSValue jsXMLHttpRequestStatusText(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    ExceptionCode ec = 0;
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    JSC::JSValue result = jsString(exec, imp->statusText(ec));
    setDOMException(exec, ec);
    return result;
}

JSValue jsXMLHttpRequestConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSXMLHttpRequest* domObject = static_cast<JSXMLHttpRequest*>(asObject(slotBase));
    return JSXMLHttpRequest::getConstructor(exec, domObject->globalObject());
}

void JSXMLHttpRequest::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
{
    lookupPut<JSXMLHttpRequest, Base>(exec, propertyName, value, getJSXMLHttpRequestTable(exec), this, slot);
}

void setJSXMLHttpRequestOnabort(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(thisObject);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    imp->setOnabort(createJSAttributeEventListener(exec, value, thisObject));
}

void setJSXMLHttpRequestOnerror(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(thisObject);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    imp->setOnerror(createJSAttributeEventListener(exec, value, thisObject));
}

void setJSXMLHttpRequestOnload(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(thisObject);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    imp->setOnload(createJSAttributeEventListener(exec, value, thisObject));
}

void setJSXMLHttpRequestOnloadstart(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(thisObject);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    imp->setOnloadstart(createJSAttributeEventListener(exec, value, thisObject));
}

void setJSXMLHttpRequestOnprogress(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(thisObject);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    imp->setOnprogress(createJSAttributeEventListener(exec, value, thisObject));
}

void setJSXMLHttpRequestOnreadystatechange(ExecState* exec, JSObject* thisObject, JSValue value)
{
    UNUSED_PARAM(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(thisObject);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    imp->setOnreadystatechange(createJSAttributeEventListener(exec, value, thisObject));
}

void setJSXMLHttpRequestWithCredentials(ExecState* exec, JSObject* thisObject, JSValue value)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(thisObject);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    ExceptionCode ec = 0;
    imp->setWithCredentials(value.toBoolean(exec), ec);
    setDOMException(exec, ec);
}

void setJSXMLHttpRequestResponseType(ExecState* exec, JSObject* thisObject, JSValue value)
{
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(thisObject);
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    ExceptionCode ec = 0;
    imp->setResponseType(ustringToString(value.toString(exec)), ec);
    setDOMException(exec, ec);
}

JSValue JSXMLHttpRequest::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
{
    return getDOMConstructor<JSXMLHttpRequestConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
}

EncodedJSValue JSC_HOST_CALL jsXMLHttpRequestPrototypeFunctionOpen(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXMLHttpRequest::s_info))
        return throwVMTypeError(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(thisValue));
    return JSValue::encode(castedThis->open(exec));
}

EncodedJSValue JSC_HOST_CALL jsXMLHttpRequestPrototypeFunctionSetRequestHeader(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXMLHttpRequest::s_info))
        return throwVMTypeError(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(thisValue));
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    if (exec->argumentCount() < 2)
        return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
    ExceptionCode ec = 0;
    const String& header(ustringToString(exec->argument(0).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    const String& value(ustringToString(exec->argument(1).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    imp->setRequestHeader(header, value, ec);
    setDOMException(exec, ec);
    return JSValue::encode(jsUndefined());
}

EncodedJSValue JSC_HOST_CALL jsXMLHttpRequestPrototypeFunctionSend(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXMLHttpRequest::s_info))
        return throwVMTypeError(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(thisValue));
    return JSValue::encode(castedThis->send(exec));
}

EncodedJSValue JSC_HOST_CALL jsXMLHttpRequestPrototypeFunctionAbort(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXMLHttpRequest::s_info))
        return throwVMTypeError(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(thisValue));
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());

    imp->abort();
    return JSValue::encode(jsUndefined());
}

EncodedJSValue JSC_HOST_CALL jsXMLHttpRequestPrototypeFunctionGetAllResponseHeaders(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXMLHttpRequest::s_info))
        return throwVMTypeError(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(thisValue));
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    ExceptionCode ec = 0;

    JSC::JSValue result = jsStringOrUndefined(exec, imp->getAllResponseHeaders(ec));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}

EncodedJSValue JSC_HOST_CALL jsXMLHttpRequestPrototypeFunctionGetResponseHeader(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXMLHttpRequest::s_info))
        return throwVMTypeError(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(thisValue));
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    if (exec->argumentCount() < 1)
        return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
    ExceptionCode ec = 0;
    const String& header(ustringToString(exec->argument(0).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    JSC::JSValue result = jsStringOrNull(exec, imp->getResponseHeader(header, ec));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}

EncodedJSValue JSC_HOST_CALL jsXMLHttpRequestPrototypeFunctionOverrideMimeType(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXMLHttpRequest::s_info))
        return throwVMTypeError(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(thisValue));
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    if (exec->argumentCount() < 1)
        return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
    const String& override(ustringToString(exec->argument(0).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    imp->overrideMimeType(override);
    return JSValue::encode(jsUndefined());
}

EncodedJSValue JSC_HOST_CALL jsXMLHttpRequestPrototypeFunctionAddEventListener(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXMLHttpRequest::s_info))
        return throwVMTypeError(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(thisValue));
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    JSValue listener = exec->argument(1);
    if (!listener.isObject())
        return JSValue::encode(jsUndefined());
    imp->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec));
    return JSValue::encode(jsUndefined());
}

EncodedJSValue JSC_HOST_CALL jsXMLHttpRequestPrototypeFunctionRemoveEventListener(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXMLHttpRequest::s_info))
        return throwVMTypeError(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(thisValue));
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    JSValue listener = exec->argument(1);
    if (!listener.isObject())
        return JSValue::encode(jsUndefined());
    imp->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec));
    return JSValue::encode(jsUndefined());
}

EncodedJSValue JSC_HOST_CALL jsXMLHttpRequestPrototypeFunctionDispatchEvent(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSXMLHttpRequest::s_info))
        return throwVMTypeError(exec);
    JSXMLHttpRequest* castedThis = static_cast<JSXMLHttpRequest*>(asObject(thisValue));
    XMLHttpRequest* imp = static_cast<XMLHttpRequest*>(castedThis->impl());
    ExceptionCode ec = 0;
    Event* evt(toEvent(exec->argument(0)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    JSC::JSValue result = jsBoolean(imp->dispatchEvent(evt, ec));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}

// Constant getters

JSValue jsXMLHttpRequestUNSENT(ExecState* exec, JSValue, const Identifier&)
{
    UNUSED_PARAM(exec);
    return jsNumber(static_cast<int>(0));
}

JSValue jsXMLHttpRequestOPENED(ExecState* exec, JSValue, const Identifier&)
{
    UNUSED_PARAM(exec);
    return jsNumber(static_cast<int>(1));
}

JSValue jsXMLHttpRequestHEADERS_RECEIVED(ExecState* exec, JSValue, const Identifier&)
{
    UNUSED_PARAM(exec);
    return jsNumber(static_cast<int>(2));
}

JSValue jsXMLHttpRequestLOADING(ExecState* exec, JSValue, const Identifier&)
{
    UNUSED_PARAM(exec);
    return jsNumber(static_cast<int>(3));
}

JSValue jsXMLHttpRequestDONE(ExecState* exec, JSValue, const Identifier&)
{
    UNUSED_PARAM(exec);
    return jsNumber(static_cast<int>(4));
}

static inline bool isObservable(JSXMLHttpRequest* jsXMLHttpRequest)
{
    if (jsXMLHttpRequest->hasCustomProperties())
        return true;
    if (jsXMLHttpRequest->impl()->hasEventListeners())
        return true;
    return false;
}

bool JSXMLHttpRequestOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
    JSXMLHttpRequest* jsXMLHttpRequest = static_cast<JSXMLHttpRequest*>(handle.get().asCell());
    if (jsXMLHttpRequest->impl()->hasPendingActivity())
        return true;
    if (!isObservable(jsXMLHttpRequest))
        return false;
    UNUSED_PARAM(visitor);
    return false;
}

void JSXMLHttpRequestOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
    JSXMLHttpRequest* jsXMLHttpRequest = static_cast<JSXMLHttpRequest*>(handle.get().asCell());
    DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
    uncacheWrapper(world, jsXMLHttpRequest->impl(), jsXMLHttpRequest);
}

JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, XMLHttpRequest* impl)
{
    return wrap<JSXMLHttpRequest>(exec, globalObject, impl);
}

XMLHttpRequest* toXMLHttpRequest(JSC::JSValue value)
{
    return value.inherits(&JSXMLHttpRequest::s_info) ? static_cast<JSXMLHttpRequest*>(asObject(value))->impl() : 0;
}

}


text:
import { registerPlugin } from 'linkifyjs';

/**
	Quick Hashtag parser plugin for linkify
*/
var hashtag = function hashtag(_ref) {
  var scanner = _ref.scanner,
      parser = _ref.parser,
      utils = _ref.utils;
  // Various tokens that may compose a hashtag
  var _scanner$tokens = scanner.tokens,
      POUND = _scanner$tokens.POUND,
      DOMAIN = _scanner$tokens.DOMAIN,
      TLD = _scanner$tokens.TLD,
      LOCALHOST = _scanner$tokens.LOCALHOST,
      UNDERSCORE = _scanner$tokens.UNDERSCORE; // The start state

  var START_STATE = parser.start; // Create a new token that class that the parser emits when it finds a hashtag

  var Hashtag = utils.createTokenClass('hashtag', {
    isLink: true
  }); // Take or create a transition from start to the '#' sign (non-accepting)

  var HASH_STATE = START_STATE.tt(POUND); // Take transition from '#' to any text token to yield valid hashtag state

  var HASHTAG_STATE = HASH_STATE.tt(DOMAIN, Hashtag); // Now that we have the hashtag state, no need to create new states

  HASH_STATE.tt(TLD, HASHTAG_STATE);
  HASH_STATE.tt(LOCALHOST, HASHTAG_STATE); // Account for leading underscore (non-accepting unless followed by domain)

  var HASH_UNDERSCORE_STATE = HASH_STATE.tt(UNDERSCORE);
  HASH_UNDERSCORE_STATE.tt(UNDERSCORE, HASH_UNDERSCORE_STATE);
  HASH_UNDERSCORE_STATE.tt(DOMAIN, HASHTAG_STATE);
  HASH_UNDERSCORE_STATE.tt(TLD, HASHTAG_STATE);
  HASH_UNDERSCORE_STATE.tt(LOCALHOST, HASHTAG_STATE); // Continue the transitions

  HASHTAG_STATE.tt(UNDERSCORE, HASHTAG_STATE);
  HASHTAG_STATE.tt(DOMAIN, HASHTAG_STATE);
  HASHTAG_STATE.tt(TLD, HASHTAG_STATE);
  HASHTAG_STATE.tt(LOCALHOST, HASHTAG_STATE); // Trailing underscore is okay
};
registerPlugin('hashtag', hashtag);

export { hashtag };


text:
<?php

namespace zikmont\FrontEndBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Table(name="gen_consecutivos")
 * @ORM\Entity(repositoryClass="zikmont\FrontEndBundle\Repository\GenConsecutivosRepository")
 */
class GenConsecutivos
{

    /**
     * @ORM\Id
     * @ORM\Column(name="codigo_pk", type="smallint")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $codigoPk;

    /**
     * @ORM\Column(name="asientos", type="integer")
     */
    private $asientos = 0;

    /**
     * Get codigoPk
     *
     * @return smallint
     */
    public function getCodigoPk()
    {
        return $this->codigoPk;
    }

    /**
     * Set asientos
     *
     * @param integer $asientos
     */
    public function setAsientos($asientos)
    {
        $this->asientos = $asientos;
    }

    /**
     * Get asientos
     *
     * @return integer
     */
    public function getAsientos()
    {
        return $this->asientos;
    }
}