text:
/**
 * author: Shawn
 * time  : 2017/8/30 13:52
 * desc  :
 * update: Shawn 2017/8/30 13:52
 */

let BaseDao = require('./BaseDao');
let Book = require('./Book');

class BookDao extends BaseDao {
    constructor() {
        super(Book);
    }
}

function test() {
    let bookDao = new BookDao();
    let bookEntity = new Book({title: 'ssssss', author: '哈哈哈', bill: 1});
    // bookDao.create({title: '基督山伯爵', author: '大仲马'}).then((result) => console.log('create dao-->', result));
    bookDao.save(bookEntity).then((result) => console.log('save dao --> ', result));
    // bookDao.update({title: '老人与海'}, {$set: {author: 'hamawa'}}).then((result) => console.log('update dao--> ', result));
    // bookDao.findOne({title: '三国'}).then((results) => console.log('findOne dao --> ', results));
    // bookDao.findAll({title: '三国'}).then((results) => console.log('findOne dao --> ', results));
    // bookDao.remove({title: '老人与海'}).then((results) => console.log('remove dal --> ', results));
}

test();

module.exports = BookDao;


text:
class CreateProductMaintenanceConversionFactors < ActiveRecord::Migration
  def change
    create_table :product_maintenance_conversion_factors do |t|
      t.decimal :factor
      t.string :abbreviation
      t.string :desc
      t.references :unit_of_measure

      t.timestamps
    end

    add_index(:product_maintenance_conversion_factors, :unit_of_measure_id,
              :name => 'index_conversion_factors_on_unit_of_measure_id')
  end
end

redpajama_set_name: RedPajamaGithub


text:
import rethinkdb as r
try:
    from settings import RDB_HOST, RDB_PORT, RDB_DATABASE
except:
    RDB_HOST = "localhost"
    RDB_PORT = 28015
    RDB_DATABASE = "vagascrawler"
table_name = "vagas"

r.connect(RDB_HOST, RDB_PORT).repl()
# Cria o banco de dados
r.db_create(RDB_DATABASE).run()
# Cria a tabela
r.db(RDB_DATABASE).table_create(table_name).run()
r.db(RDB_DATABASE).table(table_name).index_create("body").run()
r.db(RDB_DATABASE).table(table_name).index_create("datetime").run()
r.db(RDB_DATABASE).table(table_name).index_create("cidade").run()
r.db(RDB_DATABASE).table(table_name).index_create("categoria").run()
r.db(RDB_DATABASE).table(table_name).index_create("titulo").run()


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

<meta name="collection" content="api">

<TITLE>
CompoundEdit (Java 2 Platform SE 5.0)
</TITLE>

<META NAME="keywords" CONTENT="javax.swing.undo.CompoundEdit class">
<META NAME="keywords" CONTENT="edits">
<META NAME="keywords" CONTENT="undo()">
<META NAME="keywords" CONTENT="redo()">
<META NAME="keywords" CONTENT="lastEdit()">
<META NAME="keywords" CONTENT="die()">
<META NAME="keywords" CONTENT="addEdit()">
<META NAME="keywords" CONTENT="end()">
<META NAME="keywords" CONTENT="canUndo()">
<META NAME="keywords" CONTENT="canRedo()">
<META NAME="keywords" CONTENT="isInProgress()">
<META NAME="keywords" CONTENT="isSignificant()">
<META NAME="keywords" CONTENT="getPresentationName()">
<META NAME="keywords" CONTENT="getUndoPresentationName()">
<META NAME="keywords" CONTENT="getRedoPresentationName()">
<META NAME="keywords" CONTENT="toString()">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

JavaTM 2 Platform
Standard Ed. 5.0

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

javax.swing.undo

Class CompoundEdit

java.lang.Object
  javax.swing.undo.AbstractUndoableEdit
      javax.swing.undo.CompoundEdit

All Implemented Interfaces:
Serializable, UndoableEdit

Direct Known Subclasses:
AbstractDocument.DefaultDocumentEvent, UndoManager

public class CompoundEdit
extends AbstractUndoableEdit

A concrete subclass of AbstractUndoableEdit, used to assemble little
 UndoableEdits into great big ones.

Field Summary

protected  Vector<UndoableEdit>
edits

          The collection of UndoableEdits
 undone/redone en masse by this CompoundEdit.

Fields inherited from class javax.swing.undo.AbstractUndoableEdit

RedoName, UndoName

Constructor Summary

CompoundEdit()

Method Summary

 boolean
addEdit(UndoableEdit anEdit)

          If this edit is inProgress,
 accepts anEdit and returns true.

 boolean
canRedo()

          Returns false if isInProgress or if super
 returns false.

 boolean
canUndo()

          Returns false if isInProgress or if super
 returns false.

 void
die()

          Sends die to each subedit,
 in the reverse of the order that they were added.

 void
end()

          Sets inProgress to false.

 String
getPresentationName()

          Returns getPresentationName from the
 last UndoableEdit added to
 edits.

 String
getRedoPresentationName()

          Returns getRedoPresentationName
 from the last UndoableEdit
 added to edits.

 String
getUndoPresentationName()

          Returns getUndoPresentationName
 from the last UndoableEdit
 added to edits.

 boolean
isInProgress()

          Returns true if this edit is in progress--that is, it has not
 received end.

 boolean
isSignificant()

          Returns true if any of the UndoableEdits
 in edits do.

protected  UndoableEdit
lastEdit()

          Returns the last UndoableEdit in
 edits, or null
 if edits is empty.

 void
redo()

          Sends redo to all contained
 UndoableEdits in the order in
 which they were added.

 String
toString()

          Returns a string that displays and identifies this
 object's properties.

 void
undo()

          Sends undo to all contained
 UndoableEdits in the reverse of
 the order in which they were added.

Methods inherited from class javax.swing.undo.AbstractUndoableEdit

replaceEdit

Methods inherited from class java.lang.Object

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

Field Detail

edits

protected Vector<UndoableEdit> edits

The collection of UndoableEdits
 undone/redone en masse by this CompoundEdit.

Constructor Detail

CompoundEdit

public CompoundEdit()

Method Detail

undo

public void undo()
          throws CannotUndoException

Sends undo to all contained
 UndoableEdits in the reverse of
 the order in which they were added.

Specified by:
undo in interface UndoableEdit
Overrides:
undo in class AbstractUndoableEdit

Throws:

CannotUndoException - if canUndo
    returns false
See Also:
AbstractUndoableEdit.canUndo()

redo

public void redo()
          throws CannotRedoException

Sends redo to all contained
 UndoableEdits in the order in
 which they were added.

Specified by:
redo in interface UndoableEdit
Overrides:
redo in class AbstractUndoableEdit

Throws:

CannotRedoException - if canRedo
     returns false
See Also:
AbstractUndoableEdit.canRedo()

lastEdit

protected UndoableEdit lastEdit()

Returns the last UndoableEdit in
 edits, or null
 if edits is empty.

die

public void die()

Sends die to each subedit,
 in the reverse of the order that they were added.

Specified by:
die in interface UndoableEdit
Overrides:
die in class AbstractUndoableEdit

See Also:
die()

addEdit

public boolean addEdit(UndoableEdit anEdit)

If this edit is inProgress,
 accepts anEdit and returns true.

The last edit added to this CompoundEdit
 is given a chance to addEdit(anEdit).
 If it refuses (returns false), anEdit is
 given a chance to replaceEdit the last edit.
 If anEdit returns false here,
 it is added to edits.

Specified by:
addEdit in interface UndoableEdit
Overrides:
addEdit in class AbstractUndoableEdit

Parameters:
anEdit - the edit to be added

Returns:
true if the edit is inProgress;
        otherwise returns false
See Also:
UndoableEdit.addEdit(javax.swing.undo.UndoableEdit)

end

public void end()

Sets inProgress to false.

See Also:
canUndo(),
canRedo()

canUndo

public boolean canUndo()

Returns false if isInProgress or if super
 returns false.

Specified by:
canUndo in interface UndoableEdit
Overrides:
canUndo in class AbstractUndoableEdit

Returns:
true if this edit is alive
    and hasBeenDone is true
See Also:
isInProgress()

canRedo

public boolean canRedo()

Returns false if isInProgress or if super
 returns false.

Specified by:
canRedo in interface UndoableEdit
Overrides:
canRedo in class AbstractUndoableEdit

Returns:
true if this edit is alive
   and hasBeenDone is false
See Also:
isInProgress()

isInProgress

public boolean isInProgress()

Returns true if this edit is in progress--that is, it has not
 received end. This generally means that edits are still being
 added to it.

See Also:
end()

isSignificant

public boolean isSignificant()

Returns true if any of the UndoableEdits
 in edits do.
 Returns false if they all return false.

Specified by:
isSignificant in interface UndoableEdit
Overrides:
isSignificant in class AbstractUndoableEdit

Returns:
true
See Also:
UndoableEdit.isSignificant()

getPresentationName

public String getPresentationName()

Returns getPresentationName from the
 last UndoableEdit added to
 edits. If edits is empty,
 calls super.

Specified by:
getPresentationName in interface UndoableEdit
Overrides:
getPresentationName in class AbstractUndoableEdit

Returns:
the empty string ""
See Also:
AbstractUndoableEdit.getUndoPresentationName(),
AbstractUndoableEdit.getRedoPresentationName()

getUndoPresentationName

public String getUndoPresentationName()

Returns getUndoPresentationName
 from the last UndoableEdit
 added to edits.
 If edits is empty, calls super.

Specified by:
getUndoPresentationName in interface UndoableEdit
Overrides:
getUndoPresentationName in class AbstractUndoableEdit

Returns:
the value from the defaults table with key
    AbstractUndoableEdit.undoText, followed
    by a space, followed by getPresentationName
    unless getPresentationName is "" in which
    case, the defaults value is returned alone.
See Also:
AbstractUndoableEdit.getPresentationName()

getRedoPresentationName

public String getRedoPresentationName()

Returns getRedoPresentationName
 from the last UndoableEdit
 added to edits.
 If edits is empty, calls super.

Specified by:
getRedoPresentationName in interface UndoableEdit
Overrides:
getRedoPresentationName in class AbstractUndoableEdit

Returns:
the value from the defaults table with key
    AbstractUndoableEdit.redoText, followed
    by a space, followed by getPresentationName
    unless getPresentationName is "" in which
    case, the defaults value is returned alone.
See Also:
AbstractUndoableEdit.getPresentationName()

toString

public String toString()

Returns a string that displays and identifies this
 object's properties.

Overrides:
toString in class AbstractUndoableEdit

Returns:
a String representation of this object

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

JavaTM 2 Platform
Standard Ed. 5.0

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.


text:
<?php

class SimpleImage {

   var $image;
   var $image_type;

   function load($filename) {
      $image_info = getimagesize($filename);
      $this->image_type = $image_info[2];
      if( $this->image_type == IMAGETYPE_JPEG ) {
         $this->image = imagecreatefromjpeg($filename);
      } elseif( $this->image_type == IMAGETYPE_GIF ) {
         $this->image = imagecreatefromgif($filename);
      } elseif( $this->image_type == IMAGETYPE_PNG ) {
         $this->image = imagecreatefrompng($filename);
		imagealphablending($this->image, true);
		imagesavealpha($this->image, true);
      }
   }
   function save($filename, $image_type=IMAGETYPE_JPEG, $compression=100, $permissions=null) {
      if( $image_type == IMAGETYPE_JPEG ) {
         imagejpeg($this->image,$filename,$compression);
      } elseif( $image_type == IMAGETYPE_GIF ) {
         imagegif($this->image,$filename);
      } elseif( $image_type == IMAGETYPE_PNG ) {
         imagepng($this->image,$filename);
      }
      if( $permissions != null) {
         chmod($filename,$permissions);
      }
   }
   function output($image_type=IMAGETYPE_JPEG) {
      if( $image_type == IMAGETYPE_JPEG ) {
         imagejpeg($this->image);
      } elseif( $image_type == IMAGETYPE_GIF ) {
         imagegif($this->image);
      } elseif( $image_type == IMAGETYPE_PNG ) {
         imagepng($this->image);
      }
   }
   function getCanvasWidth(){
   	if (isset($this->canvasWidth))return $this->canvasWidth();
   	else return $this->getWidth();
   }
   function getCanvasHeight(){
   	if (isset($this->canvasHeight))return $this->canvasHeight();
   	else return $this->getHeight();
   }
   function getWidth() {
      return imagesx($this->image);
   }
   function getHeight() {
      return imagesy($this->image);
   }
   function resizeToHeight($height) {
      $ratio = $height / $this->getHeight();
      $width = $this->getWidth() * $ratio;
      $this->resize($width,$height);
   }
   function resizeToWidth($width) {
      $ratio = $width / $this->getWidth();
      $height = $this->getheight() * $ratio;
      $this->resize($width,$height);
   }
   function resizeToMaxHeight($height) {
    	 if ($height>$this->getHeight())return;
      $ratio = $height / $this->getHeight();
      $width = $this->getWidth() * $ratio;
      $this->resize($width,$height);
   }
   function resizeToMaxWidth($width) {
   	 if ($width>$this->getWidth())return;
      $ratio = $width / $this->getWidth();
      $height = $this->getheight() * $ratio;
      $this->resize($width,$height);
   }
   function setCanvas($width,$height,$bgcolor=array(255,255,255)){
      $new_image = imagecreatetruecolor($width, $height);
	 $color = imagecolorallocate($new_image, $bgcolor[0], $bgcolor[1], $bgcolor[2]);
	 imagefilledrectangle($new_image, 0, 0, $width, $height, $color);

      $offset_x = ($width-$this->getWidth())/2;
      $offset_y = ($height-$this->getHeight())/2;
      imagecopyresampled($new_image, $this->image, $offset_x, $offset_y, 0, 0, $this->getWidth(), $this->getHeight(), $this->getWidth(), $this->getHeight());
      $this->image = $new_image;
   }
   function scale($scale) {
      $width = $this->getWidth() * $scale/100;
      $height = $this->getheight() * $scale/100;
      $this->resize($width,$height);
   }
   function resize($width,$height) {
      $new_image = imagecreatetruecolor($width, $height);
      imagesavealpha($new_image, true);
      $trans_colour = imagecolorallocatealpha($new_image, 0, 0, 0, 127);
	 imagefill($new_image, 0, 0, $trans_colour);
      imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());
      $this->image = $new_image;
   }

   	function zoomToMinimum($min_width,$min_height){
   		if ($this->getWidth()<$min_width){
   			$min_height = ($this->getWidth()*$this->getHeight())/$min_width;
   			$this->resize($min_width,$min_height);
   		}

   		if ($this->getHeight()<$min_height){
   			$min_width = ($this->getHeight()*$this->getWidth())/$min_height;
   			$this->resize($min_width,$min_height);
   		}

   	}

	function createImage($width,$height){
		$new_image = imagecreatetruecolor($width, $height);
		imagesavealpha($new_image, true);

		imagealphablending($new_image, false);
		$trans_colour = imagecolorallocatealpha($new_image, 255, 255, 255, 127);
		imagefill($new_image, 0, 0, $trans_colour);

		imagealphablending($new_image, true);
	     $this->image = $new_image;
	}
	function paint($image,$x=0,$y=0){
     	imagecopyresampled($this->image, $image, $x, $y, 0, 0, imagesx($image), imagesy($image), imagesx($image), imagesy($image));
	}
}


text:
django-push-notifications
=========================

.. image:: https://api.travis-ci.org/jleclanche/django-push-notifications.png
	:target: https://travis-ci.org/jleclanche/django-push-notifications

A minimal Django app that implements Device models that can send messages through APNS and GCM.

The app implements two models: GCMDevice and APNSDevice. Those models share the same attributes:
 - name (optional): A name for the device.
 - is_active (default True): A boolean that determines whether the device will be sent notifications.
 - user (optional): A foreign key to auth.User, if you wish to link the device to a specific user.
 - device_id (optional): A UUID for the device obtained from Android/iOS APIs, if you wish to uniquely identify it.
 - registration_id (required): The GCM registration id or the APNS token for the device.

The app also implements an admin panel, through which you can test single and bulk notifications. Select one or more
GCM or APNS devices and in the action dropdown, select "Send test message" or "Send test message in bulk", accordingly.
Note that sending a non-bulk test message to more than one device will just iterate over the devices and send multiple
single messages.

Dependencies
------------
All versions of Django 1.0 and newer should be supported, however no guarantees are made for versions older than 1.4.

Tastypie support should work on Tastypie 0.9.11 and newer.

Django versions older than 1.5 require 'six' to be installed.
Django versions older than 1.7 require 'south' to be installed.
Django versions older than 1.8 require 'django-uuidfield' to be installed.

Setup
-----
You can install the library directly from pypi using pip::

	$ pip install django-push-notifications

Edit your settings.py file::

	INSTALLED_APPS = (
		...
		"push_notifications"
	)

	PUSH_NOTIFICATIONS_SETTINGS = {
		"GCM_API_KEY": "<your api key>",
		"APNS_CERTIFICATE": "/path/to/your/certificate.pem",
	}

Note: If you are planning on running your project with `DEBUG=True`, then make sure you have set the
*development* certificate as your `APNS_CERTIFICATE`. Otherwise the app will not be able to connect to the correct host.

You can learn more about APNS certificates here: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ProvisioningDevelopment.html

Native Django migrations are supported on Django 1.7 and beyond. The app will automatically
fall back to South on older versions, however you will also need the following setting::

	SOUTH_MIGRATION_MODULES = {"push_notifications": "push_notifications.south_migrations"}

Settings list
-------------
All settings are contained in a PUSH_NOTIFICATIONS_SETTINGS dict.

In order to use GCM, you are required to include GCM_API_KEY.
For APNS, you are required to include APNS_CERTIFICATE.

- APNS_CERTIFICATE: Absolute path to your APNS certificate file. Certificates with passphrases are not supported.
- GCM_API_KEY: Your API key for GCM.
- APNS_HOST: The hostname used for the APNS sockets. When DEBUG=True, this defaults to gateway.sandbox.push.apple.com. When DEBUG=False, this defaults to gateway.push.apple.com.
- APNS_PORT: The port used along with APNS_HOST. Defaults to 2195.
- GCM_POST_URL: The full url that GCM notifications will be POSTed to. Defaults to https://android.googleapis.com/gcm/send.
- GCM_MAX_RECIPIENTS: The maximum amount of recipients that can be contained per bulk message. If the registration_ids list is larger than that number, multiple bulk messages will be sent. Defaults to 1000 (the maximum amount supported by GCM).

Sending messages
----------------
GCM and APNS services have slightly different semantics. The app tries to offer a common interface for both when using the models.

::

	from push_notifications.models import APNSDevice, GCMDevice

	device = GCMDevice.objects.get(registration_id=gcm_reg_id)
	# The first argument will be sent as "message" to the intent extras Bundle
	# Retrieve it with intent.getExtras().getString("message")
	device.send_message("You've got mail")
	# If you want to customize, send an extra dict and a None message.
	# the extras dict will be mapped into the intent extras Bundle.
	# For dicts where all values are keys this will be sent as url parameters,
	# but for more complex nested collections the extras dict will be sent via
	# the bulk message api.
	device.send_message(None, extra={"foo": "bar"})

	device = APNSDevice.objects.get(registration_id=apns_token)
	device.send_message("You've got mail") # Alert message may only be sent as text.
	device.send_message(None, badge=5) # No alerts but with badge.
	device.send_message(None, badge=1, extra={"foo": "bar"}) # Silent message with badge and added custom data.

Note that APNS does not support sending payloads that exceed 2048 bytes (increased from 256 in 2014).
The message is only one part of the payload, if
once constructed the payload exceeds the maximum size, an APNSDataOverflow exception will be raised before anything is sent.

Sending messages in bulk
------------------------
::

	from push_notifications.models import APNSDevice, GCMDevice

	devices = GCMDevice.objects.filter(user__first_name="James")
	devices.send_message("Happy name day!")

Sending messages in bulk makes use of the bulk mechanics offered by GCM and APNS. It is almost always preferable to send
bulk notifications instead of single ones.

Administration
--------------
APNS devices which are not receiving push notifications can be set to inactive by two methods.  The web admin interface for
APNS devices has a "prune devices" option.  Any selected devices which are not receiving notifications will be set to inactive(*).
There is also a management command to prune all devices failing to receive notifications::

	python manage.py prune_devices

This removes all devices which are not receiving notifications.

For more information, please refer to the APNS feedback service_.

.. _service: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html

(*)Any devices which are not selected, but are not receiving notifications will not be deactivated on a subsequent call to "prune devices" unless another
attempt to send a message to the device fails after the call to the feedback service.

Exceptions
----------

- NotificationError(Exception): Base exception for all notification-related errors.
- gcm.GCMError(NotificationError): An error was returned by GCM. This is never raised when using bulk notifications.
- apns.APNSError(NotificationError): Something went wrong upon sending APNS notifications.
- apns.APNSDataOverflow(APNSError): The APNS payload exceeds its maximum size and cannot be sent.

Tastypie support
----------------

The app includes tastypie-compatible resources in push_notifications.api. These can be used as-is, or as base classes
for more involved APIs.
The following resources are available:

- APNSDeviceResource
- GCMDeviceResource
- APNSDeviceAuthenticatedResource
- GCMDeviceAuthenticatedResource

The base device resources will not ask for authentication, while the authenticated ones will link the logged in user to
the device they register.
Subclassing the authenticated resources in order to add a SameUserAuthentication and a user ForeignKey is recommended.

When registered, the APIs will show up at <api_root>/device/apns and <api_root>/device/gcm, respectively.

Python 3 support
----------------

django-push-notifications is compatible with Python 3. Django 1.8 or higher is recommended.


text:
package com.bytesgo.nfs.rpc.grizzly.client;

/**
 * nfs-rpc Apache License
 *
 * http://code.google.com/p/nfs-rpc (c) 2011
 */
import java.net.InetSocketAddress;
import java.util.List;
import java.util.Map;

import com.bytesgo.nfs.rpc.core.client.AbstractClientInvocationHandler;
import com.bytesgo.nfs.rpc.core.client.ClientFactory;

/**
 * Grizzly Client Invocation Handler for RPC
 *
 * @author bluedavy
 */
public class GrizzlyClientInvocationHandler extends AbstractClientInvocationHandler {

  public GrizzlyClientInvocationHandler(List<InetSocketAddress> servers, int clientNums, int connectTimeout, String targetInstanceName,
      Map<String, Integer> methodTimeouts, int codecType, int protocolType) {
    super(servers, clientNums, connectTimeout, targetInstanceName, methodTimeouts, codecType, protocolType);
  }

  public ClientFactory getClientFactory() {
    return GrizzlyClientFactory.getInstance();
  }

}


text:
package org.colorcoding.ibas.importexport.transformer.template;

public class WriteFileException extends Exception {

	private static final long serialVersionUID = -3567030339264693945L;

	public WriteFileException() {
		super();
	}

	public WriteFileException(String arg0, Throwable arg1, boolean arg2, boolean arg3) {
		super(arg0, arg1, arg2, arg3);
	}

	public WriteFileException(String arg0, Throwable arg1) {
		super(arg0, arg1);
	}

	public WriteFileException(String arg0) {
		super(arg0);
	}

	public WriteFileException(Throwable arg0) {
		super(arg0);
	}

}


text:
#include "hdmi.h"

struct hdmi_bridge {
	struct drm_bridge base;

	struct hdmi *hdmi;
	bool power_on;

	unsigned long int pixclock;
};
#define to_hdmi_bridge(x) container_of(x, struct hdmi_bridge, base)

static void hdmi_bridge_destroy(struct drm_bridge *bridge)
{
	struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
	hdmi_unreference(hdmi_bridge->hdmi);
	drm_bridge_cleanup(bridge);
	kfree(hdmi_bridge);
}

static void power_on(struct drm_bridge *bridge)
{
	struct drm_device *dev = bridge->dev;
	struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
	struct hdmi *hdmi = hdmi_bridge->hdmi;
	const struct hdmi_platform_config *config = hdmi->config;
	int i, ret;

	for (i = 0; i < config->pwr_reg_cnt; i++) {
		ret = regulator_enable(hdmi->pwr_regs[i]);
		if (ret) {
			dev_err(dev->dev, "failed to enable pwr regulator: %s (%d)\n",
					config->pwr_reg_names[i], ret);
		}
	}

	if (config->pwr_clk_cnt > 0) {
		DBG("pixclock: %lu", hdmi_bridge->pixclock);
		ret = clk_set_rate(hdmi->pwr_clks[0], hdmi_bridge->pixclock);
		if (ret) {
			dev_err(dev->dev, "failed to set pixel clk: %s (%d)\n",
					config->pwr_clk_names[0], ret);
		}
	}

	for (i = 0; i < config->pwr_clk_cnt; i++) {
		ret = clk_prepare_enable(hdmi->pwr_clks[i]);
		if (ret) {
			dev_err(dev->dev, "failed to enable pwr clk: %s (%d)\n",
					config->pwr_clk_names[i], ret);
		}
	}
}

static void power_off(struct drm_bridge *bridge)
{
	struct drm_device *dev = bridge->dev;
	struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
	struct hdmi *hdmi = hdmi_bridge->hdmi;
	const struct hdmi_platform_config *config = hdmi->config;
	int i, ret;

	/* TODO do we need to wait for final vblank somewhere before
	 * cutting the clocks?
	 */
	mdelay(16 + 4);

	for (i = 0; i < config->pwr_clk_cnt; i++)
		clk_disable_unprepare(hdmi->pwr_clks[i]);

	for (i = 0; i < config->pwr_reg_cnt; i++) {
		ret = regulator_disable(hdmi->pwr_regs[i]);
		if (ret) {
			dev_err(dev->dev, "failed to disable pwr regulator: %s (%d)\n",
					config->pwr_reg_names[i], ret);
		}
	}
}

static void hdmi_bridge_pre_enable(struct drm_bridge *bridge)
{
	struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
	struct hdmi *hdmi = hdmi_bridge->hdmi;
	struct hdmi_phy *phy = hdmi->phy;

	DBG("power up");

	if (!hdmi_bridge->power_on) {
		power_on(bridge);
		hdmi_bridge->power_on = true;
	}

	phy->funcs->powerup(phy, hdmi_bridge->pixclock);
	hdmi_set_mode(hdmi, true);
}

static void hdmi_bridge_enable(struct drm_bridge *bridge)
{
}

static void hdmi_bridge_disable(struct drm_bridge *bridge)
{
}

static void hdmi_bridge_post_disable(struct drm_bridge *bridge)
{
	struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
	struct hdmi *hdmi = hdmi_bridge->hdmi;
	struct hdmi_phy *phy = hdmi->phy;

	DBG("power down");
	hdmi_set_mode(hdmi, false);
	phy->funcs->powerdown(phy);

	if (hdmi_bridge->power_on) {
		power_off(bridge);
		hdmi_bridge->power_on = false;
	}
}

static void hdmi_bridge_mode_set(struct drm_bridge *bridge,
		 struct drm_display_mode *mode,
		 struct drm_display_mode *adjusted_mode)
{
	struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
	struct hdmi *hdmi = hdmi_bridge->hdmi;
	int hstart, hend, vstart, vend;
	uint32_t frame_ctrl;

	mode = adjusted_mode;

	hdmi_bridge->pixclock = mode->clock * 1000;

	hdmi->hdmi_mode = drm_match_cea_mode(mode) > 1;

	hstart = mode->htotal - mode->hsync_start;
	hend   = mode->htotal - mode->hsync_start + mode->hdisplay;

	vstart = mode->vtotal - mode->vsync_start - 1;
	vend   = mode->vtotal - mode->vsync_start + mode->vdisplay - 1;

	DBG("htotal=%d, vtotal=%d, hstart=%d, hend=%d, vstart=%d, vend=%d",
			mode->htotal, mode->vtotal, hstart, hend, vstart, vend);

	hdmi_write(hdmi, REG_HDMI_TOTAL,
			HDMI_TOTAL_H_TOTAL(mode->htotal - 1) |
			HDMI_TOTAL_V_TOTAL(mode->vtotal - 1));

	hdmi_write(hdmi, REG_HDMI_ACTIVE_HSYNC,
			HDMI_ACTIVE_HSYNC_START(hstart) |
			HDMI_ACTIVE_HSYNC_END(hend));
	hdmi_write(hdmi, REG_HDMI_ACTIVE_VSYNC,
			HDMI_ACTIVE_VSYNC_START(vstart) |
			HDMI_ACTIVE_VSYNC_END(vend));

	if (mode->flags & DRM_MODE_FLAG_INTERLACE) {
		hdmi_write(hdmi, REG_HDMI_VSYNC_TOTAL_F2,
				HDMI_VSYNC_TOTAL_F2_V_TOTAL(mode->vtotal));
		hdmi_write(hdmi, REG_HDMI_VSYNC_ACTIVE_F2,
				HDMI_VSYNC_ACTIVE_F2_START(vstart + 1) |
				HDMI_VSYNC_ACTIVE_F2_END(vend + 1));
	} else {
		hdmi_write(hdmi, REG_HDMI_VSYNC_TOTAL_F2,
				HDMI_VSYNC_TOTAL_F2_V_TOTAL(0));
		hdmi_write(hdmi, REG_HDMI_VSYNC_ACTIVE_F2,
				HDMI_VSYNC_ACTIVE_F2_START(0) |
				HDMI_VSYNC_ACTIVE_F2_END(0));
	}

	frame_ctrl = 0;
	if (mode->flags & DRM_MODE_FLAG_NHSYNC)
		frame_ctrl |= HDMI_FRAME_CTRL_HSYNC_LOW;
	if (mode->flags & DRM_MODE_FLAG_NVSYNC)
		frame_ctrl |= HDMI_FRAME_CTRL_VSYNC_LOW;
	if (mode->flags & DRM_MODE_FLAG_INTERLACE)
		frame_ctrl |= HDMI_FRAME_CTRL_INTERLACED_EN;
	DBG("frame_ctrl=%08x", frame_ctrl);
	hdmi_write(hdmi, REG_HDMI_FRAME_CTRL, frame_ctrl);

	// TODO until we have audio, this might be safest:
	if (hdmi->hdmi_mode)
		hdmi_write(hdmi, REG_HDMI_GC, HDMI_GC_MUTE);
}

static const struct drm_bridge_funcs hdmi_bridge_funcs = {
		.pre_enable = hdmi_bridge_pre_enable,
		.enable = hdmi_bridge_enable,
		.disable = hdmi_bridge_disable,
		.post_disable = hdmi_bridge_post_disable,
		.mode_set = hdmi_bridge_mode_set,
		.destroy = hdmi_bridge_destroy,
};

/* initialize bridge */
struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi)
{
	struct drm_bridge *bridge = NULL;
	struct hdmi_bridge *hdmi_bridge;
	int ret;

	hdmi_bridge = kzalloc(sizeof(*hdmi_bridge), GFP_KERNEL);
	if (!hdmi_bridge) {
		ret = -ENOMEM;
		goto fail;
	}

	hdmi_bridge->hdmi = hdmi_reference(hdmi);

	bridge = &hdmi_bridge->base;

	drm_bridge_init(hdmi->dev, bridge, &hdmi_bridge_funcs);

	return bridge;

fail:
	if (bridge)
		hdmi_bridge_destroy(bridge);

	return ERR_PTR(ret);
}


text:
import {AbstractFormatter} from "../language/formatter/abstractFormatter";
import {IFormatterMetadata} from "../language/formatter/formatter";
import {RuleFailure} from "../language/rule/rule";

export class Formatter extends AbstractFormatter {
    /* tslint:disable:object-literal-sort-keys */
    public static metadata: IFormatterMetadata = {
        formatterName: "filesList",
        description: "Lists files containing lint errors.",
        sample: "directory/myFile.ts",
        consumer: "machine",
    };
    /* tslint:enable:object-literal-sort-keys */

    public format(failures: RuleFailure[]): string {
        if (failures.length === 0) {
            return "";
        }

        const files: string[] = [];
        let currentFile: string | undefined;

        for (const failure of failures) {
            const fileName = failure.getFileName();
            if (fileName !== currentFile) {
                files.push(fileName);
                currentFile = fileName;
            }
        }

        return files.join("\n") + "\n";
    }
}


text:
/**
 * File Name    : AuthGroupSqlServiceI
 * Creator      : 20160701688
 * Created Date : 2017/04/10
 * Comment      :
 */
package com.neo.usermgr.mybatis.service.itf;

import com.neo.usermgr.common.model.AuthGroup;

import java.util.List;

public interface AuthGroupSqlServiceI {
    public AuthGroup queryAuthGroupByIdAndCreator(int id, String creator);
    public List<AuthGroup> queryAuthGroupListByIds(List<Integer> ids,
                                                    int offset,
                                                    int count);
    public boolean checkAuthGroupNameIsExistedOrNotByCreator(String groupName, String creator);

    public boolean checkAuthGroupIdIsAllBelongToCreatorOrNot(List<Integer> ids, String creator);

    public int deleteAuthGroupByIdAndCreator(int id, String creator);

    public int insertAuthGroup(AuthGroup authGroup);

    public int updateAuthGroupNameByIdAndCreator(AuthGroup authGroup);
}


text:
from tfs import *
from pylab import *
import numpy
from numpy import *
import tensorflow as tf
import glob, os
import nibabel as nib

matplotlib.interactive(True)
session = tf.InteractiveSession()

dataPath = '../corpusCallosum/'

def computePad(dims,depth):
	y1=y2=x1=x2=0;
	y,x = [numpy.ceil(dims[i]/float(2**depth)) * (2**depth) for i in range(-2,0)]
	x = float(x); y = float(y);
	y1 = int(numpy.floor((y - dims[-2])/2)); y2 = int(numpy.ceil((y - dims[-2])/2))
	x1 = int(numpy.floor((x - dims[-1])/2)); x2 = int(numpy.ceil((x - dims[-1])/2))
	return y1,y2,x1,x2

def padImage(img,depth):
	"""Pads (or crops) an image so it is evenly divisible by 2**depth."""
	y1,y2,x1,x2 = computePad(img.shape,depth)
	dims = [(0,0) for i in img.shape]
	dims[-2] = (y1,y2); dims[-1] = (x1,x2)
	return numpy.pad(img,dims,'constant')

# Class to serve up segmented images
class CCData(object):

	def __init__(self,paths,padding=None):
		self.paths = paths
		self.padding = padding

	def getSlices(self,paths):
		image,truth = paths
		image = nib.load(image).get_data(); truth = nib.load(truth).get_data()
		slicesWithValues = [unique(s) for s in where(truth>0)]
		sliceAxis = argmin([len(s) for s in slicesWithValues])
		slicesWithValues = slicesWithValues[sliceAxis]
		slc = repeat(-1,3); slc[sliceAxis] = slicesWithValues[0]
		if not self.padding is None:
			image, truth = [padImage(im,self.padding) for im in (image[slc][0],truth[slc][0])]
		else:
			image, truth = (image[slc][0],truth[slc][0])
		return (image,truth)

	def next_batch(self,miniBatch=None):
		if miniBatch is None or miniBatch==len(self.paths):
			batch = arange(0,len(self.paths))
		else:
			batch = random.choice(arange(0,len(self.paths)),miniBatch)
		images = [self.getSlices(self.paths[i]) for i in batch]
		return list(zip(*images))

class Container(object):

	def __init__(self,dataPath,reserve=2,**args):
		self.dataPath = dataPath
		images = glob.glob(os.path.join(dataPath,'?????.nii.gz'))
		images = [(i,i.replace('.nii.gz','_cc.nii.gz')) for i in images]
		self.train = CCData(images[0:-reserve],**args)
		self.test = CCData(images[reserve:],**args)

data = Container(dataPath,reserve=2,padding=3)

trainingIterations = 5000

x = tf.placeholder('float',shape=[None,None,None],name='input')
y_ = tf.placeholder('float', shape=[None,None,None],name='truth')
y_OneHot = tf.one_hot(indices=tf.cast(y_,tf.int32),depth=2,name='truthOneHot')
xInput = tf.expand_dims(x,axis=3,name='xInput')

# ------------------------   Standard conv net from Session 3 ---------------------------------
# net = LD1 = Conv2D(xInput,[5,5,1,10],strides=1,name='Conv1')
# net = LD2 = Conv2D(net.output,[5,5,10,20],strides=1,name='Conv2')
# net = LSM = ConvSoftMax(net.output,[1,1,20,2],name='softmax-conv')
# y = net.output

# -------------------------  Standard conv net from Session 3 using new TensorFlow layers ---------------------------
# net = LD1 = tf.layers.conv2d(
# 					inputs=xInput,
# 					filters=10,
# 					kernel_size=[5,5],
# 					strides = 1,
# 					padding = 'same',
# 					activation=tf.nn.relu,
# 					name='convD1'
# 				)
# net = LD2 = tf.layers.conv2d(
# 					inputs=net,
# 					filters=20,
# 					kernel_size=[5,5],
# 					strides = 1,
# 					padding = 'same',
# 					activation=tf.nn.relu,
# 					name='convD2'
# 				)
# net = LTop = tf.layers.conv2d(
# 					inputs=net,
# 					filters=2,
# 					kernel_size=[5,5],
# 					strides = 1,
# 					padding = 'same',
# 					activation=tf.nn.relu,
# 					name='topRelu'
# 				)

# ----------------------------------------  U Net ---------------------------------------

net = LD1 = tf.layers.conv2d(
					inputs=xInput,
					filters=10,
					kernel_size=[5,5],
					strides = 2,
					padding = 'same',
					activation=tf.nn.relu,
					name='convD1'
				)
net = LD2 = tf.layers.conv2d(
					inputs=net,
					filters=20,
					kernel_size=[5,5],
					strides = 2,
					padding = 'same',
					activation=tf.nn.relu,
					name='convD2'
				)
net = LB = tf.layers.conv2d(
					inputs=net,
					filters=30,
					kernel_size=[5,5],
					strides = 1,
					padding = 'same',
					activation=tf.nn.relu,
					name='convBottom'
				)
net = LU2 = tf.layers.conv2d_transpose(
					inputs=net,
					filters=20,
					kernel_size=[5,5],
					strides = 2,
					padding = 'same',
					activation=tf.nn.relu,
					name='convU2'
				)
net = LU1 = tf.layers.conv2d_transpose(
					inputs=net,
					filters=10,
					kernel_size=[5,5],
					strides = 2,
					padding = 'same',
					activation=tf.nn.relu,
					name='convU1'
				)
net = LTop = tf.layers.conv2d(
					inputs=net,
					filters=2,
					kernel_size=[5,5],
					strides = 1,
					padding = 'same',
					activation=None,
					name='logits'
				)

logits = LTop
y = tf.nn.softmax(logits,-1)

kp = 0.5; trainDict = {}#{L0do.keepProb:kp}
kp = 1.0; testDict = {}#{L0do.keepProb:kp}
logName = None #logName = 'logs/Conv'

# Training and evaluation
loss = tf.losses.softmax_cross_entropy(onehot_labels=y_OneHot, logits=logits)
#loss = -tf.reduce_sum(y_OneHot*tf.log(y+1e-6))
trainStep = tf.train.AdamOptimizer(1e-3).minimize(loss)

# Accuracy
correctPrediction = tf.equal(tf.argmax(y,axis=-1), tf.argmax(y_OneHot,axis=-1))
accuracy = tf.reduce_mean(tf.cast(correctPrediction,'float'))

# Jaccard
output = tf.cast(tf.argmax(y,axis=-1), dtype=tf.float32)
truth = tf.cast(tf.argmax(y_OneHot,axis=-1), dtype=tf.float32)
intersection = tf.reduce_sum(tf.reduce_sum(tf.multiply(output, truth), axis=-1),axis=-1)
union = tf.reduce_sum(tf.reduce_sum(tf.cast(tf.add(output, truth)>= 1, dtype=tf.float32), axis=-1),axis=-1)
jaccard = tf.reduce_mean(intersection / union)

train(session=session,trainingData=data.train,testingData=data.test,truth=y_,input=x,cost=loss,trainingStep=trainStep,accuracy=jaccard,iterations=trainingIterations,miniBatch=2,trainDict=trainDict,testDict=testDict,logName=logName)

# Make a figure
# Get a couple of examples
batch = data.test.next_batch(2)
d = {x:batch[0][0:1],y_:batch[1][0:1]}
ex = array(batch[0])
segmentation = y.eval({x:ex})

# Display each example
# Display each example
figure('Example 1'); clf()
imshow(batch[0][0].transpose(),cmap=cm.gray,origin='lower left');
#contour(batch[1][0].transpose(),alpha=0.5,color='g');
contour(segmentation[0,:,:,1].transpose(),alpha=0.5,color='b')
figure('Example 2'); clf()
imshow(batch[0][1].transpose(),cmap=cm.gray,origin='lower left');
#contour(batch[1][1].transpose(),alpha=0.5,color='g');
contour(segmentation[1,:,:,1].transpose(),alpha=0.5,color='b')
plotOutput(LD1,{x:ex[0:1]},figOffset='Layer 1 Output')
plotOutput(LD2,{x:ex[0:1]},figOffset='Layer 2 Output')
plotOutput(LU1,{x:ex[0:1]},figOffset='Layer 2 Output')


text:
package com.microsoft.azure.management.logic.v2018_07_01_preview;

import org.joda.time.DateTime;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * The artifact properties definition.
 */
public class ArtifactProperties {
    /**
     * The artifact creation time.
     */
    @JsonProperty(value = "createdTime")
    private DateTime createdTime;

    /**
     * The artifact changed time.
     */
    @JsonProperty(value = "changedTime")
    private DateTime changedTime;

    /**
     * The metadata property.
     */
    @JsonProperty(value = "metadata")
    private Object metadata;

    /**
     * Get the artifact creation time.
     *
     * @return the createdTime value
     */
    public DateTime createdTime() {
        return this.createdTime;
    }

    /**
     * Set the artifact creation time.
     *
     * @param createdTime the createdTime value to set
     * @return the ArtifactProperties object itself.
     */
    public ArtifactProperties withCreatedTime(DateTime createdTime) {
        this.createdTime = createdTime;
        return this;
    }

    /**
     * Get the artifact changed time.
     *
     * @return the changedTime value
     */
    public DateTime changedTime() {
        return this.changedTime;
    }

    /**
     * Set the artifact changed time.
     *
     * @param changedTime the changedTime value to set
     * @return the ArtifactProperties object itself.
     */
    public ArtifactProperties withChangedTime(DateTime changedTime) {
        this.changedTime = changedTime;
        return this;
    }

    /**
     * Get the metadata value.
     *
     * @return the metadata value
     */
    public Object metadata() {
        return this.metadata;
    }

    /**
     * Set the metadata value.
     *
     * @param metadata the metadata value to set
     * @return the ArtifactProperties object itself.
     */
    public ArtifactProperties withMetadata(Object metadata) {
        this.metadata = metadata;
        return this;
    }

}


text:
package org.ovirt.engine.ui.webadmin.uicommon;

import java.util.logging.Logger;

import org.ovirt.engine.core.compat.Event;
import org.ovirt.engine.core.compat.Version;
import org.ovirt.engine.ui.uicommonweb.models.vms.ISpice;
import org.ovirt.engine.ui.uicommonweb.models.vms.SpiceConsoleModel;

public class SpiceInterfaceImpl implements ISpice {
    private static Logger logger = Logger.getLogger(SpiceInterfaceImpl.class
            .getName());

    private Event disconnectedEvent = new Event(
            SpiceConsoleModel.SpiceDisconnectedEventDefinition);
    private Event connectedEvent = new Event(
            SpiceConsoleModel.SpiceConnectedEventDefinition);
    private Event menuItemSelectedEvent = new Event(
            SpiceConsoleModel.SpiceMenuItemSelectedEventDefinition);
    private Version currentVersion = new Version(4, 4);
    private Version desiredVersion = new Version(4, 4);
    private int port;
    public String host;
    private boolean fullScreen;
    private String password;
    private int numberOfMonitors;
    private int usbListenPort;
    private boolean adminConsole;
    private String guestHostName;
    private int securePort;
    private String sslChanels;
    private String cipherSuite;
    private String hostSubject;
    private String trustStore;
    private String title;
    private String hotKey;
    private String[] localizedStrings;
    private String menu;
    private String guestID;
    private boolean noTaskMgrExecution;
    private boolean sendCtrlAltDelete;
    private boolean usbAutoShare;
    private String usbFilter;
    ClientAgentType cat = new ClientAgentType();

    public SpiceInterfaceImpl() {
        logger.severe("Instantiating GWT Spice Implementation");
    }

    @Override
    public Event getDisconnectedEvent() {
        return disconnectedEvent;
    }

    public void setDisconnectedEvent(Event disconnectedEvent) {
        this.disconnectedEvent = disconnectedEvent;
    }

    @Override
    public Event getConnectedEvent() {
        return connectedEvent;
    }

    public void setConnectedEvent(Event connectedEvent) {
        this.connectedEvent = connectedEvent;
    }

    @Override
    public Event getMenuItemSelectedEvent() {
        return menuItemSelectedEvent;
    }

    public void setMenuItemSelectedEvent(Event menuItemSelectedEvent) {
        this.menuItemSelectedEvent = menuItemSelectedEvent;
    }

    @Override
    public Version getCurrentVersion() {
        return currentVersion;
    }

    public void setCurrentVersion(Version currentVersion) {
        this.currentVersion = currentVersion;
    }

    // This should be defined by UiCommon
    @Override
    public Version getDesiredVersion() {
        return desiredVersion;
    }

    @Override
    public void setDesiredVersion(Version desiredVersion) {
        this.desiredVersion = desiredVersion;
    }

    public String getDesiredVersionStr() {
        return desiredVersion.toString().replace('.', ',');
    }

    @Override
    public int getPort() {
        return port;
    }

    @Override
    public void setPort(int port) {
        this.port = port;
    }

    @Override
    public String getHost() {
        return host;
    }

    @Override
    public void setHost(String host) {
        this.host = host;
    }

    public boolean isFullScreen() {
        return fullScreen;
    }

    @Override
    public boolean getFullScreen() {
        return fullScreen;
    }

    @Override
    public void setFullScreen(boolean fullScreen) {
        this.fullScreen = fullScreen;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public int getNumberOfMonitors() {
        return numberOfMonitors;
    }

    @Override
    public void setNumberOfMonitors(int numberOfMonitors) {
        this.numberOfMonitors = numberOfMonitors;
    }

    @Override
    public int getUsbListenPort() {
        return usbListenPort;
    }

    @Override
    public void setUsbListenPort(int usbListenPort) {
        this.usbListenPort = usbListenPort;
    }

    public boolean isAdminConsole() {
        return adminConsole;
    }

    @Override
    public boolean getAdminConsole() {
        return adminConsole;
    }

    @Override
    public void setAdminConsole(boolean adminConsole) {
        this.adminConsole = adminConsole;
    }

    @Override
    public String getGuestHostName() {
        return guestHostName;
    }

    @Override
    public void setGuestHostName(String guestHostName) {
        this.guestHostName = guestHostName;
    }

    @Override
    public int getSecurePort() {
        return securePort & 0xffff;
    }

    @Override
    public void setSecurePort(int securePort) {
        this.securePort = securePort;
    }

    @Override
    public String getSslChanels() {
        return sslChanels;
    }

    @Override
    public void setSslChanels(String sslChanels) {
        this.sslChanels = sslChanels;
    }

    @Override
    public String getCipherSuite() {
        return cipherSuite;
    }

    @Override
    public void setCipherSuite(String cipherSuite) {
        this.cipherSuite = cipherSuite;
    }

    @Override
    public String getHostSubject() {
        return hostSubject;
    }

    @Override
    public void setHostSubject(String hostSubject) {
        this.hostSubject = hostSubject;
    }

    @Override
    public String getTrustStore() {
        return trustStore;
    }

    @Override
    public void setTrustStore(String trustStore) {
        this.trustStore = trustStore;
    }

    @Override
    public String getTitle() {
        return title;
    }

    @Override
    public void setTitle(String title) {
        this.title = title;
    }

    @Override
    public String getHotKey() {
        return hotKey;
    }

    @Override
    public void setHotKey(String hotKey) {
        this.hotKey = hotKey;
    }

    @Override
    public String[] getLocalizedStrings() {
        return localizedStrings;
    }

    @Override
    public void setLocalizedStrings(String[] localizedStrings) {
        this.localizedStrings = localizedStrings;
    }

    @Override
    public String getMenu() {
        return menu;
    }

    @Override
    public void setMenu(String menu) {
        this.menu = menu;
    }

    @Override
    public String getGuestID() {
        return guestID;
    }

    @Override
    public void setGuestID(String guestID) {
        this.guestID = guestID;
    }

    @Override
    public boolean getNoTaskMgrExecution() {
        return noTaskMgrExecution;
    }

    @Override
    public void setNoTaskMgrExecution(boolean noTaskMgrExecution) {
        this.noTaskMgrExecution = noTaskMgrExecution;
    }

    @Override
    public boolean getSendCtrlAltDelete() {
        return sendCtrlAltDelete;
    }

    @Override
    public void setSendCtrlAltDelete(boolean sendCtrlAltDelete) {
        this.sendCtrlAltDelete = sendCtrlAltDelete;
    }

    @Override
    public boolean getUsbAutoShare() {
        return usbAutoShare;
    }

    @Override
    public void setUsbAutoShare(boolean usbAutoShare) {
        this.usbAutoShare = usbAutoShare;
    }

    @Override
    public String getUsbFilter() {
        return usbFilter;
    }

    @Override
    public void setUsbFilter(String usbFilter) {
        this.usbFilter = usbFilter;
    }

    @Override
    public void Connect() {
        logger.warning("Connecting via spice...");

        if ((cat.os.equalsIgnoreCase("Linux"))
                && (cat.browser.equalsIgnoreCase("Firefox"))) {
            connectNativelyViaXPI();
        } else if ((cat.os.equalsIgnoreCase("Windows"))
                && (cat.browser.equalsIgnoreCase("Explorer"))) {
            connectNativelyViaActiveX();
        }
    }

    public String getSpiceCabURL() {
        // According to the OS type, return the appropriate CAB URL
        if (cat.getPlatform().equalsIgnoreCase("win32")) {
            return WebAdminConfigurator.getSpiceBaseURL() + "SpiceX.cab";
        } else if (cat.getPlatform().equalsIgnoreCase("win64")) {
            return WebAdminConfigurator.getSpiceBaseURL() + "SpiceX_x64.cab";
        } else {
            return null;
        }
    }

    public String getSpiceObjectClassId() {
        // According to the OS type, return the appropriate (x64/x86) object
        // class ID
        if (cat.getPlatform().equalsIgnoreCase("win32")) {
            return "ACD6D89C-938D-49B4-8E81-DDBD13F4B48A";
        } else if (cat.getPlatform().equalsIgnoreCase("win64")) {
            return "ACD6D89C-938D-49B4-8E81-DDBD13F4B48B";
        } else {
            return null;
        }
    }

    public native String loadActiveX(String id, String codebase, String classId) /*-{
		var container = $wnd.document.createElement("div");
		container.innerHTML = '<object id="' + id + '" codebase="' + codebase
				+ '" classid="CLSID:' + classId
				+ '" width="0" height="0"></object>';
		container.style.width = "0px";
		container.style.height = "0px";
		container.style.position = "absolute";
		container.style.top = "0px";
		container.style.left = "0px";
		var target_element = $wnd.document.getElementsByTagName("body")[0];
		if (typeof (target_element) == "undefined" || target_element == null)
			return false;
		target_element.appendChild(container);
    }-*/;

    public native String loadXpi(String id) /*-{
		var container = $wnd.document.createElement("div");
		container.innerHTML = '<embed id="' + id
				+ '" type="application/x-spice" width=0 height=0/>';
		container.style.width = "0px";
		container.style.height = "0px";
		container.style.position = "absolute";
		container.style.top = "0px";
		container.style.left = "0px";
		var target_element = $wnd.document.getElementsByTagName("body")[0];
		if (typeof (target_element) == "undefined" || target_element == null)
			return false;
		target_element.appendChild(container);
    }-*/;

    public native void connectNativelyViaXPI() /*-{
		var pluginFound = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::detectXpiPlugin()();
		if (!pluginFound) {
			alert("Spice XPI addon was not found, please install Spice XPI addon first.");
			return;
		}

		var hostIp = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getHost()();
		var port = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getPort()();
		var fullScreen = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getFullScreen()();
		var password = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getPassword()();
		var numberOfMonitors = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getNumberOfMonitors()();
		var usbListenPort = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getUsbListenPort()();
		var adminConsole = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getAdminConsole()();
		var guestHostName = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getGuestHostName()();
		var securePort = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getSecurePort()();
		var sslChanels = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getSslChanels()();
		var cipherSuite = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getCipherSuite()();
		var hostSubject = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getHostSubject()();
		var trustStore = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getTrustStore()();
		var title = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getTitle()();
		var hotKey = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getHotKey()();
		var menu = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getMenu()();
		var guestID = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getGuestID()();
		var version = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getCurrentVersion()();
		var spiceCabURL = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getSpiceCabURL()();
		var spiceCabOjectClassId = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getSpiceObjectClassId()();
		var id = "SpiceX_" + guestHostName;
		var noTaskMgrExecution = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getNoTaskMgrExecution()();
		var sendCtrlAltDelete = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getSendCtrlAltDelete()();
		var usbAutoShare = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getUsbAutoShare()();
		var usbFilter = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getUsbFilter()();
		var disconnectedEvent = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getDisconnectedEvent()();
		var connectedEvent = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getConnectedEvent()();
		var menuItemSelectedEvent = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getMenuItemSelectedEvent()();
		var model = this;

		//        alert("Host IP: " + hostIp + ", port: " + port + ", fullScreen: "
		//              + fullScreen + ", password: " + password
		//              + ", numberOfMonitors: " + numberOfMonitors
		//              + ", Usb Listen Port: " + usbListenPort + ", Admin Console: "
		//              + adminConsole + ", Guest HostName: " + guestHostName
		//              + ", Secure Port: " + securePort + ", Ssl Chanels: "
		//              + sslChanels + ", cipherSuite: " + cipherSuite
		//              + ", Host Subject: " + hostSubject + ", Title: " + title
		//              + ", Hot Key: " + hotKey + ", Menu: " + menu + ", GuestID: "
		//              + guestID + ", version: " + version + ", Trust Store: "
		//              + trustStore);

		this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::loadXpi(Ljava/lang/String;)(id);
		var client = $wnd.document.getElementById(id);
		client.hostIP = hostIp;
		client.port = port;
		client.Title = title;
		client.dynamicMenu = "";
		client.fullScreen = fullScreen;
		client.Password = password;
		client.NumberOfMonitors = numberOfMonitors;
		client.UsbListenPort = usbListenPort;
		client.AdminConsole = adminConsole;
		client.SecurePort = securePort;
		if (sslChanels != null && sslChanels.length > 0)
			client.SSLChannels = sslChanels;
		client.GuestHostName = guestHostName;
		if (cipherSuite != null && cipherSuite.length > 0)
			client.CipherSuite = cipherSuite;
		if (hostSubject != null)
			client.HostSubject = hostSubject;
		if (trustStore != null)
			client.TrustStore = trustStore;
		client.HotKey = hotKey;
		client.NoTaskMgrExecution = noTaskMgrExecution;
		client.SendCtrlAltDelete = sendCtrlAltDelete;
		client.UsbAutoShare = usbAutoShare;
		client.connect();

		connectedEvent.@org.ovirt.engine.core.compat.Event::raise(Ljava/lang/Object;Lorg/ovirt/engine/core/compat/EventArgs;)(model, null);

		//since the 'ondisconnected' event doesn't work well in linux, we use polling instead:
		var checkConnectStatusIntervalID = setInterval(checkConnectStatus, 2000);
		function checkConnectStatus() {
			if (client.ConnectedStatus() >= 0) {
				clearInterval(checkConnectStatusIntervalID);
				var connectedStatus = client.ConnectedStatus();
				var errorCodeEventArgs = @org.ovirt.engine.ui.uicommonweb.models.vms.ErrorCodeEventArgs::new(I)(connectedStatus);
				disconnectedEvent.@org.ovirt.engine.core.compat.Event::raise(Ljava/lang/Object;Lorg/ovirt/engine/core/compat/EventArgs;)(model, errorCodeEventArgs);
			}
		}
    }-*/;

    public native boolean detectXpiPlugin() /*-{
		var pluginsFound = false;
		if (navigator.plugins && navigator.plugins.length > 0) {
			var daPlugins = ["Spice"];
			var pluginsAmount = navigator.plugins.length;
			for (counter = 0; counter < pluginsAmount; counter++) {
				var numFound = 0;
				for (namesCounter = 0; namesCounter < daPlugins.length; namesCounter++) {
					if ((navigator.plugins[counter].name
							.indexOf(daPlugins[namesCounter]) > 0)
							|| (navigator.plugins[counter].description
									.indexOf(daPlugins[namesCounter]) >= 0)) {
						numFound++;
					}
				}
				if (numFound == daPlugins.length) {
					pluginsFound = true;
					break;
				}
			}

			return pluginsFound;
		}
    }-*/;

    public native void connectNativelyViaActiveX() /*-{
		var hostIp = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getHost()();
		var port = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getPort()();
		var fullScreen = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getFullScreen()();
		var password = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getPassword()();
		var numberOfMonitors = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getNumberOfMonitors()();
		var usbListenPort = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getUsbListenPort()();
		var adminConsole = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getAdminConsole()();
		var guestHostName = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getGuestHostName()();
		var securePort = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getSecurePort()();
		var sslChanels = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getSslChanels()();
		var cipherSuite = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getCipherSuite()();
		var hostSubject = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getHostSubject()();
		var trustStore = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getTrustStore()();
		var title = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getTitle()();
		var hotKey = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getHotKey()();
		var menu = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getMenu()();
		var guestID = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getGuestID()();
		var version = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getCurrentVersion()();
		var spiceCabURL = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getSpiceCabURL()();
		var spiceCabOjectClassId = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getSpiceObjectClassId()();
		var noTaskMgrExecution = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getNoTaskMgrExecution()();
		var sendCtrlAltDelete = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getSendCtrlAltDelete()();
		var usbAutoShare = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getUsbAutoShare()();
		var usbFilter = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getUsbFilter()();
		var menu = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getMenu()();
		var disconnectedEvent = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getDisconnectedEvent()();
        var connectedEvent = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getConnectedEvent()();
		var menuItemSelectedEvent = this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::getMenuItemSelectedEvent()();
		var codebase = spiceCabURL + "#version=" + version;
		var model = this;
		var id = "SpiceX_" + guestHostName;

		//		alert("Host IP: " + hostIp + ", port: " + port + ", fullScreen: "
		//				+ fullScreen + ", password: " + password
		//				+ ", numberOfMonitors: " + numberOfMonitors
		//				+ ", Usb Listen Port: " + usbListenPort + ", Admin Console: "
		//				+ adminConsole + ", Guest HostName: " + guestHostName
		//				+ ", Secure Port: " + securePort + ", Ssl Chanels: "
		//				+ sslChanels + ", cipherSuite: " + cipherSuite
		//				+ ", Host Subject: " + hostSubject + ", Title: " + title
		//				+ ", Hot Key: " + hotKey + ", Menu: " + menu + ", GuestID: "
		//				+ guestID + ", version: " + version + ", Trust Store: "
		//				+ trustStore);

		// Create ActiveX object
		this.@org.ovirt.engine.ui.webadmin.uicommon.SpiceInterfaceImpl::loadActiveX(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)(id,codebase,spiceCabOjectClassId);

		var client = $wnd.document.getElementById(id);
		client.attachEvent('onreadystatechange', onReadyStateChange);
		client.attachEvent('onmenuitemselected', onMenuItemSelected);

		tryToConnect();

		function tryToConnect() {
			if (client.readyState == 4) {
				try {
					client.style.width = "0px";
					client.style.height = "0px";
					client.hostIP = hostIp;
					client.port = port;
					client.Title = title;
					client.dynamicMenu = menu;
					client.fullScreen = fullScreen;
					client.Password = password;
					client.NumberOfMonitors = numberOfMonitors;
					client.UsbListenPort = usbListenPort;
					client.AdminConsole = adminConsole;
					client.SecurePort = securePort;
					if (sslChanels != null && sslChanels.length > 0)
						client.SSLChannels = sslChanels;
					client.GuestHostName = guestHostName;
					if (cipherSuite != null && cipherSuite.length > 0)
						client.CipherSuite = cipherSuite;
					if (hostSubject != null)
						client.HostSubject = hostSubject;
					if (trustStore != null)
						client.TrustStore = trustStore;
					client.HotKey = hotKey;
					client.NoTaskMgrExecution = noTaskMgrExecution;
					client.SendCtrlAltDelete = sendCtrlAltDelete;
					client.UsbAutoShare = usbAutoShare;
					client.attachEvent('ondisconnected', onDisconnected);

					client.connect();

					connectedEvent.@org.ovirt.engine.core.compat.Event::raise(Ljava/lang/Object;Lorg/ovirt/engine/core/compat/EventArgs;)(model, null);

				} catch (ex) {
					onDisconnected();
				}
			}
		}

		function onReadyStateChange() {
			tryToConnect();
		}

		function onDisconnected(errorCode) {
			var errorCodeEventArgs = @org.ovirt.engine.ui.uicommonweb.models.vms.ErrorCodeEventArgs::new(I)(errorCode);
			disconnectedEvent.@org.ovirt.engine.core.compat.Event::raise(Ljava/lang/Object;Lorg/ovirt/engine/core/compat/EventArgs;)(model, errorCodeEventArgs);
		}

		function onMenuItemSelected(itemId) {
			var spiceMenuItemEventArgs = @org.ovirt.engine.ui.uicommonweb.models.vms.SpiceMenuItemEventArgs::new(I)(itemId);
			menuItemSelectedEvent.@org.ovirt.engine.core.compat.Event::raise(Ljava/lang/Object;Lorg/ovirt/engine/core/compat/EventArgs;)(model, spiceMenuItemEventArgs);
		}
    }-*/;

    @Override
    public void Install() {
    }

    @Override
    public boolean getIsInstalled() {
        return true;
    }

    public static boolean isBrowserSupported() {
        ClientAgentType cat = new ClientAgentType();
        logger.finer("Determining whether browser [" + cat.browser
                + "], version [" + cat.version + "] on OS [" + cat.os
                + "] is supported by spice");

        if ((cat.os.equalsIgnoreCase("Windows"))
                && (cat.browser.equalsIgnoreCase("Explorer"))
                && (cat.version >= 7.0)) {
            return true;
        } else if ((cat.os.equalsIgnoreCase("Linux"))
                && (cat.browser.equalsIgnoreCase("Firefox"))
                && (cat.version >= 2.0)) {
            return true;
        }

        return false;
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>

		<list key="ENABLED_TRANSFERS">
			<item value="org.eclipse.ui.workingSets"/>
			<item value=""/>
		</list>

		<item value="544" key="DIALOG_X_ORIGIN"/>
		<item value="319" key="DIALOG_Y_ORIGIN"/>


text:
using base::TimeTicks;

namespace disk_cache {

BlockFiles::BlockFiles(const base::FilePath& path)
    : init_(false), zero_buffer_(NULL), path_(path) {
}

BlockFiles::~BlockFiles() {
  if (zero_buffer_)
    delete[] zero_buffer_;
  CloseFiles();
}

bool BlockFiles::Init(bool create_files) {
  DCHECK(!init_);
  if (init_)
    return false;

  thread_checker_.reset(new base::ThreadChecker);

  block_files_.resize(kFirstAdditionalBlockFile);
  for (int i = 0; i < kFirstAdditionalBlockFile; i++) {
    if (create_files)
      if (!CreateBlockFile(i, static_cast<FileType>(i + 1), true))
        return false;

    if (!OpenBlockFile(i))
      return false;

    // Walk this chain of files removing empty ones.
    if (!RemoveEmptyFile(static_cast<FileType>(i + 1)))
      return false;
  }

  init_ = true;
  return true;
}

bool BlockFiles::CreateBlock(FileType block_type, int block_count,
                             Addr* block_address) {
  DCHECK(thread_checker_->CalledOnValidThread());
  if (block_type < RANKINGS || block_type > BLOCK_4K ||
      block_count < 1 || block_count > 4)
    return false;
  if (!init_)
    return false;

  MappedFile* file = FileForNewBlock(block_type, block_count);
  if (!file)
    return false;

  ScopedFlush flush(file);
  BlockFileHeader* header = reinterpret_cast<BlockFileHeader*>(file->buffer());

  int target_size = 0;
  for (int i = block_count; i <= 4; i++) {
    if (header->empty[i - 1]) {
      target_size = i;
      break;
    }
  }

  DCHECK(target_size);
  int index;
  if (!CreateMapBlock(target_size, block_count, header, &index))
    return false;

  Addr address(block_type, block_count, header->this_file, index);
  block_address->set_value(address.value());
  Trace("CreateBlock 0x%x", address.value());
  return true;
}

void BlockFiles::DeleteBlock(Addr address, bool deep) {
  DCHECK(thread_checker_->CalledOnValidThread());
  if (!address.is_initialized() || address.is_separate_file())
    return;

  if (!zero_buffer_) {
    zero_buffer_ = new char[Addr::BlockSizeForFileType(BLOCK_4K) * 4];
    memset(zero_buffer_, 0, Addr::BlockSizeForFileType(BLOCK_4K) * 4);
  }
  MappedFile* file = GetFile(address);
  if (!file)
    return;

  Trace("DeleteBlock 0x%x", address.value());

  size_t size = address.BlockSize() * address.num_blocks();
  size_t offset = address.start_block() * address.BlockSize() +
                  kBlockHeaderSize;
  if (deep)
    file->Write(zero_buffer_, size, offset);

  BlockFileHeader* header = reinterpret_cast<BlockFileHeader*>(file->buffer());
  DeleteMapBlock(address.start_block(), address.num_blocks(), header);
  file->Flush();

  if (!header->num_entries) {
    // This file is now empty. Let's try to delete it.
    FileType type = Addr::RequiredFileType(header->entry_size);
    if (Addr::BlockSizeForFileType(RANKINGS) == header->entry_size)
      type = RANKINGS;
    RemoveEmptyFile(type);  // Ignore failures.
  }
}

void BlockFiles::CloseFiles() {
  if (init_) {
    DCHECK(thread_checker_->CalledOnValidThread());
  }
  init_ = false;
  for (unsigned int i = 0; i < block_files_.size(); i++) {
    if (block_files_[i]) {
      block_files_[i]->Release();
      block_files_[i] = NULL;
    }
  }
  block_files_.clear();
}

void BlockFiles::ReportStats() {
  DCHECK(thread_checker_->CalledOnValidThread());
  int used_blocks[kFirstAdditionalBlockFile];
  int load[kFirstAdditionalBlockFile];
  for (int i = 0; i < kFirstAdditionalBlockFile; i++) {
    GetFileStats(i, &used_blocks[i], &load[i]);
  }
  UMA_HISTOGRAM_COUNTS("DiskCache.Blocks_0", used_blocks[0]);
  UMA_HISTOGRAM_COUNTS("DiskCache.Blocks_1", used_blocks[1]);
  UMA_HISTOGRAM_COUNTS("DiskCache.Blocks_2", used_blocks[2]);
  UMA_HISTOGRAM_COUNTS("DiskCache.Blocks_3", used_blocks[3]);

  UMA_HISTOGRAM_ENUMERATION("DiskCache.BlockLoad_0", load[0], 101);
  UMA_HISTOGRAM_ENUMERATION("DiskCache.BlockLoad_1", load[1], 101);
  UMA_HISTOGRAM_ENUMERATION("DiskCache.BlockLoad_2", load[2], 101);
  UMA_HISTOGRAM_ENUMERATION("DiskCache.BlockLoad_3", load[3], 101);
}

bool BlockFiles::IsValid(Addr address) {
#ifdef NDEBUG
  return true;
#else
  if (!address.is_initialized() || address.is_separate_file())
    return false;

  MappedFile* file = GetFile(address);
  if (!file)
    return false;

  BlockFileHeader* header = reinterpret_cast<BlockFileHeader*>(file->buffer());
  bool rv = UsedMapBlock(address.start_block(), address.num_blocks(), header);
  DCHECK(rv);

  static bool read_contents = false;
  if (read_contents) {
    scoped_ptr<char[]> buffer;
    buffer.reset(new char[Addr::BlockSizeForFileType(BLOCK_4K) * 4]);
    size_t size = address.BlockSize() * address.num_blocks();
    size_t offset = address.start_block() * address.BlockSize() +
                    kBlockHeaderSize;
    bool ok = file->Read(buffer.get(), size, offset);
    DCHECK(ok);
  }

  return rv;
#endif
}

MappedFile* BlockFiles::GetFile(Addr address) {
  DCHECK(thread_checker_->CalledOnValidThread());
  DCHECK(block_files_.size() >= 4);
  DCHECK(address.is_block_file() || !address.is_initialized());
  if (!address.is_initialized())
    return NULL;

  int file_index = address.FileNumber();
  if (static_cast<unsigned int>(file_index) >= block_files_.size() ||
      !block_files_[file_index]) {
    // We need to open the file
    if (!OpenBlockFile(file_index))
      return NULL;
  }
  DCHECK(block_files_.size() >= static_cast<unsigned int>(file_index));
  return block_files_[file_index];
}

bool BlockFiles::GrowBlockFile(MappedFile* file, BlockFileHeader* header) {
  if (kMaxBlocks == header->max_entries)
    return false;

  ScopedFlush flush(file);
  DCHECK(!header->empty[3]);
  int new_size = header->max_entries + 1024;
  if (new_size > kMaxBlocks)
    new_size = kMaxBlocks;

  int new_size_bytes = new_size * header->entry_size + sizeof(*header);

  if (!file->SetLength(new_size_bytes)) {
    // Most likely we are trying to truncate the file, so the header is wrong.
    if (header->updating < 10 && !FixBlockFileHeader(file)) {
      // If we can't fix the file increase the lock guard so we'll pick it on
      // the next start and replace it.
      header->updating = 100;
      return false;
    }
    return (header->max_entries >= new_size);
  }

  FileLock lock(header);
  header->empty[3] = (new_size - header->max_entries) / 4;  // 4 blocks entries
  header->max_entries = new_size;

  return true;
}

MappedFile* BlockFiles::FileForNewBlock(FileType block_type, int block_count) {
  COMPILE_ASSERT(RANKINGS == 1, invalid_file_type);
  MappedFile* file = block_files_[block_type - 1];
  BlockFileHeader* header = reinterpret_cast<BlockFileHeader*>(file->buffer());

  TimeTicks start = TimeTicks::Now();
  while (NeedToGrowBlockFile(header, block_count)) {
    if (kMaxBlocks == header->max_entries) {
      file = NextFile(file);
      if (!file)
        return NULL;
      header = reinterpret_cast<BlockFileHeader*>(file->buffer());
      continue;
    }

    if (!GrowBlockFile(file, header))
      return NULL;
    break;
  }
  HISTOGRAM_TIMES("DiskCache.GetFileForNewBlock", TimeTicks::Now() - start);
  return file;
}

// Note that we expect to be called outside of a FileLock... however, we cannot
// DCHECK on header->updating because we may be fixing a crash.
bool BlockFiles::FixBlockFileHeader(MappedFile* file) {
  ScopedFlush flush(file);
  BlockFileHeader* header = reinterpret_cast<BlockFileHeader*>(file->buffer());
  int file_size = static_cast<int>(file->GetLength());
  if (file_size < static_cast<int>(sizeof(*header)))
    return false;  // file_size > 2GB is also an error.

  const int kMinBlockSize = 36;
  const int kMaxBlockSize = 4096;
  if (header->entry_size < kMinBlockSize ||
      header->entry_size > kMaxBlockSize || header->num_entries < 0)
    return false;

  // Make sure that we survive crashes.
  header->updating = 1;
  int expected = header->entry_size * header->max_entries + sizeof(*header);
  if (file_size != expected) {
    int max_expected = header->entry_size * kMaxBlocks + sizeof(*header);
    if (file_size < expected || header->empty[3] || file_size > max_expected) {
      NOTREACHED();
      LOG(ERROR) << "Unexpected file size";
      return false;
    }
    // We were in the middle of growing the file.
    int num_entries = (file_size - sizeof(*header)) / header->entry_size;
    header->max_entries = num_entries;
  }

  FixAllocationCounters(header);
  int empty_blocks = EmptyBlocks(header);
  if (empty_blocks + header->num_entries > header->max_entries)
    header->num_entries = header->max_entries - empty_blocks;

  if (!ValidateCounters(header))
    return false;

  header->updating = 0;
  return true;
}

// We are interested in the total number of blocks used by this file type, and
// the max number of blocks that we can store (reported as the percentage of
// used blocks). In order to find out the number of used blocks, we have to
// substract the empty blocks from the total blocks for each file in the chain.
void BlockFiles::GetFileStats(int index, int* used_count, int* load) {
  int max_blocks = 0;
  *used_count = 0;
  *load = 0;
  for (;;) {
    if (!block_files_[index] && !OpenBlockFile(index))
      return;

    BlockFileHeader* header =
        reinterpret_cast<BlockFileHeader*>(block_files_[index]->buffer());

    max_blocks += header->max_entries;
    int used = header->max_entries;
    for (int i = 0; i < 4; i++) {
      used -= header->empty[i] * (i + 1);
      DCHECK_GE(used, 0);
    }
    *used_count += used;

    if (!header->next_file)
      break;
    index = header->next_file;
  }
  if (max_blocks)
    *load = *used_count * 100 / max_blocks;
}

}  // namespace disk_cache


text:
using System.ComponentModel.DataAnnotations;
using XDASv2Net.Attributes;

namespace XDASv2Net.Model
{
    /// <summary>
    /// A representation of an XDAS action.
    /// </summary>
    public partial class Action
    {
        /// <summary>
        /// Initializes a new instance of <see cref="Action"/>.
        /// </summary>
        public Action()
        {

        }

        /// <summary>
        /// The event identifier in standard XDASv2 taxonomy.
        /// </summary>
        [Required, ValidateObject]
        public virtual Event Event { get; set; }

        /// <summary>
        /// Describes the actual domain specific event that has occurred.
        /// </summary>
        public virtual SubEvent SubEvent { get; set; }

        /// <summary>
        /// Client-specified logging attributes.
        /// </summary>
        public virtual Log Log { get; set; }

        /// <summary>
        /// The time the event occurred.
        /// </summary>
        [Required, ValidateObject]
        public virtual Time Time { get; set; }

        /// <summary>
        /// The XDASv2 taxonomy outcome identifier.
        ///
        /// The outcome code is a hierarchical numeric value much like the event code. Outcome codes indicate
        /// success or a failure class and reason.The success hierarchy is encapsulated by the 0.x sub-arc.
        /// Failure classes are represented by the 1.x hierarchy.Denial codes are represented by the 2.x hierarchy.
        /// </summary>
        [Required]
        [RegularExpression(@"^[0-9]+(\.[0-9]+)*$", ErrorMessage = "Invalid outcome code.")]
        public virtual string Outcome { get; set; }

        /// <summary>
        /// The XDASv2 taxonomy outcome identifier.
        ///
        /// The outcome code is a hierarchical numeric value much like the event code. Outcome codes indicate
        /// success or a failure class and reason.The success hierarchy is encapsulated by the 0.x sub-arc.
        /// Failure classes are represented by the 1.x hierarchy.Denial codes are represented by the 2.x hierarchy.
        /// </summary>
        [Required]
        [RegularExpression(@"^[0-9]+(\.[0-9]+)*$", ErrorMessage = "Invalid extended outcome code.")]
        public virtual string ExtendedOutcome { get; set; }
    }
}


text:
title: Configuration Wizard
page_title: Configuration Wizard - RadHtmlChart
description: Check our Web Forms article about Configuration Wizard.
slug: htmlchart/design-time/configuration-wizard
tags: configuration,wizard
published: True
position: 1
---

# Configuration Wizard

The Visual Designer lets you select a chart layout and chart type, configure series, set properties for	axes, set properties for a chart's title and legend or configure a Navigator pane.	To use the **RadHtmlChart** Visual Designer, open Visual Studio 2012, add a	ScriptManager, and then put a **RadHtmlChart** on the page. Then choose the Design tab	and click Smart Tag to open the **RadHtmlChart** Tasks window. Click the **Open Configuration Wizard** link (**Figure 1**)	to open a dialog box (**Figure 2**), that provides a Visual Designer.

>caption Figure 1: Select Open Configuration Wizard from the Smart Tag of a RadHtmlChart.

![htmlchart-design-time-visual-designer-overview](images/htmlchart-design-time-visual-designer-overview.png)

>caption Figure 2: You can use the Configuration Wizard to select a chart layout and chart type, configure a series,set properties for axes, set properties for a chart's title and legend or configure a Navigator pane.

![htmlchart-design-time-type](images/htmlchart-design-time-type.png)

The tabs and their functionality of the **RadHtmlChart** Configuration Wizard are explained below.

## Type

The Type tab of the Configuration Wizard allows you to select the chart layout and the corresponding chart type you will create.You need to select the layout and the type of the chart first because not all chart series can be combined in the same chart. Selecting the proper type will prevent you from adding a series that will not be supported by the chart layout and the corresponding chart type you will be creating. For example, a **PieSeries** can be the only series in a chart with **Default** or **Sparkline** layout; a Scatter chart cannot host a Line chart because of the different x-axis type, etc.

## Series

The Series tab is where you modify the series collection. In **Figure 3**,	a Bar chart has been selected in the Type tab, so only the BarSeries and LineSeries can be added. Also, onlythe properties that are applicable for the series' type are displayed.

>caption Figure 3: Selecting a Bar chart will limit the series properties and series items that the Configuration Wizard	displays to just the properties that are available for that type of chart.

![htmlchart-design-time-series-tab](images/htmlchart-design-time-series-tab.png)

As **Figure 4** shows, you can set the desired column from the data source using the **DataField** textbox.

>caption Figure 4: Setting a desired column from the data source to the BarSeries.

![htmlchart-design-time-available-data-fields-new](images/htmlchart-design-time-available-data-fields-new.png)

If you want to build a simple or static chart, you can choose to not set a data source and simply add items to the series in the Series Item collection editor below. Once again, the Configuration Wizard only shows properties that are relevant to the type of chart you selected.

>note The Configuration Wizard doesn't override already defined series. That being said, in order to switch to a	different chart type, you must initially remove the inconsistent series and then add the new one.	This is done to prevent data loss. Having a Configuration Wizard does not mean that everything will be set	(or modified) by it, because this would make it very restrictive and unusable.

## X-Axis

You can configure the x-axis of the chart on the next tab - XAxis (**Figure 5**).The Configuration Wizard exposes the most common properties of the axis (even though setting them is not necessary in most cases - the chart will adjust itself to the data). The right side of the XAxis tab features an Axis Items collection editor that lets you add static x-axis items.
>caption Figure 5: The XAxis tab of the Configuration Wizard lets you set common x-axis properties or	add static axis items.

![htmlchart-design-time-x-axis-configurator](images/htmlchart-design-time-x-axis-configurator.png)

## Y-Axis

The YAxis tab of the Configuration Wizard (**Figure 6**) exposes the Y-Axis configuration.On the left is a set of common properties for the main y-axis. On the right, you'll see an AdditionalYAxes collection editor that lets a developer add [additional Y-axes]({%slug htmlchart/functionality/axes/multiple-y-axes%}) and set their basic settings.
>caption Figure 6: The YAxis tab lets you set y-axis properties or add additional Y-axes.

![htmlchart-design-time-y-axis-configurator](images/htmlchart-design-time-y-axis-configurator.png)

## Legend and Title

The Legend, Title tab (**Figure 7**) allows you to set the global properties of the chart related to the legend and the title. The available positions and alignments are provided in dropdowns and the color fill uses a color picker for fine-tuning without using additional color converters. The Text property is, of course, a textbox into which you can enter a custom string.
>caption Figure 7: Use the Legend, Title tab of the Configuration Wizard to set properties for the legend and title of the chart you selected on the Type tab.

![htmlchart-design-time-legend-and-title](images/htmlchart-design-time-legend-and-title.png)

## Navigator

If you want to take advantage of the [Data Navigation]({%slug htmlchart/functionality/data-navigation%}) functionality, you can create and customize a Navigator pane from the Navigator tab (**Figure 8**).

>note This functionality is available only for a Stock layout.

On the left is a set of properties for modifying the hint, x-axis appearance and the date ranges of the selector use calenders for easing the input of DateTime values. On the right, you'll see the availableSeries collection editor that lets a developer add an appropriate series and adjust their corresponding settings.

>caption Figure 8: Use the Navigator tab of the Configuration Wizard to create and customize a Navigator pane, used for Data Navigation functionality of the Stock layout charts.

![htmlchart-design-time-navigator-tab](images/htmlchart-design-time-navigator-tab.png)

## See Also

 * [Series Configuration]({%slug htmlchart/server-side-programming/series-configuration%})

 * [Series Items Configuration]({%slug htmlchart/server-side-programming/series-items-configuration%})

 * [Axes Configuration]({%slug htmlchart/server-side-programming/axes-configuration%})

 * [Navigator Configuration]({%slug htmlchart/server-side-programming/navigator-configuration%})

 * [Overview]({%slug htmlchart/design-time/overview%})

 * [Data Navigation]({%slug htmlchart/functionality/data-navigation%})

 * [Multiple Y-Axes]({%slug htmlchart/functionality/axes/multiple-y-axes%})


text:
package com.jxd.android.bookinventtory.search;

import com.jxd.android.bookinventtory.bean.SearchKeyBean;
import com.jxd.android.bookinventtory.mvp.IPresenter;

/**
 * Created by jinxiangdong on 2017/9/28.
 */
public interface ISearchPresenter extends IPresenter{

    void getSearchKeysListAsync(String key);

    /**
     * 添加关键字
     * @param key
     */
    void addSearchKey(SearchKeyBean key);

    void deleteSearchKey();

}


text:
package Feb2021Leetcode;

public class _0282ExpressionAddOperators {

	public static void main(String[] args) {
		System.out.println(addOperators("123", 6));
		System.out.println(addOperators("232", 8));
		System.out.println(addOperators("105", 5));
		System.out.println(addOperators("00", 0));
		System.out.println(addOperators("3456237490", 9191));
	}

	public static List<String> addOperators(String num, int target) {

	}

}


text:
<?php declare(strict_types=1);

namespace Darvin\AdminBundle\EntityNamer;

/**
 * Entity namer
 */
interface EntityNamerInterface
{
    /**
     * @param object|string $entityOrClass Entity object or class
     *
     * @return string
     */
    public function name($entityOrClass): string;
}


text:
<!doctype html>

    <meta charset="UTF-8">
    <title>Quality builders -login</title>

Log in

<?php //echo base_url('login/verify');?>
        <?php
        echo form_open(base_url('login/verify'),['class' =>'login-container','name' =>'loginform','method' =>'POST'])
        ?>

<input type="text" placeholder="Username" name="username" ng-model="user.username">

<input type="password" placeholder="Password" name="password" ng-model="user.password">

<input type="submit" value="Log in">

            <?php echo (isset($error) ? $error : '');?>

    </form>
<?php //form_close();?>


text:
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics.Contracts;

namespace Tests.Sources
{
  class Base
  {
    public virtual void Test(string arg)
    {
      Contract.Requires<ArgumentException>(!String.IsNullOrEmpty(arg));

    }
  }

  partial class TestMain : Base
  {
    public override void Test(string arg)
    {
    }

    partial void Run()
    {
      if (behave)
      {
        this.Test("foo");
      }
      else
      {
        this.Test("");
      }
    }
    public ContractFailureKind NegativeExpectedKind = ContractFailureKind.Precondition;
    public string NegativeExpectedCondition = "Precondition failed: !String.IsNullOrEmpty(arg)";
  }
}


text:
package JiuChap2_UnionFind_Heap;

import java.util.*;

/**
 * http://www.lintcode.com/en/problem/find-the-weak-connected-component-in-the-directed-graph/
 * Created this class in JiuChap2_UnionFind_Heap at 10:26 PM, 10/29/2015.
 */

public class WeakConnDigraph {

  public static void main(String[] args) {
    WeakConnDigraph wcd = new WeakConnDigraph();
    wcd.test();
  }

  public void test(){
    ArrayList<DirectedGraphNode> nodes = new ArrayList<>();
    DirectedGraphNode yi = new DirectedGraphNode(1);
    DirectedGraphNode er = new DirectedGraphNode(2);
    DirectedGraphNode sa = new DirectedGraphNode(3);
    DirectedGraphNode si = new DirectedGraphNode(4);
    DirectedGraphNode wu = new DirectedGraphNode(5);
    DirectedGraphNode li = new DirectedGraphNode(6);
    DirectedGraphNode qi = new DirectedGraphNode(7);

//    qi.addNei(yi);
//    yi.addNei(er);
//    yi.addNei(si);
//    sa.addNei(wu);
//    si.addNei(er);
//    li.addNei(wu);
//
//    nodes.add(qi);
//    nodes.add(yi);
//    nodes.add(er);
//    nodes.add(sa);
//    nodes.add(si);
//    nodes.add(wu);
//    nodes.add(li);

    yi.addNei(er);
    er.addNei(sa);
    sa.addNei(si);
    si.addNei(er);
    yi.addNei(wu);

    nodes.add(yi);
    nodes.add(er);
    nodes.add(sa);
    nodes.add(si);
    nodes.add(wu);

    List<List<Integer>> result = connectedSet2(nodes);
    for (List<Integer> res : result) {
      System.out.println(res);
    }
  }

  /**
   * @param nodes a array of Directed graph node
   * @return a connected set of a directed graph
   */
  public List<List<Integer>> connectedSet2(ArrayList<DirectedGraphNode> nodes) {
    // Write your code here
    if (nodes == null || nodes.size() == 0) {
      return null;
    }

    List<List<Integer>> result = new ArrayList<>();
    UF uf = new UF(nodes);

    // phase 1: build init uf
    for (DirectedGraphNode node : nodes) {
      for (DirectedGraphNode nei : node.neighbors) {
        int pa_node = uf.find(node);
        int pa_nei = uf.find(nei);
        if (pa_node != pa_nei) {
          uf.union(node, nei);
        }
      }
    }
    uf.printUF();

    System.out.println("----");
    // phase 2: compress UF
    for (DirectedGraphNode node : nodes) {
      uf.compress_find(node);
    }

    uf.printUF();

    System.out.println("----");
//    Map<Integer, List<Integer>> res = uf.findUnion();
//    for (Map.Entry<Integer, List<Integer>> ks : res.entrySet()) {
//      System.out.println(ks.getKey() + " : " + ks.getValue());
//    }

    List<List<Integer>> res = new ArrayList<>();
    Map<Integer, List<Integer>> hashmap = new HashMap<>();
    for (DirectedGraphNode node : nodes) {
      int pa_i = uf.find(node);
      if (!hashmap.containsKey(pa_i)) {
        hashmap.put(pa_i, new ArrayList<>());
      }
      hashmap.get(pa_i).add(node.label);
    }

    for (int i : hashmap.keySet()) {
      List<Integer> list = hashmap.get(i);
      Collections.sort(list);
      res.add(list);
    }
    return res;
  }

  private class DirectedGraphNode {
    int label;
    ArrayList<DirectedGraphNode> neighbors;

    DirectedGraphNode(int x) {
      label = x;
      neighbors = new ArrayList<>();
    }

    public void addNei(DirectedGraphNode x) {
      this.neighbors.add(x);
    }
  }

  private class UF {
    Map<Integer, Integer> father;

    UF(ArrayList<DirectedGraphNode> nodes) {
      father = new HashMap<>();
      for (DirectedGraphNode node : nodes) {
        father.put(node.label, node.label);
      }
    }

    public int find(DirectedGraphNode node) {
      int fa = father.get(node.label);
      while (fa != father.get(fa)) {
        fa = father.get(fa);
      }
      return fa;
    }

    public int compress_find(DirectedGraphNode x) {
      int parent = father.get(x.label);
      while (parent != father.get(parent)) {
        parent = father.get(parent);
      }

      int temp = -1;
      int pa = x.label; //father.get(x.label);
      while (pa != father.get(pa)) {
        temp = father.get(pa);
        father.put(pa, parent);
        pa = temp;
      }
      return parent;
    }

    public void union(DirectedGraphNode p, DirectedGraphNode q) {
      int fa_p = find(p);
      int fa_q = find(q);
      if (fa_p != fa_q) {
        father.put(fa_p, fa_q);
      }
    }

    public void printUF() {
      for (Map.Entry<Integer, Integer> es : father.entrySet()) {
        System.out.println(es.getKey() + " : " + es.getValue());
      }
    }

    public Map<Integer, List<Integer>> findUnion() {
      Map<Integer, List<Integer>> result = new HashMap<>();
      for (Map.Entry<Integer, Integer> ks : father.entrySet()) {
        if (!result.containsKey(ks.getValue())) {
          result.put(ks.getValue(), new ArrayList<>());
          result.get(ks.getValue()).add(ks.getKey());
        }
        else {
          result.get(ks.getValue()).add(ks.getKey());
        }
      }

      return result;
    }
  }
}