text:
module RailsRole::LinkHelper

  def link_to(name = nil, options = nil, html_options = nil, &block)
    if block_given?
      _options = name
      _html_options = options || {}
    else
      _options = options
      _html_options = html_options || {}
    end

    if role_permit?(_options, _html_options)
      super
    elsif _html_options[:text]
      if block_given?
        capture(&block)
      else
        ERB::Util.html_escape(name)
      end
    end
  end

  def role_permit?(_options, _html_options)
    if _options.is_a? String
      begin
        path_params = Rails.application.routes.recognize_path _options, { method: _html_options.fetch(:method, nil) }
      rescue ActionController::RoutingError
        return true
      end
    elsif _options == :back
      return true
    elsif _options.is_a? Hash
      path_params = _options.slice(:controller, :action)
    else
      path_params = {}
    end
    path_params[:controller] ||= controller_path
    path_params[:action] ||= 'index'
    r = RailsCom::Routes.controllers.dig(path_params[:controller].delete_prefix('/'), path_params[:action])
    Rails.application.routes.send :generate, nil, path_params, request.path_parameters  # 例如 'orders' -> 'trade/me/orders'
    if r.present?
      path_params[:business] = r[:business]
      path_params[:namespace] = r[:namespace]
    else
      path_params[:business] = params[:business]
      path_params[:namespace] = params[:namespace]
      path_params[:controller] = path_params[:controller]
    end
    extra_params = path_params.except(:controller, :action, :business, :namespace)

    if defined?(current_organ) && current_organ
      organ_permitted = current_organ.has_role?(params: extra_params, **path_params.slice(:business, :namespace, :controller, :action).symbolize_keys)
    else
      organ_permitted = true
    end
    if defined?(rails_role_user) && rails_role_user
      user_permitted = rails_role_user.has_role?(params: extra_params, **path_params.slice(:business, :namespace, :controller, :action).symbolize_keys)
    else
      user_permitted = true
    end

    result = organ_permitted && user_permitted
    if RailsRole.config.debug || !result
      logger.debug "  \e[35mOptions: #{_options}\e[0m"
      logger.debug "  \e[35mParams: #{path_params}\e[0m"
      logger.debug "  \e[35mOrgan: #{organ_permitted}\e[0m"
      logger.debug "  \e[35mUser: #{rails_role_user&.class&.name}_#{rails_role_user&.id}: #{user_permitted.inspect}\e[0m"
    end

    result
  end

end


text:
package com.mxixm.fastboot.weixin.module.media;

import com.mxixm.fastboot.weixin.exception.WxAppException;
import com.mxixm.fastboot.weixin.module.Wx;
import com.mxixm.fastboot.weixin.service.WxApiService;
import com.mxixm.fastboot.weixin.service.invoker.common.WxBufferingInputMessageWrapper;
import com.mxixm.fastboot.weixin.util.WxContextUtils;
import com.mxixm.fastboot.weixin.util.WxWebUtils;
import org.springframework.core.io.AbstractResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.MediaType;
import org.springframework.util.FileCopyUtils;
import org.springframework.util.StreamUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.util.UriComponentsBuilder;

import java.io.*;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import static java.nio.charset.StandardCharsets.US_ASCII;

/**
 * FastBootWeixin WxMediaResource
 *
 * @author Guangshan
 * @date 2017/8/12 21:05
 * @since 0.1.2
 */
public class WxMediaResource extends AbstractResource {

    private static final Map<String, String> MEDIA_TYPE_FILE_EXT = new HashMap<>();

    static {
        MEDIA_TYPE_FILE_EXT.put("image/png", "png");
        MEDIA_TYPE_FILE_EXT.put("image/jpeg", "jpg");
        MEDIA_TYPE_FILE_EXT.put("image/gif", "gif");
        MEDIA_TYPE_FILE_EXT.put("image/bmp", "bmp");
        MEDIA_TYPE_FILE_EXT.put("audio/amr", "amr");
        MEDIA_TYPE_FILE_EXT.put("audio/x-wav", "wav");
        MEDIA_TYPE_FILE_EXT.put("audio/mpeg", "mp3");
        MEDIA_TYPE_FILE_EXT.put("audio/x-ms-wma", "wma");
        MEDIA_TYPE_FILE_EXT.put("video/mp4", "mp4");
    }

    private static final String DEFAULT_EXT = "jpg";

    private static final String FILENAME_KEY = "filename=";

    private static final String FILENAME_WITH_CHARSET_KEY = "filename*=";

    private HttpHeaders httpHeaders;

    private byte[] body;

    private String description;

    private MediaType contentType;

    private long contentLength;

    private String filename;

    private String mediaId;

    private URL url;

    private File file;

    private boolean isUrlMedia;

    private boolean isFileResource;

    /**
     * 是否真的需要这么多成员变量?
     *
     * @param httpInputMessage
     * @throws IOException
     */
    public WxMediaResource(HttpInputMessage httpInputMessage) throws IOException {
        this.isFileResource = false;
        if (httpInputMessage instanceof WxBufferingInputMessageWrapper) {
            this.body = ((WxBufferingInputMessageWrapper) httpInputMessage).getRawBody();
        } else {
            this.body = StreamUtils.copyToByteArray(httpInputMessage.getBody());
        }
        this.httpHeaders = httpInputMessage.getHeaders();
        this.contentType = httpHeaders.getContentType();
        this.contentLength = httpHeaders.getContentLength();
        // 判断是否是json
        if (!this.httpHeaders.containsKey(HttpHeaders.CONTENT_DISPOSITION)) {
            this.isUrlMedia = true;
            if (body[0] == '{') {
                this.url = extractURL(body);
                this.filename = extractFilenameFromURL(url);
            } else if (httpHeaders.containsKey(WxWebUtils.X_WX_REQUEST_URL)) {
                this.url = URI.create(httpHeaders.getFirst(WxWebUtils.X_WX_REQUEST_URL)).toURL();
                this.filename = extractFilenameFromURL(url);
            } else {
                this.filename = UUID.randomUUID().toString() + ".jpg";
            }
        } else {
            this.description = this.httpHeaders.getFirst(HttpHeaders.CONTENT_DISPOSITION);
            this.filename = extractFilename(this.description);
        }
    }

    /**
     * 覆盖FileSystemResource,用于兼容mediaManager中从本地文件获取的资源
     * 是否真的需要这么多成员变量?
     *
     * @param file
     */
    public WxMediaResource(File file) {
        this.isFileResource = true;
        this.file = file;
        this.httpHeaders = new HttpHeaders();
        // 判断是否是json
        this.description = "file [" + this.file.getAbsolutePath() + "]";
        this.filename = file.getName();
        // 这里可以考虑使用文件扩展名获取对应的contentType,但是我不太想管,先不管吧
        // 反正获取contentType的地方做过空判断,如果为空的话会走默认的根据文件扩展名获取
        this.contentLength = file.length();
    }

    private URL extractURL(byte[] body) {
        String json = new String(body, StandardCharsets.UTF_8);
        int start = json.indexOf(":\"") + 2;
        int end = json.indexOf("\"", start);
        try {
            return new URL(json.substring(start, end));
        } catch (MalformedURLException e) {
            return null;
        }
    }

    /**
     * copy from StandardMultipartHttpServletRequest
     *
     * @param disposition
     * @return the result
     */
    private String extractFilename(String disposition) {
        String fileName = extractFilename(disposition, FILENAME_KEY);
        if (fileName == null) {
            fileName = extractFilenameWithCharset(disposition);
        }
        return fileName;
    }

    private String extractFilename(String contentDisposition, String key) {
        if (contentDisposition == null) {
            return null;
        }
        int startIndex = contentDisposition.indexOf(key);
        if (startIndex == -1) {
            return null;
        }
        String filename = contentDisposition.substring(startIndex + key.length());
        if (filename.startsWith("\"")) {
            int endIndex = filename.indexOf("\"", 1);
            if (endIndex != -1) {
                return filename.substring(1, endIndex);
            }
        } else {
            int endIndex = filename.indexOf(";");
            if (endIndex != -1) {
                return filename.substring(0, endIndex);
            }
        }
        return filename;
    }

    private String extractFilenameWithCharset(String contentDisposition) {
        String filename = extractFilename(contentDisposition, FILENAME_WITH_CHARSET_KEY);
        if (filename == null) {
            return null;
        }
        int index = filename.indexOf("'");
        if (index != -1) {
            Charset charset = null;
            try {
                charset = Charset.forName(filename.substring(0, index));
            } catch (IllegalArgumentException ex) {
                // ignore
            }
            filename = filename.substring(index + 1);
            // Skip language information..
            index = filename.indexOf("'");
            if (index != -1) {
                filename = filename.substring(index + 1);
            }
            if (charset != null) {
                filename = new String(filename.getBytes(US_ASCII), charset);
            }
        }
        return filename;
    }

    private String extractFilenameFromURL(URL url) {
        String uri = url.toString();
        int index = uri.lastIndexOf('/') + 1;
        String name = uri.substring(index);
        if (name.contains("?")) {
            name = name.substring(0, name.indexOf("?"));
        }
        String ext = MEDIA_TYPE_FILE_EXT.getOrDefault(this.contentType.toString(), DEFAULT_EXT);
        return name.contains(".") ? name : name + "." + ext;
    }

    @Override
    public String getDescription() {
        return this.description;
    }

    @Override
    public InputStream getInputStream() throws IOException {
        if (isFileResource) {
            return new FileInputStream(this.file);
        }
        return new ByteArrayInputStream(this.body);
    }

    @Override
    public URL getURL() throws IOException {
        if (this.isFileResource) {
            return this.file.toURI().toURL();
        }
        return this.url;
    }

    /**
     * 我的stream用的并不好,所以有空要梳理和观察一下当前的Stream是否会出现内存泄漏
     * 加锁防止多次写入
     * findBugs确实提示了这个问题,先不管吧。。
     */
    @Override
    public File getFile() throws IOException {
        if (isFileResource) {
            return this.file;
        }
        return this.getFile(Wx.Environment.instance().getDefaultMediaPath());
    }

    public synchronized File getFile(String path) throws IOException {
        if (this.file == null) {
            // 拿到临时文件路径
            String pathToUse = StringUtils.applyRelativePath(path, this.filename);
            this.file = new File(pathToUse);
            if (!this.file.exists()) {
                this.file.getParentFile().mkdirs();
                this.file.createNewFile();
            }
            FileCopyUtils.copy(this.getBody(), file);
        }
        return this.file;
    }

    /**
     * This implementation reads the entire InputStream to calculate the
     * content length. Subclasses will almost always be able to provide
     * a more optimal version of this, e.g. checking a File length.
     *
     * @see #getInputStream()
     */
    @Override
    public long contentLength() throws IOException {
        return this.contentLength;
    }

    @Override
    public Resource createRelative(String mediaId) throws IOException {
        if (isFileResource) {
            String pathToUse = StringUtils.applyRelativePath(StringUtils.cleanPath(file.getPath()), mediaId);
            return new WxMediaResource(new File(pathToUse));
        }
        return WxContextUtils.getBean(WxApiService.class).getTempMedia(mediaId);
    }

    /**
     * This implementation always returns {@code null},
     * assuming that this resource type does not have a filename.
     */
    @Override
    public String getFilename() {
        return this.filename;
    }

    /**
     * body只在
     *
     * @return the result
     */
    public byte[] getBody() {
        if (this.body == null && this.file != null) {
            try (InputStream is = new BufferedInputStream(new FileInputStream(file))) {
                this.body = StreamUtils.copyToByteArray(is);
            } catch (Exception e) {
                throw new WxAppException(e);
            }
        }
        return body;
    }

    public MediaType getContentType() {
        return contentType;
    }

    public HttpHeaders getHttpHeaders() {
        return httpHeaders;
    }

    public boolean isUrlMedia() {
        return isUrlMedia;
    }

    public String getMediaId() {
        return mediaId;
    }

    public void setURL(URI uri) {
        try {
            this.url = uri.toURL();
        } catch (MalformedURLException e) {
            // ignore it
        }
        this.mediaId = UriComponentsBuilder.fromUri(uri).build().getQueryParams().getFirst("media_id");
    }

}

redpajama_set_name: RedPajamaGithub


text:
/* CSS Document
*
*
*	descriptiooon!
*
*
* */

html, body {
  	margin: 0;
  	padding: 0;
	top: 0;
	left: 0;
	font-family: Myriad Pro, Arial, Helvetica, Tahoma, sans-serif;
	font-size: 11px;
	font-style: normal;
	text-align: justify;

	color: #9a734f !important;

	background-color: #0a181b !important;
	background-image: url("../../bundles/db/images/body_background2.jpg");
	background-attachment: fixed;
	background-position: top center;
	background-repeat: repeat-x;
}
h1 { color: #ffca28; }
h2 { color: #dc8a3a; text-align: right; }
h3 { color: #a26e3b; }
img { border: none;}
#layout {
	width: 980px;
	margin: auto;
}

.center { margin: auto; }

.header {
	z-index: 1;
	width: 980px;
	margin: auto;
	margin-top: -180px;
}

.header_top {
	height: 190px;
	width: 100%;
	background-image: url("../../bundles/db/images/navigation_bar_top.png");
	background-repeat: no-repeat;
}

.header_bottom {
	height: 75px;
	width: 100%;
	margin-bottom: -45px;
	background-image: url("../../bundles/db/images/navigation_bar_bottom.png");
	background-repeat: no-repeat;
	position: relative;
}

.main_navigation {
	height: 66px;
	width: 880px;
	margin: -19px auto;
	background-image: url("../../bundles/db/images/navigation_bar.png");
	background-repeat: no-repeat;
}
.main_menu {
	padding: 15px 45px;
	height: 36px;
	text-align: center;
	color: #9A734F !important;
	list-style: none;
}

.main_menu > li > a:LINK, .main_menu > li > a:ACTIVE, .main_menu > li > a:VISITED {
	width: 155px;
	float: left;
	text-decoration: none;
	color: #9A734F !important;
}
.main_menu > li > a:HOVER {
	width: 155px;
	float: left;
	color: #ffca28;
	text-decoration: none;
	background-color: transparent !important;
}
.main_menu > li > a:hover > .navigation_text2 {
	color: #FFCA28;
}
.navigation_text1 {
	width: 155px;
	float: left;
	font-size: 16px;
	color: #dc8a3a;
}
.navigation_text2 {
	width: 155px;
	float: left;
	font-size: 11px;
}
.logo {
	margin: auto;
	height: 300px;
	width: 600px;
	cursor: pointer;
	/*background-image: url("../../bundles/db/images/d3_logo.png");*/
	background-repeat: no-repeat;
	z-index: 2;
	font-family: 'New Rocker', cursive;
	text-align: center;
}
.logo h1 {
	padding-top: 110px;
	font-size: 42px;

	color: #9A734F !important;
}
.logo a {

	color: #9A734F !important;
}
.wrapper {
	width: 920px;
	margin-top: -45px;
	margin: auto;
	background-image: url("../../bundles/db/images/body_frame.png");
	background-repeat: repeat-y;
	background-position: center;
	background-color: #000000;
}
.wrapper_bottom {
	width: 920px;
	height: 43px;
	margin: auto;
	background-image: url("../../bundles/db/images/body_frame_bottom.png");
	background-repeat: no-repeat;
	background-color: #000000;
	border-radius: 8px;
	margin-bottom: 30px;
}

.wrapper_appendix_left {
	display: none;
	position: absolute;
	width: 270px;
	height: 535px;
	left: 30px;
	top: 400px;
	background-image: url("../../bundles/db/images/d3renders/barbarian.png");
	background-repeat: no-repeat;
}

.wrapper_appendix_right {
	display: none;
	position: fixed;
	width: 250px;
	height: 100%;
	left: 1260px;
	top: 0px;
	background-image: url("../../bundles/db/images/d3renders/wizard.png");
	background-repeat: no-repeat;

	background-attachment: scroll;
	background-position: center;
	z-index: 10;
}

.content {
	width: 870px;
	padding: 20px 10px;
	margin: auto;
}

.content_text {
	padding: 20 40px;
}

.content_subnav {
	float: left;
	width: 300px;
	background-image: url("../../bundles/db/images/navigation_bck5.png");
	margin-left: 15px;
	height: 490px;
}
div.leftMenu { padding-top: 45px; }
div.leftMenu h1 { text-align: center; }
div.leftMenu ul { list-style-image: none; list-style-type: none; padding: 20px 25px; }
div.leftMenu ul li a {
 	background: url("../../bundles/db/images/v.png") no-repeat scroll 0 0 transparent;
    color: #9A734F;
    display: block;
    font-size: 13px;
    height: 25px;
    line-height: 25px;
    margin: 5px 0;
    padding-left: 25px;
    text-decoration: none;
    width: 170px;
    font-weight: bold;
}
div.leftMenu ul li a:HOVER { background-position: 0 bottom; color: #DC8A3A; }
div.leftMenu ul li:HOVER { margin-left: 10px; }

/* remove below!! */
.right_panel_subnav_empty {
	width: 1px;
	height: 1px;
}
.right_panel_subnav_menu {
	margin-right: 20px;
	width: 200px;
	height: 100%;
	color: #DC8A3A;
	font-size: 19px;
	font-weight: bold;
}
.right_menu_elem {
	font-size: 12px;
	float: left;
	width: 200px;
	padding: 5px 0px;
	border-left: 3px #000000 solid;
}
.right_menu_elem:HOVER {
	font-size: 12px;
	float: left;
	width: 200px;
	padding: 5px 5px;
	background-color: #000000;
	border-left: 3px #DC8A3A solid;
}
.right_menu_link {
	text-decoration: none;
}
.right_panel_text {
	height: 100%;
	padding: 60px;
}

.clear {
	height: 1px;
	clear:both;
}

.panel {
	width: 100%;
	background-color: #222255;
	float: left;
}

.panel_adversite {
	width: 290px;
	height: 290px;
	background-image: url("../images/adversite.png");
	background-repeat: no-repeat;
	background-position: center;
	float: left;
	z-index: 2;
}

.panel_adversite_google {
	width: 728px;
	height: 90px;
	margin: auto;
}

.panel_box {
	width: 290px;
	height: 290px;
	float: left;
	z-index: 2;
}

.panel_box_image1 { background-image: url("../../bundles/db/images/as1.png"); background-repeat: no-repeat; background-position: center; }
.panel_box_image2 { background-image: url("../../bundles/db/images/as2.png"); background-repeat: no-repeat; background-position: center; }
.panel_box_image3 { background-image: url("../../bundles/db/images/as3.png"); background-repeat: no-repeat; background-position: center; }

.panel_box_text { width: 150px; position: absolute; left: 70px; bottom: 70px; cursor: pointer; }
h1 { color: #ffca28; }
h2 { color: #dc8a3a; text-align: right; }
h3 { color: #a26e3b; }
a.panel_navigation_element:LINK, a.panel_navigation_element:ACTIVE, a.panel_navigation_element:VISITED {
	width: 155px;
	float: left;
	font-weight: bold;
	text-decoration: none;
}
a.panel_navigation_element:HOVER {
	width: 155px;
	float: left;
	color: #ffca28;
	font-weight: bold;
	text-decoration: none;
}
.panel_navigation_text1 {
	width: 155px;
	float: left;
	font-size: 18px;
	color: #ffca28;
}
.panel_navigation_text2 {
	width: 155px;
	float: left;
	font-size: 13px;
}
.panel_frame {
	width: 290px;
	height: 290px;
	background-image: url("../../bundles/db/images/panel_frame.png");
	background-repeat: no-repeat;
	z-index: 1;
}
.button {
	background-image: url("../../bundles/db/images/short_button.png");
	background-position: center;
	background-repeat: no-repeat;
	float: right;
}

.button_link {
	padding: 5px 30px;
	height: 60px;
	margin:auto;
	line-height: 60px;
	font-weight: bold;
	font-size: small;
}

.footer {
    background-image: url("../../bundles/db/images/footer_bck.png");
    background-position: center;
    background-repeat: no-repeat;
    background-color: black;
    clear: both;
    margin: 50px auto 0 auto;
    font-size: 11px;
    height: 200px;
    width: 919px;
    border-radius: 8px;
}

/*
a:link, a:active, a:visited {
	color: inherit;
	text-decoration: none;
	font-weight: normal;
}

a:hover {
	color: inherit;
	text-decoration: underline;
	font-weight: normal;
}
*/
.lesserContent {
	float: left;
	margin-left: 45px;
	margin-top: 15px;
}
#recent {
	width: 500px;
	float: left;
}
.recentNews {
	float: right;
	font-style: italic;
	font-size: small;
	width: 435px;
	height: 35px;
	background-image: url("../../bundles/db/images/wide_button.png");
	background-position: center;
	background-repeat: no-repeat;
	color: #dc8a3a;
	padding: 4px;
	text-indent: 10px;
	line-height: 33px;
}

#last {
	width: 500px;
	min-height: 100px;
	float: left;
	margin-bottom: 10px;
}

.lastThumbnail {
	width: 128px;
	height: 128px;
	float: left;
}
.lastTitle {
	font-size: 17px;
	font-weight: bold;
	text-align: left;
	color: #FFCA28;
}
.lastContent {
	width: 350px;
	min-height: 64px;
	float: left;
	padding: 7px;
	font-size: 13px;
}

ul {
	list-style-image: url("../../bundles/db/images/point.png");
}


text:
$: << File.expand_path(File.dirname(__FILE__) + "/models")
require 'test/unit'
require 'rubygems'
gem 'activerecord', '>= 2.0.2'
require 'active_record'
require "#{File.dirname(__FILE__)}/../init"
require 'person'

ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")

class GateKeeperTest < Test::Unit::TestCase
  def setup
    setup_db

    #Change user class from default 'User'.
    GateKeeper.user_class_name = 'Person'

    #Bypass GateKeeper to setup initial stuff.
    GateKeeper.bypass do
      @admin = Person.create(:username => 'administrator')
      @arthur = Person.create(:username => 'arthur')
      @amy = Person.create(:username => 'amy')
      @arthurs_book = Notebook.create(:title => "Arthur's Book", :owner => arthur)
      @arthurs_book.pages.create(:number => 1)
      @arthurs_mug = CoffeeMug.create(:person => arthur)
      @amys_book = Notebook.create(:title => "Amys Book", :owner => amy)

    end
  end

  def teardown; teardown_db; end

  def admin; @admin; end
  def arthur; @arthur; end
  def amy; @amy; end
  def find_arthurs_book; Notebook.find(@arthurs_book.id); end
  def find_amys_book; Notebook.find(@amys_book.id); end
  def find_arthurs_book_with_eager_loading
    Notebook.find(:first,
      :conditions => ['notebooks.id = ?',@arthurs_book.id],
      :include => {:pages => [:margin_notes, :coffee_stains] }
    )
  end

  def test_user_permissions
    #### Login as Guest ###
    Person.current = nil
    assert_equal('guest',Person.current.username)
    assert(Person.current.new_record?)
    assert(Person.current.is_guest?)

    #Guest can't save herself
    assert_raise(GateKeeper::PermissionError) { Person.current.save }

    #### Login as Admin ####
    Person.current = admin

    #Admin can create new users.
    newbie = Person.create(:username => 'newbie')
    assert(newbie.id > 1)

    #Admin can destroy users
    assert(newbie.destroy)

    #### Login as Arthur ####
    Person.current = arthur

    #Arthur can not create new users
    assert_raise(GateKeeper::PermissionError) { Person.create(:username => 'nobody') }

    #Arthur can not destroy users
    assert_raise(GateKeeper::PermissionError) { amy.destroy }

    #Arthur can read himself
    assert_equal(arthur,Person.find(arthur.id))

    #Arthur can update himself
    assert_equal(nil,arthur.hair_color)
    arthur.update_attributes(:hair_color => 'red')
    arthur.reload
    assert_equal('red',arthur.hair_color)

    #Arthur can read amy
    assert_equal('amy',amy.username)

    #Arthur can not update amy
    assert_equal(nil,amy.hair_color)
    assert_raise(GateKeeper::PermissionError) { amy.update_attributes(:hair_color => 'green') }
    amy.reload
    assert_equal(nil,amy.hair_color)
  end

  def test_notebook_permissions
    #### Login as Admin ####
    Person.current = admin

    # Admin can create notebooks for other users.
    assert(Notebook.create(:title => 'A Notebook For Amy', :owner => amy))

    #### Login as Arthur ####
    Person.current = arthur

    # Arthur can read his own books
    assert_equal("Arthur's Book",find_arthurs_book.title)

    # Arthur can create notebooks for himself
    arthurs_new_book = Notebook.create(:title => 'My New Book')
    assert_equal(arthurs_new_book.owner,arthur)

    #Arthur can update his book
    assert(find_arthurs_book.update_attributes(:title => 'Bumbleweed'))

    #Arthur can not create notebooks for amy
    assert_raise(GateKeeper::PermissionError) { Notebook.create(:title => 'A Notebook For Amy', :owner => amy) }

    #Arthur can't find Amy's notebook
    assert_raise(GateKeeper::PermissionError) { find_amys_book }

    #Check other convenience methods. Should only find things with readable permissins
    assert_equal(nil,Notebook.find(:first, :conditions => ['title = ?',@amys_book.title]))
    assert_raise(GateKeeper::PermissionError) { Notebook.find(:all, :conditions => ['title = ?',@amys_book.title]) }
    assert_equal([],GateKeeper.with_permission_scoping { Notebook.find(:all, :conditions => ['title = ?',@amys_book.title])})
    assert_equal(nil,Notebook.find_by_title(@amys_book.title))
    assert_raise(GateKeeper::PermissionError) { Notebook.find_all_by_title(@amys_book.title) }
    assert_equal([],GateKeeper.with_permission_scoping { Notebook.find_all_by_title(@amys_book.title) })

    arthurs_book_clone1 = Notebook.find_or_create_by_title(find_arthurs_book.title)
    assert_equal(find_arthurs_book,arthurs_book_clone1)
    arthurs_book2 = Notebook.find_or_create_by_title(@amys_book.title)
    assert_not_equal(find_arthurs_book,arthurs_book2)
    assert_equal(arthur,arthurs_book2.owner)

    arthurs_book_clone2 = Notebook.find_or_initialize_by_title(find_arthurs_book.title)
    assert_equal(find_arthurs_book,arthurs_book_clone2)
    assert(!arthurs_book_clone2.new_record?)
    arthurs_book3 = Notebook.find_or_initialize_by_title(@amys_book.title)
    assert_not_equal(find_arthurs_book,arthurs_book3)
    assert(arthurs_book3.new_record?)

    #Arthur can destroy his own book.
    pre_book_count = arthur.notebooks.size
    assert(find_arthurs_book.destroy)
    assert_equal(pre_book_count-1,arthur.notebooks.size)

    #### Login as Admin ####
    Person.current = admin

    #Admin can destroy other people books
    pre_book_count = Notebook.count()
    assert(arthurs_book2.destroy)
    assert_equal(pre_book_count-1,Notebook.count())
  end

  def test_update_permissions
    #### Login as Arthur ####
    Person.current = arthur

    # Arthur can add Amy as an updater to his book
    find_arthurs_book.updaters << amy
    assert(find_arthurs_book.updaters.include?(amy))

    # Arthur can not see Amy's book
    assert_raise(GateKeeper::PermissionError) { find_amys_book }

    #### Login as Amy ####
    Person.current = amy

    #As a scribbler, Amy can read Arthur's book
    assert_equal("Arthur's Book",find_arthurs_book.title)

    #As an updater, Amy can update Arthur's book
    assert(find_arthurs_book.update_attributes(:title => "Amy's Stolen Book"))
    assert_equal("Amy's Stolen Book",find_arthurs_book.reload.title)

    #Amy can remove herself as an updater
    assert(find_arthurs_book.updaters.delete(amy))

    #Amy can find all books, scoped to just those she's allowed to read.
    scoped_books = GateKeeper.with_permission_scoping { Notebook.find(:all) }
    assert_equal(false,scoped_books.include?(@arthurs_book))
    assert_equal(true,scoped_books.include?(@amys_book))

    #No longer a scribbler, now Amy can not read Arthur's Book
    assert_raise(GateKeeper::PermissionError) { find_arthurs_book }

  end

  def test_page_permissions
    #### Login as Arthur ####
    Person.current = arthur

    #Arthur can read pages in his book
    assert_equal(1,find_arthurs_book.pages.first.number)

    #Arthur can add pages to his book
    assert(find_arthurs_book.pages.create(:number => 2))

    # Arthur adds Amy as a updater to his book
    find_arthurs_book.updaters << amy

    #### Login as Amy ####
    Person.current = amy
    #Amy can read pages in Arthur's Book
    assert_equal(1,find_arthurs_book.pages.first.number)

    #Arthur can NOT add pages to Arthur's book
    assert_raise(GateKeeper::PermissionError) { find_arthurs_book.pages.create(:number => 314159) }

    #Amy can update pages in Arthur's Book
    assert(find_arthurs_book.pages.first.update_attributes(:number => 42))
    assert_equal(42,find_arthurs_book.pages.first.number)

    #Amy can remove herself as a scribbler
    assert(find_arthurs_book.updaters.delete(amy))

    #No longer a scribbler, now Amy can not find pages in Arthur's Book
    page_id = GateKeeper.bypass { @arthurs_book.pages.first.id }
    assert_raise(GateKeeper::PermissionError) { Page.find(page_id) }
  end

  def test_chained_of_permissions_from_word
    #### Login as Arthur ####
    Person.current = arthur

    #Arthur can add words to pages to his book
    assert(find_arthurs_book.pages.first.words.create(:text => 'Hello'))

    #Arthur can read words on pages in his book.
    assert_equal('Hello',find_arthurs_book.pages.first.words.first.text)

    #Arthur can update words on pages in his book
    assert(find_arthurs_book.pages.first.words.first.update_attributes(:text => 'World'))
    assert_equal('World',find_arthurs_book.pages.first.words.first.text)

    #Arthur can destroy words on pages in his book
    pre_word_count = Word.count()
    assert(find_arthurs_book.pages.first.words.first.destroy)
    assert_equal(pre_word_count-1,Word.count())

    # Arthur adds Amy as a updater to his book
    find_arthurs_book.updaters << amy

    #### Login as Amy ####
    Person.current = amy

    #Amy can add words to pages to Arthur's book
    assert(find_arthurs_book.pages.first.words.create(:text => 'Hello'))

    #Amy can read words on pages in Arthur's book.
    assert_equal('Hello',find_arthurs_book.pages.first.words.first.text)

    #Amy can update words on pages in Arhtur's book
    assert(find_arthurs_book.pages.first.words.first.update_attributes(:text => 'World'))
    assert_equal('World',find_arthurs_book.pages.first.words.first.text)

    #Amy can destroy words on pages in Arthur's book
    pre_word_count = Word.count()
    assert(find_arthurs_book.pages.first.words.first.destroy)
    assert_equal(pre_word_count-1,Word.count())

    #Amy adds another word to a page in Arthur's book
    page = find_arthurs_book.pages.first
    extra = find_arthurs_book.pages.first.words.create(:text => 'Extra')
    extra.reload #reset associations and force reload of associations after Amy unscribbles herself

    #Amy removes herself as an updater
    assert(find_arthurs_book.updaters.delete(amy))

    #Amy can not CRUD words on Arhtur's Book
    assert_raise(GateKeeper::PermissionError) { page.words.create(:text => 'Denied') }
    assert_raise(GateKeeper::PermissionError) { Word.find(extra.id) }
    assert_raise(GateKeeper::PermissionError) { extra.update_attributes(:text => 'DeniedAgain') }
    assert_raise(GateKeeper::PermissionError) { extra.destroy }
  end

  def test_with_eager_loading
    #### Login as Arthur ####
    Person.current = arthur

    #Arthur can add words to pages to his book
    assert(find_arthurs_book.pages.first.words.create(:text => 'Hello'))

    #Arthur can add margin_notes to pages to his book
    assert(find_arthurs_book.pages.first.margin_notes.create(:content => 'Scratch'))

    # Arthur adds Amy as a updater to his book
    find_arthurs_book.updaters << amy

    #### Login as Amy ####
    Person.current = amy

    #Amy can read words on pages in Arthur's book.
    assert_equal('Hello',find_arthurs_book.pages.first.words.first.text)

    #Amy can NOT read Arthur's eagerly loaded margin notes.
    assert_equal([],
      GateKeeper.with_permission_scoping {
        find_arthurs_book_with_eager_loading.pages[0].margin_notes
      }
    )
    assert_raise(GateKeeper::PermissionError) {
      find_arthurs_book_with_eager_loading
    }

    #### Login as Arthur ####
    Person.current = arthur

    #Arthur's margin note hasn't been erroneously
    #deleted from the database by GateKeeper
    assert_equal('Scratch',find_arthurs_book.pages.first.margin_notes.first.content)

    #### Login as Admin ####
    Person.current = admin

    #Load all people with their coffee mugs
    people = Person.find(:all, :include => :coffee_mug)
    assert(people.include?(arthur))
    assert(people.include?(amy))
    assert_not_nil(arthur.reload.coffee_mug)
    assert_nil(amy.reload.coffee_mug)
  end

  def test_method_missing_superizer
    assert_raise(NoMethodError) { Person.non_existant_method }
  end
end

###############################
#### DB Setup and Teardown ####
###############################

def setup_db
  #Supress annoying Schema creation output when tests run
  old_stdout = $stdout
  $stdout = StringIO.new

  ActiveRecord::Schema.define(:version => 1) do
    create_table :people do |t|
      t.column :username, :string
      t.column :hair_color, :string
    end

    create_table :coffee_mugs do |t|
      t.column :person_id, :integer
    end

    create_table :roles do |t|
      t.column :name, :string
    end

    create_table :people_roles do |t|
      t.column :role_id, :integer
      t.column :person_id, :integer
    end

    create_table :notebooks do |t|
      t.column :title, :string
      t.column :owner_id, :integer
      t.column :ghost_writer_id, :integer
    end

    create_table :update_permissions do |t|
      t.column :updater_id, :integer
      t.column :notebook_id, :integer
    end

    create_table :pages do |t|
      t.column :number, :integer
      t.column :notebook_id, :integer
    end

    create_table :margin_notes do |t|
      t.column :content, :string
      t.column :page_id, :integer
    end

    create_table :coffee_stains do |t|
      t.column :opacity, :integer
      t.column :page_id, :integer
    end

    create_table :words do |t|
      t.column :text, :string
      t.column :page_id, :integer
    end
  end

  #Re-enable stdout
  $stdout = old_stdout
end

def teardown_db
  ActiveRecord::Base.connection.tables.each do |table|
    ActiveRecord::Base.connection.drop_table(table)
  end
end


text:
"""
Classes for the history API.

.. currentmodule:: asyncqlio.orm.schema.history
"""
import abc
from typing import Any, Callable, Tuple

from asyncqlio.orm.operators import OperatorResponse
from asyncqlio.orm.schema import column as md_column

class ColumnChange(abc.ABC):
    """
    Represents a column change. This object stores the old value of a column, and the new value
    of a column, and can produce the SQL to update it accordingly.

    For example, a simple change could be:
    .. code-block:: python3

        row = await session.select.from_(User).where(User.id == 1).first()
        row.username = "admin_2"

    A new ColumnChange object is then stored in the row, ready to be retrieved for the SQL
    generator to use.

    Another change could be on an array type:
    .. code-block:: python3

        row = await session.select.from_(User).where(User.id == 1).first()
        row.some_array[0] = 1

    The history of a column on a row can be established with it's ``__history__`` attribute,
    which is a :class:`.ColumnHistory` object relating to the current history of said column.

    """
    def __init__(self, column: 'md_column.Column'):
        """
        :param column: The :class:`.Column` this change is for.
        """
        self.column = column

    @property
    @abc.abstractmethod
    def current_value(self) -> Any:
        """
        :return: The current value for the column, i.e. after the change.
        """

    @abc.abstractmethod
    def handle_change(self, before: Any, after: Any) -> None:
        """
        Handles a change.

        :param before: The value of the column before the change.
        :param after: The value of the column after the change.
        """

    @abc.abstractmethod
    def handle_change_with_history(self, previous: 'ColumnChange', new: Any) -> None:
        """
        Handles a change with history.

        The previous history object is passed to this object, and after processing it will be
        deleted.

        :param previous: The previous :class:`.ColumnChange`.
        :param new: The new value being added.
        """

    @abc.abstractmethod
    def get_update_sql(self, emitter: Callable[[], Tuple[str, str]]) -> 'OperatorResponse':
        """
        :return: The UPDATE SQL (the part after the ``SET``) for this change.
        """

class ValueChange(ColumnChange):
    """
    Represents a basic value change on a column.
    """
    def __init__(self, column):
        super().__init__(column)

        #: The previous value of the column.
        self._previous = None

        #: The new value of the column.
        self._new = None

    @property
    def current_value(self):
        return self._new

    def handle_change(self, before: Any, after: Any):
        self._previous = before
        self._new = after

    def handle_change_with_history(self, previous: 'ColumnChange', new: Any):
        # we don't care about any intermediate changes
        self._previous = previous._previous
        self._new = new

    def get_update_sql(self, emitter: Callable[[], Tuple[str, str]]) -> 'OperatorResponse':
        emitted, name = emitter()
        sql = "{} = {}".format(self.column.quoted_name, emitted)
        return OperatorResponse(sql, {name: self._new})


text:
<title>arangodb索引的使用</title>
<meta name="description" content="个人小站 分享linux mysql  php 前端记录">
<meta name="keywords" content="avocadodb,phpnosql,freeidea,composer,ssdb,arangodb,orientdb,redis"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta charset="UTF-8">

     主页     日常     关于我     nosql     corecms     留言

    <x-markdown>

# arangodb-index  索引的使用

磁盘储存的索引

FulltextIndex, GeoIndex, VPackIndex, EdgeIndex, PrimaryIndex, Documents

可选属性

unique 不重复  当插入重复键值时

sparse  非空

deduplicate

**Primary Index** 创建**collection**时自动创建的**_key 的索引**

Edge Index  创建EdgeCollection时对 _from _to创建的索引

Hash Index 特定属性查找,无排序,对某单个属性值查找快速  查询条件 ==

Skiplist Index 排序/范围

Persistent Index  持久化索引 服务器重启后不需要重新载入内存重建索引 使用的是rocksdb储存索引

Geo Index  地理索引 用于索引二维坐标

Fulltext Index   全文索引  仅能索引单个键值

</x-markdown>

<link rel="stylesheet" href="/hight/styles/default.css">

<link rel="stylesheet" href="/css/default.css">


text:
require File.join(File.expand_path(File.dirname(__FILE__)), 'test_utils')
require 'tmpdir'

include TZInfo

class TCDataSource < Test::Unit::TestCase
  class InitDataSource < DataSource
  end

  class DummyDataSource < DataSource
  end

  def setup
    @orig_data_source = DataSource.get
    DataSource.set(InitDataSource.new)
    @orig_search_path = ZoneinfoDataSource.search_path.clone
  end

  def teardown
    DataSource.set(@orig_data_source)
    ZoneinfoDataSource.search_path = @orig_search_path
  end

  def test_get
    data_source = DataSource.get
    assert_kind_of(InitDataSource, data_source)
  end

  def test_get_default_ruby_only
    code = <<-EOF
      require 'tmpdir'

      begin
        Dir.mktmpdir('tzinfo_test_dir') do |dir|
          TZInfo::ZoneinfoDataSource.search_path = [dir]

          puts TZInfo::DataSource.get.class
        end
      rescue Exception => e
        puts "Unexpected exception: \#{e}"
      end
    EOF

    assert_sub_process_returns(['TZInfo::RubyDataSource'], code, [TZINFO_TEST_DATA_DIR])
  end

  def test_get_default_zoneinfo_only
    code = <<-EOF
      require 'tmpdir'

      begin
        Dir.mktmpdir('tzinfo_test_dir') do |dir|
          TZInfo::ZoneinfoDataSource.search_path = [dir, '#{TZINFO_TEST_ZONEINFO_DIR}']

          puts TZInfo::DataSource.get.class
          puts TZInfo::DataSource.get.zoneinfo_dir
        end
      rescue Exception => e
        puts "Unexpected exception: \#{e}"
      end
    EOF

    assert_sub_process_returns(
      ['TZInfo::ZoneinfoDataSource', TZINFO_TEST_ZONEINFO_DIR],
      code)
  end

  def test_get_default_ruby_and_zoneinfo
    code = <<-EOF
      begin
        TZInfo::ZoneinfoDataSource.search_path = ['#{TZINFO_TEST_ZONEINFO_DIR}']

        puts TZInfo::DataSource.get.class
      rescue Exception => e
        puts "Unexpected exception: \#{e}"
      end
    EOF

    assert_sub_process_returns(['TZInfo::RubyDataSource'], code, [TZINFO_TEST_DATA_DIR])
  end

  def test_get_default_no_data
    code = <<-EOF
      require 'tmpdir'

      begin
        Dir.mktmpdir('tzinfo_test_dir') do |dir|
          TZInfo::ZoneinfoDataSource.search_path = [dir]

          begin
            data_source = TZInfo::DataSource.get
            puts "No exception raised, returned \#{data_source} instead"
          rescue Exception => e
            puts e.class
          end
        end
      rescue Exception => e
        puts "Unexpected exception: \#{e}"
      end
    EOF

    assert_sub_process_returns(['TZInfo::DataSourceNotFound'], code)
  end

  def test_set_instance
    DataSource.set(DummyDataSource.new)
    data_source = DataSource.get
    assert_kind_of(DummyDataSource, data_source)
  end

  def test_set_standard_ruby
    DataSource.set(:ruby)
    data_source = DataSource.get
    assert_kind_of(RubyDataSource, data_source)
  end

  def test_set_standard_zoneinfo_search
    Dir.mktmpdir('tzinfo_test_dir') do |dir|
      FileUtils.touch(File.join(dir, 'iso3166.tab'))
      FileUtils.touch(File.join(dir, 'zone.tab'))

      ZoneinfoDataSource.search_path = [dir]

      DataSource.set(:zoneinfo)
      data_source = DataSource.get
      assert_kind_of(ZoneinfoDataSource, data_source)
      assert_equal(dir, data_source.zoneinfo_dir)
    end
  end

  def test_set_standard_zoneinfo_explicit
    Dir.mktmpdir('tzinfo_test_dir') do |dir|
      FileUtils.touch(File.join(dir, 'iso3166.tab'))
      FileUtils.touch(File.join(dir, 'zone.tab'))

      DataSource.set(:zoneinfo, dir)
      data_source = DataSource.get
      assert_kind_of(ZoneinfoDataSource, data_source)
      assert_equal(dir, data_source.zoneinfo_dir)
    end
  end

  def test_set_standard_zoneinfo_search_not_found
    Dir.mktmpdir('tzinfo_test_dir') do |dir|
      ZoneinfoDataSource.search_path = [dir]

      assert_raises(ZoneinfoDirectoryNotFound) do
        DataSource.set(:zoneinfo)
      end

      assert_kind_of(InitDataSource, DataSource.get)
    end
  end

  def test_set_standard_zoneinfo_explicit_invalid
    Dir.mktmpdir('tzinfo_test_dir') do |dir|
      assert_raises(InvalidZoneinfoDirectory) do
        DataSource.set(:zoneinfo, dir)
      end

      assert_kind_of(InitDataSource, DataSource.get)
    end
  end

  def test_set_standard_zoneinfo_wrong_arg_count
    assert_raises(ArgumentError) do
      DataSource.set(:zoneinfo, 1, 2)
    end

    assert_kind_of(InitDataSource, DataSource.get)
  end
end


text:
<?php

class Activity extends MY_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->model('Activity_model');
        $this->load->model('Uploads_model');
        $this->user_id = $this->session->userdata('id');
    }

    public function index()
    {
        $data['activities'] = $this->Activity_model->getActivities();
        if(isset($data['activities']) and !empty($data['activities'])) {
            foreach($this->data['activities'] as $activity)
            {
                $going[$activity['id']] = $this->Activity_model->getNumberAcceptEvent($activity['id']);
            }
        }
       $data['accepted_invitation'] = array(
           'all' => $going
       );
        $this->data['view']='activity/list';
        $this->load->view('account/layout',$data);
    }

    public function add()
    {
        $title = $this->input->post('title');
        $description = nl2br($this->input->post('description'));
        $address = $this->input->post('address');
        $start_date = $this->input->post('start_date');
        $end_date = $this->input->post('end_date');

        $start_date = str_replace('/', '-', $start_date);
        $start_date = date('Y-m-d',strtotime($start_date));

        $end_date = str_replace('/', '-', $end_date);
        $end_date = date('Y-m-d',strtotime($end_date));

        $this->form_validation->set_rules('title', 'Title', 'required');
        $this->form_validation->set_rules('address', 'Address', 'required');
        $this->form_validation->set_rules('start_date', 'Start Date', 'required');
        $this->form_validation->set_rules('end_date', 'End Date', 'required');

        if ($this->form_validation->run() == true) {
            $this->load->model('Uploads_model');
            $file = $this->Uploads_model->upload_file(true);
            $data = array(
                'title' => $title,
                'description' => $description,
                'address' => $address,
                'user_id' => $this->user_id,
                'cover' => $file,
                'date' => $start_date,
                'end_date' => $end_date
                );

            $this->Activity_model->addActivity($data);
            redirect('dashboard');
        }

        $this->data['view']='activity/add';
        $this->load->view('account/layout',$this->data);

    }

    public function answer_vote($question_id, $answer_id)
    {
        $this->Activity_model->vote_answer($question_id, $answer_id);
    }

    public function question($id)
    {
        $question = $this->input->post('question');
        $answers = $this->input->post('answer');

        $this->form_validation->set_rules('question','Question','required');

        if($this->form_validation->run() == true){
            $data = array(
                'text' => $question,
                'activity_id' => $id
                );
            $this->Activity_model->addQuestion($data);
            $question_id = $this->db->insert_id();

            $data = array();
            foreach($answers as $answer){
                $data[] = array(
                        'text' => $answer,
                        'question_id' => $question_id

                );
            }

            foreach($data as $data_answer){
                $this->Activity_model->addAnswer($data_answer);
            }

			redirect('activity/view/' . $id);
        }else{
            redirect('activity/view/' . $id);
        }

        $this->data['view']='activity/add_question_answer';
        $this->load->view('account/layout',$this->data);
    }

    public function ended()
    {
        $this->data['activities'] = $this->Activity_model->getEndedActivities();

        $goingEnded = array();
        if(is_array($this->data['activities']) and !empty($this->data['activities'])) {
            foreach ($this->data['activities'] as $activity) {
                $goingEnded[$activity['id']] = $this->Activity_model->getNumberAcceptEvent($activity['id']);
            }
        }
        $this->data['accepted_invitation'] = array(
            'ended' => $goingEnded,
        );

        $this->data['view']='activity/list_ended';
        $this->load->view('account/layout',$this->data);

    }

    public function upcoming()
    {
        $this->data['activities'] = $this->Activity_model->getUpcomingActivities();
        $goingUpcoming = array();
        if(is_array($this->data['activities']) and !empty($this->data['activities'])) {
            foreach ($this->data['activities'] as $activity) {
                $goingUpcoming[$activity['id']] = $this->Activity_model->getNumberAcceptEvent($activity['id']);
            }
        }
        $this->data['accepted_invitation'] = array(
            'upcoming' => $goingUpcoming,
        );
        $this->data['view']='activity/list_upcoming';
        $this->load->view('account/layout',$this->data);
    }

	public function view($eventId){
		if (!empty($eventId)) {
			$this->data['event_details'] = $this->Activity_model->getEventDetails($eventId);
			$this->data['gallery_photos'] = $this->Uploads_model->getPhotosById($eventId);
            $this->data['questions'] = $this->Activity_model->getQuestions($eventId);
            if(is_array($this->data['questions']) and !empty($this->data['questions'])){
                foreach($this->data['questions'] as $question){
                    $answers[$question['id']] = $this->Activity_model->getAnswers($question['id']);
                }
                $this->data['answers'] = $answers;
            }

			$this->data['view'] = 'activity/event_details';
			$this->load->view('account/layout', $this->data);
		}
	}

	public function invite_friend($id)
    {
		$this->data['activity'] = current($this->Activity_model->getActivity($id));
		$email_address = $this->input->post('friend_email');

		$hash = $this->Activity_model->create_event_invitation($id, $email_address);
		if ($hash) {
			$this->data['activity_owner'] = $this->session->userdata('username');
			$this->data['hash'] = $hash;
			$subject = 'You\'ve been invited to an event';
			$text = $this->load->view('messages/emails/invitation', $this->data, true);
			$this->send_mail($email_address, $subject, $text);
		}
		redirect('activity/view/' . $id);
	}

	public function accept_invite($hash, $ajax = false){
		$this->Activity_model->accept_invite($hash);
		if (! $ajax)
			redirect('dashboard');
	}
}


text:
package net.gbmb.xemph;

import java.util.HashMap;
import java.util.Map;

/**
 * The parent class for all values of a RDF property.
 */
public abstract class Value {

    private String xmlLang;

    private Map<Name,String> qualifiers = new HashMap<>();

    public void addQualifier (Name name, String qualifier) {
        qualifiers.put(name,qualifier);
    }

    public boolean hasQualifiers() {
        return qualifiers.size()>0;
    }

    public Map<Name,String> getQualifiers () {
        return qualifiers;
    }

    public String getQualifier(Name name) {
        return qualifiers.get(name);
    }

    public boolean containsQualifier(Name name) {
        return qualifiers.containsKey(name);
    }

    public String getXmlLang() {
        return xmlLang;
    }

    public void setXmlLang(String xmlLang) {
        this.xmlLang = xmlLang;
    }
}


text:
import {OrganizeFlightResource} from "../../../api/resources/organize-flight.resource";

export interface OrganizeFlightSlice {
  flight?: OrganizeFlightResource;
}


text:
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckfinder.com/license

 Defines the object for the Italian language.
-->
<messages>
	<errorUnknown>Impossibile completare la richiesta. (Errore %1)</errorUnknown>
	<errors>
		<error number="10">Comando non valido.</error>
		<error number="11">Il tipo di risorsa non è stato specificato nella richiesta.</error>
		<error number="12">Il tipo di risorsa richiesto non è valido.</error>
		<error number="102">Nome di file o cartella non valido.</error>
		<error number="103">Non è stato possibile completare la richiesta a causa di restrizioni di autorizzazione.</error>
		<error number="104">Non è stato possibile completare la richiesta a causa di restrizioni nei permessi del file system.</error>
		<error number="105">L'estensione del file non è valida.</error>
		<error number="109">Richiesta non valida.</error>
		<error number="110">Errore sconosciuto.</error>
		<error number="111">È stato impossibile completare la richiesta a causa della dimensione finale del file.</error>
		<error number="115">Un file o cartella con lo stesso nome è già esistente.</error>
		<error number="116">Cartella non trovata. Aggiornare e riprovare.</error>
		<error number="117">File non trovato. Aggiornare la lista dei file e riprovare.</error>
		<error number="118">I percorsi di origine e di destinazione sono uguali.</error>
		<error number="201">Un file con lo stesso nome è già presente. Il file caricato è stato rinominato in "%1".</error>
		<error number="202">File invalido.</error>
		<error number="203">File invalido. La dimensione del file eccede i limiti del sistema.</error>
		<error number="204">Il file caricato è corrotto.</error>
		<error number="205">Directory temporanea non disponibile sul server.</error>
		<error number="206">Caricamento annullato per motivi di sicurezza. Il file contiene dati in formato HTML.</error>
		<error number="207">Il file caricato è stato rinominato in "%1".</error>
		<error number="300">Non è stato possibile muovere i file.</error>
		<error number="301">Non è stato possibile copiare i file.</error>
		<error number="500">Questo programma è disabilitato per motivi di sicurezza. Contattare l'amministratore del sistema e verificare le configurazioni di CKFinder.</error>
		<error number="501">Il supporto alle anteprime non è attivo.</error>
	</errors>
</messages>


text:
package com.drivers.weixin.web;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

/**
 * Created by xhuji on 2016/9/4.
 */
@Controller
@Slf4j
public class Route {
    @RequestMapping(value = {"/","/index.html"},method = RequestMethod.GET)
    public String index(){
        log.debug("visit index page");
        return "/index";
    }

    @RequestMapping(value = "/about.html",method = RequestMethod.GET)
    public String about(){
        log.debug("visit about page");
        return "/about";
    }

    /**
     * suggestion
     * @return
     */
    @RequestMapping(value = "/suggestion.html",method = RequestMethod.GET)
    public String suggestion(){
        log.debug("visit suggestion page");
        return "/suggestion";
    }
    @RequestMapping(value = "/signup.html",method = RequestMethod.GET)
    public String signup(){
        log.debug("visit signup page");
        return "/signup";
    }
    @RequestMapping(value = "/pay/payment.html",method = RequestMethod.GET)
    public String payment(RedirectAttributes attr){
        log.debug("visit payment page");
        return "/signup/signup";
    }

    @RequestMapping(value = "/contact.html",method = RequestMethod.GET)
    public String contact(){
        log.debug("visit contact page");
        return "/contact";
    }

    @RequestMapping(value = "/addr.html",method = RequestMethod.GET)
    public String addr(){
        log.debug("visit addr page");
        return "/addr";
    }

    @RequestMapping(value = "/fee.html",method = RequestMethod.GET)
    public String fee(){
        log.debug("visit fee page");
        return "/fee";
    }
    @RequestMapping(value = "/document.html",method = RequestMethod.GET)
    public String document(){
        log.debug("visit fee page");
        return "/document";
    }
}


text:
from urlparse import urljoin
from crawly.crawler import Crawler
from crawly.url import URL

def test_live_site_without_exception(site):
    """Crawls a live site without raising an exception"""
    Crawler(URL(urljoin(site, '/index.html'))).crawl()


text:
package com.hazelcast.simulator.tests;

import com.hazelcast.simulator.test.TestContext;
import com.hazelcast.simulator.test.annotations.Prepare;
import com.hazelcast.simulator.test.annotations.Run;
import com.hazelcast.simulator.test.annotations.Setup;
import com.hazelcast.simulator.test.annotations.Teardown;
import com.hazelcast.simulator.test.annotations.Verify;

import static com.hazelcast.simulator.utils.CommonUtils.sleepSeconds;

public class SuccessTest {

    private TestContext context;

    @Setup
    public void setUp(TestContext context) {
        this.context = context;
    }

    @Teardown(global = false)
    public void localTearDown() {
    }

    @Teardown(global = true)
    public void globalTearDown() {
    }

    @Prepare(global = false)
    public void localPrepare() {
    }

    @Prepare(global = true)
    public void globalPrepare() {
    }

    @Verify(global = false)
    public void localVerify() {
    }

    @Verify(global = true)
    public void globalVerify() {
    }

    @Run
    public void run() {
        while (!context.isStopped()) {
            sleepSeconds(1);
            System.out.println("testSuccess running");
        }
        System.out.println("testSuccess completed");
    }
}


text:
define(["UpgradeCard", "upgradestats/DefaultFilters", "upgradestats/EntityFilter", "upgradestats/RangeFilter", "upgradestats/UpgradeData"],
   function(UpgradeCard, DefaultFilters, EntityFilter, RangeFilter, UpgradeData)
   {
      "use strict";

      function InitialState()
      {
         this.upgradeData = [];
         this.filteredUpgradeData = [];

         UpgradeCard.values().forEach(function(upgradeKey)
         {
            var upgrade = UpgradeCard.properties[upgradeKey];
            var upgradeData = UpgradeData.createUpgradeData(upgrade);
            this.upgradeData.push(upgradeData);
            this.filteredUpgradeData.push(upgradeData);
         }, this);

         // FIXME
         // localStorage.removeItem("filters");
         // FIXME

         this.isFilterShown = false;
         this.filters = DefaultFilters.create();
         var oldFilters = InitialState.loadFromLocalStorage();

         if (oldFilters)
         {
            this.merge(oldFilters);
         }
      }

      InitialState.prototype.merge = function(oldFilters)
      {
         InputValidator.validateNotNull("oldFilters", oldFilters);

         Object.getOwnPropertyNames(oldFilters).forEach(function(columnKey, i)
         {
            this.filters[columnKey] = oldFilters[columnKey];
         }, this);
      };

      InitialState.loadFromLocalStorage = function()
      {
         var answer;
         var filterObjects = JSON.parse(localStorage.filters || null);

         if (filterObjects)
         {
            answer = {};

            filterObjects.forEach(function(object, i)
            {
               var filter;

               switch (object.type)
               {
                  case "EntityFilter":
                     filter = EntityFilter.fromObject(object);
                     break;
                  case "RangeFilter":
                     filter = RangeFilter.fromObject(object);
                     break;
                  default:
                     throw "Unknown filter type: " + JSON.stringify(object);
               }

               answer[filter.columnKey()] = filter;
            });
         }

         return answer;
      };

      return InitialState;
   });


text:
package org.pac4j.core.profile;

import java.security.Principal;
import java.util.Objects;

import org.pac4j.core.util.CommonHelper;

/**
 *
 * Default implementation for {@link Principal} based on a pac4j
 * {@link BasicUserProfile}.
 *
 * It determines the name based on the profile's username, and fallbacks to id
 * if it doesn't exist.
 *
 * @author Victor Noel
 * @since 3.0.0
 */
public class Pac4JPrincipal implements Principal {

    private final String name;

    public Pac4JPrincipal(final UserProfile profile) {
        String username = profile.getUsername();
        if (CommonHelper.isNotBlank(username)) {
            this.name = username;
        } else {
            this.name = profile.getId();
        }
    }

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

    @Override
    public int hashCode() {
        return Objects.hashCode(getName());
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        final Pac4JPrincipal principal = (Pac4JPrincipal) o;
        return CommonHelper.areEquals(this.getName(), principal.getName());
    }

    @Override
    public String toString() {
        return CommonHelper.toNiceString(this.getClass(), "profileId", this.name);
    }
}


text:
'use strict';
var express = require('express');
var app = express();
var path = require('path');
var morgan = require('morgan');
var logger = require('express-logger');
var chalk = require('chalk');
var middleware = require('./middleware/middleware.js');
var MainController = require('./controllers/MainController.js');

// morgan used for logging when developing
// logging once per 24 h in prod
switch (app.get('env')) {
    case 'development':
        app.use(morgan('dev'));
        break;
    case 'production':
        app.use(logger({
            path: __dirname + '/log/requests.log'
        }));
        break;
}

app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.static(path.join(__dirname, 'public')));
app.set('port', process.env.PORT || 8080);
app.use(middleware.clusterlog);

var start = function () {
    app.listen(app.get('port'), function () {
        console.log(chalk.cyan('james-node '
        + chalk.white('port: '
        + app.get('port')
        + '. environment: '
        + app.get('env')
        + '.')
        ));
    });
};

// handles routing and control of routes
MainController.init(app);

// if run directly, start server
if (require.main === module) {
    start();
}
// else it's required(), export start
else {
    // logs which worker that's handling requests
    module.exports = start;
}


text:
from django.core.signals import Signal

process_finished = Signal(providing_args=['result_text', 'result_data', 'files', 'profile','logs'])
process_aborted = Signal(providing_args=['error_text','result_data','profile','logs'])


text:
class Question < ActiveRecord::Base

  belongs_to :hypothesis, :touch => true
  belongs_to :project

  # validates_presence_of :hypothesis

  include Sanitized

  acts_as_audited :associated_with => :project

  before_create do |model|
    model.project ||= model.hypothesis.project if model.hypothesis

    model.insert_at(1) unless model.position
    true
  end

  before_destroy do |model|
    model.remove_from_list(false)
    true
  end

  include ImportExport

  def export
    hash = super
    hash["relationships"] = {
      "hypothesis_id" => self.hypothesis_id,
      "project_id" => self.project_id
    }
    return hash
  end

  # def Question.import(hash, member, project)
  #   bp = super(hash)
  #   bp.member = member
  #   bp.project = project
  #   return bp
  # end

  def to_s
    return self.title
  end

  def to_hash
    Rails.cache.fetch(self.cache_key + "/hash") do
      {
        :type => self.class.name.underscore,
        :id => self.id,
        :title => self.title,
        :position => self.position,
        :hypothesis_id => self.hypothesis_id,
        :created_at => self.created_at
      }
    end
  end

  def remove_from_list(save_self = true)
    return unless self.position

    self.hypothesis.questions.where("position > ?", self.position).each{|x| x.update_attributes!(:position => x.position-1)}
    self.update_attributes!(:position => nil) if (save_self)
  end

  def insert_at(pos)
    self.hypothesis.questions.where("position >= ?", pos).each{|x| x.update_attributes!(:position => x.position+1)}
    self.position = pos
  end

end


text:
<?php
/**
 * 软件产品表
 */

use yii\db\Schema;
use yii\db\Migration;

class m150321_024902_create_software_table extends Migration{
    public function up(){
        $this->createTable('{{%software}}', [
            'id' => 'pk',
            'image' => Schema::TYPE_STRING . ' NOT NULL',
            'title' => Schema::TYPE_STRING . ' NOT NULL',
            'type_id' => Schema::TYPE_INTEGER . ' NOT NULL',        //类型id
            'price' => Schema::TYPE_STRING.' NOT NULL DEFAULT 0',   //价格
            'content' => Schema::TYPE_TEXT.' NOT NULL',             //描述
            'view' => Schema::TYPE_INTEGER.' NOT NULL DEFAULT 0',   //浏览次数
            'create_time' => Schema::TYPE_TIMESTAMP.' NOT NULL DEFAULT "0000-00-00 00:00:00"',
            'update_time' => Schema::TYPE_TIMESTAMP.' NOT NULL DEFAULT "0000-00-00 00:00:00"',
        ]);
    }

    public function down(){
        $this->dropTable('{{%software}}');
        return true;
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="hidingtitlebar.android.gauntface.com.hidingtitlebar" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

    <uses-permission android:name="android.permission.INTERNET" />

</manifest>


text:
package org.wso2.andes.unit.client.destinationurl;

import junit.framework.TestCase;

import org.wso2.andes.exchange.ExchangeDefaults;
import org.wso2.andes.url.AMQBindingURL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.URISyntaxException;

public class DestinationURLTest extends TestCase
{
    private static final Logger _logger = LoggerFactory.getLogger(DestinationURLTest.class);

    public void testFullURL() throws URISyntaxException
    {

        String url = "exchange.Class://exchangeName/Destination/Queue";

        AMQBindingURL dest = new AMQBindingURL(url);

        assertTrue(url.equals(dest.toString()));

        assertTrue(dest.getExchangeClass().equals("exchange.Class"));
        assertTrue(dest.getExchangeName().equals("exchangeName"));
        assertTrue(dest.getDestinationName().equals("Destination"));
        assertTrue(dest.getQueueName().equals("Queue"));
    }

    public void testQueue() throws URISyntaxException
    {

        String url = "exchangeClass://exchangeName//Queue";

        AMQBindingURL dest = new AMQBindingURL(url);

        assertTrue(url.equals(dest.toString()));

        assertTrue(dest.getExchangeClass().equals("exchangeClass"));
        assertTrue(dest.getExchangeName().equals("exchangeName"));
        assertTrue(dest.getDestinationName().equals(""));
        assertTrue(dest.getQueueName().equals("Queue"));
    }

    public void testQueueWithOption() throws URISyntaxException
    {

        String url = "exchangeClass://exchangeName//Queue?option='value'";

        AMQBindingURL dest = new AMQBindingURL(url);

        assertTrue(url.equals(dest.toString()));

        assertTrue(dest.getExchangeClass().equals("exchangeClass"));
        assertTrue(dest.getExchangeName().equals("exchangeName"));
        assertTrue(dest.getDestinationName().equals(""));
        assertTrue(dest.getQueueName().equals("Queue"));
        assertTrue(dest.getOption("option").equals("value"));
    }

    public void testDestination() throws URISyntaxException
    {

        String url = "exchangeClass://exchangeName/Destination/";

        AMQBindingURL dest = new AMQBindingURL(url);

        assertTrue(url.equals(dest.toString()));

        assertTrue(dest.getExchangeClass().equals("exchangeClass"));
        assertTrue(dest.getExchangeName().equals("exchangeName"));
        assertTrue(dest.getDestinationName().equals("Destination"));
        assertTrue(dest.getQueueName().equals(""));
    }

    public void testDestinationWithOption() throws URISyntaxException
    {

        String url = "exchangeClass://exchangeName/Destination/?option='value'";

        AMQBindingURL dest = new AMQBindingURL(url);

        assertTrue(url.equals(dest.toString()));

        assertTrue(dest.getExchangeClass().equals("exchangeClass"));
        assertTrue(dest.getExchangeName().equals("exchangeName"));
        assertTrue(dest.getDestinationName().equals("Destination"));
        assertTrue(dest.getQueueName().equals(""));

        assertTrue(dest.getOption("option").equals("value"));
    }

    public void testDestinationWithMultiOption() throws URISyntaxException
    {

        String url = "exchangeClass://exchangeName/Destination/?option='value',option2='value2'";

        AMQBindingURL dest = new AMQBindingURL(url);

        assertTrue(dest.getExchangeClass().equals("exchangeClass"));
        assertTrue(dest.getExchangeName().equals("exchangeName"));
        assertTrue(dest.getDestinationName().equals("Destination"));
        assertTrue(dest.getQueueName().equals(""));

        assertTrue(dest.getOption("option").equals("value"));
        assertTrue(dest.getOption("option2").equals("value2"));
    }

    public void testDestinationWithNoExchangeDefaultsToDirect() throws URISyntaxException
    {

        String url = "IBMPerfQueue1?durable='true'";

        AMQBindingURL dest = new AMQBindingURL(url);

        assertTrue(dest.getExchangeClass().equals(ExchangeDefaults.DIRECT_EXCHANGE_CLASS));
        assertTrue(dest.getExchangeName().equals(""));
        assertTrue(dest.getDestinationName().equals(""));
        assertTrue(dest.getQueueName().equals("IBMPerfQueue1"));

        assertTrue(dest.getOption("durable").equals("true"));
    }

    public void testDestinationWithMultiBindingKeys() throws URISyntaxException
    {

        String url = "exchangeClass://exchangeName/Destination/?bindingkey='key1',bindingkey='key2'";

        AMQBindingURL dest = new AMQBindingURL(url);

        assertTrue(dest.getExchangeClass().equals("exchangeClass"));
        assertTrue(dest.getExchangeName().equals("exchangeName"));
        assertTrue(dest.getDestinationName().equals("Destination"));
        assertTrue(dest.getQueueName().equals(""));

        assertTrue(dest.getBindingKeys().length == 2);
    }

    // You can only specify only a routing key or binding key, but not both.
    public void testDestinationIfOnlyRoutingKeyOrBindingKeyIsSpecified() throws URISyntaxException
    {

        String url = "exchangeClass://exchangeName/Destination/?bindingkey='key1',routingkey='key2'";
        boolean exceptionThrown = false;
        try
        {

            new AMQBindingURL(url);
        }
        catch(URISyntaxException e)
        {
            exceptionThrown = true;
            _logger.info("Exception thrown",e);
        }

        assertTrue("Failed to throw an URISyntaxException when both the bindingkey and routingkey is specified",exceptionThrown);
    }

    public void testDestinationWithDurableTopic() throws URISyntaxException
    {

        String url = "topic://amq.topic//testTopicD?durable='true'&autodelete='true'&clientid='test'&subscription='testQueueD'";

        AMQBindingURL dest = new AMQBindingURL(url);

        assertTrue(dest.getExchangeClass().equals("topic"));
        assertTrue(dest.getExchangeName().equals("amq.topic"));
        assertTrue(dest.getQueueName().equals("test:testQueueD"));
    }

    public static junit.framework.Test suite()
    {
        return new junit.framework.TestSuite(DestinationURLTest.class);
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Loganon: /home/taron/GSOC/loganon/lib/parser/loganon_queue.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">

Main Page

Data Structures

Files

/home/taron/GSOC/loganon/lib/parser/loganon_queue.h
Go to the documentation of this file.

00001 /*
00002  *      Data structures used by Loganon
00003  *      Authors: Guillaume TOURON
00004  */
00005
00006 #ifndef LOGANON_QUEUE_H
00007 #define LOGANON_QUEUE_H
00008
00009 #include <inttypes.h>
00010
00011 #include "loganon_errors.h"
00012 #include "loganon_structs.h"
00013
00018 extern
00019 int8_t insert_new_ip(const char* original, struct ip_anon **list);
00020
00027 extern
00028 uint32_t get_anonymized_ip(const char *originalIP, struct ip_anon *list);
00029
00034 extern
00035 void free_list_ips(struct ip_anon *list);
00036
00037 #endif

<address style="text-align: right;">Generated on Sun Aug 15 18:40:24 2010 for Loganon by

 1.5.3 </address>


text:
using System.Collections.Generic;

namespace Derivco.Orniscient.Proxy.Grains.Models
{
    public class GrainMethod
    {
        public string Name { get; set; }
        public List<GrainMethodParameters> Parameters { get; set; }
        public string InterfaceForMethod { get; set; }
        public string MethodId { get; set; }
    }
}


text:
import sys
import os
import string

"""read a file returning the lines in reverse order for each call of readline()
This actually just reads blocks (4096 bytes by default) of data from the end of
the file and returns last line in an internal buffer.  I believe all the corner
cases are handled, but never can be sure..."""

class BackwardsReader:
  def readline(self):
    while len(self.data) == 1 and ((self.blkcount * self.blksize) < self.size):
      self.blkcount = self.blkcount + 1
      line = self.data[0]
      try:
        self.f.seek(-self.blksize * self.blkcount, 2) # read from end of file
        self.data = string.split(self.f.read(self.blksize) + line, '\n')
      except IOError:  # can't seek before the beginning of the file
        self.f.seek(0)
        self.data = string.split(self.f.read(self.size - (self.blksize * (self.blkcount-1))) + line, '\n')

    if len(self.data) == 0:
      return ""

    # self.data.pop()
    # make it compatible with python <= 1.5.1
    line = self.data[-1]
    self.data = self.data[:-1]
    return line + '\n'

  def __init__(self, file, blksize=4096):
    """initialize the internal structures"""
    # get the file size
    self.size = os.stat(file)[6]
    # how big of a block to read from the file...
    self.blksize = blksize
    # how many blocks we've read
    self.blkcount = 1
    self.f = open(file, 'rb')
    # if the file is smaller than the blocksize, read a block,
    # otherwise, read the whole thing...
    if self.size > self.blksize:
      self.f.seek(-self.blksize * self.blkcount, 2) # read from end of file
    self.data = string.split(self.f.read(self.blksize), '\n')
    # strip the last item if it's empty...  a byproduct of the last line having
    # a newline at the end of it
    if not self.data[-1]:
      # self.data.pop()
      self.data = self.data[:-1]

if(__name__ == "__main__"):
  # do a thorough test...

  f = open('br.py', 'r')
  lines = []
  line = f.readline()
  while line:
    lines.append(line)
    line = f.readline()

  f.close()

  lines.reverse()

  for i in range(1, 5000):  # test different buffer sizes...
    foo = BackwardsReader('br.py', i)

    linesbr = []
    line = foo.readline()
    while line:
      linesbr.append(line)
      line = foo.readline()

    if linesbr != lines:
      print "\nNOT MATCHED  %5d" % (i)
    else:
      print "MATCHED %5d\r" % (i),
      sys.stdout.flush()


text:
import {Anno} from './resources/setup.js';

var object = {
  get foo() {
    class Foo {
      @Anno
      get b() {}
    }
    return Foo;
  }
};

assertArrayEquals([new Anno],
    Object.getOwnPropertyDescriptor(object.foo.prototype, 'b').get.annotations);


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>JGraber</title>

Media Controls

<video id="video" preload="auto" controls="" width="560" height="320">
  <source src="video.ogv" type="video/ogg">
  <source src="video.mp4" type="video/mp4">
  <source src="video.mov" type="video/quicktime">
  <p>Your browser does not support the video tag.</p>
</video>

	<video id="video" preload="auto" controls="" width="560" height="320">
		<source src="video.ogv" type="video/ogg">
		<source src="video.mp4" type="video/mp4">
        <source src="video.mov" type="video/quicktime">

Your browser does not support the video tag.

    </video>


text:
using System;
using System.Drawing;

namespace DrawIt
{
    public abstract class Shape
    {
        public Color Color;
        public Shape(Color color)
        {
            this.Color = color;
        }
        public abstract void Draw(int gridSize, Graphics g);

        public abstract bool ContainsPoint(int gridSize, Point p);

        public abstract void Translate(int x, int y);

        public abstract Container GetBounds();

        public abstract Shape DeepClone();
    }
}


text:
package org.sliderule.stats;

import java.util.*;

public abstract class AStatistics implements IStatistics {

	public static final int MIN_N_BEFORE_VALID_VARIANCE = 2;

	@Override
	final public double standardDeviation() {
		return Math.sqrt( variance() );
	}
	@Override
	public double[] orderedData() {
		synchronized( this ) {
			double[] data = data();
			Arrays.sort( data );
			return data;
		}
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public String toString() {
		String r = "";
		r += "size: " + size() + ", ";
		r += "mean: " + mean() + ", ";
//		r += "variance: " + variance() + ", ";
		r += "std: " + standardDeviation() + ", ";
		r += "lowest: " + lowest() + ", ";
		r += "highest: " + highest();
		return r;
	}
}


text:
ALTER TABLE builds ADD COLUMN build_signed   BOOLEAN;
ALTER TABLE builds ADD COLUMN build_verified BOOLEAN;

UPDATE builds SET build_signed   = false;
UPDATE builds SET build_verified = false;

-- +migrate Down

ALTER TABLE builds DROP COLUMN build_signed;
ALTER TABLE builds DROP COLUMN build_verified;


text:
Weclome menu upon loading a map or entering the game.
Choose a team.

]]--

surface.CreateFont( "stupidButton",
{
    font    = "Marlett",
    size    = 13,
    weight  = 600,
    antialias = true,
    blursize = 0.2,
	symbol = true,
    shadow = false
})

surface.CreateFont( "stupidButton2",
{
    font    = "Marlett",
    size    = 11,
    weight  = 600,
    antialias = true,
    blursize = 0.2,
	symbol = true,
    shadow = false
})

surface.CreateFont( "Close",
{
    font    = "CloseCaption_Bold",
    size    = 13,
    weight  = 700,
    antialias = true,
    blursize = 0.2,
    shadow = false
})

surface.CreateFont( "Button",
{
    font    = "Triomphe",
    size    = 16,
    weight  = 700,
    antialias = true,
    blursize = 0.3,
    shadow = false
})

surface.CreateFont( "WelcomeMSG",
{
    font    = "Triomphe",
    size    = 62,
    weight  = 400,
    antialias = true,
    blursize = 0.2,
    shadow = false
})

surface.CreateFont( "WelcomeMSGShadow",
{
    font    = "Triomphe",
    size    = 62,
    weight  = 400,
    antialias = true,
    blursize = 2,
    shadow = false
})

surface.CreateFont( "TeamMSG",
{
    font    = "Triomphe",
    size    = 32,
    weight  = 400,
    antialias = true,
    blursize = 0.2,
    shadow = false
})

surface.CreateFont( "TeamMSGShadow",
{
    font    = "Triomphe",
    size    = 32,
    weight  = 400,
    antialias = true,
    blursize = 1.5,
    shadow = false
})

local blur = Material("pp/blurscreen")

local function DrawBlur(panel, amount)
	local x, y = panel:LocalToScreen(0, 0)
	local scrW, scrH = ScrW(), ScrH()

	surface.SetDrawColor(255, 255, 255)
	surface.SetMaterial(blur)

	for i = 1, 3 do
		blur:SetFloat("$blur", (i / 3) * (amount or 6))
		blur:Recompute()

		render.UpdateScreenEffectTexture()
		surface.DrawTexturedRect(x * -1, y * -1, scrW, scrH)
	end
end

function welcomePlayer( ply )
	local PlayerName = LocalPlayer():Nick()
	local MapName = game.GetMap()
	local SpecPlayers = GetGlobalInt( "TDM_SpecTeamNum" )
	local RedPlayers = GetGlobalInt( "TDM_RedTeamNum" )
	local BluePlayers = GetGlobalInt( "TDM_BlueTeamNum" )

	--Force update of information
	timer.Create( "NumberCheckTimer", 1, 0, function()

		PlayerName = LocalPlayer():Nick()
		SpecPlayers = GetGlobalInt( "TDM_SpecTeamNum" )
		RedPlayers = GetGlobalInt( "TDM_RedTeamNum" )
		BluePlayers = GetGlobalInt( "TDM_BlueTeamNum" )

	end )

	local ChooseTeamFrame = vgui.Create( "DFrame" )
	ChooseTeamFrame:SetSize(ScrW(), ScrH()*0.3)
	ChooseTeamFrame:SetTitle("")
	ChooseTeamFrame:SetPos( 0, ScrH()/4)
	ChooseTeamFrame:SetVisible( true )
	ChooseTeamFrame:SetDraggable( false )
	ChooseTeamFrame:ShowCloseButton( false )
	ChooseTeamFrame:MakePopup()
	function ChooseTeamFrame:Paint( w, h, ply )
		DrawBlur( ChooseTeamFrame, 4 )
		draw.RoundedBox( 0, 0, 0 + h/(1.5), w, h*(1/3), Color(250,250,250,25))
		draw.RoundedBox( 0, 0, 0, w, h/(1.5), Color(40,40,40,205))
		draw.DrawText( "Welcome, " .. PlayerName .. ".", "WelcomeMSGShadow",  0 + w/2 + 1, 0 + (h/1.5)/3 - 31 + 1, Color(0, 0, 0, 225), TEXT_ALIGN_CENTER )
		draw.DrawText( "Welcome, " .. PlayerName .. ".", "WelcomeMSG",  0 + w/2, 0 + (h/1.5)/3 - 31, Color(255, 255, 255, 235), TEXT_ALIGN_CENTER )
		draw.DrawText( "Please select a team.", "TeamMSGShadow", 0 + w/2 + 1, 0 + (h/1.5)/3 + (h/1.5)/3 - 16 + 1, Color(0, 0, 0, 225), TEXT_ALIGN_CENTER )
		draw.DrawText( "Please select a team.", "TeamMSG", 0 + w/2, 0 + (h/1.5)/3 + (h/1.5)/3 - 16, Color(255, 255, 255, 235), TEXT_ALIGN_CENTER )
	end

	local tabHover = false
	local HelpButton = vgui.Create('DButton')
	HelpButton:SetParent(ChooseTeamFrame)
	HelpButton:SetSize(45, 22)
	HelpButton:SetPos( ScrW()-90, 0 )
	HelpButton:SetFont("Close")
	HelpButton:SetText("")
	HelpButton:SetTextColor( Color(255,255,255,255) )
	function HelpButton:OnCursorEntered()
		tabHover = true
	end
	function HelpButton:OnCursorExited()
		tabHover = false
	end
	function HelpButton:Paint(w, h)
		if tabHover then
			draw.RoundedBox( 0, 0, 0, w, h, Color(80,80,80,210))
		else
			draw.RoundedBox( 0, 0, 0, w, h, Color(120,120,120,210))
		end
		draw.SimpleText( "s", "stupidButton2", w/2, h/2, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
	end
	function HelpButton:DoClick()
		--ChooseTeamFrame:Close()
	end

	local tabHover = false
	local CloseButton = vgui.Create('DButton')
	CloseButton:SetParent(ChooseTeamFrame)
	CloseButton:SetSize(45, 22)
	CloseButton:SetPos( ScrW()-45, 0 )
	CloseButton:SetFont("Close")
	CloseButton:SetText("")
	CloseButton:SetTextColor( Color(255,255,255,255) )
	function CloseButton:OnCursorEntered()
		tabHover = true
	end
	function CloseButton:OnCursorExited()
		tabHover = false
	end
	function CloseButton:Paint(w, h)
		if tabHover then
			draw.RoundedBox( 0, 0, 0, w, h, Color(240,30,30,210))
		else
			draw.RoundedBox( 0, 0, 0, w, h, Color(250,120,120,210))
		end
		draw.SimpleText( "r", "stupidButton", w/2, h/2, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
	end
	function CloseButton:DoClick()
		ChooseTeamFrame:Close()
		timer.Stop( "NumberCheckTimer" )
	end

	local tabHover = false
	local SpectatorButton = vgui.Create('DButton')
	SpectatorButton:SetParent(ChooseTeamFrame)
	SpectatorButton:SetSize(ScrW()/10, ScrH()/20)
	SpectatorButton:SetPos(ScrW()/2 - (ScrW()/10)/2, 0 + (ScrH()/4)/1.5 + ScrH()/20 + (ScrH()/20)/6)
	SpectatorButton:SetText("")
	SpectatorButton:SetTextColor( Color(255,255,255,255) )
	SpectatorButton:SetFont("Button")
	SpectatorButton:SetDrawBackground(true)
	function SpectatorButton:OnCursorEntered()
		tabHover = true
	end
	function SpectatorButton:OnCursorExited()
		tabHover = false
	end
	function SpectatorButton:Paint(w, h)
		if tabHover then
			draw.RoundedBox( 2, 0, 0, w, h, Color(220,220,220,255))
			draw.RoundedBox( 2, 1, 1, w-2, h-2, Color(75,75,75,255))
		else
			draw.RoundedBox( 2, 0, 0, w, h, Color(65,65,65,0))
			draw.RoundedBox( 2, 1, 1, w-2, h-2, Color(65,65,65,255))
		end
		draw.SimpleText( "SPECTATE ("..SpecPlayers..")", "Button", w/2, h/2 - 1, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
	end
	function SpectatorButton:DoClick()
		ChooseTeamFrame:Close()
		timer.Stop( "NumberCheckTimer" )
	end

	local tabHover = false
	local RedButton = vgui.Create('DButton')
	RedButton:SetParent(ChooseTeamFrame)
	RedButton:SetSize(ScrW()/10, ScrH()/20)
	RedButton:SetPos(ScrW()/3 - (ScrW()/10)/2, 0 + (ScrH()/4)/1.5 + ScrH()/20 + (ScrH()/20)/6 )
	RedButton:SetText("")
	RedButton:SetTextColor( Color(255,255,255,255) )
	RedButton:SetFont("Button")
	RedButton:SetDrawBackground(true)
	function RedButton:OnCursorEntered()
		tabHover = true
	end
	function RedButton:OnCursorExited()
		tabHover = false
	end
	function RedButton:Paint(w, h)
		if tabHover then
			draw.RoundedBox( 2, 0, 0, w, h, Color(220,220,220,255))
			draw.RoundedBox( 2, 1, 1, w-2, h-2, Color(180,40,40,250))
		else
			draw.RoundedBox( 2, 0, 0, w, h, Color(40,40,40,0))
			draw.RoundedBox( 2, 1, 1, w-2, h-2, Color(180,30,30,250))
		end
		draw.SimpleText( "TEAM RED ("..RedPlayers..")", "Button", w/2, h/2 - 1, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
	end
	function RedButton:DoClick()
		if ply:Team() == TEAM_RED then
		ply:ChatPrint( "You are already on the Red Team." )
		else
			if RedPlayers > BluePlayers then
				ply:ChatPrint( "There are too many players on the Red Team." )
			else
				RunConsoleCommand( "stTeamT" )
				ChooseTeamFrame:Close()
				timer.Stop( "NumberCheckTimer" )
			end
		end
	end

	local tabHover = false
	local BlueButton = vgui.Create('DButton')
	BlueButton:SetParent(ChooseTeamFrame)
	BlueButton:SetSize(ScrW()/10, ScrH()/20)
	BlueButton:SetPos(ScrW()/2 + ScrW()/6 - (ScrW()/10)/2, 0 + (ScrH()/4)/1.5 + ScrH()/20 + (ScrH()/20)/6)
	BlueButton:SetText("")
	BlueButton:SetTextColor( Color(255,255,255,255) )
	BlueButton:SetFont("Button")
	BlueButton:SetDrawBackground(true)
	function BlueButton:OnCursorEntered()
		tabHover = true
	end
	function BlueButton:OnCursorExited()
		tabHover = false
	end
	function BlueButton:Paint(w, h)
		if tabHover then
			draw.RoundedBox( 2, 0, 0, w, h, Color(220,220,220,255))
			draw.RoundedBox( 2, 1, 1, w-2, h-2, Color(40,40,180,250))
		else
			draw.RoundedBox( 2, 0, 0, w, h, Color(40,40,40,0))
			draw.RoundedBox( 2, 1, 1, w-2, h-2, Color(30,30,180,250))
		end
		draw.SimpleText( "TEAM BLUE ("..BluePlayers..")", "Button", w/2, h/2 - 1, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
	end
	function BlueButton:DoClick()
		if ply:Team() == TEAM_BLUE then
		ply:ChatPrint( "You are already on Team Blue." )
		else
			if BluePlayers > RedPlayers then
				ply:ChatPrint( "There are too many players on the Blue Team." )
			else
				RunConsoleCommand( "stTeamCT" )
				ChooseTeamFrame:Close()
				timer.Stop( "NumberCheckTimer" )
			end
		end
	end
end
concommand.Add("welcomePlayer", welcomePlayer)


text:
This iOS sample project demos how to call TF Serving from an iOS app, via REST
and gRPC. You can input a value and it will send the input to TF Serving and
return a precited regression value.

## Usage

1. Go into 'ML' folder and open the Jupyter notebook (make sure you have
   TensorFlow installed).
2. Train model and export SavedModel inside the notebook.
3. Start docker:
`docker run -t --rm -p 8501:8501 -p 8500:8500 -v "/PATH/TO/SAVEDMODEL:/models/regression" -e MODEL_NAME=regression tensorflow/serving`.
4. Install Swift code generator plugin by running 'brew install swift-protobuf grpc-swift'
5. Go into 'iOS/regression/proto' folder and run './generate_grpc_stub_swift.sh' to
   generate gRPC client stub code.
6. Run 'pod install'. Open 'regression.xcworkspace/' with XCode. Drag the
   generated Swift code in generated/import folder into Xcode.
7. Run the app.


text:
namespace GSchemaPaths {
    const QString Unity         = "/org/compiz/profiles/unity/plugins/unityshell/";
    const QString UnityLauncher = "/com/canonical/unity/launcher/";
    const QString OpenGL        = "/org/compiz/profiles/unity/plugins/opengl/";
    const QString Core          = "/org/compiz/profiles/unity/plugins/core/";
}

namespace GSchemas {
    namespace Unity {
        const QString Shell     = "org.compiz.unityshell";
        const QString Launcher  = "com.canonical.Unity.Launcher";
        const QString Lens      = "com.canonical.Unity.Lenses";
        const QString AppLens   = "com.canonical.Unity.ApplicationsLens";
        const QString FileLens  = "com.canonical.Unity.FilesLens";
        const QString DateTime  = "com.canonical.indicator.datetime";
        const QString Sound     = "com.canonical.indicator.sound";
        const QString Session   = "com.canonical.indicator.session";
    }
    namespace Window {
        const QString OpenGL      = "org.compiz.opengl";
        const QString Core        = "org.compiz.core";
        const QString Preferences = "org.gnome.desktop.wm.preferences";
    }
    namespace Appearance {
        const QString Desktop       = "org.gnome.nautilus.desktop";
        const QString Background    = "org.gnome.desktop.background";
        const QString Screensaver   = "org.gnome.desktop.screensaver";
        const QString Applications  = "org.gnome.desktop.a11y.applications";
    }
}

namespace GSchemaKeys {
    namespace Unity {
        const QString LauncherHideMode      = "launcher-hide-mode";
        const QString RevealTrigger         = "reveal-trigger";
        const QString EdgeResponsiveness    = "edge-responsiveness";
        const QString LauncherMinimizeApp   = "launcher-minimize-window";
        const QString LauncherOpacity       = "launcher-opacity";
        const QString LauncherVisibility    = "num-launchers";
        const QString LauncherPosition      = "launcher-position";
        const QString LauncherIconSize      = "icon-size";
        const QString DashBlur              = "dash-blur-experimental";
        const QString SearchOnlineResource  = "remote-content-search";
        const QString DisplayAvailableApps  = "display-available-apps";
        const QString DisplayRecentApps     = "display-recent-apps";
        const QString EnableSearchFile      = "use-locate";
        const QString PanelOpacity          = "panel-opacity";
        const QString ShowDateTime          = "show-clock";
        const QString TimeFormat            = "time-format";
        const QString ShowSeconds           = "show-seconds";
        const QString ShowDate              = "show-date";
        const QString ShowDay               = "show-day";
        const QString ShowCalendar          = "show-calendar";
        const QString ShowVolume            = "visible";
        const QString ShowMyName            = "show-real-name-on-panel";
    }

    namespace Window {
        const QString TextureQuality     = "texture-filter";
        const QString HorizontalWorkSize = "hsize";
        const QString VerticalWorkSize   = "vsize";
        const QString RaiseOnClick       = "raise-on-click";
        const QString FocusMode          = "focus-mode";
        const QString ActionDoubleClick  = "action-double-click-titlebar";
        const QString ActionMiddleClick  = "action-middle-click-titlebar";
        const QString ActionRightClick   = "action-right-click-titlebar";
    }

    namespace Appearance {
        const QString ShowDesktopIcons  = "show-desktop-icons";
        const QString ShowHomeIcon      = "home-icon-visible";
        const QString ShowNetworkIcon   = "network-icon-visible";
        const QString ShowTrashIcon     = "trash-icon-visible";
        const QString ShowVolumesIcon   = "volumes-visible";
        const QString PictureOptions    = "picture-options";
        const QString ScreenKeyboard    = "screen-keyboard-enabled";
        const QString ScreenReader      = "screen-reader-enabled";
    }
}

namespace GValues {
    enum RevealLocation {
        Left,
        TopLeft
    };

    enum LauncherVisibility {
        AllDesktop,
        PrimaryDesktop
    };
}

#endif // GNOMESCHEMA_H


text:
package org.buildmlearn.appstore.models;

import java.util.ArrayList;

/**
 * Template model for Quiz type of apps. It has a model for questions.
 */
public class Question {
    private String mQuestion;
    private ArrayList<String> mAnswerOption;
    private int mOptionNumber;

    public String getQuestion() {
        return mQuestion;
    }

    public void setQuestion(String mQuestion) {
        this.mQuestion = mQuestion;
    }

    public ArrayList<String> getAnswerOption() {
        return mAnswerOption;
    }

    public void setAnswerOption(ArrayList<String> mAnswerOption) {
        this.mAnswerOption = mAnswerOption;
    }

    public int getOptionNumber() {
        return mOptionNumber;
    }

    public void setOptionNumber(int mOptionNumber) {
        this.mOptionNumber = mOptionNumber;
    }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>JsUtils (GWT Javadoc)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Deprecated

Help

GWT 2.8.0-rc1

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.google.gwt.typedarrays.client

Class JsUtils

java.lang.Object

com.google.gwt.typedarrays.client.JsUtils

public class JsUtils
extends java.lang.Object

JS-specific utility methods, for use in client-side code that has the values in
 JS objects already.

Method Summary

All Methods Static Methods Concrete Methods

Modifier and Type
Method and Description

static ArrayBuffer
arrayBufferFromString(java.lang.String str)

Creates an ArrayBuffer from a string, with bytes encoded as
 individual characters (which means in UTF8-encoded strings, byte
 values 0x80-0xFF take two bytes.

static Float32ArrayNative
createFloat32Array(JsArrayNumber array)

static Float64ArrayNative
createFloat64Array(JsArrayNumber array)

static Int16ArrayNative
createInt16Array(JsArrayInteger array)

static Int32ArrayNative
createInt32Array(JsArrayInteger array)

static Int8ArrayNative
createInt8Array(JsArrayInteger array)

static Uint16ArrayNative
createUint16Array(JsArrayInteger array)

static Uint32ArrayNative
createUint32Array(JsArrayNumber array)

static Uint8ArrayNative
createUint8Array(JsArrayInteger array)

static Uint8ClampedArray
createUint8ClampedArray(JsArrayInteger array)

static void
set(Float32Array dest,
   JsArrayNumber array)

static void
set(Float32Array dest,
   JsArrayNumber array,
   int offset)

static void
set(Float64Array dest,
   JsArrayNumber array)

static void
set(Float64Array dest,
   JsArrayNumber array,
   int offset)

static void
set(Int16Array dest,
   JsArrayInteger array)

static void
set(Int16Array dest,
   JsArrayInteger array,
   int offset)

static void
set(Int32Array dest,
   JsArrayInteger array)

static void
set(Int32Array dest,
   JsArrayInteger array,
   int offset)

static void
set(Int8Array dest,
   JsArrayInteger array)

static void
set(Int8Array dest,
   JsArrayInteger array,
   int offset)

static void
set(Uint16Array dest,
   JsArrayInteger array)

static void
set(Uint16Array dest,
   JsArrayInteger array,
   int offset)

static void
set(Uint32Array dest,
   JsArrayNumber array)

static void
set(Uint32Array dest,
   JsArrayNumber array,
   int offset)

static void
set(Uint8Array dest,
   JsArrayInteger array)

static void
set(Uint8Array dest,
   JsArrayInteger array,
   int offset)

static void
set(Uint8ClampedArray dest,
   JsArrayInteger array)

static void
set(Uint8ClampedArray dest,
   JsArrayInteger array,
   int offset)

static java.lang.String
stringFromArrayBuffer(ArrayBuffer buf)

Creates a string from an ArrayBuffer, with bytes encoded as
 individual characters (which means in UTF8-encoded strings, byte
 values 0x80-0xFF take two bytes.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

arrayBufferFromString

public static ArrayBuffer arrayBufferFromString(java.lang.String str)

Creates an ArrayBuffer from a string, with bytes encoded as
 individual characters (which means in UTF8-encoded strings, byte
 values 0x80-0xFF take two bytes.

Parameters:

str -

Returns:

an ArrayBuffer containing the bytes decoded from the
     string

createFloat32Array

public static Float32ArrayNative createFloat32Array(JsArrayNumber array)

createFloat64Array

public static Float64ArrayNative createFloat64Array(JsArrayNumber array)

createInt16Array

public static Int16ArrayNative createInt16Array(JsArrayInteger array)

createInt32Array

public static Int32ArrayNative createInt32Array(JsArrayInteger array)

createInt8Array

public static Int8ArrayNative createInt8Array(JsArrayInteger array)

createUint16Array

public static Uint16ArrayNative createUint16Array(JsArrayInteger array)

createUint32Array

public static Uint32ArrayNative createUint32Array(JsArrayNumber array)

createUint8Array

public static Uint8ArrayNative createUint8Array(JsArrayInteger array)

createUint8ClampedArray

public static Uint8ClampedArray createUint8ClampedArray(JsArrayInteger array)

set

public static void set(Float32Array dest,
                       JsArrayNumber array)

set

public static void set(Float32Array dest,
                       JsArrayNumber array,
                       int offset)

set

public static void set(Float64Array dest,
                       JsArrayNumber array)

set

public static void set(Float64Array dest,
                       JsArrayNumber array,
                       int offset)

set

public static void set(Int16Array dest,
                       JsArrayInteger array)

set

public static void set(Int16Array dest,
                       JsArrayInteger array,
                       int offset)

set

public static void set(Int32Array dest,
                       JsArrayInteger array)

set

public static void set(Int32Array dest,
                       JsArrayInteger array,
                       int offset)

set

public static void set(Int8Array dest,
                       JsArrayInteger array)

set

public static void set(Int8Array dest,
                       JsArrayInteger array,
                       int offset)

set

public static void set(Uint16Array dest,
                       JsArrayInteger array)

set

public static void set(Uint16Array dest,
                       JsArrayInteger array,
                       int offset)

set

public static void set(Uint32Array dest,
                       JsArrayNumber array)

set

public static void set(Uint32Array dest,
                       JsArrayNumber array,
                       int offset)

set

public static void set(Uint8Array dest,
                       JsArrayInteger array)

set

public static void set(Uint8Array dest,
                       JsArrayInteger array,
                       int offset)

set

public static void set(Uint8ClampedArray dest,
                       JsArrayInteger array)

set

public static void set(Uint8ClampedArray dest,
                       JsArrayInteger array,
                       int offset)

stringFromArrayBuffer

public static java.lang.String stringFromArrayBuffer(ArrayBuffer buf)

Creates a string from an ArrayBuffer, with bytes encoded as
 individual characters (which means in UTF8-encoded strings, byte
 values 0x80-0xFF take two bytes.

Parameters:

buf -

Returns:

a string encoding the bytes in the ArrayBuffer

Skip navigation links

Overview

Package

Class

Use

Deprecated

Help

GWT 2.8.0-rc1

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method