text:
.class public Landroid/telephony/gsm/SmsMessage;
.super Ljava/lang/Object;
.source "SmsMessage.java"

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Landroid/telephony/gsm/SmsMessage$DeliverPdu;,
        Landroid/telephony/gsm/SmsMessage$SubmitPdu;,
        Landroid/telephony/gsm/SmsMessage$MessageClass;
    }
.end annotation

.annotation runtime Ljava/lang/Deprecated;
.end annotation

# static fields
.field public static final ENCODING_16BIT:I = 0x3
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final ENCODING_7BIT:I = 0x1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final ENCODING_8BIT:I = 0x2
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final ENCODING_UNKNOWN:I = 0x0
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field private static final LOCAL_DEBUG:Z = true

.field private static final LOG_TAG:Ljava/lang/String; = "SMS"

.field public static final MAX_USER_DATA_BYTES:I = 0x8c
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final MAX_USER_DATA_BYTES_WITH_HEADER:I = 0x86
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final MAX_USER_DATA_SEPTETS:I = 0xa0
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final MAX_USER_DATA_SEPTETS_WITH_HEADER:I = 0x99
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

# instance fields
.field public mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

# direct methods
.method public constructor <init>()V
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 181
    invoke-static {}, Landroid/telephony/gsm/SmsMessage;->getSmsFacility()Lcom/android/internal/telephony/SmsMessageBase;

    move-result-object v0

    invoke-direct {p0, v0}, Landroid/telephony/gsm/SmsMessage;-><init>(Lcom/android/internal/telephony/SmsMessageBase;)V

    .line 182
    return-void
.end method

.method private constructor <init>(Lcom/android/internal/telephony/SmsMessageBase;)V
    .locals 0
    .parameter "smb"

    .prologue
    .line 184
    invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V

    .line 185
    iput-object p1, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    .line 186
    return-void
.end method

.method public static calculateLength(Ljava/lang/CharSequence;Z)[I
    .locals 4
    .parameter "messageBody"
    .parameter "use7bitOnly"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 242
    invoke-static {p0, p1}, Lcom/android/internal/telephony/gsm/SmsMessage;->calculateLength(Ljava/lang/CharSequence;Z)Lcom/android/internal/telephony/SmsMessageBase$TextEncodingDetails;

    move-result-object v1

    .line 245
    .local v1, ted:Lcom/android/internal/telephony/SmsMessageBase$TextEncodingDetails;
    const/4 v2, 0x4

    new-array v0, v2, [I

    .line 246
    .local v0, ret:[I
    const/4 v2, 0x0

    iget v3, v1, Lcom/android/internal/telephony/SmsMessageBase$TextEncodingDetails;->msgCount:I

    aput v3, v0, v2

    .line 247
    const/4 v2, 0x1

    iget v3, v1, Lcom/android/internal/telephony/SmsMessageBase$TextEncodingDetails;->codeUnitCount:I

    aput v3, v0, v2

    .line 248
    const/4 v2, 0x2

    iget v3, v1, Lcom/android/internal/telephony/SmsMessageBase$TextEncodingDetails;->codeUnitsRemaining:I

    aput v3, v0, v2

    .line 249
    const/4 v2, 0x3

    iget v3, v1, Lcom/android/internal/telephony/SmsMessageBase$TextEncodingDetails;->codeUnitSize:I

    aput v3, v0, v2

    .line 250
    return-object v0
.end method

.method public static calculateLength(Ljava/lang/String;Z)[I
    .locals 1
    .parameter "messageBody"
    .parameter "use7bitOnly"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 271
    invoke-static {p0, p1}, Landroid/telephony/gsm/SmsMessage;->calculateLength(Ljava/lang/CharSequence;Z)[I

    move-result-object v0

    return-object v0
.end method

.method public static createFromPdu([B)Landroid/telephony/gsm/SmsMessage;
    .locals 4
    .parameter "pdu"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 195
    const-string v2, "SMS"

    const-string v3, "android.telephony.SmsMessage.java - createFromPdu"

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

    .line 197
    invoke-static {}, Landroid/telephony/TelephonyManager;->getDefault()Landroid/telephony/TelephonyManager;

    move-result-object v2

    invoke-virtual {v2}, Landroid/telephony/TelephonyManager;->getCurrentPhoneType()I

    move-result v0

    .line 199
    .local v0, activePhone:I
    const/4 v2, 0x2

    if-ne v2, v0, :cond_0

    .line 200
    invoke-static {p0}, Lcom/android/internal/telephony/cdma/SmsMessage;->createFromPdu([B)Lcom/android/internal/telephony/cdma/SmsMessage;

    move-result-object v1

    .line 205
    .local v1, wrappedMessage:Lcom/android/internal/telephony/SmsMessageBase;
    :goto_0
    new-instance v2, Landroid/telephony/gsm/SmsMessage;

    invoke-direct {v2, v1}, Landroid/telephony/gsm/SmsMessage;-><init>(Lcom/android/internal/telephony/SmsMessageBase;)V

    return-object v2

    .line 202
    .end local v1           #wrappedMessage:Lcom/android/internal/telephony/SmsMessageBase;
    :cond_0
    invoke-static {p0}, Lcom/android/internal/telephony/gsm/SmsMessage;->createFromPdu([B)Lcom/android/internal/telephony/gsm/SmsMessage;

    move-result-object v1

    .restart local v1       #wrappedMessage:Lcom/android/internal/telephony/SmsMessageBase;
    goto :goto_0
.end method

.method public static getSimDeliverPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[B)Landroid/telephony/gsm/SmsMessage$DeliverPdu;
    .locals 4
    .parameter "scAddress"
    .parameter "Address"
    .parameter "message"
    .parameter "date"
    .parameter "header"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 725
    const-string v2, "SMS"

    const-string v3, "android.telephony.gsm.SmsMessage.java - getSimSubmitPdu"

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

    .line 728
    invoke-static {}, Landroid/telephony/TelephonyManager;->getDefault()Landroid/telephony/TelephonyManager;

    move-result-object v2

    invoke-virtual {v2}, Landroid/telephony/TelephonyManager;->getPhoneType()I

    move-result v0

    .line 730
    .local v0, activePhone:I
    const/4 v2, 0x2

    if-ne v2, v0, :cond_0

    .line 732
    const/4 v1, 0x0

    .line 738
    .local v1, spb:Lcom/android/internal/telephony/SmsMessageBase$DeliverPduBase;
    :goto_0
    new-instance v2, Landroid/telephony/gsm/SmsMessage$DeliverPdu;

    invoke-direct {v2, v1}, Landroid/telephony/gsm/SmsMessage$DeliverPdu;-><init>(Lcom/android/internal/telephony/SmsMessageBase$DeliverPduBase;)V

    return-object v2

    .line 734
    .end local v1           #spb:Lcom/android/internal/telephony/SmsMessageBase$DeliverPduBase;
    :cond_0
    invoke-static {p0, p1, p2, p3, p4}, Lcom/android/internal/telephony/gsm/SmsMessage;->getSimDeliverPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[B)Lcom/android/internal/telephony/gsm/SmsMessage$DeliverPdu;

    move-result-object v1

    .restart local v1       #spb:Lcom/android/internal/telephony/SmsMessageBase$DeliverPduBase;
    goto :goto_0
.end method

.method public static getSimSubmitPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[B)Landroid/telephony/gsm/SmsMessage$SubmitPdu;
    .locals 4
    .parameter "scAddress"
    .parameter "Address"
    .parameter "message"
    .parameter "header"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 702
    const-string v2, "SMS"

    const-string v3, "android.telephony.gsm.SmsMessage.java - getSimSubmitPdu"

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

    .line 705
    invoke-static {}, Landroid/telephony/TelephonyManager;->getDefault()Landroid/telephony/TelephonyManager;

    move-result-object v2

    invoke-virtual {v2}, Landroid/telephony/TelephonyManager;->getPhoneType()I

    move-result v0

    .line 707
    .local v0, activePhone:I
    const/4 v2, 0x2

    if-ne v2, v0, :cond_0

    .line 709
    const/4 v1, 0x0

    .line 715
    .local v1, spb:Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;
    :goto_0
    new-instance v2, Landroid/telephony/gsm/SmsMessage$SubmitPdu;

    invoke-direct {v2, v1}, Landroid/telephony/gsm/SmsMessage$SubmitPdu;-><init>(Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;)V

    return-object v2

    .line 711
    .end local v1           #spb:Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;
    :cond_0
    invoke-static {p0, p1, p2, p3}, Lcom/android/internal/telephony/gsm/SmsMessage;->getSimSubmitPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[B)Lcom/android/internal/telephony/gsm/SmsMessage$SubmitPdu;

    move-result-object v1

    .restart local v1       #spb:Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;
    goto :goto_0
.end method

.method private static final getSmsFacility()Lcom/android/internal/telephony/SmsMessageBase;
    .locals 2

    .prologue
    .line 686
    invoke-static {}, Landroid/telephony/TelephonyManager;->getDefault()Landroid/telephony/TelephonyManager;

    move-result-object v1

    invoke-virtual {v1}, Landroid/telephony/TelephonyManager;->getCurrentPhoneType()I

    move-result v0

    .line 687
    .local v0, activePhone:I
    const/4 v1, 0x2

    if-ne v1, v0, :cond_0

    .line 688
    new-instance v1, Lcom/android/internal/telephony/cdma/SmsMessage;

    invoke-direct {v1}, Lcom/android/internal/telephony/cdma/SmsMessage;-><init>()V

    .line 690
    :goto_0
    return-object v1

    :cond_0
    new-instance v1, Lcom/android/internal/telephony/gsm/SmsMessage;

    invoke-direct {v1}, Lcom/android/internal/telephony/gsm/SmsMessage;-><init>()V

    goto :goto_0
.end method

.method public static getSubmitPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)Landroid/telephony/gsm/SmsMessage$SubmitPdu;
    .locals 3
    .parameter "scAddress"
    .parameter "destinationAddress"
    .parameter "message"
    .parameter "statusReportRequested"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 316
    invoke-static {}, Landroid/telephony/TelephonyManager;->getDefault()Landroid/telephony/TelephonyManager;

    move-result-object v2

    invoke-virtual {v2}, Landroid/telephony/TelephonyManager;->getCurrentPhoneType()I

    move-result v0

    .line 318
    .local v0, activePhone:I
    const/4 v2, 0x2

    if-ne v2, v0, :cond_0

    .line 319
    const/4 v2, 0x0

    invoke-static {p0, p1, p2, p3, v2}, Lcom/android/internal/telephony/cdma/SmsMessage;->getSubmitPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLcom/android/internal/telephony/SmsHeader;)Lcom/android/internal/telephony/cdma/SmsMessage$SubmitPdu;

    move-result-object v1

    .line 326
    .local v1, spb:Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;
    :goto_0
    new-instance v2, Landroid/telephony/gsm/SmsMessage$SubmitPdu;

    invoke-direct {v2, v1}, Landroid/telephony/gsm/SmsMessage$SubmitPdu;-><init>(Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;)V

    return-object v2

    .line 322
    .end local v1           #spb:Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;
    :cond_0
    invoke-static {p0, p1, p2, p3}, Lcom/android/internal/telephony/gsm/SmsMessage;->getSubmitPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)Lcom/android/internal/telephony/gsm/SmsMessage$SubmitPdu;

    move-result-object v1

    .restart local v1       #spb:Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;
    goto :goto_0
.end method

.method public static getSubmitPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z[B)Landroid/telephony/gsm/SmsMessage$SubmitPdu;
    .locals 3
    .parameter "scAddress"
    .parameter "destinationAddress"
    .parameter "message"
    .parameter "statusReportRequested"
    .parameter "header"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 289
    invoke-static {}, Landroid/telephony/TelephonyManager;->getDefault()Landroid/telephony/TelephonyManager;

    move-result-object v2

    invoke-virtual {v2}, Landroid/telephony/TelephonyManager;->getCurrentPhoneType()I

    move-result v0

    .line 291
    .local v0, activePhone:I
    const/4 v2, 0x2

    if-ne v2, v0, :cond_0

    .line 292
    invoke-static {p4}, Lcom/android/internal/telephony/SmsHeader;->fromByteArray([B)Lcom/android/internal/telephony/SmsHeader;

    move-result-object v2

    invoke-static {p0, p1, p2, p3, v2}, Lcom/android/internal/telephony/cdma/SmsMessage;->getSubmitPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLcom/android/internal/telephony/SmsHeader;)Lcom/android/internal/telephony/cdma/SmsMessage$SubmitPdu;

    move-result-object v1

    .line 300
    .local v1, spb:Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;
    :goto_0
    new-instance v2, Landroid/telephony/gsm/SmsMessage$SubmitPdu;

    invoke-direct {v2, v1}, Landroid/telephony/gsm/SmsMessage$SubmitPdu;-><init>(Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;)V

    return-object v2

    .line 296
    .end local v1           #spb:Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;
    :cond_0
    invoke-static {p0, p1, p2, p3, p4}, Lcom/android/internal/telephony/gsm/SmsMessage;->getSubmitPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z[B)Lcom/android/internal/telephony/gsm/SmsMessage$SubmitPdu;

    move-result-object v1

    .restart local v1       #spb:Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;
    goto :goto_0
.end method

.method public static getSubmitPdu(Ljava/lang/String;Ljava/lang/String;S[BZ)Landroid/telephony/gsm/SmsMessage$SubmitPdu;
    .locals 3
    .parameter "scAddress"
    .parameter "destinationAddress"
    .parameter "destinationPort"
    .parameter "data"
    .parameter "statusReportRequested"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 347
    invoke-static {}, Landroid/telephony/TelephonyManager;->getDefault()Landroid/telephony/TelephonyManager;

    move-result-object v2

    invoke-virtual {v2}, Landroid/telephony/TelephonyManager;->getCurrentPhoneType()I

    move-result v0

    .line 349
    .local v0, activePhone:I
    const/4 v2, 0x2

    if-ne v2, v0, :cond_0

    .line 350
    invoke-static {p0, p1, p2, p3, p4}, Lcom/android/internal/telephony/cdma/SmsMessage;->getSubmitPdu(Ljava/lang/String;Ljava/lang/String;I[BZ)Lcom/android/internal/telephony/cdma/SmsMessage$SubmitPdu;

    move-result-object v1

    .line 357
    .local v1, spb:Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;
    :goto_0
    new-instance v2, Landroid/telephony/gsm/SmsMessage$SubmitPdu;

    invoke-direct {v2, v1}, Landroid/telephony/gsm/SmsMessage$SubmitPdu;-><init>(Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;)V

    return-object v2

    .line 353
    .end local v1           #spb:Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;
    :cond_0
    invoke-static {p0, p1, p2, p3, p4}, Lcom/android/internal/telephony/gsm/SmsMessage;->getSubmitPdu(Ljava/lang/String;Ljava/lang/String;I[BZ)Lcom/android/internal/telephony/gsm/SmsMessage$SubmitPdu;

    move-result-object v1

    .restart local v1       #spb:Lcom/android/internal/telephony/SmsMessageBase$SubmitPduBase;
    goto :goto_0
.end method

.method public static getTPLayerLengthForPDU(Ljava/lang/String;)I
    .locals 2
    .parameter "pdu"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 215
    invoke-static {}, Landroid/telephony/TelephonyManager;->getDefault()Landroid/telephony/TelephonyManager;

    move-result-object v1

    invoke-virtual {v1}, Landroid/telephony/TelephonyManager;->getCurrentPhoneType()I

    move-result v0

    .line 217
    .local v0, activePhone:I
    const/4 v1, 0x2

    if-ne v1, v0, :cond_0

    .line 218
    invoke-static {p0}, Lcom/android/internal/telephony/cdma/SmsMessage;->getTPLayerLengthForPDU(Ljava/lang/String;)I

    move-result v1

    .line 220
    :goto_0
    return v1

    :cond_0
    invoke-static {p0}, Lcom/android/internal/telephony/gsm/SmsMessage;->getTPLayerLengthForPDU(Ljava/lang/String;)I

    move-result v1

    goto :goto_0
.end method

# virtual methods
.method public getDisplayDestinationAddress()Ljava/lang/String;
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 397
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getDisplayDestinationAddress()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getDisplayMessageBody()Ljava/lang/String;
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 428
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getDisplayMessageBody()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getDisplayOriginatingAddress()Ljava/lang/String;
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 388
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getDisplayOriginatingAddress()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getEmailBody()Ljava/lang/String;
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 485
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getEmailBody()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getEmailFrom()Ljava/lang/String;
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 495
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getEmailFrom()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getIndexOnIcc()I
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 636
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getIndexOnIcc()I

    move-result v0

    return v0
.end method

.method public getIndexOnSim()I
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 623
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getIndexOnIcc()I

    move-result v0

    return v0
.end method

.method public getMessageBody()Ljava/lang/String;
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 407
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getMessageBody()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getMessageClass()Landroid/telephony/gsm/SmsMessage$MessageClass;
    .locals 2
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 416
    iget-object v1, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v1}, Lcom/android/internal/telephony/SmsMessageBase;->getMessageClass()Landroid/telephony/SmsMessage$MessageClass;

    move-result-object v1

    invoke-virtual {v1}, Landroid/telephony/SmsMessage$MessageClass;->ordinal()I

    move-result v0

    .line 418
    .local v0, index:I
    invoke-static {}, Landroid/telephony/gsm/SmsMessage$MessageClass;->values()[Landroid/telephony/gsm/SmsMessage$MessageClass;

    move-result-object v1

    aget-object v1, v1, v0

    return-object v1
.end method

.method public getMessageType()I
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 444
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getMessageType()I

    move-result v0

    return v0
.end method

.method public getOriginatingAddress()Ljava/lang/String;
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 377
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getOriginatingAddress()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getPdu()[B
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 578
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getPdu()[B

    move-result-object v0

    return-object v0
.end method

.method public getProtocolIdentifier()I
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 504
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getProtocolIdentifier()I

    move-result v0

    return v0
.end method

.method public getPseudoSubject()Ljava/lang/String;
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 454
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getPseudoSubject()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getServiceCenterAddress()Ljava/lang/String;
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 367
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getServiceCenterAddress()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getStatus()I
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 658
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getStatus()I

    move-result v0

    return v0
.end method

.method public getStatusOnIcc()I
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 612
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getStatusOnIcc()I

    move-result v0

    return v0
.end method

.method public getStatusOnSim()I
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 594
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getStatusOnIcc()I

    move-result v0

    return v0
.end method

.method public getTimestampMillis()J
    .locals 2
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 463
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getTimestampMillis()J

    move-result-wide v0

    return-wide v0
.end method

.method public getUserData()[B
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 563
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->getUserData()[B

    move-result-object v0

    return-object v0
.end method

.method public isCphsMwiMessage()Z
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 524
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->isCphsMwiMessage()Z

    move-result v0

    return v0
.end method

.method public isEmail()Z
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 475
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->isEmail()Z

    move-result v0

    return v0
.end method

.method public isMWIClearMessage()Z
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 534
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->isMWIClearMessage()Z

    move-result v0

    return v0
.end method

.method public isMWISetMessage()Z
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 544
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->isMWISetMessage()Z

    move-result v0

    return v0
.end method

.method public isMwiDontStore()Z
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 554
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->isMwiDontStore()Z

    move-result v0

    return v0
.end method

.method public isReplace()Z
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 513
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->isReplace()Z

    move-result v0

    return v0
.end method

.method public isReplyPathPresent()Z
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 677
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->isReplyPathPresent()Z

    move-result v0

    return v0
.end method

.method public isStatusReportMessage()Z
    .locals 1
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation

    .prologue
    .line 667
    iget-object v0, p0, Landroid/telephony/gsm/SmsMessage;->mWrappedSmsMessage:Lcom/android/internal/telephony/SmsMessageBase;

    invoke-virtual {v0}, Lcom/android/internal/telephony/SmsMessageBase;->isStatusReportMessage()Z

    move-result v0

    return v0
.end method


text:
<persistence
  version="2.1"
  xmlns="http://xmlns.jcp.org/xml/ns/persistence"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd">

  <persistence-unit name="test-unit-1" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

    <class>eu.drus.jpa.unit.test.entities.EntityA</class>
    <class>eu.drus.jpa.unit.test.entities.EntityB</class>

    <properties>
      <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
      <property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.H2Platform" />
      <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
      <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testDB" />
      <property name="javax.persistence.jdbc.user" value="test" />
      <property name="javax.persistence.jdbc.password" value="test" />
    </properties>
  </persistence-unit>

  <persistence-unit name="test-unit-2" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

    <class>eu.drus.jpa.unit.test.entities.EntityA</class>
    <class>eu.drus.jpa.unit.test.entities.EntityB</class>

    <properties>
      <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
      <property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.H2Platform" />
      <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
      <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testDB" />
      <property name="javax.persistence.jdbc.user" value="test" />
      <property name="javax.persistence.jdbc.password" value="test" />
    </properties>
  </persistence-unit>

  <persistence-unit name="test-unit-4" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

    <class>eu.drus.jpa.unit.test.entities.EntityA</class>
    <class>eu.drus.jpa.unit.test.entities.EntityB</class>

    <properties>
      <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
      <property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.H2Platform" />
      <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
      <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testDB" />
      <property name="javax.persistence.jdbc.user" value="test" />
      <property name="javax.persistence.jdbc.password" value="test" />
    </properties>
  </persistence-unit>

  <persistence-unit name="test-unit-4" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

    <class>eu.drus.jpa.unit.test.entities.EntityA</class>
    <class>eu.drus.jpa.unit.test.entities.EntityB</class>

    <properties>
      <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
      <property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.H2Platform" />
      <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
      <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testDB" />
      <property name="javax.persistence.jdbc.user" value="test" />
      <property name="javax.persistence.jdbc.password" value="test" />
    </properties>
  </persistence-unit>
</persistence>

redpajama_set_name: RedPajamaGithub


text:
A collection of utility functions to be used when writing [Pebble][3] apps using [Katharine][2]'s [httpebble library][1].

### Error Message

Returns a string containing the error message for the given error code.

```c
char* httpebble_error(int error_code)
```

#### Sample Usage

```c
void http_failure(int32_t request_id, int http_status, void* context) {
  httpebble_error(http_status);
}
```
```c
HTTPResult  result = http_out_get("http://api.pblweb.com/tutorials/demo.php", HTTP_COOKIE, &dict);
if (result != HTTP_OK) {
  httpebble_error(result);
  return;
}
````

[1]: http://kathar.in/httpebble
[2]: http://kathar.in/
[3]: http://getpebble.com


text:
package controllers

import scala.concurrent.Future

import play.api.mvc._
import play.api.data._
import play.api.data.Forms._
import play.api.Play.current
import play.api.i18n.Messages.Implicits._
import play.api.libs.concurrent.Execution.Implicits.defaultContext

import views._
import model.PIMAidDBContext._
import model.PIMAidDBContext.driver.api._

object MedicationProductGenericTypesController extends Controller {
  val genericTypeMedicationProductForm = Form(
    tuple(
      "genericTypeId" -> longNumber.transform(
        (id: Long) => GenericTypeID(id),
        (genericTypeId: GenericTypeID) => genericTypeId.value
      ),
      "medicationProductId" -> longNumber.transform(
        (id: Long) => MedicationProductID(id),
        (medicationProductId: MedicationProductID) => medicationProductId.value
      )
    )
  )

  def list(medicationProductId: MedicationProductID) = Action.async { implicit rs =>
    db.run(for {
      productOption <- MedicationProduct.one(medicationProductId).include(MedicationProduct.genericTypes).result
      genericTypes <- GenericType.all.result
    } yield productOption match {
      case Some(medicationProduct) =>
        Ok(html.medicationProductGenericTypes.list(medicationProduct, genericTypes, genericTypeMedicationProductForm))
      case _ =>
        NotFound
    })
  }

  def save(medicationProductId: MedicationProductID) = Action.async { implicit rs =>
    db.run(MedicationProduct.one(medicationProductId).include(MedicationProduct.genericTypes).result).flatMap {
      case Some(medicationProduct) =>
        genericTypeMedicationProductForm.bindFromRequest.fold(
          formWithErrors =>
            db.run(GenericType.all.result).map { genericTypes =>
              BadRequest(html.medicationProductGenericTypes.list(medicationProduct, genericTypes, formWithErrors))
            },
          genericTypeMedicationProduct =>
            db.run(TableQuery[GenericTypesMedicationProducts] += genericTypeMedicationProduct).map { _=>
              Redirect(routes.MedicationProductGenericTypesController.list(medicationProductId))
                .flashing("success" -> "The generic type was successfully added to the medication product.")
            }
        )
      case _ =>
        Future.successful(NotFound)
    }
  }

  def remove(medicationProductId: MedicationProductID, id: GenericTypeID) = Action.async { implicit rs =>
    db.run(MedicationProduct.one(medicationProductId).result).flatMap {
      case Some(medicationProduct) =>
        db.run(GenericType.one(id).result).map {
          case Some(genericType) =>
            Ok(html.medicationProductGenericTypes.remove(medicationProduct, genericType))
          case _ =>
            NotFound
        }
      case _ => Future.successful(NotFound)
    }
  }

  def delete(medicationProductId: MedicationProductID, id: GenericTypeID) = Action.async { implicit rs =>
    val action = TableQuery[GenericTypesMedicationProducts]
      .filter(x => x.genericTypeId === id && x.medicationProductId === medicationProductId)
      .delete

    db.run(action).map { _ =>
      Redirect(routes.MedicationProductGenericTypesController.list(medicationProductId))
        .flashing("success" -> "The generic type was succesfully removed from the medication product.")
    }
  }
}


text:
================================================================================
SendSNMPAction
================================================================================

.. describe:: Extends

    :py:class:`~pyvisdk.mo.action.Action`

.. class:: pyvisdk.do.send_snmp_action.SendSNMPAction


text:
<template name="home">

Proyectos

      {{> loginButtons }}

    {{#if currentUser }}
      <button id="btnNew" class="btn btn-info">Nuevo</button>

            Nombre del proyecto

          {{#each projects}}

              {{ folder }}

          {{else}}

No tienes ningun proyecto. Empieza creando uno nuevo...

          {{/each}}

    {{/if }}

</template>


text:
from unittest import TestCase
from mock import MagicMock
from chatterbot.logic import BestMatch
from chatterbot.conversation import Statement, Response
from tests.base_case import ChatBotTestCase

class BestMatchLevenshteinDistanceTestCase(ChatBotTestCase):
    """
    Integration tests for the BestMatch logic adapter
    using Levenshtein distance as a comparison function.
    """

    def setUp(self):
        super(BestMatchLevenshteinDistanceTestCase, self).setUp()
        from chatterbot.comparisons import levenshtein_distance

        self.adapter = BestMatch(
            statement_comparison_function=levenshtein_distance
        )
        self.adapter.set_chatbot(self.chatbot)

    def test_get_closest_statement(self):
        """
        Note, the content of the in_response_to field for each of the
        test statements is only required because the logic adapter will
        filter out any statements that are not in response to a known statement.
        """
        possible_choices = [
            Statement('Who do you love?', in_response_to=[Response('I hear you are going on a quest?')]),
            Statement('What is the meaning of life?', in_response_to=[Response('Yuck, black licorice jelly beans.')]),
            Statement('I am Iron Man.', in_response_to=[Response('What... is your quest?')]),
            Statement('What... is your quest?', in_response_to=[Response('I am Iron Man.')]),
            Statement('Yuck, black licorice jelly beans.', in_response_to=[Response('What is the meaning of life?')]),
            Statement('I hear you are going on a quest?', in_response_to=[Response('Who do you love?')]),
        ]
        self.adapter.chatbot.storage.filter = MagicMock(return_value=possible_choices)

        statement = Statement('What is your quest?')

        match = self.adapter.get(statement)

        self.assertEqual('What... is your quest?', match)

    def test_confidence_exact_match(self):
        possible_choices = [
            Statement('What is your quest?', in_response_to=[Response('What is your quest?')])
        ]
        self.adapter.chatbot.storage.filter = MagicMock(return_value=possible_choices)

        statement = Statement('What is your quest?')
        match = self.adapter.get(statement)

        self.assertEqual(match.confidence, 1)

    def test_confidence_half_match(self):
        possible_choices = [
            Statement('xxyy', in_response_to=[Response('xxyy')])
        ]
        self.adapter.chatbot.storage.filter = MagicMock(return_value=possible_choices)

        statement = Statement('wwxx')
        match = self.adapter.get(statement)

        self.assertEqual(match.confidence, 0.5)

    def test_confidence_no_match(self):
        possible_choices = [
            Statement('xxx', in_response_to=[Response('xxx')])
        ]
        self.adapter.chatbot.storage.filter = MagicMock(return_value=possible_choices)

        statement = Statement('yyy')
        match = self.adapter.get(statement)

        self.assertEqual(match.confidence, 0)

    def test_no_known_responses(self):
        """
        In the case that a match is selected which has no known responses.
        In this case a random response will be returned, but the confidence
        should be zero because it is a random choice.
        """
        self.adapter.chatbot.storage.update = MagicMock()
        self.adapter.chatbot.storage.count = MagicMock(return_value=1)
        self.adapter.chatbot.storage.get_random = MagicMock(
            return_value=Statement('Random')
        )

        match = self.adapter.process(Statement('Blah'))

        self.assertEqual(match.confidence, 0)
        self.assertEqual(match.text, 'Random')


text:
include_guard(GLOBAL)

if(NOT TARGET Microsoft.GSL::GSL
   AND NOT TARGET gsl::gsl-lite-v1
   AND NOT TARGET gsl::gsl-lite)
  if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
    if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "8")
      include("${ATFRAMEWORK_CMAKE_TOOLSET_DIR}/ports/gsl/ms-gsl.cmake")
    endif()
  elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
    if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "10")
      include("${ATFRAMEWORK_CMAKE_TOOLSET_DIR}/ports/gsl/ms-gsl.cmake")
    endif()
  elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")
    if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "10.3")
      include("${ATFRAMEWORK_CMAKE_TOOLSET_DIR}/ports/gsl/ms-gsl.cmake")
    endif()
  elseif(MSVC)
    if(MSVC_VERSION GREATER_EQUAL 1916)
      include("${ATFRAMEWORK_CMAKE_TOOLSET_DIR}/ports/gsl/ms-gsl.cmake")
    endif()
  endif()

  if(NOT TARGET Microsoft.GSL::GSL)
    include("${ATFRAMEWORK_CMAKE_TOOLSET_DIR}/ports/gsl/gsl-lite.cmake")
  endif()
endif()

if(TARGET Microsoft.GSL::GSL)
  set(LIBATFRAME_UTILS_ENABLE_GSL_WITH_MS_GSL ON)
  list(APPEND PROJECT_ATFRAME_UTILS_PUBLIC_LINK_NAMES Microsoft.GSL::GSL)
endif()

if(TARGET gsl::gsl-lite-v1)
  set(LIBATFRAME_UTILS_ENABLE_GSL_WITH_GSL_LITE ON)
  list(APPEND PROJECT_ATFRAME_UTILS_PUBLIC_LINK_NAMES gsl::gsl-lite-v1)
elseif(TARGET gsl::gsl-lite)
  set(LIBATFRAME_UTILS_ENABLE_GSL_WITH_GSL_LITE ON)
  list(APPEND PROJECT_ATFRAME_UTILS_PUBLIC_LINK_NAMES gsl::gsl-lite)
endif()

set(LIBATFRAME_UTILS_TEST_GSL_SUPPORT_BACKUP_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES ${ATFRAMEWORK_CMAKE_TOOLSET_SYSTEM_LINKS})

check_cxx_source_compiles(
  "
#include <iostream>
#include <string_view>
int main() {
std::string_view unicode[] {\"▀▄─\", \"▄▀─\", \"▀─▄\", \"▄─▀\"};

for (int y{}, p{}; y != 6; ++y, p = ((p + 1) % 4)) {
  for (int x{}; x != 16; ++x)
    std::cout << unicode[p];
  std::cout << std::endl;
}
return 0;
}"
  LIBATFRAME_UTILS_GSL_TEST_STL_STRING_VIEW)

if(NOT TARGET Microsoft.GSL::GSL AND NOT TARGET gsl::gsl-lite)
  check_cxx_source_compiles(
    "
#include <algorithm>
#include <cstddef>
#include <iostream>
#include <span>
template<class T, std::size_t N> [[nodiscard]]
constexpr auto slide(std::span<T,N> s, std::size_t offset, std::size_t width) {
  return s.subspan(offset, offset + width <= s.size() ? width : 0U);
}
int main() {
  constexpr int a[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
  constexpr int b[] { 8, 7, 6 };
  for (std::size_t offset{}; ; ++offset) {
    constexpr std::size_t width{6};
    auto s = slide(std::span{a}, offset, width);
    if (s.empty())
      break;
  }
  return 0;
}"
    LIBATFRAME_UTILS_GSL_TEST_FALLBACK_STL_SPAN)
  check_cxx_source_compiles(
    "
#include <iostream>
#include <cstddef>

int main() {
  std::byte b{42};
  return 0;
}"
    LIBATFRAME_UTILS_GSL_TEST_FALLBACK_STL_BYTE)
  if(LIBATFRAME_UTILS_GSL_TEST_STL_STRING_VIEW AND LIBATFRAME_UTILS_GSL_TEST_FALLBACK_STL_SPAN)
    set(LIBATFRAME_UTILS_ENABLE_GSL_WITH_FALLBACK_STL ON)
  endif()
endif()

set(CMAKE_REQUIRED_LIBRARIES ${LIBATFRAME_UTILS_TEST_GSL_SUPPORT_BACKUP_CMAKE_REQUIRED_LIBRARIES})
unset(LIBATFRAME_UTILS_TEST_GSL_SUPPORT_BACKUP_CMAKE_REQUIRED_LIBRARIES)


text:
using System;
class Program
{
    static void Main()
    {
        int beatsPerMinute = int.Parse(Console.ReadLine());
        int beatsCount = int.Parse(Console.ReadLine());

        decimal time = (decimal)beatsCount / beatsPerMinute * 60;
        decimal minutes = Math.Floor(time / 60);
        decimal secounds = Math.Truncate(time % 60);

        decimal bars = Math.Round((decimal)beatsCount / 4, 1);

        Console.WriteLine("{0} bars - {1}m {2}s", bars, minutes, secounds);
    }
}


text:
#import "PBSegmentationThemes.h"

@implementation PBSegmentationThemes

- (instancetype)init {
  self = [super init];
  if (self) {
    // initialize property's default value, if any

  }
  return self;
}

/**
 * Maps json key to property name.
 * This method is used by `JSONModel`.
 */
+ (JSONKeyMapper *)keyMapper {
  return [[JSONKeyMapper alloc] initWithDictionary:@{ @"lifeStyleTheme": @"lifeStyleTheme" }];
}

/**
 * Indicates whether the property with the given name is optional.
 * If `propertyName` is optional, then return `YES`, otherwise return `NO`.
 * This method is used by `JSONModel`.
 */
+ (BOOL)propertyIsOptional:(NSString *)propertyName {

  NSArray *optionalProperties = @[@"lifeStyleTheme"];
  return [optionalProperties containsObject:propertyName];
}

@end


text:
import time

import numpy as np
import tensorflow as tf

import awesome_gans.image_utils as iu
import awesome_gans.wgan.wgan_model as wgan
from awesome_gans.datasets import CiFarDataSet as DataSet
from awesome_gans.datasets import DataIterator

results = {'output': './gen_img/', 'model': './model/WGAN-model.ckpt'}

train_step = {
    'epochs': 100,
    'batch_size': 64,
    'global_step': 50001,
    'logging_interval': 500,
}

def main():
    start_time = time.time()  # Clocking start

    # Loading Cifar-10 DataSet
    ds = DataSet(height=32, width=32, channel=3, ds_path="D:/DataSet/cifar/cifar-10-batches-py/", ds_name='cifar-10')

    ds_iter = DataIterator(
        x=iu.transform(ds.train_images, '127'), y=ds.train_labels, batch_size=train_step['batch_size'], label_off=True
    )  # using label # maybe someday, i'll change this param's name

    # Generated image save
    test_images = iu.transform(ds.test_images[:100], inv_type='127')
    iu.save_images(test_images, size=[10, 10], image_path=results['output'] + 'sample.png', inv_type='127')

    # GPU configure
    config = tf.ConfigProto()
    config.gpu_options.allow_growth = True

    with tf.Session(config=config) as s:
        # WGAN Model
        model = wgan.WGAN(
            s, batch_size=train_step['batch_size'], height=32, width=32, channel=3, enable_gp=True
        )  # WGAN-GP

        # Initializing
        s.run(tf.global_variables_initializer())

        # Load model & Graph & Weights
        saved_global_step = 0
        ckpt = tf.train.get_checkpoint_state('./model/')
        if ckpt and ckpt.model_checkpoint_path:
            model.saver.restore(s, ckpt.model_checkpoint_path)

            saved_global_step = int(ckpt.model_checkpoint_path.split('/')[-1].split('-')[-1])
            print("[+] global step : %s" % saved_global_step, " successfully loaded")
        else:
            print('[-] No checkpoint file found')

        global_step = saved_global_step
        start_epoch = global_step // (len(ds.train_images) // model.batch_size)  # recover n_epoch
        ds_iter.pointer = saved_global_step % (len(ds.train_images) // model.batch_size)  # recover n_iter
        for epoch in range(start_epoch, train_step['epochs']):
            for _ in range(ds_iter.num_batches):
                # Update critic
                model.critic = 5
                if global_step % 500 == 0 or global_step < 25:
                    model.critic = 100
                if model.EnableGP:
                    model.critic = 1

                for _ in range(model.critic):
                    batch_x = ds_iter.next_batch()
                    batch_z = np.random.uniform(-1.0, 1.0, [model.batch_size, model.z_dim]).astype(np.float32)

                    # Update d_clip
                    if not model.EnableGP:
                        s.run(model.d_clip)

                    # Update D network
                    _, d_loss = s.run(
                        [model.d_op, model.d_loss],
                        feed_dict={
                            model.x: batch_x,
                            model.z: batch_z,
                        },
                    )

                batch_x = ds_iter.next_batch()
                batch_z = np.random.uniform(-1.0, 1.0, [model.batch_size, model.z_dim]).astype(np.float32)

                # Update G network
                _, g_loss = s.run(
                    [model.g_op, model.g_loss],
                    feed_dict={
                        model.x: batch_x,
                        model.z: batch_z,
                    },
                )

                # Logging
                if global_step % train_step['logging_interval'] == 0:
                    summary = s.run(
                        model.merged,
                        feed_dict={
                            model.x: batch_x,
                            model.z: batch_z,
                        },
                    )

                    # Print loss
                    print(
                        "[+] Epoch %04d Step %08d => " % (epoch, global_step),
                        " D loss : {:.8f}".format(d_loss),
                        " G loss : {:.8f}".format(g_loss),
                    )

                    # Training G model with sample image and noise
                    sample_z = np.random.uniform(-1.0, 1.0, [model.sample_num, model.z_dim]).astype(np.float32)
                    samples = s.run(
                        model.g,
                        feed_dict={
                            model.z: sample_z,
                        },
                    )

                    # Summary saver
                    model.writer.add_summary(summary, global_step)

                    # Export image generated by model G
                    sample_image_height = model.sample_size
                    sample_image_width = model.sample_size
                    sample_dir = results['output'] + 'train_{:08d}.png'.format(global_step)

                    # Generated image save
                    iu.save_images(
                        samples, size=[sample_image_height, sample_image_width], image_path=sample_dir, inv_type='127'
                    )

                    # Model save
                    model.saver.save(s, results['model'], global_step)

                global_step += 1

    end_time = time.time() - start_time  # Clocking end

    # Elapsed time
    print("[+] Elapsed time {:.8f}s".format(end_time))

    # Close tf.Session
    s.close()

if __name__ == '__main__':
    main()


text:
<?php

namespace Grav\Common\Page\Medium;

use Grav\Common\Markdown\Parsedown;
use Grav\Common\Page\Markdown\Excerpts;

/**
 * Trait ParsedownHtmlTrait
 * @package Grav\Common\Page\Medium
 */
trait ParsedownHtmlTrait
{
    /** @var Parsedown|null */
    protected $parsedown;

    /**
     * Return HTML markup from the medium.
     *
     * @param string|null $title
     * @param string|null $alt
     * @param string|null $class
     * @param string|null $id
     * @param bool $reset
     * @return string
     */
    public function html($title = null, $alt = null, $class = null, $id = null, $reset = true)
    {
        $element = $this->parsedownElement($title, $alt, $class, $id, $reset);

        if (!$this->parsedown) {
            $this->parsedown = new Parsedown(new Excerpts());
        }

        return $this->parsedown->elementToHtml($element);
    }
}


text:
Edit `now.staging.json` to include `DEBUG`

```diff
{
    "env": {
+     "DEBUG": "agenda:*"
    }
}
```

You can throw up a UI to the db using:

```sh
echo "http://localhost:3001"; npx agendash --db=[get this from .env] --collection=agendaJobs --port=3001
```

## How to debug hyper runs

For staging:

```sh
hyper func inspect peril-staging
```

To get the ENV, and set debug to true:

```sh
hyper func update  --env PERIL_BOT_USER_ID=34651588 --env DEBUG=* peril-staging
```


text:
Title: The Age of Paine by Jon Katz
Slug: aboutpaine/the-age-of-paine-by-jon-katz
Date: Mon Aug  4 09:08:53 EDT 2014

   This article first appeared in Wired Magazine in 1995.

   Thomas Paine was one of the first journalists to use media as a weapon
   against the entrenched power structure. He should be resurrected as the
   moral father of the Internet. Jon Katz explains why.

   By Jon Katz

   If any father has been forsaken by his children, it is Thomas Paine.
   Statues of the man should greet incoming journalism students; his words
   should be chiseled above newsroom doors and taped to laptops, guiding the
   communications media through their many travails, controversies, and
   challenges. Yet Paine, a fuzzy historical figure of the 1700s, is
   remembered mostly for one or two sparkling patriotic quotes - "These are
   the times that try men's souls" - and little else. Thomas Paine,
   professional revolutionary, was one of the first to use media as a
   powerful weapon against an entrenched array of monarchies, feudal lords,
   dictators, and repressive social structures. He invented contemporary
   political journalism, creating almost by himself a mass reading-public
   aware for the first time of its right to encounter controversial opinions
   and to participate in politics.

   Between his birth in 1737 and his death in 1809, enormous political
   upheavals turned the Western world upside down - and Paine was in the
   middle of the biggest ones. His writings put his life at risk in every
   country he lived in - in America for rebellion, in England for sedition,
   in France for his insistence on a merciful and democratic revolution. At
   the end of his life, he was shunned by the country he helped create,
   reviled as an infidel, forced to beg friends for money, denied the right
   to vote, refused burial in a Quaker cemetery. His grave was desecrated,
   his remains were stolen.

   A popular old nursery rhyme about Paine could just as easily be sung
   today:
   Poor Tom Paine! there he lies:
   Nobody laughs and nobody cries.
   Where he has gone or how he fares
   Nobody knows and nobody cares.

   Certainly that's true of the media. The modern-day press has forgotten
   this brilliant, lonely, socially awkward progenitor, who pioneered the
   concept of the uncensored flow of ideas, and developed a new kind of
   communications in the service of the then-radical proposition that people
   should control their own lives.

   In this country, his memory has been tended by a few determined academics
   and historians and a stubborn little historical society in New Rochelle,
   New York, where he spent a good deal of his final, impoverished days.

   So what?

   We've all been numbed by drowsy history-book pedagogy about founders,
   patriots, and dusty historical heroes. If journalism and the rest of the
   country have forgotten Paine, why should we remember another of history's
   lost souls?

   Because we owe Paine. He is our dead and silenced ancestor. He made us
   possible. We need to resurrect and hear him again, not for his sake but
   for ours. We need to know who he was, to understand his life and work, in
   order to comprehend our own revolutionary culture. Paine's odyssey made
   him the greatest media figure of his time, one of the unseen but profound
   influencers of ours. He made more noise in the information world than any
   messenger or pilgrim before or since. His mark is now nearly invisible in
   the old culture, but his spirit is woven through and through this new one,
   his fingerprints on every Web site, his voice in every online thread.

   If the old media (newspapers, magazines, radio, and television) have
   abandoned their father, the new media (computers, cable, and the Internet)
   can and should adopt him. If the press has lost contact with its spiritual
   and ideological roots, the new media culture can claim them as its own.

   For Paine does have a legacy, a place where his values prosper and are
   validated millions of times a day: the Internet. There, his ideas about
   communications, media ethics, the universal connections between people,
   and the free flow of honest opinion are all relevant again, visible every
   time one modem shakes hands with another.

   Tom Paine's ideas, the example he set of free expression, the sacrifices
   he made to preserve the integrity of his work, are being resuscitated by
   means that hadn't existed or been imagined in his day - via the blinking
   cursors, clacking keyboards, hissing modems, bits and bytes of another
   revolution, the digital one. If Paine's vision was aborted by the new
   technologies of the last century, newer technology has brought his vision
   full circle. If his values no longer have much relevance for conventional
   journalism, they fit the Net like a glove.

   The Net offers what Paine and his revolutionary colleagues hoped for - a
   vast, diverse, passionate, global means of transmitting ideas and opening
   minds. That was part of the political transformation he envisioned when he
   wrote, "We have it in our power to begin the world over again." Through
   media, he believed, "we see with other eyes; we hear with other ears; and
   think with other thoughts, than those we formerly used."

   His writing is infused with the sense - especially relevant now as the
   digital culture spreads across the world - that a new age was about to
   burst open all around him. This would be an unmistakable, great awakening,
   even if it came in stages. Instead of seeing a single bud on a winter
   tree, he wrote, "I should instantly conclude that the same appearance was
   beginning, or about to begin, everywhere; and though the vegetable sleep
   will continue longer on some trees and plants than on others, and though
   some of them may not blossom for two or three years, all will be in leaf
   in the summer, except those which are rotten." It is not difficult to
   perceive, he wrote, "that the spring is begun."

   Paine's life and the birth of the American press prove that information
   media, taken together, were never meant, collectively, to be just another
   industry. Information wants to be free. That was the familiar and
   inspiring moral imperative behind the medium imagined by Paine and Thomas
   Jefferson. Media existed to spread ideas, to allow fearless argument, to
   challenge and question authority, to set a common social agenda.

   Asked about the reasons for new media, Paine would have answered in a
   flash: to advance human rights, spread democracy, ease suffering, pester
   government. Modern journalists would have a much rougher time with the
   question. There is no longer widespread consensus, among practitioners or
   consumers, about journalism's practices and its goals.

   Of course, the ferociously spirited press of the late 1700s that Paine
   helped invent differed from the institution we know today. It was
   dominated by individuals expressing their opinions. The idea that ordinary
   citizens with no special resources, expertise, or political power - like
   Paine himself - could sound off, reach wide audiences, even spark
   revolutions, was brand-new to the world. In Paine's wake, writes Gordon
   Wood in The Radicalism of the American Revolution, "every conceivable form
   of printed matter - books, pamphlets, handbills, posters, broadsides, and
   especially newspapers - multiplied and were now written and read by many
   more ordinary people than ever before in history."

   Never skilled in business, Paine failed to foresee how fragile and easily
   overwhelmed these values and forms of expression would be when they
   collided with free-market economics. The rotary press and other printing
   technologies that later made it possible to mass-market newspapers also
   led publishers to make newspapers tamer and more moderate so their many
   new customers wouldn't be offended. Big, expensive printing presses
   churning out thousands of copies meant opinionated private citizens like
   Paine could no longer afford to own or have direct access to media, and
   journalism couldn't afford to give voice to opinionated private citizens.

   Paine once warned a Philadelphia newspaper editor about the distinction
   between editorial power and the freedom of the press. It was a caution
   neither the editor nor his increasingly wealthy and powerful successors
   took to heart: "If the freedom of the press is to be determined by the
   judgment of the printer of a Newspaper in preference to that of the
   people, who when they read will judge for themselves, then freedom is on a
   very sandy foundation."

   So it is. Paine's worst fear was echoed more than 150 years later by
   critic A.J. Liebling, who wryly observed: "In America, freedom of the
   press is largely reserved for those who own one." Almost everyone else has
   been shut out. But media history is being reversed. With computers and
   modems, individuals are pouring back in. The people who own the presses
   still have enormous power, but every day, very much against their will,
   they're facing a dread reality: they're going to have to learn to share.

   The people running the traditional media are in a state of near panic at
   this competition, at the fragmentation of an audience they once
   monopolized. In their search for answers, they seem to be looking at
   everything save what's most important: values. Although journalism
   presumes great and lofty purpose, it has grown preoccupied with ratings,
   market penetration, stockholders, cultural demographics, and bottom lines.
   Almost overwhelmingly owned and run by corporations and business sharks
   with turnips for hearts and market research for ideology, the press is
   disconnected and resented. One opinion survey after another confirms
   pervasive public mistrust.

   Like the specters introduced by the Ghost of Christmas Future, today's
   media are what the Net should never become - but will surely evolve into
   if it fails to develop, articulate, fight fiercely for, and maintain a
   value system other than expanded memory, whiz-bang toys, and money. The
   digital age is young, ascending, diverse, already nearly as arrogant, and,
   in parts, as greedy as the mass media it is supplanting. The new
   generation faces enormous danger from government, from corporations that
   control the traditional media, from commercialization, and from its own
   chaotic growth.

   Thomas Paine is a guide, the conscience that can prompt new media to
   remember the past chiefly in order not to repeat it.

   He often introduced his most controversial ideas formally and courteously,
   writing, for example, The following notion is put under your protection.
   You will do us the justice to remember that he who denies the right of
   every man or woman to his own opinion makes a slave of them, because he
   precludes their right of changing their own minds.

   This notion is put under your protection, too: The Internet is Thomas
   Paine's bastard child. Thomas Paine should be our hero.

   The sad part of Paine's story is that it's necessary to pause here and
   tell it to those who may never have heard it.

   He lived a life that would make the cheesiest Hollywood screenwriter blush
   in frustration. He was born in England. He ran away from home to sail as a
   pirate, then worked as a staymaker and matched wits with smugglers as a
   customs collector. He lobbied Parliament for better pay for himself and
   fellow customs collectors. He lost his job but met Benjamin Franklin, who
   urged him to move to America, and who became a lifelong pen pal.

   One of the regulars at Independence Hall, Paine was a philosophical soul
   mate of Thomas Jefferson. He fought and froze with his buddy George
   Washington at Valley Forge. King George III badly wanted to hang Paine
   because he helped touch off the American Revolution with his writings, but
   got the chance to try him for sedition after Paine had the gall to return
   to England and lobby for an end to the monarchy.

   Paine fled to France, where the bloodthirstier leaders of the French
   Revolution ordered him killed because he urged leniency for the members of
   the overthrown regime and because they feared he would alert Americans to
   the increasingly undemocratic Gallic uprising. Clergymen all over the
   world cursed him for his heretical religious views. Businessmen despised
   him even more for his radical views about labor.

   In between was high drama, great daring, narrow scrapes - wandering
   revolutionary war battlefields dodging British bullets, fleeing England 20
   minutes ahead of warrants ordering his arrest, coming within hours of
   being guillotined in Paris. Paine seemed to live most happily in boiling
   water.

   The Big Concept man of his time, his deep ideas still resonate: An end to
   monarchies and dictatorships. American independence from England, of
   course. International federations to promote development and maintain
   peace. Rights and protections for laborers. An end to slavery. Equal
   rights for women. Redistribution of land. Organized religion was a cruel
   and corrupt hoax. Public education, public employment, assistance for the
   poor, pensions for the elderly. And above all, a fearless press that tells
   the truth, gives voice to individual citizens, tolerates opposing points
   of view, transcends provincialism, is accessible to the poor as well as
   the rich.

   He was as astonishingly productive as he must have been obnoxious,
   mouthing off about everything from yellow fever to iron bridge
   construction. Although he wrote countless articles and pamphlets during
   his life, his core works are four powerful, sometimes beautifully written,
   flaming-with-indignation essays. Common Sense, an argument for
   independence, helped spark the American Revolution. Rights of Man, an
   essay written in support of the French Revolution, attacks hereditary
   monarchies and called for universal democracy and human rights. The Age of
   Reason challenges the logic behind organized religion's grip on much of
   the Western world, and Agrarian Justice calls for radical reforms in the
   world economy, especially in land ownership. The first three constitute
   the three bestselling works of the 18th century.

   It is almost impossible, today, to imagine the overwhelming impact of
   Common Sense.

   Paine arrived in Philadelphia in 1774 at the age of 37 with little more
   than a letter of reference from Franklin. He rented a room and landed a
   job as executive editor of a new publication called Pennsylvania Magazine.
   In January of 1776, Common Sense went on sale for two shillings.

   Historian Gregory Claeys, in Thomas Paine, Social and Political Thought,
   quotes one colonial observer who described Common Sense as bursting forth
   "like a mighty conqueror bearing down all opposition." It became America's
   first bestseller, with more than 120,000 copies sold in its first three
   months, and possibly as many as half a million in its first year - this in
   a country whose population was 3 million. Newspapers, then crammed with
   controversial viewpoints, scrambled to reprint it. Common people quoted it
   to one another.

   It had, wrote a contemporary historian, "produced most astonishing
   effects; and been received with vast applause, read by almost every
   American; and recommended as a work replete with truth." It was nicely
   written, too, one of the first and most dramatic of the anthems and
   call-to-arms that run through Paine's writing. The cause of America, wrote
   Paine, was the cause of all mankind. "O! ye that love mankind! Ye that
   dare oppose not only the tyranny but the tyrant, stand forth! Every spot
   of the old world is overrun with oppression. Freedom hath been hunted
   round the globe. Asia and Africa have long expelled her. Europe regards
   her like a stranger, and England hath given her warning to depart. O!
   receive the fugitive, and prepare in time an asylum for mankind."

   How Paine, poorly educated and inexperienced as a writer, came to produce
   such a work remains a historical puzzle. American historians have
   traditionally advanced the idea that Paine, who already hated the British
   ruling classes and had been disillusioned in his battle to improve working
   conditions for his fellow customs collectors in England, needed only to
   step onshore and catch the revolutionary fever raging all around for his
   literary gifts to ignite.

   But Paine's democratic republicanism had deep British roots. He might have
   been influenced by some of the world's earliest, least-known and best
   political journalists, such as the late 17th-century pamphleteers Sir
   William Molesworth and Walter Moyle. But such high-brow English
   republicans had no notions of democracy or universal suffrage - not to
   mention representative government, which they considered anarchic and
   dangerous. Those were Paine's additions. He broadened his definitions of
   "the people" to include laborers, slaves, women, fishermen, and artisans.
   Paine's journalistic writings about these new notions of democracy in
   Common Sense, wrote Jefferson, "rendered useless almost everything written
   before on the structures of government."

   Were Paine to enjoy in 1995 the kind of literary success he had in his
   day, he would earn millions in royalties, rights, and speaking fees. But
   Paine didn't earn a shilling from the book. He paid the cost of
   publication for one edition - 30 pounds - himself, then donated the
   copyright and all royalties to the colonists' struggle for independence.
   Royalties would make his work more expensive, he feared, and thus less
   accessible. It's tough to imagine Paine's words coming out of some
   Washington journalist's mouth today: "As my wish was to serve an oppressed
   people, and assist in a just and good cause, I conceived that the honor of
   it would be promoted by my declining to make even the usual profits of an
   author, by the publication (of Common Sense) ... and there I gave up the
   profits of the first edition" - to be disposed of, he stipulated, "in any
   public service or private charity." This idea cost him, in the most
   literal sense: Paine was impoverished for much of his life.

   Paintings of Washington ferrying his troops across the Delaware have bored
   schoolchildren for 200 years. Kids might have more interest if they could
   see Paine's ghost hovering in the background. In 1776, the Colonial Army
   was virtually defeated, its dispirited troops freezing and starving
   outside Philadelphia. Even the most die-hard revolutionaries were giving
   up. Then Paine started cranking out a series of pamphlets called "The
   American Crisis."

   At dusk on Christmas Day, a desperate George Washington ordered what
   remained of his hungry, ill-equipped army - the snow was spotted red from
   their bleeding bare feet - to gather into small squads and listen as their
   officers read them excerpts from Paine's latest rant. In countless letters
   and diaries, the soldiers were later to recount how many of them wept when
   they heard what Paine wrote. They found in his now-famous words the
   strength to continue: "These are the times that try men's souls. The
   summer soldier and the sunshine patriot will, in this crisis, shrink from
   the service of their country; but he that stands it now, deserves the love
   and thanks of man and woman. Tyranny, like hell, is not easily conquered;
   yet we have this consolation with us, that the harder the conflict, the
   more glorious the triumph."

   That night, crossing the river through a storm of hail and sleet,
   Washington's army surprised and defeated the mercenaries occupying
   Trenton. The victory is considered one of the major turning points in the
   war.

   If it sounds like a fairy tale from another world, it was. But it pales
   next to the fairy tale that our world would seem to him. We can conceive
   and transmit ideas and send them all over the world in seconds. We can
   leave them and store them for others to see and answer. But for Paine,
   moving an idea from one place to another at all was a spiritual notion, a
   miraculous vision. He imagined a global means of communication, one in
   which the boundaries between the sender and receiver were cleared away.

   Such freedom was, to Paine, one of the fundamental rights of mankind. And
   it was the essence of media. He shared this notion most intensely with his
   cohort Thomas Jefferson. The two corresponded constantly about how ideas
   were conceived and distributed.

   Their foresight and their relevance to the promise of the Net was captured
   by Jefferson when he wrote: "That ideas should spread freely from one to
   another over the globe, for the moral and mutual instruction of man, and
   improvement of his condition, seems to have been peculiarly and
   benevolently designed by nature, when she made them, like fire, expansible
   over all space, without lessening their density at any point, and like the
   air in which we breathe, move, and have our physical being, incapable of
   confinement or exclusive appropriation. Inventions then cannot, in nature,
   be a subject of property."

   Herewith, to be put under your protection, some of the more striking
   connections between the Net and its rightful intellectual father.

   Paine called for a "universal society," one whose citizens transcend their
   narrow interests and consider humankind as one entity. "My country is the
   world," he wrote. The Internet has, in fact, redefined citizenship as well
   as communications. It is the first worldwide medium in which people can
   communicate so directly, so quickly, so personally, and so reliably. In
   which they can form distant but diverse and cohesive communities, send,
   receive, and store vast amounts of textual and graphic information, skip
   without paperwork or permission across borders. Where computers are
   plentiful, digital communications are nearly uncensorable. This reality
   gives our moral and media guardians fits; they still tend to portray the
   computer culture as an out-of-control menace harboring perverts, hackers,
   pornographers, and thieves. But Paine would have known better. The
   political, economic, and social implications of an interconnected global
   medium are enormous, making plausible Paine's belief in the "universal
   citizen."

   He would recognize its style and language, too. Paine believed that
   journalists should write in a short, spare, unadorned language that
   everyone could understand. He was the first modern political writer to
   experiment with the art of writing democratically and for democratic ends,
   writes John Keane in Tom Paine: A Political Life (the newest and perhaps
   best of the Paine biographies). Paine hammered out his own colloquial
   style that eschewed "purple passages, sentences without meaning, and
   general humbug" because he considered it the highest duty of political
   writers to irritate their country's government.

   Reading Paine is eerie after spending time online and in political
   conferences on The Well, say, or after poring through the most provocative
   BBS postings. From reasoned arguments to raging flames to the staccato
   shorthand (LOL, IMHO) of countless e-mailers, digital communications are
   spare, blunt, economical, and efficient. Paine's style is the style of the
   Internet; his succinct voice and language could slip comfortably into its
   debates and discussions.

   Paine would understand, too, the loner at the heart of computer lore. Many
   of the teenagers, academics, and visionaries who pioneered the computer
   culture see themselves, and have been seen by others, as nerds or misfits
   - outcasts alone in their labs, bedrooms, or garages.

   Paine met with, corresponded with, and plotted with and against some of
   the most powerful people of his time, from George Washington to Napoleon.
   But he never partied at Mount Vernon or Fontainebleau and he has never
   joined the gallery of heroes whose statues adorn Washington's marble
   halls. He saw the world with agonizing clarity, but never figured out how
   to live comfortably in it.

   His rare social appearances were uncomfortable. He never danced or joked
   much, and he dressed frumpily and simply in an era of frilly pomp. He
   never spoke or wrote about the worst personal tragedy in his life, the
   death in childbirth of his first wife, Mary Lambert, and their child.
   Friends claimed Paine seemed to hold himself responsible for the deaths in
   some way. His second marriage was brief and unhappy. For the rest of his
   life, he was an unyielding ascetic, one of the earliest supporters of
   women's rights but an asexual man who spent most of his time around men.
   He seemed lost without a repressive regime to undermine, disconnected if
   the conversation didn't revolve around politics. He hated small talk. A
   friend described him at one party as a "solitary character walking among
   the artificial bowers in the gardens." Paine, said the friend, "retired
   frequently from company to analyze his thoughts and to enjoy the repast of
   his own original ideas." He seemed at ease only when writing and railing
   against various forms of tyranny.

   Where would Tom Paine go today for some serious rabble-rousing?

   To get any real attention on TV or in the papers, he'd have to march,
   blockade, or burn something. Maybe he would try to get through to a radio
   talk show or Larry King Live. But if he had a computer and a modem, he
   could instantly spread his message. Anyone online can recognize the idea -
   suddenly in circulation again - of countless ordinary people participating
   in public opinion, their ideas "expansible all over space."

   Net culture, as it happens, is an even greater medium for individual
   expression than the pamphlets cranked by hand presses in colonial America.
   It swarms with the young and the outspoken. Its bulletin boards,
   conferencing systems, mailing structures, and Web sites are crammed with
   political organizations, academics, and ordinary citizens posting
   messages, raising questions, sharing information, offering arguments,
   changing minds. From thousands of newsgroups to the vast public-opinion
   forums growing on giant bulletin boards, the Internet would give the old
   hell raiser's unhappy spirit a place to rest.

   Cyberspace, not mainstream media, would be Paine's home now. Commentary
   has virtually vanished from TV, and the liveliest newspaper Op-Ed pages
   are tepid compared to Paine's tirades. But online, millions of messages
   centering on the country's civic discourse are posted daily, in forums
   teeming with the kind of vigorous democratic debate and discussion that
   Paine and his fellow pamphleteers had in mind. Gun owners talk to gun
   haters, people in favor of abortion message people who think abortion is
   murder, journalists have to explain their stories to readers, and
   prosecution and defense strategies in the O.J. Simpson trial are thrashed
   out.

   If Paine would feel at home there, he would also fight to protect this
   nascent medium. Learning what had happened to the media he founded as
   corporations moved in, he would spot commercialization as Danger Number
   One. He believed in a press that was not monopolistic but filled, as it
   was in his time, with individual voices; one that was cheap, accessible,
   fiercely outspoken. He believed that media like the Net - many citizens
   talking to many other citizens - were essential to free government.

   He was right: journalism's exclusion of outside voices and fear of
   publishing any but moderate opinions has made it difficult for the country
   to come to grips with some of its most sensitive issues - race, gender,
   and violence. Media overwhelmed and monopolized by large corporations,
   inaccessible to individual people and motivated primarily by profit, is
   the antithesis of Paine's life, his work, and his vision for the press.

   We could use his clear direction at a time when mainstream journalists are
   losing their ethical grounding. Some of the most visible reporters accept
   fat speaking fees from lobbyists and associations whose issues they often
   cover. They accept money to appear on quasi-entertainment panels where
   they pretend to be passionate and argue the issues of the day.

   Paine would never appear on talk shows or garner fat speaking fees. At one
   point during the Revolutionary War - when he was completely broke, as
   usual - he was offered a thousand pounds a year by the French government
   to write and publish articles in support of the Franco-American alliance
   against Britain. He said no. He told friends that the principle at stake -
   a political writer's ability to express opinions free of any party's or
   government's taint - was sacred, even if it meant being a pauper. And for
   him, it did.

   During his life, his value system remained intact. Shortly before he died,
   bedridden, penniless, and mostly alone, he fired off a note to an editor
   in New York City who had messed with the outspoken prose in one of Paine's
   final essays for the American Citizen.

   "I, sir," Paine wrote, "never permit any- one to alter anything that I
   write; you have spoiled the whole sense that it was meant to convey on the
   subject."

   His deathbed scene was perhaps the greatest example of Paine's refusal to
   compromise.

   Lapsing into unconsciousness, in agony from gangrenous bedsores, Paine
   woke occasionally to cry "Oh, Lord help me! Oh, Lord help me!" Convinced
   that Paine's time on earth was nearly up, a physician and pastor named
   Manley took advantage of one of Paine's last lucid moments to try to save
   his soul. "Allow me to ask again," Manley inquired, "Do you believe - or
   let me qualify the question, Do you wish to believe that Jesus Christ is
   the son of God?"

   Incapable of acquiescence, even when it might have provided him some
   comfort, Paine uttered his quiet last words: "I have no wish to believe on
   that subject." Small wonder one colonial wrote of him: "The name is
   enough. Every person has ideas of him. Some respect his genius and dread
   the man. Some reverence his political, while they hate his religious,
   opinions. Some love the man, but not his private manners. Indeed he has
   done nothing which has not extremes in it. He never appears but we love
   and hate him. He is as great a paradox as ever appeared in human nature."

   It's easy to imagine Paine as a citizen of the new culture, issuing his
   fervent harangues from http://www.commonsense.com. He would be a cyber
   hell raiser, a net.fiend.

   Picture him logging on from the small brown wooden cottage still standing
   on his New Rochelle farm - the one given him by New York State in
   appreciation of his services during the Revolutionary War. He would get up
   late, as always, breakfast on his customary tea, milk, and fruit. The six
   chairs downstairs would be piled high with pamphlets, magazines,
   printouts, discs, letters, papers, tracts, and research. Technologically
   challenged, Paine would have an older Macintosh he'd be loathe to replace.
   A friend would have given him the screen saver with the flying toasters,
   which he would scoff at as frivolous but love dearly. Friends, surely,
   would also have given him a PowerBook to write on when he had to retreat
   to his sick bed.

   He might belong to contentious conferencing systems like The Well or Echo,
   but he would especially love cruising the more populist big boards -
   Prodigy, CompuServe, America Online. He would check into Time Online's
   message boards and tear into Republicans and Democrats daily. He would
   e-mail the New England Journal of Medicine his tracts on the spread of
   disease, and pepper Scientific American's home page with his ideas about
   bridges.

   He would bombard Congress and the White House Internet site with
   proposals, reforms, and legislative initiatives, tackling the most
   explosive subjects head-on, enraging - at one time or another - everybody.

   The Net would help enormously in his various campaigns, allowing him to
   call up research papers, download his latest tract, fire off hundreds of
   angry posts, and receive hundreds of replies.

   They would hear from him soon enough in China and Iran, Croatia and
   Rwanda. He would not be happy to find a Royal Family still reigning in
   England, but he would be relieved to see George III's heirs reduced to
   tabloid fodder. And he'd delight in seeing France a republic after all. He
   would emit nuclear flames from time to time, their recipients emerging
   singed and sooty. He would not use smileys. He would be flamed incessantly
   in turn.

   He would be spared the excruciating loneliness he faced in later life on
   that modest farm, where neighbors shunned him, where visitors rarely came,
   and where he pored over newspapers for any news of his former friends'
   lives. No longer an outcast, thanks to the Net, he would find at least as
   many kindred spirits as adversaries; his cyber mailbox would be eternally
   full.

   It is here, perhaps, that the gap between Paine's tradition and modern
   journalism seems the most poignant and stark. Journalism no longer seems
   to function as a community. Since it no longer shares a definable value
   system - a sense of outsiderness, a commitment to truth-telling, an
   inspiring ethical structure - journalists seem increasingly disconnected
   from one another as well as from the public.

   Online, feuds rage and people storm at one another, but the vast digital
   news and information world contains many distinct communities. On bulletin
   boards and conferencing systems, there is already a moving and richly
   documented tradition of rushing to one another's assistance, of viewing
   oneself as part of a collective culture. In America's media capitals - New
   York, Washington, and LA - there seems to be no such sense of common
   ground.

   Paine in particular might not find much friendship from other journalists.
   He would hate Manhattan media movers and shun them like the plague.

   Paine would greatly prefer the chat room to the cocktail party. His
   notions of spare, direct writing would work beautifully on the Net,
   permitting him productivity and an audience even after his gout made
   traveling difficult. He would find himself, in fact, embarking on his
   greatest dream, to become a member of a "universal society, whose mind
   rises above the atmosphere of local thoughts and considers mankind, of
   whatever nation or profession they may be, as the work of one Creator."

   Life might be easier for him, but it would not be easy. Intense personal
   relationships would still elude him, but he seems a good candidate for one
   of those online romances that flourish all across cyberspace. Like some of
   his Net successors, his social skills were not substantial. He would still
   be reclusive and moody, too offensive to have dinner with Bill and
   Hillary, too combative to be lionized by academia, and too ornery to get
   hired by major media outlets. He would probably find most of today's
   newspapers unbearably bland and write angry letters to editors canceling
   his subscriptions.

   He and the massing corporate entities drooling over the Net would be
   instantly and ferociously at war as he recognized Time Warner, TCI, the
   Baby Bells, and Viacom as different incarnations of the same elements that
   scarfed up the press and homogenized it. He'd have lots to say about the
   so-called information highway and the government's alleged role in shaping
   it. One of his pamphlets - this may be the only thing he'd have in common
   with Newt Gingrich - would surely propose means of getting more computers
   and modems into the hands of people who can't afford them.

   Instead of dying alone and in agony, Paine would spend his last days
   sending poignant e-mail all over the world from his deathbed via his
   PowerBook, arranging for his digital wake. He'd call for more humane
   treatment for the dying. He'd journal online about the shortcomings of
   medicine and the mystical experience of aging, while digging into his
   inexhaustible supply of prescriptions for the incalculable injustices that
   still afflict the world.

   I know not whether any Man in the World has had more influence on its
   inhabitants or affairs for the last thirty years than Tom Paine," John
   Adams wrote to a friend after Paine's death in 1809, "for such a mongrel
   between Pigg and Puppy, begotten by a wild Boar on a Bitch Wolf, never
   before in any Age of the World was suffered by the Poltroonery of mankind,
   to run through such a career of mischief. Call it then the Age of Paine."

   It's odd that so spectacular a force of media and political nature should
   be so vaguely remembered. Unfortunately for Paine, the historian Crane
   Brinton reminds us, revolutionaries need to die young or turn conservative
   in order not to lose favor with society. Paine did neither and fell from
   grace. Many of his reform programs will remain unacceptable to political
   conservatives and his religious views will always offend believing
   Christians. Though his memory is invoked from time to time, his
   resurrection will never be complete.

   At the moment, though, he is showing signs of minor resurgence. In 1994,
   officials in Washington, DC, were considering funding a monument to him
   somewhere. And Sir Richard Attenborough, the famed British actor and
   director, has been struggling for several years to get studio backing for
   a film about Paine.

   A Paine bio - featuring two bloody revolutions, standoffs with Napoleon,
   tangles with the British royals, and cameo roles for Washington,
   Jefferson, Robespierre, and his nemesis George III - would make a socko TV
   miniseries, too. Nigel Hawthorne could play Paine's father, who
   intercepted his runaway teenage son in 1756 as he was about to board the
   Terrible, a privateer captained by a man named William Death. Heeding his
   father's desperate plea, Paine didn't sail. Shortly afterward, the
   Terrible was engaged by a French privateer, the Vengeance, and was
   horribly mauled. More than 150 members of its crew were killed, including
   Captain Death and all but one of his officers.

   Anthony Hopkins could star in Rights of Man, playing the role of the
   Honourable Spencer Perceval, who stood up at the Guildhall in London to
   read out the sedition charges against the absent Paine in 1792 and accuse
   him of being "wicked, malicious, and ill-disposed."

   And imagine the scene of his near-execution. Paine went to France after
   the Revolutionary War as a hero and supporter of democratization there.
   But the French Revolution was far bloodier and more violent than the
   American. Paine tried to save King Louis XVI's life and pleaded with the
   country's new rulers to be merciful and democratic. Eventually, he was
   imprisoned and sentenced to death. In June 1794, six months into his
   harrowing imprisonment, watching as hundreds of fellow prisoners were led
   off to be killed, Paine fell into a feverish semiconsciousness. His fellow
   cellmates barely kept him alive, mopping his brow, feeding him soup, and
   changing his clothes.

   The prison governors were ordered to send him to the guillotine the next
   morning. At 6 a.m., a turnkey carrying Paine's death warrant walked
   quietly down the prison corridors, chalking the cell doors of the
   condemned, marking the number 4 on the inside of Paine's door. Usually the
   turnkey marked the outside of the door, but Paine was seriously ill, and
   his cellmates had been granted permission to leave the door open so that a
   breeze could help cool Paine's profusely sweating body. That evening, the
   weather cooled, and Paine's cellmates asked a different turnkey for
   permission to close the door. Knowing that the number on the door was now
   inward, the occupants of the cell waited, Paine murmuring on his cot. Near
   midnight, the death squad slowly made its way down the corridor, keys
   jangling, pistols drawn. One of his friends cupped his hand over Paine's
   mouth. The squad paused, then moved on to the next cell.

   A few days later, the Jacobin government was overthrown. A fellow prisoner
   said Paine had struggled to keep his democratic values alive in prison.
   "He was the confidant of the unhappy, the counselor of the perplexed; and
   to his sympathizing friendship many a devoted victim in the hour of death
   confided the last cares of humanity; and the last wishes of tenderness."

   Despite his close call, Paine stayed in France until 1802 when he managed,
   inevitably, to alienate Napoleon. At the invitation of Jefferson, he
   returned to the United States to a hostile welcome.

   Although he had left the United States a revolutionary hero, Paine soon
   outraged the American clergy by publishing The Age of Reason. He
   infuriated the business community with his pro-labor writings in England
   and by publishing Agrarian Justice. He also wandered into the middle of
   increasingly vicious domestic politics. Federalists, looking for ground to
   attack Jefferson, seized upon his invitation to Paine to come home. Paine
   was savaged as a heretic, and as an unwashed, drunken infidel. He was
   attacked in columns and stories, insulted on the streets and in public
   places. Not only had the children forgotten the father, they had turned on
   him.

   Paine didn't see, writes Keane, "that he was among the first modern public
   figures to suffer firsthand an increasingly concentrated press equipped
   with the power to peddle one-sided interpretations of the world."

   Perhaps, if a movie is made and Paine becomes a focus of attention once
   more, somebody could locate his bones. That they are missing may be the
   most fitting postscript to his life. British journalist and Paine
   contemporary William Cobbett smarted at the way Paine had been neglected
   in his final years. Cobbett wrote, in his Cobbett's Weekly Political
   Register, under the pseudonym of Peter Porcupine: "Paine lies in a little
   hole under the grass and weeds of an obscure farm in America. There,
   however, he shall not lie, unnoticed, much longer. He belongs to England."

   Just before dawn one autumn night in 1819, Cobbett, his son, and a friend
   went to Paine's New Rochelle farm - the hole under the grass is still
   there, marked by a plaque from the Thomas Paine National Historical
   Association - and dug up his grave, determined that Paine should have a
   proper burial in his native country. From there, the story becomes hazy.
   By most accounts, Cobbett fled with Paine's bones but never publicly
   buried the remains. Some historians think he lost them overboard on the
   return voyage. But certain British newspapers report their being displayed
   in November 1819, in Liverpool.

   After Cobbett's death in 1835, his son auctioned off all his worldly
   goods, but the auctioneer refused to include the box that supposedly
   contained Paine's bones. Years later, a Unitarian minister in England
   claimed to own Paine's skull and right hand (though he wouldn't show them
   to anybody). Parts of Paine, truly by now the "universal citizen" he
   wanted to be, have been reported turning up intermittently ever since. In
   the 1930s, a woman in Brighton claimed to own what clearly would be the
   best part of Paine to have - his jawbone. As historian Moncure Daniel
   Conway wrote a hundred years ago: "As to his bones, no man knows the place
   of their rest to this day. His principles rest not."


text:
from sublime_plugin import WindowCommand
from ..libraries.tools import get_setting, save_setting

class DeviotOutputConsoleCommand(WindowCommand):
    """
    Stores the output console oprion selected for the user and save it in
    the preferences file.

    Extends: sublime_plugin.WindowCommand
    """

    def run(self):
        output_console = get_setting('output_console', False)
        save_setting('output_console', not output_console)

    def is_checked(self):
        return get_setting('output_console', False)