text:
import { Inject, InjectionToken, Optional } from "@angular/core";
import {
    BaseResponseOptions,
    Connection,
    Headers,
    ReadyState,
    Request,
    RequestMethod,
    Response,
    ResponseOptions,
    URLSearchParams
} from "@angular/http";
import { Observable } from "rxjs/Observable";
import { Observer } from "rxjs/Observer";
import "rxjs/add/operator/delay";

import { STATUS, STATUS_CODE_INFO } from "./http-status-codes";

/**
 * Class that creates seed data for in-memory database
 * Must implement InMemoryDbService.
 */
export const SEED_DATA = new InjectionToken("seedData");

/**
 * Interface for a class that creates an in-memory database
 * Safe for consuming service to morph arrays and objects.
 */
export interface InMemoryDbService {
    /**
     * Creates "database" object hash whose keys are collection names
     * and whose values are arrays of the collection objects.
     *
     * It must be safe to call again and should return new arrays with new objects.
     * This condition allows InMemoryBackendService to morph the arrays and objects
     * without touching the original source data.
     */
    createDb(): {};
}

/**
 * Interface for InMemoryBackend configuration options
 */
export interface InMemoryBackendConfigArgs {
    /**
     * default response options
     */
    defaultResponseOptions?: ResponseOptions;
    /**
     * delay (in ms) to simulate latency
     */
    delay?: number;
    /**
     * false (default) if ok when object-to-delete not found; else 404
     */
    delete404?: boolean;
    /**
     * host for this service
     */
    host?: string;
    /**
     * root path before any API call
     */
    rootPath?: string;
}

/**
 *  InMemoryBackendService configuration options
 *  Usage:
 *    provide(InMemoryBackendConfig, {useValue: {delay:600}}),
 */
export class InMemoryBackendConfig implements InMemoryBackendConfigArgs {
    constructor(config: InMemoryBackendConfigArgs = {}) {
        Object.assign(this, {
            defaultResponseOptions: new BaseResponseOptions(),
            delay: 500,
            delete404: false
        }, config);
    }
}

/**
 * Interface for object w/ info about the current request url
 * extracted from an Http Request
 */
export interface ReqInfo {
    req: Request;
    base: string;
    collection: any[];
    collectionName: string;
    headers: Headers;
    id: any;
    query: URLSearchParams;
    resourceUrl: string;
}

export const isSuccess = (status: number): boolean => (status >= 200 && status < 300);

/**
 * Simulate the behavior of a RESTy web api
 * backed by the simple in-memory data store provided by the injected InMemoryDataService service.
 * Conforms mostly to behavior described here:
 * http://www.restapitutorial.com/lessons/httpmethods.html
 *
 * ### Usage
 *
 * Create InMemoryDataService class the implements InMemoryDataService.
 * Register both this service and the seed data as in:
 * ```
 * // other imports
 * import { HTTPPROVIDERS, XHRBackend } from 'angular2/http';
 * import { InMemoryBackendConfig, InMemoryBackendService, SEEDDATA } from '../in-memory-backend/in-memory-backend.service';
 * import { InMemoryStoryService } from '../api/in-memory-story.service';
 *
 * @Component({
 *   selector: ...,
 *   templateUrl: ...,
 *   providers: [
 *     HTTPPROVIDERS,
 *     provide(XHRBackend, { useClass: InMemoryBackendService }),
 *     provide(SEEDDATA, { useClass: InMemoryStoryService }),
 *     provide(InMemoryBackendConfig, { useValue: { delay: 600 } }),
 *   ]
 * })
 * export class AppComponent { ... }
 * ```
 */

export class InMemoryBackendService {

    protected config: InMemoryBackendConfigArgs = new InMemoryBackendConfig();
    protected db: {};

    constructor(@Inject(SEED_DATA) private seedData: InMemoryDbService,
                @Inject(InMemoryBackendConfig) @Optional() config: InMemoryBackendConfigArgs) {
        this.resetDb();

        let loc = this.getLocation("./");
        this.config.host = loc.host;
        this.config.rootPath = loc.pathname;
        Object.assign(this.config, config);
    }

    createConnection(req: Request): Connection {
        let res = this.handleRequest(req);

        let response = new Observable<Response>((responseObserver: Observer<Response>) => {
            if (isSuccess(res.status)) {
                responseObserver.next(res);
                responseObserver.complete();
            } else {
                responseObserver.error(res);
            }
            return () => {
            }; // unsubscribe function
        });

        response = response.delay(this.config.delay || 500);
        return {
            readyState: ReadyState.Done,
            request: req,
            response
        };
    }

    ////  protected /////

    /**
     * Process Request and return an Http Response object
     * in the manner of a RESTy web api.
     *
     * Expect URI pattern in the form :base/:collectionName/:id?
     * Examples:
     *   // for store with a 'characters' collection
     *   GET api/characters          // all characters
     *   GET api/characters/42       // the character with id=42
     *   GET api/characters?name=^j  // 'j' is a regex; returns characters whose name contains 'j' or 'J'
     *   GET api/characters.json/42  // ignores the ".json"
     *
     *   POST commands/resetDb  // resets the "database"
     */
    protected handleRequest(req: Request) {
        console.log("Handling request", req);
        let {base, collectionName, id, resourceUrl, query} = this.parseUrl(req.url);
        let collection = this.db[collectionName];
        let reqInfo: ReqInfo = {
            req: req,
            base: base,
            collection: collection,
            collectionName: collectionName,
            headers: new Headers({"Content-Type": "application/json"}),
            id: this.parseId(collection, id),
            query: query,
            resourceUrl: resourceUrl
        };

        let options: ResponseOptions;

        try {
            if ("commands" === reqInfo.base.toLowerCase()) {
                options = this.commands(reqInfo);

            } else if (reqInfo.collection) {
                switch (req.method) {
                    case RequestMethod.Get:
                        options = this.get(reqInfo);
                        break;
                    case RequestMethod.Post:
                        options = this.post(reqInfo);
                        break;
                    case RequestMethod.Put:
                        options = this.put(reqInfo);
                        break;
                    case RequestMethod.Delete:
                        options = this.delete(reqInfo);
                        break;
                    default:
                        options = this.createErrorResponse(STATUS.METHOD_NOT_ALLOWED, "Method not allowed");
                        break;
                }

            } else {
                options = this.createErrorResponse(STATUS.NOT_FOUND, `Collection '${collectionName}' not found`);
            }

        } catch (error) {
            let err = error.message || error;
            options = this.createErrorResponse(STATUS.INTERNAL_SERVER_ERROR, `${err}`);
        }

        options = this.setStatusText(options);
        if (this.config.defaultResponseOptions) {
            options = this.config.defaultResponseOptions.merge(options);
        }

        return new Response(options);
    }

    /**
     * Apply query/list parameters as a filter over the collection
     * This impl only supports RegExp queries on string properties of the collection
     * ANDs the conditions together
     */
    protected applyQuery(collection: any[], query: URLSearchParams) {
        // extract filtering conditions - {propertyName, RegExps) - from query/list parameters
        let conditions: { name: string, rx: RegExp }[] = [];
        query.paramsMap.forEach((value: string[], name: string) => {
            value.forEach(v => conditions.push({name, rx: new RegExp(decodeURI(v), "i")}));
        });

        let len = conditions.length;
        if (!len) {
            return collection;
        }

        // AND the RegExp conditions
        return collection.filter(row => {
            let ok = true;
            let i = len;
            while (ok && i) {
                i -= 1;
                let cond = conditions[i];
                ok = cond.rx.test(row[cond.name]);
            }
            return ok;
        });
    }

    protected clone(data: any) {
        return JSON.parse(JSON.stringify(data));
    }

    /**
     * When the `base`="commands", the `collectionName` is the command
     * Example URLs:
     *   commands/resetdb   // Reset the "database" to its original state
     *   commands/config (GET) // Return this service's config object
     *   commands/config (!GET) // Update the config (e.g. delay)
     *
     * Usage:
     *   http.post('commands/resetdb', null);
     *   http.get('commands/config');
     *   http.post('commands/config', '{"delay":1000}');
     */
    protected commands(reqInfo: ReqInfo) {
        let command = reqInfo.collectionName.toLowerCase();
        let method = reqInfo.req.method;
        let options: ResponseOptions;

        switch (command) {
            case "resetdb":
                this.resetDb();
                options = new ResponseOptions({status: STATUS.OK});
                break;
            case "config":
                if (method === RequestMethod.Get) {
                    options = new ResponseOptions({
                        body: this.clone(this.config),
                        status: STATUS.OK
                    });
                } else {
                    // Be nice ... any other method is a config update
                    let body = JSON.parse(<string>reqInfo.req.text() || "{}");
                    Object.assign(this.config, body);
                    options = new ResponseOptions({status: STATUS.NO_CONTENT});
                }
                break;
            default:
                options = this.createErrorResponse(
                    STATUS.INTERNAL_SERVER_ERROR, `Unknown command "${command}"`);
        }
        return options;
    }

    protected createErrorResponse(status: number, message: string) {
        return new ResponseOptions({
            body: {"error": `${message}`},
            headers: new Headers({"Content-Type": "application/json"}),
            status: status
        });
    }

    protected delete({id, collection, collectionName, headers /*, req */}: ReqInfo) {
        if (!id) {
            return this.createErrorResponse(STATUS.NOT_FOUND, `Missing "${collectionName}" id`);
        }
        let exists = this.removeById(collection, id);
        return new ResponseOptions({
            headers: headers,
            status: (exists || !this.config.delete404) ? STATUS.NO_CONTENT : STATUS.NOT_FOUND
        });
    }

    protected findById(collection: any[], id: number | string) {
        return collection.find((item: any) => item.id === id);
    }

    protected genId(collection: any): any {
        // assumes numeric ids
        let maxId = 0;
        collection.reduce((prev: any, item: any) => {
            maxId = Math.max(maxId, typeof item.id === "number" ? item.id : maxId);
        }, null);
        return maxId + 1;
    }

    protected get({id, query, collection, collectionName, headers}: ReqInfo) {
        let data = collection;

        if (id) {
            data = this.findById(collection, id);
        } else if (query) {
            data = this.applyQuery(collection, query);
        }

        if (!data) {
            return this.createErrorResponse(STATUS.NOT_FOUND,
                `'${collectionName}' with id='${id}' not found`);
        }
        return new ResponseOptions({
            body: this.clone(data),
            headers: headers,
            status: STATUS.OK
        });
    }

    protected getLocation(href: string) {
        let l = document.createElement("a");
        l.href = href;
        return l;
    };

    protected indexOf(collection: any[], id: number) {
        return collection.findIndex((item: any) => item.id === id);
    }

    // tries to parse id as number if collection item.id is a number.
    // returns the original param id otherwise.
    protected parseId(collection: { id: any }[], id: string): any {
        if (!id) {
            return null;
        }
        let isNumberId = collection[0] && typeof collection[0].id === "number";
        if (isNumberId) {
            let idNum = parseFloat(id);
            return isNaN(idNum) ? id : idNum;
        }
        return id;
    }

    protected parseUrl(url: string) {
        try {
            let loc = this.getLocation(url);
            let drop = this.config.rootPath.length;
            let urlRoot = "";
            if (loc.host !== this.config.host) {
                // url for a server on a different host!
                // assume it's collection is actually here too.
                drop = 1; // the leading slash
                urlRoot = loc.protocol + "//" + loc.host + "/";
            }
            let path = loc.pathname.substring(drop);
            let [base, collectionName, id] = path.split("/");
            let resourceUrl = urlRoot + base + "/" + collectionName + "/";
            [collectionName] = collectionName.split("."); // ignore anything after the '.', e.g., '.json'
            let query = loc.search && new URLSearchParams(loc.search.substr(1));
            return {base, id, collectionName, resourceUrl, query};
        } catch (err) {
            let msg = `unable to parse url '${url}'; original error: ${err.message}`;
            throw new Error(msg);
        }
    }

    protected post({collection, /* collectionName, */ headers, id, req, resourceUrl}: ReqInfo) {
        let item = JSON.parse(<string>req.text());
        if (!item.id) {
            item.id = id || this.genId(collection);
        }
        // ignore the request id, if any. Alternatively,
        // could reject request if id differs from item.id
        id = item.id;
        let existingIx = this.indexOf(collection, id);
        if (existingIx > -1) {
            collection[existingIx] = item;
            return new ResponseOptions({
                headers: headers,
                status: STATUS.NO_CONTENT
            });
        } else {
            collection.push(item);
            headers.set("Location", resourceUrl + "/" + id);
            return new ResponseOptions({
                headers: headers,
                body: this.clone(item),
                status: STATUS.CREATED
            });
        }
    }

    protected put({id, collection, collectionName, headers, req}: ReqInfo) {
        let item = JSON.parse(<string>req.text());
        if (!id) {
            return this.createErrorResponse(STATUS.NOT_FOUND, `Missing '${collectionName}' id`);
        }
        if (id !== item.id) {
            return this.createErrorResponse(STATUS.BAD_REQUEST,
                `"${collectionName}" id does not match item.id`);
        }
        let existingIx = this.indexOf(collection, id);
        if (existingIx > -1) {
            collection[existingIx] = item;
            return new ResponseOptions({
                headers: headers,
                status: STATUS.NO_CONTENT // successful; no content
            });
        } else {
            collection.push(item);
            return new ResponseOptions({
                body: this.clone(item),
                headers: headers,
                status: STATUS.CREATED
            });
        }
    }

    protected removeById(collection: any[], id: number) {
        let ix = this.indexOf(collection, id);
        if (ix > -1) {
            collection.splice(ix, 1);
            return true;
        }
        return false;
    }

    /**
     * Reset the "database" to its original state
     */
    protected resetDb() {
        this.db = this.seedData.createDb();
    }

    protected setStatusText(options: ResponseOptions) {
        try {
            let statusCode = STATUS_CODE_INFO[options.status];
            options["statusText"] = statusCode ? statusCode.text : "Unknown Status";
            return options;
        } catch (err) {
            return new ResponseOptions({
                status: STATUS.INTERNAL_SERVER_ERROR,
                statusText: "Invalid Server Operation"
            });
        }
    }
}


text:
package org.elasticsearch.common.time;

import org.apache.logging.log4j.LogManager;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.joda.time.DateTimeZone;

import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import static java.util.Map.entry;
import static org.elasticsearch.common.time.DateUtilsRounding.getMonthOfYear;
import static org.elasticsearch.common.time.DateUtilsRounding.getTotalMillisByYearMonth;
import static org.elasticsearch.common.time.DateUtilsRounding.getYear;
import static org.elasticsearch.common.time.DateUtilsRounding.utcMillisAtStartOfYear;

public class DateUtils {
    public static DateTimeZone zoneIdToDateTimeZone(ZoneId zoneId) {
        if (zoneId == null) {
            return null;
        }
        if (zoneId instanceof ZoneOffset) {
            // the id for zoneoffset is not ISO compatible, so cannot be read by ZoneId.of
            return DateTimeZone.forOffsetMillis(((ZoneOffset)zoneId).getTotalSeconds() * 1000);
        }
        return DateTimeZone.forID(zoneId.getId());
    }

    private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(DateFormatters.class));
    // pkg private for tests
    static final Map<String, String> DEPRECATED_SHORT_TIMEZONES;
    public static final Set<String> DEPRECATED_SHORT_TZ_IDS;
    static {
        Map<String, String> tzs = new HashMap<>();
        tzs.put("EST", "-05:00"); // eastern time without daylight savings
        tzs.put("HST", "-10:00");
        tzs.put("MST", "-07:00");
        tzs.put("ROC", "Asia/Taipei");
        tzs.put("Eire", "Europe/London");
        DEPRECATED_SHORT_TIMEZONES = Collections.unmodifiableMap(tzs);
        DEPRECATED_SHORT_TZ_IDS = tzs.keySet();
    }

    // Map of deprecated timezones and their recommended new counterpart
    public static final Map<String, String> DEPRECATED_LONG_TIMEZONES = Map.ofEntries(
            entry("Africa/Asmera", "Africa/Nairobi"),
            entry("Africa/Timbuktu", "Africa/Abidjan"),
            entry("America/Argentina/ComodRivadavia", "America/Argentina/Catamarca"),
            entry("America/Atka", "America/Adak"),
            entry("America/Buenos_Aires", "America/Argentina/Buenos_Aires"),
            entry("America/Catamarca", "America/Argentina/Catamarca"),
            entry("America/Coral_Harbour", "America/Atikokan"),
            entry("America/Cordoba", "America/Argentina/Cordoba"),
            entry("America/Ensenada", "America/Tijuana"),
            entry("America/Fort_Wayne", "America/Indiana/Indianapolis"),
            entry("America/Indianapolis", "America/Indiana/Indianapolis"),
            entry("America/Jujuy", "America/Argentina/Jujuy"),
            entry("America/Knox_IN", "America/Indiana/Knox"),
            entry("America/Louisville", "America/Kentucky/Louisville"),
            entry("America/Mendoza", "America/Argentina/Mendoza"),
            entry("America/Montreal", "America/Toronto"),
            entry("America/Porto_Acre", "America/Rio_Branco"),
            entry("America/Rosario", "America/Argentina/Cordoba"),
            entry("America/Santa_Isabel", "America/Tijuana"),
            entry("America/Shiprock", "America/Denver"),
            entry("America/Virgin", "America/Port_of_Spain"),
            entry("Antarctica/South_Pole", "Pacific/Auckland"),
            entry("Asia/Ashkhabad", "Asia/Ashgabat"),
            entry("Asia/Calcutta", "Asia/Kolkata"),
            entry("Asia/Chongqing", "Asia/Shanghai"),
            entry("Asia/Chungking", "Asia/Shanghai"),
            entry("Asia/Dacca", "Asia/Dhaka"),
            entry("Asia/Harbin", "Asia/Shanghai"),
            entry("Asia/Kashgar", "Asia/Urumqi"),
            entry("Asia/Katmandu", "Asia/Kathmandu"),
            entry("Asia/Macao", "Asia/Macau"),
            entry("Asia/Rangoon", "Asia/Yangon"),
            entry("Asia/Saigon", "Asia/Ho_Chi_Minh"),
            entry("Asia/Tel_Aviv", "Asia/Jerusalem"),
            entry("Asia/Thimbu", "Asia/Thimphu"),
            entry("Asia/Ujung_Pandang", "Asia/Makassar"),
            entry("Asia/Ulan_Bator", "Asia/Ulaanbaatar"),
            entry("Atlantic/Faeroe", "Atlantic/Faroe"),
            entry("Atlantic/Jan_Mayen", "Europe/Oslo"),
            entry("Australia/ACT", "Australia/Sydney"),
            entry("Australia/Canberra", "Australia/Sydney"),
            entry("Australia/LHI", "Australia/Lord_Howe"),
            entry("Australia/NSW", "Australia/Sydney"),
            entry("Australia/North", "Australia/Darwin"),
            entry("Australia/Queensland", "Australia/Brisbane"),
            entry("Australia/South", "Australia/Adelaide"),
            entry("Australia/Tasmania", "Australia/Hobart"),
            entry("Australia/Victoria", "Australia/Melbourne"),
            entry("Australia/West", "Australia/Perth"),
            entry("Australia/Yancowinna", "Australia/Broken_Hill"),
            entry("Brazil/Acre", "America/Rio_Branco"),
            entry("Brazil/DeNoronha", "America/Noronha"),
            entry("Brazil/East", "America/Sao_Paulo"),
            entry("Brazil/West", "America/Manaus"),
            entry("Canada/Atlantic", "America/Halifax"),
            entry("Canada/Central", "America/Winnipeg"),
            entry("Canada/East-Saskatchewan", "America/Regina"),
            entry("Canada/Eastern", "America/Toronto"),
            entry("Canada/Mountain", "America/Edmonton"),
            entry("Canada/Newfoundland", "America/St_Johns"),
            entry("Canada/Pacific", "America/Vancouver"),
            entry("Canada/Yukon", "America/Whitehorse"),
            entry("Chile/Continental", "America/Santiago"),
            entry("Chile/EasterIsland", "Pacific/Easter"),
            entry("Cuba", "America/Havana"),
            entry("Egypt", "Africa/Cairo"),
            entry("Eire", "Europe/Dublin"),
            entry("Europe/Belfast", "Europe/London"),
            entry("Europe/Tiraspol", "Europe/Chisinau"),
            entry("GB", "Europe/London"),
            entry("GB-Eire", "Europe/London"),
            entry("Greenwich", "Etc/GMT"),
            entry("Hongkong", "Asia/Hong_Kong"),
            entry("Iceland", "Atlantic/Reykjavik"),
            entry("Iran", "Asia/Tehran"),
            entry("Israel", "Asia/Jerusalem"),
            entry("Jamaica", "America/Jamaica"),
            entry("Japan", "Asia/Tokyo"),
            entry("Kwajalein", "Pacific/Kwajalein"),
            entry("Libya", "Africa/Tripoli"),
            entry("Mexico/BajaNorte", "America/Tijuana"),
            entry("Mexico/BajaSur", "America/Mazatlan"),
            entry("Mexico/General", "America/Mexico_City"),
            entry("NZ", "Pacific/Auckland"),
            entry("NZ-CHAT", "Pacific/Chatham"),
            entry("Navajo", "America/Denver"),
            entry("PRC", "Asia/Shanghai"),
            entry("Pacific/Johnston", "Pacific/Honolulu"),
            entry("Pacific/Ponape", "Pacific/Pohnpei"),
            entry("Pacific/Samoa", "Pacific/Pago_Pago"),
            entry("Pacific/Truk", "Pacific/Chuuk"),
            entry("Pacific/Yap", "Pacific/Chuuk"),
            entry("Poland", "Europe/Warsaw"),
            entry("Portugal", "Europe/Lisbon"),
            entry("ROC", "Asia/Taipei"),
            entry("ROK", "Asia/Seoul"),
            entry("Singapore", "Asia/Singapore"),
            entry("Turkey", "Europe/Istanbul"),
            entry("UCT", "Etc/UCT"),
            entry("US/Alaska", "America/Anchorage"),
            entry("US/Aleutian", "America/Adak"),
            entry("US/Arizona", "America/Phoenix"),
            entry("US/Central", "America/Chicago"),
            entry("US/East-Indiana", "America/Indiana/Indianapolis"),
            entry("US/Eastern", "America/New_York"),
            entry("US/Hawaii", "Pacific/Honolulu"),
            entry("US/Indiana-Starke", "America/Indiana/Knox"),
            entry("US/Michigan", "America/Detroit"),
            entry("US/Mountain", "America/Denver"),
            entry("US/Pacific", "America/Los_Angeles"),
            entry("US/Samoa", "Pacific/Pago_Pago"),
            entry("Universal", "Etc/UTC"),
            entry("W-SU", "Europe/Moscow"),
            entry("Zulu", "Etc/UTC"));

    public static ZoneId dateTimeZoneToZoneId(DateTimeZone timeZone) {
        if (timeZone == null) {
            return null;
        }
        if (DateTimeZone.UTC.equals(timeZone)) {
            return ZoneOffset.UTC;
        }

        return of(timeZone.getID());
    }

    public static ZoneId of(String zoneId) {
        String deprecatedId = DEPRECATED_SHORT_TIMEZONES.get(zoneId);
        if (deprecatedId != null) {
            deprecationLogger.deprecate("timezone",
                "Use of short timezone id " + zoneId + " is deprecated. Use " + deprecatedId + " instead");
            return ZoneId.of(deprecatedId);
        }
        return ZoneId.of(zoneId).normalized();
    }

    static final Instant MAX_NANOSECOND_INSTANT = Instant.parse("2262-04-11T23:47:16.854775807Z");

    static final long MAX_NANOSECOND_IN_MILLIS = MAX_NANOSECOND_INSTANT.toEpochMilli();

    /**
     * convert a java time instant to a long value which is stored in lucene
     * the long value resembles the nanoseconds since the epoch
     *
     * @param instant the instant to convert
     * @return        the nano seconds and seconds as a single long
     */
    public static long toLong(Instant instant) {
        if (instant.isBefore(Instant.EPOCH)) {
            throw new IllegalArgumentException("date[" + instant + "] is before the epoch in 1970 and cannot be " +
                "stored in nanosecond resolution");
        }
        if (instant.isAfter(MAX_NANOSECOND_INSTANT)) {
            throw new IllegalArgumentException("date[" + instant + "] is after 2262-04-11T23:47:16.854775807 and cannot be " +
                "stored in nanosecond resolution");
        }
        return instant.getEpochSecond() * 1_000_000_000 + instant.getNano();
    }

    /**
     * Returns an instant that is with valid nanosecond resolution. If
     * the parameter is before the valid nanosecond range then this returns
     * the minimum {@linkplain Instant} valid for nanosecond resultion. If
     * the parameter is after the valid nanosecond range then this returns
     * the maximum {@linkplain Instant} valid for nanosecond resolution.
     * <p>
     * Useful for checking if all values for the field are within some range,
     * even if the range's endpoints are not valid nanosecond resolution.
     */
    public static Instant clampToNanosRange(Instant instant) {
        if (instant.isBefore(Instant.EPOCH)) {
            return Instant.EPOCH;
        }
        if (instant.isAfter(MAX_NANOSECOND_INSTANT)) {
            return MAX_NANOSECOND_INSTANT;
        }
        return instant;
    }

    /**
     * convert a long value to a java time instant
     * the long value resembles the nanoseconds since the epoch
     *
     * @param nanoSecondsSinceEpoch the nanoseconds since the epoch
     * @return                      the instant resembling the specified date
     */
    public static Instant toInstant(long nanoSecondsSinceEpoch) {
        if (nanoSecondsSinceEpoch < 0) {
            throw new IllegalArgumentException("nanoseconds [" + nanoSecondsSinceEpoch + "] are before the epoch in 1970 and cannot " +
                "be processed in nanosecond resolution");
        }
        if (nanoSecondsSinceEpoch == 0) {
            return Instant.EPOCH;
        }

        long seconds = nanoSecondsSinceEpoch / 1_000_000_000;
        long nanos = nanoSecondsSinceEpoch % 1_000_000_000;
        return Instant.ofEpochSecond(seconds, nanos);
    }

    /**
     * Convert a nanosecond timestamp in milliseconds
     *
     * @param milliSecondsSinceEpoch the millisecond since the epoch
     * @return                      the nanoseconds since the epoch
     */
    public static long toNanoSeconds(long milliSecondsSinceEpoch) {
        if (milliSecondsSinceEpoch < 0) {
            throw new IllegalArgumentException("milliSeconds [" + milliSecondsSinceEpoch + "] are before the epoch in 1970 and cannot " +
                "be converted to nanoseconds");
        } else if (milliSecondsSinceEpoch > MAX_NANOSECOND_IN_MILLIS) {
            throw new IllegalArgumentException("milliSeconds [" + milliSecondsSinceEpoch + "] are after 2262-04-11T23:47:16.854775807 " +
                "and cannot be converted to nanoseconds");
        }

        return milliSecondsSinceEpoch * 1_000_000;
    }

    /**
     * Convert a nanosecond timestamp in milliseconds
     *
     * @param nanoSecondsSinceEpoch the nanoseconds since the epoch
     * @return                      the milliseconds since the epoch
     */
    public static long toMilliSeconds(long nanoSecondsSinceEpoch) {
        if (nanoSecondsSinceEpoch < 0) {
            throw new IllegalArgumentException("nanoseconds are [" + nanoSecondsSinceEpoch + "] are before the epoch in 1970 and cannot " +
                "be converted to milliseconds");
        }

        if (nanoSecondsSinceEpoch == 0) {
            return 0;
        }

        return nanoSecondsSinceEpoch / 1_000_000;
    }

    /**
     * Rounds the given utc milliseconds sicne the epoch down to the next unit millis
     *
     * Note: This does not check for correctness of the result, as this only works with units smaller or equal than a day
     *       In order to ensure the performance of this methods, there are no guards or checks in it
     *
     * @param utcMillis   the milliseconds since the epoch
     * @param unitMillis  the unit to round to
     * @return            the rounded milliseconds since the epoch
     */
    public static long roundFloor(long utcMillis, final long unitMillis) {
        if (utcMillis >= 0) {
            return utcMillis - utcMillis % unitMillis;
        } else {
            utcMillis += 1;
            return utcMillis - utcMillis % unitMillis - unitMillis;
        }
    }

    /**
     * Round down to the beginning of the quarter of the year of the specified time
     * @param utcMillis the milliseconds since the epoch
     * @return The milliseconds since the epoch rounded down to the quarter of the year
     */
    public static long roundQuarterOfYear(final long utcMillis) {
        int year = getYear(utcMillis);
        int month = getMonthOfYear(utcMillis, year);
        int firstMonthOfQuarter = (((month-1) / 3) * 3) + 1;
        return DateUtils.of(year, firstMonthOfQuarter);
    }

    /**
     * Round down to the beginning of the month of the year of the specified time
     * @param utcMillis the milliseconds since the epoch
     * @return The milliseconds since the epoch rounded down to the month of the year
     */
    public static long roundMonthOfYear(final long utcMillis) {
        int year = getYear(utcMillis);
        int month = getMonthOfYear(utcMillis, year);
        return DateUtils.of(year, month);
    }

    /**
     * Round down to the beginning of the year of the specified time
     * @param utcMillis the milliseconds since the epoch
     * @return The milliseconds since the epoch rounded down to the beginning of the year
     */
    public static long roundYear(final long utcMillis) {
        int year = getYear(utcMillis);
        return utcMillisAtStartOfYear(year);
    }

    /**
     * Round down to the beginning of the week based on week year of the specified time
     * @param utcMillis the milliseconds since the epoch
     * @return The milliseconds since the epoch rounded down to the beginning of the week based on week year
     */
    public static long roundWeekOfWeekYear(final long utcMillis) {
        return roundFloor(utcMillis + 3 * 86400 * 1000L, 604800000) - 3 * 86400 * 1000L;
    }

    /**
     * Return the first day of the month
     * @param year  the year to return
     * @param month the month to return, ranging from 1-12
     * @return the milliseconds since the epoch of the first day of the month in the year
     */
    private static long of(final int year, final int month) {
        long millis = utcMillisAtStartOfYear(year);
        millis += getTotalMillisByYearMonth(year, month);
        return millis;
    }

    /**
     * Returns the current UTC date-time with milliseconds precision.
     * In Java 9+ (as opposed to Java 8) the {@code Clock} implementation uses system's best clock implementation (which could mean
     * that the precision of the clock can be milliseconds, microseconds or nanoseconds), whereas in Java 8
     * {@code System.currentTimeMillis()} is always used. To account for these differences, this method defines a new {@code Clock}
     * which will offer a value for {@code ZonedDateTime.now()} set to always have milliseconds precision.
     *
     * @return {@link ZonedDateTime} instance for the current date-time with milliseconds precision in UTC
     */
    public static ZonedDateTime nowWithMillisResolution() {
        return nowWithMillisResolution(Clock.systemUTC());
    }

    public static ZonedDateTime nowWithMillisResolution(Clock clock) {
        Clock millisResolutionClock = Clock.tick(clock, Duration.ofMillis(1));
        return ZonedDateTime.now(millisResolutionClock);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

    <!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext*.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>

    <!-- Processes application requests -->
    <servlet>
        <servlet-name>appServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/servlet-context.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
        <async-supported>true</async-supported>
    </servlet>

    <servlet-mapping>
        <servlet-name>appServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <filter>
        <filter-name>MultipartFilter</filter-name>
        <filter-class>org.springframework.web.multipart.support.MultipartFilter</filter-class>
    </filter>
    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>

    <filter>
        <filter-name>noCacheFilter</filter-name>
        <filter-class>org.jugbd.mnet.filter.NoCacheFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>noCacheFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>MultipartFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>MdcFilter</filter-name>
        <filter-class>org.jugbd.mnet.filter.MdcFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>MdcFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- Disables Servlet Container welcome file handling. Needed for compatibility with Servlet 3.0 and Tomcat 7.0 -->
    <welcome-file-list>
        <welcome-file></welcome-file>
    </welcome-file-list>

    <error-page>
        <exception-type>java.lang.Exception</exception-type>
        <location>/uncaughtException</location>
    </error-page>

    <error-page>
        <error-code>404</error-code>
        <location>/resourceNotFound</location>
    </error-page>

</web-app>


text:
<!DOCTYPE html>

Testing masks with filters on compositing layers. Left and right columns should look the same.


text:
#ifndef _ASM_TILE_IRQFLAGS_H
#define _ASM_TILE_IRQFLAGS_H

#include <arch/interrupts.h>
#include <arch/chip.h>

/*
 * The set of interrupts we want to allow when interrupts are nominally
 * disabled.  The remainder are effectively "NMI" interrupts from
 * the point of view of the generic Linux code.  Note that synchronous
 * interrupts (aka "non-queued") are not blocked by the mask in any case.
 */
#define LINUX_MASKABLE_INTERRUPTS \
	(~((_AC(1,ULL) << INT_PERF_COUNT) | (_AC(1,ULL) << INT_AUX_PERF_COUNT)))

#if CHIP_HAS_SPLIT_INTR_MASK()
/* The same macro, but for the two 32-bit SPRs separately. */
#define LINUX_MASKABLE_INTERRUPTS_LO (-1)
#define LINUX_MASKABLE_INTERRUPTS_HI \
	(~((1 << (INT_PERF_COUNT - 32)) | (1 << (INT_AUX_PERF_COUNT - 32))))
#endif

#ifndef __ASSEMBLY__

/* NOTE: we can't include <linux/percpu.h> due to #include dependencies. */
#include <asm/percpu.h>
#include <arch/spr_def.h>

/*
 * Set and clear kernel interrupt masks.
 *
 * NOTE: __insn_mtspr() is a compiler builtin marked as a memory
 * clobber.  We rely on it being equivalent to a compiler barrier in
 * this code since arch_local_irq_save() and friends must act as
 * compiler barriers.  This compiler semantic is baked into enough
 * places that the compiler will maintain it going forward.
 */
#if CHIP_HAS_SPLIT_INTR_MASK()
#if INT_PERF_COUNT < 32 || INT_AUX_PERF_COUNT < 32 || INT_MEM_ERROR >= 32
# error Fix assumptions about which word various interrupts are in
#endif
#define interrupt_mask_set(n) do { \
	int __n = (n); \
	int __mask = 1 << (__n & 0x1f); \
	if (__n < 32) \
		__insn_mtspr(SPR_INTERRUPT_MASK_SET_K_0, __mask); \
	else \
		__insn_mtspr(SPR_INTERRUPT_MASK_SET_K_1, __mask); \
} while (0)
#define interrupt_mask_reset(n) do { \
	int __n = (n); \
	int __mask = 1 << (__n & 0x1f); \
	if (__n < 32) \
		__insn_mtspr(SPR_INTERRUPT_MASK_RESET_K_0, __mask); \
	else \
		__insn_mtspr(SPR_INTERRUPT_MASK_RESET_K_1, __mask); \
} while (0)
#define interrupt_mask_check(n) ({ \
	int __n = (n); \
	(((__n < 32) ? \
	 __insn_mfspr(SPR_INTERRUPT_MASK_K_0) : \
	 __insn_mfspr(SPR_INTERRUPT_MASK_K_1)) \
	  >> (__n & 0x1f)) & 1; \
})
#define interrupt_mask_set_mask(mask) do { \
	unsigned long long __m = (mask); \
	__insn_mtspr(SPR_INTERRUPT_MASK_SET_K_0, (unsigned long)(__m)); \
	__insn_mtspr(SPR_INTERRUPT_MASK_SET_K_1, (unsigned long)(__m>>32)); \
} while (0)
#define interrupt_mask_reset_mask(mask) do { \
	unsigned long long __m = (mask); \
	__insn_mtspr(SPR_INTERRUPT_MASK_RESET_K_0, (unsigned long)(__m)); \
	__insn_mtspr(SPR_INTERRUPT_MASK_RESET_K_1, (unsigned long)(__m>>32)); \
} while (0)
#define interrupt_mask_save_mask() \
	(__insn_mfspr(SPR_INTERRUPT_MASK_SET_K_0) | \
	 (((unsigned long long)__insn_mfspr(SPR_INTERRUPT_MASK_SET_K_1))<<32))
#define interrupt_mask_restore_mask(mask) do { \
	unsigned long long __m = (mask); \
	__insn_mtspr(SPR_INTERRUPT_MASK_K_0, (unsigned long)(__m)); \
	__insn_mtspr(SPR_INTERRUPT_MASK_K_1, (unsigned long)(__m>>32)); \
} while (0)
#else
#define interrupt_mask_set(n) \
	__insn_mtspr(SPR_INTERRUPT_MASK_SET_K, (1UL << (n)))
#define interrupt_mask_reset(n) \
	__insn_mtspr(SPR_INTERRUPT_MASK_RESET_K, (1UL << (n)))
#define interrupt_mask_check(n) \
	((__insn_mfspr(SPR_INTERRUPT_MASK_K) >> (n)) & 1)
#define interrupt_mask_set_mask(mask) \
	__insn_mtspr(SPR_INTERRUPT_MASK_SET_K, (mask))
#define interrupt_mask_reset_mask(mask) \
	__insn_mtspr(SPR_INTERRUPT_MASK_RESET_K, (mask))
#define interrupt_mask_save_mask() \
	__insn_mfspr(SPR_INTERRUPT_MASK_K)
#define interrupt_mask_restore_mask(mask) \
	__insn_mtspr(SPR_INTERRUPT_MASK_K, (mask))
#endif

/*
 * The set of interrupts we want active if irqs are enabled.
 * Note that in particular, the tile timer interrupt comes and goes
 * from this set, since we have no other way to turn off the timer.
 * Likewise, INTCTRL_K is removed and re-added during device
 * interrupts, as is the the hardwall UDN_FIREWALL interrupt.
 * We use a low bit (MEM_ERROR) as our sentinel value and make sure it
 * is always claimed as an "active interrupt" so we can query that bit
 * to know our current state.
 */
DECLARE_PER_CPU(unsigned long long, interrupts_enabled_mask);
#define INITIAL_INTERRUPTS_ENABLED (1ULL << INT_MEM_ERROR)

#ifdef CONFIG_DEBUG_PREEMPT
/* Due to inclusion issues, we can't rely on <linux/smp.h> here. */
extern unsigned int debug_smp_processor_id(void);
# define smp_processor_id() debug_smp_processor_id()
#endif

/* Disable interrupts. */
#define arch_local_irq_disable() \
	interrupt_mask_set_mask(LINUX_MASKABLE_INTERRUPTS)

/* Disable all interrupts, including NMIs. */
#define arch_local_irq_disable_all() \
	interrupt_mask_set_mask(-1ULL)

/*
 * Read the set of maskable interrupts.
 * We avoid the preemption warning here via __this_cpu_ptr since even
 * if irqs are already enabled, it's harmless to read the wrong cpu's
 * enabled mask.
 */
#define arch_local_irqs_enabled() \
	(*__this_cpu_ptr(&interrupts_enabled_mask))

/* Re-enable all maskable interrupts. */
#define arch_local_irq_enable() \
	interrupt_mask_reset_mask(arch_local_irqs_enabled())

/* Disable or enable interrupts based on flag argument. */
#define arch_local_irq_restore(disabled) do { \
	if (disabled) \
		arch_local_irq_disable(); \
	else \
		arch_local_irq_enable(); \
} while (0)

/* Return true if "flags" argument means interrupts are disabled. */
#define arch_irqs_disabled_flags(flags) ((flags) != 0)

/* Return true if interrupts are currently disabled. */
#define arch_irqs_disabled() interrupt_mask_check(INT_MEM_ERROR)

/* Save whether interrupts are currently disabled. */
#define arch_local_save_flags() arch_irqs_disabled()

/* Save whether interrupts are currently disabled, then disable them. */
#define arch_local_irq_save() ({ \
	unsigned long __flags = arch_local_save_flags(); \
	arch_local_irq_disable(); \
	__flags; })

/* Prevent the given interrupt from being enabled next time we enable irqs. */
#define arch_local_irq_mask(interrupt) \
	this_cpu_and(interrupts_enabled_mask, ~(1ULL << (interrupt)))

/* Prevent the given interrupt from being enabled immediately. */
#define arch_local_irq_mask_now(interrupt) do { \
	arch_local_irq_mask(interrupt); \
	interrupt_mask_set(interrupt); \
} while (0)

/* Allow the given interrupt to be enabled next time we enable irqs. */
#define arch_local_irq_unmask(interrupt) \
	this_cpu_or(interrupts_enabled_mask, (1ULL << (interrupt)))

/* Allow the given interrupt to be enabled immediately, if !irqs_disabled. */
#define arch_local_irq_unmask_now(interrupt) do { \
	arch_local_irq_unmask(interrupt); \
	if (!irqs_disabled()) \
		interrupt_mask_reset(interrupt); \
} while (0)

#else /* __ASSEMBLY__ */

/* We provide a somewhat more restricted set for assembly. */

#ifdef __tilegx__

#if INT_MEM_ERROR != 0
# error Fix IRQS_DISABLED() macro
#endif

/* Return 0 or 1 to indicate whether interrupts are currently disabled. */
#define IRQS_DISABLED(tmp)					\
	mfspr   tmp, SPR_INTERRUPT_MASK_K;			\
	andi    tmp, tmp, 1

/* Load up a pointer to &interrupts_enabled_mask. */
#define GET_INTERRUPTS_ENABLED_MASK_PTR(reg)			\
	moveli reg, hw2_last(interrupts_enabled_mask);		\
	shl16insli reg, reg, hw1(interrupts_enabled_mask);	\
	shl16insli reg, reg, hw0(interrupts_enabled_mask);	\
	add     reg, reg, tp

/* Disable interrupts. */
#define IRQ_DISABLE(tmp0, tmp1)					\
	moveli  tmp0, hw2_last(LINUX_MASKABLE_INTERRUPTS);	\
	shl16insli tmp0, tmp0, hw1(LINUX_MASKABLE_INTERRUPTS);	\
	shl16insli tmp0, tmp0, hw0(LINUX_MASKABLE_INTERRUPTS);	\
	mtspr   SPR_INTERRUPT_MASK_SET_K, tmp0

/* Disable ALL synchronous interrupts (used by NMI entry). */
#define IRQ_DISABLE_ALL(tmp)					\
	movei   tmp, -1;					\
	mtspr   SPR_INTERRUPT_MASK_SET_K, tmp

/* Enable interrupts. */
#define IRQ_ENABLE_LOAD(tmp0, tmp1)				\
	GET_INTERRUPTS_ENABLED_MASK_PTR(tmp0);			\
	ld      tmp0, tmp0
#define IRQ_ENABLE_APPLY(tmp0, tmp1)				\
	mtspr   SPR_INTERRUPT_MASK_RESET_K, tmp0

#else /* !__tilegx__ */

/*
 * Return 0 or 1 to indicate whether interrupts are currently disabled.
 * Note that it's important that we use a bit from the "low" mask word,
 * since when we are enabling, that is the word we write first, so if we
 * are interrupted after only writing half of the mask, the interrupt
 * handler will correctly observe that we have interrupts enabled, and
 * will enable interrupts itself on return from the interrupt handler
 * (making the original code's write of the "high" mask word idempotent).
 */
#define IRQS_DISABLED(tmp)					\
	mfspr   tmp, SPR_INTERRUPT_MASK_K_0;			\
	shri    tmp, tmp, INT_MEM_ERROR;			\
	andi    tmp, tmp, 1

/* Load up a pointer to &interrupts_enabled_mask. */
#define GET_INTERRUPTS_ENABLED_MASK_PTR(reg)			\
	moveli  reg, lo16(interrupts_enabled_mask);		\
	auli    reg, reg, ha16(interrupts_enabled_mask);	\
	add     reg, reg, tp

/* Disable interrupts. */
#define IRQ_DISABLE(tmp0, tmp1)					\
	{							\
	 movei  tmp0, LINUX_MASKABLE_INTERRUPTS_LO;		\
	 moveli tmp1, lo16(LINUX_MASKABLE_INTERRUPTS_HI)	\
	};							\
	{							\
	 mtspr  SPR_INTERRUPT_MASK_SET_K_0, tmp0;		\
	 auli   tmp1, tmp1, ha16(LINUX_MASKABLE_INTERRUPTS_HI)	\
	};							\
	mtspr   SPR_INTERRUPT_MASK_SET_K_1, tmp1

/* Disable ALL synchronous interrupts (used by NMI entry). */
#define IRQ_DISABLE_ALL(tmp)					\
	movei   tmp, -1;					\
	mtspr   SPR_INTERRUPT_MASK_SET_K_0, tmp;		\
	mtspr   SPR_INTERRUPT_MASK_SET_K_1, tmp

/* Enable interrupts. */
#define IRQ_ENABLE_LOAD(tmp0, tmp1)				\
	GET_INTERRUPTS_ENABLED_MASK_PTR(tmp0);			\
	{							\
	 lw     tmp0, tmp0;					\
	 addi   tmp1, tmp0, 4					\
	};							\
	lw      tmp1, tmp1
#define IRQ_ENABLE_APPLY(tmp0, tmp1)				\
	mtspr   SPR_INTERRUPT_MASK_RESET_K_0, tmp0;		\
	mtspr   SPR_INTERRUPT_MASK_RESET_K_1, tmp1
#endif

#define IRQ_ENABLE(tmp0, tmp1)					\
	IRQ_ENABLE_LOAD(tmp0, tmp1);				\
	IRQ_ENABLE_APPLY(tmp0, tmp1)

/*
 * Do the CPU's IRQ-state tracing from assembly code. We call a
 * C function, but almost everywhere we do, we don't mind clobbering
 * all the caller-saved registers.
 */
#ifdef CONFIG_TRACE_IRQFLAGS
# define TRACE_IRQS_ON  jal trace_hardirqs_on
# define TRACE_IRQS_OFF jal trace_hardirqs_off
#else
# define TRACE_IRQS_ON
# define TRACE_IRQS_OFF
#endif

#endif /* __ASSEMBLY__ */

#endif /* _ASM_TILE_IRQFLAGS_H */


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>gem5: Member List</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">

Main Page

Modules

Namespaces

Classes

Files

Related Pages

      <form action="search.php" method="get">

             Search for
            <input type="text" name="query" value="" size="20" accesskey="s"/>

      </form>

Alphabetical List

Class List

Class Hierarchy

Class Members

HexFile Member List
This is the complete list of members for HexFile, including all inherited members.

close()	HexFile

filename	HexFile	 [protected]

fp	HexFile	 [protected]

HexFile(const std::string _filename)	HexFile

loadSections(PortProxy &memProxy)	HexFile

parseLine(char *, Addr *, uint32_t *)	HexFile	 [protected]

~HexFile()	HexFile	 [virtual]

<address style="align: right;">
Generated on Fri Apr 17 12:39:40 2015 for gem5 by  doxygen 1.4.7</address>


text:
@implementation BZUpdateResponseModel

@end


text:
var mkdirp = require('mkdirp');

module.exports = function (writePath, file, cb) {
  // mode needs to be done
  if (file.stat && typeof file.stat.mode !== 'undefined') {
    mkdirp(writePath, file.stat.mode, cb);
    return;
  }

  // no mode
  mkdirp(writePath, cb);
};


text:
/**
 * CTCI 6th (Indian) Edition.
 * Chapter 1: Arrays & Strings
 * C++11 or C++14 required
 */
#include <bits/stdc++.h> // using GCC/G++11
using namespace std;

/**
 * Utility functions
 */
unsigned int countSpaces(const vector<char> &str, unsigned int trueLen) {
  // count spaces in a char array till only given length
  unsigned int ret = 0;
  for(int i=0; i<trueLen; i++) {
    if(isspace(str[i]))
      ret++;
  }
  return ret;
}

bool isSubstring(const string &a, const string &b) {
  if(a.find(b) != string::npos)
    return true;
  return false;
}

void printMatrix(int **matrix, int N) {
  // print NxN matrix
  for(int i=0; i<N; i++) {
    for(int j=0; j<N; j++)
      cout << matrix[i][j] << " ";
    cout << endl;
  }
}

/* ====== Problem Solutions ======== */

/**
 * 1.1 Is Unique
 * Character Set agnostic solution in O(nlogn)
 */
bool isUnique(string str) {
  sort(str.begin(), str.end());

  for(int i=1; i<str.size(); i++)
    if(str[i] == str[i-1])
      return false;

  return true;
}

/**
 * 1.2 Check Permutation
 * O(nlogn) sort solution
 */
bool checkPerm(string a, string b) {
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());

  return a == b;
}

/**
 * 1.3 URLify
 * In place O(n) algorithm. `url` has enough
 * space and does not require resizing.
 */
void URLify(vector<char> &url, unsigned int trueLen) {
  int writerHead = 2*countSpaces(url, trueLen) + trueLen - 1, readerHead = trueLen - 1;

  while(readerHead >= 0) {
    if(!isspace(url[readerHead]))
      url[writerHead--] = url[readerHead--];
    else {
      url[writerHead--] = '0';
      url[writerHead--] = '2';
      url[writerHead--] = '%';
      readerHead--;
    }
  }
}

/**
 * 1.4 Palindrome Permutation
 * O(|alpha|) extra space + O(n) time algorithm
 */
bool palinPerm(string str) {
  unordered_map<char, int> charMap; // C++11 only
  bool singleSolitary = true;

  transform(str.begin(), str.end(), str.begin(), ::tolower);
  for(char &c: str)
    if(!isspace(c))
      charMap[c]++;

  for(auto &tup: charMap)
    if(tup.second == 1)
      if(singleSolitary)
        singleSolitary = false;
      else
        return false;

  return true;
}

/**
 * 1.5 One Away
 * Simple O(n) algorithm with O(n) extra space
 */
bool oneAway(const string &a, const string &b) {
  if(abs(a.size() - b.size()) > 1)
    return false;

  string shorter = (a.size() < b.size() ? a : b);
  string longer = (a.size() < b.size() ? b : a);

  int shorterindex = 0, longerindex = 0;
  bool alreadyMismatch = false;

  while(shorterindex < shorter.size() && longerindex < longer.size()) {
    // Mismatch occurs
    if(shorter[shorterindex] != longer[longerindex]) {
      // already had a Mismatch, return false
      if(alreadyMismatch)
        return false;

      // register this Mismatch
      alreadyMismatch = true;

      // sizes are same. we can do a replace
      if(shorter.size() == longer.size())
        shorterindex++;

      // else looks like a insertion/deletion. stay put

    } else
    // no miss-match till now, move shorter index
      shorterindex++;

    // always move longer index
    longerindex++;
  }

  return true;
}

/**
 * 1.6 String Compression
 * O(n) time + O(n) space
 */
string compressString(const string &str) {
  int count = 1;
  char prev = str[0];
  string ret;

  for(int i=1; i<str.size(); i++)
    if(str[i] == prev)
      count++;
    else {
      ret += prev + ((count > 1) ? to_string(count) : "");
      count = 1;
      prev = str[i];
    }

  if(count > 0)
    ret += prev + ((count > 1) ? to_string(count) : "");

  return ret;
}

/**
 * 1.7 Rotate Matrix
 * We need to rotate matrix right by 90 degrees
 * (which is effectively a +270 degree rotation)
 * This is similar to spiral matrix printing
 * O(N^2) algorithm
 */
void rotateMatrix(int **matrix, int N) {
  for(int layer = 0; layer < N/2; layer++) {
    int lo = layer, hi = N-1-layer;

    for(int i=lo; i<hi; i++) {
      int offset = i - lo;

      // save top
      int temp = matrix[lo][i];

      // top <- left
      matrix[lo][i] = matrix[hi-offset][lo];

      // left <- bottom
      matrix[hi-offset][lo] = matrix[hi][hi-offset];

      // bottom <- right
      matrix[hi][hi-offset] = matrix[i][hi];

      // right <- top (saved before)
      matrix[i][hi] = temp;
    }
  }
}

/**
 * 1.8 Zero Matrix
 * Simple O(M+N) extra time algorithm
 * with O(M+N) extra space
 */
void zeroMatrix(int **matrix, int rowNum, int colNum) {
  vector<int> rows, cols;

  for(int i=0; i<rowNum; i++)
    for(int j=0; j<colNum; j++) {
      if(matrix[i][j] == 0) {
        rows.push_back(i);
        cols.push_back(j);
      }
    }

  for(int &row: rows) {
    for(int i=0; i<colNum; i++)
      matrix[row][i] = 0;
  }

  for(int &col: cols) {
    for(int i=0; i<rowNum; i++)
      matrix[i][col] = 0;
  }
}

/**
 * 1.9 String Rotation
 * Simple O(n) time + O(n) extra space
 * Check whether s1 is substring of s2+s2
 * or vice-versa
 */
bool stringRotation(const string &s1, const string &s2) {
  if(s1.length() == s2.length())
    return isSubstring(s1+s1, s2);
  return false;
}

/* ======== Testing ======== */
int main() {
  // set cout to display bool names instead of integer
  cout << boolalpha;

  // is unique test
  cout << "Testing isUnique: abcdaefgh "
      << isUnique("abcdaefgh") << endl;

  // check permutation test
  cout << "Testing checkPerm: abc, cab "
      << checkPerm("abc", "cab") << endl;

  // urlify test
  vector<char> url(17);
  string str = "Mr John Smith";
  copy(str.begin(), str.end(), url.begin());
  URLify(url, 13);
  cout << "Testing URLify: " << str << " "
      << string(url.begin(), url.end()) << endl;

  // palindrome permutation test
  cout << "Testing palinPerm: \"Tact Coa\" "
      <<  palinPerm("Tact Coa") << endl
      << "Testing palinPerm: \"TactTCa\" "
      <<  palinPerm("TactTCa") << endl;

  // one away test
  cout << "Testing oneAway: pale, ple "
      << oneAway("pale", "ple") << endl
      << "Testing oneAway: pales, pale "
      << oneAway("pales", "pale") << endl
      << "Testing oneAway: pale, bale "
      << oneAway("pale", "bale") << endl
      << "Testing oneAway: pale, bake "
      << oneAway("pale", "bake") << endl;

  // string compression test
  cout << "Testing compressString: aabcccccaa$$$ "
      << compressString("aabcccccaa$$$") << endl;

  // rotate matrix test
  int **mat = new int*[4];
  for(int i=0; i<4; i++)
    mat[i] = new int[4];

  for(int i=0; i<16; i++)
    mat[i/4][i - (i/4)*4] = i+1;

  cout << "Testing rotateMatrix:" << endl
      << "Original matrix:" << endl;
  printMatrix(mat, 4);
  rotateMatrix(mat, 4);
  cout << "Rotated matrix:" << endl;
  printMatrix(mat, 4);

  // zero matrix test
  mat[1][2] = mat[2][1] = 0;

  cout << "Testing zeroMatrix:" << endl
      << "Original matrix:" << endl;
  printMatrix(mat, 4);
  zeroMatrix(mat, 4, 4);
  cout << "Zeroed matrix:" << endl;
  printMatrix(mat, 4);

  // cleanup
  for(int i=0; i<4; i++)
    delete[] mat[i];
  delete[] mat;

  // string rotation test
  cout << "Testing stringRotation: watermelon, ermelonwat "
      <<  stringRotation("watermelon", "ermelonwat") << endl
      << "Testing stringRotation: watermelon, ermelonate "
      <<  stringRotation("watermelon", "ermelonate") << endl;

  return 0;
}


text:
Audio Kit Examples
==================

This folder contains examples of simple mini-projects for both iOS devices and on the Mac (OS X).  There are examples in Objective-C as well as Swift.

More information and audio clips for the examples are available at <http://audiokit.io/examples>.


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

	<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
	<title>iGrape Framework</title>

	<?=html::favicon("igrape.png")?>
	<link rel="home" href="http://igrape.org/" title="Home" />
	<link rel="downloads" href="http://igrape.org/" title="Downloads" />
	<link rel="news" href="http://igrape.org/" title="News" />
	<link rel="group" href="http://igrape.org/" title="Group" />
	<link rel="userguide" href="http://igrape.org/" title="User Guide" />
	<link rel="wiki" href="http://igrape.org/" title="Wiki" />
	<link rel="bugtracker" href="http://igrape.org/" title="Bug Tracker" />

	<?=html::css("http://fonts.googleapis.com/css?family=Cantarell")?>
	<?=html::css("http://fonts.googleapis.com/css?family=Droid+Sans")?>
	<?=html::css("style.css")?>

	<meta http-equiv='expires' content='-1' />
	<meta http-equiv='pragma' content='no-cache' />
	<meta name='robots' content='all' />
	<meta name='description' content='iGrape: It is based on solid MVC principles, including separation of display' />
	<meta name='keywords' content='igrape, php, python, ruby, developer, mvc, orm, oop' />

	<link rev="diogocosta" href="http://diogocosta.com.br/"
	title="webdesigner e designer de interfaces" />
	<link rev="ormphp" href="http://phpburn.com/"
	title="orm php" />

	<link rel="alternate" type="application/atom+xml" title="Master Atom feed" href="/atom" />
	<link rel="alternate" type="application/rss+xml" title="Master RSS feed" href="/rss" />

	<link href='<?=html::pathimg("logo.png")?>' rel='icon'/>

			<?=html::img("logo.png",'alt="iGrape Framework"')?>

<a href="<?=url("/")?>">Home

Downloads

Group

Bug Tracker

					Acelere seu código agora.

					Quando você quiser,

					Como você quiser.

					Php, Ruby ou Python. Você escolhe.

iGrape é um framework que te levará a um nível superior.

					Com ele, será possível utilizar um mesmo modo de programação em  várias linguagens de programação diferente. Com uma estrutura modular, baseada em necessidades reais e pessoas reais.

			<?=$_content?>

Obrigado por usar:

				<?=html::img("logo_black.png",'alt="iGrape Framework"')?>

<a href="<?=url("/")?>">Home

Downloads

Group

Bug Tracker

					iGrape Framework está sobre licença New BSD.

					Copyright 2007-<?=date("Y")?> - iGrape Framework - All rights Reserved


text:
package com.stratio.sparta.serving.core.helpers

import java.net.InetSocketAddress
import java.nio.channels.ServerSocketChannel

import com.typesafe.config.ConfigFactory
import org.junit.runner.RunWith
import org.scalatest._
import org.scalatest.junit.JUnitRunner

import com.stratio.sparta.serving.core.SpartaConfig

@RunWith(classOf[JUnitRunner])
class ResourceManagerLinkIT extends FlatSpec with
  ShouldMatchers with Matchers with BeforeAndAfter {

  var serverSocket: ServerSocketChannel = _

  after {
    serverSocket.close()
  }

  it should "return local Spark UI link" in {
    serverSocket = ServerSocketChannel.open()
    val localhostName = java.net.InetAddress.getLocalHost().getHostName()
    serverSocket.socket.bind(new InetSocketAddress(localhostName, 4040))
    val config = ConfigFactory.parseString(
      """
        |sparta{
        |  config {
        |    executionMode = local
        |  }
        |}
      """.stripMargin)
    SpartaConfig.initMainConfig(Option(config))

    ResourceManagerLink.getLink should be(Some(s"http://${localhostName}:4040"))
  }

  /*it should "return Mesos UI link" in {
    serverSocket = ServerSocketChannel.open()
    serverSocket.socket.bind(new InetSocketAddress("127.0.0.1",5050))
    val config = ConfigFactory.parseString(
      """
        |sparta{
        |  config {
        |    executionMode = mesos
        |  }
        |
        |  mesos {
        |    master = "mesos://127.0.0.1:7077"
        |  }
        |}
      """.stripMargin)
    SpartaConfig.initMainConfig(Option(config))

    ResourceManagerLink.getLink should be(Some("http://127.0.0.1:5050"))
  }*/

  it should "return YARN UI link" in {
    serverSocket = ServerSocketChannel.open()
    serverSocket.socket.bind(new InetSocketAddress("localhost",8088))
    val config = ConfigFactory.parseString(
      """
        |sparta{
        |  config {
        |    executionMode = yarn
        |  }
        |
        |  hdfs {
        |    hadoopUserName = stratio
        |    hdfsMaster = localhost
        |    hdfsPort = 8020
        |    pluginsFolder = "plugins"
        |    executionJarFolder = "driver"
        |    classpathFolder = "classpath"
        |  }
        |
        |  yarn {
        |    master = yarn-cluster
        |  }
        |}
      """.stripMargin)
    SpartaConfig.initMainConfig(Option(config))

    ResourceManagerLink.getLink should be(Some("http://localhost:8088"))
  }

  it should "return Spark Standalone UI link" in {
    serverSocket = ServerSocketChannel.open()
    serverSocket.socket.bind(new InetSocketAddress("localhost",8080))
    val config = ConfigFactory.parseString(
      """
        |sparta{
        |  config {
        |    executionMode = standalone
        |  }
        |
        |  standalone {
        |    master = "spark://localhost:4040"
        |  }
        |}
      """.stripMargin)
    SpartaConfig.initMainConfig(Option(config))

    ResourceManagerLink.getLink should be(Some("http://localhost:8080"))
  }

}


text:
#include <cmath>
#include <Corrade/TestSuite/Tester.h>

#include "Magnum/Math/Constants.h"
#include "Magnum/Math/Functions.h"

namespace Magnum { namespace Math { namespace Test {

struct ConstantsTest: Corrade::TestSuite::Tester {
    explicit ConstantsTest();

    void constants();
    void specials();

    private:
        template<class> void _constants();
        template<class> void _specials();
};

ConstantsTest::ConstantsTest() {
    addTests({&ConstantsTest::constants,
              &ConstantsTest::specials});
}

void ConstantsTest::constants() {
    _constants<Float>();
    #ifndef MAGNUM_TARGET_GLES
    _constants<Double>();
    #endif
}

void ConstantsTest::specials() {
    _specials<Float>();
    #ifndef MAGNUM_TARGET_GLES
    _specials<Double>();
    #endif
}

template<class T> void ConstantsTest::_constants() {
    constexpr T a = Constants<T>::sqrt2();
    constexpr T b = Constants<T>::sqrt3();
    CORRADE_COMPARE(Math::pow<2>(a), T(2));
    CORRADE_COMPARE(Math::pow<2>(b), T(3));

    constexpr T c = Constants<T>::pi();
    constexpr T d = Constants<T>::piHalf();
    constexpr T e = Constants<T>::tau();
    CORRADE_COMPARE(T(0.5)*c, d);
    CORRADE_COMPARE(T(2.0)*c, e);

    constexpr T f = Constants<T>::e();
    CORRADE_COMPARE(std::log(f), T(1));
}

template<class T> void ConstantsTest::_specials() {
    #ifndef CORRADE_MSVC2015_COMPATIBILITY /* NaN is not constexpr */
    constexpr
    #endif
    T a = Constants<T>::nan();
    CORRADE_VERIFY(std::isnan(a));
    CORRADE_VERIFY(a != a);

    constexpr T b = Constants<T>::inf();
    CORRADE_VERIFY(std::isinf(b));

    /* Clang complains that producing NaN is not constexpr */
    T h = Constants<T>::inf() - Constants<T>::inf();
    CORRADE_VERIFY(h != h);
}

}}}

CORRADE_TEST_MAIN(Magnum::Math::Test::ConstantsTest)


text:
<?php

namespace GEPedag\EstudianteBundle\Controller;

//use Doctrine\ORM\Tools\Pagination\Paginator;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; //al parecer tienen que estar en este orden
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use GEPedag\EntidadesBundle\Entity\Estudiante;
use GEPedag\EstudianteBundle\Form\EstudianteType;

class EstudianteController extends Controller {

    /**
     * @Method("GET")
     * @Template("GEPedagEstudianteBundle:Estudiante:index.html.twig")
     */
    public function indexAction() {
        $em = $this->getDoctrine()->getManager();
        //$paginator = new Paginator($query, $fetchJoinCollection = true);
        return ['entities' =>
            $em->getRepository('GEPedagEntidadesBundle:Estudiante')->findTodosAsigns()];
    }

    /**
     * @Method("POST")
     * @Template("GEPedagEstudianteBundle:Estudiante:new_edit.html.twig")
     */
    public function createAction(Request $request) {
        $est_obj = new Estudiante();
        $form = $this->createForm(new EstudianteType(), $est_obj);
        $form->handleRequest($request);
        $msj = '';
        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $ok_valido = TRUE;
            try {
                $em->persist($est_obj);
                $em->flush();
            } catch (\Doctrine\DBAL\DBALException $e) {
                $ok_valido = FALSE;
                $ex_msj = $e->getMessage();
                if (strpos($ex_msj, "Duplicate entry") && strpos($ex_msj, "PRIMARY")) {
                    $msj = "
El número de carne de identidad ya está en uso.
Por favor seleccione otro.";
                }
            }
            if ($ok_valido) {
                $this->get('session')->getFlashBag()->add(
                        'success', 'El estudiante  ' . $est_obj . ' se ha registrado con éxito!');
                return $this->redirect($this->generateUrl('ge_estudiante_show', ['id' => $est_obj->getCi()]));
            }
        } else {
            $msj = "
Errores: " . count($form->getErrorsAsString()) . "

";
            foreach ($form->getErrors() as $elem) :
                $msj .= "
" . $elem->getMessage() . "
";
            endforeach;
            $msj .= "
";
        }
        $this->get('session')->getFlashBag()->add(
                'error', 'Error al registrar.' . $msj);
        return $this->createArrayNewEditar($est_obj, 'create', $form);
    }

    private function createArrayNewEditar(Estudiante $est_obj, $action = 'create', $form = FALSE) {
        if ($form === FALSE)
            $form = $this->createForm(new EstudianteType(), $est_obj);
        $formulario = $form->createView();
        $selects_name = ['fuenteIngreso', 'procedenciaMadre', 'municipio',
            'provincia', 'procedenciaEscolar', 'claseEstudiante', 'codigoBaja',
            'procedenciaPapa', 'tipoPlan', 'especialidad', 'asignatura'];
        $selects_list = [];
        foreach ($formulario as $k => $elem) {
            if (in_array($k, $selects_name)) {
                //echo get_class($elem);
                //print_r($elem);die;
                $selects_list[] = $elem;
            }
        }

        $data = [
            'est_obj' => $est_obj,
            'form' => $formulario,
            'selects_list' => $selects_list
        ];
        if ($action == 'create')
            $action = $this->generateUrl('ge_estudiante_create');
        else {
            $action = $this->generateUrl(
                    'ge_estudiante_update', ['id' => $est_obj->getCi()]);
            $deleteForm = $this->createDeleteForm($est_obj->getCi());
            $data['delete_form'] = $deleteForm->createView();
        }
        $data['action'] = $action;
        return $data;
    }

    /**
     * @Method("GET")
     * @Template("GEPedagEstudianteBundle:Estudiante:new_edit.html.twig")
     */
    public function newAction() {
        $est_obj = new Estudiante();
        $today = new \DateTime('today');
        $est_obj->setFechaIngrIsp($today);
        $est_obj->setFechaIngrEducSup($today);
        $est_obj->setFechaIngrEsp($today);

        return $this->createArrayNewEditar($est_obj);
    }

    /**
     * @Method("GET")
     * @Template("GEPedagEstudianteBundle:Estudiante:show.html.twig")
     */
    public function detallesAction($id) {
        $em = $this->getDoctrine()->getManager();
        $est_obj = $em->getRepository('GEPedagEntidadesBundle:Estudiante')->find($id);
        if (!$est_obj) {
            throw $this->createNotFoundException('Imposible encontrar al Estudiante con carne de id: ' . $id);
        }
        $deleteForm = $this->createDeleteForm($id);
        return array(
            'entity' => $est_obj,
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
     * @Method("GET")
     * @Template("GEPedagEstudianteBundle:Estudiante:new_edit.html.twig")
     */
    public function editAction($id) {
        $em = $this->getDoctrine()->getManager();
        $est_obj = $em->getRepository('GEPedagEntidadesBundle:Estudiante')->find($id);
        if (!$est_obj) {
            throw $this->createNotFoundException(
                    'Imposible encontrar al Estudiante con carne de id: ' . $id);
        }
        return $this->createArrayNewEditar($est_obj, 'edit');
    }

    /**
     * @Method("POST")
     * @Template("GEPedagEstudianteBundle:Estudiante:new_edit.html.twig")
     */
    public function updateAction(Request $request, $id) {
        $em = $this->getDoctrine()->getManager();
        $est_obj = $em->getRepository('GEPedagEntidadesBundle:Estudiante')->find($id);
        if (!$est_obj) {
            throw $this->createNotFoundException('Imposible encontrar al Estudiante con carne de id: ' . $id);
        }

        $editForm = $this->createForm(new EstudianteType(), $est_obj);
        $editForm->handleRequest($request);
        $msj = '';
        if ($editForm->isValid()) {
            $ok_valido = TRUE;
            try {
                //$em->persist($est_obj);
                $em->flush();
            } catch (\Doctrine\DBAL\DBALException $e) {
                $ok_valido = FALSE;
                $msj = $e->getMessage();
            }
            if ($ok_valido) {
                $this->get('session')->getFlashBag()->add(
                        'success', 'Los datos de ' . $est_obj . ' se ha actualizado correctamente!');
                return $this->redirect($this->generateUrl('ge_estudiante_edit', ['id' => $est_obj->getCi()]));
            }
        }
        $this->get('session')->getFlashBag()->add(
                'error', 'Error al actualizar verifique sus datos.
' . $msj);
        return $this->redirect($this->generateUrl('ge_estudiante_edit', ['id' => $est_obj->getCi()]));
    }

    /**
     * @Method("POST")
     */
    public function deleteAction(Request $request, $id) {
        $form = $this->createDeleteForm($id);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $entity = $em->getRepository('GEPedagEntidadesBundle:Estudiante')->find($id);
            if (!$entity) {
                throw $this->createNotFoundException(
                        'Imposible encontrar al Estudiante con carne de id: ' . $id);
            }
            $em->remove($entity);
            $em->flush();
        }
        $this->get('session')->getFlashBag()->add(
                'success', 'Eliminado correctamente estudiante con carne de id: ' . $id);
        return $this->redirect($this->generateUrl('ge_estudiante_homepage'));
    }

    /**
     * Creates a form to delete a Estudiante entity by id.
     *
     * @param mixed $id The entity id
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createDeleteForm($id) {
        return $this->createFormBuilder()
                        ->setAction($this->generateUrl('ge_estudiante_delete', array('id' => $id)))
                        ->setMethod('POST')
                        ->add('submit', 'submit', array('label' => 'Eliminar'))
                        ->getForm();
    }

}


text:
package at.alladin.rmbt.client.helper;

/**
 * The system defaults.
 *
 *
 *
 */
public abstract interface Config
{

    /*********************
     *
     * Default Preferences
     *
     *********************/

    public static final String RMBT_CLIENT_NAME = "RMBT";
    public static final String RMBT_VERSION_NUMBER = "0.3";
    public static final String RMBT_VERSION_STRING = RMBT_CLIENT_NAME + "v" + RMBT_VERSION_NUMBER;

    public static final int RMBT_CONTROL_PORT = 443;
    public static final boolean RMBT_CONTROL_SSL = true;
    public static final boolean RMBT_QOS_SSL = true;
    public static final String RMBT_CONTROL_PATH = "/RMBTControlServer";
    public static final String RMBT_CONTROL_MAIN_URL = "/";
    public static final String RMBT_CONTROL_V2_TESTS = "/qosTestRequest";
    public static final String RMBT_CONTROL_NDT_RESULT_URL = "ndtResult";
    public static final String RMBT_NEWS_HOST_URL = "/news";
    public static final String RMBT_IP_HOST_URL = "/ip";
    public static final String RMBT_HISTORY_HOST_URL = "/history";
    public static final String RMBT_TESTRESULT_HOST_URL = "/testresult";
    public static final String RMBT_TESTRESULT_DETAIL_HOST_URL = "/testresultdetail";
    public static final String RMBT_TESTRESULT_QOS_HOST_URL = "/qosTestResult";
    public static final String RMBT_TESTRESULT_OPENDATA_HOST_URL = "/v2/opentests/";
    public static final String RMBT_SYNC_HOST_URL = "/sync";
    public static final String RMBT_SETTINGS_HOST_URL = "/settings";

    // Verschluesselungsart -> TLS oder SSL
    public static final String RMBT_ENCRYPTION_STRING = "TLS";

    public static final int RMBT_SPEED_TEST_INTERVAL = 250;

    public static final String MLAB_NS = "http://mlab-ns.appspot.com/ndt?format=json";
    public static final String NDT_FALLBACK_HOST = "ndt.iupui.donar.measurement-lab.org";

}


text:
<?php
/**
 * User: daniele
 * Date: 21/09/13
 * Time: 12.07
 * @author dipompeodaniele@gmail.com
 */

session_start();

require "include/beContent.inc.php";
require "include/auth.inc.php";
require_once 'include/content.inc.php';
require_once(realpath(dirname(__FILE__)).'/include/view/template/InitGraphic.php');

$main = new Skin("system");

InitGraphic::getInstance()->createSystemGraphic($main);

$form = new Form("dataEntry", $dintorniEntity);

$form->addTitleForm("Dintorni Management");
$form->addSection('Dintorni details');
$form->addText("nome", "Nome", 255, MANDATORY);
$form->addEditor("descrizione", "Descrizione");
$form->addText('luogo', 'Luogo', 255);
$form->addText('latitudine', 'Latitudine', 255);
$form->addText('longitudine', 'Longitudine', 255);

$imageForm = new ImageForm('imageEntry',$dintorniEntity);
$imageForm->addImage('foto','Foto');
$form->triggers($imageForm);

$relationForm = new RelationForm("dataEntry4", $dintorniImageRelation);
$relationForm->addSection('Immagini da legare');
$relationForm->addRelationManager("id_sys_image", "Immagini");
$form->triggers($relationForm);

/*
$relationForm = new RelationForm("dataEntry3", $serviziCameraRelation);
$relationForm->addSection('Servizi da legare');
$relationForm->addRelationManager("vp_servizi_nome", "Servizi");
$form->triggers($relationForm);*/

$main->setContent("body", $form->requestAction());

$main->close();


text:
from flask import Flask, request, render_template, redirect
from flask import send_from_directory

from mongoengine import Document, StringField, DateTimeField, connect

import os
import datetime
import tasks

app = Flask(__name__)
app.debug = True

class Entry(Document):
    name = StringField()
    zip = StringField()
    timestamp = DateTimeField()

@app.route("/", methods=["GET", ])
def index():
    """List all the entries."""
    all_entries = Entry.objects
    return render_template("index.html", entries=all_entries)

@app.route("/new", methods=["GET", "POST", ])
def sign():
    """Allow users to create new entries."""
    if request.method == "GET":
        return render_template("new.html")
    else:
        the_zip = request.form["the_zip"]
        current_time = datetime.datetime.now()

        entry = Entry(
            zip=the_zip,
            timestamp=current_time
        )
        entry.save()
        tasks.lookup.delay(entry.id)
        return redirect("/")  # Redirect after POST is Good Behavor!

@app.route("/styles/<path:filename>")
def styles(filename):
    """Allow Flask to server our CSS files."""
    return send_from_directory("styles", filename)

if __name__ == "__main__":
    host = "localhost"
    port = int(os.getenv("PORT", 5000))
    if port != 5000:
        host = "0.0.0.0"
    else:
        connect("mempyflaskcelery")  # A MongoDB connection
    app.run(port=port, host=host)


text:
<!DOCTYPE html>

        <meta charset='utf-8'>
        <title>re-com Demo</title>

        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css">
        <link rel="stylesheet" href="assets/css/material-design-iconic-font.min.css">
        <link rel="stylesheet" href="assets/css/re-com.css">

        <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic" rel="stylesheet" type="text/css">
        <link href='https://fonts.googleapis.com/css?family=Roboto+Condensed:400,300' rel='stylesheet' type='text/css'>


text:
namespace NAudio
{
    ///
    ///     Manufacturer codes from mmreg.h
    ///
    public enum Manufacturers
    {
        /// Microsoft Corporation
        Microsoft = 1,

        /// Creative Labs, Inc
        Creative = 2,

        /// Media Vision, Inc.
        Mediavision = 3,

        /// Fujitsu Corp.
        Fujitsu = 4,

        /// Artisoft, Inc.
        Artisoft = 20,

        /// Turtle Beach, Inc.
        TurtleBeach = 21,

        /// IBM Corporation
        Ibm = 22,

        /// Vocaltec LTD.
        Vocaltec = 23,

        /// Roland
        Roland = 24,

        /// DSP Solutions, Inc.
        DspSolutions = 25,

        /// NEC
        Nec = 26,

        /// ATI
        Ati = 27,

        /// Wang Laboratories, Inc
        Wanglabs = 28,

        /// Tandy Corporation
        Tandy = 29,

        /// Voyetra
        Voyetra = 30,

        /// Antex Electronics Corporation
        Antex = 31,

        /// ICL Personal Systems
        IclPS = 32,

        /// Intel Corporation
        Intel = 33,

        /// Advanced Gravis
        Gravis = 34,

        /// Video Associates Labs, Inc.
        Val = 35,

        /// InterActive Inc
        Interactive = 36,

        /// Yamaha Corporation of America
        Yamaha = 37,

        /// Everex Systems, Inc
        Everex = 38,

        /// Echo Speech Corporation
        Echo = 39,

        /// Sierra Semiconductor Corp
        Sierra = 40,

        /// Computer Aided Technologies
        Cat = 41,

        /// APPS Software International
        Apps = 42,

        /// DSP Group, Inc
        DspGroup = 43,

        /// microEngineering Labs
        Melabs = 44,

        /// Computer Friends, Inc.
        ComputerFriends = 45,

        /// ESS Technology
        Ess = 46,

        /// Audio, Inc.
        Audiofile = 47,

        /// Motorola, Inc.
        Motorola = 48,

        /// Canopus, co., Ltd.
        Canopus = 49,

        /// Seiko Epson Corporation
        Epson = 50,

        /// Truevision
        Truevision = 51,

        /// Aztech Labs, Inc.
        Aztech = 52,

        /// Videologic
        Videologic = 53,

        /// SCALACS
        Scalacs = 54,

        /// Korg Inc.
        Korg = 55,

        /// Audio Processing Technology
        Apt = 56,

        /// Integrated Circuit Systems, Inc.
        Ics = 57,

        /// Iterated Systems, Inc.
        Iteratedsys = 58,

        /// Metheus
        Metheus = 59,

        /// Logitech, Inc.
        Logitech = 60,

        /// Winnov, Inc.
        Winnov = 61,

        /// NCR Corporation
        Ncr = 62,

        /// EXAN
        Exan = 63,

        /// AST Research Inc.
        Ast = 64,

        /// Willow Pond Corporation
        Willowpond = 65,

        /// Sonic Foundry
        Sonicfoundry = 66,

        /// Vitec Multimedia
        Vitec = 67,

        /// MOSCOM Corporation
        Moscom = 68,

        /// Silicon Soft, Inc.
        Siliconsoft = 69,

        /// Supermac
        Supermac = 73,

        /// Audio Processing Technology
        Audiopt = 74,

        /// Speech Compression
        Speechcomp = 76,

        /// Ahead, Inc.
        Ahead = 77,

        /// Dolby Laboratories
        Dolby = 78,

        /// OKI
        Oki = 79,

        /// AuraVision Corporation
        Auravision = 80,

        /// Ing C. Olivetti & C., S.p.A.
        Olivetti = 81,

        /// I/O Magic Corporation
        Iomagic = 82,

        /// Matsushita Electric Industrial Co., LTD.
        Matsushita = 83,

        /// Control Resources Limited
        Controlres = 84,

        /// Xebec Multimedia Solutions Limited
        Xebec = 85,

        /// New Media Corporation
        Newmedia = 86,

        /// Natural MicroSystems
        Nms = 87,

        /// Lyrrus Inc.
        Lyrrus = 88,

        /// Compusic
        Compusic = 89,

        /// OPTi Computers Inc.
        Opti = 90,

        /// Adlib Accessories Inc.
        Adlacc = 91,

        /// Compaq Computer Corp.
        Compaq = 92,

        /// Dialogic Corporation
        Dialogic = 93,

        /// InSoft, Inc.
        Insoft = 94,

        /// M.P. Technologies, Inc.
        Mptus = 95,

        /// Weitek
        Weitek = 96,

        /// Lernout & Hauspie
        LernoutAndHauspie = 97,

        /// Quanta Computer Inc.
        Qciar = 98,

        /// Apple Computer, Inc.
        Apple = 99,

        /// Digital Equipment Corporation
        Digital = 100,

        /// Mark of the Unicorn
        Motu = 101,

        /// Workbit Corporation
        Workbit = 102,

        /// Ositech Communications Inc.
        Ositech = 103,

        /// miro Computer Products AG
        Miro = 104,

        /// Cirrus Logic
        Cirruslogic = 105,

        /// ISOLUTION  B.V.
        Isolution = 106,

        /// Horizons Technology, Inc
        Horizons = 107,

        /// Computer Concepts Ltd
        Concepts = 108,

        /// Voice Technologies Group, Inc.
        Vtg = 109,

        /// Radius
        Radius = 110,

        /// Rockwell International
        Rockwell = 111,

        /// Co. XYZ for testing
        Xyz = 112,

        /// Opcode Systems
        Opcode = 113,

        /// Voxware Inc
        Voxware = 114,

        /// Northern Telecom Limited
        NorthernTelecom = 115,

        /// APICOM
        Apicom = 116,

        /// Grande Software
        Grande = 117,

        /// ADDX
        Addx = 118,

        /// Wildcat Canyon Software
        Wildcat = 119,

        /// Rhetorex Inc
        Rhetorex = 120,

        /// Brooktree Corporation
        Brooktree = 121,

        /// ENSONIQ Corporation
        Ensoniq = 125,

        /// FAST Multimedia AG
        Fast = 126,

        /// NVidia Corporation
        Nvidia = 127,

        /// OKSORI Co., Ltd.
        Oksori = 128,

        /// DiAcoustics, Inc.
        Diacoustics = 129,

        /// Gulbransen, Inc.
        Gulbransen = 130,

        /// Kay Elemetrics, Inc.
        KayElemetrics = 131,

        /// Crystal Semiconductor Corporation
        Crystal = 132,

        /// Splash Studios
        SplashStudios = 133,

        /// Quarterdeck Corporation
        Quarterdeck = 134,

        /// TDK Corporation
        Tdk = 135,

        /// Digital Audio Labs, Inc.
        DigitalAudioLabs = 136,

        /// Seer Systems, Inc.
        Seersys = 137,

        /// PictureTel Corporation
        Picturetel = 138,

        /// AT&T Microelectronics
        AttMicroelectronics = 139,

        /// Osprey Technologies, Inc.
        Osprey = 140,

        /// Mediatrix Peripherals
        Mediatrix = 141,

        /// SounDesignS M.C.S. Ltd.
        Soundesigns = 142,

        /// A.L. Digital Ltd.
        Aldigital = 143,

        /// Spectrum Signal Processing, Inc.
        SpectrumSignalProcessing = 144,

        /// Electronic Courseware Systems, Inc.
        Ecs = 145,

        /// AMD
        Amd = 146,

        /// Core Dynamics
        Coredynamics = 147,

        /// CANAM Computers
        Canam = 148,

        /// Softsound, Ltd.
        Softsound = 149,

        /// Norris Communications, Inc.
        Norris = 150,

        /// Danka Data Devices
        Ddd = 151,

        /// EuPhonics
        Euphonics = 152,

        /// Precept Software, Inc.
        Precept = 153,

        /// Crystal Net Corporation
        CrystalNet = 154,

        /// Chromatic Research, Inc
        Chromatic = 155,

        /// Voice Information Systems, Inc
        Voiceinfo = 156,

        /// Vienna Systems
        Viennasys = 157,

        /// Connectix Corporation
        Connectix = 158,

        /// Gadget Labs LLC
        Gadgetlabs = 159,

        /// Frontier Design Group LLC
        Frontier = 160,

        /// Viona Development GmbH
        Viona = 161,

        /// Casio Computer Co., LTD
        Casio = 162,

        /// Diamond Multimedia
        Diamondmm = 163,

        /// S3
        S3 = 164,

        /// Fraunhofer
        FraunhoferIis = 172,

        /*
		public static String GetName(int manufacturerId) {
			switch(manufacturerId) {
			case Gravis:			return "Advanced Gravis Computer Technology, Ltd.";
			case Antex:				return "Antex Electronics Corporation";
			case Apps:				return "APPS Software";
			case Artisoft:			return "Artisoft, Inc.";
			case Ast:				return "AST Research, Inc.";
			case Ati:				return "ATI Technologies, Inc.";
			case Audiofile:			return "Audio, Inc.";
			case Apt:				return "Audio Processing Technology";
			case Audiopt:			return "Audio Processing Technology";
			case Auravision:		return "Auravision Corporation";
			case Aztech:			return "Aztech Labs, Inc.";
			case Canopus:			return "Canopus, Co., Ltd.";
			case Compusic:			return "Compusic";
			case Cat:				return "Computer Aided Technology, Inc.";
			case ComputerFriends:	return "Computer Friends, Inc.";
			case Controlres:		return "Control Resources Corporation";
			case Creative:			return "Creative Labs, Inc.";
			case Dialogic:			return "Dialogic Corporation";
			case Dolby:				return "Dolby Laboratories, Inc.";
			case DspGroup:			return "DSP Group, Inc.";
			case DspSolutions:		return "DSP Solutions, Inc.";
			case Echo:				return "Echo Speech Corporation";
			case Ess:				return "ESS Technology, Inc.";
			case Everex:			return "Everex Systems, Inc.";
			case Exan:				return "EXAN, Ltd.";
			case Fujitsu:			return "Fujitsu, Ltd.";
			case Iomagic:			return "I/O Magic Corporation";
			case IclPS:				return "ICL Personal Systems";
			case Olivetti:			return "Ing. C. Olivetti & C., S.p.A.";
			case Ics:				return "Integrated Circuit Systems, Inc.";
			case Intel:				return "Intel Corporation";
			case Interactive:		return "InterActive, Inc.";
			case Ibm:				return "International Business Machines";
			case Iteratedsys:		return "Iterated Systems, Inc.";
			case Logitech:			return "Logitech, Inc.";
			case Lyrrus:			return "Lyrrus, Inc.";
			case Matsushita:		return "Matsushita Electric Corporation of America";
			case Mediavision:		return "Media Vision, Inc.";
			case Metheus:			return "Metheus Corporation";
			case Melabs:			return "microEngineering Labs";
			case Microsoft:			return "Microsoft Corporation";
			case Moscom:			return "MOSCOM Corporation";
			case Motorola:			return "Motorola, Inc.";
			case Nms:				return "Natural MicroSystems Corporation";
			case Ncr:				return "NCR Corporation";
			case Nec:				return "NEC Corporation";
			case Newmedia:			return "New Media Corporation";
			case Oki:				return "OKI";
			case Opti:				return "OPTi, Inc.";
			case Roland:			return "Roland Corporation";
			case Scalacs:			return "SCALACS";
			case Epson:				return "Seiko Epson Corporation, Inc.";
			case Sierra:			return "Sierra Semiconductor Corporation";
			case Siliconsoft:		return "Silicon Software, Inc.";
			case Sonicfoundry:		return "Sonic Foundry";
			case Speechcomp:		return "Speech Compression";
			case Supermac:			return "Supermac Technology, Inc.";
			case Tandy:				return "Tandy Corporation";
			case Korg:				return "Toshihiko Okuhura, Korg, Inc.";
			case Truevision:		return "Truevision, Inc.";
			case TurtleBeach:		return "Turtle Beach Systems";
			case Val:				return "Video Associates Labs, Inc.";
			case Videologic:		return "VideoLogic, Inc.";
			case Vitec:				return "Visual Information Technologies, Inc.";
			case Vocaltec:			return "VocalTec, Inc.";
			case Voyetra:			return "Voyetra Technologies";
			case Wanglabs:			return "Wang Laboratories";
			case Willowpond:		return "Willow Pond Corporation";
			case Winnov:			return "Winnov, LP";
			case Xebec:				return "Xebec Multimedia Solutions Limited";
			case Yamaha:			return "Yamaha Corporation of America";
			default:				return String.Format("Unknown Manufacturer ({0})",manufacturerId);
			}
		}
		**/
    }
}


text:
namespace peloton {
namespace planner {

AbstractPlan::AbstractPlan() {}

AbstractPlan::~AbstractPlan() {}

void AbstractPlan::AddChild(std::unique_ptr<AbstractPlan> &&child) {
  children_.emplace_back(std::move(child));
}

const std::vector<std::unique_ptr<AbstractPlan>> &AbstractPlan::GetChildren()
    const {
  return children_;
}

const AbstractPlan *AbstractPlan::GetParent() { return parent_; }

// Get a string representation of this plan
std::ostream &operator<<(std::ostream &os, const AbstractPlan &plan) {
  os << PlanNodeTypeToString(plan.GetPlanNodeType());

  return os;
}

const std::string AbstractPlan::GetInfo() const {
  std::ostringstream os;

  os << GetInfo();

  // Traverse the tree
  std::string child_spacer = "  ";
  for (int ctr = 0, cnt = static_cast<int>(children_.size()); ctr < cnt;
       ctr++) {
    os << child_spacer << children_[ctr].get()->GetPlanNodeType() << "\n";
    os << children_[ctr].get()->GetInfo();
  }

  return os.str();
}

void AbstractPlan::SetParameterValues(std::vector<common::Value> *values) {
  LOG_TRACE("Setting parameter values in all child plans of %s",
            GetInfo().c_str());
  for (auto &child_plan : GetChildren()) {
    child_plan->SetParameterValues(values);
  }
};

}  // namespace planner
}  // namespace peloton


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.anguo.web.db.mapper.CommonSysParamMapper">

 <!-- 配置内容信息 -->
	<resultMap id="commonSysParamMap" type="com.anguo.web.db.domain.CommonSysParam" >

		 		<result property="id" column="id" />
		 		<result property="commonSysClassId" column="common_sys_class_id" />
		 		<result property="name" column="name" />
		 		<result property="value" column="value" />
		 		<result property="memo" column="memo" />
		 		<result property="status" column="status" />
		 		<result property="operateUserId" column="operate_user_id" />
		 		<result property="operateDate" column="operate_date" />
		 		 <result property="realName" column="real_name" />
	</resultMap>

<!-- 分页查询 -->
<select id="getPageData" resultMap="commonSysParamMap"
               parameterType="com.anguo.web.db.domain.CommonSysParam">
     select a.*,b.real_name from ${commonSchema}.common_sys_param a left join ${commonSchema}.common_sys_user b on a.operate_user_id=b.id
     <trim prefix="where" prefixOverrides="and |or ">
             <if test="id != null and id != ''">
           and (a.id like concat('%',concat(#{id},'%')))
        </if>
             <if test="commonSysClassId != null and commonSysClassId != ''">
           and (a.common_sys_class_id like concat('%',concat(#{commonSysClassId},'%')))
        </if>
             <if test="name != null and name != ''">
           and (a.name like concat('%',concat(#{name},'%')))
        </if>
             <if test="value != null and value != ''">
           and (a.value like concat('%',concat(#{value},'%')))
        </if>
             <if test="memo != null and memo != ''">
           and (a.memo like concat('%',concat(#{memo},'%')))
        </if>
             <if test="status != null and status != ''">
           and (a.status like concat('%',concat(#{status},'%')))
        </if>
             <if test="operateUserId != null and operateUserId != ''">
           and (a.operate_user_id like concat('%',concat(#{operateUserId},'%')))
        </if>
             <if test="operateDate != null and operateDate != ''">
           and (a.operate_date like concat('%',concat(#{operateDate},'%')))
        </if>
          </trim>
     order by id desc
</select>

<!-- 查询 -->
<select id="getAllData" resultMap="commonSysParamMap"
               parameterType="com.anguo.web.db.domain.CommonSysParam">
     select a.*,b.real_name from ${commonSchema}.common_sys_param a left join ${commonSchema}.common_sys_user b on a.operate_user_id=b.id
     <trim prefix="where" prefixOverrides="and |or ">
             <if test="id != null and id != ''">
           and (a.id like concat('%',concat(#{id},'%')))
        </if>
             <if test="commonSysClassId != null and commonSysClassId != ''">
           and (a.common_sys_class_id like concat('%',concat(#{commonSysClassId},'%')))
        </if>
             <if test="name != null and name != ''">
           and (a.name like concat('%',concat(#{name},'%')))
        </if>
             <if test="value != null and value != ''">
           and (a.value like concat('%',concat(#{value},'%')))
        </if>
             <if test="memo != null and memo != ''">
           and (a.memo like concat('%',concat(#{memo},'%')))
        </if>
             <if test="status != null and status != ''">
           and (a.status like concat('%',concat(#{status},'%')))
        </if>
             <if test="operateUserId != null and operateUserId != ''">
           and (a.operate_user_id like concat('%',concat(#{operateUserId},'%')))
        </if>
             <if test="operateDate != null and operateDate != ''">
           and (a.operate_date like concat('%',concat(#{operateDate},'%')))
        </if>
          </trim>
     order by id desc
</select>

<!-- 读一条记录 -->
<select id="getData" resultMap="commonSysParamMap" parameterType="com.anguo.web.db.domain.CommonSysParam">
    select * from  ${commonSchema}.common_sys_param
    where id = #{id}
</select>

<!-- 根据名称获取值 -->
<select id="getDataByName" resultMap="commonSysParamMap" parameterType="com.anguo.web.db.domain.CommonSysParam">
    select * from  ${commonSchema}.common_sys_param
    where name = #{name}
</select>

<!-- 插入记录  -->
<insert id="insertData" parameterType="com.anguo.web.db.domain.CommonSysParam" useGeneratedKeys="true" keyProperty="id">

	insert into  ${commonSchema}.common_sys_param
	<trim prefix="(" suffix=")" suffixOverrides=",">
		id,
		 		 		 		 		<if test="commonSysClassId != null">
				common_sys_class_id,
	  	</if>
	  			 		 		<if test="name != null">
				name,
	  	</if>
	  			 		 		<if test="value != null">
				value,
	  	</if>
	  			 		 		<if test="memo != null">
				memo,
	  	</if>
	  			 		 		<if test="status != null">
				status,
	  	</if>
	  			 		 		<if test="operateUserId != null">
				operate_user_id,
	  	</if>
	  			 		 		<if test="operateDate != null">
				operate_date,
	  	</if>
	  			 	</trim>
	<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id},

		<if test="commonSysClassId != null">
#{commonSysClassId},
</if>
				<if test="name != null">
#{name},
</if>
				<if test="value != null">
#{value},
</if>
				<if test="memo != null">
#{memo},
</if>
				<if test="status != null">
#{status},
</if>
				<if test="operateUserId != null">
#{operateUserId},
</if>
				<if test="operateDate != null">
#{operateDate},
</if>
					</trim>
</insert>

<!-- 修改  -->
<update id="updateData" parameterType="com.anguo.web.db.domain.CommonSysParam">
	update  ${commonSchema}.common_sys_param
	<set>
										<if test="commonSysClassId != null and commonSysClassId != ''">
			common_sys_class_id=#{commonSysClassId},
		</if>
								<if test="name != null and name != ''">
			name=#{name},
		</if>
								<if test="value != null and value != ''">
			value=#{value},
		</if>
								<if test="memo != null and memo != ''">
			memo=#{memo},
		</if>
								<if test="status != null and status != ''">
			status=#{status},
		</if>
								<if test="operateUserId != null and operateUserId != ''">
			operate_user_id=#{operateUserId},
		</if>
								<if test="operateDate != null and operateDate != ''">
			operate_date=#{operateDate},
		</if>
					</set>
	where id=#{id}
</update>

<!-- 删除 -->
<delete id="deleteData" parameterType="com.anguo.web.db.domain.CommonSysParam">
	delete from  ${commonSchema}.common_sys_param
	where id=#{id}
</delete>

</mapper>


text:
CannibalThemes_themes
=====================


text:
{% if field.help_text %}
    {% autoescape off %}
        {% if display == "inline" %}
            {{ field.help_text }}
        {% else %}

{{ field.help_text }}

        {% endif %}
    {% endautoescape %}
{% endif %}


text:
<?php

defined('JPATH_PLATFORM') or die;

/**
 * GitHub API DB class for the Joomla Platform.
 *
 * @documentation http://developer.github.com/v3/git/
 *
 * @package     Joomla.Platform
 * @subpackage  GitHub.Data
 * @since       12.3

 * http://developer.github.com/v3/git/
Git DB API

The Git Database API gives you access to read and write raw Git objects to your Git database on GitHub and to list
 * and update your references (branch heads and tags).

This basically allows you to reimplement a lot of Git functionality over our API - by creating raw objects
 * directly into the database and updating branch references you could technically do just about anything that
 * Git can do without having Git installed.

Git DB API functions will return a 409 if the git repo for a Repository is empty or unavailable.
 * This typically means it is being created still. Contact Support if this response status persists.

git db

For more information on the Git object database, please read the Git Internals chapter of the Pro Git book.

As an example, if you wanted to commit a change to a file in your repository, you would:

    get the current commit object
    retrieve the tree it points to
    retrieve the content of the blob object that tree has for that particular file path
    change the content somehow and post a new blob object with that new content, getting a blob SHA back
    post a new tree object with that file path pointer replaced with your new blob SHA getting a tree SHA back
    create a new commit object with the current commit SHA as the parent and the new tree SHA, getting a commit SHA back
    update the reference of your branch to point to the new commit SHA

It might seem complex, but it's actually pretty simple when you understand the model and it opens up a ton of
 * things you could potentially do with the API.

 */
class JGithubPackageData extends JGithubPackage
{
	protected $name = 'Data';

	protected $packages = array(
		'blobs', 'commits', 'refs', 'tags', 'trees'
	);
}