text:
<layout xmlns:android="http://schemas.android.com/apk/res/android">

    <data>

        <!--调用静态方法-->
        <import type="com.example.jingbin.cloudreader.utils.StringFormatUtil" />
        <!--引用bean-->
        <variable
            name="subjectsBean"
            type="com.example.jingbin.cloudreader.bean.moviechild.SubjectsBean" />

        <!--引用bean-->
        <variable
            name="movieDetailBean"
            type="com.example.jingbin.cloudreader.bean.MovieDetailBean" />

    </data>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.example.jingbin.cloudreader.view.MyNestedScrollView
            android:id="@+id/nsv_scrollview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/colorPageBg"
            android:scrollbars="none">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <LinearLayout
                    android:id="@+id/ll_Header_view"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <include
                        android:id="@+id/include"
                        layout="@layout/header_slide_shape" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="5dp"
                        android:gravity="center_vertical"
                        android:orientation="horizontal"
                        android:paddingTop="10dp">

                        <View
                            android:layout_width="2dp"
                            android:layout_height="18dp"
                            android:background="@color/colorTheme" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="5dp"
                            android:text="另称"
                            android:textColor="@color/colorContent"
                            android:textSize="17sp" />

                    </LinearLayout>

                    <!--又名-->
                    <TextView
                        android:id="@+id/tv_one_title"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:padding="12dp"
                        android:text='@{StringFormatUtil.formatGenres(movieDetailBean.aka)}'
                        android:textColor="@color/colorTitle" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="5dp"
                        android:gravity="center_vertical"
                        android:orientation="horizontal"
                        android:paddingBottom="5dp"
                        android:paddingTop="5dp">

                        <View
                            android:layout_width="2dp"
                            android:layout_height="18dp"
                            android:background="@color/colorTheme" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="5dp"
                            android:text="剧情简介"
                            android:textColor="@color/colorContent"
                            android:textSize="17sp" />
                    </LinearLayout>

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:lineSpacingExtra="7dp"
                        android:padding="12dp"
                        android:text="@{movieDetailBean.summary}"
                        android:textColor="@color/colorTitle"
                        android:textSize="16sp" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="5dp"
                        android:gravity="center_vertical"
                        android:orientation="horizontal"
                        android:paddingBottom="5dp"
                        android:paddingTop="10dp">

                        <View
                            android:layout_width="2dp"
                            android:layout_height="18dp"
                            android:background="@color/colorTheme" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="5dp"
                            android:text="导演 & 演员"
                            android:textColor="@color/colorContent"
                            android:textSize="17sp" />

                    </LinearLayout>

                    <!--导演&演员-->
                    <com.example.xrecyclerview.XRecyclerView
                        android:id="@+id/xrv_cast"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="gone" />

                </LinearLayout>

            </LinearLayout>

        </com.example.jingbin.cloudreader.view.MyNestedScrollView>

        <RelativeLayout xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/rl_title_head"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/transparent">

            <ImageView
                android:id="@+id/iv_title_head_bg"
                android:layout_width="match_parent"
                android:layout_height="310dp"
                android:scaleType="fitXY" />

            <android.support.v7.widget.Toolbar
                android:id="@+id/title_tool_bar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@color/colorTransparent"
                app:contentInsetStart="0.0dp"
                app:layout_collapseMode="pin"
                app:layout_scrollFlags="enterAlways|scroll"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                app:theme="@style/ToolbarStyle">

            </android.support.v7.widget.Toolbar>

        </RelativeLayout>

    </FrameLayout>

</layout>


text:
package cgeo.geocaching;

import cgeo.geocaching.connector.ConnectorFactory;
import cgeo.geocaching.connector.trackable.TrackableBrand;
import cgeo.geocaching.connector.trackable.TrackableConnector;
import cgeo.geocaching.enumerations.LogTypeTrackable;
import cgeo.geocaching.utils.ImageUtils;

import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;

import android.text.Html;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;

public class Trackable implements ILogable {
    static final private int SPOTTED_UNSET = 0;
    static final public int SPOTTED_CACHE = 1;
    static final public int SPOTTED_USER = 2;
    static final public int SPOTTED_UNKNOWN = 3;
    static final public int SPOTTED_OWNER = 4;
    static final public int SPOTTED_ARCHIVED = 5;
    static final public int SPOTTED_TRAVELLING = 6;

    private String guid = "";
    private String geocode = "";
    private String iconUrl = "";
    private String name = "";
    private String type = null;
    @Nullable
    private Date released = null;
    private float distance = -1;
    private String origin = null;
    private String owner = null;
    private String ownerGuid = null;
    private String spottedName = null;
    private int spottedType = SPOTTED_UNSET;
    private String spottedGuid = null;
    private String goal = null;
    private String details = null;
    private String image = null;
    private List<LogEntry> logs = new ArrayList<>();
    private String trackingcode = null;
    private TrackableBrand brand = null;
    private TrackableConnector trackableConnector = null;
    private Boolean missing = null;

    /**
     * Merge data from another Trackable.
     * Squeeze existing data from the new one.
     *
     * @param newTrackable from which to pull informations
     */
    public void mergeTrackable(final Trackable newTrackable) {
        guid = StringUtils.defaultIfEmpty(newTrackable.guid, guid);
        geocode = StringUtils.defaultIfEmpty(newTrackable.geocode, geocode);
        iconUrl = StringUtils.defaultIfEmpty(newTrackable.iconUrl, iconUrl);
        name = StringUtils.defaultIfEmpty(newTrackable.name, name);

        type = ObjectUtils.defaultIfNull(newTrackable.type, type);
        released = ObjectUtils.defaultIfNull(newTrackable.released, released);
        distance = newTrackable.distance == -1 ? distance : newTrackable.distance;
        origin = ObjectUtils.defaultIfNull(newTrackable.origin, origin);
        owner = ObjectUtils.defaultIfNull(newTrackable.owner, owner);
        ownerGuid = ObjectUtils.defaultIfNull(newTrackable.ownerGuid, ownerGuid);
        spottedName = ObjectUtils.defaultIfNull(newTrackable.spottedName, spottedName);
        spottedType = newTrackable.spottedType == SPOTTED_UNSET ? spottedType : newTrackable.spottedType;
        spottedGuid = ObjectUtils.defaultIfNull(newTrackable.spottedGuid, spottedGuid);
        goal = ObjectUtils.defaultIfNull(newTrackable.goal, goal);
        details = ObjectUtils.defaultIfNull(newTrackable.details, details);
        image = ObjectUtils.defaultIfNull(newTrackable.image, image);
        mergeLogEntry(newTrackable.logs);
        trackingcode = ObjectUtils.defaultIfNull(newTrackable.trackingcode, trackingcode);
        brand = ObjectUtils.defaultIfNull(newTrackable.brand, brand);
        trackableConnector = ObjectUtils.defaultIfNull(newTrackable.trackableConnector, trackableConnector);
        missing = ObjectUtils.defaultIfNull(newTrackable.missing, missing);
    }

    /**
     * Merge another logEntry list into current logs list.
     * No duplicates.
     * LogEntry are then sorted by date.
     *
     * @param newLogs to merge
     */
    public void mergeLogEntry(final List<LogEntry> newLogs) {
        for (final LogEntry newLog : newLogs){
           if (!logs.contains(newLog)) {
               logs.add(newLog);
           }
        }
        Collections.sort(logs, LogEntry.DESCENDING_DATE_COMPARATOR);
    }

    /**
     * Check whether this trackable has a corresponding URL.
     */
    public boolean hasUrl() {
        return getConnector().hasTrackableUrls();
    }

    @NonNull
    public String getUrl() {
        return getConnector().getUrl(this);
    }

    @NonNull
    private TrackableConnector getConnector() {
        if (trackableConnector == null) {
            trackableConnector = ConnectorFactory.getConnector(this);
        }
        return trackableConnector;
    }

    public String getGuid() {
        return guid;
    }

    public void setGuid(final String guid) {
        this.guid = guid;
    }

    @Override
    public String getGeocode() {
        return geocode;
    }

    public String getUniqueID() {
        if (StringUtils.isNotEmpty(guid)) {
            return guid;
        }
        if (StringUtils.isNotEmpty(geocode)) {
            return geocode;
        }
        throw new IllegalStateException("Trackable must have at least one of geocode or guid");
    }

    public void setGeocode(final String geocode) {
        this.geocode = StringUtils.upperCase(geocode);
    }

    public String getIconUrl() {
        return iconUrl;
    }

    public int getIconBrand() {
        return getBrand().getIconResource();
    }

    public void forceSetBrand(final TrackableBrand trackableBrand) {
        this.brand = trackableBrand;
    }

    public TrackableBrand getBrand() {
        if (brand == null) {
            // Only TravelBug have a guid
            if (StringUtils.isNotEmpty(guid)) {
                brand = TrackableBrand.TRAVELBUG;
                return brand;
            }
            // Consult all other Trackable connectors
            if (StringUtils.isNotEmpty(geocode)) {
                final TrackableConnector connector = ConnectorFactory.getTrackableConnector(geocode);
                brand = connector.getBrand();
                return brand;
            }
            // Fallback to Unkwown
            brand = TrackableBrand.UNKNOWN;
        }
        return brand;
    }

    public void setIconUrl(final String iconUrl) {
        this.iconUrl = iconUrl;
    }

    @Override
    public String getName() {
        return name;
    }

    public void setName(final String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(final String type) {
        this.type = type;
    }

    @Nullable
    public Date getReleased() {
        if (released != null) {
            return new Date(released.getTime());
        }
        return null;
    }

    public void setReleased(@Nullable final Date released) {
        if (released == null) {
            this.released = null;
        }
        else {
            this.released = new Date(released.getTime()); // avoid storing external reference in this object
        }
    }

    public float getDistance() {
        return distance;
    }

    public void setDistance(final float distance) {
        this.distance = distance;
    }

    public String getOrigin() {
        return origin;
    }

    public void setOrigin(final String origin) {
        this.origin = origin;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(final String owner) {
        this.owner = owner;
    }

    public String getOwnerGuid() {
        return ownerGuid;
    }

    public void setOwnerGuid(final String ownerGuid) {
        this.ownerGuid = ownerGuid;
    }

    public String getSpottedName() {
        return spottedName;
    }

    public void setSpottedName(final String spottedName) {
        this.spottedName = spottedName;
    }

    public int getSpottedType() {
        return spottedType;
    }

    public void setSpottedType(final int spottedType) {
        this.spottedType = spottedType;
    }

    public String getSpottedGuid() {
        return spottedGuid;
    }

    public void setSpottedGuid(final String spottedGuid) {
        this.spottedGuid = spottedGuid;
    }

    public String getGoal() {
        return goal;
    }

    public void setGoal(final String goal) {
        this.goal = goal;
    }

    public String getDetails() {
        return details;
    }

    public void setDetails(final String details) {
        this.details = details;
    }

    public String getImage() {
        return image;
    }

    public void setImage(final String image) {
        this.image = image;
    }

    /**
     * Get the trackable missing status.
     * False if missing status is unknonwn.
     *
     * @return true if missing from cache
     */
    public boolean isMissing() {
        return missing == null ? false : missing;
    }

    /**
     * Set the trackable missing status
     *
     * @param missing
     *          the new missing status
     */
    public void setMissing(final Boolean missing) {
        this.missing = missing;
    }

    @NonNull
    public List<LogEntry> getLogs() {
        return logs;
    }

    public void setLogs(final List<LogEntry> logs) {
        this.logs = logs != null ? logs : new ArrayList<LogEntry>();
    }

    @Override
    public String toString() {
        if (null != name) {
            return Html.fromHtml(name).toString();
        }

        if (guid != null) {
            return guid;
        }

        return "???";
    }

    public boolean isLoggable() {
        return getConnector().isLoggable();
    }

    public String getTrackingcode() {
        return trackingcode;
    }

    public void setTrackingcode(final String trackingcode) {
        this.trackingcode = trackingcode;
    }

    @NonNull
    public Collection<Image> getImages() {
        final List<Image> images = new LinkedList<>();
        if (StringUtils.isNotBlank(image)) {
            images.add(new Image(image, StringUtils.defaultIfBlank(name, geocode)));
        }
        ImageUtils.addImagesFromHtml(images, geocode, getDetails());
        for (final LogEntry log : getLogs()) {
            images.addAll(log.getLogImages());
        }
        return images;
    }

    @NonNull
    static public List<LogTypeTrackable> getPossibleLogTypes() {
        final List<LogTypeTrackable> logTypes = new ArrayList<>();
        logTypes.add(LogTypeTrackable.RETRIEVED_IT);
        logTypes.add(LogTypeTrackable.GRABBED_IT);
        logTypes.add(LogTypeTrackable.NOTE);
        logTypes.add(LogTypeTrackable.DISCOVERED_IT);

        return logTypes;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package cn.wz.algorithm.algs4;

import cn.wz.algorithm.stdlib.StdIn;
import cn.wz.algorithm.stdlib.StdOut;

/*************************************************************************
 *  Compilation:  javac SequentialSearchST.java
 *  Execution:    java SequentialSearchST
 *  Dependencies: StdIn.java StdOut.java
 *  Data files:   http://algs4.cs.princeton.edu/31elementary/tinyST.txt
 *
 *  Symbol table implementation with sequential search in an
 *  unordered linked list of key-value pairs.
 *
 *  % more tinyST.txt
 *  S E A R C H E X A M P L E
 *
 *  % java SequentialSearchST < tiny.txt
 *  L 11
 *  P 10
 *  M 9
 *  X 7
 *  H 5
 *  C 4
 *  R 3
 *  A 8
 *  E 12
 *  S 0
 *
 *************************************************************************/

public class SequentialSearchST<Key, Value> {
    private int N;           // number of key-value pairs
    private Node first;      // the linked list of key-value pairs

    // a helper linked list data type
    private class Node {
        private Key key;
        private Value val;
        private Node next;

        public Node(Key key, Value val, Node next)  {
            this.key  = key;
            this.val  = val;
            this.next = next;
        }
    }

    // return number of key-value pairs
    public int size() { return N; }

    // is the symbol table empty?
    public boolean isEmpty() { return size() == 0; }

    // does this symbol table contain the given key?
    public boolean contains(Key key) {
        return get(key) != null;
    }

    // return the value associated with the key, or null if the key is not present
    public Value get(Key key) {
        for (Node x = first; x != null; x = x.next) {
            if (key.equals(x.key)) return x.val;
        }
        return null;
    }

    // add a key-value pair, replacing old key-value pair if key is already present
    public void put(Key key, Value val) {
        if (val == null) { delete(key); return; }
        for (Node x = first; x != null; x = x.next)
            if (key.equals(x.key)) { x.val = val; return; }
        first = new Node(key, val, first);
        N++;
    }

    // remove key-value pair with given key (if it's in the table)
    public void delete(Key key) {
        first = delete(first, key);
    }

    // delete key in linked list beginning at Node x
    // warning: function call stack too large if table is large
    private Node delete(Node x, Key key) {
        if (x == null) return null;
        if (key.equals(x.key)) { N--; return x.next; }
        x.next = delete(x.next, key);
        return x;
    }

    // return all keys as an Iterable
    public Iterable<Key> keys()  {
        Queue<Key> queue = new Queue<Key>();
        for (Node x = first; x != null; x = x.next)
            queue.enqueue(x.key);
        return queue;
    }

   /***********************************************************************
    * Test client
    **********************************************************************/
    public static void main(String[] args) {
        SequentialSearchST<String, Integer> st = new SequentialSearchST<String, Integer>();
        for (int i = 0; !StdIn.isEmpty(); i++) {
            String key = StdIn.readString();
            st.put(key, i);
        }
        for (String s : st.keys())
            StdOut.println(s + " " + st.get(s));
    }
}


text:
function holaMundo2()
{
    console.log("Hola mundo");
}

holaMundo2();


text:
import { Arguments, Options } from "yargs";

export type ResponseCallback = (response: string) => void;
export interface IHandlerArgs {
    respond: ResponseCallback;
    resolve: () => void;
}
type CommandCallback = (args: Arguments<IHandlerArgs>) => void|Promise<void>;

export class AdminCommand {
    constructor(
        public readonly command: string,
        public readonly description: string,
        private readonly cb: CommandCallback,
        public readonly options: {[key: string]: Options}|null = null) {
    }

    public handler(argv: Arguments<IHandlerArgs>): void {
        void Promise.resolve(this.cb(argv)).finally(argv.resolve);
    }

    /**
     * Returns a one-liner of how to use the command.
     * @returns A short description of the command
     */
    public simpleHelp(): string|null {
        if (!this.description) {
            return null;
        }
        const opts = this.options || {};
        const commandString = Object.keys(opts).sort((a, b) => {
            const x = opts[a].demandOption;
            const y = opts[b].demandOption;
            return (x === y) ? 0 : (x ? -1 : 1);
        }).map((key, i) => {
            const positional = this.command.includes(` ${key}`) || this.command.includes(` [${key}]`);
            if (positional) {
                return null;
            }

            const placeholder = key.toUpperCase();
            let strOpt = `--${key} ${placeholder}`;
            const opt = opts[key];
            if (!opt.demandOption) {
                strOpt = `[${strOpt}]`;
            }

            // Spacing
            return (i === 0 ? " " : "") + strOpt;
        }).filter((n) => n !== null).join(" ");
        return `${this.command}${commandString} - ${this.description}`;
    }

    /**
     * Returns a detailed description of the command and its options.
     * @returns An array of strings. Display each string in a separate line for the user.
     */
    public detailedHelp(): string[]|null {
        if (!this.description) {
            return null;
        }
        const response: string[] = [];
        response.push(`${this.command} - ${this.description}`);
        const opts = this.options || {};
        Object.keys(opts).sort((a, b) => {
            const x = opts[a].demandOption;
            const y = opts[b].demandOption;
            return (x === y) ? 0 : (x ? -1 : 1);
        }).forEach((key) => {
            const opt = opts[key];
            const positional = this.command.includes(` ${key}`) || this.command.includes(` [${key}]`);
            const alias = opt.alias && !positional ? `|-${opt.alias}` : "";
            const k = positional ? key : `--${key}`;
            const required = opt.demandOption ? " (Required)" : "";
            response.push(`  ${k}${alias} - ${opt.description}${required}`);
        });
        return response;
    }
}


text:
exports.config = {
  specs: [
    './js/**/*.js'
  ],
  exclude: [
    './js/nbviewer/*.js',
    './js/*/infinit*.js',
    './js/groovy/javaArg*.js'
  ],
  maxInstances: 1,
  capabilities: [{
    maxInstances: 1,
    browserName: 'chrome'
  }],
  sync: true,
  logLevel: 'silent',
  coloredLogs: true,
  bail: 0,
  baseUrl: 'http://localhost',
  waitforTimeout: 70000,
  connectionRetryTimeout: 90000,
  connectionRetryCount: 3,
  deprecationWarnings: false,
  framework: 'jasmine',
  reporters: ['spec'],
  jasmineNodeOpts: {
    defaultTimeoutInterval: 60000,
    expectationResultHandler: function (passed, assertion) {
      // do something
    }
  }
};


text:
cpp-ORM
=========

Current build status :
[![Build Status](https://travis-ci.org/Krozark/cpp-ORM.svg?branch=master)](https://travis-ci.org/Krozark/cpp-ORM)

An ORM project.

You can simply create persistent objects using databases.

The object representation:
    Each object have to be in a separate table with a pk column named 'id' as auto increment.
    each attr is a column in this table.

Table ares created automaticly.

Tested on
----------

* Windows x64 (sqlite3 only) + Mingw 4.9 [v 0.4+]
* Ubuntu + Gcc 4.8+ [v 0.1+]
* Ubuntu + clang 3.3+ [v 0.1+]

functions
---------

* Persistent Object
 * print as json
 * save / update / load
 * polymorphic object [0.4.2]
* Foreign key
 * save / update / load
* ManyToMany
 * save / update / load / add / remove
* filters (and, or, not)
 * WHERE statement
 * and, or, not
 * order by
 * limit
* caching
* debug output (set ORM_DEBUG to ORM_DEBUG_XXX in debug.hpp)
* multi connection for a single object (select/save) [v 0.3]
* Table creation, clearing and drop

Data bases supported
=====================

* MySql
* Sqlite3

Requirement
===========

* mysql-connector-c (if Mysql support is needed). Can be find here : https://dev.mysql.com/downloads/connector/c/ or libmysql++-dev (ubuntu)
* ~~lib Sqlite3~~ [included since v 0.4]
* pthread (for linux only) [v 0.4+]
* doxygen (for user doc only)

Installation
===========

You just have to use cmake:

    mkdir build
    cd build
    cmake ..
    make
    make install

You can customise the backends supported using

* ORM_BUILD_SUPPORT_SQLITE3
* ORM_BUILD_SUPPORT_MYSQL

Exemple
=======

You can see complet exemple in main.cpp

To build the exemple (the database is include)

    set the BUILD_EXAMPLES to True with cmake

```C++

    //#include <ORM/backends/MySql.hpp>
    //create your default database
    orm::MySqlDB def("root","root","test");

    //#include <ORM/backends/Sqlite3.hpp>
    //orm::Sqlite3DB def("./datas/test.db"); //if you want to use sqlite3

    //make it as default
    orm::DB& orm::DB::Default = def;

    #include <ORM/fields.hpp>
    #include <ORM/models/SqlObject.hpp>
    //create you class
    class Perso : public orm::SqlObject<Perso>
    {
        public:
            Perso();
            orm::CharField<255> name;
            orm::IntegerField pv;
            orm::IntegerField lvl;

            MAKE_STATIC_COLUM(name,pv,lvl)
    };
    REGISTER_AND_CONSTRUCT(Perso,"perso",name,"nom",pv,"pv",lvl,"lvl")

    int main(int argc,char* argv[])
    {
        //connect to database
        orm::DB::Default.connect();

        //orm::Tables::drop();  // delete all tables
        //orm::Tables::clear();  // clear tables contents
        orm::Tables::create(); //create all thes tables

        //get perso with pk=1
        Perso::type_ptr p1 = Perso::get(1);
        //see it
        cout<<*p1<<endl;
        //modify it
        p1->pv +=14;
        //save it
        p1->save();

        //add one
        Perso::type_ptr p2 = Perso::create();// = new Perso;
        p2->name = "test insert";
        p2->lvl = 75;
        p2->save(); //save it
        cout<<*p2<<endl;

        // all
        cout<<"All persos"<<endl;
        Perso::result_type lis= Perso::all();
        for(auto u : lis)
            cout<<*u<<endl;

        list.clear();
        //custom query
        Perso::query()\
            .filter(Q<Perso>(4,"gt",Perso::$lvl)
                and Q<Perso>(42,"gte",Perso::$lvl)
                and Q<Perso>("test","startswith",Perso::$name)
                and not Q<Perso>(4,"lt",Perso::$lvl)
            ).orderBy(Perso::$name)\
            .limit(42)\
            .get(lis); //get take a list T::result_type& or a T& as param
        for(auto u : lis)
            cout<<*u<<endl;

        orm::DB::Default.disconnect();
        return 0;
    }

```

Class
=====

All class are under the orm namespace

orm::SqlObject<T>
-----------------

Base class for persistent T class. It add all static method / attribute to your class.

make some static method:
* T::result_type get(int pk)
* T::result_type all()
* orm::QuerySet\<T\> T::query()  construct a queryset to make custom query

static member:
* DB* default_connection : database where the object is contain
* std::string table : table name on the database

make member fonction:
* bool save(bool recursive=false,DB&=*default_connection)
* bool del(bool recursive=false,DB&=*default_connection)

Exemple: see main.cpp

Fields
------

* AutoField
* BooleanField
* CharField\<int\>
* TextField
* DateTimeField
* AutoDateTimeField
* AutoNowDateTimeField
* DoubleField
* FloatField
* IntegerField

* FK\<T\>
* ManyToMany\<OWNER,T\>

orm::Attr\<T\>
--------------

Make a T persistent in the database.

You can access to the value using:
* T value;

All operators are overloads to make a easy use of it.

You may prefer to use premake fields

orm::ManyToMany\<T,U\>
======================

T have to be the persistent class where the M2M is use, and U the persistent class.
I create a link with the 2 class, and you can access to the U using:

accessors:
* U::result_type .all()

orm::DB
---------

Base classe to deal with your database. Use specialize database (MySqlDB, ...)

Constructor:
DB(const std::string& username,const std::string& pass,const std::string& db,const std::string& serveur,const std::string& port);

You can use some fonction:
* bool connect()
* bool disconnect()
* Query* query()
* Query* query(std::string&)
* Query* query(std::string&&)
* Query* preparedQuery(std::string&)
* Query* preparedQuery(std::string&&)

You can custom the default database:

    orm::MySqlDB def("root","root","test");
    orm::DB& orm::DB::Default = def;

Macros
======

There are some macos to help.

MAKE_STATIC_COLUM(...)
----------------------

To call in your class with all persistent attrs in params. It will construct the static std::string to use (on filter ...).
ORM_MAKE_NAME(colum) turn your colunm name to the on to use by adding ORM_COLUMN_CHAR ($ by default)

exemple:

```C++
    class Spell : public orm::SqlObject<Spell>
    {
        public:
            Spell();
            orm::CharField<255> name;
            orm::IntegerField element;

            MAKE_STATIC_COLUMN(name,element);

    };
```

the colums $name and $element will be created for query.

```C++
    Spell::
    auto results = Spell::query().filter("spell name",orm::op::exact,Spell::$name);
```

REGISTER_AND_CONSTRUCT(klass,colum,[attr,colum]+)
-------------------------------------------------

Make the default constructor of your class, construct all comulm as static strings.
This macro simply call REGISTER_TABLE(klass,colum) and MAKE_CONSTRUCTOR(klass,__VA_ARGS__)

Marcos II
---------

Only to use if you want build a custum constructor

REGISTER_TABLE(klass,colum)
------------------------------

If you use REGISTER_AND_CONSTRUCT, you don't need to use it.

Thiis will create all the static variables needed by the library

MAKE_CONSTRUCTOR(klass[,attr,colum]+)
--------------------------------------

If you use REGISTER_AND_CONSTRUCT, you don't need to use it.

Make the default constructor for the class klass, and register all Att in params. It also call _MAKE_STRING_N to create attrs colum names as static.

     _MAKE_STRING_N(klass,NUM_ARGS(__VA_ARGS__),__VA_ARGS__)
    klass::klass(): _MAKE_ATTRS_N(NUM_ARGS(__VA_ARGS__),__VA_ARGS__)
    {
         _MAKE_REGISTER_ATTRS(NUM_ARGS(__VA_ARGS__),__VA_ARGS__)
    }

 _MAKE_STRING_N(klass,N,...)
----------------------------
If you use REGISTER_AND_CONSTRUCT, you don't need to use it.

N have to be the number of attrs (in ...)

Simply construct all string as:
    std::string klass::_attr = colum;

_MAKE_ATTRS_N(N,...)
--------------------
If you use REGISTER_AND_CONSTRUCT, you don't need to use it.

N have to be lenght of ...

simply add attr(colum) to constuctor for const initialize

_MAKE_REGISTER_ATTRS(N,...)
---------------------------------------
If you use REGISTER_AND_CONSTRUCT, you don't need to use it.

for each att in ...

    this->registerAttr(this->name);


text:
<?php
/**
 * Created by PhpStorm.
 * User: psybo-03
 * Date: 1/7/17
 * Time: 2:59 PM
 */

defined('BASEPATH') OR exit('No direct script access allowed');
require_once(APPPATH . 'core/Check_Logged.php');

class Gallery_Controller extends Check_Logged
{

    //        public $delete_cache_on_save = TRUE;
    function __construct()
    {
        parent::__construct();
        $this->load->model('Gallery_model', 'gallery');
//        $this->load->model('Gallery_Files_Model', 'gallery_files');
        $this->load->model('File_model', 'file');

        $this->load->library(['upload', 'image_lib']);

        if (!$this->logged) {
            redirect(base_url('login'));
        }
    }

    function index()
    {
        $data = $this->gallery->with_file()->get_all();
        $this->output->set_content_type('application/json')->set_output(json_encode($data));
    }

    function get_all()
    {
        $data = $this->gallery->with_file()->get_all();
        $this->output->set_content_type('application/json')->set_output(json_encode($data));
    }

    function store()
    {
        $this->form_validation->set_rules('name', 'Name', 'required');
        if ($this->form_validation->run() === FALSE) {
            $this->output->set_status_header(400, 'Validation Error');
            $this->output->set_content_type('application/json')->set_output(json_encode(validation_errors()));
        } else {
            $post_data = $this->input->post();
            $uploaded = json_decode($post_data['uploaded']);

            unset($post_data['uploaded']);

            if (!empty($uploaded) ) {
                /*INSERT FILE DATA TO DB*/
                foreach ($uploaded as $value) {
                    $file_data['file_name'] = $value->file_name;
                    $file_data['file_type'] = $value->file_type;
                    $file_data['size'] = $value->file_size;
                    $file_data['date'] = date('Y-m-d');
                    $file_id = $this->file->insert($file_data);

                    $post_data['file_id'] = $file_id;

                    $gallery_id = $this->gallery->insert($post_data);

                    if ($gallery_id) {
                        /*****Create Thumb Image****/
                        $img_cfg['source_image'] = getwdir() . 'uploads/' . $value->file_name;
                        $img_cfg['maintain_ratio'] = TRUE;
                        $img_cfg['new_image'] = getwdir() . 'uploads/thumb/thumb_' . $value->file_name;
                        $img_cfg['quality'] = 99;
                        $img_cfg['master_dim'] = 'height';

                        $this->image_lib->initialize($img_cfg);
                        if (!$this->image_lib->resize()) {
                            $resize_error[] = $this->image_lib->display_errors();
                        }
                        $this->image_lib->clear();

                        /********End Thumb*********/

                        /*resize and create thumbnail image*/
                        if ($value->file_size > 1024) {
                            $img_cfg['image_library'] = 'gd2';
                            $img_cfg['source_image'] = getwdir() . 'uploads/' . $value->file_name;
                            $img_cfg['maintain_ratio'] = TRUE;
                            $img_cfg['new_image'] = getwdir() . 'uploads/' . $value->file_name;
                            $img_cfg['height'] = 500;
                            $img_cfg['quality'] = 100;
                            $img_cfg['master_dim'] = 'height';

                            $this->image_lib->initialize($img_cfg);
                            if (!$this->image_lib->resize()) {
                                $resize_error[] = $this->image_lib->display_errors();
                            }
                            $this->image_lib->clear();

                            /********End resize*********/
                        }
                    }
                    $resize_error = [];
                    if (empty($resize_error)) {
                        $this->output->set_content_type('application/json')->set_output(json_encode($post_data));
                    } else {
//                            $this->output->set_status_header(402, 'Server Down');
                        $this->output->set_content_type('application/json')->set_output(json_encode($resize_error));
                    }
                }
            } else {
                $this->output->set_status_header(400, 'Validation Error');
                $this->output->set_content_type('application/json')->set_output(json_encode(['validation_error' => 'Please select images.']));
            }
        }
    }

    function update($id){
        $this->form_validation->set_rules('name', 'Name', 'required');
        if ($this->form_validation->run() === FALSE) {
            $this->output->set_status_header(400, 'Validation Error');
            $this->output->set_content_type('application/json')->set_output(json_encode(validation_errors()));
        } else {
            $post_data = $this->input->post();
            $uploaded = json_decode($post_data['uploaded']);

            unset($post_data['uploaded']);
            unset($post_data['file']);

                if (!empty($uploaded)) {
                    /*INSERT FILE DATA TO DB*/
                    foreach ($uploaded as $value) {
                        $file_data['file_name'] = $value->file_name;
                        $file_data['file_type'] = $value->file_type;
                        $file_data['size'] = $value->file_size;
                        $file_data['date'] = $this->input->post('date');
                        $file_id = $this->file->insert($file_data);

                        $post_data['file_id'] = $file_id;

                        if ($this->gallery->update($post_data,$id)) {
                            /*****Create Thumb Image****/
                            $img_cfg['source_image'] = getwdir() . 'uploads/' . $value->file_name;
                            $img_cfg['maintain_ratio'] = TRUE;
                            $img_cfg['new_image'] = getwdir() . 'uploads/thumb/thumb_' . $value->file_name;
                            $img_cfg['quality'] = 99;
                            $img_cfg['master_dim'] = 'height';

                            $this->image_lib->initialize($img_cfg);
                            if (!$this->image_lib->resize()) {
                                $resize_error[] = $this->image_lib->display_errors();
                            }
                            $this->image_lib->clear();

                            /********End Thumb*********/

                            /*resize and create thumbnail image*/
                            if ($value->file_size > 1024) {
                                $img_cfg['image_library'] = 'gd2';
                                $img_cfg['source_image'] = getwdir() . 'uploads/' . $value->file_name;
                                $img_cfg['maintain_ratio'] = TRUE;
                                $img_cfg['new_image'] = getwdir() . 'uploads/' . $value->file_name;
                                $img_cfg['height'] = 500;
                                $img_cfg['quality'] = 100;
                                $img_cfg['master_dim'] = 'height';

                                $this->image_lib->initialize($img_cfg);
                                if (!$this->image_lib->resize()) {
                                    $resize_error[] = $this->image_lib->display_errors();
                                }
                                $this->image_lib->clear();

                                /********End resize*********/
                            }
                        }
                        $resize_error = [];
                        if (empty($resize_error)) {
                            $this->output->set_content_type('application/json')->set_output(json_encode($post_data));
                        } else {
                            $this->output->set_content_type('application/json')->set_output(json_encode($resize_error));
                        }
                    }
                } elseif($this->gallery->update($post_data,$id)) {
                    $this->output->set_content_type('application/json')->set_output(json_encode($post_data));
                }else {
                $this->output->set_status_header(500, 'Server Down');
                $this->output->set_content_type('application/json')->set_output(json_encode(['validation_error' => 'Please select images.']));
            }
        }
    }

    function delete_image($id)
    {
        $gallery = $this->gallery->with_file()->where('file_id',$id)->get();
        if ($gallery->file != null and $this->file->delete($gallery->file->id)) {
            if (file_exists(getwdir() . 'uploads/' . $gallery->file->file_name)) {
                unlink(getwdir() . 'uploads/' . $gallery->file->file_name);
            }
            $this->output->set_content_type('application/json')->set_output(json_encode(['msg' => 'Image Delete']));
        }else{
            $this->output->set_status_header(400, 'Server Down');
            $this->output->set_content_type('application/json')->set_output(json_encode(['error' => 'Try again later']));
        }
    }

    function upload()
    {
        $config['upload_path'] = getwdir() . 'uploads';
        $config['allowed_types'] = 'jpg|png|jpeg|JPG|JPEG';
        $config['max_size'] = 4096;
        $config['file_name'] = 'G_' . rand();
        $config['multi'] = 'ignore';
        $this->upload->initialize($config);
        if ($this->upload->do_upload('file')) {
            $this->output->set_content_type('application/json')->set_output(json_encode($this->upload->data()));
        }else{
            $this->output->set_status_header(401, 'File Upload Error');
            $this->output->set_content_type('application/json')->set_output($this->upload->display_errors('',''));
        }
    }

    public function delete($id)
    {
        $gallery = $this->gallery->with_file()->where('id', $id)->get();
        if ($gallery) {
            if ($gallery->file != null) {
                if ($this->file->delete($gallery->file->id)) {
                    if (file_exists(getwdir() . 'uploads/' . $gallery->file->file_name)) {
                        unlink(getwdir() . 'uploads/' . $gallery->file->file_name);
                        if ($this->gallery->delete($id)) {
                            $this->output->set_content_type('application/json')->set_output(json_encode(['msg' => 'Gallery Deleted']));
                        } else {
                            $this->output->set_content_type('application/json')->set_output(json_encode(['msg' => 'Gallery not deleted but some files are deleted']));
                        }
                    } else {
                        $this->output->set_content_type('application/json')->set_output(json_encode(['msg' => 'Gallery file not exist in directory']));
                    }
                }
            } else {
                $this->gallery->delete($id);
                $this->output->set_content_type('application/json')->set_output(json_encode(['msg' => 'Gallery Deleted']));
            }
        } else {
            $this->output->set_status_header(500, 'Validation error');
            $this->output->set_content_type('application/json')->set_output(json_encode(['error' => 'The Record Not found']));
        }
    }

}


text:
import {charaChartRodata} from '../rodata'
import Word from './Word'
import {isCharacter,searchNodeArrayForCharacterAndPoint} from '../chara/isChara'
import {isVerb} from './isVerb'
import {addSVO2Bunsetsu

} from './SO/addSVO2bunsetsu'
import { unifyNotaion } from '../chara/unifyNotation'

const bunsetsu1stJpRIdx=charaChartRodata.bunsetsu1stJpRowNo

export default class Bunsetsu {
  constructor (no, input2dArr, charaArr, bun) {
    this.csv_raw_array = input2dArr
    this.id = no + 'D'

    this.kihonkuArr = []
   // this.kihonkuArr.length = count_kihonku(input2dArr)

    this.word_array = []

    this.kakaru_bunsetsu_id = input2dArr[0][1]
    this.kakarareru_bunsetsu_id_array = []
    //this.surfaceForm = ''
    input2dArr.forEach((r) => {
      //this.surfaceForm += r[0]
      this.word_array.push(new Word(r))//forHinshi
    })
    this.isVerb = false

    //this.createKihonkuArrayInBunsetsu(input2dArr)

    const tmpCharaName = unifyNotaion( this.csv_raw_array[ bunsetsu1stJpRIdx ][ 0 ] )

    addSVO2Bunsetsu(charaArr,tmpCharaName,this,bun)
    delete this.csv_raw_array
  }

  createKihonkuArrayInBunsetsu (bunsetsuRaw2dArray) {
    let kihonkuIdxInBunsetsu = 0
    let tmp2dArrForKihonku = []
    if (bunsetsuRaw2dArray.length >= 1) {
      const jp1stNo = 2
      for (let rowCnt = jp1stNo; rowCnt < bunsetsuRaw2dArray.length; rowCnt++) {
        let tmpRow = bunsetsuRaw2dArray[rowCnt]
        if (tmpRow[0] === charaChartRodata.kihonkuSymbol) { // 文節内 2こ目以降の基本句
          this.kihonkuArr[kihonkuIdxInBunsetsu] = new KihonkuInBunsetsu(tmp2dArrForKihonku)// 文の中の通し番号での基本句array
          tmp2dArrForKihonku = []
          kihonkuIdxInBunsetsu++
        }
        tmp2dArrForKihonku.push(tmpRow)
      }
      this.kihonkuArr[kihonkuIdxInBunsetsu] = new KihonkuInBunsetsu(tmp2dArrForKihonku)// 文の中の通し番号での基本句array
    }
  }

  findVerbInBunsetsu () {
    for(let i=bunsetsu1stJpRIdx;i<this.word_array.length;i++){
      if (isVerb(this.word_array[i].hinshi)) {
        this.isVerb = true
        this.verb = this.word_array[i].basic_form
        break
      }
    }
  }

}

class KihonkuInBunsetsu {
  constructor (r) {
    this.csv_raw_array = []
    this.word_array = []
    for (let rCnt = 1; rCnt < r.length; rCnt++) {
    }
    this.subject = 'null'
    this.object = 'null'
    this.kakaruNo = 'null'
    this.surfaceForm = r[0]
  }
}


text:
package ru.job4j.board;

/**
*Class ImposibleMoveException.
*Оригинальное исключение, выдаваемое при выборе невозможного хода.
*@author APavlov.
*@since 16.12.17.
*@version 1.
*/
public class ImpossibleMoveException extends Exception {
	public String toString() {
		return "Error, this move the impossible ImpossibleMoveException";
	}
}


text:
title: What does multi-stakeholder management mean?
layout: default
date: 2014-07-14
img: what.png
thumbnail: what.png
alt: image-alt
category: content
description: Guiding the evolution of a complex network of human organizations.
page: what
---


text:
#ifndef UseCounter_h
#define UseCounter_h

#include "CSSPropertyNames.h"
#include "wtf/BitVector.h"
#include "wtf/Noncopyable.h"
#include "wtf/OwnPtr.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/text/WTFString.h"

namespace WebCore {

class CSSStyleSheet;
class DOMWindow;
class Document;
class ScriptExecutionContext;
class StyleSheetContents;

// UseCounter is used for counting the number of times features of
// Blink are used on real web pages and help us know commonly
// features are used and thus when it's safe to remove or change them.
//
// The Chromium Content layer controls what is done with this data.
// For instance, in Google Chrome, these counts are submitted
// anonymously through the Histogram recording system in Chrome
// for users who opt-in to "Usage Statistics" submission
// during their install of Google Chrome:
// http://www.google.com/chrome/intl/en/privacy.html

class UseCounter {
    WTF_MAKE_NONCOPYABLE(UseCounter);
public:
    UseCounter();
    ~UseCounter();

    enum Feature {
        PageDestruction,
        LegacyNotifications,
        MultipartMainResource,
        PrefixedIndexedDB,
        WorkerStart,
        SharedWorkerStart,
        LegacyWebAudio,
        WebAudioStart,
        PrefixedContentSecurityPolicy,
        UnprefixedIndexedDB,
        OpenWebDatabase,
        UnusedSlot01, // Prior to 7/2013, we used this slot for LegacyHTMLNotifications.
        LegacyTextNotifications,
        UnprefixedRequestAnimationFrame,
        PrefixedRequestAnimationFrame,
        ContentSecurityPolicy,
        ContentSecurityPolicyReportOnly,
        PrefixedContentSecurityPolicyReportOnly,
        PrefixedTransitionEndEvent,
        UnprefixedTransitionEndEvent,
        PrefixedAndUnprefixedTransitionEndEvent,
        AutoFocusAttribute,
        UnusedSlot02, // Prior to 4/2013, we used this slot for AutoSaveAttribute.
        DataListElement,
        FormAttribute,
        IncrementalAttribute,
        InputTypeColor,
        InputTypeDate,
        InputTypeDateTime,
        InputTypeDateTimeFallback,
        InputTypeDateTimeLocal,
        InputTypeEmail,
        InputTypeMonth,
        InputTypeNumber,
        InputTypeRange,
        InputTypeSearch,
        InputTypeTel,
        InputTypeTime,
        InputTypeURL,
        InputTypeWeek,
        InputTypeWeekFallback,
        ListAttribute,
        MaxAttribute,
        MinAttribute,
        PatternAttribute,
        PlaceholderAttribute,
        PrecisionAttribute,
        PrefixedDirectoryAttribute,
        PrefixedSpeechAttribute,
        RequiredAttribute,
        ResultsAttribute,
        StepAttribute,
        PageVisits,
        HTMLMarqueeElement,
        UnusedSlot03, // Removed, was tracking overflow: -webkit-marquee.
        Reflection,
        CursorVisibility, // Removed, was -webkit-cursor-visibility.
        StorageInfo,
        XFrameOptions,
        XFrameOptionsSameOrigin,
        XFrameOptionsSameOriginWithBadAncestorChain,
        DeprecatedFlexboxWebContent,
        DeprecatedFlexboxChrome,
        DeprecatedFlexboxChromeExtension,
        SVGTRefElement,
        UnprefixedPerformanceTimeline,
        PrefixedPerformanceTimeline,
        UnprefixedUserTiming,
        PrefixedUserTiming,
        WindowEvent,
        ContentSecurityPolicyWithBaseElement,
        PrefixedMediaAddKey,
        PrefixedMediaGenerateKeyRequest,
        WebAudioLooping,
        DocumentClear,
        PrefixedTransitionMediaFeature,
        SVGFontElement,
        XMLDocument,
        XSLProcessingInstruction,
        XSLTProcessor,
        SVGSwitchElement,
        PrefixedDocumentRegister,
        HTMLShadowElementOlderShadowRoot,
        DocumentAll,
        FormElement,
        DemotedFormElement,
        CaptureAttributeAsEnum,
        ShadowDOMPrefixedPseudo,
        ShadowDOMPrefixedCreateShadowRoot,
        ShadowDOMPrefixedShadowRoot,
        SVGAnimationElement,
        KeyboardEventKeyLocation,
        CaptureEvents,
        ReleaseEvents,
        CSSDisplayRunIn,
        CSSDisplayCompact,
        LineClamp,
        SubFrameBeforeUnloadRegistered,
        SubFrameBeforeUnloadFired,
        CSSPseudoElementPrefixedDistributed,
        TextReplaceWholeText,
        PrefixedShadowRootConstructor,
        ConsoleMarkTimeline,
        CSSPseudoElementUserAgentCustomPseudo,
        // Add new features immediately above this line. Don't change assigned
        // numbers of each items, and don't reuse unused slots.
        NumberOfFeatures, // This enum value must be last.
    };

    // "count" sets the bit for this feature to 1. Repeated calls are ignored.
    static void count(Document*, Feature);
    static void count(DOMWindow*, Feature);
    void count(CSSPropertyID);
    void count(Feature);

    // "countDeprecation" sets the bit for this feature to 1, and sends a deprecation
    // warning to the console. Repeated calls are ignored.
    //
    // Be considerate to developers' consoles: features should only send deprecation warnings
    // when we're actively interested in removing them from the platform.
    static void countDeprecation(DOMWindow*, Feature);
    static void countDeprecation(ScriptExecutionContext*, Feature);
    static void countDeprecation(Document*, Feature);
    String deprecationMessage(Feature);

    void didCommitLoad();

    static UseCounter* getFrom(const Document*);
    static UseCounter* getFrom(const CSSStyleSheet*);
    static UseCounter* getFrom(const StyleSheetContents*);

    static int mapCSSPropertyIdToCSSSampleIdForHistogram(int id);

private:
    bool recordMeasurement(Feature feature)
    {
        ASSERT(feature != PageDestruction); // PageDestruction is reserved as a scaling factor.
        ASSERT(feature < NumberOfFeatures);
        if (!m_countBits) {
            m_countBits = adoptPtr(new BitVector(NumberOfFeatures));
            m_countBits->clearAll();
        }

        if (m_countBits->quickGet(feature))
            return false;

        m_countBits->quickSet(feature);
        return true;
    }

    void updateMeasurements();

    OwnPtr<BitVector> m_countBits;
    BitVector m_CSSFeatureBits;
};

} // namespace WebCore

#endif // UseCounter_h


text:
'''
EIP checker.

Author: YYK
'''

import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.header.checker as checker_header

class eip_checker(checker_header.TestChecker):
    def __init__(self):
        super(eip_checker, self).__init__()

    def check(self):
        super(eip_checker, self).check()
        test_result = True
        if self.test_obj.vm:
            self.vm_check(test_result)
        test_util.test_logger('Check result:' )
        return self.judge(test_result)

    def vm_check(self, test_result):
        vm = self.test_obj.vm
        test_util.test_logger("Begin to check VM DHCP in VM: %s" % vm.uuid)
        nic = test_lib.lib_get_nic_by_uuid(self.test_obj.get_creation_option().get_vm_nic_uuid())
        test_lib.lib_find_vr_by_vm(vm)
        guest_ip = nic.ip
        host = test_lib.lib_get_vm_host(vm)
        vm_command = '/sbin/ifconfig'
        vm_cmd_result = test_lib.lib_ssh_vm_cmd_by_agent_with_retry(host.managementIp, self.test_obj.vip.ip, test_lib.lib_get_vm_username(vm), test_lib.lib_get_vm_password(vm), vm_command)
        if not vm_cmd_result:
            test_util.test_logger('Checker result: FAIL to execute test ssh command in test [vm:] %s throught [host:] %s.' % (vm.uuid, host.name))
            return self.judge(False)

        if guest_ip in vm_cmd_result:
            test_util.test_logger('Checker result: guest [ip:] %s is SET in guest [vm:] %s.' % (guest_ip, vm.uuid))
        else:
            test_util.test_logger('Checker result: guest [ip:] %s is NOT found in guest [vm:] %s. \n It might be because the ifconfig is not reflect the ip address yet. \n The current ifconfig result is: %s' % (guest_ip, vm.uuid, vm_cmd_result))
            return self.judge(False)
        return self.judge(True)


text:
module Opendata::Api::PackageSearchFilter
  extend ActiveSupport::Concern
  include Opendata::Api

  private
    def package_search_check(rows, start)

      rows_messages = []
      start_messages = []

      check_num(rows, rows_messages)
      check_num(start, start_messages)

      messages = {}
      messages[:rows] = rows_messages if rows_messages.size > 0
      messages[:start] = start_messages if start_messages.size > 0

      if messages.size > 0
        error = {__type: "Validation Error"}
        error = error.merge(messages)
      end

      return error
    end

  public
    def package_search
      help = t("opendata.api.package_search_help")

      query = params[:q] || ":"
      rows = params[:rows]
      start = params[:start]

      error = package_search_check(rows, start)
      if error
        render json: {help: help, success: false, error: error} and return
      end

      datasets = Opendata::Dataset.site(@cur_site).public.search({keyword: URI.decode(query)})

      all_count = datasets.count
      datasets = datasets.skip(start) if start
      datasets = datasets[0, rows.to_i] if rows
      result = {count: all_count, results: convert_packages(datasets)}
      res = {help: help, success: true, result: result}

      render json: res

    end

end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NaturalLanguageDateTime.NLDT
{
    class Nouns : IDetector
    {
        public static string[] AbstractNouns = new string[] { "second", "seconds", "minute", "minutes", "hour", "hours", "day", "days", "week", "weeks", "month", "months", "year", "years" };// These are abstract nouns - you cannot sense them with your 5 senses.
        public static string[] AbstractNounsAny = new string[] { "time" }; //nouns that can have any meaning from AbstractNouns

        public static bool IsA(string noun)
        {
            return AbstractNouns.Concat<string>(AbstractNounsAny).Contains<string>(noun, StringComparer.OrdinalIgnoreCase);
        }

        public static TimeSpan AsTimeSpan(Noun noun)
        {
            return TimeSpan.FromTicks(Ticks(noun));
        }

        public static Int64 Ticks(Noun noun)
        {
            switch(noun.Value.ToLower())
            {
                case "second":
                case "seconds":
                    return TimeSpan.TicksPerSecond;
                case "minute":
                case "minutes":
                    return TimeSpan.TicksPerMinute;
                case "hour":
                case "hours":
                    return TimeSpan.TicksPerHour;
                case "day" :
                case "days" :
                    return TimeSpan.TicksPerDay;
                case "week":
                case "weeks":
                    return Ticks(Noun.From("day")) * 7;
                case "month":
                case "months":
                    return Ticks(Noun.From("week")) * 4;
                case "year":
                case "years":
                    return Ticks(Noun.From("month")) * 2;
                case "time":
                    return Ticks(Noun.From(AbstractNouns[new Random().Next(AbstractNouns.Length)]));//take some random noun
                default:
                    throw new ArgumentException("Got unrecognized noun: " + noun);
            }
        }

    }
}


text:
package squants.experimental.formatter

import squants.Quantity
import squants.experimental.unitgroups.UnitGroup

class DefaultFormatter[A <: Quantity[A]](unitGroup: UnitGroup[A]) extends Formatter[A] {
  override def inBestUnit(quantity: Quantity[A]): A = {
    if (unitGroup.units.isEmpty)
      quantity.in(quantity.unit)
    else {
      val unit =
        unitGroup.sortedUnits
          .takeWhile { u => quantity.to(u).abs >= 1.0 }
          .lastOption
          .getOrElse(unitGroup.sortedUnits.head)
      quantity.in(unit)
    }
  }
}


text:
<!--- Provide a general summary of the issue in the Title above -->

## Expected Behavior
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->

## Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->

## Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->

## Steps to Reproduce (for bugs)
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->
1.
2.
3.
4.

## Debug log (for bugs)
<!--- Please provide a debug log for your issue. -->
<!--- You can activate the debug log with 'WebSocketImpl.DEBUG = true;' -->

## Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->

## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* Version used:
* Java version:
* Operating System and version:
* Endpoint Name and version:
* Link to your project:


text:
<?php

namespace Respect\Validation\Rules;

use ReflectionClass;
use Symfony\Component\Validator\ConstraintViolation;

class Sf extends AbstractRule
{

    public $name;
    protected $constraint;
    protected $messages = array();
    protected $validator;

    public function __construct($name, $params=array())
    {
        $this->name = ucfirst($name);
        $sfMirrorConstraint = new ReflectionClass(
                'Symfony\Component\Validator\Constraints\\' . $this->name
        );
        if ($sfMirrorConstraint->hasMethod('__construct'))
            $this->constraint = $sfMirrorConstraint->newInstanceArgs($params);
        else
            $this->constraint = $sfMirrorConstraint->newInstance();
    }

    public function assert($input)
    {
        if (!$this->validate($input)) {
            $violation = new ConstraintViolation(
                    $this->validator->getMessageTemplate(),
                    $this->validator->getMessageParameters(),
                    '',
                    '',
                    $input
            );
            throw $this->reportError($violation->getMessage());
        }
        return true;
    }

    public function validate($input)
    {
        $validatorName = 'Symfony\Component\Validator\Constraints\\'
            . $this->name . 'Validator';
        $this->validator = new $validatorName;
        return $this->validator->isValid($input, $this->constraint);
    }

}


text:
<!DOCTYPE html>

	<title>Index Landing Page</title>
	<link rel="stylesheet" type="text/css" href="stylesheet/default.css">

Eran Chazan

GitHub

Twitter

LinkedIn

Facebook

About Me

Contact

Projects

Resume

Index.html

Coppperhead Fall 2015 DevBootCamp Phase 0