text:
.class abstract Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;
.super Lcom/android/server/display/DisplayDevice;
.source "OverlayDisplayAdapter.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/server/display/OverlayDisplayAdapter;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x402
    name = "OverlayDisplayDevice"
.end annotation

# instance fields
.field private mActiveMode:I

.field private final mDefaultMode:I

.field private final mDisplayPresentationDeadlineNanos:J

.field private mInfo:Lcom/android/server/display/DisplayDeviceInfo;

.field private final mModes:[Landroid/view/Display$Mode;

.field private final mName:Ljava/lang/String;

.field private final mRawModes:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Lcom/android/server/display/OverlayDisplayAdapter$OverlayMode;",
            ">;"
        }
    .end annotation
.end field

.field private final mRefreshRate:F

.field private final mSecure:Z

.field private mState:I

.field private mSurface:Landroid/view/Surface;

.field private mSurfaceTexture:Landroid/graphics/SurfaceTexture;

.field final synthetic this$0:Lcom/android/server/display/OverlayDisplayAdapter;

# direct methods
.method public constructor <init>(Lcom/android/server/display/OverlayDisplayAdapter;Landroid/os/IBinder;Ljava/lang/String;Ljava/util/List;IIFJZILandroid/graphics/SurfaceTexture;I)V
    .locals 6
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/os/IBinder;",
            "Ljava/lang/String;",
            "Ljava/util/List",
            "<",
            "Lcom/android/server/display/OverlayDisplayAdapter$OverlayMode;",
            ">;IIFJZI",
            "Landroid/graphics/SurfaceTexture;",
            "I)V"
        }
    .end annotation

    iput-object p1, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->this$0:Lcom/android/server/display/OverlayDisplayAdapter;

    new-instance v3, Ljava/lang/StringBuilder;

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

    const-string/jumbo v4, "overlay:"

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

    move-result-object v3

    move/from16 v0, p13

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

    move-result-object v3

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

    move-result-object v3

    invoke-direct {p0, p1, p2, v3}, Lcom/android/server/display/DisplayDevice;-><init>(Lcom/android/server/display/DisplayAdapter;Landroid/os/IBinder;Ljava/lang/String;)V

    iput-object p3, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mName:Ljava/lang/String;

    iput p7, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mRefreshRate:F

    iput-wide p8, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mDisplayPresentationDeadlineNanos:J

    move/from16 v0, p10

    iput-boolean v0, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mSecure:Z

    move/from16 v0, p11

    iput v0, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mState:I

    move-object/from16 v0, p12

    iput-object v0, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mSurfaceTexture:Landroid/graphics/SurfaceTexture;

    iput-object p4, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mRawModes:Ljava/util/List;

    invoke-interface {p4}, Ljava/util/List;->size()I

    move-result v3

    new-array v3, v3, [Landroid/view/Display$Mode;

    iput-object v3, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mModes:[Landroid/view/Display$Mode;

    const/4 v1, 0x0

    :goto_0
    invoke-interface {p4}, Ljava/util/List;->size()I

    move-result v3

    if-ge v1, v3, :cond_0

    invoke-interface {p4, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/android/server/display/OverlayDisplayAdapter$OverlayMode;

    iget-object v3, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mModes:[Landroid/view/Display$Mode;

    iget v4, v2, Lcom/android/server/display/OverlayDisplayAdapter$OverlayMode;->mWidth:I

    iget v5, v2, Lcom/android/server/display/OverlayDisplayAdapter$OverlayMode;->mHeight:I

    invoke-static {v4, v5, p7}, Lcom/android/server/display/OverlayDisplayAdapter;->createMode(IIF)Landroid/view/Display$Mode;

    move-result-object v4

    aput-object v4, v3, v1

    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_0
    iput p5, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mActiveMode:I

    iput p6, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mDefaultMode:I

    return-void
.end method

# virtual methods
.method public destroyLocked()V
    .locals 2

    const/4 v1, 0x0

    iput-object v1, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mSurfaceTexture:Landroid/graphics/SurfaceTexture;

    iget-object v0, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mSurface:Landroid/view/Surface;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mSurface:Landroid/view/Surface;

    invoke-virtual {v0}, Landroid/view/Surface;->release()V

    iput-object v1, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mSurface:Landroid/view/Surface;

    :cond_0
    invoke-virtual {p0}, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->getDisplayTokenLocked()Landroid/os/IBinder;

    move-result-object v0

    invoke-static {v0}, Landroid/view/SurfaceControl;->destroyDisplay(Landroid/os/IBinder;)V

    return-void
.end method

.method public getDisplayDeviceInfoLocked()Lcom/android/server/display/DisplayDeviceInfo;
    .locals 11

    const/4 v10, 0x0

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    if-nez v2, :cond_1

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mModes:[Landroid/view/Display$Mode;

    iget v3, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mActiveMode:I

    aget-object v0, v2, v3

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mRawModes:Ljava/util/List;

    iget v3, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mActiveMode:I

    invoke-interface {v2, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/android/server/display/OverlayDisplayAdapter$OverlayMode;

    new-instance v2, Lcom/android/server/display/DisplayDeviceInfo;

    invoke-direct {v2}, Lcom/android/server/display/DisplayDeviceInfo;-><init>()V

    iput-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    iget-object v3, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mName:Ljava/lang/String;

    iput-object v3, v2, Lcom/android/server/display/DisplayDeviceInfo;->name:Ljava/lang/String;

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    invoke-virtual {p0}, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->getUniqueId()Ljava/lang/String;

    move-result-object v3

    iput-object v3, v2, Lcom/android/server/display/DisplayDeviceInfo;->uniqueId:Ljava/lang/String;

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    invoke-virtual {v0}, Landroid/view/Display$Mode;->getPhysicalWidth()I

    move-result v3

    iput v3, v2, Lcom/android/server/display/DisplayDeviceInfo;->width:I

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    invoke-virtual {v0}, Landroid/view/Display$Mode;->getPhysicalHeight()I

    move-result v3

    iput v3, v2, Lcom/android/server/display/DisplayDeviceInfo;->height:I

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    invoke-virtual {v0}, Landroid/view/Display$Mode;->getModeId()I

    move-result v3

    iput v3, v2, Lcom/android/server/display/DisplayDeviceInfo;->modeId:I

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    iget-object v3, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mModes:[Landroid/view/Display$Mode;

    aget-object v3, v3, v10

    invoke-virtual {v3}, Landroid/view/Display$Mode;->getModeId()I

    move-result v3

    iput v3, v2, Lcom/android/server/display/DisplayDeviceInfo;->defaultModeId:I

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    iget-object v3, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mModes:[Landroid/view/Display$Mode;

    iput-object v3, v2, Lcom/android/server/display/DisplayDeviceInfo;->supportedModes:[Landroid/view/Display$Mode;

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    iget v3, v1, Lcom/android/server/display/OverlayDisplayAdapter$OverlayMode;->mDensityDpi:I

    iput v3, v2, Lcom/android/server/display/DisplayDeviceInfo;->densityDpi:I

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    iget v3, v1, Lcom/android/server/display/OverlayDisplayAdapter$OverlayMode;->mDensityDpi:I

    int-to-float v3, v3

    iput v3, v2, Lcom/android/server/display/DisplayDeviceInfo;->xDpi:F

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    iget v3, v1, Lcom/android/server/display/OverlayDisplayAdapter$OverlayMode;->mDensityDpi:I

    int-to-float v3, v3

    iput v3, v2, Lcom/android/server/display/DisplayDeviceInfo;->yDpi:F

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    iget-wide v4, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mDisplayPresentationDeadlineNanos:J

    iget v3, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mRefreshRate:F

    float-to-int v3, v3

    int-to-long v6, v3

    const-wide/32 v8, 0x3b9aca00

    div-long v6, v8, v6

    add-long/2addr v4, v6

    iput-wide v4, v2, Lcom/android/server/display/DisplayDeviceInfo;->presentationDeadlineNanos:J

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    const/16 v3, 0x40

    iput v3, v2, Lcom/android/server/display/DisplayDeviceInfo;->flags:I

    iget-boolean v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mSecure:Z

    if-eqz v2, :cond_0

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    iget v3, v2, Lcom/android/server/display/DisplayDeviceInfo;->flags:I

    or-int/lit8 v3, v3, 0x4

    iput v3, v2, Lcom/android/server/display/DisplayDeviceInfo;->flags:I

    :cond_0
    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    const/4 v3, 0x4

    iput v3, v2, Lcom/android/server/display/DisplayDeviceInfo;->type:I

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    iput v10, v2, Lcom/android/server/display/DisplayDeviceInfo;->touch:I

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    iget v3, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mState:I

    iput v3, v2, Lcom/android/server/display/DisplayDeviceInfo;->state:I

    :cond_1
    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    return-object v2
.end method

.method public hasStableUniqueId()Z
    .locals 1

    const/4 v0, 0x0

    return v0
.end method

.method public abstract onModeChangedLocked(I)V
.end method

.method public performTraversalInTransactionLocked()V
    .locals 2

    iget-object v0, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mSurfaceTexture:Landroid/graphics/SurfaceTexture;

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mSurface:Landroid/view/Surface;

    if-nez v0, :cond_0

    new-instance v0, Landroid/view/Surface;

    iget-object v1, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mSurfaceTexture:Landroid/graphics/SurfaceTexture;

    invoke-direct {v0, v1}, Landroid/view/Surface;-><init>(Landroid/graphics/SurfaceTexture;)V

    iput-object v0, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mSurface:Landroid/view/Surface;

    :cond_0
    iget-object v0, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mSurface:Landroid/view/Surface;

    invoke-virtual {p0, v0}, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->setSurfaceInTransactionLocked(Landroid/view/Surface;)V

    :cond_1
    return-void
.end method

.method public requestDisplayModesInTransactionLocked(II)V
    .locals 5

    const/4 v1, -0x1

    if-nez p2, :cond_2

    const/4 v1, 0x0

    :cond_0
    :goto_0
    const/4 v2, -0x1

    if-ne v1, v2, :cond_1

    const-string/jumbo v2, "OverlayDisplayAdapter"

    new-instance v3, Ljava/lang/StringBuilder;

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

    const-string/jumbo v4, "Unable to locate mode "

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

    move-result-object v3

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

    move-result-object v3

    const-string/jumbo v4, ", reverting to default."

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

    move-result-object v3

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

    move-result-object v3

    invoke-static {v2, v3}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I

    iget v1, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mDefaultMode:I

    :cond_1
    iget v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mActiveMode:I

    if-ne v2, v1, :cond_4

    return-void

    :cond_2
    const/4 v0, 0x0

    :goto_1
    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mModes:[Landroid/view/Display$Mode;

    array-length v2, v2

    if-ge v0, v2, :cond_0

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mModes:[Landroid/view/Display$Mode;

    aget-object v2, v2, v0

    invoke-virtual {v2}, Landroid/view/Display$Mode;->getModeId()I

    move-result v2

    if-ne v2, p2, :cond_3

    move v1, v0

    goto :goto_0

    :cond_3
    add-int/lit8 v0, v0, 0x1

    goto :goto_1

    :cond_4
    iput v1, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mActiveMode:I

    const/4 v2, 0x0

    iput-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    iget-object v2, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->this$0:Lcom/android/server/display/OverlayDisplayAdapter;

    const/4 v3, 0x2

    invoke-virtual {v2, p0, v3}, Lcom/android/server/display/OverlayDisplayAdapter;->sendDisplayDeviceEventLocked(Lcom/android/server/display/DisplayDevice;I)V

    invoke-virtual {p0, v1}, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->onModeChangedLocked(I)V

    return-void
.end method

.method public setStateLocked(I)V
    .locals 1

    iput p1, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mState:I

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/android/server/display/OverlayDisplayAdapter$OverlayDisplayDevice;->mInfo:Lcom/android/server/display/DisplayDeviceInfo;

    return-void
.end method


text:
@implementation TLVideoMetadata

#pragma mark - Constructors

- (id)initWithDictionary:(NSDictionary*)dict
{
    self = [super init];
    if (self) {
        [self setAttributesWithDictionary:dict];
    }
    return self;
}

#pragma mark - Setters

- (void)setAttributesWithDictionary:(NSDictionary*)dict
{
    if (dict[@"width"] && [dict[@"width"] isKindOfClass:[NSNumber class]]) self.width = [dict[@"width"] doubleValue];
    if (dict[@"height"] && [dict[@"height"] isKindOfClass:[NSNumber class]]) self.height = [dict[@"height"] doubleValue];
    if (dict[@"framerate"] && [dict[@"framerate"] isKindOfClass:[NSNumber class]]) self.frameRate = [dict[@"framerate"] doubleValue];
    if (dict[@"video_bitrate"] && [dict[@"video_bitrate"] isKindOfClass:[NSNumber class]]) self.videoBitRate = [dict[@"video_bitrate"] doubleValue];
    if (dict[@"video_codec"]) self.videoCodec = dict[@"video_codec"];
    if (dict[@"audio_bitrate"] && [dict[@"audio_bitrate"] isKindOfClass:[NSNumber class]]) self.audioBitRate = [dict[@"audio_bitrate"] doubleValue];
    if (dict[@"audio_samplerate"] && [dict[@"audio_samplerate"] isKindOfClass:[NSNumber class]]) self.audioSampleRate = [dict[@"audio_samplerate"] doubleValue];
    if (dict[@"audio_channels"] && [dict[@"audio_channels"] isKindOfClass:[NSNumber class]]) self.audioChannels = [dict[@"audio_channels"] doubleValue];
    if (dict[@"audio_codec"]) self.audioCodec = dict[@"audio_codec"];
    if (dict[@"seekable"] && [dict[@"seekable"] isKindOfClass:[NSNumber class]]) self.seekable = [dict[@"seekable"] boolValue];
    if (dict[@"date_recorded"]) self.dateRecorded = [NSDate dateFromTransloaditString:dict[@"date_recorded"]];
    if (dict[@"date_file_created"]) self.dateFileCreated = [NSDate dateFromTransloaditString:dict[@"date_file_created"]];
    if (dict[@"date_file_modified"]) self.dateFileModified = [NSDate dateFromTransloaditString:dict[@"date_file_modified"]];
    if (dict[@"device_name"]) self.deviceName = dict[@"device_name"];
    if (dict[@"device_vendor"]) self.deviceName = dict[@"device_vendor"];
    if (dict[@"device_software"]) self.deviceName = dict[@"device_software"];
    if ((dict[@"latitude"] && [dict[@"latitude"] isKindOfClass:[NSNumber class]]) &&
        (dict[@"longitude"] && [dict[@"longitude"] isKindOfClass:[NSNumber class]])) {
        double longitude = [dict[@"longitude"] doubleValue];
        double latitude = [dict[@"latitude"] doubleValue];
        self.coordinates = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude];
    }

    if (dict[@"device_name"]) self.deviceName = dict[@"device_name"];

}

@end

redpajama_set_name: RedPajamaGithub


text:
/** Contiene las funcionalidades necesarias para el la gestión de diálogos
 * para la solicitud del PIN de una tarjeta, la confirmación de operaciones de firma y en general
 * la información al usuario. */
package es.gob.jmulticard.ui.passwordcallback;


text:
""" Needed Tests

    Component.draw_border() tests
    --------------------
        DONE *. draw_border output should match a similar draw_rect output
"""

import nose
import unittest

from numpy import array, alltrue, ravel

# Chaco imports
from chaco.api import Plot, PlotGraphicsContext

class DrawBorderTestCase(unittest.TestCase):
    def assertRavelEqual(self, x, y):
        self.assert_(alltrue(ravel(x) == ravel(y)), "\n%s\n !=\n%s" % (x, y))

    def test_draw_border_simple(self):
        """ Borders should have the correct height and width.
        """
        size = (5,5)
        container = Plot(padding=1, border_visible=True)
        container.outer_bounds = list(size)
        gc = PlotGraphicsContext(size)
        gc.render_component(container)

        desired = array(((255, 255, 255, 255, 255, 255),
                         (255, 255, 255, 255, 255, 255),
                         (255,   0,   0,   0, 255, 255),
                         (255,   0, 255,   0, 255, 255),
                         (255,   0,   0,   0, 255, 255),
                         (255, 255, 255, 255, 255, 255)))

        actual = gc.bmp_array[:,:,0]
        self.assertRavelEqual(actual, desired)

if __name__ == "__main__":
    unittest.main()


text:
/**
 *
 */
package aho.util.mysql2PHP2Java;

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

import aho.util.mysql2PHP2Java.exceptions.DatabaseWasNotFoundException;
import aho.util.mysql2PHP2Java.exceptions.InvalidPasswordException;
import aho.util.mysql2PHP2Java.exceptions.InvalidStateException;
import aho.util.mysql2PHP2Java.exceptions.NoCommandSpecifiedException;

/**
 * @author Adam Hlavacek
 *
 */
public class MySQL2PHP2Java {
    /*
     * Server can return this states:
     */
    public static final int STATE_OK = 0; // Everything was in normal
    public static final int STATE_DATABASE_NOT_FOUND = 1; // Database was not found
    public static final int STATE_NO_COMMAND_SPECIFIED = 2; // No command was specified
    public static final int STATE_WRONG_PASSWORD = 3; // Password used to connect to the script is invalid
    public static final int STATE_TEST_CON_PHP = 4; // Connection to the PHP script was successful
    public static final int STATE_TEST_CON_MySQL = 5; // Connection to the MySQL was successful
    public static final int STATE_INVALID = 255; // Returned state is not known

    private String url; // URL of PHP script
    private String password; // Password used to connect with

    private MySQLRespond last = null; // Respond from last SQL execution

    /**
     * Creates a new bridge on specified URL
     *
     * @param url
     *            URL of PHP script on server
     */
    public MySQL2PHP2Java(String url) {
	this.url = url;
	this.password = "";
    }

    /**
     * Creates a new bridge on specified URL
     *
     * @param url
     *            URL of PHP script on server
     * @param password
     *            Password used to connect to the PHP script
     */
    public MySQL2PHP2Java(String url, String password) {
	this.url = url;
	this.password = password;
    }

    /**
     * Executes SQL command to MySQL database by PHP script and saves it as last().
     *
     * @param sqlcommand
     *            command to execute
     * @return MySQL respond for this command
     * @throws DatabaseWasNotFoundException
     * @throws InvalidPasswordException
     * @throws InvalidStateException
     * @throws NoCommandSpecifiedException
     * @throws IOException
     */
    public MySQLRespond executeSQL(String sqlcommand)
	    throws DatabaseWasNotFoundException, InvalidPasswordException, InvalidStateException, NoCommandSpecifiedException, IOException {
	String[] parameters = { "sql=" + sqlcommand + "" };
	String whereString = null; // Part of SQL command after word WHERE
	if (sqlcommand.toUpperCase().contains("WHERE")) {
	    int whereIdex = sqlcommand.toUpperCase().indexOf(" WHERE ");
	    whereString = sqlcommand.substring(whereIdex + 7);
	}
	return last = new MySQLRespond(executeScript(parameters), this, whereString);
    }

    /**
     * Returns respond from last SQL execution
     *
     * @return respond from last SQL execution
     */
    public MySQLRespond last() {
	return last;
    }

    /**
     * Tests connection to PHP script.
     *
     * @return true if server returned STATE_TEST_CON_PHP state, false otherwise.
     */
    public boolean testConn2PHPScript() {
	try {
	    final String[] parameters = { "testing=testPHP" };
	    switch (getReturnCode(executeScript(parameters))) {
	    case STATE_WRONG_PASSWORD:
		throw new InvalidPasswordException("PHP script refuges this password");
	    case STATE_TEST_CON_PHP:
		return true;
	    default:
		return false;
	    }
	} catch (Exception e) {
	    StringWriter sw = new StringWriter();
	    PrintWriter pw = new PrintWriter(sw);
	    e.printStackTrace(pw);
	    System.err.println(sw.toString());
	    return false;
	}
    }

    /**
     * Tests connection to MySQL.
     *
     * @return true if server returned STATE_TEST_CON_MySQL state, false otherwise.
     */
    public boolean testConn2MySQL() {
	try {
	    final String[] parameters = { "testing=testMySQL" };
	    switch (getReturnCode(executeScript(parameters))) {
	    case STATE_WRONG_PASSWORD:
		throw new InvalidPasswordException("PHP script refuges this password");
	    case STATE_DATABASE_NOT_FOUND:
		throw new DatabaseWasNotFoundException("Database was not found");
	    case STATE_TEST_CON_MySQL:
		return true;
	    default:
		return false;
	    }
	} catch (Exception e) {
	    StringWriter sw = new StringWriter();
	    PrintWriter pw = new PrintWriter(sw);
	    e.printStackTrace(pw);
	    System.err.println(sw.toString());
	    return false;
	}
    }

    /**
     * Tests connection to PHP script and MySQL database
     *
     * @return true if both works, false otherwise
     */
    public boolean testConn() {
	if (testConn2PHPScript())
	    return testConn2MySQL();
	return false;
    }

    /**
     * Sends request to the PHP script with given parameters. Password is not need to be given, it is added by
     * function itself.
     *
     * @param PHPParameters
     *            Parameters used to send to the PHP script
     * @throws IOException
     */
    private String executeScript(final String[] PHPParameters) throws IOException {
	String parameters = "p=" + password + "&";
	for (String param : PHPParameters)
	    parameters += param + "&";

	StringBuilder response = new StringBuilder();

	byte[] postData = parameters.getBytes(StandardCharsets.UTF_8);
	int postDataLength = postData.length;

	URL obj = new URL(url);
	HttpURLConnection con = (HttpURLConnection) obj.openConnection();

	con.setDoOutput(true);
	con.setInstanceFollowRedirects(false);

	con.setRequestMethod("POST");

	con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
	con.setRequestProperty("charset", "utf-8");
	con.setRequestProperty("Content-Length", Integer.toString(postDataLength));
	con.setUseCaches(false);

	DataOutputStream wr = new DataOutputStream(con.getOutputStream());
	wr.write(postData);

	BufferedReader in = null;
	try {
	    in = new BufferedReader(new InputStreamReader(con.getInputStream()));
	} catch (java.io.FileNotFoundException e) {
	    /*
	     * We need to change this, because default print is with parameters and that means it would print
	     * our password to the console
	     */
	    throw new java.io.FileNotFoundException("Script on adress " + this.url + " was not found");
	}
	String inputLine;

	while ((inputLine = in.readLine()) != null) {
	    response.append(inputLine);
	}

	return response.toString();
	// Response contains metadata about encoding, we should exclude them
	// return response.substring(response.indexOf("/>") + 2);
    }

    /**
     * Asks server for raw data, no formation is in place
     *
     * @param sqlcommand
     *            SQL command to select wanted data
     * @param targetCollum
     *            collumn in which are raw data stored
     * @return byte array downloaded from respond of server
     * @throws IOException
     */
    public ByteArrayOutputStream getRawData(final String sqlcommand, final String targetCollum) throws IOException {
	final int buffSize = 1024; // How large is the buffered stream byte array

	String parameters = "p=" + password + "&getRaw=t&sql=" + URLEncoder.encode(sqlcommand, "UTF-8") + "&tcollumn=" + targetCollum;

	byte[] postData = parameters.getBytes(StandardCharsets.UTF_8);
	int postDataLength = postData.length;

	URL obj = new URL(url);
	byte[] buf = new byte[buffSize];

	HttpURLConnection connection = (HttpURLConnection)obj.openConnection();

	connection.setDoOutput(true);
	connection.setInstanceFollowRedirects(false);

	connection.setRequestMethod("POST");

	connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
	connection.setRequestProperty("charset", "utf-8");
	connection.setRequestProperty("Content-Length", Integer.toString(postDataLength));
	connection.setUseCaches(false);

	DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
	wr.write(postData);

	InputStream inS = connection.getInputStream();

	int currLength = 0;

	ByteArrayOutputStream outStream = new ByteArrayOutputStream();

	while ((currLength = inS.read(buf)) != -1) {
	    outStream.write(buf, 0, currLength);
	}

	return outStream;
    }

    /**
     * Parses respond code from PHP script's respond
     *
     * @param scriptRespond
     *            respond from PHP script
     * @return number of known parsed state, 255 otherwise
     */
    public static int getReturnCode(final String scriptRespond) {
	final char respondNumber = scriptRespond.charAt(0);

	if (Character.isDigit(respondNumber))
	    return Integer.parseInt("" + respondNumber);
	else
	    return STATE_INVALID;
    }

}


text:
ActiveRecord::Schema.define(version: 20131204121934) do

  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"

  create_table "people", force: true do |t|
    t.string   "name"
    t.string   "surname"
    t.json     "contact_data"
    t.json     "addresses"
    t.json     "family"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

end


text:
**To describe the launch permissions for an AMI**

This example describes the launch permissions for the specified AMI.

Command::

  aws ec2 describe-image-attribute --image-id ami-5731123e --attribute launchPermission

Output::

  {
      "LaunchPermissions": [
          {
              "UserId": "123456789012"
          }
      ],
      "ImageId": "ami-5731123e",
  }

**To describe the product codes for an AMI**

This example describes the product codes for the specified AMI. Note that this AMI has no product codes.

Command::

  aws ec2 describe-image-attribute --image-id ami-5731123e --attribute productCodes

Output::

  {
      "ProductCodes": [],
      "ImageId": "ami-5731123e",
  }


text:
pm.subscriptions.fromOffer("pay_95ba26ba2c613ebb0ca8","offer_40237e20a7d5a231d99b")
.withClient( "client_64b025ee5955abd5af66" )
.withName( "Example Subscription" )
.withPeriodOfValidity( "2 YEAR" )
.withStartDate( new Date(1400575533)).create().then( function(subscription) {
    console.log("created subscription:" + subscription.id);
}, function(error) {
    console.log("couldnt create subscription:" + error);
});


text:
/*
  Contributed by Brandon Schaefer, <brandon.schaefer@canonical.com>
*/

#include "../../SDL_internal.h"

#if SDL_VIDEO_DRIVER_MIR

#include "../SDL_egl_c.h"
#include "../SDL_sysvideo.h"

#include "SDL_mirevents.h"
#include "SDL_mirwindow.h"

#include "SDL_mirdyn.h"

int
IsSurfaceValid(MIR_Window* mir_window)
{
    if (!MIR_mir_surface_is_valid(mir_window->surface)) {
        const char* error = MIR_mir_surface_get_error_message(mir_window->surface);
        return SDL_SetError("Failed to created a mir surface: %s", error);
    }

    return 0;
}

MirPixelFormat
FindValidPixelFormat(MIR_Data* mir_data)
{
    unsigned int pf_size = 32;
    unsigned int valid_formats;
    unsigned int f;

    MirPixelFormat formats[pf_size];
    MIR_mir_connection_get_available_surface_formats(mir_data->connection, formats,
                                                 pf_size, &valid_formats);

    for (f = 0; f < valid_formats; f++) {
        MirPixelFormat cur_pf = formats[f];

        if (cur_pf == mir_pixel_format_abgr_8888 ||
            cur_pf == mir_pixel_format_xbgr_8888 ||
            cur_pf == mir_pixel_format_argb_8888 ||
            cur_pf == mir_pixel_format_xrgb_8888) {

            return cur_pf;
        }
    }

    return mir_pixel_format_invalid;
}

int
MIR_CreateWindow(_THIS, SDL_Window* window)
{
    MIR_Window* mir_window;
    MIR_Data* mir_data;

    MirSurfaceParameters surfaceparm =
    {
        .name = "MirSurface",
        .width = window->w,
        .height = window->h,
        .pixel_format = mir_pixel_format_invalid,
        .buffer_usage = mir_buffer_usage_hardware,
        .output_id = mir_display_output_id_invalid
    };

    MirEventDelegate delegate = {
        MIR_HandleInput,
        window
    };

    mir_window = SDL_calloc(1, sizeof(MIR_Window));
    if (!mir_window)
        return SDL_OutOfMemory();

    mir_data = _this->driverdata;
    window->driverdata = mir_window;

    if (mir_data->software)
        surfaceparm.buffer_usage = mir_buffer_usage_software;

    if (window->x == SDL_WINDOWPOS_UNDEFINED)
        window->x = 0;

    if (window->y == SDL_WINDOWPOS_UNDEFINED)
        window->y = 0;

    mir_window->mir_data = mir_data;
    mir_window->sdl_window = window;

    surfaceparm.pixel_format = FindValidPixelFormat(mir_data);
    if (surfaceparm.pixel_format == mir_pixel_format_invalid) {
        return SDL_SetError("Failed to find a valid pixel format.");
    }

    mir_window->surface = MIR_mir_connection_create_surface_sync(mir_data->connection, &surfaceparm);
    if (!MIR_mir_surface_is_valid(mir_window->surface)) {
        const char* error = MIR_mir_surface_get_error_message(mir_window->surface);
        return SDL_SetError("Failed to created a mir surface: %s", error);
    }

    if (window->flags & SDL_WINDOW_OPENGL) {
        EGLNativeWindowType egl_native_window =
                        (EGLNativeWindowType)MIR_mir_surface_get_egl_native_window(mir_window->surface);

        mir_window->egl_surface = SDL_EGL_CreateSurface(_this, egl_native_window);

        if (mir_window->egl_surface == EGL_NO_SURFACE) {
            return SDL_SetError("Failed to created a window surface %p",
                                _this->egl_data->egl_display);
        }
    }
    else {
        mir_window->egl_surface = EGL_NO_SURFACE;
    }

    MIR_mir_surface_set_event_handler(mir_window->surface, &delegate);

    return 0;
}

void
MIR_DestroyWindow(_THIS, SDL_Window* window)
{
    MIR_Data* mir_data = _this->driverdata;
    MIR_Window* mir_window = window->driverdata;

    if (mir_data) {
        SDL_EGL_DestroySurface(_this, mir_window->egl_surface);
        MIR_mir_surface_release_sync(mir_window->surface);

        SDL_free(mir_window);
    }
    window->driverdata = NULL;
}

SDL_bool
MIR_GetWindowWMInfo(_THIS, SDL_Window* window, SDL_SysWMinfo* info)
{
    if (info->version.major == SDL_MAJOR_VERSION &&
        info->version.minor == SDL_MINOR_VERSION) {
        MIR_Window* mir_window = window->driverdata;

        info->subsystem = SDL_SYSWM_MIR;
        info->info.mir.connection = mir_window->mir_data->connection;
        info->info.mir.surface = mir_window->surface;

        return SDL_TRUE;
    }

    return SDL_FALSE;
}

void
MIR_SetWindowFullscreen(_THIS, SDL_Window* window,
                        SDL_VideoDisplay* display,
                        SDL_bool fullscreen)
{
    MIR_Window* mir_window = window->driverdata;

    if (IsSurfaceValid(mir_window) < 0)
        return;

    if (fullscreen) {
        MIR_mir_surface_set_state(mir_window->surface, mir_surface_state_fullscreen);
    } else {
        MIR_mir_surface_set_state(mir_window->surface, mir_surface_state_restored);
    }
}

void
MIR_MaximizeWindow(_THIS, SDL_Window* window)
{
    MIR_Window* mir_window = window->driverdata;

    if (IsSurfaceValid(mir_window) < 0)
        return;

    MIR_mir_surface_set_state(mir_window->surface, mir_surface_state_maximized);
}

void
MIR_MinimizeWindow(_THIS, SDL_Window* window)
{
    MIR_Window* mir_window = window->driverdata;

    if (IsSurfaceValid(mir_window) < 0)
        return;

    MIR_mir_surface_set_state(mir_window->surface, mir_surface_state_minimized);
}

void
MIR_RestoreWindow(_THIS, SDL_Window * window)
{
    MIR_Window* mir_window = window->driverdata;

    if (IsSurfaceValid(mir_window) < 0)
        return;

    MIR_mir_surface_set_state(mir_window->surface, mir_surface_state_restored);
}

#endif /* SDL_VIDEO_DRIVER_MIR */

/* vi: set ts=4 sw=4 expandtab: */


text:
#ifndef H_MPRINTF
#define H_MPRINTF

#include <stdarg.h>
#include <stdio.h> /* needed for FILE */

int curl_mprintf(const char *format, ...);
int curl_mfprintf(FILE *fd, const char *format, ...);
int curl_msprintf(char *buffer, const char *format, ...);
int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...);
int curl_mvprintf(const char *format, va_list args);
int curl_mvfprintf(FILE *fd, const char *format, va_list args);
int curl_mvsprintf(char *buffer, const char *format, va_list args);
int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args);
char *curl_maprintf(const char *format, ...);
char *curl_mvaprintf(const char *format, va_list args);

#ifdef _MPRINTF_REPLACE
# define printf curl_mprintf
# define fprintf curl_mfprintf
# define sprintf curl_msprintf
# define snprintf curl_msnprintf
# define vprintf curl_mvprintf
# define vfprintf curl_mvfprintf
# define vsprintf curl_mvsprintf
# define vsnprintf curl_mvsnprintf
# define aprintf curl_maprintf
# define vaprintf curl_mvaprintf
#endif

#endif /* H_MPRINTF */


text:
/* ./src/main/java/bdglue2/publisher/bigquery/BigQueryPublisherPropertyValues.java
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package bdglue2.publisher.bigquery;

/**
 * This class contains configuration constants used by the
 * Big Data Glue BigQuery Publisher, including property names and where appropriate
 * the default values to use in the event that a property
 * is not defined.
 *
 */
public final class BigQueryPublisherPropertyValues {
    /**
     * Properties related to BigQueryPublisher.
     */
    /**
     * The BigQuery dataset name to connect to.
     */
    public static final String BIGQUERY_DATASET = "bdglue.bigquery.dataset";
    public static final String BIGQUERY_DATASET_DEFAULT = "default_dataset";
    /**
     * The number of operations to batch together.
     */
    public static final String BIGQUERY_BATCH_SIZE = "bdglue.bigquery.batch-size";
    public static final String BIGQUERY_BATCH_SIZE_DEFAULT = "5";
    /**
     * The frequency to flush operations if the batch-size isn't reached.
     */
    public static final String BIGQUERY_FLUSH_FREQ = "bdglue.bigquery.flush-frequency";
    public static final String BIGQUERY_FLUSH_FREQ_DEFAULT = "500";
    /**
     * Boolean: True if we want to convert deletes and updates into inserts. Assumes that
     * inclusion of operation type and timestamp has been specified in the properties.
     */
    public static final String BIGQUERY_INSERT_ONLY = "bdglue.bigquery.insert-only";
    public static final String BIGQUERY_INSERT_ONLY_DEFAULT = "true";

    /*******************************************************************/
    /**
     * private to prevent explicit object creation
     */
    private BigQueryPublisherPropertyValues() {
        super();
    }
}


text:
asynctest(
  'browser.tinymce.plugins.textpattern.TriggerInlinePatternBeginningTest',
  [
    'ephox.agar.api.GeneralSteps',
    'ephox.agar.api.Keys',
    'ephox.agar.api.Logger',
    'ephox.agar.api.Pipeline',
    'ephox.agar.api.Step',
    'ephox.mcagar.api.TinyActions',
    'ephox.mcagar.api.TinyApis',
    'ephox.mcagar.api.TinyLoader',
    'tinymce.plugins.textpattern.Plugin',
    'tinymce.plugins.textpattern.test.Utils',
    'tinymce.themes.modern.Theme'
  ],
  function (GeneralSteps, Keys, Logger, Pipeline, Step, TinyActions, TinyApis, TinyLoader, TextpatternPlugin, Utils, ModernTheme) {
    var success = arguments[arguments.length - 2];
    var failure = arguments[arguments.length - 1];

    ModernTheme();
    TextpatternPlugin();

    TinyLoader.setup(function (editor, onSuccess, onFailure) {
      var tinyApis = TinyApis(editor);
      // var tinyActions = TinyActions(editor);

      var steps = Utils.withTeardown([
        Logger.t('enter after first * in *a*', GeneralSteps.sequence([
          tinyApis.sSetContent('
*a*
'),
          tinyApis.sFocus,
          tinyApis.sSetCursor([0, 0], 1),
          Step.sync(function () {
            editor.fire('keydown', { keyCode: 13 });
          }),
          tinyApis.sAssertContent('
*

a*
')
        ])),
        Logger.t('enter after first * in *a*', GeneralSteps.sequence([
          tinyApis.sSetContent('
a*b*
'),
          tinyApis.sFocus,
          tinyApis.sSetCursor([0, 1], 1),
          Step.sync(function () {
            editor.fire('keydown', { keyCode: 13 });
          })
        ]))
      ], tinyApis.sSetContent(''));

      Pipeline.async({}, steps, onSuccess, onFailure);
    }, {
      plugins: 'textpattern',
      toolbar: 'textpattern',
      indent: false,
      skin_url: '/project/src/skins/lightgray/dist/lightgray'
    }, success, failure);
  }
);


text:
<?php
if (!defined('InternalAccess')) exit('error: 403 Access Denied');
?>

	<?php echo $Lang['Notifications_Replied_To_Me']; ?>
	<?php echo $Lang['Notifications_Mentioned_Me']; ?>

<?php
foreach($ReplyArray as $key => $post)
{
?>

<a href="<?php echo $Config['WebsitePath']; ?>/goto/<?php echo $post['TopicID']; ?>-<?php echo $post['ID']; ?>" data-transition="slide" data-persist-ajax="true"><?php echo $post['UserName'];?>  <?php echo $Lang['Replied_To_Topic']; ?> › <?php echo $post['Subject'];?>

<?php echo strip_tags(mb_substr($post['Content'], 0, 512, 'utf-8'),'

'); ?>

<?php echo FormatTime($post['PostTime']); ?>

<?php
}
?>

<?php
foreach($MentionArray as $key => $post)
{
?>

<a href="<?php echo $Config['WebsitePath']; ?>/goto/<?php echo $post['TopicID']; ?>-<?php echo $post['ID']; ?>" data-transition="slide" data-persist-ajax="true"><?php echo $post['UserName'];?>  <?php echo $Lang['Mentioned_Me']; ?> › <?php echo $post['Subject'];?>

<?php echo strip_tags(mb_substr($post['Content'], 0, 512, 'utf-8'),'

'); ?>

<?php echo FormatTime($post['PostTime']); ?>

<?php
}
?>


text:
@implementation UIImage (MostColor)

-(UIColor*)mostColor{

#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1
    int bitmapInfo = kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedLast;
#else
    int bitmapInfo = kCGImageAlphaPremultipliedLast;
#endif

    //第一步 先把图片缩小 加快计算速度. 但越小结果误差可能越大
    CGSize thumbSize=CGSizeMake(50, 50);

    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    CGContextRef context = CGBitmapContextCreate(NULL,
                                                 thumbSize.width,
                                                 thumbSize.height,
                                                 8,//bits per component
                                                 thumbSize.width*4,
                                                 colorSpace,
                                                 bitmapInfo);

    CGRect drawRect = CGRectMake(0, 0, thumbSize.width, thumbSize.height);
    CGContextDrawImage(context, drawRect, self.CGImage);
    CGColorSpaceRelease(colorSpace);

    //第二步 取每个点的像素值
    unsigned char* data = CGBitmapContextGetData (context);

    if (data == NULL) return nil;

    NSCountedSet *cls=[NSCountedSet setWithCapacity:thumbSize.width*thumbSize.height];

    for (int x=0; x<thumbSize.width; x++) {
        for (int y=0; y<thumbSize.height; y++) {

            int offset = 4*(x*y);

            int red = data[offset];
            int green = data[offset+1];
            int blue = data[offset+2];
            int alpha =  data[offset+3];

            NSArray *clr=@[@(red),@(green),@(blue),@(alpha)];
            [cls addObject:clr];

        }
    }
    CGContextRelease(context);

    //第三步 找到出现次数最多的那个颜色
    NSEnumerator *enumerator = [cls objectEnumerator];
    NSArray *curColor = nil;

    NSArray *MaxColor=nil;
    NSUInteger MaxCount=0;

    while ( (curColor = [enumerator nextObject]) != nil )
    {
        NSUInteger tmpCount = [cls countForObject:curColor];

        if ( tmpCount < MaxCount ) continue;

        MaxCount=tmpCount;
        MaxColor=curColor;

    }

    return [UIColor colorWithRed:([MaxColor[0] intValue]/255.0f) green:([MaxColor[1] intValue]/255.0f) blue:([MaxColor[2] intValue]/255.0f) alpha:([MaxColor[3] intValue]/255.0f)];
}

@end


text:
		<title>MailFred Options</title>

		GMail address:
		<input type="text" id="email">

		Debugging enabled:
		<input type="checkbox" id="debug">

		<button id="save">Save</button>

		Uninstall


text:
using System.Web;
using System.Configuration;
using System;

namespace FacebookSharp.Samples.Website
{
    public class SampleFacebookContext : IFacebookContext
    {
        private Facebook _facebookContext;

        #region Implementation of IFacebookContext

        public Facebook FacebookContext
        {
            get
            {
                if (ConfigurationManager.AppSettings["FacebookSharp.AppKey"] == "AppKey")
                    throw new ApplicationException("Please specify FacebookSharp.AppKey in web.config AppSettings.");
                if (ConfigurationManager.AppSettings["FacebookSharp.AppSecret"] == "AppSecret")
                    throw new ApplicationException("Please specify FacebookSharp.AppSecret in web.config AppSettings.");
                if (ConfigurationManager.AppSettings["FacebookSharp.PostAuthorizeUrl"] == "PostAuthorizeUrl")
                    throw new ApplicationException("Please specify FacebookSharp.PostAuthorizeUrl in web.config AppSettings.");
                if (_facebookContext == null)
                {
                    FacebookSettings settings = new FacebookSettings();
                    settings.PostAuthorizeUrl = ConfigurationManager.AppSettings["FacebookSharp.PostAuthorizeUrl"];
                    settings.ApplicationKey = ConfigurationManager.AppSettings["FacebookSharp.AppKey"];
                    settings.ApplicationSecret = ConfigurationManager.AppSettings["FacebookSharp.AppSecret"];
                    settings.DefaultApplicationPermissions = new[] { "publish_stream", "read_stream" };

                    if (HttpContext.Current.Session["access_token"] != null)
                    {
                        settings.AccessExpires = Convert.ToInt64(HttpContext.Current.Session["expires_in"]);
                        settings.AccessToken = HttpContext.Current.Session["access_token"].ToString();
                    }

                    _facebookContext = new Facebook(settings);
                }

                return _facebookContext;
            }
        }

        public virtual IFacebookMembershipProvider FacebookMembershipProvider
        {
            get { return null; }
        }

        #endregion
    }
}


text:
"""Python code corresponding to PYTHONCODE entries in __builtin__.pytd.

Each PYTHONCODE item in __builtin__.pytd will have a single python `def` here.
"""

# pylint: disable=redefined-builtin
# pylint: disable=invalid-name
# pylint: disable=unused-argument

def abs(number):
  return number.__abs__()

# TODO(pludemann): Use the proper definition of cmp (similar to repr)
def cmp(x, y):
  return True

# TODO(pludemann): Use the proper definition of repr (see TODO.txt)
def repr(x):
  return ''

class property(object):
  """Property method decorator."""
  # TODO(kramm): Support for setter(), getter(), deleter()

  def __init__(self, fget, fset=None, fdel=None, doc=None):
    self.fget = fget
    self.fset = fset
    self.fdel = fdel
    self.doc = doc

  def __get__(self, obj, objtype):
    return self.fget(obj)

  def __set__(self, obj, value):
    return self.fset(obj, value)

  def __delete__(self, obj):
    return self.fdel(obj)

class staticmethod(object):
  """Staticmethod method decorator."""

  def __init__(self, func):
    # Name the inner method __func__, like in Python/Objects/funcobject.c
    self.__func__ = func

  def __get__(self, obj, objtype):
    return self.__func__

class classmethod(object):
  """Classmethod method decorator."""

  def __init__(self, func):
    # Name the inner method __func__, like in Python/Objects/funcobject.c
    self.__func__ = func

  def __get__(self, obj, objtype):
    func = self.__func__
    def method(*args, **kwargs):
      return func(objtype, *args, **kwargs)
    return method


text:
/* See license.txt for terms of usage */

FBL.ns(function() { with (FBL) {

// ************************************************************************************************
// Constants

const Cc = Components.classes;
const Ci = Components.interfaces;
const nsIScriptError = Ci.nsIScriptError;
const nsIConsoleMessage = Ci.nsIConsoleMessage;

const WARNING_FLAG = nsIScriptError.warningFlag;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

const urlRe = new RegExp("([^:]*):(//)?([^/]*)");
const reUncaught = /uncaught exception/;
const reException = /uncaught exception:\s\[Exception...\s\"([^\"]*)\".*nsresult:.*\(([^\)]*)\).*location:\s\"([^\s]*)\sLine:\s(\d*)\"/;
const statusBar = $("fbStatusBar");
const statusText = $("fbStatusText");

const pointlessErrors =
{
    "uncaught exception: Permission denied to call method Location.toString": 1,
    "uncaught exception: Permission denied to get property Window.writeDebug": 1,
    "uncaught exception: Permission denied to get property XULElement.accessKey": 1,
    "this.docShell has no properties": 1,
    "aDocShell.QueryInterface(Components.interfaces.nsIWebNavigation).currentURI has no properties": 1,
    "Deprecated property window.title used. Please use document.title instead.": 1,
    "Key event not available on GTK2:": 1
};

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Components.utils.import("resource://firebug/firebug-service.js");
const consoleService = CCSV("@mozilla.org/consoleservice;1", "nsIConsoleService");

// ************************************************************************************************

var Errors = Firebug.Errors = extend(Firebug.Module,
{
    dispatchName: "errors",

    clear: function(context)
    {
        this.setCount(context, 0); // reset the UI counter
        delete context.droppedErrors;    // clear the counts of dropped errors
    },

    increaseCount: function(context)
    {
        this.setCount(context, context.errorCount + 1)
    },

    setCount: function(context, count)
    {
        context.errorCount = count;

        if (context == FirebugContext)
            this.showCount(context.errorCount);
    },

    showMessageOnStatusBar: function(error)
    {
        if (statusText && statusBar && Firebug.breakOnErrors && error.message &&  !(error.flags & WARNING_FLAG))  // sometimes statusText is undefined..how?
        {
            statusText.setAttribute("value", error.message);
            statusBar.setAttribute("errors", "true");
            statusText.setAttribute("shown", "true")
            if (FBTrace.DBG_ERRORLOG) FBTrace.sysout("errors.showMessageOnStatusBar error.message:"+error.message+"\n");
        }
    },

    showCount: function(errorCount)
    {
        if (!statusBar)
            return;

        if (errorCount)
        {
            if (Firebug.showErrorCount)
            {
                var errorLabel = $STRP("plural.Error_Count", [errorCount]);
                statusText.setAttribute("shown", "true")
                statusText.setAttribute("value", errorLabel);
            }
            else
            {
              statusText.removeAttribute("shown");
            }

            statusBar.setAttribute("errors", "true");
        }
        else
        {
            statusText.setAttribute("value", "");
            statusBar.removeAttribute("errors");
        }
    },

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    // Called by Console

    startObserving: function()
    {
        consoleService.registerListener(this);
        this.isObserving = true;
    },

    stopObserving: function()
    {
        consoleService.unregisterListener(this);
        this.isObserving = false;
    },

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    // extends consoleListener

    observe: function(object)
    {
        try
        {
            if (window.closed)
                this.stopObserving();
            if (typeof FBTrace == 'undefined')
                return;
            if (!FBTrace)
                return;
        }
        catch(exc)
        {
            return;
        }

        try
        {
            var ScriptError = object instanceof nsIScriptError;
            var ConsoleMessage = object instanceof nsIConsoleMessage;
            var isWarning = object && object.flags & WARNING_FLAG;  // This cannot be pulled in front of the instanceof
            var CSSParser = object && object.category == "CSS Parser";
            var XPConnect = object && object.category && object.category.split(' ').indexOf("XPConnect") != -1;
            if (ScriptError && !XPConnect)  // all branches should trace 'object'
            {
                if (FBTrace.DBG_ERRORLOG)
                    FBTrace.sysout("errors.observe nsIScriptError: "+object.errorMessage, object);

                var context = this.getErrorContext(object);  // after instanceof
                context = this.logScriptError(context, object, isWarning);
                if (!context)
                    return;
            }
            else
            {
                if (Firebug.showChromeMessages)
                {
                    if (ConsoleMessage)
                    {
                        if (FBTrace.DBG_ERRORLOG)
                            FBTrace.sysout("errors.observe nsIConsoleMessage: "+object.message, object);

                        var context = this.getErrorContext(object);  // after instanceof
                        var msgId = lessTalkMoreAction(context, object, isWarning);
                        if (!msgId)
                            return;
                        if (context)
                            Firebug.Console.log(object.message, context, "consoleMessage", FirebugReps.Text);
                    }
                    else if (object.message)
                    {
                        if (FBTrace.DBG_ERRORLOG)
                            FBTrace.sysout("errors.observe object.message:", object);

                        var context = this.getErrorContext(object);
                        if (context)  // maybe just FirebugContext
                            Firebug.Console.log(object.message, context, "consoleMessage", FirebugReps.Text);
                        else
                            FBTrace.sysout("errors.observe, no context for message", object);
                    }
                    else
                        FBTrace.sysout("errors.observe, no message in object", object);
                }
                else
                {
                    if (FBTrace.DBG_ERRORLOG)
                        FBTrace.sysout("errors.observe showChromeMessages off, dropped:", object);
                    return;
                }
            }
            if (FBTrace.DBG_ERRORLOG)
            {
                if (context)
                {
                    if (context.window)
                        FBTrace.sysout((isWarning?"warning":"error")+" logged to "+ context.getName());
                    else
                    {
                        FBTrace.sysout("errors.observe, context with no window, "+(isWarning?"warning":"error")+" object:", object);
                        FBTrace.sysout("errors.observe, context with no window, context:", context);
                    }
                }
                else
                    FBTrace.sysout("errors.observe, no context!\n");
            }
        }
        catch (exc)
        {
            // Errors prior to console init will come out here, eg error message from Firefox startup jjb.
            if (FBTrace.DBG_ERRORLOG)
            {
                FBTrace.sysout("errors.observe FAILS "+exc, exc);
                FBTrace.sysout("errors.observe object "+object, object);
            }
        }
    },

    logScriptError: function(context, object, isWarning)
    {
        if (!context)
            return;

        if (FBTrace.DBG_ERRORLOG)
            FBTrace.sysout("errors.observe logScriptError "+(Firebug.errorStackTrace?"have ":"NO ")+"errorStackTrace error object:", {object: object, errorStackTrace: Firebug.errorStackTrace});

        var category = getBaseCategory(object.category);
        var isJSError = category == "js" && !isWarning;

        var error = new ErrorMessage(object.errorMessage, object.sourceName,
                object.lineNumber, object.sourceLine, category, context, null, msgId);  // the sourceLine will cause the source to be loaded.

        if (Firebug.showStackTrace && Firebug.errorStackTrace)
        {
            error.correctWithStackTrace(Firebug.errorStackTrace);
        }
        else if (checkForUncaughtException(context, object))
        {
            context = getExceptionContext(context);
            correctLineNumbersOnExceptions(object, error);
        }

        var msgId = lessTalkMoreAction(context, object, isWarning);
        if (!msgId)
            return null;

        Firebug.errorStackTrace = null;  // clear global: either we copied it or we don't use it.

        if (!isWarning)
            this.increaseCount(context);

        var className = isWarning ? "warningMessage" : "errorMessage";

        if (context)
        {
            if (FBTrace.DBG_ERRORLOG) FBTrace.sysout("errors.observe delayed log to "+context.getName()+"\n");
             // then report later to avoid loading sourceS
            context.throttle(this.delayedLogging, this, [msgId, context, error, context, className, false, true], true);
        }
        else
        {
            if (FBTrace.DBG_ERRORLOG) FBTrace.sysout("errors.observe direct log to FirebugContext"+FirebugContext+"\n");
            Firebug.Console.log(error, FirebugContext,  className);
        }
        return context;
    },

    delayedLogging: function()
    {
        var args = cloneArray(arguments);
        var msgId = args.shift();
        var context = args.shift();
        var row = Firebug.Console.log.apply(Firebug.Console, args);
        return row;
    },

    getErrorContext: function(object)
    {
        var url = object.sourceName;
        if(!url)
            return FirebugContext;  // eg some XPCOM messages

        var errorContext = null;
        TabWatcher.iterateContexts(
            function findContextByURL(context)
            {
                if (FBTrace.DBG_ERRORLOG && FBTrace.DBG_CSS)
                    FBTrace.sysout("findContextByURL "+context.getName());

                if (!context.window || !context.getWindowLocation())
                    return false;

                if (context.getWindowLocation().toString() == url)
                {
                    if (FBTrace.DBG_ERRORLOG && FBTrace.DBG_CSS)
                        FBTrace.sysout("findContextByURL found match to context window location");
                    return errorContext = context;
                }
                else
                {
                    if (context.sourceFileMap && context.sourceFileMap[url])
                    {
                        if (FBTrace.DBG_ERRORLOG && FBTrace.DBG_CSS)
                            FBTrace.sysout("findContextByURL found match in sourceFileMap");
                        return errorContext = context;
                    }
                }

                if (context.loaded)
                {
                    if (FBL.getStyleSheetByHref(url, context))
                    {
                        if (FBTrace.DBG_ERRORLOG && FBTrace.DBG_CSS)
                            FBTrace.sysout("findContextByURL found match to in loaded styleSheetMap");
                        return errorContext = context;
                    }
                    else
                        return false;
                }
                else  // then new stylesheets are still coming in.
                {
                    if (FBL.getStyleSheetByHref(url, context))
                    {
                        if (FBTrace.DBG_ERRORLOG && FBTrace.DBG_CSS)
                            FBTrace.sysout("findContextByURL found match to in non-loaded styleSheetMap");
                        errorContext = context;  // but we already have this one.
                    }
                    delete context.styleSheetMap; // clear the cache for next time.
                }
            }
        );

        if (FBTrace.DBG_ERRORLOG && FBTrace.DBG_CSS && 'initTime' in this)
        {
            var deltaT = new Date().getTime() - this.initTime.getTime();
            FBTrace.sysout("errors.getErrorContext sheets: "+FBL.totalSheets+" rules: "+FBL.totalRules+" time: "+deltaT);
        }

        if (!errorContext)
        {
            if (FBTrace.DBG_ERRORLOG)
                FBTrace.sysout("errors.getErrorContext no context from error filename:"+url, object);
            errorContext = FirebugContext;  // this is problem if the user isn't viewing the page with errors
        }

        if (FBTrace.DBG_ERRORLOG && !FirebugContext)
            FBTrace.sysout("errors.observe, no FirebugContext in "+window.location+"\n");

        return errorContext; // we looked everywhere...
    },

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    // extends Module

    initContext: function(context)
    {
        this.clear(context);

        if (FBTrace.DBG_ERRORLOG && FBTrace.DBG_CSS)
        {
            FBL.totalSheets = 0;
            FBL.totalRules = 0;
            this.initTime = new Date();
        }
    },

    showContext: function(browser, context)
    {
        this.showCount(context ? context.errorCount : 0);
    },

    unwatchWindow: function(context, win)  // called for top window and frames.
    {
        this.clear(context);  // If we ever get errors by window from Firefox we can cache by window.
    },

    destroyContext: function(context, persistedState)
    {
        this.showCount(0);
        if (FBTrace.DBG_ERRORLOG && FBTrace.DBG_CSS && 'initTime' in this)
        {
            var deltaT = new Date().getTime() - this.initTime.getTime();
            FBTrace.sysout("errors.destroyContext sheets: "+FBL.totalSheets+" rules: "+FBL.totalRules+" time: "+deltaT);
        }
    },

    updateOption: function(name, value)
    {
        this.checkEnabled();
    },

    checkEnabled: function()
    {
        if (this.mustBeEnabled())
        {
            if(!this.isObserving)
                this.startObserving();
            // else we must be and we are observing
        }
        else
        {
            if (this.isObserving)
                this.stopObserving();
            // else we must not be and we are not
        }
        if (FBTrace.DBG_ERRORLOG)
            FBTrace.sysout("errors.checkEnabled mustBeEnabled: "+this.mustBeEnabled()+" isObserving:"+this.isObserving);
    },

    mustBeEnabled: function()
    {
        const optionMap = {showJSErrors:1, showJSWarnings:1, showCSSErrors:1, showXMLErrors: 1,
                showChromeErrors: 1, showChromeMessages: 1, showExternalErrors: 1, showXMLHttpRequests: 1,
                showStackTrace: 1};

        for (var p in optionMap)
        {
            if (Firebug[p])
                return true;
        }
        return false;
    },
    // ******************************************************************************

    reparseXPC: function(errorMessage, context)
    {
        var reXPCError = /JavaScript Error:\s*\"([^\"]*)\"/;
        var reFile = /file:\s*\"([^\"]*)\"/;
        var reLine = /line:\s*(\d*)/;
        var m = reXPCError.exec(errorMessage);
        if (!m)
            return null;
        var msg = m[1];

        var sourceFile = null;
        m = reFile.exec(errorMessage);
        if (m)
            sourceFile = m[1];

        var sourceLineNo = 0;
        m = reLine.exec(errorMessage);
        if (m)
            sourceLineNo = m[1];

        var sourceLine = null;
        if (sourceFile && sourceLineNo && sourceLineNo != 0)
            sourceLine = context.sourceCache.getLine(sourceFile, sourceLineNo);

        var error = new ErrorMessage(msg, sourceFile,
                sourceLineNo, sourceLine, "error", context, null);
        return error;
    }
});

// ************************************************************************************************
// Local Helpers

const categoryMap =
{
    "javascript": "js",
    "JavaScript": "js",
    "DOM": "js",
    "Events": "js",
    "CSS": "css",
    "XML": "xml",
    "malformed-xml": "xml"
};

function getBaseCategory(categories)
{
    var categoryList = categories.split(" ");
    for (var i = 0 ; i < categoryList.length; ++i)
    {
        var category = categoryList[i];
        if ( categoryMap.hasOwnProperty(category) )
            return categoryMap[category];
    }
}

function whyNotShown(url, category, isWarning)
{
    var m = urlRe.exec(url);
    var errorScheme = m ? m[1] : "";
    if (errorScheme == "javascript")
        return null;

    var isChrome = false;

    if (!category)
        return Firebug.showChromeErrors ? null :"no category, assume chrome, showChromeErrors false";

    var categories = category.split(" ");
    for (var i = 0 ; i < categories.length; ++i)
    {
        var category = categories[i];
        if (category == "CSS" && !Firebug.showCSSErrors)
            return "showCSSErrors";
        else if ((category == "XML" || category == "malformed-xml" ) && !Firebug.showXMLErrors)
            return "showXMLErors";
        else if ((category == "javascript" || category == "JavaScript" || category == "DOM")
                    && !isWarning && !Firebug.showJSErrors)
            return "showJSErrors";
        else if ((category == "javascript" || category == "JavaScript" || category == "DOM")
                    && isWarning && !Firebug.showJSWarnings)
            return "showJSWarnings";
        else if (errorScheme == "chrome" || category == "XUL" || category == "chrome" || category == "XBL"
                || category == "component")
            isChrome = true;
    }

    if ((isChrome && !Firebug.showChromeErrors))
        return "showChromeErrors";

    return null;
}

function domainFilter(url)  // never called?
{
    if (Firebug.showExternalErrors)
        return true;

    var browserWin = document.getElementById("content").contentWindow;

    var m = urlRe.exec(browserWin.location.href);
    if (!m)
        return false;

    var browserDomain = m[3];

    m = urlRe.exec(url);
    if (!m)
        return false;

    var errorScheme = m[1];
    var errorDomain = m[3];

    return errorScheme == "javascript"
        || errorScheme == "chrome"
        || errorDomain == browserDomain;
}

function lessTalkMoreAction(context, object, isWarning)
{
    if (!context)
    {
        if (FBTrace.DBG_ERRORLOG)
            FBTrace.sysout("errors.observe dropping "+object.category+" no context");
        return false;
    }

    var enabled = Firebug.Console.isAlwaysEnabled();
    if (!enabled) {
        return null;
    }

    var why = whyNotShown(object.sourceName, object.category, isWarning);

    if (why)
    {
        if (FBTrace.DBG_ERRORLOG)
            FBTrace.sysout("errors.observe dropping "+object.category+" because: "+why);

        context.droppedErrors = context.droppedErrors || {};
        if (!context.droppedErrors[object.category])
            context.droppedErrors[object.category] = 1;
        else
            context.droppedErrors[object.category] += 1;

        return null;
    }

    var incoming_message = object.errorMessage;  // nsIScriptError
    if (!incoming_message)                       // nsIConsoleMessage
        incoming_message = object.message;

    if (Firebug.suppressPointlessErrors)
    {
        for (var msg in pointlessErrors)
        {

            if( msg.charAt(0) == incoming_message.charAt(0) )
            {
                if (incoming_message.indexOf(msg) == 0)
                {
                    if (FBTrace.DBG_ERRORLOG)
                        FBTrace.sysout("errors.observe dropping pointlessError: "+msg+"\n");
                    return null;
                }
            }
        }
    }

    var msgId = [incoming_message, object.sourceName, object.lineNumber].join("/");

    return msgId;
}

function checkForUncaughtException(context, object)
{
    if (object.flags & object.exceptionFlag)
    {
        if (FBTrace.DBG_ERRORLOG) FBTrace.sysout("errors.observe is exception\n");
        if (reUncaught.test(object.errorMessage))
        {
            if (FBTrace.DBG_ERRORLOG) FBTrace.sysout("uncaught exception matches "+reUncaught+"\n");
            if (context.thrownStackTrace)
            {
                Firebug.errorStackTrace = context.thrownStackTrace;
                if (FBTrace.DBG_ERRORLOG) FBTrace.sysout("errors.observe trace.frames", context.thrownStackTrace.frames);
                delete context.thrownStackTrace;
            }
            else
            {
                 if (FBTrace.DBG_ERRORLOG) FBTrace.sysout("errors.observe NO context.thrownStackTrace\n");
            }
            return true;
        }
        else
        {
            if (FBTrace.DBG_ERRORLOG) FBTrace.sysout("errors.observe not an uncaught exception\n");
        }
    }
    delete context.thrownStackTrace;
    return false;
}

function getExceptionContext(context)
{
    var errorWin = fbs.lastErrorWindow;  // not available unless Script panel is enabled.
    if (errorWin)
    {
        var errorContext = TabWatcher.getContextByWindow(errorWin);
        if (FBTrace.DBG_ERRORLOG)
            FBTrace.sysout("errors.observe exception context:"+(errorContext?errorContext.getName():"none")+" errorWin: "+errorWin+"\n");
        if (errorContext)
            return errorContext;
    }
    return context;
}

function correctLineNumbersOnExceptions(object, error)
{
    var m = reException.exec(object.errorMessage);
    if (m)
    {
        var exception = m[1];
        if (exception)
            errorMessage = "uncaught exception: "+exception;
        var nsresult = m[2];
        if (nsresult)
            errorMessage += " ("+nsresult+")";
        var sourceName = m[3];
        var lineNumber = parseInt(m[4]);

        error.correctSourcePoint(sourceName, lineNumber);

        if (FBTrace.DBG_ERRORLOG)
            FBTrace.sysout("errors.correctLineNumbersOnExceptions corrected message with sourceName: "+sourceName+"@"+lineNumber);
    }
}

// ************************************************************************************************

Firebug.registerModule(Errors);

// ************************************************************************************************

}});


text:
# Cordova Service Discovery

Simple plugin to get any SSDP / UPnP / DLNA service on a local network

## Using
Clone the plugin

    $ git clone https://github.com/scottdermott/cordova-plugin-discovery.git

Create a new Cordova Project

    $ cordova create myApp com.example.myApp MyApp
    $ cd myApp

Add Android platform

    cordova platform add android
    cordova platform add ios

Install the plugin

    $ cordova plugin add ../cordova-plugin-discovery

Edit `www/js/index.js` and add the following code inside `onDeviceReady`

```js
    var serviceType = "ssdp:all";

    var success = function(devices) {
        console.log(devices);
    }

    var failure = function() {
        alert("Error calling Service Discovery Plugin");
    }

    /**
     * Similar to the W3C specification for Network Service Discovery api 'http://www.w3.org/TR/discovery-api/'
     * @method getNetworkServices
     * @param {String} serviceType e.g. "urn:schemas-upnp-org:service:ContentDirectory:1", "ssdp:all", "urn:schemas-upnp-org:service:AVTransport:1"
     * @param {Function} success callback an array of services
     * @param {Function} failure callback
     */
    serviceDiscovery.getNetworkServices(serviceType, success, failure);
```

Run the code

    cordova run android
    cordova run ios

## Supported Platforms
- Android
- iOS


text:
/* $FreeBSD$ */

/*-
 * Copyright (c) 2011 Hans Petter Selasky. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <fcntl.h>
#include <err.h>
#include <sysexits.h>
#include <unistd.h>

#include "bus_load_file.h"

void
load_file(const char *fname, uint8_t **pptr, uint32_t *plen)
{
	uint8_t *ptr;
	ssize_t len;
	off_t off;
	int f;

	f = open(fname, O_RDONLY);
	if (f < 0)
		err(EX_NOINPUT, "Cannot open file '%s'", fname);

	off = lseek(f, 0, SEEK_END);
	if (off < 0) {
		err(EX_NOINPUT, "Cannot seek to "
		    "end of file '%s'", fname);
	}

	if (lseek(f, 0, SEEK_SET) < 0) {
		err(EX_NOINPUT, "Cannot seek to "
		    "beginning of file '%s'", fname);
	}

	len = off;
	if (len != off)
		err(EX_NOINPUT, "File '%s' is too big", fname);

	ptr = malloc(len);
	if (ptr == NULL)
		errx(EX_SOFTWARE, "Out of memory");

	if (read(f, ptr, len) != len)
		err(EX_NOINPUT, "Cannot read all data");

	close(f);

	*pptr = ptr;
	*plen = len;
}


text:
"""Copyright 2016 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Methods to interact with the Google Cloud Print Service APIs.

GCPService will provide methods to access all of Cloud Print's Interfaces:

delete (delete printer)
deletejob (delete print job)
jobs (get print jobs)
list (list printers belonging to a specific proxy)
printer (get printer capabilities and info)
register (register a printer)
search (search for printers and return basic information)
submit (submit a print job)

These interfaces are not used in the library, as they are printer specific:

control (used by printer to update job state)
fetch (used by printer to get the next print job)
update (used by printer to update printer attributes)
share (used by applications and interacts with GCP, not printers)
unshare (used by applications and only interacts with GCP, not printers)

This module is dependent on modules from the LogoCert package.
"""
from _common import Sleep
from _common import Extract
from _config import Constants
from _transport import Transport

from json import dumps
from os.path import basename
import requests
import mimetypes
import time
import _log

class GCPService(object):
  """Send and receive network messages and communication."""

  def __init__(self, auth_token):
    """Get a reference to a logger object.

      Args:
      auth_token: the authentication token to use for GCP requests
    """
    self.auth_token = auth_token
    self.logger = _log.GetLogger('LogoCert')
    self.transport = Transport(self.logger)

  def VerifyNotNone(query):
    """Decorator to check that None is not returned.
       This keeps calling code cleaner

    Args:
      query: function we are wrapping.
    Returns:
      formatted data from query if valid, otherwise raise exception
    """
    def VerifyNotNone(self, *args, **kwargs):
      res = query(self, *args, **kwargs)
      if res is None:
        print '%s failed' % str(query)
        raise AssertionError
      return res

    return VerifyNotNone

  def HTTPGetQuery(query):
    """Decorator for various queries to GCP interfaces

    Args:
      query: function we are wrapping.
    Returns:
      formatted data from query to GCP Service Interface.
    """
    def GCPQuery(self, *args, **kwargs):
      url = query(self, *args, **kwargs)
      headers = {'Authorization': 'Bearer %s' % self.auth_token}
      res = self.transport.HTTPGet(url, headers=headers)

      response_dict = {}
      Extract(res.json(), response_dict)
      return response_dict

    return GCPQuery

  @VerifyNotNone
  def FetchRaster(self, job_id):
    """Get the data content belonging to a job_id in pwg-raster format
       Note: This only works for job_id's that are queued, or in_progress.
             This will not work for jobs that have finished

       Args:
          job_id: string, printer's id
       Returns:
         str, the content in pwg-raster format if successful, otherwise, None

         """
    url = '%s/download?id=%s&forcepwg=1' % (Constants.GCP['MGT'], job_id)
    headers = {'Authorization': 'Bearer %s' % self.auth_token}
    r = self.transport.HTTPGet(url, headers=headers)

    if r is None or requests.codes.ok != r.status_code:
      if r is None:
        print 'ERROR! Request to /download returned None type'
      elif r.status_code == 415:
        print ('GCP failed to provide raster file conversion, either supply '
               'your own raster files or capture the content via wireshark '
               'from manual printing the following from Chrome: testpage.png, '
               'rosemary.pdf, dna_overview.png')
      else:
        print ('ERROR! Bad HTTP status code received from /download: %s' %
               r.status_code)
      return None

    return r.content

  # Not decorated with @HTTPGetQuery since Submit() is an HTTP Post
  @VerifyNotNone
  def Submit(self, printer_id, content, title, cjt=None, is_url=False):
    """Submit a print job to the printer

        Args:
          printer_id: string, target printer to print from.
          content: string, url or absolute filepath of the item to print.
          title: string, title of the print job.
          cjt: CloudJobTicket, object that defines the options of the print job
          is_url: boolean, flag to identify between url's and files
        Returns:
          dictionary, response msg from the printer if successful;
                      otherwise, None
        """

    if cjt is None:
      cjt = {}
    else:
      cjt = cjt.val

    name = content

    if not is_url:
      name = basename(content)
      with open(content, 'rb') as f:
        content = f.read()

    if title is None:
      title = "LogoCert Testing: " + name

    content_type = 'url' if is_url else mimetypes.guess_type(name)[0]
    files = {"content": (name,content)}
    url = '%s/submit' % (Constants.GCP['MGT'])
    headers = {'Authorization': 'Bearer %s' % self.auth_token}

    data = {'printerid': printer_id,
            'title': title,
            'contentType': content_type,
            'ticket': dumps(cjt)}

    # Depending on network speed, large files may take a while to submit
    print 'Attempting to submit a job through GCP for up to 60 seconds'
    t_end = time.time()+60
    while time.time() < t_end:
      r = self.transport.HTTPPost(url, data=data, files=files, headers=headers)
      if r is None:
        print 'ERROR! HTTP POST to /submit returned None type'
        return None
      elif r.status_code == requests.codes.ok:
        # Success
        res = r.json()
        # TODO may have to fuzzy match here, print job added may not be standard
        res['success'] = (res['success'] and
                          'print job added' in res['message'].lower())

        if res['success']:
          print 'Job submitted successfully'
        else:
          print 'success: %s, msg: %s' % (res['success'], res['message'])
        return res
      else:
        # Try again if we get HTTP error code
        print 'Bad status code from Submit(): %s' % r.status_code
        if r.status_code == requests.codes.forbidden:
          # This should not happen, calling code should manage token refresh
          self.logger.info('Access token expired, need to refresh it.')
        print 'Trying again in %s sec(s)' % Constants.SLEEP['POLL']
        Sleep('POLL')
    # Continuously gotten HTTP error codes to fall out of the while loop
    return None

  # Not decorated with @HTTPGetQuery since Update() is an HTTP Post
  @VerifyNotNone
  def Update(self, printer_id, setting):
    """Update a cloud printer

        Args:
          printer_id: string, target printer to update.
          setting: dict, local settings structure that describes the fields
                         to update
        Returns:
          dictionary, response msg from the printer
        """
    url = '%s/update' % (Constants.GCP['MGT'])
    headers = {'Authorization': 'Bearer %s' % self.auth_token}

    data = {'printerid': printer_id,
            'local_settings': dumps(setting)}

    r = self.transport.HTTPPost(url, data=data, headers=headers)

    if r is None or requests.codes.ok != r.status_code:
      return False

    res = r.json()
    # TODO may have to fuzzy match here, print job added may not be a standard
    res['success'] = (res['success'] and
                      'printer updated successfully' in res['message'].lower())
    return res

  @VerifyNotNone
  @HTTPGetQuery
  def Delete(self, printer_id):
    """Delete a printer owned by a user.

    Args:
      printer_id: string, printerid of registered printer.
    Returns:
      url: string, url to delete printer.
    """
    url = '%s/delete?printerid=%s' % (Constants.GCP['MGT'], printer_id)

    return url

  @VerifyNotNone
  @HTTPGetQuery
  def DeleteJob(self, job_id):
    """Delete a job owned by user.

    Args:
      job_id: string, jobid of existing job owned by user.
    Returns:
      url: string, url to delete job.
    """
    url = '%s/deletejob?jobid=%s' % (Constants.GCP['MGT'], job_id)

    return url

  @VerifyNotNone
  @HTTPGetQuery
  def Jobs(self, printer_id=None, owner=None, job_title=None, status=None):
    """Get a list of print jobs which user has permission to view.

    Args:
      printer_id: string, filter jobs sent to this printer.
      owner: string, filter jobs submitted by this owner.
      job_title: string, filter jobs whose title or tags contain this string.
      status: string, filter jobs that match this status.
    Returns:
      string, url to be used by HTTPGetQuery method.
    Valid Job state strings are: QUEUED, IN_PROGRESS, DONE, ERROR, SUBMITTED,
    and HELD.
    """
    args = '?'
    url = '%s/jobs' % Constants.GCP['MGT']
    if printer_id:
      url += '?printerid=%s' % printer_id
      args = '&'
    if owner:
      url += '%sowner=%s' % (args, owner)
      args = '&'
    if status:
      url += '%sstatus=%s' % (args, status)
      args= '&'
    if job_title:
      url += '%sq=%s' % (args, job_title)

    return url

  @VerifyNotNone
  @HTTPGetQuery
  def List(self, proxy_id):
    """Execute the list interface and return printer fields.

    Args:
      proxy_id: string, proxy of printer.
    Returns:
      string: url to by used by HTTPGetQuery method.
    Note: the List interface returns the same information as the Search
    interface; therefore, use the Search interface unless you need a list
    or printers using the same proxy_id.
    """
    url = '%s/list?proxy=%s' % (Constants.GCP['MGT'], proxy_id)

    return url

  @VerifyNotNone
  @HTTPGetQuery
  def Printer(self, printer_id):
    """Execute the printer interface and return printer fields and capabilites.

    Args:
      printer_id: string, id of printer.
    Returns:
      string: url to be used by HTTPGetQuery method.
    """
    fields = 'connectionStatus,semanticState,uiState,queuedJobsCount'
    url = '%s/printer?printerid=%s&usecdd=True&extra_fields=%s' % (
        Constants.GCP['MGT'], printer_id, fields)

    return url

  @VerifyNotNone
  @HTTPGetQuery
  def Search(self, printer=None):
    """Search for printers owned by user.

    Args:
      printer: string, name or partial name of printer to search for.
    Returns:
      string: url to be used by HTTPGetQuery method.
    """
    url = '%s/search' % Constants.GCP['MGT']
    if printer:
      # replace all spaces with %20
      url += '?q=%s' % printer.replace(' ','%20')

    return url

  def __getJobFromList(self, job_list, job_id):
    """Find the specified job_id in a list of jobs

    Args:
      job_list: array, job objects.
      job_id: the job_id to look for
    Returns:
      object: the job object with the specified job_id
    """
    for entry in job_list:
      if entry['id'] == job_id:
        return entry
    return None

  def GetJobInfo(self, job_id, printer_id, owner=None, job_title=None):
      """Find the specified job_id in from the Job query result

          Args:
            job_id: string, id of the print job.
            printer_id: string, id of the printer
            owner: string, filter jobs submitted by this owner.
            job_title: string, filter jobs whose title or tags contain this str.
          Returns:
            object: the job object with the specified job_id
      """
      res = self.Jobs(printer_id=printer_id, owner=owner, job_title=job_title)
      job = self.__getJobFromList(res['jobs'], job_id)
      return job

  @VerifyNotNone
  def WaitJobStateNotIn(self, job_id, printer_id, job_state, timeout=60):
    """Wait until the job state is not the specified state.

    Args:
      job_id: string, id of the print job.
      printer_id: string, id of the printer
      job_state: string or list, job state(s) that should not be observed.
      timeout: integer, number of seconds to wait.
    Returns:
      string, current job.

    """
    print ('Waiting up to %s seconds for the job to not have any of the '
           'following job state(s): %s\n' % (timeout, job_state))

    end = time.time() + timeout

    while time.time() < end:
      job = self.GetJobInfo(job_id, printer_id)

      if job is not None:
        if job['semanticState']['state']['type'] not in job_state:
          return job

      Sleep('POLL')

    return None

  @VerifyNotNone
  def WaitJobStateIn(self, job_id, printer_id, job_state, timeout=60):
    """Wait until the job state becomes the specified state(s)

    Args:
      job_id: string, id of the print job.
      printer_id: string, id of the printer
      job_state: string or list, job state(s) to wait for.
      timeout: integer, number of seconds to wait.
    Returns:
      dict, current job.

    """
    print ('Waiting up to %s seconds for the job to have one of the following '
           'job state(s): %s\n' % (timeout, job_state))

    end = time.time() + timeout

    while time.time() < end:
      job = self.GetJobInfo(job_id, printer_id)

      if job is not None:
        if job['semanticState']['state']['type'] in job_state:
          return job

      Sleep('POLL')

    return None

  def WaitForUpdate(self, dev_id, key, expected_value,
                    timeout=Constants.TIMEOUT['GCP_UPDATE']):
    '''Wait for the printer's local_settings attribute matches an expected value

      Args:
        dev_id: string, id of the printer.
        key: string, the local_settings attribute to poll for.
        expected_value: int or boolean, the expected value of the attribute.
        timeout: integer, number of seconds to wait.
      Returns:
        boolean, True if expected value is observed, otherwise False
    '''
    print '[Configurable timeout] GCP_UPDATE:'
    print ('Waiting up to %s seconds for printer to accept pending settings' %
           timeout)

    end = time.time() + timeout

    while time.time() < end:
      # Continue to use the /Update to access the current local settings
      try:
        res = self.Update(dev_id,{})
      except AssertionError:
        print 'GCP Update call failed'
        return False
      else:
        if key not in res['printer']['local_settings']['current']:
          print 'ERROR: "%s" does not exist in local_settings' % key
          return False
        cur_val = res['printer']['local_settings']['current'][key]
        if expected_value == cur_val:
          return True
      Sleep('POLL')
    return False

  def WaitLocalJobExist(self, printer_id, job_title, timeout=60):
    """Wait until the local print job is present in /job api.

    Args:
      printer_id: string, id of the printer
      job_title: string, title of the print job.
      timeout: integer, number of seconds to wait.
    Returns:
      boolean, True if job exists.

    """
    print ('Waiting up to %s seconds for the local print job to be reported to '
           'GCP servers\n' % timeout)

    end = time.time() + timeout

    while time.time() < end:
      res = self.Jobs(printer_id=printer_id, job_title=job_title)
      if res['jobsCount'] > 0:
        return True

      Sleep('POLL')

    return False


text:
=head1 LICENSE

See the NOTICE file distributed with this work for additional information
regarding copyright ownership.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=cut

=head1 CONTACT

  Please email comments or questions to the public Ensembl
  developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.

  Questions may also be sent to the Ensembl help desk at
  <http://www.ensembl.org/Help/Contact>.

=head1 NAME

Bio::EnsEMBL::Compara::RunnableDB::ProteinTrees::ExpandClustersWithProjections

=head1 DESCRIPTION

This is the RunnableDB that parses the output of Hcluster, stores the
clusters as trees without internal structure (each tree will have one
root and several leaves) and dataflows the cluster_ids down branch #2.

=head1 AUTHORSHIP

Ensembl Team. Individual contributions can be found in the GIT log.

=head1 APPENDIX

The rest of the documentation details each of the object methods.
Internal methods are usually preceded with an underscore (_)

=cut

package Bio::EnsEMBL::Compara::RunnableDB::ProteinTrees::ExpandClustersWithProjections;

use strict;
use warnings;

use base ('Bio::EnsEMBL::Compara::RunnableDB::GeneTrees::StoreClusters');

sub param_defaults {
    return {
            'sort_clusters'         => 1,
            'immediate_dataflow'    => 0,
    };
}

my $sql_expand_clusters = 'INSERT INTO gene_tree_node (parent_id, root_id, seq_member_id)
SELECT gtn.parent_id, gtn.root_id, smp.target_seq_member_id
FROM gene_tree_node gtn JOIN seq_member_projection smp ON gtn.seq_member_id = smp.source_seq_member_id
LEFT JOIN gene_tree_node gtn2 ON gtn2.seq_member_id = smp.target_seq_member_id WHERE gtn2.seq_member_id IS NULL
';

my $sql_update_gene_count = 'UPDATE gene_tree_root_attr
  JOIN (SELECT root_id, COUNT(seq_member_id) AS real_size FROM gene_tree_node GROUP BY root_id) _t USING (root_id)
  JOIN gene_tree_root USING (root_id)
SET gene_count = real_size
WHERE tree_type = "tree"
';

my $sql_unexpandable_members = 'SELECT source_seq_member_id, target_seq_member_id
FROM seq_member_projection smp JOIN seq_member ON source_seq_member_id = seq_member_id LEFT JOIN gene_tree_node gtn1 USING (seq_member_id) LEFT JOIN gene_tree_node gtn2 ON gtn2.seq_member_id = smp.target_seq_member_id
WHERE gtn1.node_id IS NULL
AND gtn2.seq_member_id IS NULL
';

sub fetch_input {
    my $self = shift;
    my $this_mlss = $self->compara_dba->get_MethodLinkSpeciesSetAdaptor->fetch_by_dbID($self->param_required('mlss_id'));
    $self->param('member_type', $this_mlss->method->type eq 'PROTEIN_TREES' ? 'protein' : 'ncrna');
}

sub run {
    my $self = shift @_;

    # Add genes to the clusters
    $self->compara_dba->dbc->do($sql_expand_clusters);
    $self->compara_dba->dbc->do($sql_update_gene_count);

    # Find the source genes that are not in clusters
    my %allclusters = ();
    $self->param('allclusters', \%allclusters);

    my $sth = $self->compara_dba->dbc->prepare($sql_unexpandable_members);
    $sth->execute();
    while (my $row = $sth->fetchrow_arrayref()) {
        if (exists $allclusters{$row->[0]}) {
            push @{ $allclusters{$row->[0]}->{'members'} }, $row->[1];
        } else {
            $allclusters{$row->[0]} = { 'members' => [@$row] };
        }
    }
    $sth->finish();
    warn scalar(keys %allclusters), " clusters added\n";
}

sub write_output {
    my $self = shift @_;

    #die;
    $self->store_clusterset('default', $self->param('allclusters')) if scalar(keys %{$self->param('allclusters')});
}

1;


text: find ../ -name pubspec.yaml -execdir dart pub get \;


text:
package com.intellij.json.psi.impl;

import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import static com.intellij.json.JsonElementTypes.*;
import com.intellij.json.psi.*;
import com.intellij.navigation.ItemPresentation;

public class JsonPropertyImpl extends JsonPropertyMixin implements JsonProperty {

  public JsonPropertyImpl(@NotNull ASTNode node) {
    super(node);
  }

  public void accept(@NotNull JsonElementVisitor visitor) {
    visitor.visitProperty(this);
  }

  @Override
  public void accept(@NotNull PsiElementVisitor visitor) {
    if (visitor instanceof JsonElementVisitor) accept((JsonElementVisitor)visitor);
    else super.accept(visitor);
  }

  @NotNull
  public String getName() {
    return JsonPsiImplUtils.getName(this);
  }

  @NotNull
  public JsonValue getNameElement() {
    return JsonPsiImplUtils.getNameElement(this);
  }

  @Nullable
  public JsonValue getValue() {
    return JsonPsiImplUtils.getValue(this);
  }

  @Nullable
  public ItemPresentation getPresentation() {
    return JsonPsiImplUtils.getPresentation(this);
  }

}