text:
 * Infected Wars, an open source Garry's Mod game-mode.
 *
 * Infected Wars is the work of multiple authors,
 * a full list can be found in CONTRIBUTORS.md.
 * For more information, visit https://github.com/JarnoVgr/InfectedWars
 *
 * Infected Wars is free software: you can redistribute it and/or modify
 * it under the terms of the MIT License.
 *
 * A full copy of the MIT License can be found in LICENSE.txt.
 -----------------------------------------------------------------------------]]

include("shared.lua")

SWEP.PrintName = "Shape Shifter's Knife"
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = false
SWEP.CSMuzzleFlashes = false

SWEP.Slot = 0
SWEP.SlotPos = 0
SWEP.IconLetter = "j"
killicon.Add( "iw_und_shapeshiftersknife", "killicon/infectedwars/stalkerknife", Color(255, 80, 0, 255 ) )
--killicon.AddFont("iw_und_shapeshiftersknife", "CSKillIcons", SWEP.IconLetter, Color(255, 80, 0, 255))

function SWEP:PrimaryAttack()
	self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
	if CurTime() < self.Weapon:GetNetworkedFloat("LastShootTime", -100) + self.Primary.Delay then return end

	local trace = self.Owner:TraceLine(62)

	if trace.Hit then
		if trace.MatType == MAT_FLESH or trace.MatType == MAT_BLOODYFLESH or trace.MatType == MAT_ANTLION or trace.MatType == MAT_ALIENFLESH then
			util.Decal("Blood", trace.HitPos + trace.HitNormal * 8, trace.HitPos - trace.HitNormal * 8)
		else
			util.Decal("ManhackCut", trace.HitPos + trace.HitNormal * 8, trace.HitPos - trace.HitNormal * 8)
		end
	end
	self.Owner:SetAnimation(PLAYER_ATTACK1)
	self.Weapon:SetNetworkedFloat("LastShootTime", CurTime())
end

function SWEP:CanPrimaryAttack()
	return false
end

function SWEP:Reload()
	return false
end

function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha )
	draw.SimpleText( self.IconLetter, "CSSelectIcons", x + wide/2, y + tall*0.3, Color( 255, 210, 0, 255 ), TEXT_ALIGN_CENTER )
	// Draw weapon info box
	self:PrintWeaponInfo( x + wide + 20, y + tall * 0.95, alpha )
end

function SWEP:SetWorldModel(str)
	self.WorldModel = str
end


text:
package org.apache.carbondata.common.exceptions;

import org.apache.carbondata.common.annotations.InterfaceAudience;
import org.apache.carbondata.common.annotations.InterfaceStability;

@InterfaceAudience.User
@InterfaceStability.Stable
public class NoSuchStreamException extends Exception {
  /**
   * default serial version ID.
   */
  private static final long serialVersionUID = 133241232L;

  public NoSuchStreamException(String streamName) {
    super("stream '" + streamName + "' not found");
  }

}

redpajama_set_name: RedPajamaGithub


text:
namespace skia {
namespace textlayout {

class ParagraphImpl;
class Cluster;
class Run;

typedef size_t RunIndex;
const size_t EMPTY_RUN = EMPTY_INDEX;

typedef size_t ClusterIndex;
typedef SkRange<size_t> ClusterRange;
const size_t EMPTY_CLUSTER = EMPTY_INDEX;
const SkRange<size_t> EMPTY_CLUSTERS = EMPTY_RANGE;

typedef size_t GraphemeIndex;
typedef SkRange<GraphemeIndex> GraphemeRange;

typedef size_t CodepointIndex;
typedef SkRange<CodepointIndex> CodepointRange;

typedef size_t GlyphIndex;
typedef SkRange<GlyphIndex> GlyphRange;

// LTR: [start: end) where start <= end
// RTL: [end: start) where start >= end
class DirText {
    DirText(bool dir, size_t s, size_t e) : start(s), end(e) { }
    bool isLeftToRight() const { return start <= end; }
    size_t start;
    size_t end;
};

class InternalLineMetrics;
class Run {
public:
    Run() = default;
    Run(ParagraphImpl* master,
        const SkShaper::RunHandler::RunInfo& info,
        size_t firstChar,
        SkScalar lineHeight,
        size_t index,
        SkScalar shiftX);
    ~Run() {}

    void setMaster(ParagraphImpl* master) { fMaster = master; }

    SkShaper::RunHandler::Buffer newRunBuffer();

    SkScalar posX(size_t index) const {
        return fPositions[index].fX + fOffsets[index].fX;
    }
    void addX(size_t index, SkScalar shift) {
        fPositions[index].fX += shift;
    }
    SkScalar posY(size_t index) const {
        return fPositions[index].fY + fOffsets[index].fY;
    }
    size_t size() const { return fGlyphs.size(); }
    void setWidth(SkScalar width) { fAdvance.fX = width; }
    void setHeight(SkScalar height) { fAdvance.fY = height; }
    void shift(SkScalar shiftX, SkScalar shiftY) {
        fOffset.fX += shiftX;
        fOffset.fY += shiftY;
    }
    SkVector advance() const {
        return SkVector::Make(fAdvance.fX, fFontMetrics.fDescent - fFontMetrics.fAscent);
    }
    SkVector offset() const { return fOffset; }
    SkScalar ascent() const { return fFontMetrics.fAscent; }
    SkScalar descent() const { return fFontMetrics.fDescent; }
    SkScalar leading() const { return fFontMetrics.fLeading; }
    SkScalar correctAscent() const {

        if (fHeightMultiplier == 0) {
            return fFontMetrics.fAscent - fFontMetrics.fLeading / 2;
        }
        return fFontMetrics.fAscent * fHeightMultiplier * fFont.getSize() /
                (fFontMetrics.fDescent - fFontMetrics.fAscent + fFontMetrics.fLeading / 2);
    }
    SkScalar correctDescent() const {

        if (fHeightMultiplier == 0) {
            return fFontMetrics.fDescent + fFontMetrics.fLeading / 2;
        }
        return fFontMetrics.fDescent * fHeightMultiplier * fFont.getSize() /
                (fFontMetrics.fDescent - fFontMetrics.fAscent + fFontMetrics.fLeading / 2);
    }
    SkScalar correctLeading() const {

        if (fHeightMultiplier == 0) {
            return fFontMetrics.fAscent;
        }
        return fFontMetrics.fLeading * fHeightMultiplier * fFont.getSize() /
                (fFontMetrics.fDescent - fFontMetrics.fAscent + fFontMetrics.fLeading);
    }
    const SkFont& font() const { return fFont; }
    bool leftToRight() const { return fBidiLevel % 2 == 0; }
    TextDirection getTextDirection() const { return leftToRight() ? TextDirection::kLtr : TextDirection::kRtl; }
    size_t index() const { return fIndex; }
    SkScalar heightMultiplier() const { return fHeightMultiplier; }
    PlaceholderStyle* placeholderStyle() const;
    bool isPlaceholder() const { return fPlaceholderIndex != std::numeric_limits<size_t>::max(); }
    size_t clusterIndex(size_t pos) const { return fClusterIndexes[pos]; }
    size_t globalClusterIndex(size_t pos) const { return fClusterStart + fClusterIndexes[pos]; }
    SkScalar positionX(size_t pos) const;

    TextRange textRange() const { return fTextRange; }
    ClusterRange clusterRange() const { return fClusterRange; }

    ParagraphImpl* master() const { return fMaster; }

    bool isEllipsis() const { return fEllipsis; }

    void updateMetrics(InternalLineMetrics* endlineMetrics);

    void setClusterRange(size_t from, size_t to) { fClusterRange = ClusterRange(from, to); }
    SkRect clip() const {
        return SkRect::MakeXYWH(fOffset.fX, fOffset.fY, fAdvance.fX, fAdvance.fY);
    }

    SkScalar addSpacesAtTheEnd(SkScalar space, Cluster* cluster);
    SkScalar addSpacesEvenly(SkScalar space, Cluster* cluster);
    void shift(const Cluster* cluster, SkScalar offset);

    SkScalar calculateHeight(LineMetricStyle ascentStyle, LineMetricStyle descentStyle) const {
        auto ascent = ascentStyle == LineMetricStyle::Typographic ? this->ascent()
                                    : this->correctAscent();
        auto descent = descentStyle == LineMetricStyle::Typographic ? this->descent()
                                      : this->correctDescent();
        return descent - ascent;
    }
    SkScalar calculateWidth(size_t start, size_t end, bool clip) const;

    void copyTo(SkTextBlobBuilder& builder, size_t pos, size_t size, SkVector offset) const;

    using ClusterTextVisitor = std::function<void(size_t glyphStart,
                                                  size_t glyphEnd,
                                                  size_t charStart,
                                                  size_t charEnd,
                                                  SkScalar width,
                                                  SkScalar height)>;
    void iterateThroughClustersInTextOrder(const ClusterTextVisitor& visitor);

    using ClusterVisitor = std::function<void(Cluster* cluster)>;
    void iterateThroughClusters(const ClusterVisitor& visitor);

    std::tuple<bool, ClusterIndex, ClusterIndex> findLimitingClusters(TextRange text, bool onlyInnerClusters) const;
    SkSpan<const SkGlyphID> glyphs() const {
        return SkSpan<const SkGlyphID>(fGlyphs.begin(), fGlyphs.size());
    }
    SkSpan<const SkPoint> positions() const {
        return SkSpan<const SkPoint>(fPositions.begin(), fPositions.size());
    }
    SkSpan<const SkPoint> offsets() const {
        return SkSpan<const SkPoint>(fOffsets.begin(), fOffsets.size());
    }
    SkSpan<const uint32_t> clusterIndexes() const {
        return SkSpan<const uint32_t>(fClusterIndexes.begin(), fClusterIndexes.size());
    }
    SkSpan<const SkScalar> shifts() const { return SkSpan<const SkScalar>(fShifts.begin(), fShifts.size()); }

    void commit();

    SkRect getBounds(size_t pos) const { return fBounds[pos]; }

    void resetShifts() {
        for (auto& r: fShifts) { r = 0; }
        fSpaced = false;
    }

    void resetJustificationShifts() {
        fJustificationShifts.reset();
    }
private:
    friend class ParagraphImpl;
    friend class TextLine;
    friend class InternalLineMetrics;
    friend class ParagraphCache;
    friend class OneLineShaper;

    ParagraphImpl* fMaster;
    TextRange fTextRange;
    ClusterRange fClusterRange;

    SkFont fFont;
    SkFontMetrics fFontMetrics;
    SkScalar fHeightMultiplier;
    size_t fPlaceholderIndex;
    bool fEllipsis;
    size_t fIndex;
    uint8_t fBidiLevel;
    SkVector fAdvance;
    SkVector fOffset;
    TextIndex fClusterStart;
    SkShaper::RunHandler::Range fUtf8Range;
    SkSTArray<128, SkGlyphID, true> fGlyphs;
    SkSTArray<128, SkPoint, true> fPositions;
    SkSTArray<128, SkPoint, true> fJustificationShifts; // For justification (current and prev shifts)
    SkSTArray<128, SkPoint, true> fOffsets;
    SkSTArray<128, uint32_t, true> fClusterIndexes;
    SkSTArray<128, SkRect, true> fBounds;

    SkSTArray<128, SkScalar, true> fShifts;  // For formatting (letter/word spacing)
    bool fSpaced;
};

struct Codepoint {

  Codepoint(GraphemeIndex graphemeIndex, TextIndex textIndex, size_t index)
    : fGrapheme(graphemeIndex), fTextIndex(textIndex), fIndex(index) { }

  GraphemeIndex fGrapheme;
  TextIndex fTextIndex;             // Used for getGlyphPositionAtCoordinate
  size_t fIndex;
};

struct Grapheme {
    Grapheme(CodepointRange codepoints, TextRange textRange)
        : fCodepointRange(codepoints), fTextRange(textRange) { }
    CodepointRange fCodepointRange;
    TextRange fTextRange;           // Used for getRectsForRange
};

class Cluster {
public:
    enum BreakType {
        None,
        GraphemeBreak,  // calculated for all clusters (UBRK_CHARACTER)
        SoftLineBreak,  // calculated for all clusters (UBRK_LINE & UBRK_CHARACTER)
        HardLineBreak,  // calculated for all clusters (UBRK_LINE)
    };

    Cluster()
            : fMaster(nullptr)
            , fRunIndex(EMPTY_RUN)
            , fTextRange(EMPTY_TEXT)
            , fGraphemeRange(EMPTY_RANGE)
            , fStart(0)
            , fEnd()
            , fWidth()
            , fSpacing(0)
            , fHeight()
            , fHalfLetterSpacing(0.0)
            , fWhiteSpaces(false)
            , fBreakType(None) {}

    Cluster(ParagraphImpl* master,
            RunIndex runIndex,
            size_t start,
            size_t end,
            SkSpan<const char> text,
            SkScalar width,
            SkScalar height);

    Cluster(TextRange textRange) : fTextRange(textRange), fGraphemeRange(EMPTY_RANGE) { }

    ~Cluster() = default;

    void setMaster(ParagraphImpl* master) { fMaster = master; }
    SkScalar sizeToChar(TextIndex ch) const;
    SkScalar sizeFromChar(TextIndex ch) const;

    size_t roundPos(SkScalar s) const;

    void space(SkScalar shift, SkScalar space) {
        fSpacing += space;
        fWidth += shift;
    }

    void setBreakType(BreakType type) { fBreakType = type; }
    bool isWhitespaces() const { return fWhiteSpaces; }
    bool canBreakLineAfter() const {
        return fBreakType == SoftLineBreak || fBreakType == HardLineBreak;
    }
    bool isHardBreak() const { return fBreakType == HardLineBreak; }
    bool isSoftBreak() const { return fBreakType == SoftLineBreak; }
    bool isGraphemeBreak() const { return fBreakType == GraphemeBreak; }
    size_t startPos() const { return fStart; }
    size_t endPos() const { return fEnd; }
    SkScalar width() const { return fWidth; }
    SkScalar height() const { return fHeight; }
    size_t size() const { return fEnd - fStart; }

    void setHalfLetterSpacing(SkScalar halfLetterSpacing) { fHalfLetterSpacing = halfLetterSpacing; }
    SkScalar getHalfLetterSpacing() const { return fHalfLetterSpacing; }

    TextRange textRange() const { return fTextRange; }

    RunIndex runIndex() const { return fRunIndex; }
    ParagraphImpl* master() const { return fMaster; }

    Run* run() const;
    SkFont font() const;

    SkScalar trimmedWidth(size_t pos) const;

    void setIsWhiteSpaces();

    bool contains(TextIndex ch) const { return ch >= fTextRange.start && ch < fTextRange.end; }

    bool belongs(TextRange text) const {
        return fTextRange.start >= text.start && fTextRange.end <= text.end;
    }

    bool startsIn(TextRange text) const {
        return fTextRange.start >= text.start && fTextRange.start < text.end;
    }

private:

    friend ParagraphImpl;

    ParagraphImpl* fMaster;
    RunIndex fRunIndex;
    TextRange fTextRange;
    GraphemeRange fGraphemeRange;

    size_t fStart;
    size_t fEnd;
    SkScalar fWidth;
    SkScalar fSpacing;
    SkScalar fHeight;
    SkScalar fHalfLetterSpacing;
    bool fWhiteSpaces;
    BreakType fBreakType;
};

class InternalLineMetrics {
public:

    InternalLineMetrics() {
        clean();
        fForceStrut = false;
    }

    InternalLineMetrics(bool forceStrut) {
        clean();
        fForceStrut = forceStrut;
    }

    InternalLineMetrics(SkScalar a, SkScalar d, SkScalar l) {
        fAscent = a;
        fDescent = d;
        fLeading = l;
        fForceStrut = false;
    }

    InternalLineMetrics(const SkFont& font, bool forceStrut) {
        SkFontMetrics metrics;
        font.getMetrics(&metrics);
        fAscent = metrics.fAscent;
        fDescent = metrics.fDescent;
        fLeading = metrics.fLeading;
        fForceStrut = forceStrut;
    }

    void add(Run* run) {

        if (fForceStrut) {
            return;
        }

        fAscent = std::min(fAscent, run->correctAscent());
        fDescent = std::max(fDescent, run->correctDescent());
        fLeading = std::max(fLeading, run->correctLeading());
    }

    void add(InternalLineMetrics other) {
        fAscent = std::min(fAscent, other.fAscent);
        fDescent = std::max(fDescent, other.fDescent);
        fLeading = std::max(fLeading, other.fLeading);
    }
    void clean() {
        fAscent = 0;
        fDescent = 0;
        fLeading = 0;
    }

    SkScalar delta() const { return height() - ideographicBaseline(); }

    void updateLineMetrics(InternalLineMetrics& metrics) {
        if (metrics.fForceStrut) {
            metrics.fAscent = fAscent;
            metrics.fDescent = fDescent;
            metrics.fLeading = fLeading;
        } else {
            // This is another of those flutter changes. To be removed...
            metrics.fAscent = std::min(metrics.fAscent, fAscent - fLeading / 2.0f);
            metrics.fDescent = std::max(metrics.fDescent, fDescent + fLeading / 2.0f);
        }
    }

    SkScalar runTop(const Run* run, LineMetricStyle ascentStyle) const {
        return fLeading / 2 - fAscent +
          (ascentStyle == LineMetricStyle::Typographic ? run->ascent() : run->correctAscent()) + delta();
    }

    SkScalar height() const {
        return ::round((double)fDescent - fAscent + fLeading);
    }

    SkScalar alphabeticBaseline() const { return fLeading / 2 - fAscent; }
    SkScalar ideographicBaseline() const { return fDescent - fAscent + fLeading; }
    SkScalar deltaBaselines() const { return fLeading / 2 + fDescent; }
    SkScalar baseline() const { return fLeading / 2 - fAscent; }
    SkScalar ascent() const { return fAscent; }
    SkScalar descent() const { return fDescent; }
    SkScalar leading() const { return fLeading; }
    void setForceStrut(bool value) { fForceStrut = value; }
    bool getForceStrut() const { return fForceStrut; }

private:

    friend class TextWrapper;
    friend class TextLine;

    SkScalar fAscent;
    SkScalar fDescent;
    SkScalar fLeading;
    bool fForceStrut;
};
}  // namespace textlayout
}  // namespace skia

#endif  // Run_DEFINED


text:
const Generator = require('yeoman-generator');
const changeCase = require('change-case');

class AppGenerator extends Generator {

    constructor(args, opts) {
        super(args, opts);

        this.argument('name', { type: String, required: true });
        this.argument('module', { type: String, required: false });
    }

    /**
     * WRITING
     *
     * @returns {undefined}
     */
    writing() {
        this.log(`Spawning ${this._getName()} ...`);
        this._copyFiles();
    }

    /**
     * GET NAME
     *
     * @returns {string}- valid factory name
     * @private
     */
    _getName() {
        const nameCamelCase = changeCase.camelCase(this.options.name);
        return nameCamelCase.endsWith('Factory') ? nameCamelCase : `${nameCamelCase}Factory`;
    }

    /**
     * GET MODULE
     *
     * @returns {string} - valid module name
     * @private
     */
    _getModule() {
        return changeCase.pascalCase(this.options.module);
    }

    /**
     * GET PATH
     *
     * @returns {string} - valid path
     * @private
     */
    _getPath() {
        return (this._getModule()) ? `src/modules/${this._getModule()}/factories` : 'src/shared/factories';
    }

    /**
     * COPY FILES
     *
     * @returns {undefined}
     * @private
     */
    _copyFiles() {
        this.fs.copyTpl(
            this.templatePath('factory.txt'),
            this.destinationPath(`${this._getPath()}/${this._getName()}.js`),
            {
                name: this._getName(),
                nameInner: this._getName().replace('Factory', ''),
                nameUpperCase: changeCase.upperCase(changeCase.sentenceCase(this._getName())),
            }
        );
        this.fs.copyTpl(
            this.templatePath('factory-test.txt'),
            this.destinationPath(`${this._getPath()}/${this._getName()}.spec.js`),
            {
                name: this._getName(),
                nameInner: this._getName().replace('Factory', ''),
            }
        );
    }
};

module.exports = AppGenerator;


text:
<SageTVPlugin>
  <Name>SageMC - Library</Name>
  <Identifier>sagemc-jar</Identifier>
  <Description>SageMC main JAR/Library</Description>
  <Author>MeInMaui, flachbar</Author>
  <CreationDate>2006.11.17</CreationDate>
  <ModificationDate>2010.09.30</ModificationDate>
  <Version>7.0.10</Version>
  <Webpage><![CDATA[http://forums.sagetv.com/forums/downloads.php?do=file&id=141]]></Webpage>

  <PluginType>Library</PluginType>

  <Package>
    <PackageType>JAR</PackageType>
    <Location>https://github.com/OpenSageTV/sagetv-plugin-repo/releases/download/1/sagemc-jar-7.0.10.zip</Location>
    <MD5>b88aaf0a27eceb0afe393ae460ec4b15</MD5>
  </Package>
</SageTVPlugin>


text:
[Google Chat SDK](../README.md) / [chat\_v1](../modules/chat_v1.md) / Schema$DriveDataRef

# Interface: Schema$DriveDataRef

[chat_v1](../modules/chat_v1.md).Schema$DriveDataRef

A reference to the data of a drive attachment.

## Table of contents

### Properties

- [driveFileId](chat_v1.Schema_DriveDataRef.md#drivefileid)

## Properties

### driveFileId

• `Optional` **driveFileId**: ``null`` \| `string`

The id for the drive file, for use with the Drive API.

#### Defined in

node_modules/@googleapis/chat/build/v1.d.ts:407


text:
import mapValues from '../utils/mapValues';
import pick from '../utils/pick';

export default function composeStores(stores) {
  const finalStores = pick(stores, (val) => typeof val === 'function');
  return function Composition(atom = {}, action) {
    return mapValues(finalStores, (store, key) =>
      store(atom[key], action)
    );
  };
}


text:
/**
 * Created by Reni on 19/12/2015.
 */

var usersController = require('../controllers/UsersController');

module.exports = {
    users: usersController
};


text:
1).Bagaimana Cara melakukan Select View data Record dari File dbf dan geometri

2).Seperti apa membuat Class di Python untuk menampilkan retrieve data geospasial

Select View Data Record dari file dbf dan geometri
Import shapefile

-sf = shapefile.Reader("nama.shp")

Hitung berapa jumlah Record

Membuka dbf ;

-sf.records()

-sf.record(n)

-sf.fields = melihat daftar nama field

Membuka shp :

-sf.shapes()

-sf.shape(n)

-dir(shapes)

Contoh 1 (hitung record)

a = sf.shapes() -> retrieve all data geometri

Len(a) = digunakan untuk menghitung jumlah record di variable a dimana len() itu fungsi menghitung jumlah arrow/dict dalam variable

Contoh 2 (melihat nama fields)

Nama.file = sf.fields

Print nama.fields

Class

Import shapefile

Class gede(object) :

Def hitungbaris(self.namafile)

Sf = shapefile.Reader(namafile)

Record = sf.shapes()

Return len(rec)

-Import gede

-inst = gede.Gede()

-inst.hitungbaris("shp/bts_negara.shp")

Constract

Import shapefile

Class gede(object) :

Def_init_(shelf,namafile):

Self.sf = shapefile.Reader(namafile)

Def hitungbaris (self)

Rec = self.sf.shapes()

Return len(rec)

## Kesimpulan

Dengan membuat class di python yang sesuai dengan file.py akan membuat  kita bisa melihat record data.
Dengan perintah perintah yang sudah dipraktekan kita menjadi lebih tahu hal hal yang baru di Python.

## Saran
Praktek Coding Python sudah bagus tapi mungkin untuk memahami dokumentasi kurang karena fundamentalnya harus diperkuat
diawal agar bisa mengikuti dengan baik.

Nama : Muhammad Firman Kahfi

NPM : 1144015

Kelas : 3B

Prodi : D4 Teknik Informatika

Mata Kuliah : Sistem Informasi Geografis

* Link Github : https://github.com/FirmanMFK/GIS--Geographic-Information-Systems
* Link Youtube : https://www.youtube.com/watch?v=WL2NGdxzVi0

## Referensi :
* www.naturalearthdata.com
* https://wiki.python.org/moin/BeginnersGuide

## Scan Plagiarism
Link Plagiarism Via Duplichecker : https://drive.google.com/file/d/0BzrCjHLyhoFsVlBRazdCaG0wcHM/view?usp=sharing

Link Plagiarism Via Smallseotools : https://drive.google.com/file/d/0BzrCjHLyhoFsRVdMQmJZc0pUa2c/view?usp=sharing


text:
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

class MainPage(webapp.RequestHandler):

    def get(self):
        user = users.get_current_user()

        if user:
            self.response.out.write(
                'Hello %s Sign out
Is administrator: %s' %
                (user.nickname(), users.create_logout_url("/"), users.is_current_user_admin())
            )
        else:
            self.redirect(users.create_login_url(self.request.uri))

application = webapp.WSGIApplication([('/', MainPage)], debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()


text:
@interface LJCMTipViewController ()

@property (nonatomic, readwrite) BOOL isparamsError;
@property (nonatomic, readwrite) BOOL isNotURLSupport;
@property (nonatomic, readwrite) BOOL isNotFound;

@property (nonatomic, readwrite) NSString *showText;

@property (nonatomic, strong) UILabel *valueLabel;
@property (nonatomic, strong) UIButton *returnButton;

@end

@implementation LJCMTipViewController

- (instancetype)init {

    self = [super init];
    if (self) {

        _isparamsError = NO;
        _isNotURLSupport = NO;
        _isNotFound = NO;
    }
    return self;
}

+ (nonnull UIViewController *)paramsErrorTipController {

    LJCMTipViewController *controller = [[LJCMTipViewController alloc] init];
    controller.isparamsError = YES;
    return (UIViewController *)controller;
}

+ (nonnull UIViewController *)notURLTipController {

    LJCMTipViewController *controller = [[LJCMTipViewController alloc] init];
    controller.isNotURLSupport = YES;
    return (UIViewController *)controller;
}

+ (nonnull UIViewController *)notFoundTipConctroller {

    LJCMTipViewController *controller = [[LJCMTipViewController alloc] init];
    controller.isNotFound = YES;
    return (UIViewController *)controller;
}

- (void)viewDidLoad {

    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor redColor];

    _valueLabel = [[UILabel alloc] init];
    _valueLabel.font = [UIFont systemFontOfSize:16];
    _valueLabel.backgroundColor = [UIColor clearColor];
    _valueLabel.textColor = [UIColor whiteColor];
    _valueLabel.frame = CGRectMake(10.0f, 50.0f, self.view.frame.size.width - 20, self.view.frame.size.height - 100.0f);
    [self.view addSubview:_valueLabel];

    _returnButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _returnButton.layer.cornerRadius = 4.0f;
    [_returnButton setBackgroundColor:[UIColor grayColor]];
    [_returnButton addTarget:self action:@selector(didTappedReturnButton:) forControlEvents:UIControlEventTouchUpInside];
    [_returnButton setTitle:@"返回" forState:UIControlStateNormal];
    [_returnButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    _returnButton.frame = CGRectMake((self.view.frame.size.width - 100) / 2, self.view.frame.size.height - 75, 100, 50);
    [self.view addSubview:_returnButton];

    //show 显示
    _valueLabel.numberOfLines = [_showText componentsSeparatedByString:@"\n"].count + 1;
    _valueLabel.text = _showText;
}

- (void)showDebugTipController:(nonnull NSURL *)URL
                withParameters:(nullable NSDictionary *)parameters {

    NSString *errorString = @"";
    if (_isparamsError) {

        errorString = @"params error!!!";
    }

    if (_isNotURLSupport) {

        errorString = @"can not support return a url-based controller!!!";
    }

    if (_isNotFound) {

        errorString = @"can not found url!!!";
    }

    self.showText = [NSString stringWithFormat:@"open url error: %@\n\nurlString:\n\t%@\n\nparameters:\n%@", errorString, URL, parameters];

    UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
    if(rootViewController.presentedViewController){

        [rootViewController.presentedViewController dismissViewControllerAnimated:NO completion:^{

            [rootViewController presentViewController:self animated:YES completion:nil];
        }];

    } else {

        [rootViewController presentViewController:self animated:YES completion:nil];
    }
}

- (void)didTappedReturnButton:(UIButton *)button
{
    if (self.navigationController == nil) {

        [self dismissViewControllerAnimated:YES completion:nil];
    } else {

        if (self.parentViewController) {

            [self.parentViewController dismissViewControllerAnimated:YES completion:nil];
        } else {

            [self.navigationController popViewControllerAnimated:YES];
        }
    }
}

@end


text:
package twg2.io.serialize.xml;

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

/** A compound XML Attribute that can contain multiple attributes. Its purpose is to be reused for each XML element
 * being written by an {@link XmlOutput} stream or read by an {@link XmlInput} stream.
 * {@link XmlAttributes#clear()},
 * @author TeamworkGuy2
 * @since 2013-6-3
 */
public class XmlAttributes {
	List<String> names;
	List<String> namesIm;
	List<Object> values;
	List<Object> valuesIm;
	List<Byte> types;
	List<Byte> typesIm;
	List<Integer> arraySize;
	List<Integer> arraySizeIm;

	public XmlAttributes() {
		super();
		names = new ArrayList<String>();
		namesIm = Collections.unmodifiableList(names);
		values = new ArrayList<Object>();
		valuesIm = Collections.unmodifiableList(values);
		types = new ArrayList<Byte>();
		typesIm = Collections.unmodifiableList(types);
		arraySize = new ArrayList<Integer>();
		arraySizeIm = Collections.unmodifiableList(arraySize);
	}

	/** Add a boolean attribute to this list of XML attributes.
	 * @param name the name of the attribute
	 * @param value the attribute's boolean value
	 */
	public void addAttributeBoolean(String name, boolean value) {
		names.add(name);
		values.add(value);
		types.add(Byte.valueOf((byte)XmlHandler.BOOLEAN_TYPE));
		arraySize.add(null);
	}

	/** Add a character attribute to this list of XML attributes.
	 * @param name the name of the attribute
	 * @param value the attribute's character value
	 */
	public void addAttributeChar(String name, char value) {
		names.add(name);
		values.add(value);
		types.add(Byte.valueOf((byte)XmlHandler.CHAR_TYPE));
		arraySize.add(null);
	}

	/** Add a byte attribute to this list of XML attributes.
	 * @param name the name of the attribute
	 * @param value the attribute's byte value
	 */
	public void addAttributeByte(String name, byte value) {
		names.add(name);
		values.add(value);
		types.add(Byte.valueOf((byte)XmlHandler.BYTE_TYPE));
		arraySize.add(null);
	}

	/** Add a short value attribute to this list of XML attributes.
	 * @param name the name of the attribute
	 * @param value the attribute's short value
	 */
	public void addAttributeShort(String name, short value) {
		names.add(name);
		values.add(value);
		types.add(Byte.valueOf((byte)XmlHandler.SHORT_TYPE));
		arraySize.add(null);
	}

	/** Add an int attribute to this list of XML attributes.
	 * @param name the name of the attribute
	 * @param value the attribute's int value
	 */
	public void addAttributeInt(String name, int value) {
		names.add(name);
		values.add(value);
		types.add(Byte.valueOf((byte)XmlHandler.INT_TYPE));
		arraySize.add(null);
	}

	/** Add a long value attribute to this list of XML attributes.
	 * @param name the name of the attribute
	 * @param value the attribute's long value
	 */
	public void addAttributeLong(String name, long value) {
		names.add(name);
		values.add(value);
		types.add(Byte.valueOf((byte)XmlHandler.LONG_TYPE));
		arraySize.add(null);
	}

	/** Add a float attribute to this list of XML attributes.
	 * @param name the name of the attribute
	 * @param value the attribute's float value
	 */
	public void addAttributeFloat(String name, float value) {
		names.add(name);
		values.add(value);
		types.add(Byte.valueOf((byte)XmlHandler.FLOAT_TYPE));
		arraySize.add(null);
	}

	/** Add a double value attribute to this list of XML attributes.
	 * @param name the name of the attribute
	 * @param value the attribute's double value
	 */
	public void addAttributeDouble(String name, double value) {
		names.add(name);
		values.add(value);
		types.add(Byte.valueOf((byte)XmlHandler.DOUBLE_TYPE));
		arraySize.add(null);
	}

	/** Add an attribute to this list of XML attributes.
	 * @param name the name of the attribute
	 * @param value the attribute's value (as a string)
	 */
	public void addAttribute(String name, String value) {
		names.add(name);
		values.add(value);
		types.add(Byte.valueOf((byte)XmlHandler.STRING_TYPE));
		arraySize.add(null);
	}

	/** Add the specified attribute name and list of values
	 * to this group of attributes as an {@link XmlHandler#ARRAY_TYPE array type} attribute.
	 * A class cast exception will be generated if the items in the list are not all of the same valid type.
	 * Valid types include: Byte, Short, Integer, Long, Float, Double, Boolean, Character, and String.
	 * @param name - the name of the attribute to add
	 * @param valueList - the list of values to store as the attribute's value
	 */
	public void addAttribute(String name, List<Object> valueList) {
		byte type = checkType(valueList);
		int size = valueList.size();
		Object valuesArray = toArray(valueList, 0, size);
		names.add(name);
		values.add(valuesArray);
		types.add(Byte.valueOf((byte)(type & XmlHandler.ARRAY_TYPE)));
		arraySize.add(size);
	}

	// Get the name or value of one of the attribute stored in this object
	/** Get the name of the nth attribute in this attribute group
	 * @param index the index of the attribute to get
	 * @return the attribute's value
	 */
	public String getAttributeName(int index) {
		return names.get(index);
	}

	/** Get the length of the array of the nth attribute in this attribute group.
	 * This assumes that the nth attribute contains an array data type.
	 * @param index the index of the attribute to get
	 * @return the length of the array belonging to the specified attribute index
	 */
	public int getAttributeDataArrayLength(int index) {
		return arraySize.get(index);
	}

	/** Get the boolean value of the specified attribute index
	 * @param index the index of the attribute to get the value from
	 * @return the boolean value of the attribute at the specified index
	 */
	public boolean getAttributeBoolean(int index) {
		Object obj = values.get(index);
		if(obj instanceof String) {
			return Boolean.parseBoolean((String)obj);
		}
		else {
			return (Boolean)obj;
		}
	}

	/** Get the character value of the specified attribute index
	 * @param index the index of the attribute to get the value from
	 * @return the character value of the attribute at the specified index
	 */
	public char getAttributeChar(int index) {
		Object obj = values.get(index);
		if(obj instanceof String) {
			return ((String)obj).charAt(0);
		}
		else {
			return (Character)obj;
		}
	}

	/** Get the byte value of the specified attribute index
	 * @param index the index of the attribute to get the value from
	 * @return the byte of the attribute at the specified index
	 */
	public byte getAttributeByte(int index) {
		Object obj = values.get(index);
		if(obj instanceof String) {
			return Byte.parseByte((String)obj, 10);
		}
		else {
			return (Byte)obj;
		}
	}

	/** Get the short value of the specified attribute index
	 * @param index the index of the attribute to get the value from
	 * @return the short value of the attribute at the specified index
	 */
	public short getAttributeShort(int index) {
		Object obj = values.get(index);
		if(obj instanceof String) {
			return Short.parseShort((String)obj, 10);
		}
		else {
			return (Short)obj;
		}
	}

	/** Get the integer value of the specified attribute index
	 * @param index the index of the attribute to get the value from
	 * @return the int value of the attribute at the specified index
	 */
	public int getAttributeInt(int index) {
		Object obj = values.get(index);
		if(obj instanceof String) {
			return Integer.parseInt((String)obj, 10);
		}
		else {
			return (Integer)obj;
		}
	}

	/** Get the long value of the specified attribute index
	 * @param index the index of the attribute to get the value from
	 * @return the long value of the attribute at the specified index
	 */
	public long getAttributeLong(int index) {
		Object obj = values.get(index);
		if(obj instanceof String) {
			return Long.parseLong((String)obj, 10);
		}
		else {
			return (Long)obj;
		}
	}

	/** Get the float value of the specified attribute index
	 * @param index the index of the attribute to get the value from
	 * @return the float value of the attribute at the specified index
	 */
	public float getAttributeFloat(int index) {
		Object obj = values.get(index);
		if(obj instanceof String) {
			return Float.parseFloat((String)obj);
		}
		else {
			return (Float)obj;
		}
	}

	/** Get the double value of the specified attribute index
	 * @param index the index of the attribute to get the value from
	 * @return the double value of the attribute at the specified index
	 */
	public double getAttributeDouble(int index) {
		Object obj = values.get(index);
		if(obj instanceof String) {
			return Double.parseDouble((String)obj);
		}
		else {
			return (Double)obj;
		}
	}

	/** Get the value (as a string) of the specified attribute index
	 * @param index the index of the attribute to get the value from
	 * @return the String value of the attribute at the specified index
	 */
	public String getAttributeString(int index) {
		return (String)values.get(index);
	}

	/** Get the list of attribute names in this attribute group
	 * @return the unmodifiable list of attribute names in this attribute groups
	 */
	public List<String> getAttributeNames() {
		return namesIm;
	}

	/** Returns a list of objects which will be one of the classes:
	 * Byte, Short, Integer, Long, Float, Double, Boolean, Char, String
	 * @return the unmodifiable list of values in this attribute group
	 */
	public List<Object> getAttributeValues() {
		return valuesIm;
	}

	/** Returns a list of data types which will be one of the {@link XmlHandler} constants:
	 * {@link XmlHandler#BYTE_TYPE BYTE_TYPE}, {@link XmlHandler#SHORT_TYPE SHORT_TYPE}, {@link XmlHandler#INT_TYPE INT_TYPE},
	 * {@link XmlHandler#LONG_TYPE LONG_TYPE}, {@link XmlHandler#FLOAT_TYPE FLOAT_TYPE}, {@link XmlHandler#DOUBLE_TYPE DOUBLE_TYPE},
	 * {@link XmlHandler#BOOLEAN_TYPE BOOLEAN_TYPE}, {@link XmlHandler#CHAR_TYPE CHAR_TYPE},
	 * {@link XmlHandler#STRING_TYPE STRING_TYPE},
	 * {@link XmlHandler#ARRAY_TYPE ARRAY_TYPE}
	 * @return the list of types in this attribute group
	 */
	public List<Byte> getAttributeTypes() {
		return typesIm;
	}

	/** Returns a list of values corresponding to the array length of the data types stored in this attribute group, or null if the
	 * data element is not an {@link XmlHandler#ARRAY_TYPE ARRAY_TYPE}.
	 * @return a list of values corresponding to the array length of the data types stored in this attribute group, or null if the
	 * data element is not an {@link XmlHandler#ARRAY_TYPE ARRAY_TYPE}.
	 */
	public List<Integer> getAttributeArrayLengths() {
		return arraySizeIm;
	}

	/** Check if all of the values in the specified array are of the same type or subtype and
	 * return the {@link XmlHandler} value of the specified array.
	 * @param values the list of values to check the type of
	 * @return the data type of the list, for example: {@link XmlHandler#INT_TYPE}, {@link XmlHandler#STRING_TYPE}, etc.
	 */
	private byte checkType(List<Object> values) {
		Object obj = values.get(0);
		Class<?> clazz = obj.getClass();
		for(Object value : values) {
			if(!clazz.isInstance(value)) {
				throw new IllegalArgumentException("The array values to check are not all of the same class type");
			}
		}
		if(obj instanceof String) {
			return XmlHandler.STRING_TYPE;
		}
		else if(obj instanceof Integer) {
			return XmlHandler.INT_TYPE;
		}
		else if(obj instanceof Float) {
			return XmlHandler.FLOAT_TYPE;
		}
		else if(obj instanceof Boolean) {
			return XmlHandler.BOOLEAN_TYPE;
		}
		else if(obj instanceof Byte) {
			return XmlHandler.BYTE_TYPE;
		}
		else if(obj instanceof Short) {
			return XmlHandler.SHORT_TYPE;
		}
		else if(obj instanceof Long) {
			return XmlHandler.LONG_TYPE;
		}
		else if(obj instanceof Double) {
			return XmlHandler.DOUBLE_TYPE;
		}
		else if(obj instanceof Character) {
			return XmlHandler.CHAR_TYPE;
		}
		else {
			return XmlHandler.NO_TYPE;
		}
	}

	/** Converts a list of objects into an array of primitives based on the type of the item
	 * in the list at index offset.
	 * For example, if the object at index offset in the list is of type {@link Integer}
	 * a new int[length] array is created and the list of values starting
	 * at offset for length number of items are retrieved
	 * from the list and cast to an int and stored in the array.
	 * Valid types are Byte, Short, Integer, Long, Float, Double, Character, Boolean, and String.
	 * @param values the list of values to convert to an array
	 * @param offset the offset into the list of values at which to start converting to an array
	 * @param length the number of items from the list to convert to an array
	 * @return an array length long with the same class type as the item at
	 * index offset in the list.
	 */
	private Object toArray(List<Object> values, int offset, int length) {
		String[] st = null;
		long[] lo = null;
		int[] in = null;
		short[] sh = null;
		byte[] by = null;
		float[] fl = null;
		double[] dou = null;
		char[] ch = null;
		boolean[] bo = null;
		Object obj = values.get(offset);

		if(obj instanceof String) {
			st = new String[length];
			for(int i = 0; i < length; i++) {
				st[i] = (String)values.get(offset+i);
			}
			return st;
		}
		else if(obj instanceof Integer) {
			in = new int[length];
			for(int i = 0; i < length; i++) {
				in[i] = (Integer)values.get(offset+i);
			}
			return st;
		}
		else if(obj instanceof Float) {
			fl = new float[length];
			for(int i = 0; i < length; i++) {
				fl[i] = (Float)values.get(offset+i);
			}
			return st;
		}
		else if(obj instanceof Boolean) {
			bo = new boolean[length];
			for(int i = 0; i < length; i++) {
				bo[i] = (Boolean)values.get(offset+i);
			}
			return st;
		}
		else if(obj instanceof Byte) {
			by = new byte[length];
			for(int i = 0; i < length; i++) {
				by[i] = (Byte)values.get(offset+i);
			}
			return st;
		}
		else if(obj instanceof Short) {
			sh = new short[length];
			for(int i = 0; i < length; i++) {
				sh[i] = (Short)values.get(offset+i);
			}
			return st;
		}
		else if(obj instanceof Long) {
			lo = new long[length];
			for(int i = 0; i < length; i++) {
				lo[i] = (Long)values.get(offset+i);
			}
			return st;
		}
		else if(obj instanceof Double) {
			dou = new double[length];
			for(int i = 0; i < length; i++) {
				dou[i] = (Double)values.get(offset+i);
			}
			return st;
		}
		else if(obj instanceof Character) {
			ch = new char[length];
			for(int i = 0; i < length; i++) {
				ch[i] = (Character)values.get(offset+i);
			}
			return st;
		}
		else {
			return null;
		}
	}

	/** Clear all of the names and values in this XML attribute group
	 */
	public void clear() {
		names.clear();
		values.clear();
		types.clear();
	}

	/**
	 * @return the number of attributes in this XML attribute group
	 */
	public int size() {
		return names.size();
	}

	@Override
	public String toString() {
		List<String> name = names;
		List<Object> value = values;
		int size = name.size();
		if(size < 1) {
			return "";
		}
		StringBuilder str = new StringBuilder();
		for(int i = 0; i < size-1; i++) {
			str.append(name.get(i));
			str.append('=');
			str.append(value.get(i));
			str.append(',');
			str.append(' ');
		}
		str.append(name.get(size-1));
		str.append('=');
		str.append(value.get(size-1));
		return str.toString();
	}

}


text:
/*
 * The render engine is used for drawing most of the things you see on the screen
 * The main uses are drawing layers, creating thumbnails and cutting out selections.
 */
/// <reference path="render-helper"/>
/// <reference path="layer"/>
/// <reference path="drawbuffer"/>
/// <reference path="filters/filter"/>
/// <reference path="image-layer"/>
/// <reference path="background-shader-program"/>
/// <reference path="resource-manager"/>

class RenderEngine implements MLayer.INotifyPropertyChanged {
    private gl : WebGLRenderingContext;
    private backgroundShaderProgram : BackgroundShaderProgram;

    /* Array of layers in the order that the user sees them */
    private layers : Array<Layer>;
    private drawbuffer1 : DrawBuffer;
    private drawbuffer2 : DrawBuffer;
    private thumbnailDrawbuffer : DrawBuffer;

    /* Width and height of the framebuffer */
    private width : number;
    private height : number;

    private thumbnailWidth = 192;
    private thumbnailHeight = 192;

    public resourceManager;

    private colorPickerDrawbuffer : DrawBuffer;
    private backgroundEnabled : boolean = true;

    constructor (canvas : HTMLCanvasElement) {
        this.width = canvas.width;
        this.height = canvas.height;
        this.thumbnailHeight = Math.round(this.thumbnailWidth * (this.height / this.width));

        this.layers = new Array();

        try {
            /* Try to grab the standard context. If it fails, fallback to experimental. */
            this.gl = <WebGLRenderingContext> (
                canvas.getContext("webgl", {stencil:true, preserveDrawingBuffer: true, alpha: false}) ||
                canvas.getContext("experimental-webgl", {stencil:true, preserveDrawingBuffer: true, alpha: false})
            );
            var contextAttributes = this.gl.getContextAttributes();
            var haveStencilBuffer = contextAttributes.stencil;

            if (!haveStencilBuffer) {
                console.log("Your browser has limited support for WebGL (missing stencil buffer).\nSelection will not work!");
            }

            this.gl.enable(this.gl.BLEND);
            this.gl.blendFuncSeparate(this.gl.SRC_ALPHA, this.gl.ONE_MINUS_SRC_ALPHA, this.gl.ONE, this.gl.ONE_MINUS_SRC_ALPHA);
            this.gl.blendEquation(this.gl.FUNC_ADD);
        }

        catch(e) {
            alert("Your device/browser doesnt support WebGL!\ncheck console for stacktrace.");
            console.log(e.stack);
        }

        this.gl.viewport(0, 0, this.width, this.height);
        this.drawbuffer1 = new DrawBuffer(this.gl, this.width, this.height);
        this.drawbuffer2 = new DrawBuffer(this.gl, this.width, this.height);
        this.thumbnailDrawbuffer = new DrawBuffer(this.gl, this.thumbnailWidth, this.thumbnailHeight);
        this.resourceManager = new ResourceManager(this.gl);
        this.backgroundShaderProgram = new BackgroundShaderProgram(this.gl);
    }

    getLayer(index : number) {
        return this.layers[index];
    }

    getWidth() {
        return this.width;
    }

    getHeight() {
        return this.height;
    }

    public enableBackground(enable : boolean) {
        this.backgroundEnabled = enable;
    }

    public getNumberOfLayers() : number {
        return this.layers.length;
    }

    public addLayer(layer : Layer) {
        /* Append layer to user array */
        this.insertLayer(layer, this.layers.length);
    }

    public insertLayer(layer : Layer, index : number) {
        layer.registerNotifyPropertyChanged(this);
        this.createThumbnail(layer);
        this.layers.splice(index, 0, layer);
    }

    public removeLayer(index : number) {
        var layer : Layer = this.layers[index];
        this.layers.splice(index, 1);
        layer.destroy();
    }

    public reorder(i : number, j : number) {
        /* Switch places in the user array */
        var temp = this.layers[i];
        this.layers[i] = this.layers[j];
        this.layers[j] = temp;
    }

    /* Render all layers that are not hidden */
    public render() {
        /* Draw background */
        this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.STENCIL_BUFFER_BIT);

        if (this.backgroundEnabled) {
            this.backgroundShaderProgram.activate();
            this.backgroundShaderProgram.setUniforms(this.width, this.height);
            this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4);
        }

        var oldType = -1;
        var numItems = this.layers.length;

        /* Draw all layers to the currently bound framebuffer */
        for (var i = 0; i < numItems; i++) {
            var layer = this.layers[i];
            if (layer.isHidden()) {
                continue;
            }

            if (layer.getLayerType() != oldType) {
                /*
                 * We're drawing a different type of layer then our previous one,
                 * so we need to do some extra stuff.
                 */
                layer.setupRender();
                oldType = layer.getLayerType();
            }

            layer.render();
        }
    }

    public startColorPicking() : void {
        if (!this.colorPickerDrawbuffer) {
            this.colorPickerDrawbuffer = new DrawBuffer(this.gl, this.width, this.height);
        }

        this.colorPickerDrawbuffer.bind();
        {
            this.enableBackground(false);
            this.render();
            this.enableBackground(true);
        }
        this.colorPickerDrawbuffer.unbind();
    }

    public endColorPicking() : void {
        if (this.colorPickerDrawbuffer) {
            this.colorPickerDrawbuffer.destroy();
            this.colorPickerDrawbuffer = null;
        }
    }

    /* Get the color at a given coordinate */
    public getPixelColor(x : number, y : number) : Uint8Array {
        var value = new Uint8Array(4);
        this.colorPickerDrawbuffer.bind();
        {
            this.gl.readPixels(x, this.height - y - 1, 1, 1, this.gl.RGBA, this.gl.UNSIGNED_BYTE, value);
        }
        this.colorPickerDrawbuffer.unbind();
        return value;
    }

    /* Create a thumbnail for a layer */
    private createThumbnail(layer : Layer) {
        this.thumbnailDrawbuffer.bind();
        this.gl.viewport(0, 0, this.thumbnailWidth, this.thumbnailHeight);
        this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.STENCIL_BUFFER_BIT);
        layer.setupRender();
        layer.render();
        layer.setThumbnail(this.thumbnailDrawbuffer.getImage());
        this.thumbnailDrawbuffer.unbind();
        this.gl.viewport(0, 0, this.width, this.height);
    }

    /* When a layer changed we need to create new thumbnail */
    public propertyChanged(layer : Layer) {
        this.createThumbnail(layer);
    }

    /* Render only a given set of indices, also when they're set to hidden */
    private renderIndices(indices : number[], drawHiddenLayers = false) {
        this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.STENCIL_BUFFER_BIT);
        var oldType = -1;
        for (var i = 0; i < indices.length; i++) {
            /* Take the old layer (one layer at a time) */
            var layer:Layer = this.layers[indices[i]];

            if (!drawHiddenLayers && layer.isHidden()) {
                continue;
            }

            if (layer.getLayerType() != oldType) {
                /*
                 * We're drawing a different type of layer then our previous one,
                 * so we need to do some extra stuff.
                 */
                layer.setupRender();
                oldType = layer.getLayerType();
            }
            layer.render();
        }
    }

    /* Render indices to an image that is returned as base64 string */
    public renderIndicesToImg(indices : number[], drawHiddenLayers = false) : String {
        this.drawbuffer1.bind();
        this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.STENCIL_BUFFER_BIT);

        this.renderIndices(indices, drawHiddenLayers);

        var data : String = this.drawbuffer1.getImage();
        this.drawbuffer1.unbind();

        return data;
    }

    /* Render all layers (hidden ones too) to an image and return base64 string */
    public renderToImg() : String {
        var indices : number[] = [];
        for (var i = 0; i < this.layers.length; i++) {
            indices.push(i);
        }
        return this.renderIndicesToImg(indices);
    }

    public createImageLayer(image : HTMLImageElement) : ImageLayer {
        return new ImageLayer(
            this.resourceManager,
            this.width,
            this.height,
            image
        );
    }

    /*
     * Given a bitmask and an image layer (or at least the index) we:
     *  - replace the image layer with the part that is not in the selection
     *  - return a new image layer with the part that is in the selection
     */
    public createSelectionImageLayer(bitmask: HTMLImageElement, layerIndex: number) : ImageLayer {
        var gl = this.gl;

        var layer = <ImageLayer>this.layers[layerIndex];
        if (layer.getLayerType() != LayerType.ImageLayer) {
            return;
        }

        var width = bitmask.width;
        var height = bitmask.height;

        /* Create an image layer that will contain the selected part */
        var selectedLayer = this.createImageLayer(layer.getImage());

        var bitmaskProgram = this.resourceManager.bitmaskProgramInstance();

        /* Copy the bitmask to GPU memory */
        var texture = gl.createTexture();
        gl.bindTexture(gl.TEXTURE_2D, texture);

        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);

        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, bitmask);

        /* Draw the bitmask to the stencil buffre */
        var drawbuffer = new DrawBuffer(gl, width, height);
        drawbuffer.bind();
        gl.viewport(0, 0, width, height);

        gl.enable(this.gl.STENCIL_TEST);
        gl.clear(gl.STENCIL_BUFFER_BIT | gl.COLOR_BUFFER_BIT);
        gl.stencilFunc(gl.ALWAYS, 1, 0xFF);
        gl.stencilOp(gl.REPLACE, gl.REPLACE, gl.REPLACE);

        bitmaskProgram.activate();
        bitmaskProgram.setUniforms(texture);
        gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4);

        /* Draw the selected part of the image and put it in the new image layer*/
        gl.clear(gl.COLOR_BUFFER_BIT);
        gl.stencilFunc(gl.EQUAL, 1, 0xFF);
        gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);
        layer.setupRender();
        layer.renderFullscreen();
        selectedLayer.copyFramebuffer(width, height);

        /* Draw the not selected part of the image and put it in the original image layer */
        gl.clear(gl.COLOR_BUFFER_BIT);
        gl.stencilFunc(gl.NOTEQUAL, 1, 0xFF);
        gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);
        layer.setupRender();
        layer.renderFullscreen();
        layer.copyFramebuffer(width, height);

        this.gl.disable(this.gl.STENCIL_TEST);
        drawbuffer.unbind();
        gl.viewport(0, 0, this.width, this.height);

        selectedLayer.setPos(layer.getPosX(), layer.getPosY());
        selectedLayer.setRotation(layer.getRotation());
        selectedLayer.setDimensions(layer.getWidth(), layer.getHeight());
        selectedLayer.setTransformMatrix(layer.getTransformMatrix());
        return selectedLayer;
    }

    /*
     * Resize the drawbuffers and destroy all the layers (as we dont know what to do when the resolution changes)
     */
    public resize(width : number, height : number) {
        this.width = width;
        this.height = height;

        this.thumbnailHeight = Math.round(this.thumbnailWidth * (this.height / this.width));
        this.thumbnailDrawbuffer = new DrawBuffer(this.gl, this.thumbnailWidth, this.thumbnailHeight);

        for (var i = 0; i < this.layers.length; i++) {
            this.layers[i].destroy();
        }
        this.layers = new Array();

        this.drawbuffer1.destroy();
        this.drawbuffer2.destroy();

        this.gl.viewport(0, 0, this.width, this.height);
        this.drawbuffer1 = new DrawBuffer(this.gl, this.width, this.height);
        this.drawbuffer2 = new DrawBuffer(this.gl, this.width, this.height);
        this.render();
    }
}


text:
<?xml version="1.0"?>
<project name="SwiftSuspenders" basedir="." default="test">

  <!-- set up a prefix for all environment variables -->
  <property environment="env."/>

  <!-- System environment must contain FLEX_HOME variable that points to Flex SDK -->
  <property name="FLEX_HOME" location="${env.FLEX_HOME}"/>

  <!-- identify properties file -->
  <property file="build.properties"/>

  <!-- Set up Flex and FlexUnit ant tasks -->
  <taskdef resource="flexTasks.tasks" classpath="${lib.loc}/flexTasks.jar"/>
  <taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks.jar"/>

  <target name="usage">
      <echo message=""/>
      <echo message="SwiftSuspenders Build Usage"/>
      <echo message="-----------------------------------"/>
      <echo message=""/>
      <echo message="Available targets are:"/>
      <echo message=""/>
      <echo message="test          --> Build SwiftSuspenders SWC and run unit tests"/>
      <echo message="asdoc         --> Build SwiftSuspenders SWC, test, and generate asdocs"/>
      <echo message="package       --> Build SwiftSuspenders SWC, test, and create release zip"/>
      <echo message="compile       --> Build SwiftSuspenders SWC"/>
      <echo message="clean         --> Remove all folders created by build script"/>
      <echo message="init          --> Clean and create build folders"/>
      <echo message=""/>
  </target>

  <!-- Clean Build and Report files -->
  <target name="clean">
    <!-- Remove all directories created during the build process -->
    <echo>[clean] Removing Build and Report directories</echo>
    <delete includeemptydirs="true" failonerror="false">
      <fileset dir="${report.loc}" defaultexcludes="false">
        <include name="**/*"/>
      </fileset>
      <fileset dir="${dist.loc}" defaultexcludes="false">
        <include name="**/*"/>
      </fileset>
    </delete>
    <echo>[clean] Build and Report directories removed</echo>
  </target>

  <!-- Create directories needed for the build process -->
  <target name="init" depends="clean">
    <echo>[init] Creating Bin and Report directories</echo>
    <mkdir dir="${bin.loc}"/>
    <mkdir dir="${report.loc}"/>
    <echo>[init] Bin and Report directories created</echo>
  </target>

  <!-- Compile Release SWC -->
  <target name="compile" depends="init">
    <echo>[compile] Compiling release SWC</echo>
    <echo>[compile] Using Flex SDK at: ${FLEX_HOME}</echo>
	<java jar="${FLEX_HOME}/lib/compc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
      <!-- Build our SWC with a versioned name. -->
      <arg value="-output=${bin.loc}/${project.name.versioned}.swc" />

      <!-- We want all the org package classes in the SWC being built. -->
      <arg value="-include-sources=${main.src.loc}/org" />

      <!-- Include classes from SWCs in this folder, but only the ones we use. -->
      <arg value="-library-path+=${lib.loc}" />

	  <!-- Keep the magic alive. -->
      <arg value="-keep-as3-metadata+=Inject" />
		<arg value="-keep-as3-metadata+=PostConstruct" />

	  <!-- Boolean mosh pit! -->
      <arg value="-incremental=true" />
      <arg value="-static-link-runtime-shared-libraries=true" />
      <arg value="-verbose-stacktraces=true" />
      <arg value="-headless-server=true" />
	</java>
    <echo>[compile] Release SWC ${project.name}-${swift.suspenders.version}.swc created successfully</echo>
  </target>

  <!-- Run Unit Tests -->
  <target name="test" depends="compile">
    <echo>[test] Running Unit Tests</echo>
    <!-- Compile TestRunner.mxml as a SWF -->
	<java jar="${FLEX_HOME}/lib/mxmlc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
      <arg value="${test.src.loc}/SwiftSuspendersTestRunner.as" />
      <arg value="-source-path=${main.src.loc}" />

	  <!-- Flash those sweet legs. Blink and you'll miss 'em. -->
      <arg value="-output=${bin.loc}/TestRunner.swf" />
      <arg value="-default-size=200,200" />
      <arg value="-default-background-color=0x000000" />

	  <!-- Keep the magic alive. -->
      <arg value="-keep-as3-metadata+=Inject" />
	  <arg value="-keep-as3-metadata+=PostConstruct" />

      <!-- Include classes from SWCs in this folder, but only the ones we use. -->
      <arg value="-library-path+=${lib.loc}" />

	  <!-- So true. -->
      <arg value="-incremental=true" />
      <arg value="-static-link-runtime-shared-libraries=true" />
      <arg value="-verbose-stacktraces=true" />
      <arg value="-headless-server=true" />
	</java>
    <!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
    <flexunit swf="bin/TestRunner.swf" toDir="${report.loc}" haltonfailure="true" verbose="true" localTrusted="true"/>
    <!-- Generate readable JUnit-style reports -->
    <junitreport todir="${report.loc}">
      <fileset dir="${report.loc}">
        <include name="TEST-*.xml"/>
      </fileset>
      <report format="frames" todir="${report.loc}/html"/>
    </junitreport>
    <echo>[test] Finished running Unit Tests</echo>
  </target>

  <!-- Build Documentation -->
  <target name="asdoc" depends="test">
    <echo>[create-docs] Generating ASDOC documentation</echo>
    <tstamp>
      <format property="docgen.time" pattern="MM/dd/yyyy hh:mm aa" unit="hour"/>
    </tstamp>

    <java jar="${FLEX_HOME}/lib/asdoc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
      <arg line="-external-library-path ${lib.loc}"/>
      <arg line="-doc-sources ${main.src.loc}"/>
      <arg line="-source-path ${main.src.loc}"/>
      <arg line="-output ${doc.loc}"/>
      <arg line="-footer 'SwiftSuspenders ${swift.suspenders.version} - Documentation generated at: ${docgen.time}'" />
      <arg line="-window-title 'SwiftSuspenders ${swift.suspenders.version}'"/>
      <arg line="-main-title 'SwiftSuspenders ${swift.suspenders.version}'"/>
	</java>
    <echo>[create-docs] ASDOC documentation generated successfully</echo>
  </target>

  <!-- Package the Build -->
  <target name="package" depends="test">
    <tstamp>
      <format property="touch.time" pattern="MM/dd/yyyy hh:mm aa" unit="hour"/>
    </tstamp>
    <!-- Assemble  -->
    <echo>[package] Packaging Release</echo>
    <mkdir dir="${dist.loc}"/>
    <mkdir dir="${dist.loc}/bin"/>
    <mkdir dir="${dist.loc}/src"/>
    <copy file="${bin.loc}/${project.name}-${swift.suspenders.version}.swc" todir="${dist.loc}/bin"/>
    <copy todir="${dist.loc}/src/org">
      <fileset dir="${main.src.loc}/org"/>
    </copy>
    <!-- Copy README  -->
    <copy file="${template.loc}/README.tmpl" tofile="${dist.loc}/README" overwrite="true">
      <filterchain>
        <replacetokens>
          <token key="date" value="${touch.time}"/>
          <token key="rlversion" value="${swift.suspenders.version}"/>
          <token key="releasename" value="${project.name}-${swift.suspenders.version}"/>
          <token key="ssversion" value="${swift.suspenders.version}"/>
          <token key="sslink" value="${swift.suspenders.link}"/>
          <token key="rlprojectlink" value="${robotlegs.project.link}"/>
          <token key="bestpracticeslink" value="${robotlegs.faq.link}"/>
          <token key="faqlink" value="${robotlegs.best.practices.link}"/>
        </replacetokens>
      </filterchain>
    </copy>
    <!-- Copy LICENSE  -->
    <copy file="LICENSE" tofile="${dist.loc}/LICENSE" overwrite="true"/>
    <!-- Zip It  -->
    <zip destfile="${dist.loc}/${project.name}-${swift.suspenders.version}.zip">
      <fileset dir="${dist.loc}"/>
    </zip>
    <!-- Clean Up  -->
    <delete file="${dist.loc}/${project.name}-${swift.suspenders.version}.swc"/>
    <delete file="${dist.loc}/README"/>
    <delete file="${dist.loc}/LICENSE"/>
    <delete dir="${dist.loc}/bin"/>
    <delete dir="${dist.loc}/src"/>
    <echo>[package] Release packaged successfully</echo>
  </target>

</project>


text:
import BoostBuild

t = BoostBuild.Tester(use_test_config=False)

t.write("jamroot.jam", """
exe hello.exe : hello.obj ;
obj hello.obj : hello.cpp : <variant>debug ;
obj hello.obj2 : hello.cpp : <variant>release ;
""")

t.write("hello.cpp", """
int main() {}
""")

t.run_build_system()

t.expect_addition("bin/$toolset/debug*/hello.exe")
t.expect_addition("bin/$toolset/debug*/hello.obj")
t.expect_addition("bin/$toolset/release*/hello.obj")

t.cleanup()


text:
var W3tc_Lightbox = {
    window: jQuery(window),
    container: null,
    options: null,

    create: function() {
        var me = this;

        this.container = jQuery('

Close window

').css({
            top: 0,
            left: 0,
            width: 0,
            height: 0,
            position: 'fixed',
            'z-index': 9991,
            display: 'none'
        });

        jQuery('#w3tc').append(this.container);
        me.resize();
        this.window.resize(function() {
            me.resize();
        });

        this.window.scroll(function() {
            me.resize();
        });

        this.container.find('.lightbox-close').click(function() {
            me.close();
        });
    },

    open: function(options) {
        this.options = jQuery.extend({
            width: 0,
            height: 0,
            maxWidth: 0,
            maxHeight: 0,
            minWidth: 0,
            minHeight: 0,
            widthPercent: 0.6,
            heightPercent: 0.8,
            content: null,
            url: null,
            callback: null
        }, options);

        this.create();
        this.resize();

        if (this.options.content) {
            this.content(this.options.content);
        } else if (this.options.url) {
            this.load(this.options.url, this.options.callback);
        }

        W3tc_Overlay.show();
        this.container.show();
    },

    close: function() {
        this.container.remove();
        W3tc_Overlay.hide();
    },

    resize: function() {
        var width = (this.options.width ? this.options.width : this.window.width() * this.options.widthPercent);
        var height = (this.options.height ? this.options.height : this.window.height() * this.options.heightPercent);

        if (this.options.maxWidth && width > this.options.maxWidth) {
            width = this.options.maxWidth;
        } else if (width < this.options.minWidth) {
            width = this.options.minWidth;
        }

        if (this.options.maxHeight && height > this.options.maxHeight) {
            height = this.options.maxHeight;
        } else if (height < this.options.minHeight) {
            height = this.options.minHeight;
        }

        this.container.css({
            top: (this.window.height() / 2 - this.container.outerHeight() / 2)>=0 ? this.window.height() / 2 - this.container.outerHeight() / 2 : 0,
            left: (this.window.width() / 2 - this.container.outerWidth() / 2)>=0 ? this.window.width()  / 2 - this.container.outerWidth()  / 2 : 0
        });

        this.container.css({
            width: width,
            height: height
        });

        jQuery('.lightbox-content', this.container).css({
            width: width,
            height: height
        });
    },

    load: function(url, callback) {
        this.content('');
        this.loading(true);
        var me = this;
        jQuery.get(url, {}, function(content) {
            me.loading(false);
            me.content(content);
            if (callback) {
                callback.call(this, me);
            }
        });
    },

    content: function(content) {
        return this.container.find('.lightbox-content').html(content);
    },

    width: function(width) {
        if (width === undefined) {
            return this.container.width();
        } else {
            this.container.css('width', width);
            return this.resize();
        }
    },

    height: function(height) {
        if (height === undefined) {
            return this.container.height();
        } else {
            this.container.css('height', height);
            return this.resize();
        }
    },

    loading: function(loading) {
        return (loading === undefined ? this.container.hasClass('lightbox-loader') : (loading ? this.container.addClass('lightbox-loader') : this.container.removeClass('lightbox-loader')));
    }
};

var W3tc_Overlay = {
    window: jQuery(window),
    container: null,

    create: function() {
        var me = this;

        this.container = jQuery('
').css({
            top: 0,
            left: 0,
            width: 0,
            height: 0,
            position: 'fixed',
            'z-index': 9990,
            display: 'none',
            opacity: 0.6
        });

        jQuery('#w3tc').append(this.container);

        this.window.resize(function() {
            me.resize();
        });

        this.window.scroll(function() {
            me.resize();
        });
    },

    show: function() {
        this.create();
        this.resize();
        this.container.show();
    },

    hide: function() {
        this.container.remove();
    },

    resize: function() {
        this.container.css({
            width: this.window.width(),
            height: this.window.height()
        });
    }
};

function w3tc_lightbox_support_us(nonce) {
    W3tc_Lightbox.open({
        width: 500,
        height: 200,
        url: 'admin.php?page=w3tc_dashboard&w3tc_support_us&_wpnonce=' + nonce
    });
}

var w3tc_minify_recommendations_checked = {};

function w3tc_lightbox_minify_recommendations(nonce) {
    W3tc_Lightbox.open({
        width: 1000,
        url: 'admin.php?page=w3tc_minify&w3tc_minify_recommendations&_wpnonce=' + nonce,
        callback: function(lightbox) {
            var theme = jQuery('#recom_theme').val();

            if (jQuery.ui && jQuery.ui.sortable) {
                jQuery("#recom_js_files,#recom_css_files").sortable({
                    axis: 'y',
                    stop: function() {
                        jQuery(this).find('li').each(function(index) {
                            jQuery(this).find('td:eq(1)').html((index + 1) + '.');
                        });
                    }
                });
            }

            if (w3tc_minify_recommendations_checked[theme] !== undefined) {
                jQuery('#recom_js_files :text,#recom_css_files :text').each(function() {
                    var hash = jQuery(this).parents('li').find('[name=recom_js_template]').val() + ':' + jQuery(this).val();

                    if (w3tc_minify_recommendations_checked[theme][hash] !== undefined) {
                        var checkbox = jQuery(this).parents('li').find(':checkbox');

                        if (w3tc_minify_recommendations_checked[theme][hash]) {
                            checkbox.attr('checked', 'checked');
                        } else {
                            checkbox.removeAttr('checked');
                        }
                    }
                });
            }

            jQuery('#recom_theme').change(function() {
                jQuery('#recom_js_files :checkbox,#recom_css_files :checkbox').each(function() {
                    var li = jQuery(this).parents('li');
                    var hash = li.find('[name=recom_js_template]').val() + ':' + li.find(':text').val();

                    if (w3tc_minify_recommendations_checked[theme] === undefined) {
                        w3tc_minify_recommendations_checked[theme] = {};
                    }

                    w3tc_minify_recommendations_checked[theme][hash] = jQuery(this).is(':checked');
                });

                lightbox.load('admin.php?page=w3tc_minify&w3tc_minify_recommendations&theme_key=' + jQuery(this).val() + '&_wpnonce=' + nonce, lightbox.options.callback);
            });

            jQuery('#recom_js_check').click(function() {
                if (jQuery('#recom_js_files :checkbox:checked').size()) {
                    jQuery('#recom_js_files :checkbox').removeAttr('checked');
                } else {
                    jQuery('#recom_js_files :checkbox').attr('checked', 'checked');
                }

                return false;
            });

            jQuery('#recom_css_check').click(function() {
                if (jQuery('#recom_css_files :checkbox:checked').size()) {
                    jQuery('#recom_css_files :checkbox').removeAttr('checked');
                } else {
                    jQuery('#recom_css_files :checkbox').attr('checked', 'checked');
                }

                return false;
            });

            jQuery('.recom_apply', lightbox.container).click(function() {
                var theme = jQuery('#recom_theme').val();

                jQuery('#js_files li').each(function() {
                    if (jQuery(this).find(':text').attr('name').indexOf('js_files[' + theme + ']') != -1) {
                        jQuery(this).remove();
                    }
                });

                jQuery('#css_files li').each(function() {
                    if (jQuery(this).find(':text').attr('name').indexOf('css_files[' + theme + ']') != -1) {
                        jQuery(this).remove();
                    }
                });

                jQuery('#recom_js_files li').each(function() {
                    if (jQuery(this).find(':checkbox:checked').size()) {
                        w3tc_minify_js_file_add(theme, jQuery(this).find('[name=recom_js_template]').val(), jQuery(this).find('[name=recom_js_location]').val(), jQuery(this).find('[name=recom_js_file]').val());
                    }
                });

                jQuery('#recom_css_files li').each(function() {
                    if (jQuery(this).find(':checkbox:checked').size()) {
                        w3tc_minify_css_file_add(theme, jQuery(this).find('[name=recom_css_template]').val(), jQuery(this).find('[name=recom_css_file]').val());
                    }
                });

                w3tc_minify_js_theme(theme);
                w3tc_minify_css_theme(theme);

                w3tc_input_enable('.js_enabled', jQuery('#minify_js_enable:checked').size());
                w3tc_input_enable('.css_enabled', jQuery('#minify_css_enable:checked').size());

                lightbox.close();
            });
        }
    });
}

function w3tc_lightbox_self_test(nonce) {
    W3tc_Lightbox.open({
        width: 800,
        minHeight: 300,
        url: 'admin.php?page=w3tc_dashboard&w3tc_self_test&_wpnonce=' + nonce,
        callback: function(lightbox) {
                jQuery('.button-primary', lightbox.container).click(function() {
                lightbox.close();
            });
        }
    });
}

function w3tc_lightbox_cdn_s3_bucket_location(type, nonce) {
    W3tc_Lightbox.open({
        width: 500,
        height: 130,
        url: 'admin.php?page=w3tc_dashboard&w3tc_cdn_s3_bucket_location&type=' + type + '&_wpnonce=' + nonce,
        callback: function(lightbox) {
            jQuery('.button', lightbox.container).click(function() {
                lightbox.close();
            });
        }
    });
}

function w3tc_lightbox_netdna_maxcdn_pull_zone(type, nonce) {
    W3tc_Lightbox.open({
        width: 500,
        height: 400,
        url: 'admin.php?page=w3tc_dashboard&w3tc_create_netdna_maxcdn_pull_zone_form&type=' + type + '&_wpnonce=' + nonce,
        callback: function(lightbox) {
            jQuery('#create_pull_zone', lightbox.container).click(function() {
                var loader = jQuery('#pull-zone-loading');
                loader.addClass('w3tc-loading');
                var pull_button = jQuery(this);
                pull_button.attr("disabled", "disabled");
                jQuery('.create-error').text('');
                var name_val = jQuery('#name', lightbox.container).val();
                var name_filter = /^[a-zA-Z\d\-]*$/;
                if (name_val == '') {
                    jQuery('#name', lightbox.container).addClass('w3tc-error');
                    jQuery('.name_message', lightbox.container).text('Cannot be empty.');
                } else if(name_val.length < 3) {
                    jQuery('#name', lightbox.container).addClass('w3tc-error');
                    jQuery('.name_message', lightbox.container).text('Too short.');
                } else if (name_val.length > 32) {
                    jQuery('#name', lightbox.container).addClass('w3tc-error');
                    jQuery('.name_message', lightbox.container).text('Too long.');
                } else if (!name_filter.test(name_val)) {
                    jQuery('#name', lightbox.container).addClass('w3tc-error');
                    jQuery('.name_message', lightbox.container).text('Cannot use unsupported characters.');
                } else {
                    jQuery('#name', lightbox.container).removeClass('w3tc-error');
                    jQuery('.name_message', lightbox.container).text('');
                }

                var label_val = jQuery('#label', lightbox.container).val();
                if (label_val == '') {
                    jQuery('#label', lightbox.container).addClass('w3tc-error');
                    jQuery('.label_message', lightbox.container).text('Cannot be empty.');
                } else if(label_val.length < 1) {
                    jQuery('#label', lightbox.container).addClass('w3tc-error');
                    jQuery('.label_message', lightbox.container).text('Too short.');
                } else if (label_val.length > 255) {
                    jQuery('#label', lightbox.container).addClass('w3tc-error');
                    jQuery('.label_message', lightbox.container).text('Too long.');
                } else {
                    jQuery('#label', lightbox.container).removeClass('w3tc-error');
                    jQuery('.label_message', lightbox.container).text('');
                }
                if (!jQuery('#label').hasClass('w3tc-error') && !jQuery('#name').hasClass('w3tc-error')) {
                    jQuery.post('admin.php?page=w3tc_dashboard&w3tc_create_netdna_maxcdn_pull_zone', {name:name_val, label: label_val, nonce: jQuery('#_wp_nonce').val(), type: type},function(data) {
                            loader.removeClass('w3tc-loading');
                            if (data['status'] == 'error') {
                                jQuery('.create-error').show();
                                jQuery('.create-error').html('
Something is wrong:
' + data['message'] + '
');
                                pull_button.removeAttr("disabled");
                            } else {
                                if (jQuery('#cdn_cnames > :first-child > :first-child').val() == '') {
                                    jQuery('#cdn_cnames > :first-child > :first-child').val(data['temporary_url']);
                                    jQuery('.netdna-maxcdn-form').html('
Pull zone was successfully created. Following url was added as default "Replace site\'s hostname with:" ' + data['temporary_url'] + '
');
                                } else {
                                    jQuery('.netdna-maxcdn-form').html('
Pull zone was successfully created. cnames were already set so "Replace site\'s hostname with:" were not replaced with ' + data['temporary_url'] + '
');
                                }
                            }
                        },
                    'json');
                } else {
                    loader.removeClass('w3tc-loading');
                    pull_button.removeAttr("disabled");
                }
            });
            jQuery('.button', lightbox.container).click(function() {
                lightbox.close();
            });
        }
    });
}
jQuery(function() {
    jQuery('.button-minify-recommendations').click(function() {
        var nonce = jQuery(this).metadata().nonce;
        w3tc_lightbox_minify_recommendations(nonce);
        return false;
    });

    jQuery('.button-self-test').click(function() {
        var nonce = jQuery(this).metadata().nonce;
        w3tc_lightbox_self_test(nonce);
        return false;
    });

    jQuery('.button-cdn-s3-bucket-location,.button-cdn-cf-bucket-location').click(function() {
        var type = '';
        var nonce = jQuery(this).metadata().nonce;

        if (jQuery(this).hasClass('cdn_s3')) {
            type = 's3';
        } else if (jQuery(this).hasClass('cdn_cf')) {
            type = 'cf';
        }

        w3tc_lightbox_cdn_s3_bucket_location(type, nonce);
        return false;
    });

    jQuery('#netdna-maxcdn-create-pull-zone').click(function() {
        var type = jQuery(this).metadata().type;
        var nonce = jQuery(this).metadata().nonce;
        w3tc_lightbox_netdna_maxcdn_pull_zone(type, nonce);
        return false;
    });
});


text:
<?php

/**
 * Base class for creating test cases.
 *
 * @package CIUnit
 * @subpackage Core
 * @author Agop Seropyan <agopseropyan@gmail.com>
 * @copyright 2012, Agop Seropyan <agopseropyan@gmail.com>
 * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause
 *          License
 * @since File available since Release 1.0.0
 */
abstract class CIUnit_Framework_TestCase extends CIUnit_Framework_Assert implements
        CIUnit_Framework_TestInterface
{

    private $result;

    private $name = null;

    private $class = null;

    private $numberOfAssertions = 0;

    private $status;

    private $statusMessage;

    private $expectedException = NULL;

    private $expectedExceptionMessage = NULL;

    private $expectedExceptionCode = NULL;

    /**
     *
     * @param string $name
     */
    public function __construct ($name = NULL)
    {
        if (NULL !== $name) {
            $this->name = $name;
        }
        else {
            $name = new ReflectionClass($this);
            $this->name = $name->getName();
        }
    }

    public function get_instance()
    {
        return $ci =& get_instance();
    }
    /**
     * Runs the test case and collects the results in a TestResult object.
     * If no TestResult object is passed a new one will be created.
     *
     * @see CIUnit_Framework_Test::run()
     */
    public function run (CIUnit_Framework_TestResult $result = NULL)
    {
        // Check for existing result object and create new if current is NULL
        if (NULL == $result) {
            $result = $this->createResult();
        }

        if (! $this instanceof CIUnit_Framework_TestWarning) {
            $this->result = $result;
        }

        // check for any dependencies ???

        $result->run($this);

        $this->result = NULL;

        return $result;
    }

    /**
     * Runs a test sequence
     *
     * @throws Exception
     * @since version 1.0.0
     */
    public function runTestSequence ()
    {
        $this->numberOfAssertions = 0;

        try {
            // Run setup
            $this->setUp();

            // Run test
            $this->result = $this->runtest();

            $this->status = 0; // Passed
        }        // Catch for incomplete test
        catch (CIUnit_Framework_Exception_IncompleteTest $e) {
            $this->status = 2; // Incomplete
            $this->statusMessage = $e->getMessage();
        }

        // Catch for skipped test
        catch (CIUnit_Framework_Exception_SkippedTest $e) {
            $this->status = 1; // Skipped
            $this->statusMessage = $e->getMessage();
        }

        // Catch for Assertion Failure
        catch (CIUnit_Framework_Exception_AssertionFailed $e) {
            $this->status = 3; // Failure
            $this->statusMessage = $e->getMessage();
        }        // Catch for Error
        catch (Exception $e) {
            $this->status = 4; // Error
            $this->statusMessage = $e->getMessage();
        }

        // revert fictures
        try {
            $this->tearDown();
        }        // catch any errors
        catch (Exception $error) {
            if (! isset($e))
                $e = $error;
        }

        // If there is exception caught throw it
        if (isset($e))
            throw $e;
    }

    /**
     * Override to run the test and assert its state.
     *
     * @since version 1.0.0
     */
    protected function runTest ()
    {

        // Check if test case has name, if not throw
        // CIUnit_Framework_Exception_CIUnitException
        if (NULL === $this->name) {
            throw new CIUnit_Framework_Exception_CIUnitException(
                    'name must not be null');
        }

        // Try to create new refection of this class and assign method
        try {

            $class = new ReflectionClass($this);
            $method = $class->getMethod($this->getName());
        } catch (ReflectionException $e) {
            $this->fail($e->getMessage());
        }

        // invoke method through reflection invokeArgs
        $testResult = NULL;
        try {
            $testResult = $method->invokeArgs($this, array());
            // $this->AddAssertionCount(CIUnit_Framework_Assert::getAssertionCount());
        }        // catch exception if thrown
        catch (Exception $e) {
            $check = FALSE;

            if (is_string($this->expectedException)) {
                $check = TRUE;

                if ($e instanceof CIUnit_Framework_Exception_CIUnitException) {
                    $check = FALSE;
                }

                $exceptionReflector = new ReflectionClass(
                        $this->expectedException);
                if ($exceptionReflector->isSubclassOf(
                        'CIUnit_Framework_Exception_CIUnitException') ||
                         $this->expectedException ==
                         'CIUnit_Framework_Exception_CIUnitException') {
                    $check = TRUE;
                }
            }

            if (TRUE == $check) {

                $constraint = new CIUnit_Framework_Constraint_Exception($this->expectedException);
                $this->assertThat($e, $constraint);

                if(NULL != $this->expectedExceptionMessage) {
                    $messageConstraint = new CIUnit_Framework_Constraint_ExceptionMessage($this->expectedExceptionMessage);
                    $this->assertThat($e->getMessage(), $messageConstraint);
                }

                if(NULL != $this->expectedExceptionCode) {
                    $codeConstraint = new CIUnit_Framework_Constraint_ExceptionCode($this->expectedExceptionCode);
                    $this->assertThat($e->getCode(), $codeConstraint);
                }
            } else {
                throw $e;
            }
        }

        // return test result

        return $testResult;
    }

    private function createResult ()
    {
        return new CIUnit_Framework_TestResult();
    }

    public function getName ()
    {
        if ($this->name instanceof ReflectionMethod) {
            return $this->name->getName();
        }

        return $this->name;
    }

    public function setName ($name)
    {
        $this->name = $name;
    }

    public function setClass ($class)
    {
        $this->class = $class;
    }

    public function getClass ()
    {
        return $this->class;
    }

    public function count ()
    {
        return 1;
    }

    public function AddAssertionCount ($count)
    {
        $this->numberOfAssertions += $count;
    }

    public function getNumberOfAssertions ()
    {
        return $this->numberOfAssertions;
    }

    /**
     *
     * @return string
     * @since version 1.0.0
     */
    public function getExpectedException ()
    {
        return $this->expectedException;
    }

    /**
     *
     * @param mixed $name
     * @param string $message
     * @param integer $code
     * @since version 1.0.0
     */
    public function setExpectedException ($name, $message = NULL, $code = NULL)
    {
        $this->expectedException = $name;
        $this->expectedExceptionMessage = $message;
        $this->expectedExceptionCode = $code;
    }

    public function getResult ()
    {
        return $this->result;
    }

    public function toString ()
    {
        $class = new ReflectionClass($this);

        $buffer = sprintf('%s::%s',

        $class->name, $this->getName());

        return $buffer;
    }

    /**
     * This method is called before each test method
     *
     * @since version 1.0.0
     */
    protected function setUp ()
    {}

    /**
     * This method is called after each test method
     *
     * @since version 1.0.0
     */
    protected function tearDown ()
    {}
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">

    <title>Sending Notifications to a Microsoft Teams channel
</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="FAKE - F# Make">
    <meta name="author" content="Steffen Forkmann, Mauricio Scheffer, Colin Bull">

    <link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
    <link type="text/css" rel="stylesheet" href="content/style.css" />

fsharp.org

github page

FAKE - F# Make

Sending Notifications to a Microsoft Teams channel

In this article you will learn how to create a Office 365 webhook integration on a MS Teams channel and send a notification to it. This article assumes that you already have a Microsoft Teams team and channel setup.

Adding a Webhook Integration to a Channel

Follow the instructions for setting up a webhook connector to your channel. When finished, you should have a Webhook URL that looks like "https://outlook.office.com/webhook/some-random-text/IncomingWebhook/some/random/text".

Sending a Notification to the Webhook

 1:
 2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:

// The webhook URL from the integration you set up
let webhookUrl = "https://outlook.office.com/webhook/some-random-text/IncomingWebhook/some/random/text"

let imageUrl = sprintf "https://connectorsdemo.azurewebsites.net/images/%s"

let notification p =
    { p with
        Summary = Some "Max Muster ran a build"
        Title = Some "Sample Project"
        Sections =
           [ { SectionDefaults with
                 ActivityTitle = Some "Max Muster"
                 ActivitySubtitle = Some "on Sample Project"
                 ActivityText = Some "Build successful!"
                 ActivityImage =
                    imageUrl "MSC12_Oscar_002.jpg"
                    |> ImageUri.FromUrl
                    |> Some
             }
             { SectionDefaults with
                 Title = Some "Details"
                 Facts = [ { Name = "Labels"; Value = "FOO, BAR" }
                           { Name = "Version"; Value = "1.0.0" }
                           { Name = "Trello Id"; Value = "1101" } ]
             }
           ]
        PotentialActions =
           [
             {
               Name = "View in Trello"
               Target = System.Uri("https://trello.com/c/1101/")
             }
           ]
    }

Office365Notification webhookUrl notification |> ignore

The result should look something like this:

For additional information on the parameters, check out the Office 356 Connectors API Reference

val webhookUrl : string

Full name: msteamsnotification.webhookUrl

val imageUrl : (string -> string)

Full name: msteamsnotification.imageUrl

val sprintf : format:Printf.StringFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.sprintf

val notification : p:'a -> 'a

Full name: msteamsnotification.notification

val p : 'a

union case Option.Some: Value: 'T -> Option<'T>

namespace System

Multiple items
type Uri =
  new : uriString:string -> Uri + 5 overloads
  member AbsolutePath : string
  member AbsoluteUri : string
  member Authority : string
  member DnsSafeHost : string
  member Equals : comparand:obj -> bool
  member Fragment : string
  member GetComponents : components:UriComponents * format:UriFormat -> string
  member GetHashCode : unit -> int
  member GetLeftPart : part:UriPartial -> string
  ...

Full name: System.Uri

--------------------
System.Uri(uriString: string) : unit
System.Uri(uriString: string, uriKind: System.UriKind) : unit
System.Uri(baseUri: System.Uri, relativeUri: string) : unit
System.Uri(baseUri: System.Uri, relativeUri: System.Uri) : unit

val ignore : value:'T -> unit

Full name: Microsoft.FSharp.Core.Operators.ignore

FAKE - F# Make

Home page

Get FAKE via NuGet

Source Code on GitHub

License (Apache 2)

Release Notes

Contributing to FAKE

Who is using FAKE?

Ask a question

Tutorials

Getting started

Build script caching

NuGet package restore

Using FxCop in a build

Generating AssemblyInfo

Create NuGet packages

Running specific targets

Running FAKE from command line

Running targets in parallel

Using the F# compiler from FAKE

Creating custom tasks

Soft dependencies

TeamCity integration

Running canopy tests

Octopus Deploy

TypeScript support

Azure WebJobs support

Azure Cloud Services support

SQL DACPAC support

FluentMigrator support

Android publisher

File Watcher

WiX Setup Generation

Using Chocolatey

Using Slack

Using Microsoft Teams

Using SonarQube

Fake.Deploy

Fake.IIS

Reference

API Reference


text:
package com.twitter.elephantbird.crunch;

import com.google.protobuf.Message;
import org.apache.crunch.io.impl.ReadableSourceTargetImpl;
import org.apache.crunch.types.PType;
import org.apache.hadoop.fs.Path;

/**
 * A Crunch {@code SourceTarget} for writing files out using a
 * {@link com.twitter.elephantbird.mapreduce.output.LzoProtobufBlockOutputFormat} and then reading them back with a
 * {@link com.twitter.elephantbird.mapreduce.input.LzoProtobufBlockInputFormat}.
 */
public class LzoProtobufSourceTarget<T extends Message> extends ReadableSourceTargetImpl<T> {

  /**
   * Factory method for creating a new {@code LzoProtobufSourceTarget} from a given path and protocol buffer
   * message class.
   *
   * @param path path to the data
   * @param protoClass the Message class to read
   * @return a new {@code LzoProtobufSourceTarget}
   */
  public static <S extends Message> LzoProtobufSourceTarget<S> at(Path path, Class<S> protoClass) {
    return new LzoProtobufSourceTarget<S>(path, EBTypes.protos(protoClass));
  }

  public LzoProtobufSourceTarget(Path path, PType<T> ptype) {
    super(new LzoProtobufSource<T>(path, ptype), new LzoProtobufTarget(path));
  }
}