text:
#include "platform/platform.h"

#include <windows.h>
#include <shlwapi.h>
#include <shlobj.h>

#include <glbinding/gl/gl.h>
#include <glbinding/Binding.h>

#include "core/inf/variable.h"
#include "core/impl/asset_bundle/asset_bundle_with_fallback.h"
#include "core/impl/asset_bundle/asset_bundle_directory.h"

#include "graphics/base/font.h"
#include "graphics/impl/alphabet/alphabet_true_type.h"

#pragma comment(lib, "shlwapi.lib")

namespace ark {

void Platform::log(Log::LogLevel /*logLevel*/, const char* tag, const char* content)
{
    printf("[%s] %s\n", tag, content);
    fflush(nullptr);
}

sp<AssetBundle> Platform::getAssetBundle(const String& path, const String& appPath)
{
    if(isDirectory(path))
        return sp<AssetBundleWithFallback>::make(sp<AssetBundleDirectory>::make(appPath), sp<AssetBundleDirectory>::make(path));
    if(isDirectory(appPath))
        return sp<AssetBundleDirectory>::make(appPath);
    return nullptr;
}

String Platform::getUserStoragePath(const String& path)
{
    wchar_t* szPath = nullptr;
    if (!SUCCEEDED(SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &szPath)))
        FATAL("Get application local storage path failed");
    const String appPath = Strings::toUTF8(szPath);
    CoTaskMemFree(szPath);
    return Strings::sprintf("%s\\%s", appPath.c_str(), path.c_str());
}

String Platform::getExternalStoragePath(const String& path)
{
    const String s = path.rstrip('/').rstrip('\\').lstrip('/').lstrip('\\');
    return s.empty() ? "." : s;
}

void Platform::sysCall(int32_t id, const String& value)
{
}

String Platform::getDefaultFontDirectory()
{
    TCHAR nWindowsDirectory[MAX_PATH];
    GetWindowsDirectory(nWindowsDirectory, MAX_PATH);
    return Strings::sprintf("%s\\%s", nWindowsDirectory, "fonts");
}

String Platform::getExecutablePath()
{
    TCHAR pathbuf[MAX_PATH];
    int32_t bytes = GetModuleFileName(NULL, pathbuf, sizeof(pathbuf));
    DCHECK(bytes > 0, "GetModuleFileName() failed");
    return pathbuf;
}

String Platform::getRealPath(const String& path)
{
    char realpath[MAX_PATH];
    GetFullPathName(path.c_str(), sizeof(realpath), realpath, nullptr);
    return realpath;
}

//static int CALLBACK _enumerate_font_callback(CONST LOGFONT* lpelfe, CONST TEXTMETRIC* lpntme, DWORD FontType, LPARAM lParam)
//{
//    puts(lpelfe->lfFaceName);
//    return 1;
//}

sp<Alphabet> Platform::getSystemAlphabet(const Font& font, const String& lang)
{
/*
 * Lucida Sans Unicode
 * l_10646.ttf
*/
//    LOGFONT font = {0};
//    HWND hwnd = GetDesktopWindow();
//    HDC hdc = GetWindowDC(hwnd);
//    font.lfCharSet = DEFAULT_CHARSET;
//    EnumFontFamiliesEx(hdc, &font, _enumerate_font_callback, 0, 0);
    const String fontsDirectory = getDefaultFontDirectory();
    if(isFile(fontsDirectory + "\\ArialUni.ttf"))
        return sp<AlphabetTrueType>::make("ArialUni.ttf", font.size());
    if(isFile(fontsDirectory + "\\simfang.ttf"))
        return sp<AlphabetTrueType>::make("simfang.ttf", font.size());
    if(isFile(fontsDirectory + "\\Arial.ttf"))
        return sp<AlphabetTrueType>::make("Arial.ttf", font.size());
    return sp<AlphabetTrueType>::make("l_10646.ttf", font.size());
}

void Platform::glInitialize()
{
    glbinding::Binding::initialize(nullptr);
}

void Platform::vkInitialize()
{
}

String Platform::glShaderVersionDeclaration(uint32_t versionCode)
{
    return Strings::sprintf("#version %d\n", versionCode);
}

uint32_t Platform::glPreprocessShader(const String& shader, const char* srcs[], uint32_t length)
{
    DCHECK(length > 0, "length = %d", length);
    srcs[0] = shader.c_str();
    return 1;
}

void* Platform::dlOpen(const char* name)
{
    if(name)
    {
        const String dllName = Strings::sprintf("%s.dll", name);
        return LoadLibrary(dllName.c_str());
    }
    HMODULE hModule = nullptr;
    GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCTSTR)Platform::dlOpen, &hModule);
    return hModule;
}

void* Platform::dlSymbol(void* library, const String& symbolName)
{
    return GetProcAddress(reinterpret_cast<HMODULE>(library), symbolName.c_str());
}

void Platform::dlClose(void* library)
{
    FreeLibrary(reinterpret_cast<HMODULE>(library));
}

void Platform::detachCurrentThread()
{
}

char PlatformIndependent::_DIR_SEPARATOR = '\\';
char PlatformIndependent::_PATH_SEPARATOR = ';';

}


text:
@implementation PXExpressionNodeUtils

+ (NSString *)descriptionForNode:(id<PXExpressionNode>)node
{
    PXSourceWriter *writer = [[PXSourceWriter alloc] init];

    [self descriptionForNode:node withWriter:writer];

    NSString *result = writer.description;

    return [result stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
}

+ (void)descriptionForNode:(id<PXExpressionNode>)node withWriter:(PXSourceWriter *)writer
{
    if (node.type == EM_LCURLY)
    {
        PXBlockNode *block = (PXBlockNode *)node;

        if (block.isBlockValue)
        {
            [writer printIndent];
            [writer printWithNewLine:@"{"];
            [writer increaseIndent];
        }

        [block.nodes enumerateObjectsUsingBlock:^(id<PXExpressionNode> node, NSUInteger idx, BOOL *stop) {
            [self descriptionForNode:node withWriter:writer];
        }];

        if (block.isBlockValue)
        {
            [writer decreaseIndent];
            [writer printIndent];
            [writer printWithNewLine:@"}"];
        }
    }
    else if (node.type == EM_IF)
    {
        PXGenericNode *ifNode = (PXGenericNode *)node;

        [writer printIndent];
        [writer printWithNewLine:@"if"];

        if (ifNode.nodeValue != nil)
        {
            [writer increaseIndent];
            [self descriptionForNode:ifNode.nodeValue withWriter:writer];

            // open block
            [writer printIndent];
            [writer printWithNewLine:@"{"];
            [writer increaseIndent];

            // emit true block
            [self descriptionForNode:ifNode.nodeValue2 withWriter:writer];

            // close block
            [writer decreaseIndent];
            [writer printIndent];
            [writer printWithNewLine:@"}"];

            // false block
            if (ifNode.nodeValue3 != nil)
            {
                // open block
                [writer printIndent];
                [writer printWithNewLine:@"{"];
                [writer increaseIndent];

                // emit false block
                [self descriptionForNode:ifNode.nodeValue3 withWriter:writer];

                // close block
                [writer decreaseIndent];
                [writer printIndent];
                [writer printWithNewLine:@"}"];
            }

            [writer decreaseIndent];
        }
    }
    else
    {
        PXGenericNode *ast = (PXGenericNode *)node;
        NSString *name = nil;

        if (ast.type != EM_PARAMETER)
        {
            [writer printIndent];
        }

        switch (ast.type)
        {
            case EM_IDENTIFIER:
                [writer printWithNewLine:ast.stringValue];
                break;

            case EM_NUMBER:
                [writer printWithNewLine:[NSString stringWithFormat:@"%g", ast.doubleValue]];
                break;

            case EM_FUNC:
            {
                [writer print:ast.stringValue];

                // args
                [writer print:@"("];
                [ast.arrayValue enumerateObjectsUsingBlock:^(PXGenericNode *parameter, NSUInteger idx, BOOL *stop) {
                    if (idx > 0)
                    {
                        [writer print:@","];
                    }

                    [writer print:[self descriptionForNode:parameter]];
                }];
                [writer printWithNewLine:@")"];

                // body
                [writer increaseIndent];
                [self descriptionForNode:ast.nodeValue withWriter:writer];
                [writer decreaseIndent];
                break;
            }

            case EM_LT:
                name = @"lt";
                break;

            case EM_LE:
                name = @"le";
                break;

            case EM_EQ:
                name = @"eq";
                break;

            case EM_NE:
                name = @"ne";
                break;

            case EM_GE:
                name = @"ge";
                break;

            case EM_GT:
                name = @"gt";
                break;

            case EM_NOT:
                name = @"not";
                break;

            case EM_OR:
                name = @"or";
                break;

            case EM_AND:
                name = @"and";
                break;

            case EM_THIS:
                [writer printWithNewLine:@"this"];
                break;

            case EM_NULL:
                [writer printWithNewLine:@"null"];
                break;

            case EM_UNDEFINED:
                [writer printWithNewLine:@"undefined"];
                break;

            case EM_SYM:
                [writer printWithNewLine:@"sym"];

                [writer increaseIndent];
                [writer printIndent];
                [writer printWithNewLine:ast.stringValue];

                if (ast.nodeValue != nil)
                {
                    [self descriptionForNode:ast.nodeValue withWriter:writer];
                }

                [writer decreaseIndent];
                break;

            case EM_LPAREN:
            {
                if ([ast.nodeValue isKindOfClass:[PXGenericNode class]] && [(PXGenericNode *)ast.nodeValue type] == EM_IDENTIFIER)
                {
                    PXGenericNode *identifier = (PXGenericNode *)ast.nodeValue;

                    [writer printWithNewLine:[NSString stringWithFormat:@"'%@'()", identifier.stringValue]];
                    [writer increaseIndent];
                }
                else
                {
                    [writer printWithNewLine:@">()"];
                    [writer increaseIndent];
                    [self descriptionForNode:ast.nodeValue withWriter:writer];
                }

                [ast.arrayValue enumerateObjectsUsingBlock:^(id<PXExpressionNode> arg, NSUInteger idx, BOOL *stop) {
                    [self descriptionForNode:arg withWriter:writer];
                }];

                [writer decreaseIndent];
                break;
            }

            case EM_LBRACKET:
                name = @"getElement";
                break;

            case EM_RBRACKET:
                [writer printWithNewLine:@"[]"];

                if (ast.arrayValue.count > 0)
                {
                    [writer increaseIndent];
                    [ast.arrayValue enumerateObjectsUsingBlock:^(id<PXExpressionNode> element, NSUInteger idx, BOOL *stop) {
                        [self descriptionForNode:element withWriter:writer];
                    }];
                    [writer decreaseIndent];
                }
                break;

            case EM_RCURLY:
            {
                [writer printWithNewLine:@"{}"];

                if (ast.arrayValue.count > 0)
                {
                    [writer increaseIndent];
                    [ast.arrayValue enumerateObjectsUsingBlock:^(id<PXExpressionNode> keyValue, NSUInteger idx, BOOL *stop) {
                        [self descriptionForNode:keyValue withWriter:writer];
                    }];
                    [writer decreaseIndent];
                }
                break;
            }

            case EM_LESS_THAN:
                name = @"<";
                break;

            case EM_LESS_THAN_EQUAL:
                name = @"<=";
                break;

            case EM_EQUAL:
                name = @"==";
                break;

            case EM_NOT_EQUAL:
                name = @"!=";
                break;

            case EM_GREATER_THAN_EQUAL:
                name = @">=";
                break;

            case EM_GREATER_THAN:
                name = @">";
                break;

            case EM_LOGICAL_NOT:
                [writer printWithNewLine:@"!"];

                [writer increaseIndent];
                [self descriptionForNode:ast.nodeValue withWriter:writer];

                [writer decreaseIndent];
                break;

            case EM_LOGICAL_OR:
                name = @"||";
                break;

            case EM_LOGICAL_AND:
                name = @"&&";
                break;

            case EM_PLUS:
                name = @"+";
                break;

            case EM_MINUS:
                name = @"-";
                break;

            case EM_TIMES:
                name = @"*";
                break;

            case EM_DIVIDE:
                name = @"/";
                break;

            case EM_MODULUS:
                name = @"%";
                break;

            case EM_DOT:
                [writer printWithNewLine:@"."];
                [writer increaseIndent];

                [self descriptionForNode:ast.nodeValue withWriter:writer];

                if (ast.stringValue.length > 0)
                {
                    [writer printIndent];
                    [writer print:@"'"];
                    [writer print:ast.stringValue];
                    [writer printWithNewLine:@"'"];
                }
                else
                {
                    [self descriptionForNode:ast.nodeValue2 withWriter:writer];
                }

                [writer decreaseIndent];
                break;

            case EM_COLON:
                [writer print:@"'"];
                [writer print:ast.stringValue];
                [writer printWithNewLine:@"'"];

                [self descriptionForNode:ast.nodeValue withWriter:writer];
                break;

            case EM_STRING:
                [writer printWithNewLine:[NSString stringWithFormat:@"'%@'", ast.stringValue]];
                break;

            case EMA_APPLY:
                if (ast.stringValue.length > 0)
                {
                    [writer printWithNewLine:[NSString stringWithFormat:@"apply('%@')", ast.stringValue]];
                }
                else
                {
                    [writer printWithNewLine:@"apply"];
                }
                break;

            case EMA_CREATE_ARRAY:
                if (ast.uintValue > 0)
                {
                    [writer printWithNewLine:[NSString stringWithFormat:@"createArray(%d)", ast.uintValue]];
                }
                else
                {
                    [writer printWithNewLine:@"createArray"];
                }
                break;

            case EMA_CREATE_OBJECT:
                if (ast.uintValue > 0)
                {
                    [writer printWithNewLine:[NSString stringWithFormat:@"createObject(%d)", ast.uintValue]];
                }
                else
                {
                    [writer printWithNewLine:@"createObject"];
                }
                break;

            case EMA_DUP:
                name = @"dup";
                break;

            case EMA_EXEC:
                name = @"exec";
                break;

            case EMA_GET_ELEMENT:
                if (ast.uintValue != UINT_MAX)
                {
                    [writer printWithNewLine:[NSString stringWithFormat:@"getElement(%d)", ast.uintValue]];
                }
                else
                {
                    [writer printWithNewLine:@"getElement"];
                }
                break;

            case EMA_GET_PROPERTY:
                if (ast.stringValue.length > 0)
                {
                    [writer printWithNewLine:[NSString stringWithFormat:@"getProperty('%@')", ast.stringValue]];
                }
                else
                {
                    [writer printWithNewLine:@"getProperty"];
                }
                break;

            case EMA_GET_SYMBOL:
                if (ast.stringValue.length > 0)
                {
                    [writer printWithNewLine:[NSString stringWithFormat:@"getSymbol('%@')", ast.stringValue]];
                }
                else
                {
                    [writer printWithNewLine:@"getSymbol"];
                }
                break;

            case EMA_GLOBAL:
                name = @"global";
                break;

            case EMA_IF_ELSE:
                name = @"ifelse";
                break;

            case EMA_INVOKE:
                if (ast.stringValue.length > 0)
                {
                    if (ast.uintValue > 0)
                    {
                        [writer printWithNewLine:[NSString stringWithFormat:@"invoke('%@', %d)", ast.stringValue, ast.uintValue]];
                    }
                    else
                    {
                        [writer printWithNewLine:[NSString stringWithFormat:@"invoke('%@')", ast.stringValue]];
                    }
                }
                else if (ast.uintValue > 0)
                {
                    [writer printWithNewLine:[NSString stringWithFormat:@"invoke(%d)", ast.uintValue]];
                }
                else
                {
                    [writer printWithNewLine:@"invoke"];
                }
                break;

            case EMA_POP:
                name = @"pop";
                break;

            case EMA_SET_SYMBOL:
                if (ast.stringValue.length > 0)
                {
                    [writer printWithNewLine:[NSString stringWithFormat:@"setSymbol('%@')", ast.stringValue]];
                }
                else
                {
                    [writer printWithNewLine:@"setSymbol"];
                }
                break;

            case EMA_SWAP:
                name = @"swap";
                break;

            case EMA_ADD:
                name = @"add";
                break;

            case EMA_SUB:
                name = @"sub";
                break;

            case EMA_MUL:
                name = @"mul";
                break;

            case EMA_DIV:
                name = @"div";
                break;

            case EMA_MOD:
                name = @"mod";
                break;

            case EMA_NEG:
                [writer printWithNewLine:@"-"];

                [writer increaseIndent];
                [self descriptionForNode:ast.nodeValue withWriter:writer];

                [writer decreaseIndent];
                break;

            case EMA_MARK:
                name = @"mark";
                break;

            case EM_BOOLEAN:
            {
                NSString *text = (ast.booleanValue) ? @"true" : @"false";

                [writer printWithNewLine:[NSString stringWithFormat:@"%@", text]];
                break;
            }

            case EM_PARAMETER:
            {
                id<PXExpressionNode> defaultValue = ast.nodeValue;

                [writer print:ast.stringValue];

                if (defaultValue.type != EM_UNDEFINED)
                {
                    [writer print:@"="];
                    [writer print:[self descriptionForNode:defaultValue]];
                }
                break;
            }

            default:
                NSLog(@"Unrecognized EM node type: %d", ast.type);
        }

        if (name.length > 0)
        {
            [writer printWithNewLine:name];

            if (ast.nodeValue != nil && ast.nodeValue2 != nil)
            {
                [writer increaseIndent];
                [self descriptionForNode:ast.nodeValue withWriter:writer];
                [self descriptionForNode:ast.nodeValue2 withWriter:writer];

                [writer decreaseIndent];
            }
        }
    }
}

@end

redpajama_set_name: RedPajamaGithub


text:
package biz.neustar.ultra.rest.constants;

/**
 * Ultra rest shared constant.
 *
 * @author nupadhyay
 */
@SuppressWarnings("PMD.GodClass")
public enum UltraRestSharedConstant {
    /**
     * header key while returning the task id in HTTP header.
     */
    X_NEUSTAR_TASK_ID("X-Task-Id"),
    /**
     * Zone type in query string.
     */
    ZONE_TYPE_IN_QUERY_STRING("zone_type"),
    SPACE(" "),
    /**
     * Constant for resource records.
     */
    RR_SETS("rrsets"),
    /**
     * Constant for total count.
     */
    TOTAL_COUNT("totalCount"),
    /**
     * Constant for colon.
     */
    COLON(":"),
    /**
     * Constant for TTL string.
     */
    TTL("ttl"),
    /**
     * Constant for owner string.
     */
    OWNER("owner"),
    /**
     * Constant for value string.
     */
    VALUE("value"),
    /**
     * Constant for value string.
     */
    SKIP_SOA("skipSOA"),
    /**
     * Constant for code string.
     */
    CODE("code"),
    /**
     * Constant for hasData string.
     */
    HAS_DATA("hasData"),
    /**
     * Constant for description.
     */
    DESCRIPTION("description"),
    /**
     * Constant for double quote.
     */
    DOUBLE_QUOTE("\""),
    /**
     * Constant for comma.
     */
    COMMA(","),
    /**
     * Zone name constant.
     */
    ZONE_NAME("zoneName"),
    /**
     * Account name constant.
     */
    ACCOUNT_NAME("accountName"),

    /**
     * Account name query param constant.
     */
    ACCOUNT_NAME_QUERY_PARAM("account_name"),
    /**
     * Bind file type.
     */
    BIND_FILE_TYPE("bind"),
    /**
     * UTF Character encoding.
     */
    UTF_8_CHAR_SET("UTF-8"),
    /**
     * Query separator.
     */
    QUERY_SEPARATOR(":"),
    /**
     * Web forward type.
     */
    WEB_FORWARD_TYPE("type"),
    /**
     * Web forward advanced flag.
     */
    WEB_FORWARD_QUERY_ADVANCED("advanced"),

    /**
     * Mapping key for address in query parameter.
     */
    EMAIL_ADDRESS("address"),
    /**
     * For RRSet listing option.
     */
    KIND("kind"),
    /**
     * For match type, can be START, END, ANYWHERE, EXACT, default is ANYWHERE.
     */
    MATCH("match"),
    /**
     * For Error.
     */
    ERROR("ERROR"),
    /**
     * For ok.
     */
    OK("OK"),
    /**
     * For RRSet Profile Context.
     */
    PROFILE_CONTEXT("@context"),
    /**
     * For RRSet Profile order.
     */
    PROFILE_ORDER("order"),
    /**
     * For RRSet Profile description.
     */
    PROFILE_DESCRIPTION("description"),

    STATUS("status"),

    /**
     * For ECS flag.
     */
    DIR_POOL_IGNORE_ECS("ignoreECS"),
    /**
     * For Directional Pool conflict resolve.
     */
    DIR_POOL_CONFLICT_RESOLVE("conflictResolve"),
    /**
     * For Directional Pool record data info.
     */
    DIR_POOL_RDATA_INFO("rdataInfo"),

    DIR_POOL_ALL_NC("allNonConfigured"),

    DIR_POOL_GEO_INFO("geoInfo"),

    NAME("name"),

    DIR_POOL_IS_ACCOUNT_LEVEL("isAccountLevel"),

    DIR_POOL_IS_EXISTING_GROUP_FROM_POOL("isIsExistingGroupFromPool"),

    DIR_POOL_CODES("codes"),

    DIR_POOL_IP_INFO("ipInfo"),

    DIR_POOL_IPS("ips"),

    DIR_POOL_START("start"),

    DIR_POOL_END("end"),

    DIR_POOL_CIDR("cidr"),

    DIR_POOL_ADDRESS("address"),

    DIR_POOL_RDATA_INFO_TYPE("type"),

    /**
     * For Directional Pool no response.
     */
    DIR_POOL_NO_RESPONSE("noResponse"),
    NAME_IN_QUERY_STRING("name"),
    //Field names related to SLB Pool profile
    SLB_PROFILE_ORDER("responseMethod"),
    SLB_PROFILE_BACKUP_RECORD("allFailRecord"),
    SLB_PROFILE_MONITOR("monitor"),
    // This and regionFailureSensitivity as same purpose. When users pass value, it is called
    // regionFailureSensitivity. What ZGS gets is regionThreshold.
    SLB_PROFILE_REGION_THRESHOLD("regionThreshold"),
    SLB_PROFILE_REGION_FAILURE_SENSITIVITY("regionFailureSensitivity"),
    SLB_PROFILE_SERVING_PREFERENCE("servingPreference"),

    SF_POOL_DESCRIPTION("poolDescription"),
    SF_POOL_LIVE_RECORD_DESCRIPTION("liveRecordDescription"),
    SF_POOL_LIVE_RECORD_STATE("liveRecordState"),
    SF_POOL_BACKUP_RECORD("backupRecord"),
    SF_POOL_MONITOR("monitor"),
    SF_POOL_REGION_THRESHOLD("regionFailureSensitivity"),

    AR_OR_SLB_PROFILE_RDATA_INFO("rdataInfo"),
    AR_PROFILE_BACKUP_DATA_RECORDS("backupRecords"),
    AR_CONF_RESPONSE_METHOD("responseMethod"),
    AR_CONF_MAX_ACTIVE("maxActive"),
    AR_CONF_MAX_RESPONSE("maxResponse"),
    AR_CONF_FAILOVER_ENABLED("failoverEnabled"),
    AR_CONF_PROBING_ENABLED("probingEnabled"),
    AR_POOL_CONFIGURATION("configuration"),

    SBTCPOOL_RUN_PROBES("runProbes"),
    SBTCPOOL_ACT_ON_PROBES("actOnProbes"),
    SBPOOL_ORDER("order"),
    SBPOOL_MAX_ACTIVE("maxActive"),
    SBPOOL_MAX_SERVED("maxServed"),
    SBTCPOOL_RDATA_INFO("rdataInfo"),

    SBPOOL_BACKUP_DATA_RECORDS("backupRecords"),
    TCPOOL_BACKUP_DATA_RECORD("backupRecord"),
    ALL("ALL"),
    TCPOOL_MAX_TO_LB("maxToLB"),
    SUCCESSFUL("Successful"),
    PENDING("Pending"),
    ZONE_STATUS("zone_status"),
    DNSSEC_STATUS("dnssec_status"),

    AR_DEFAULT_CONFIGURATION_NAME("Default"),

    PROP_REPORTER_SERVICE_LOCATION("ultra.reporter.service.location"),
    PROP_REPORTER_REST_CLIENT_RECEIVED_TIMEOUT("ultra.reporter.service.rest.web.client.received.timeout"),

    PROP_VSA_SERVICE_LOCATION("ultra.vsa.service.location"),

    /**
     * Constants for ZBR service.
     */
    PROP_ZBR_SERVICE_LOCATION("ultra.zbr.service.location"),
    PROP_ZBR_REST_CLIENT_CONNECT_TIMEOUT("ultra.zbr.service.rest.web.client.connect.timeout"),
    PROP_ZBR_REST_CLIENT_READ_TIMEOUT("ultra.zbr.service.rest.web.client.read.timeout"),
    /**
     * Constant for double colon.
     */
    DBL_COLON("::"),
    /**
     * Constant for filter for Reporter Task API.
     */
    FILTER("filter"),
    /**
     * Constant for link header next link.
     */
    NEXT("next"),
    /**
     * Constant for link header prev link.
     */
    PREVIOUS("previous"),
    /**
     * Constant for link header limit for records.
     */
    LIMIT("Limit"),
    /**
     * Constant for link header record count in response.
     */
    RESULTS("Results"),
    /**
     * Constant for Link in header.
     */
    Link("Link"),
    /**
     * Application id to be used supplied to token service.
     */
    JAVA_UI("JAVA_UI"),

    /**
     * Constant for zone search type(for ZBR).
     */
    SEARCH_TYPE_IN_QUERY_STRING("_search_type"),

    /**
     * Constant for parameter to return internal fields in RRSets response. It can accept comma separated multiple
     * fields.<BR> Like 'ACCOUNTID' for account ID, 'ZONEID' for zone ID and 'ACCOUNTID,ZONEID' for both.
     */
    FETCH_INTERNAL_FIELDS("_fetch_internal_fields"),

    /**
     * Client ID for ZBR.
     */
    ZBR("ZBR");

    public static final int MAX_RECORD_COUNT_IN_SLB_POOL = 5;
    /**
     * Task create "action" parameter string.
     */
    public static final String TASK_CREATE_ACTION_STRING = "action";
    private static final String NORTH_AMERICA_EAST2 = "North America East";
    private static final String NORTH_AMERICA_WEST2 = "North America West";
    private static final String NORTH_AMERICA_CENTRAL2 = "North America Central";
    private static final String EUROPE_EAST2 = "Europe East";
    /**
     * Value.
     */
    private final String value;

    /**
     * Parameterized constructor.
     *
     * @param value - constant value
     */
    UltraRestSharedConstant(String value) {
        this.value = value;
    }

    /**
     * To get value.
     *
     * @return - String value.
     */
    public String getValue() {
        return this.value;
    }

    /**
     * Sort options for listing zones.
     */
    public enum ZoneListSortType {
        NAME(1),
        ZONE_TYPE(2),
        ACCOUNT_NAME(3);

        private int value;

        ZoneListSortType(int value) {
            this.value = value;
        }

        public int getValue() {
            return this.value;
        }
    }

    /**
     * Sort constant for RR list.
     */
    public enum RRListSortType {
        OWNER("lname"),
        TTL("ttl"),
        TYPE("type"),
        VALUE("info1");
        /**
         * Value.
         */
        private final String value;

        RRListSortType(String value) {
            this.value = value;
        }

        /**
         * Get value.
         *
         * @return - int
         */
        public String getValue() {
            return this.value;
        }
    }

    /**
     * Sort fields for web forward listing.
     */
    public enum WFListSortFields {
        REQUEST_TO(1),
        REDIRECT_TO(2),
        TYPE(3),
        DOMAIN(4),
        ADVANCED(5);
        private final int value;

        WFListSortFields(int value) {
            this.value = value;
        }

        public int getValue() {
            return value;
        }
    }

    public enum MailSortField {
        FROM_HOST_NAME(5),
        FROM_USER_NAME(6);
        private final int value;

        MailSortField(int value) {
            this.value = value;
        }

        public int getValue() {
            return value;
        }
    }

    public enum EventSortField {
        START("datestart"),
        END("datenext");
        private final String value;

        EventSortField(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }
    }

    public enum ProfileType {
        NONE(""),
        RD_POOL("http://schemas.ultradns.com/RDPool.jsonschema"),
        SF_POOL("http://schemas.ultradns.com/SFPool.jsonschema"),
        DIR_POOL("http://schemas.ultradns.com/DirPool.jsonschema"),
        SB_POOL("http://schemas.ultradns.com/SBPool.jsonschema"),
        TC_POOL("http://schemas.ultradns.com/TCPool.jsonschema"),
        AR_POOL("http://schemas.ultradns.com/ARPool.jsonschema"),
        SLB_POOL("http://schemas.ultradns.com/SLBPool.jsonschema");

        private final String context;

        ProfileType(String context) {
            this.context = context;
        }

        public String getContext() {
            return context;
        }
    }

    /**
     * The order the records will be returned in.
     */
    public enum RDProfileOrder {
        FIXED("FX"),
        RANDOM("RD"),
        ROUND_ROBIN("RR");
        private String value;

        /**
         * Constructor.
         */
        RDProfileOrder(String value) {
            this.value = value;
        }

        /**
         * Get order.
         *
         * @param string - Order in String
         * @return - {@link RDProfileOrder}
         */
        public static RDProfileOrder getOrder(String string) {
            RDProfileOrder[] orders = RDProfileOrder.values();
            for (RDProfileOrder order : orders) {
                if (order.getValue().equals(string)) {
                    return order;
                }
            }

            throw new IllegalArgumentException();
        }

        /**
         * Get order.
         *
         * @param string - Order in String
         * @return - {@link RDProfileOrder}
         */
        public static RDProfileOrder getOrderByValue(String string) {
            RDProfileOrder[] orders = RDProfileOrder.values();
            for (RDProfileOrder order : orders) {
                if (order.name().equals(string)) {
                    return order;
                }
            }

            throw new IllegalArgumentException();
        }

        /**
         * Get value.
         */
        public String getValue() {
            return this.value;
        }
    }

    public enum ProbeHttpMethod {
        GET,
        POST
    }

    public enum ProbeType {
        HTTP("HTTP"),
        PING("ping"),
        FTP("FTP"),
        TCP("TCP"),
        SMTP("SMTP Availability"),
        SMTP_SEND("SMTP Send Mail"),
        DNS("DNS");
        private String value;

        ProbeType(String value) {
            this.value = value;
        }

        public static ProbeType findBy(String value) {
            ProbeType[] enums = ProbeType.values();
            for (ProbeType type : enums) {
                if (type.getValue().equals(value)) {
                    return type;
                }
            }
            return null;
        }

        public String getValue() {
            return this.value;
        }
    }

    public enum ProbeInterval {
        HALF_MINUTE(30),
        ONE_MINUTE(1),
        TWO_MINUTES(2),
        FIVE_MINUTES(5),
        TEN_MINUTES(10),
        FIFTEEN_MINUTES(15);
        private int interval;

        ProbeInterval(int interval) {
            this.interval = interval;
        }

        public static ProbeInterval findBy(int interval) {
            ProbeInterval[] enums = ProbeInterval.values();
            for (ProbeInterval probeInterval : enums) {
                if (probeInterval.getInterval() == interval) {
                    return probeInterval;
                }
            }
            throw new IllegalArgumentException("Unknown Probe Interval: " + interval);
        }

        public int getInterval() {
            return this.interval;
        }
    }

    public enum ProbeAgent {
        NEW_YORK("New York", NORTH_AMERICA_EAST2),
        PALO_ALTO("Palo Alto", NORTH_AMERICA_WEST2),
        AMSTERDAM("Amsterdam", EUROPE_EAST2),
        DALLAS("Dallas", NORTH_AMERICA_CENTRAL2),
        NORTH_AMERICA_EAST(NORTH_AMERICA_EAST2, NORTH_AMERICA_EAST2),
        NORTH_AMERICA_WEST(NORTH_AMERICA_WEST2, NORTH_AMERICA_WEST2),
        NORTH_AMERICA_CENTRAL(NORTH_AMERICA_CENTRAL2, NORTH_AMERICA_CENTRAL2),
        EUROPE_EAST(EUROPE_EAST2, EUROPE_EAST2),
        EUROPE_WEST("Europe West", "Europe West"),
        SOUTH_AMERICA("South America", "South America"),
        ASIA("Asia", "Asia"),
        CHINA("China", "China"),
        USEAST("USEast", NORTH_AMERICA_EAST2),
        USWEST("USWest", NORTH_AMERICA_WEST2),
        EUWEST("EUWest", EUROPE_EAST2),
        USCENTRAL("USCentral", NORTH_AMERICA_CENTRAL2);

        private String agent;
        private String newAgentName;

        ProbeAgent(String oldAgent, String newAgentName) {
            this.agent = oldAgent;
            this.newAgentName = newAgentName;
        }

        public static String correctProbeAgentName(String agent) {
            //not using valueOf because I don't want to throw an exception.
            for (ProbeAgent probeAgent : values()) {
                if (probeAgent.name().equalsIgnoreCase(agent)) {
                    return probeAgent.getProbeAgent();
                }
            }
            //just return what was passed in
            return agent;
        }

        public static String convertProbeAgentNameToNewAgent(String oldAgent) {
            for (ProbeAgent probeAgent : values()) {
                if (probeAgent.getProbeAgent().equalsIgnoreCase(oldAgent)) {
                    return probeAgent.getNewAgentName();
                }
            }
            //just return what was passed in
            return oldAgent;
        }

        public static String convertProbeAgentNameToExternal(String internalAgent, SiteBackerNetwork networkName) {
            //not using valueOf because I don't want to throw an exception.
            for (ProbeAgent probeAgent : values()) {
                if (probeAgent.getProbeAgent().equalsIgnoreCase(internalAgent)) {
                    switch (probeAgent) {
                    case NORTH_AMERICA_EAST:
                        return getEastAgentName(networkName);
                    case NORTH_AMERICA_WEST:
                        return getWestAgentName(networkName);
                    case NORTH_AMERICA_CENTRAL:
                        return getCentralAgentName(networkName);
                    case EUROPE_EAST:
                        return getEuropeAgentName(networkName);
                    default:
                        return probeAgent.name();
                    }
                }
            }
            //just return what was passed in
            return internalAgent;
        }

        /**
         * Get Appropriate Agent for Europe.
         *
         * @param networkName the name of the sitebacker network customer belongs to.
         * @return Europe site corresponding to the network name.
         */
        private static String getEuropeAgentName(SiteBackerNetwork networkName) {
            return SiteBackerNetwork.PRIMARY.equals(networkName)
                    ? ProbeAgent.AMSTERDAM.name()
                    : ProbeAgent.EUWEST.getProbeAgent();
        }

        /**
         * Get Appropriate Agent for Central.
         *
         * @param networkName the name of the sitebacker network customer belongs to.
         * @return North America Central site corresponding to the network name.
         */
        private static String getCentralAgentName(SiteBackerNetwork networkName) {
            return SiteBackerNetwork.PRIMARY.equals(networkName)
                    ? ProbeAgent.DALLAS.name()
                    : ProbeAgent.USCENTRAL.getProbeAgent();
        }

        /**
         * Get Appropriate Agent for West.
         *
         * @param networkName the name of the sitebacker network customer belongs to.
         * @return North America West site corresponding to the network name.
         */
        private static String getWestAgentName(SiteBackerNetwork networkName) {
            return SiteBackerNetwork.PRIMARY.equals(networkName)
                    ? ProbeAgent.PALO_ALTO.name()
                    : ProbeAgent.USWEST.getProbeAgent();
        }

        /**
         * Get Appropriate Agent for East.
         *
         * @param networkName the name of the sitebacker network customer belongs to.
         * @return North America East site corresponding to the network name.
         */
        private static String getEastAgentName(SiteBackerNetwork networkName) {
            return SiteBackerNetwork.PRIMARY.equals(networkName)
                    ? ProbeAgent.NEW_YORK.name()
                    : ProbeAgent.USEAST.getProbeAgent();
        }

        public static ProbeAgent findBy(String agent) {
            ProbeAgent[] enums = ProbeAgent.values();
            for (ProbeAgent type : enums) {
                if (type.getProbeAgent().equals(agent)) {
                    return type;
                }
            }
            throw new IllegalArgumentException("Unknown Probe Agent: " + agent);
        }

        private String getNewAgentName() {
            return this.newAgentName;
        }

        public String getProbeAgent() {
            return this.agent;
        }
    }

    public enum Order {
        FIXED("FX"),
        RANDOM("RD"),
        ROUND_ROBIN("RR");

        private final String value;

        Order(String value) {
            this.value = value;
        }

        public String getValue() {
            return this.value;
        }

    }

    public enum RecordState {
        NORMAL(0),
        ACTIVE(1),
        INACTIVE(2);
        private final int val;

        RecordState(int val) {
            this.val = val;
        }

        public static RecordState fromVal(int val) {
            for (RecordState state : values()) {
                if (state.getVal() == val) {
                    return state;
                }
            }
            throw new IllegalArgumentException("Unknown state value: " + val);
        }

        public int getVal() {
            return val;
        }
    }

    public enum PassiveMode {
        ENABLED,
        DISABLED
    }

    public enum EventType {
        NORMAL("Normal", "NORMAL"),
        ACTIVE("ForceActive-NoTest", "Force Active-No Test"),
        ACTIVE_TEST("ForceActive-Test", "Force Active-Test"),
        INACTIVE("ForceFail-NoTest", "Force Fail-No Test"),
        INACTIVE_TEST("ForceFail-Test", "Force Fail-Test");

        private final String getValue;
        private final String postValue;

        EventType(String getValue, String postValue) {
            this.getValue = getValue;
            this.postValue = postValue;
        }

        public static EventType findByGetValue(String getValue) {
            EventType[] enums = EventType.values();
            for (EventType type : enums) {
                if (type.getGetValue().equals(getValue)) {
                    return type;
                }
            }
            throw new IllegalArgumentException("Unknown event type: " + getValue);
        }

        public String getGetValue() {
            return this.getValue;
        }

        public String getPostValue() {
            return this.postValue;
        }
    }

    public enum EventRepeat {
        DAILY(TimeConstants.SECONDS_IN_DAY),
        WEEKLY(TimeConstants.DAYS_IN_WEEK * TimeConstants.SECONDS_IN_DAY),
        FORTNIGHTLY(TimeConstants.DAYS_IN_FORTNIGHT * TimeConstants.SECONDS_IN_DAY),
        MONTHLY(TimeConstants.DAYS_IN_MONTH * TimeConstants.SECONDS_IN_DAY);

        private final int value;

        EventRepeat(int value) {
            this.value = value;
        }

        public static EventRepeat findBy(long value) {
            EventRepeat[] enums = EventRepeat.values();
            for (EventRepeat repeat : enums) {
                if (repeat.getValue() == value) {
                    return repeat;
                }
            }
            return null;
        }

        public int getValue() {
            return value;
        }
    }

    public enum EventNotify {
        NEVER(0),
        ERROR(1),
        ALWAYS(2);

        private final int value;

        EventNotify(int value) {
            this.value = value;
        }

        public static EventNotify findBy(int value) {
            EventNotify[] enums = EventNotify.values();
            for (EventNotify notify : enums) {
                if (notify.getValue() == value) {
                    return notify;
                }
            }
            return null;
        }

        public int getValue() {
            return value;
        }
    }

    public enum EventCategory {
        PROBE,
        RECORD,
        SCHEDULED
    }

    public enum AlertDataStatus {
        ACTIVE(1),
        INACTIVE(0);

        private final Integer value;

        AlertDataStatus(Integer value) {
            this.value = value;
        }

        public static Integer getIntegerValue(String statusStr) {
            for (AlertDataStatus status : AlertDataStatus.values()) {
                if (statusStr.equals(status.name())) {
                    return status.getValue();
                }
            }
            return null;
        }

        public static AlertDataStatus findBy(String value) {
            for (AlertDataStatus status : AlertDataStatus.values()) {
                if (status.getValue().toString().equals(value)) {
                    return status;
                }
            }
            return null;
        }

        public Integer getValue() {
            return this.value;
        }
    }

    public enum ProbeAlertSort {
        POOL_RECORD(2),
        PROBE_TYPE(3),
        PROBE_STATUS(1),
        ALERT_DATE(6),
        STATUS(4);
        private final int value;

        ProbeAlertSort(int value) {
            this.value = value;
        }

        public int getValue() {
            return this.value;
        }
    }

    /**
     * Constant for JSON Patch operation.
     */
    public enum JsonPatchOps {
        ADD("add"),
        REPLACE("replace"),
        REMOVE("remove"),
        MOVE("move"),
        TEST("test");
        private String value;

        JsonPatchOps(String value) {
            this.value = value;
        }

        public static JsonPatchOps findByValue(String operation) {
            for (JsonPatchOps op : JsonPatchOps.values()) {
                if (op.getValue().equals(operation)) {
                    return op;
                }
            }
            return null;
        }

        public String getValue() {
            return this.value;
        }
    }

    /**
     * Constants for JSON patch operation attributes.
     */
    public enum JsonPatchAttributes {
        OP("op"),
        PATH("path"),
        VALUE("value"),
        FROM("from");
        private String value;

        JsonPatchAttributes(String value) {
            this.value = value;
        }

        public String getValue() {
            return this.value;
        }
    }

    /**
     * For zone status.
     */
    public enum ZoneStatusInSearch {
        ACTIVE(0),
        ALL(1),
        SUSPENDED(2);
        private Integer value;

        ZoneStatusInSearch(Integer value) {
            this.value = value;
        }

        public static ZoneStatusInSearch valueOf(Integer value) {
            for (ZoneStatusInSearch zoneStatus : ZoneStatusInSearch.values()) {
                if (value.equals(zoneStatus.value)) {
                    return zoneStatus;
                }
            }
            throw new IllegalArgumentException();
        }

        public Integer getValue() {
            return this.value;
        }
    }

    public enum DNSSecKeyType {
        KSK(0x101),
        ZSK(0x100);

        private int flag;

        DNSSecKeyType(int flag) {
            this.flag = flag;
        }

        /**
         * The DNSKEY flag field.
         */
        public int flag() {
            return flag;
        }
    }

    public enum DnsSecStatus {
        UNKNOWN("U"),
        FUTURE("N"),
        CURRENT("A"),
        EXPIRED("P");

        private String value;

        DnsSecStatus(String value) {
            this.value = value;

        }

        public static DnsSecStatus getDnsSecStatus(final String str) {
            for (DnsSecStatus status : DnsSecStatus.values()) {
                if (str != null && str.equals(status.getValue())) {
                    return status;
                }
            }
            throw new IllegalArgumentException();
        }

        public String getValue() {
            return this.value;
        }
    }

    public enum DnssecType {
        NONE(0),
        NSEC(1),
        NSEC3(2),
        NSEC3_OPT_OUT(3),
        NSEC_ON_THE_FLY(4);

        private Integer value;

        DnssecType(Integer value) {
            this.value = value;
        }

        public Integer toInt() {
            return value;
        }
    }

    public enum CreateAutoPtr {
        ENABLED,
        DISABLED
    }

    public enum SiteBackerNetwork {
        PRIMARY,
        SECONDARY
    }

    public enum CursorOperation {
        FIRST,
        NEXT,
        PREVIOUS,
        LAST
    }
}


text:
<?php
/*
Plugin Name: 	SocialBox
Plugin URI: 	http://codecanyon.net/item/socialbox-social-wordpress-widget/627127
Description: 	Adds a super easy Social Box Widget which displays the current numbers of Facebook Page Likes, Twitter, Dribbble, Forrst and Digg Followers and YouTube and Vimeo Channel and Feedburner Feed Subscriptions.
Version: 		1.2.1
Author: 		JonasDoebertin
Author URI: 	http://codecanyon.net/user/JonasDoebertin
License: 		Sold exclusively on CodeCanyon
*/

if(!class_exists('SocialBoxConnector')){

	class SocialBoxConnector{

		/**
		 * Facebook API Base URL
		 */
		const FACEBOOK_API_BASE = "http://graph.facebook.com/";

		/**
		 * Twitter API Base URL
		 */
		const TWITTER_API_BASE = "http://api.twitter.com/1/users/show.json?skip_status=true&screen_name=";

		/**
		 * YouTube API Base URL
		 */
		const YOUTUBE_API_BASE ="http://gdata.youtube.com/feeds/api/users/";

		/**
		 * Vimeo API Base URL
		 */
		const VIMEO_API_BASE = "http://vimeo.com/api/v2/channel/%s/info.json";

		/**
		 * Feedburner API Base URL
		 */
		const FEEDBURNER_API_BASE = "http://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=";

		/**
		 * Dribbble API Base URL
		 */
		const DRIBBBLE_API_BASE = "http://api.dribbble.com/players/";

		/**
		 * Forrst API Base URL
		 */
		const FORRST_API_BASE = "https://forrst.com/api/v2/users/info?username=";

		/**
		 * Digg API Base URL
		 */
		const DIGG_API_BASE = "http://services.digg.com/2.0/user.getInfo?usernames=";

		/**
		 * Get data for given network and account/ID
		 *
		 * Will be called by "SocialBox::refresh()"
		 */
		public static function getData($network, $id){

			switch($network){
				case 'facebook':
					return self::getFacebookData($id);
				case 'twitter':
					return self::getTwitterData($id);
				case 'youtube':
					return self::getYoutubeData($id);
				case 'vimeo':
					return self::getVimeoData($id);
				case 'feedburner':
					return self::getFeedburnerData($id);
				case 'dribbble':
					return self::getDribbbleData($id);
				case 'forrst':
					return self::getForrstData($id);
				case 'digg':
					return self::getDiggData($id);
				default:
					return false;
			}

		}

		/**
		 * Get Facebook likes for given account
		 *
		 * Will be called by "SocialBox::refresh()"
		 */
		public static function getFacebookData($facebookId){

			/* Fetch data */
			$result = wp_remote_get(self::FACEBOOK_API_BASE . $facebookId);

			/* Check for unsuccessful http requests */
			if(is_wp_error($result) or (wp_remote_retrieve_response_code($result) != 200)){
				return false;
			}

			/* Check for incorrect data */
			$data = json_decode(wp_remote_retrieve_body($result), true);
			if(!is_array($data) or isset($data['error']) or !isset($data['likes'])){
				return false;
			}

			/* Return like count */
			return $data['likes'];

		}

		/**
		 * Get Twitter followers for given account
		 *
		 * Will be called by "SocialBox::refresh()"
		 */
		public static function getTwitterData($twitterId){

			/* Fetch data */
			$result = wp_remote_get(self::TWITTER_API_BASE . $twitterId);

			/* Check for unsuccessful http requests */
			if(is_wp_error($result) or (wp_remote_retrieve_response_code($result) != 200)){
				return false;
			}

			/* Check for incorrect data */
			$data = json_decode(wp_remote_retrieve_body($result), true);
			if(!is_array($data) or !isset($data['followers_count'])){
				return false;
			}

			/* Return followers count */
			return $data['followers_count'];

		}

		/**
		 * Get YouTube channel subscriptions for given account
		 *
		 * Will be called by "SocialBox::refresh()"
		 */
		public static function getYoutubeData($youtubeId){

			/* Fetch data */
			$result = wp_remote_get(self::YOUTUBE_API_BASE . $youtubeId);

			/* check for unseccessful http requests */
			if(is_wp_error($result) or (wp_remote_retrieve_response_code($result) != 200)){
				return false;
			}

			/* Check for incorrect data */
			$data = simplexml_load_string(wp_remote_retrieve_body($result));
			if(!$data or isset($data->err) or !isset($data->children('http://gdata.youtube.com/schemas/2007')->statistics->attributes()->subscriberCount)){
				return false;
			}

			/* Return subscribers count */
			return (int) $data->children('http://gdata.youtube.com/schemas/2007')->statistics->attributes()->subscriberCount;

		}

		public static function getVimeoData($vimeoId){

			/* Fetch data */
			$result = wp_remote_get(sprintf(self::VIMEO_API_BASE, $vimeoId));

			/* Check for unsuccessful http requests */
			if(is_wp_error($result) or (wp_remote_retrieve_response_code($result) != 200)){
				return false;
			}

			/* Check for incorrect data */
			$data = json_decode(wp_remote_retrieve_body($result), true);
			if(!is_array($data) or !isset($data['total_subscribers'])){
				return false;
			}

			/* Return followers count */
			return $data['total_subscribers'];

		}

		/**
		 * Get Feedburner subscriptions for given feed
		 *
		 * Will be called by "SocialBox::refresh()"
		 */
		public static function getFeedburnerData($feedburnerId){

			/* Fetch data */
			$result = wp_remote_get(self::FEEDBURNER_API_BASE . $feedburnerId);

			/* Check for unsuccessful http requests */
			if(is_wp_error($result) or (wp_remote_retrieve_response_code($result) != 200)){
				return false;
			}

			/* Check for incorrect data */
			$data = simplexml_load_string(wp_remote_retrieve_body($result));
			if(!$data or isset($data->err) or !isset($data->feed->entry['circulation'])){
				return false;
			}

			/* Return subscribers count */
			return (int) $data->feed->entry['circulation'];

		}

		/**
		 * Get Dribble followers for given account
		 *
		 * Will be called by "SocialBox::refresh()"
		 */
		public static function getDribbbleData($dribbbleId){

			/* Fetch data */
			$result = wp_remote_get(self::DRIBBBLE_API_BASE . $dribbbleId);

			/* Check for unsuccessful http requests */
			if(is_wp_error($result) or (wp_remote_retrieve_response_code($result) != 200)){
				return false;
			}

			/* Check for incorrect data */
			$data = json_decode(wp_remote_retrieve_body($result), true);
			if(!is_array($data) or !isset($data['followers_count'])){
				return false;
			}

			/* Return followers count */
			return $data['followers_count'];

		}

		/**
		 * Get Forrst followers for given account
		 *
		 * Will be called by "SocialBox::refresh()"
		 */
		public static function getForrstData($forrstId){

			/* Fix: Forrst requires SSL encrypted requests. This could lead to error on Servers like MAMP/XAMPP,
			   so let's simply disable the server-side SSL validation completely. */
			$args = array(
				'method' => 'GET',
				'timeout' => 5,
				'redirection' => 5,
				'httpversion' => '1.0',
				'blocking' => true,
				'headers' => array(),
				'body' => null,
				'cookies' => array(),
				'sslverify' => false /* <- This is the important part! */
			);

			/* Fetch data */
			$result = wp_remote_get(self::FORRST_API_BASE . $forrstId, $args);

			/* Check for unsuccessful http requests */
			if(is_wp_error($result) or (wp_remote_retrieve_response_code($result) != 200)){
				return false;
			}

			/* Check for incorrect data */
			$data = json_decode(wp_remote_retrieve_body($result), true);
			if(!is_array($data) or !isset($data['resp']['typecast_followers'])){
				return false;
			}

			/* Return followers count */
			return $data['resp']['typecast_followers'];

		}

		/**
		 * Get Digg followers for given account
		 *
		 * Will be called by "SocialBox::refresh()"
		 */
		public static function getDiggData($diggId){

			/* Fetch data */
			$result = wp_remote_get(self::DIGG_API_BASE . $diggId);

			/* Check for unsuccessful http requests */
			if(is_wp_error($result) or (wp_remote_retrieve_response_code($result) != 200)){
				return false;
			}

			/* Check for incorrect data */
			$data = json_decode(wp_remote_retrieve_body($result), true);
			if(!is_array($data) or !isset($data['users'][$diggId]['followers'])){
				return false;
			}

			/* Return followers count */
			return $data['users'][$diggId]['followers'];

		}

	}

}


text:
<resources>
    <string name="app_name">浏览器</string>
    <string name="action_settings">设置</string>
</resources>


text:
namespace DevOpsAssignment
{
    class Program
    {
        public static void Main(string[] args)
        {

            OutputString os = new OutputString(@"c:\temp\HelloWorld.txt");
            System.Console.WriteLine(StringHelper.HelloWorldString());
            os.Save(StringHelper.HelloWorldString());
            System.Console.ReadLine();
        }
    }
}


text:
var colorutil = require('../app/colorutil.js');

/**
 * PixelData
 * @param {Integer} size
 */
function PixelData(size) {

  this.size = size;
  this.data = new Uint32Array(this.size);

  this.wipe = function() {
    this.data = new Uint32Array(this.size);
    return this;
  }

  this.setOverallColor = function(color) {
    for (var i = 0; i < this.data.length; i++) {
      this.data[i] = color;
    }
  }

  this.setOverallHexColor = function(hexColor) {
    this.setOverallColor(colorutil.hex2Int(hexColor));
  }

  this.setColorAtPosition = function(pos, color) {
    this.data[pos] = color;
  }
  this.setHexColorAtPosition = function(pos, hexColor) {
    this.setColorAtPosition(pos, colorutil.hex2Int(hexColor));
  }

  this.setColorRange = function (range, color) {
    for (var i = 0; i < range.length; i++) {
      this.data[range[i]] = color;
    }
  }

  this.setHexColorRange = function (range, hexColor) {
    this.setColorRange(range, colorutil.hex2Int(hexColor));
  }

  this.setColors = function (positions, colors) {
    if (positions.length != colors.length) {
      // console.log("Invalid parameters for setColors()");
      return;
    }
    for (var i = 0; i < positions.length; i++) {
      this.data[positions[i]] = colors[i];
    }
  }

}

module.exports = PixelData;


text:
using namespace std;

int main()
{
	cv::VideoCapture cap(0);
	cap.set(cv::CAP_PROP_FPS, 60);

	int lowerH = 17, lowerS = 157, lowerV = 132, upperH = 35, upperS = 255, upperV = 255;
	float focalLength = 505, FOV = 76.6, targetWidth = 3;
	//                       In Degrees

	cv::Mat frame;
	VisionCore vcore(focalLength);

	while(true){
		cv::createTrackbar("upperH", "dst", &upperH, 255);
		cv::createTrackbar("upperS", "dst", &upperS, 255);
		cv::createTrackbar("upperV", "dst", &upperV, 255);

		cv::createTrackbar("lowerH", "dst", &lowerH, 255);
		cv::createTrackbar("lowerS", "dst", &lowerS, 255);
		cv::createTrackbar("lowerV", "dst", &lowerV, 255);

		vcore.setBounds(cv::Scalar(lowerH, lowerS, lowerV), cv::Scalar(upperH, upperS, upperV));
		cap >> frame;
		vcore.VisionCore::DetectObjects(frame);

		cv::waitKey(1);
	}

	cap.release();
    return 0;
}


text:
/**
 * Implementation of the distributed flow rule store using p2p synchronization
 * protocol.
 */
package org.onosproject.store.flow.impl;


text:
// Type definitions for rox-react-native 4.8
// Project: https://rollout.io
// Definitions by: ahanriat <https://github.com/ahanriat>
//                 g-guirado <https://github.com/g-guirado>
//                 glenna <https://github.com/glenna>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0

/**
 *
 * Official documentation for rox-react-native is available here:
 * https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api
 *
 */

export interface RoxContainer {
    [key: string]: Flag | Configuration<any> | Variant;
}

/**
 * The register function should be called before the call to Rox.setup()
 *
 * https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api#_register
 */
export function register(namespace: string, roxContainer: RoxContainer): void;

/**
 * Initiate connection with Rox servers for the application identified by the application key.
 * The registered containers will be synced and Rox entities will get the appropriate values.
 *
 * https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api#_setup
 */
export function setup(
    apiKey: string,
    options?: RoxSetupOptions
): Promise<unknown>;

export interface RoxSetupOptions {
    version?: string;
    // https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api#_configurationfetchedhandler
    configurationFetchedHandler?(fetcherResult: RoxFetcherResult): void;
    debugLevel?: 'verbose';
    // https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api#_using_the_impressionhandler_option
    impressionHandler?(reporting: RoxReporting, experiment: RoxExperiment, context: unknown): void;
    platform?: string;
    freeze?: FreezeOptions;
    disableNetworkFetch?: boolean;
    devModeSecret?: string;
    /**
     * Set Roxy's URL for automated tests or local development.
     *
     * https://docs.cloudbees.com/docs/cloudbees-feature-flags/latest/debugging/microservices-automated-testing-and-local-development
     */
    roxy?: string;
    // https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api#_asyncstorage
    AsyncStorage?: any; // AsyncStorage from 'react-native' package
}

export enum RoxFetcherStatus {
    AppliedFromEmbedded = 'APPLIED_FROM_EMBEDDED',
    AppliedFromCache = 'APPLIED_FROM_CACHE',
    AppliedFromNetwork = 'APPLIED_FROM_NETWORK',
    ErrorFetchFailed = 'ERROR_FETCH_FAILED',
}

export interface RoxFetcherResult {
    fetcherStatus: RoxFetcherStatus;
    creationDate: Date;
    hasChanges: boolean;
    errorDetails?: string;
}

export interface RoxReporting {
    name: string;
    value: string;
}

export interface RoxExperiment {
    identifier: string; //  experiment id
    name: string;
    isArchived: boolean;
    labels: string[]; // experiment's labels. assigned from dashboard
}

/**
 * Note that you might have to call unfreeze after setting custom properties such as email after login
 * https://docs.cloudbees.com/docs/cloudbees-feature-flags/latest/feature-releases/custom-properties
 */
export function setCustomNumberProperty(
    name: string,
    value: number | (() => number)
): void;
export function setCustomStringProperty(
    name: string,
    value: string | (() => string)
): void;
export function setCustomBooleanProperty(
    name: string,
    value: boolean | (() => boolean)
): void;
export function setDynamicCustomPropertyRule(
    handler: (propName: string, context: unknown) => number | string | boolean
): void;

/**
 * Unfreeze the state of all flags in code
 * Calling this function will unfreeze all flags, and using a flag will return it's most updated value
 *
 * https://docs.cloudbees.com/docs/cloudbees-feature-flags/latest/feature-flags/flag-freeze#_flag_unfreeze
 * https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api#_unfreeze_4
 */
export function unfreeze(namespace?: string): void;

/**
 * Pulls the latest configuration and flag values down from the Rollout servers
 *
 * https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api#_fetch
 */
export function fetch(): void;

/**
 * Default is untilForeground
 *
 * https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api#_rox_freezeoptions
 */
export enum FreezeOptions {
    freezeOptionUntilLaunch = 1,
    freezeOptionUntilForeground = 2,
    freezeOptionNone = 3,
}

export interface RoxFlagOptions {
    freeze?: FreezeOptions;
}

/**
 * Creates a new Flag
 * https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api#_rox_flag
 */
export class Flag {
    constructor(defaultValue?: boolean, options?: RoxFlagOptions);

    // The name of the Flag
    readonly name: string;

    // Default value of the Flag
    readonly defaultValue: boolean;

    // Returns true when the flag is enabled
    isEnabled(): boolean;

    // Unlock the Flag value from changes from the last time it was freezed
    unfreeze(): void;
}

/**
 * Used to create and manage Rollout feature flags that determine different predefined values
 *
 * https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api#_rox_variant
 */
export class Variant<T extends string = string> {
    constructor(defaultValue: T, options: T[], name?: string);

    // The name of the Flag
    readonly name: string;

    // Default value of the Variant
    readonly defaultValue: BasicType<T>;

    // Returns the current value of the Variant, accounting for value overrides
    getValue(): BasicType<T>;

    // Unlock the Flag value from changes from the last time it was freezed
    unfreeze(): void;
}

/**
 * manages a remote configuration setting with a value of type string, boolean, or number.
 * The constructor sets the default value for the remote configuration setting
 *
 * https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api#_rox_configuration
 */
export class Configuration<T extends string | boolean | number = string> {
    constructor(defaultValue: T);

    // The name of the Configuration
    readonly name: string;

    // Default value of the Configuration
    readonly defaultValue: BasicType<T>;

    // Returns the current value of the Configuration, accounting for value overrides
    getValue(): BasicType<T>;

    // Unlock the Configuration value from changes from the last time it was freezed
    unfreeze(): void;
}

/**
 * Ensure that TypeScript properly types things with a basic type.
 * For example, if T is true, returned type shall be boolean, not true
 */
export type BasicType<T> = T extends boolean ? boolean : T extends number ? number : T extends string ? string : never;

/**
 * Override: Should only be used for development purposes (QA - Feature dev - e2e)
 *
 * When you override an existing flag value using the Rox.overrides.setOverride method,
 * the SDK will disregard existing configuration coming from the dashboard and will
 * serialize the override on disk this value will be loaded and override the flag
 * right after you call Rox.setup. To clear the override from the cache you need to
 * call the Rox.overrides.clearOverride method
 *
 * https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api#_rox_overrides
 */
export namespace overrides {
    /**
     * Sets an override value on a specific flag, this function accepts two parameters flag name (
     * full flag name including namespace) and desired value (from type String).
     * This function also saves the override value on the local device disk,
     * so it is "remembered" for the next the SDK is loaded to production.
     *
     * https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api#_rox_overrides_setoverride
     *
     * Note that for boolean flag we still give the value as a string.
     */
    function setOverride(nameSpacedFlagName: string, value: string | 'false' | 'true'): void;

    /**
     * Clears the override value from the flag (and the disk).
     *
     * https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api#_rox_overrides_clearoverride
     */
    function clearOverride(nameSpacedFlagName: string): void;

    function getOriginalValue(nameSpacedFlagName: string): string;

    /**
     * full flag name including namespace
     *
     * https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/4.9/api-reference/react-native-api#_rox_overrides_hasoverride
     */
    function hasOverride(nameSpacedFlagName: string): boolean;
}

/**
 * Dynamic API is an alternative to Rollout static API for defining flags on the
 * different container objects and accessing them from that container object.
 * https://docs.cloudbees.com/docs/cloudbees-feature-flags/latest/feature-flags/dynamic-api
 */
export namespace dynamicApi {
    /**
     * Getting boolean value of a flag
     */
    function isEnabled(nameSpacedFlagName: string, defaultValue: boolean, context?: unknown): boolean;

    /**
     * Getting string value of a Variant flag
     */
    function value(nameSpacedFlagName: string, defaultValue: string, context?: unknown): string;
  }

export const flags: ReadonlyArray<Flag>;


text:
@interface AddTripViewController : UITableViewController

@property (weak, nonatomic) IBOutlet UITextField *storeName;
@property (weak, nonatomic) IBOutlet UIDatePicker *tripDate;

//*****************************************
//                 Methods
//*****************************************

- (IBAction)dismissModal:(id)sender;
- (IBAction)dismissModalSave:(id)sender;

@end


text:
import celery.exceptions
from django.db import transaction
from django.db.utils import OperationalError
import logging
import traceback

from vimma.models import Audit, VM, User

log = logging.getLogger(__name__)

class Auditor():
    """
    Auditor logs messages to both the DB and Python Standard Logging.

    Standard library logging uses the logger with the name you provide.
    Intended usage:
        from vimma.audit import Auditor
        aud = Auditor(__name__)
        …
        aud.warning(…)
    meant to be similar to standard logging usage:
        import logging
        log = logging.getLogger(__name__)
        …
        log.warning(…)
    """

    def __init__(self, name=None):
        self.name = name
        self.logger = logging.getLogger(self.name)

    def _std_log(self, level, msg, *args, vm_id=None, user_id=None):
        """
        Log to Python Standard Logging.

        Level is the Audit.* level.
        """
        if level in Audit.STD_LEVEL:
            std_lvl = Audit.STD_LEVEL[level]
        else:
            log.warning('Unknown Audit level '{}''.format(level))
            std_lvl = logging.ERROR

        self.logger.log(std_lvl, '{}, vm_id={}, user_id={}'.format(
            msg, vm_id, user_id))

    def log(self, level, msg, *args, vm_id=None, user_id=None):
        """
        Log audit message with Audit.* level and VM and User with given IDs.

        The message goes to both a new Audit object and Python's Standard
        Logging.
        This method tries to suppress all exceptions raised from its
        implementation (other than incorrect usage of this method itself).
        """
        if args:
            raise TypeError('{} extra positional args'.format(len(args)))

        try:
            text = '{}: {}'.format(self.name, msg)
            #with transaction.atomic():
            vm = VM.objects.get(id=vm_id) if vm_id else None
            user = User.objects.get(id=user_id) if user_id else None
            Audit.objects.create(level=level, text=text,
                    vm=vm, user=user).full_clean()
        except OperationalError as e:
            # Likely the DB is locked. Don't pollute the logs with a stack
            # trace in this case.
            log.warning('OperationalError: ' + str(e))
        except:
            log.error(traceback.format_exc())
        finally:
            self._std_log(level, msg, vm_id=vm_id, user_id=user_id)

    def debug(self, *args, **kwargs):
        self.log(Audit.DEBUG, *args, **kwargs)

    def info(self, *args, **kwargs):
        self.log(Audit.INFO, *args, **kwargs)

    def warning(self, *args, **kwargs):
        self.log(Audit.WARNING, *args, **kwargs)

    def error(self, *args, **kwargs):
        self.log(Audit.ERROR, *args, **kwargs)

    def ctx_mgr(self, *args, user_id=None, vm_id=None):
        """
        Return a new Context Manager which audits if an exception is raised.

        Usage (args are optional):
            with aud.ctx_mgr(user_id=…, vm_id=…):
                «code»

        If the with-block doesn't raise an exception, nothing is audited.
        If the with-block raises an exception, the context manager calls
        aud.error(…) on this Audit object then lets the exception be re-raised
        by the with-statement.
        """
        if args:
            raise TypeError('{} extra positional args'.format(len(args)))

        return _CtxMgr(self, user_id=user_id, vm_id=vm_id)

    def celery_retry_ctx_mgr(self, task_obj, task_description,
            *args, user_id=None, vm_id=None):
        """
        Return a new Context Manager which retries a celery task on exception.

        If the protected block doesn't raise an exception, nothing is audited.

        If the type of the exception thrown is a subclass of
        celery.exceptions.Retry or celery.exceptions.MaxRetriesExceededError,
        the context manager audits the exception then lets it be re-raised by
        the with-statement.

        If the protected block throws any other exception (E*), the context
        manager audits it, then calls .retry() on the celery task object.
        Any exception raised by this call is audited and allowed to propagate.
        If .retry() doesn't raise an exception, the context manager lets (E*)
        be re-raised by the with-statement.
        """
        if args:
            raise TypeError('{} extra positional args'.format(len(args)))

        return _CeleryRetryCtxMgr(self, task_obj, task_description,
                user_id=user_id, vm_id=vm_id)

class _CtxMgr():
    """
    Context Manager, meant to be used via Auditor(…).ctx_mgr(…).
    """

    def __init__(self, auditor, *args, user_id=None, vm_id=None):
        self.auditor = auditor
        self.user_id = user_id
        self.vm_id = vm_id

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_value, tb):
        if exc_type is None and exc_value is None and tb is None:
            return
        msg = ''.join(traceback.format_exception(exc_type, exc_value, tb))
        self.auditor.error(msg, vm_id=self.vm_id, user_id=self.user_id)
        return False

class _CeleryRetryCtxMgr():
    """
    Context manager, meant to be used via Auditor(…).celery_retry_ctx_mgr(…).
    """

    def __init__(self, auditor, task_obj, task_description,
            *args, user_id=None, vm_id=None):
        self.auditor = auditor
        self.task_obj = task_obj
        self.task_description = task_description
        self.user_id = user_id
        self.vm_id = vm_id

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_value, tb):
        if exc_type is None and exc_value is None and tb is None:
            return

        msg = ''.join(traceback.format_exception(exc_type, exc_value, tb))
        kw_args = {'user_id': self.user_id, 'vm_id': self.vm_id}

        if issubclass(exc_type, celery.exceptions.Retry):
            self.auditor.warning('{}: retry\n{}'.format(self.task_description,
                msg), **kw_args)
            return False
        if issubclass(exc_type, celery.exceptions.MaxRetriesExceededError):
            self.auditor.error('{}: max. retries exceeded\n{}'.format(
                self.task_description, msg), **kw_args)
            return False

        self.auditor.error('{}:\n{}'.format(self.task_description, msg),
                **kw_args)

        try:
            self.task_obj.retry()
            return False
        except celery.exceptions.Retry:
            msg = ''.join(traceback.format_exc())
            self.auditor.warning('{}: retry\n{}'.format(self.task_description,
                msg), **kw_args)
            raise
        except celery.exceptions.MaxRetriesExceededError:
            msg = ''.join(traceback.format_exc())
            self.auditor.error('{}: max. retries exceeded\n{}'.format(
                self.task_description, msg), **kw_args)
            raise


text:
<?php
/* @var $this UserController */
/* @var $model User */
/* @var $form CActiveForm */
?>

<?php $form=$this->beginWidget('CActiveForm', array(
	'action'=>Yii::app()->createUrl($this->route),
	'method'=>'get',
)); ?>

		<?php echo $form->label($model,'id'); ?>
		<?php echo $form->textField($model,'id',array('size'=>20,'maxlength'=>20)); ?>

		<?php echo $form->label($model,'email'); ?>
		<?php echo $form->textField($model,'email',array('size'=>50,'maxlength'=>50)); ?>

		<?php echo $form->label($model,'first'); ?>
		<?php echo $form->textField($model,'first',array('size'=>20,'maxlength'=>20)); ?>

		<?php echo $form->label($model,'last'); ?>
		<?php echo $form->textField($model,'last',array('size'=>20,'maxlength'=>20)); ?>

		<?php echo $form->label($model,'language'); ?>
		<?php echo $form->textField($model,'language',array('size'=>4,'maxlength'=>4)); ?>

		<?php echo $form->label($model,'gender'); ?>
		<?php echo $form->textField($model,'gender'); ?>

		<?php echo $form->label($model,'birthday'); ?>
		<?php echo $form->textField($model,'birthday'); ?>

		<?php echo $form->label($model,'weight'); ?>
		<?php echo $form->textField($model,'weight'); ?>

		<?php echo $form->label($model,'height'); ?>
		<?php echo $form->textField($model,'height'); ?>

		<?php echo $form->label($model,'create_date'); ?>
		<?php echo $form->textField($model,'create_date'); ?>

		<?php echo $form->label($model,'last_update'); ?>
		<?php echo $form->textField($model,'last_update'); ?>

		<?php echo $form->label($model,'role'); ?>
		<?php echo $form->textField($model,'role'); ?>

		<?php echo $form->label($model,'active'); ?>
		<?php echo $form->textField($model,'active'); ?>

		<?php echo CHtml::submitButton('Search'); ?>

<?php $this->endWidget(); ?>


text:
package com.planet_ink.coffee_mud.Abilities.Spells;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

@SuppressWarnings("rawtypes")
public class Spell_BurningHands extends Spell
{
	@Override public String ID() { return "Spell_BurningHands"; }
	private final static String localizedName = CMLib.lang()._("Burning Hands");
	@Override public String name() { return localizedName; }
	private final static String localizedStaticDisplay = CMLib.lang()._("(Burning Hands spell)");
	@Override public String displayText() { return localizedStaticDisplay; }
	@Override public int abstractQuality(){return Ability.QUALITY_MALICIOUS;}
	@Override public int classificationCode(){	return Ability.ACODE_SPELL|Ability.DOMAIN_ALTERATION;}
	@Override public long flags(){return Ability.FLAG_FIREBASED;}

	@Override
	public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel)
	{
		final MOB target=this.getTarget(mob,commands,givenTarget);
		if(target==null) return false;

		// the invoke method for spells receives as
		// parameters the invoker, and the REMAINING
		// command line parameters, divided into words,
		// and added as String objects to a vector.
		if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
			return false;

		// now see if it worked
		final boolean success=proficiencyCheck(mob,0,auto);

		if(success)
		{
			// it worked, so build a copy of this ability,
			// and add it to the affects list of the
			// affected MOB.  Then tell everyone else
			// what happened.
			final CMMsg msg=CMClass.getMsg(mob,target,this,CMMsg.MASK_HANDS|verbalCastCode(mob,target,auto),_((auto?"":"^S<S-NAME> incant(s) and reach(es) for <T-NAMESELF>.  ")+"A fan of flames erupts!^?")+CMLib.protocol().msp("fireball.wav",40));
			final CMMsg msg2=CMClass.getMsg(mob,target,this,CMMsg.MSK_CAST_MALICIOUS_VERBAL|CMMsg.TYP_FIRE|(auto?CMMsg.MASK_ALWAYS:0),null);
			if((mob.location().okMessage(mob,msg))&&(mob.location().okMessage(mob,msg2)))
			{
				mob.location().send(mob,msg);
				invoker=mob;
				mob.location().send(mob,msg2);
				int damage = 0;
				final int maxDie =  (adjustedLevel(mob,asLevel)+(2*super.getX1Level(mob))/2);
				damage += CMLib.dice().roll(1,maxDie,15);
				if((msg2.value()>0)||(msg.value()>0))
					damage = (int)Math.round(CMath.div(damage,2.0));
				if(target.location()==mob.location())
					CMLib.combat().postDamage(mob,target,this,damage,CMMsg.MASK_ALWAYS|CMMsg.TYP_FIRE,Weapon.TYPE_BURNING,"The flaming hands <DAMAGE> <T-NAME>!");
			}
		}
		else
			return maliciousFizzle(mob,target,_("<S-NAME> incant(s) and reach(es) for <T-NAMESELF>, but flub(s) the spell."));

		// return whether it worked
		return success;
	}
}


text:
#include "config.h"
#include "CryptoAlgorithmRegistry.h"

#if ENABLE(SUBTLE_CRYPTO)

#include "CryptoAlgorithm.h"
#include <mutex>
#include <wtf/NeverDestroyed.h>

namespace WebCore {

CryptoAlgorithmRegistry& CryptoAlgorithmRegistry::shared()
{
    static NeverDestroyed<CryptoAlgorithmRegistry> registry;

    return registry;
}

static std::mutex& registryMutex()
{
    static std::once_flag onceFlag;
    static LazyNeverDestroyed<std::mutex> mutex;

    std::call_once(onceFlag, []{
        mutex.construct();
    });

    return mutex;
}

CryptoAlgorithmRegistry::CryptoAlgorithmRegistry()
{
    platformRegisterAlgorithms();
}

bool CryptoAlgorithmRegistry::getIdentifierForName(const String& name, CryptoAlgorithmIdentifier& result)
{
    if (name.isEmpty())
        return false;

    std::lock_guard<std::mutex> lock(registryMutex());

    auto iter = m_nameToIdentifierMap.find(name.isolatedCopy());
    if (iter == m_nameToIdentifierMap.end())
        return false;

    result = iter->value;
    return true;
}

String CryptoAlgorithmRegistry::nameForIdentifier(CryptoAlgorithmIdentifier identifier)
{
    std::lock_guard<std::mutex> lock(registryMutex());

    return m_identifierToNameMap.get(static_cast<unsigned>(identifier)).isolatedCopy();
}

std::unique_ptr<CryptoAlgorithm> CryptoAlgorithmRegistry::create(CryptoAlgorithmIdentifier identifier)
{
    std::lock_guard<std::mutex> lock(registryMutex());

    auto iter = m_identifierToConstructorMap.find(static_cast<unsigned>(identifier));
    if (iter == m_identifierToConstructorMap.end())
        return nullptr;

    return iter->value();
}

void CryptoAlgorithmRegistry::registerAlgorithm(const String& name, CryptoAlgorithmIdentifier identifier, CryptoAlgorithmConstructor constructor)
{
    std::lock_guard<std::mutex> lock(registryMutex());

    bool added = m_nameToIdentifierMap.add(name, identifier).isNewEntry;
    ASSERT_UNUSED(added, added);

    added = m_identifierToNameMap.add(static_cast<unsigned>(identifier), name).isNewEntry;
    ASSERT_UNUSED(added, added);

    added = m_identifierToConstructorMap.add(static_cast<unsigned>(identifier), constructor).isNewEntry;
    ASSERT_UNUSED(added, added);
}

} // namespace WebCore

#endif // ENABLE(SUBTLE_CRYPTO)


text:
layout: model
title: Mapping RxNorm Codes with Corresponding UMLS Codes
author: John Snow Labs
name: rxnorm_umls_mapper
date: 2022-06-24
tags: [rxnorm, umls, chunk_mapper, en, licensed]
task: Chunk Mapping
language: en
edition: Healthcare NLP 3.5.3
spark_version: 3.0
supported: true
annotator: ChunkMapperModel
article_header:
type: cover
use_language_switcher: "Python-Scala-Java"
---

## Description

This pretrained model maps RxNorm codes with corresponding UMLS Codes.

## Predicted Entities

{:.btn-box}
<button class="button button-orange" disabled>Live Demo</button>
[Open in Colab](https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/Certification_Trainings/Healthcare/26.Chunk_Mapping.ipynb){:.button.button-orange.button-orange-trans.co.button-icon}
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/clinical/models/rxnorm_umls_mapper_en_3.5.3_3.0_1656088714126.zip){:.button.button-orange.button-orange-trans.arr.button-icon}

## How to use

<div class="tabs-box" markdown="1">
{% include programmingLanguageSelectScalaPythonNLU.html %}
```python
documentAssembler = DocumentAssembler()\
.setInputCol("text")\
.setOutputCol("ner_chunk")

sbert_embedder = BertSentenceEmbeddings\
.pretrained("sbiobert_base_cased_mli", "en","clinical/models")\
.setInputCols(["ner_chunk"])\
.setOutputCol("sbert_embeddings")

rxnorm_resolver = SentenceEntityResolverModel\
.pretrained("sbiobertresolve_rxnorm_augmented", "en", "clinical/models")\
.setInputCols(["ner_chunk", "sbert_embeddings"])\
.setOutputCol("rxnorm_code")\
.setDistanceFunction("EUCLIDEAN")

chunkerMapper = ChunkMapperModel.pretrained("rxnorm_umls_mapper", "en", "clinical/models")\
.setInputCols(["rxnorm_code"])\
.setOutputCol("mappings")\
.setRels(["umls_code"])

pipeline = Pipeline(
stages = [
documentAssembler,
sbert_embedder,
rxnorm_resolver,
chunkerMapper
])

model = pipeline.fit(spark.createDataFrame([['']]).toDF('text'))

lp= LightPipeline(model)
result = lp.fullAnnotate(["amlodipine 5 MG", "hydrochlorothiazide 25 MG"])
```
```scala
val documentAssembler = new DocumentAssembler()
.setInputCol("text")
.setOutputCol("ner_chunk")

val sbert_embedder = BertSentenceEmbeddings
.pretrained("sbiobert_base_cased_mli", "en","clinical/models")
.setInputCols(Array("ner_chunk"))
.setOutputCol("sbert_embeddings")

val rxnorm_resolver = SentenceEntityResolverModel
.pretrained("sbiobertresolve_rxnorm_augmented", "en", "clinical/models")
.setInputCols(Array("ner_chunk", "sbert_embeddings"))
.setOutputCol("rxnorm_code")
.setDistanceFunction("EUCLIDEAN")

val chunkerMapper = ChunkMapperModel.pretrained("rxnorm_umls_mapper", "en", "clinical/models")
.setInputCols(Array("rxnorm_code"))
.setOutputCol("mappings")
.setRels(Array("umls_code"))

val pipeline = new Pipeline(stages = Array(documentAssembler,
sbert_embedder,
rxnorm_resolver,
chunkerMapper)

val model = pipeline.fit(Seq("").toDF("text"))

val lp= LightPipeline(model)
val result = lp.fullAnnotate(Seq("amlodipine 5 MG", "hydrochlorothiazide 25 MG"))
```

{:.nlu-block}
```python
import nlu
nlu.load("en.rxnorm_to_umls").predict("""hydrochlorothiazide 25 MG""")
```

</div>

## Results

```bash
|    | chunk                     |   rxnorm_code | umls_mappings   |
|---:|:--------------------------|--------------:|:----------------|
|  0 | amlodipine 5 MG           |        329528 | C1124796        |
|  1 | hydrochlorothiazide 25 MG |        310798 | C0977518        |
```

{:.model-param}
## Model Information

{:.table-model}
|---|---|
|Model Name:|rxnorm_umls_mapper|
|Compatibility:|Healthcare NLP 3.5.3+|
|License:|Licensed|
|Edition:|Official|
|Input Labels:|[rxnorm_code]|
|Output Labels:|[mappings]|
|Language:|en|
|Size:|1.9 MB|


text:
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.build;

import com.android.tools.r8.DiagnosticsHandler;
import com.android.tools.r8.retrace.ProguardMappingSupplier;
import com.android.tools.r8.retrace.Retrace;
import com.android.tools.r8.retrace.RetraceCommand;
import com.android.tools.r8.retrace.StackTraceSupplier;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.List;

/**
 * A wrapper around ReTrace that:
 *  1. Hardcodes a more useful line regular expression
 *  2. Disables output buffering
 */
public class FlushingReTrace {
    // E.g.: D/ConnectivityService(18029): Message
    // E.g.: W/GCM     ( 151): Message
    // E.g.: 09-08 14:22:59.995 18029 18055 I ProcessStatsService: Message
    // E.g.: 09-08 14:30:59.145 17731 18020 D MDnsDS  : Message
    private static final String LOGCAT_PREFIX =
            "(?:[VDIWEF]/.*?\\( *\\d+\\): |\\d\\d-\\d\\d [0-9:. ]+[VDIWEF] .*?: )?";

    // Note: Order of these sub-patterns defines their precedence.
    // Note: Deobfuscation of methods without the presense of line numbers basically never works.
    // There is a test for these pattern at //build/android/stacktrace/java_deobfuscate_test.py
    private static final String LINE_PARSE_REGEX =
            // Eagerly match logcat prefix to avoid conflicting with the patterns below.
            LOGCAT_PREFIX
            + "(?:"
            // Based on default ReTrace regex, but with whitespaces allowed in file:line parentheses
            // and "at" changed to to allow :
            // E.g.: 06-22 13:58:02.895  4674  4674 E THREAD_STATE:     bLA.a( PG : 173 )
            // Normal stack trace lines look like:
            // \tat org.chromium.chrome.browser.tab.Tab.handleJavaCrash(Tab.java:682)
            + "(?:.*?(?::|\\bat)\\s+%c\\.%m\\s*\\(\\s*%s(?:\\s*:\\s*%l\\s*)?\\))|"
            // Stack trace from crbug.com/1300215 looks like:
            // 0xffffffff (chromium-TrichromeChromeGoogle.aab-canary-490400033: 70) ii2.p
            + "(?:.*?\\(\\s*%s(?:\\s*:\\s*%l\\s*)?\\)\\s*%c\\.%m)|"
            // E.g.: Caused by: java.lang.NullPointerException: Attempt to read from field 'int bLA'
            // on a null object reference
            + "(?:.*java\\.lang\\.NullPointerException.*[\"']%t\\s*%c\\.(?:%f|%m\\(%a\\))[\"'].*)|"
            // E.g.: java.lang.VerifyError: bLA
            + "(?:java\\.lang\\.VerifyError: %c)|"
            // E.g.: java.lang.NoSuchFieldError: No instance field e of type L...; in class LbxK;
            + "(?:java\\.lang\\.NoSuchFieldError: No instance field %f of type .*? in class L%C;)|"
            // E.g.: Object of type Clazz was not destroyed... (See LifetimeAssert.java)
            + "(?:.*?Object of type %c .*)|"
            // E.g.: VFY: unable to resolve new-instance 3810 (LSome/Framework/Class;) in Lfoo/Bar;
            + "(?:.*L%C;.*)|"
            // E.g.: END SomeTestClass#someMethod
            + "(?:.*?%c#%m.*?)|"
            // Special-case for a common junit logcat message:
            // E.g.: java.lang.NoClassDefFoundError: SomeFrameworkClass in isTestClass for Foo
            + "(?:.* isTestClass for %c)|"
            // E.g.: Caused by: java.lang.RuntimeException: Intentional Java Crash
            + "(?:Caused by: %c:.*)|"
            // Quoted values and lines that end with a class / class+method:
            // E.g.: The class: Foo
            // E.g.: INSTRUMENTATION_STATUS: class=Foo
            // E.g.: NoClassDefFoundError: SomeFrameworkClass in isTestClass for Foo
            // E.g.: Could not find class 'SomeFrameworkClass', referenced from method Foo.bar
            // E.g.: Could not find method SomeFrameworkMethod, referenced from method Foo.bar
            // E.g.: The member "Foo.bar"
            // E.g.: The class "Foobar"
            // Be careful about matching %c without %m since language tags look like class names.
            + "(?:.*?%c\\.%m)|"
            + "(?:.*?\"%c\\.%m\".*)|"
            + "(?:.*\\b(?:[Cc]lass|[Tt]ype)\\b.*?\"%c\".*)|"
            + "(?:.*\\b(?:[Cc]lass|[Tt]ype)\\b.*?%c)|"
            // E.g.: java.lang.RuntimeException: Intentional Java Crash
            + "(?:%c:.*)|"
            // See if entire line matches a class name (e.g. for manual deobfuscation)
            + "(?:%c)"
            + ")";

    private static void usage() {
        System.err.println("Usage: echo $OBFUSCATED_CLASS | java_deobfuscate Foo.apk.mapping");
        System.err.println("Usage: java_deobfuscate Foo.apk.mapping < foo.log");
        System.err.println("Note: Deobfuscation of symbols outside the context of stack "
                + "traces will work only when lines match the regular expression defined "
                + "in FlushingReTrace.java.");
        System.err.println("Also: Deobfuscation of method names without associated line "
                + "numbers does not seem to work.");
        System.exit(1);
    }

    public static void main(String[] args) {
        if (args.length != 1 || args[0].startsWith("-")) {
            usage();
        }

        try {
            ProguardMappingSupplier mappingSupplier =
                    ProguardMappingSupplier.builder()
                            .setProguardMapProducer(() -> new FileInputStream(args[0]))
                            .build();
            // Force earger parsing of .mapping file (~10 second operation). It otherwise would
            // not happen until the first line of input is received.
            // https://crbug.com/1351023
            mappingSupplier.createRetracer(new DiagnosticsHandler() {});

            // This whole command was given to us by the R8 team in b/234758957.
            RetraceCommand retraceCommand =
                    RetraceCommand.builder()
                            .setMappingSupplier(mappingSupplier)
                            .setRetracedStackTraceConsumer(
                                    retraced -> retraced.forEach(System.out::println))
                            .setRegularExpression(LINE_PARSE_REGEX)
                            .setStackTrace(new StackTraceSupplier() {
                                final BufferedReader mReader = new BufferedReader(
                                        new InputStreamReader(System.in, "UTF-8"));

                                @Override
                                public List<String> get() {
                                    try {
                                        String line = mReader.readLine();
                                        if (line == null) {
                                            return null;
                                        }
                                        return Collections.singletonList(line);
                                    } catch (IOException e) {
                                        e.printStackTrace();
                                        return null;
                                    }
                                }
                            })
                            .build();
            Retrace.run(retraceCommand);
        } catch (IOException ex) {
            // Print a verbose stack trace.
            ex.printStackTrace();
            System.exit(1);
        }
        System.exit(0);
    }
}


text:
require 'rubygems'
require 'bundler/setup'

require "windy/version"

module Windy
  # Your code goes here...
end