new Graph(wrapper, options, axis)
Main class of jsGraph that creates a new graph.
Parameters:
| Name | Type | Argument | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wrapper |
HTMLElement | The DOM Wrapper element |
||||||||||||||||
options |
Graph#options |
<optional> |
The options of the graph |
|||||||||||||||
axis |
Object |
<optional> |
The list of axes Properties
|
- Tutorial: basic
Source:
Tutorials:
Examples
var graph = new Graph("someDomID");
var graph = new Graph("someOtherDomID", { title: 'Graph title', paddingRight: 100 } );
Extends
- EventEmitter
Members
-
options
-
- GraphOptionsDefault
Default Value:
Source:
-
<inner> GraphOptionsDefault
-
Default graph parameters
Properties:
Name Type Description title
String Title of the graph
paddingTop
Number The top padding
paddingLeft
Number The left padding
paddingRight
Number The right padding
paddingBottom
Number The bottom padding
padding
Number | Boolean A common padding value for top, bottom, left and right
fontSize
Number The basic text size of the graphs
fontFamily
Number The basic font family. Should be installed on the computer of the user
plugins
Object.<String, Object> A list of plugins to import with their options
pluginAction
Object.<String, Object> The default key combination to access those actions
wheel
Object Define the mouse wheel action
dblclick
Object Define the double click action
shapesUniqueSelection
Boolean true to allow only one shape to be selected at the time
shapesUnselectOnClick
Boolean true to unselect all shapes on click
Source:
-
<static> registerConstructor
-
Registers a constructor to jsGraph. Constructors are used on a later basis by jsGraph to create series, shapes or plugins
Methods
-
getDom() → {SVGElement}
-
Returns the graph SVG wrapper element
Returns:
( SVGElement )The DOM element wrapping the graph
-
getWrapper() → {HTMLElement}
-
Returns the graph wrapper element passed during the graph creation
Returns:
( HTMLElement )The DOM element wrapping the graph
-
setOption(name, value) → {Graph}
-
Sets an option of the graph
Parameters:
Name Type Description name
String Option name
value
New option value
Returns:
( Graph )- Graph instance
-
setTitle()
-
Sets the title of the graph
-
displayTitle()
-
Shows the title of the graph
-
hideTitle()
-
Hides the title of the graph
-
redraw(onlyIfAxesHaveChanged) → {Boolean}
-
Calls a repaint of the container. Used internally when zooming on the graph, or when
.autoscaleAxes()
is called (see Graph#autoscaleAxes).
To be called after axes min/max are expected to have changed (e.g. after anaxis.zoom( from, to )
) has been calledParameters:
Name Type Description onlyIfAxesHaveChanged
Boolean Triggers a redraw only if min/max values of the axes have changed.
Returns:
( Boolean )if the redraw has been successful
-
draw()
-
Draw the graph and the series. This method will only redraw what is necessary. You may trust its use when you have set new data to series, changed serie styles or called for a zoom on an axis.
-
setWidth(width, skipResize)
-
Sets the total width of the graph
Parameters:
Name Type Description width
Number The new width of the graph
skipResize
Boolean true
to defer graph repaint. Use Graph#resize to force repain later on. (Useful if many graph sizing operations are done successively) -
setHeight(height, skipResize)
-
Sets the total height of the graph
Parameters:
Name Type Description height
Number The new height of the graph
skipResize
Boolean true
to defer graph repaint. Use Graph#resize to force repain later on. (Useful if many graph sizing operations are done successively) -
resize(width, height) → {Graph}
-
Sets the new dimension of the graph and repaints it. If width and height are omitted, a simple refresh is done.
Parameters:
Name Type Argument Description width
Number <optional>
The new width of the graph
height
Number <optional>
The new height of the graph
Source:
See:
Returns:
( Graph )The current graph
-
setSize(width, height)
-
Sets the new dimension of the graph without repainting it. Use Graph#resize to perform the actual resizing of the graph.
Parameters:
Name Type Argument Description width
Number <optional>
The new width of the graph
height
Number <optional>
The new height of the graph
-
getWidth() → {Number}
-
Returns the width of the graph (set by setSize, setWidth or resize methods)
Returns:
( Number )Width of the graph
-
getHeight() → {Number}
-
Returns the height of the graph (set by setSize, setHeight or resize methods)
Returns:
( Number )Height of the graph
-
getPaddingTop() → {Number}
-
Returns the top padding of the graph (space between the top of the svg container and the topmost axis)
Returns:
( Number )paddingTop
-
getPaddingLeft() → {Number}
-
Returns the left padding of the graph (space between the left of the svg container and the leftmost axis)
Returns:
( Number )paddingTop
-
getPaddingBottom() → {Number}
-
Returns the bottom padding of the graph (space between the bottom of the svg container and the bottommost axis)
Returns:
( Number )paddingTop
-
getPaddingRight() → {Number}
-
Returns the right padding of the graph (space between the right of the svg container and the rightmost axis)
Returns:
( Number )paddingRight
-
getDrawingHeight(useCache) → {Number}
-
Returns the height of the drawable zone, including the space used by the axes
Parameters:
Name Type Description useCache
Boolean Use cached value. Useful if one is sure the graph hasn't changed dimension. Automatically called after a Graph.resize();
Returns:
( Number )Height of the graph
-
getDrawingWidth(useCache) → {Number}
-
Returns the width of the drawable zone, including the space used by the axes
Parameters:
Name Type Description useCache
Boolean Use cached value. Useful if one is sure the graph hasn't changed dimension. Automatically called after a Graph.resize();
Returns:
( Number )Width of the graph
-
cacheOffset()
-
Caches the wrapper offset in the page.
The position of the wrapper is used when processing most of mouse events and it is fetched via the jQuery function .offset(). If performance becomes a critical issue in your application,cacheOffset()
should be used to store the offset position. It should be ensured that the graph doesn't move in the page. If one can know when the graph has moved,cacheOffset()
should be called again to update the offset position. -
uncacheOffset()
-
Un-caches the wrapper offset value
-
getXAxis(index, options)
-
Returns the x axis at a certain index. If any top axis exists and no bottom axis exists, returns or creates a top axis. Otherwise, creates or returns a bottom axis Caution ! The
options
parameter will only be effective if an axis is createdParameters:
Name Type Argument Default Description index
Number <optional>
0 The index of the axis
options
Object <optional>
{} The options to pass to the axis constructor
-
getYAxis(index, options)
-
Returns the y axis at a certain index. If any right axis exists and no left axis exists, returns or creates a right axis. Otherwise, creates or returns a left axis Caution ! The
options
parameter will only be effective if an axis is createdParameters:
Name Type Argument Default Description index
Number <optional>
0 The index of the axis
options
Object <optional>
{} The options to pass to the axis constructor
-
getTopAxis(index, options)
-
Returns the top axis at a certain index. Creates it if non-existant
Parameters:
Name Type Argument Default Description index
Number <optional>
0 The index of the axis
options
Object <optional>
{} The options to pass to the axis constructor
-
getBottomAxis(index, options)
-
Returns the bottom axis at a certain index. Creates it if non-existant
Parameters:
Name Type Argument Default Description index
Number <optional>
0 The index of the axis
options
Object <optional>
{} The options to pass to the axis constructor
-
getLeftAxis(index, options)
-
Returns the left axis at a certain index. Creates it if non-existant
Parameters:
Name Type Argument Default Description index
Number <optional>
0 The index of the axis
options
Object <optional>
{} The options to pass to the axis constructor
-
getRightAxis(index, options)
-
Returns the right axis at a certain index. Creates it if non-existant
Parameters:
Name Type Argument Default Description index
Number <optional>
0 The index of the axis
options
Object <optional>
{} The options to pass to the axis constructor
-
setXAxis(axis, index)
-
Sets a bottom axis
Parameters:
Name Type Argument Default Description axis
GraphAxis The axis instance to set
index
Number <optional>
0 The index of the axis
-
setYAxis(axis, index)
-
Sets a left axis
Parameters:
Name Type Argument Default Description axis
GraphAxis The axis instance to set
index
Number <optional>
0 The index of the axis
-
setLeftAxis(axis, index)
-
Sets a left axis
Parameters:
Name Type Argument Default Description axis
GraphAxis The axis instance to set
index
Number <optional>
0 The index of the axis
-
setRightAxis(axis, index)
-
Sets a right axis
Parameters:
Name Type Argument Default Description axis
GraphAxis The axis instance to set
index
Number <optional>
0 The index of the axis
-
setTopAxis(axis, index)
-
Sets a top axis
Parameters:
Name Type Argument Default Description axis
GraphAxis The axis instance to set
index
Number <optional>
0 The index of the axis
-
setBottomAxis(axis, number)
-
Sets a bottom axis
Parameters:
Name Type Argument Default Description axis
GraphAxis The axis instance to set
number
Number <optional>
0 The index of the axis
-
hasXAxis(axis)
-
Determines if an x axis belongs to the graph
Parameters:
Name Type Description axis
Axis The axis instance to check
-
hasYAxis(axis)
-
Determines if an x axis belongs to the graph
Parameters:
Name Type Description axis
Axis The axis instance to check
-
hasTopAxis(axis)
-
Determines if an x axis belongs to top axes list of the graph
Parameters:
Name Type Description axis
Axis The axis instance to check
-
hasBottomAxis(axis)
-
Determines if an x axis belongs to bottom axes list of the graph
Parameters:
Name Type Description axis
Axis The axis instance to check
-
hasLeftAxis(axis)
-
Determines if a y axis belongs to left axes list of the graph
Parameters:
Name Type Description axis
Axis The axis instance to check
-
hasRightAxis(axis)
-
Determines if a y axis belongs to right axes list of the graph
Parameters:
Name Type Description axis
Axis The axis instance to check
-
autoscaleAxes()
-
Autoscales the x and y axes of the graph
Repains the canvas- Find a solution for rescaling the y axis: if the x axis is
Source:
To Do:
-
getBoundaryAxis()
-
Calculates the minimal or maximal value of the axis. Currently, alias of getBoudaryAxisFromSeries
-
getBoundaryAxisFromSeries(axis, minmax) → {Number}
-
Calculates the minimal or maximal value of the axis, based on the series that belong to it. The value is computed so that all series just fit in the value.
Parameters:
Name Type Description axis
GraphAxis The axis for which the value should be computed
minmax
minmax The minimum or maximum to look for. "min" for the minimum, anything else for the maximum
Returns:
( Number )The minimimum or maximum of the axis based on its series
-
getSeriesFromAxis(axis) → {Array.<Serie>}
-
Returns all the series associated to an axis
Parameters:
Name Type Description axis
GraphAxis The axis to which the series belong
Returns:
( Array.<Serie> )An array containing the list of series that belong to the axis
-
updateDataMinMaxAxes()
-
Determines the maximum and minimum of each axes, based on Graph#getBoundaryAxis. It is usually called internally, but if the data of series has changed, called this function to make sure that minimum / maximum of the axes are properly updated.
-
_applyToAxes(func, params, topbottom, leftright)
-
Applies a function to axes. The function will be executed once for every axis. If func is a string, the internal function belonging to the axis will be called, with the params array flattened out (in this case, params must be an array). If func is a function, the function will be called with the axis, its type and params as parameters. See AxisCallbackFunction for more details.
Parameters:
Name Type Default Description func
AxisCallbackFunction | String The function or function name to execute
params
Extra parameters to pass to the function
topbottom
Boolean false True to apply to function to top and bottom axes
leftright
Boolean false True to apply to function to left and right axes
-
findAxesLinkedTo(axis) → {Array.<Axis>}
-
Axes can be dependant of one another (for instance for unit conversions) Finds and returns all the axes that are linked to a specific axis. Mostly used internally.
Parameters:
Name Type Description axis
GraphAxis The axis that links one or multiple other dependant axes
Returns:
( Array.<Axis> )The list of axes linked to the axis passed as parameter
-
newSerie(name, options, type) → {Serie}
-
Creates a new serie
If the a serie with the same name exists, returns this serie with update options
The type of the serie is used to fetch the corresponding registered constructor registered with the name "graph.serie.", e.g "line" will fetch the "graph.serie.line" prototype (built-in)
Built-in series types are "line", "contour", "zone" and "scatter".Parameters:
Name Type Description name
String The name of the serie (unique)
options
Object The serie options
type
Type The type of the serie.
Returns:
( Serie )The newly created serie
-
getSerie(name) → {Serie}
-
Looks for an existing serie by name or by index and returns it. The index of the serie follows the creation sequence (0 for the first one, 1 for the second one, ...)
Parameters:
Name Type Description name
String | Number The name or the index of the serie
Returns:
-
getSeries() → {Array.<Serie>}
-
Returns all the series
Returns:
( Array.<Serie> )An array of all the series
-
drawSerie(serie, force)
-
Draws a specific serie
Parameters:
Name Type Description serie
Serie The serie to redraw
force
Boolean Forces redraw even if no data has changed
-
drawSeries(force)
-
Redraws all visible series
Parameters:
Name Type Description force
Boolean Forces redraw even if no data has changed
-
removeSeries()
-
Removes all series from the graph
-
selectSerie(serie, selectName)
-
Selects a serie. Only one serie per graph can be selected.
Parameters:
Name Type Default Description serie
Serie The serie to select
selectName
String "selected" The name of the selection
-
getSelectedSerie() → {Serie|undefined}
-
Returns the selected serie
Returns:
-
unselectSerie(serie)
-
Unselects a serie
Parameters:
Name Type Description serie
Serie The serie to unselect
-
getShapesOfSerie(serie) → {Array.<Shape>}
-
Returns all the shapes associated to a serie. Shapes can (but don't have to) be associated to a serie. The position of the shape can then be relative to the same axes as the serie.
Parameters:
Name Type Description serie
Serie The serie containing the shapes
Returns:
( Array.<Shape> )An array containing a list of shapes associated to the serie
-
getShapes()
-
Returns all shapes from the graph
-
newShape(shapeType, shapeData, mute) → {Shape}
-
Creates a new shape. jsGraph will look for the registered constructor "graph.shape.
". Parameters:
Name Type Argument Default Description shapeType
String The type of the shape
shapeData
Object <optional>
The options passed to the shape creator
mute
Boolean <optional>
false true
to create the shape quietly- Graph#getConstructor
Source:
See:
Returns:
( Shape )The created shape
-
newPosition(var_args)
-
Creates a new position. Arguments are passed to the position constructor
Parameters:
Name Type Argument Description var_args
* <repeatable>
-
redrawShapes()
-
Redraws all shapes. To be called if their definitions have changed
-
removeShapes()
-
Removes all shapes from the graph
-
selectShape(shape, mute)
-
Selects a shape
Parameters:
Name Type Description shape
Shape The shape to select
mute
Boolean Select the shape quietly
-
unselectShape(shape, mute)
-
Unselects a shape
Parameters:
Name Type Description shape
Shape The shape to unselect
mute
Boolean Unselect the shape quietly
-
unselectShapes(mute) → {Graph}
-
Unselects all shapes
Parameters:
Name Type Argument Default Description mute
Boolean <optional>
false Mutes all unselection events
Returns:
( Graph )The current graph instance
-
getPlugin(pluginName) → {Plugin}
-
Returns an initialized plugin
Parameters:
Name Type Description pluginName
String Returns:
( Plugin )The plugin which name is
-
makeLegend(options)
-
Creates a legend. Only one legend is allowed per graph
Parameters:
Name Type Description options
Object The legend options
-
updateLegend()
-
Redraw the legend
-
kill()
-
Kills the graph


Don't have an account yet ? Create an account


|
Generic Inliner
<IP_ADDRESS>
A base for making inliners for .NET deobfuscation
|
Public Member Functions | |
| void | Process (IAssemblyHelper asmHelper) |
| This function is called when the inlining process is being executed. It is the only function that is executed by the plugin loader. More... | |
Static Public Member Functions | |
| static double | Pow (double x, double y) |
Public Attributes | |
| IAssemblyHelper | asm |
| int | DecimalPlaces = 2 |
| bool | Round |
| List< string > | IgnoredMethods = new List<string>() |
Properties | |
| string | Name [get] |
| string | Author [get] |
| string | Description [get] |
| int | Priority [get] |
| List< PluginControl > | Controls [get] |
| Version | Version [get] |
| Properties inherited from ClientPlugin.Models.IGenericInliner | |
| string | Name [get] |
| The name of the plugin More... | |
| string | Author [get] |
| The author of the plugin More... | |
| string | Description [get] |
| The description of the plugin, keep it short! More... | |
| int | Priority [get] |
| The priority of the plugin, it will determine which plugin should be executed before another. More... | |
| Version | Version [get] |
| The version of the plugin More... | |
| List< PluginControl > | Controls [get] |
| The associated ClientPlugin.UI.PluginControl list that will be displayed on the 'Plugin Settings' page. More... | |
| void MathInliner.MathInliner.Process | ( | IAssemblyHelper | asmHelper | ) |
This function is called when the inlining process is being executed. It is the only function that is executed by the plugin loader.
| asmHelper |
Implements ClientPlugin.Models.IGenericInliner.


Default
Responsive picture
Responsive
Background (Object fit)
Background (min width / height)
Background center (min width / height)
Background image css
Background in component
Card title
Card title
Card title
Card title
Background in component
Card title
Card title
Card title
Card title


Class hQuery_Node
Base class for HTML Elements and Documents.
used internally
- hQuery_Node implements Iterator, Countable
Direct known subclasses
Indirect known subclasses
Methods summary
protected
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
string
|
|
public
string
|
|
public
string
|
|
public
string
|
|
public
integer
|
|
protected
array
|
|
protected
array
|
|
protected
array
|
|
protected
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
protected static
|
|
public static
|
|
public static
|
|
public static
|
|
public static
|
|
public static
|
|
public static
|
|
public static
|
Properties summary
public static
|
$last_http_result
|
|
public static
|
$selected_doc
|
#
NULL
|
protected
|
$_prop
|
|
protected
|
$doc
|
|
protected
|
$ids
|
|
protected
|
$exc
|
|
public
|
$tag_map
|
|
public static
array
|
$_ar_
|
#
array()
|
public static
integer
|
$_mi_
|
#
PHP_INT_MAX
|
public static
|
$_nl_
|
#
NULL
|
public static
boolean
|
$_fl_
|
#
false
|
public static
boolean
|
$_tr_
|
#
true
|


The data displayed is for informational purposes and can not be edited. This information is obtained once by the Lattice PCIe driver when the Operating System detects the board and loads the driver. Displaying this page does not cause the driver to issue PCI Config Type 0 read requests.
Of interest are the Root Complex's initial credits (bottom of Xfer Info) and PC Common DMA Buffer size and address. The PCIe link capabilities are displayed in the Capabilites Registers tab. The link negotiated width, speed, Max Read Size, Max TLP Size and RCB size are displayed.
There are two modes of operation: Cycles and Throughput.
Throughput - This mode allows the test to run continuously, looping through the tx_fifo and updating the performance numbers every second. This test will run until the user presses the STOP button.
Cycles - This mode allows the user to setup a specific number of times the tx_fifo will be looped. Once complete, the test will stop automatically and the performance numbers will be displayed based on the entire run. Note: the maximum duration of the cycles test is 1 second.
The key difference between the two modes is how the performance data is displayed. A throughput test will provide new performance data every second. A cycle test will provide performance data after the number of cycles completes, or one second, whichever comes first. Note that cycles will not run longer than one second. Cycles tests run once; throughput tests run continuously until stopped.
There are 4 types of TLP types which impact the type of traffic sent over the PCIe link.
MWr - Memory Write TLPs to write data from the endpoint to the PC system memory.
MRd - Memory Read TLPs to read data from PC system memory to the endpoint.
MRd+MWr - Both Memory Read and Memory Write TLPs are sent to the root complex.
R+W+Ctl - Read, Write, and Control data are present on the PCIe link. The Read and Write TLPs are sent from the SFIF while the PC is also modifying the GPIO 16-segment display LEDs. This TLP type shows both data and control plane TLPs sharing the PCIe link.
The TLP size controls allows the user to select the size of the TLPs to be sent from the SFIF. The maximum size of the TLP will be dependent on the root complex. In MRd mode, the TLP size is limited by the Max. Read Request size (512 bytes). In MWr mode, the max TLP size is limited by Max. TLP Size (128 bytes). In Read/Write mode the following sizes are available for MRd TLP and MWr TLP combinations.
512/128 - 512 byte Read requests with 128 byte Write TLPs
256/128 - 256 byte Read requests with 128 byte Write TLPs
128/128 - 128 byte Read requests with 128 byte Write TLPs
64/64 - 64 byte Read requests with 64 byte Write TLPs
32/32 - 32 byte Read requests with 32 byte Write TLPs
16/16 - 16 byte Read requests with 16 byte Write TLPs
This control allows the user to select the ratio of Read requests to Write TLPs.
1Rd,1Wr - This ratio results in 1 Read Request and 1 Write TLPs back to back. The completion data will need to be received before another Read Request can be made.
1Rd,4Wr - This ratio results in 1 Read Request and 4 Write TLPs. The completion data will need to be received before another Read Request can be made. This results in much greater bandwidth since read requests are 4 times the size of a write TLP. This ratio balances the PCIe link, but still waits for read data.
4Rd,16Wr - This ratio results in 4 Read Requests and 16 Write TLPs. This ratio allows for 4 read requests to be outstanding (TAGs). This ratio is only recommended on server class motherboards due to the high bandwidth required. With 4 reads outstanding the root complex can better utilize the read data.
16Rd,64Wr - This ratio results in 16 Read Requests and 64 Write TLPs. This ratio allows for 16 read requests to be outstanding (TAGs). This ratio is only recommended on server class motherboards due to the high bandwidth required. With 16 read outstanding the root complex can better utilize the read data.
This control is only available when the Cycle mode has been selected. This controls the number of times the tx_fifo is looped before ending the test. The software starts the SFIF and waits one second while the SFIF transfers data (number of cycles). After one second, the software stops the SFIF and displays the performance. This has the effect of limiting cycles tests to a maximum of one second of operation. The cycles value cannot be larger than 65535 (it is a 16-bit counter).
In Throughput mode this control is not used. In Throughput mode the SFIF is looping the tx_fifo continuously until the user presses the STOP button.
This control sets the number of 125MHz clock cycles between cycles. This control allows for modeling TLP traffic patterns that may be appropriate for a userís system. The ICG value cannot be larger than 65535 (it is a 16-bit counter).
Data rates are displayed as progress bars, with the rate (MB/sec) displayed in the bar. The bars are updated every second when running in the Throughput mode or upon completion in the Cycles mode. The rates are computed from the hardware counters in the SFIF.
Write rates are computed from the following SFIF hardware counters: Tx TLP Count and Elapsed Count.
Write Rate (MB/sec) = (Tx TLP Count * TLP Size) / (Elapsed Count * 8ns)
Read rates are computed from the following SFIF hardware counters: Rx TLP Count and CplD Timestamp.
Read Rate (MB/sec) = (Rx TLP Count * RCB_Size) / (Elapsed Count * 8ns)
RCB_Size is the size in bytes of a CplD.
In Throughput mode the performance is recalculated every second and the counters are reset. In Cycles mode the performance is calculated once at the end of the run displaying the results for the entire transfer.
Time spent waiting for the root complex to accept TLPs is computed and displayed as a bar graph in percentage of time waiting over time spent running. Normal efficient operation should show a small percentage of time spent waiting for credits and more time spent sending TLPs.
Counters record when the SFIF wants to send a MRd but the credit available ports of the PCIe core indicates the root complex has not yet processed the read requests. The PCIe core is waiting to accept an UpdateFC-NP freeing up Non-Posted credits to send another MRd TLP.
Counters record when the SFIF wants to send a MWr but the credit available ports of the PCIe core indicates the root complex has not yet processed the previously sent write TLPs. The PCIe core is waiting to accept an UpdateFC-P freeing up Posted credits to send another MWr TLP.
The Report box provides details about the test. In the Throughput mode this report will be updated every second up to 10 seconds. After 10 seconds the data is no longer updated in the report box to prevent system load and excessive resource usage during long duration tests (over night). In the Cycles mode the report window is updated when the test is complete.
The SFIF RX FIFO contents is valid only after a test that contains MRD requests. The FIFO will then contain CplD data. If the total transfered size of the test is less than 16kB (including TLP headers and timestamps) then the contents are parsed on a TLP basis and compared with the source pattern in the PC Common Buffer.
If the MRd length is greater than the 16kB FIFO, then the raw data contents are displayed. The Rx FIFO contains a series of timestamp words, the TLP header and the CplD payload.
The following block diagram shows a high level view of the IP blocks within the Lattice FPGA.
The SFIF IP design allows the user to use the PCIe link as both the control plane and data plane. For the control plane 1DW Memory Requests can be made through the Completer block. This block converts PCIe TLP Memory Requests into Wishbone bus cycles. Both BAR0 and BAR1 are mapped to the same address space as defined below.
|
BAR0/1 |
Wishbone Bus |
|
Address (Hex) |
Device Description |
|
0x00000000 |
GPIO |
|
0x00010000 |
SFIF |
|
0x00040000 |
EBR |
Using the Completer block the user can load the SFIF and exercise the data plane.
The SFIF details are shown in the following figure.
The SFIF is made up of the following blocks.
Wbs - This module is responsible for transactions on the wishbone bus.
Tx_fifo - This module stores up to 16KBs of TLPs loaded from the WBs to send over the PCIe link
Rx_fifo - This module stores completions from the PC memory from read requests. It is 16kB deep.
Ctrl - This module includes a state machine to perform all of the SFIF features such as looping through the tx_fifo and providing an inter TLP gap (IPG).
Ca - This module is responsible for checking if credits are available to send the current TLP.
Ta - This module is responsible for checking if the tag is available for the next read request.
Cr - This module is responsible for freeing CPL credits once completions are received.
The SFIF works by loading TLPs into the tx_fifo via the wishbone bus. Once the TLPs are loaded into the tx_fifo the user can determine how many times to iterate through the tx_fifo (cycles) and how much gap to provide between the loops (IPG). The user then runs the SFIF and plays out the tx_fifo over the PCIe link. The SFIF transmitter will honor the credits available reported by the PCIe core. It will also make sure not to use an outstanding request's TAG value on a read request.
The rx_fifo will monitor the receive bus of the PCIe link waiting for completion TLPs with data. These TLPs will be stored in the rx_fifo. As TLPs are stored in the FIFO, CPL credits are released to the system allowing the system to send more completions. Each CPLD TLP is stored along with a timestamp to mark the latency of read operations.
As shown, the SFIF configuration registers are accessed at base address 0x1000 on the Wishbone Bus. The GUI software will address the registers in this range to setup the configuration registers, load the SFIF tx_fifo, and read the SFIF rx_fifo.
The register map for the SFIF is:
|
Name |
Addr (hex) |
Width |
Access |
Description |
|
Control |
0 |
32 |
RW |
Controls operation of SFIF |
|
Tx TLP Control |
4 |
32 |
W |
Tx TLP control of loading TLP into FIFO |
|
Tx IPG Control |
8 |
16 |
RW |
Tx Inter TLP Gap control |
|
Tx TLP Data |
c |
32 |
W |
DW of TLP data |
|
Rx TLP Data |
10 |
32 |
R |
DW of Completion TLP data |
|
Elapsed Count |
14 |
32 |
R |
Number of clock cycles in current run |
|
Tx TLP Count |
18 |
32 |
R |
Number of Tx TLPs sent in current run |
|
Rx TLP Count |
1c |
32 |
R |
Number of CplDs received in current run |
|
Credit Wait P |
20 |
32 |
R |
Number of clock cycles waiting for Posted Credits in current run |
|
CplD Timestamp |
24 |
32 |
R |
Timestamp for last CplD |
|
Credit Wait NP |
28 |
32 |
R |
Number of clocks cycles waiting for Non-Posted Credits or Tags in current run |
The remaining IP in the demo design is used as simple testing blocks and are not part of the demo. The GPIO block is used to read the DIP switches and control the 16-segment LEDs. It also has the ability to generate an interrupt via the PCIe core. The 32K EBR is again simply used for testing data movement via the completor block and is not part of the demo.
|
BAR1 |
Location |
|||
|
Offset (Hex) |
Byte 3 [31:24] |
Byte 2 [23:16] |
Byte 1[15:8] |
Byte 0 [7:0] |
|
0000 |
ID Register |
|||
|
0004 |
Scratch Pad Register |
|||
|
0008 |
DIP Switch |
rsvd |
16 Segment LED upper 8 bits lower 8 bits |
|
|
000C |
rsvd |
rsvd |
rsvd |
Counter ctrl |
|
0010 |
Current Counter Value |
|||
|
0014 |
Counter Reload Value |
Ensure the board has a valid PCIe SFIF bitstream loaded in the SPI flash and for ECP2M that the Mode DIP switches are set to program from SPI flash (does not apply to SC eval boards).
Ensure the 4 Status LEDs are on, indicating the board is seen as a PCIe endpoint. If the 2 yellow LEDs and 2 green LEDs are not on, the board will not be recognized by the PC BIOS or Windows. You can try installing in a different PCIe slot to see if that fixes the link-up problem. You can also try pressing the Eval Board's reset button immediately after the PC boots.
Ensure the board is seen by Windows. Check My Computer->Properties->Hardware->Device Manager and verify the lscpcie2 driver and eval board are shown in the list. If not, shutdown the system and try another slot. If the board is present, check its Properties and the Resource tab to verify memory was assigned to it. Also verify the Vendor ID and Device ID are valid, as seen by Windows Plug-n-Play. If the values are invalid, perhaps the bitstream is not the SFIF demo or is corrupt and needs to be reloaded into SPI flash.
Make sure you specify the search location for the driver during installation. Tell Windows to install from the C:\Program Files\LatticeApps\Drivers directory.
You may need administrator permission to install device driver files.
If the GUI displays an error (ERROR LOADING LIBRARY:Cpp_Jni - running in View Only mode) when launched, then the driver could not be found or loaded. There are 2 probable causes
Right-click on the My Computer icon and select Properties to bring up Device Manager. The Device Manager provides software driver information for devices detected by Windows Plug-n-Play manager. The most useful utility is to verify that the lscpcie2 driver has been installed and associated with the board. Double click on the Lattice board icon to bring up the device and driver details tabs.
The Linux distribution needs to have the udev service running. You may also need the kernel development package (just the header files, not the complete source package) installed if you need to rebuild the drivers from their source.
If you get errors during install such as FATAL: Error inserting lscpcie2... then you will need to rebuild the
drivers to match your Linux kernel and distribution.
This can be done by simply running make drivers
.
If probelms are encountererd, see the documentation in the lscpcie2 or lscdma
driver source for details on building from the source.
You may also need to rebuild the demo applications from the source if the Linux kernel and distribution
varies greatly. Simply run make demos
.
Ensure the board has a valid PCIe bitstream loaded in the SPI flash (and if applicable, that the Mode DIP switches are set to program from SPI flash).
Ensure the 4 Status LEDs are on, indicating the board is seen as a PCIe endpoint. If the 2 yellow LEDs and 2 green LEDs are not on, the board will not be recognized by the PC BIOS or OS. You can try installing in a different PCIe slot to see if that fixes the link-up problem. You can also try pressing the Eval Board's reset button immediately after the PC boots.
The eval board must be installed in the PC, and seen by Linux for the demo (and driver) to operate properly.
Check that the board is seen with the command: /sbin/lspci
This will display all enumerated PCI and PCIe devices in the system. Look for a Lattice board.
If the board is not listed (vendor ID = 0x1204) then try another PCIe slot. Also verify the 4 PCIe link status LEDs
are all lit.
If the board is seen with lspci, then verify the 16 segment LED is displaying an "I", which means the driver has initialized the board. If the "I" is not displayed then see the next section.
/sbin/lsmod
- The output should list either the lscpcie2 or lscdma drivers are loaded.
dmesg
- This displays error and status messages from the driver during its load and operation.
Normal builds will not have much debug info present, but error conditions and warnings will be logged.
The log entry will be prefixed with lscpcie2 or lscdma.
/dev
- check for lscpcie2 or lscdma device nodes in the /dev directory. If they
are not present (and the driver module is loaded) then the driver did not find any boards. Check for errors with dmesg.
/sys/class
- check for lscpcie2 or lscdma class types in the directory. If they
are not present (and the driver module is loaded) then the driver did not find any boards. Check for errors with dmesg.
The driver directories under each demo contain script files to manually load and remove the driver for debugging.
Try running insdrvr debug=1
to insert the driver and enable debugging. Check the driver messages with
dmesg. Use rmdrvr to remove the driver and try inserting again.
Remember, you will probably need to rebuild the driver to match your Linux kernel distribution. Do not expect the distributed driver binary to work on all Linux systems.
If you can not get the driver to load, please contact Lattice Support for further assistance.
If the GUI displays an error (ERROR LOADING LIBRARY:Cpp_Jni - running in View Only mode) when launched, then the driver could not be found or loaded. There are 3 causes
/sbin/lsmod
- The output will list drivers loaded in the system.
dmesg
- This displays error and status messages from the kernel and drivers.
cat /proc/devices | grep lsc
- checks for lscpcie2 or lscdma devices detected
cat /proc/modules | grep lsc
- checks for lscpcie2 or lscdma drivers installed
cat /proc/interrupts
- displays interrupt connectivity of driver/board when demo is running
cat /proc/driver/lscpcie2
- displays driver parameter information
cat /proc/driver/lscdma
- displays driver parameter information


(PHP 5 >= 5.5.0, PHP 7)
cli_get_process_title — Returns the current process title
Returns the current process title, as set by cli_set_process_title(). Note that this may not exactly match what is shown in ps or top, depending on your operating system.
This function is available only in CLI mode.
此函数没有参数。
Return a string with the current process title or NULL
on error.
An E_WARNING
will be generated if the operating system
is unsupported.
Example #1 cli_get_process_title() example
<?php
echo "Process title: " . cli_get_process_title() . "\n";
?>


Next:
Traversal Rules and Side Effects
, Previous:
Lambda Lists
, Up:
Evaluation and Compilation
3.5 Error Checking in Function Calls
•
Argument Mismatch Detection
:


How to build a whole home energy monitor
This page and the linked pages detailed below, document how to build whole house energy monitor that displays current energy use information, can do usb data logging and has Internet connectivity for online graphing.
First a quick look at the installed setup:
The Display
The display unit consists of 4 large green 7-segment LEDs. On the right is a mode chooser you operate by turning the potentiometer (bottom – right) to display real power, apparent power, power factor, RMS Voltage, RMS Current, frequency or cumulative kWh used. The display is connected to the main unit by a cable that goes through the wall at the back of the display.
The Main unit
The main unit is the small box in the far left of pic below with the white CT sensor wire crossing the shelf over to the sensor clipped on to an AC-mains wire on the right. The main unit contains the Arduino, voltage and current measurement electronics, power electronics, USB pen datalogger and Xbee wireless link.
The Ethernet unit
The Ethernet unit is connected to the router. The small box on top of the larger box houses the wireless Xbee link.
Web based graphing
Below is a screenshot of the web based graphing that can be seen live here.
Graphing is done with flot.
For more pictures of the setup, check out the picasa album here.
Main Features:
- Voltage measurement via AC to AC adapter
- Current measurement via CT sensor.
- Power for sensor board provided with same AC to AC adapter used for voltage measurement.
- Calculation of Real power, Apparent power, power factor, RMS voltage, RMS current, frequency, cumulative kWh.
- Display unit consisting of large green 7-segment display,
- Mode selector and red/green LED indicator to indicate if grid frequency is above or below 50Hz.
- USB pen data logging using VDIP1 board
- Xbee wireless link from sensor unit to the Ethernet unit.
- Ethernet board for logging and graphing on Internet.
- Flot based graphing on website.
The block diagram below details the overall setup:
How the documentation works
The documentation is organised in such a way that each major part in the above setup is covered independently so that each part can be tested to ensure it works. There is a section at the end about bringing each part together to complete the build. Hopefully this way, it will be easier to troubleshoot if things don't work, and make it easier to bring the parts together in different configurations, and use them for other projects.
Apart from the measurement board, each section has been documented by others to some extent, so there will be links to the tutorials I found useful, and I will add the only relevant details and adaptations if any.
Measurement board
Note: This guide needs updating to be consistent with version 3.0 of the mains AC- non invasive energy monitor.
The measurement and power board consists of the electronics required to convert signals from the CT sensor and AC power adapter to signals in the voltage range suitable for the Arduino analogue inputs. It also contains components to convert the AC from the adapter to DC for the Arduino. Currently, it works with single-phase 2 wire distribution system as is common in many UK homes. If you're in the US, and have a split-phase 3-wire system and would like to help adapt the design for the 3-wire system, please contact me.
USB data logger board
USB pen drive datalogging is done using a Viniculum VDIP1 USB host controller board and a write-start/stop button and indicator, to safely start/stop/remove the pen drive. The datalogger makes it possible to store large quantities of high detail data over a long time.
How to build the Display unit
How to build the 7-segment display using a MAX7221 and a mode selector using a shift register and potentiometer.
Xbee wireless link
Point-to-point wireless serial link via Xbees. Connection between the main unit and the Ethernet unit. The Xbees relay serial messages between the Arduinos. A wire connection can be used instead of the Xbees without changing the Arduino sketches.
Ethernet unit and web based Flot graphing.
How to send data to a MySQL database using the Ethernet shield and a Perl script on the server and how to graph the data in the database with flot.
Bringing it all together
Once you have each section working independently, the next step is to get them all working together. The wiring diagram below shows how each major part is connected together and how the I/O of the Arduinos are configured:
The pictures at these links may be of use when deciding how to route wires and position the various parts:
Main unit assembly | Installed energy monitor | Measurement board assembly
And here's a short description of how to build an enclosure
Arduino Software
Here are the complete Arduino sketches for the main and Ethernet units. They are made up of the stand-alone sketches from each section above. So if you're wondering how one part works, or want to use, say the usb data-logger section, in another project, then have a look at the stand alone code.
I tried to annotate them as best I could, so I wont cover how they work here, but let me know if anything is not clear.
Download: MainSketch27Jan.tar.gz
Download: EthernetSketch27Jan.tar.gz
Full parts list
Here's the full parts list. It contains links to suppliers (mainly Farnell), prices and alternative parts to reduce the project cost.
Quick cost breakdown
Measurement Board: £12.68
Xbee link: £54.32
Xbee link cable: £0.57
DataLogger: £15.44
Display: £19.56
Display cable: £1.53
Ethernet shield: £29.00
2 Arduino's: £41.16
Total: £174.25!!!
Thats a bit steep I know! I've been looking at how to bring it down a bit. If the Xbee wireless connection is replaced with a simple RF link, the Nuelectronics Ethernet shield and Arduinos are used with a display based on an SAA1064 driver chip, the overall cost can be reduced to £91.71. I've added details on the alternate components including links to suppliers, and tutorials, in the spreadsheet. I'm hoping to get a chance at making a lower cost version soon as I may be building an energy monitor for the local community center here. I will update as soon as there are any developments.
Re: Home energy monitor
is it possible if we change the output of the Xbee linking to a GSM module so that the design would be SMS based??this is the concept our group have.. :D
Re: Home energy monitor
Hello, i am trying to build this power monitor here in the philippines, is there any available schematic diagram by this time?tnx for the help!! :)
Re: Home energy monitor
Hello, i am trying to build this power monitor here in the philippines, is there any available schematic diagram by this time?tnx for the help!! :)
Re: Home energy monitor
Hello, where i find the schematic and .hex for this project?
Re: Home energy monitor
Im afraid there is no schematic for the project as a whole, but each module is independantly documented either with schematics from me or linked to schematics of that particular part by others on other sites.
Re: Home energy monitor
MainSketch27Jan.tar.gz
Does this sketch incorporate all the sketches of the Xbee, data logger, display, measurements?? because when I open it, it opens all those together, so are they run together?
Re: Home energy monitor
Dear all,
I am trying to download a sketch, i.e. for example MainSketch27Jan.tar.gz
How do I install and open them in Arduino pls?
Thx
Re: Home energy monitor
you just have to open them with winrar and then just run them
Re: Home energy monitor
Hello!
I love this site! Thanks for putting all the info on here.
I'm working on developing a open source wireless module using the atmega128rfa1 micro. My goal is to have a wireless IPv6 (6LoWPAN) network formed with them. One of the things I planned to do/make with them was a whole house power monitor system. I've got several "modules" in the pipe before a power monitor, but once I get the software working, I think I can crank out new PCB designs pretty quickly. I'm thinking the cost of the board and electronics for the monitor would be around $15-$20 USD. Couple that with 2 CT sensors, a voltage sensor, and a $40 "gateway" USB stick (Atmel's Raven USB stick), and the cost goes down quite a bit. The drawback is you actually have to run a IPv6 network translation between the USB stick and your server. I also haven't figured out any of the application layer software yet (like server client TCP port communications).
I'm documenting the progress on my blog.
Re: Home energy monitor
cant seem to comment on your blog the resistor color code captcha doesnt seem to work?


Class controllerProcessExcel
Handles AJAX calls to process excel files
Create a new object and call handleRequest. Gets the request options for the Excel file and sets an object with those options. The object is passed to a loader where it is filled with data. The resulting data is returned as a JSON object. The JSON string is then returned.
public
string
|
|
private
string
|
private
mixed
|
$requestData | NULL |


---
layout: post
title: Hotxt
date: 2006-11-16 00:00:00
categories: business digital-media mobile personal social
---
' ...and here's a great example of one of those PR companies engaging bloggers: I was invited to meet Doug and David of Hotxt for a chat this afternoon.
It was interesting to talk through their product and how they see the industry; I didn't learn anything much about their product roadmap (which is hardly surprising), but I have a few notes from our conversation, things which sparked thoughts or struck chords:
- There's an asynchronicity to text messaging which IM lacks, and which is attractive in itself;
- Hotxt users are surprisingly enthusiastic about the web as a means of access to the Hotxt service (though I suspect that when you're launching a mobile proposition this puts you in competition alongside a whole set of businesses you're looking to radically differentiate yourselves from, and forces you to put effort into competing with them);
- The Hotxt service has gone free partly to "build an audience", and more interestingly because compliance with ICSTIS regulations around handling of premium SMS services were off-putting to customers;
- Anonymity and control of your own identity are a big advantage of a service like this over raw SMS (where you're effectively giving away your mobile number with every message you send);
- As online social services grow, they're taking market share away from the dating companies - who are in turn forced to focus on niche communities to survive;
- Operators are really bad at billing accurately for mobile data usage - Doug told a story about his daughter Hotxting from China and not paying a penny in charges;
- Services like group messaging are where Hotxt plan to differentiate themselves from the competition: augmenting text messaging rather than replacing it;
Good fun. Dragons Den doesn't do Doug justice.


`5f41fa8` Dev (#33) - gcharang
`35597e3` Fix typo: me - > be - Cris-F
`fadfccd` Fix typo: me - > be (#34) - gcharang
`e7358e6` Merge branch 'master' into dev - gcharang
When you have a lot of transaction history in atomicdex wallet with certain coin and you go through those transactions by scrolling down them and every time wallet is updating transactions from spv servers wallet reset to most view history to most recent transaction. This makes impossible to check transactions in that time period especially when there are lot of transaction to scroll down and search it in time between checks from SPV.
After scanning the QR code, the following string is put into the address field:
{"address":"R...","amount":"1","coin":"KMD"}
which is not accepted as a valid address.
I can confirm this problem with 0.2.7 on iOS. It's impossible to view old KMD transactions since after scrolling down to them, after 1-2 seconds, the page "resets" itself and jumps back to the newest transactions.
Performs similarly for me.
QR scanner supposed to read QR address to send to. And it's what it does in a way - reads json in Agama QR and pastes it to Address field.
We will consider to add json scans support as feature.
I had another instance with a QR code generated from an older version of the Ledger Live App (the wallet software for the Ledger Nano S hard wallet). After scanning its QR code, a string like
komodo:R...
was put into the address field which was also not a valid address. Not reproducable with the latest version of Ledger Live app anymore, however. But still maybe something to consider.
Some times one of my mm2 nodes start showing this error on console:
23 00:00:30, http_fallback:621] hf_poll 500 from <IP_ADDRESS>:80: http_fallback:155] Payload too big.
23 00:00:30, peers:1344] hf_poll error: http_fallback:606] http_fallback:627] http_fallback:531] HTTP status 500 Internal Server Error
it happens only on that node (one with many coins) and only with that seed node
there are 2 other seed nodes up and they also have http_fallback (listening on port 80)
quick hackaround for 404 on the current 1.0.15 as reported by @cipig - we re debugging a 1.0.18 build and will update this entry accordingly if all tests pass.
cc: @tonymorony @DeckerSU @Alrighttt
related to: https://github.com/zcash/zcash/issues/4238


The existing chess variants (CVs) use an enormous wide of different concepts in their rules. Some of those new rules have a special feature, they can be used in other variants, creating new games. A simple and good example is the pass rule: A player may pass his turn. If you apply this rule to FIDE chess, you get a different game, Passing Chess (or whatever...). I will call to this kind of rules, mutators.
What I want is to start a discussion about this concept, namely:
| What makes a certain rule a Mutator? | |
| Can mutators be applied to any game, or just to some set of CVs? | |
| How mutators interact with each other? | |
| Is the mutator concept flexible enough? If not, how can it be expanded? | |
| Is a mutator list useful to the CV community? |
Definition: A mutator M is a well-defined and reasonable concept that applied at least to one game G, produces a new game, denoted G[M].
Remark: A game G with mutator M, that is G[M] is, by definition, a new game. So we can apply other mutator M' on it to produce another new game denoted by G[M][M'].
I inserted the reasonable word in the mutator definition, to avoid questionable mutators like rule 8th-yellow: "The game must be played on the 8th floor of a yellow building". I trust your common sense :-)
Even so, this is a not a strict definition, since I didn't define what a game is (a rather complex issue). To avoid this problem (since we will deal just with CVs), I use the next definition:
Definition: Let's denote "FIDE Chess" as game FIDE. A chess variant C is the result of applying N mutators, M1, M2, ..., Mn to FIDE, that is, C = FIDE[M1][M2]...[Mn].
Remark: A consequence is that every CV can be defined in terms of Mutators.
Example: Assume the Pass rule as a mutator. So, Passing Chess is defined by FIDE[Pass].
What if we use more than one mutator in a game? Can we use the same mutator twice? It depends, of course...
Some initial notation:
| iff means "if and only if" | |
| x|y means a choice between x or y. | |
| set means the typical mathematical set with zero or more elements, e.g. {1,2,3} or {} | |
| sequence means a deterministic sequence of numbers, e.g., {1,2,3,...} or {1,3,5,7,...} | |
| rel-op means one of the relational operators, i.e., <, >, =, <> (not equal), >=, <= | |
| A game is made of turns, and each turn has a set of moves for each player. |
Now for some concepts:
| A mutator M is applicable to game G iff G[M] is a game. | |
| A mutator M is idempotent in game G iff G[M] = G[M][M] | |
| Mutators M and M' are commutative in game G iff G[M][M'] = G[M'][M] | |
| Mutator M is atomic iff there is no mutators M' and M'' and a game G such that G[M] = G[M'][M'']. Otherwise M is composite. | |
| Mutator M is parameterized iff it needs one or more arguments to define it properly. It is denoted by M(param1, ..., paramN). | |
| Given a game G and mutators M and M', if G[M][M'] and G[M'][M] are not games, then M and M' are incompatible towards G. Otherwise they are compatible towards G. |
Assume the following mutators:
| NIL : changes nothing (perhaps this is not a mutator, because people may argue that it is not a reasonable rule). | |
| Pass : A player may pass is move. | |
| Unroyal: There is no longer any royal piece (no check, no mate and no castling). | |
| Royal(set): All pieces in set become royal. | |
| Take-All : A player wins if he captures all unroyal opponent pieces. | |
| Move-Opponent : The player can move the opponent pieces. | |
| Regicide : Removes all royal pieces from the board. | |
| Progressive(sequence): The players have increasing moves for each move, given by sequence parameter. | |
| Stop-Turn : If a player checks in the middle of his move, he must pass. | |
| Bad-Advice : A player offers for each move, two possible options to the opponent, who advises the player which to play. | |
| Reuse(same|other) : A player can reuse opponent captured pieces and drop them on his side (like in Shogi) in the same board, or in other board. | |
| Assault(2|4) : Two games are played simultaneous with color reversed boards, by 2 or 4 players. Wins who finish first. |
Examples:
| Regicide is not applicable to FIDE (there is no winning condition). However, it is applicable to FIDE[Take-All] | |||||||||
| Pass is idempotent in FIDE, since FIDE[Pass] = FIDE[Pass][Pass] | |||||||||
| Bad-Advice is not idempotent in FIDE, since FIDE[Bad-Advice] is not equal to FIDE[Bad-Advice][Bad-Advice] (in this 2nd game, each player should offer 4 possible moves). | |||||||||
| Pass and Take-All are commutative in FIDE, since FIDE[Take-All][Pass] = FIDE[Take-All][Pass] | |||||||||
| Pass is an atomic mutator (at least, I think it is) | |||||||||
Progressive and
Assault are parameterized.
|
|||||||||
| Regicide and NIL are incompatible towards FIDE. | |||||||||
| Mutator [Bughouse] is composite since it is defined by [Reuse(other)][Assault(4)] |
Here are some other mutators (only a few of them are mine, the others were taken from various sources). Some mutators would need more explanations to remove ambiguities, but the main idea is there.
| Misere : The player wins if it looses the original game. | |
| Must-Capture : Captures are compulsory. | |
| Must-Move : Moves are compulsory. | |
| No-Capture(set) : Pieces may not be captured at turns included in set. | |
| No-Move(set): Pieces may not be moved at turns included in set. | |
| Limit(N) : The game has a maximum of N turns. | |
| Stalemate(win|loss) : A stalemate is a loss or a win. | |
| Swap : A piece may swap its position with some other within its capturing or moving range. | |
| Ko : A move is not legal if it repeats the board position of the last turn. | |
| Strong-Ko : A move is not legal if it repeats any past board position. | |
| Kriegspiel : The player cannot see the opponent pieces, but he can repeat the move if the last one he tried was illegal. | |
| Exhaustion(turn|game) : All pieces should be moved, in a turn or in the entire game, until any piece can be moved again. | |
| Points : At the end of game, the player with more points wins (note: this should be used with other Mutators, like next one). | |
| Domination(set) : For each turn, the last player that occupied a square included in set, gains 1 point. | |
| Optional-Side(N) : After the Nth turn, the 2nd player can choose to switch sides rather than respond. | |
| Switch(N) : At each set of N turns, players switch sides. | |
| Handicap(remove-set,insert-set) : The pieces in remove-set (insert-set) are removed (inserted) from the board before the game starts. | |
| Conditional(set) : Each move may have a "if condition then ..." prefix attach to it. All legal conditions belongs to set. | |
| Whim : The original game turns Misere. This may be invoked only once in the game (not once per player). | |
| Neighbors(left|right|opposite,low|high): A player win iff the player to his direction (left, right or opposite) has the lowest or highest score at the end of the game. | |
| Atomic : Each piece adjacent to a capture, friend or foe, is removed from the board. | |
| Nuclear : Each piece adjacent to a capture, friend or foe, is removed from the board (except the capturing piece). | |
| Inertial : The last moved piece will continue to move on the following turns, if possible. | |
| Momentum : Same as Inertial, but the player can also move a new piece, or stop one with momentum. | |
| Rotational(clockwise|cclockwise,N) : The board rotates 90 degrees (counter)clockwise every N turns. | |
| Protean : Each unroyal piece takes on the powers of movement of whatever piece it captures. | |
| Morph : Each unroyal piece becomes whatever piece it captures. | |
| Magnetic : Same color repels, different color attracts in rookwise way. | |
| Diplomatic : Moves are done at the same time, and just if they do not conflict with each other. | |
| Reserve(set) : Each player has the pieces in set that can be dropped one per turn at any turn. | |
| Save-Turn(N) : A player can pass and save his move. After saving N moves, he can make a double move. |
Fell free to send me more!
[December 2000] Patrick Duff sent me an idea for a sacrifice mutator. The point is to give the player, the choice to play a move with the opponent's pieces. This can be very interesting in certain games, like in Duff's own invention, Sacrifice Reversi, where a play may indeed sacrifice some stones in order to get a better future position!
Let's imagine the following CV: The game is equal to FIDE chess until turn 40, then it behaves like Misere Chess. How to do it? This could be done only with mutators parameterized with other mutators (see next section). Other way is to insert a new notation called prefixes. A Prefix is a condition that is attached to one or more mutators. A mutator only works if its prefix condition is true, otherwise it behaves like mutator NIL, i.e., it changes nothing. A prefix P of mutator M in game G is denoted by G::P[M]::
List of Prefixes:
| turn rel-op N - works if "actual turn rel-op N" result is true. | |
| board rel-op N - works on boards where "boards rel-op N". | |
| player(s) - works just for specified player(s). | |
| pieces in set - works just for pieces included in set. Pieces may be defined by type (e.g., Q), by color (e.g., wQ) or by starting position (e.g., Qd1). |
It is also possible to combine prefixes using the logical operators, like and, or, not, ...
Examples:
| FIDE::turn>40[Misere]:: - The first example of this section. | |
| [Bughouse]::board=1[Atomic]:: - Bughouse, but the 1st board has an atomic mutator. | |
| FIDE::white[Take-All]:: - The white player can also win by capturing all unroyal black pieces. Black plays as usual. | |
| FIDE::black[Unroyal]:: ::white[Take-All]:: - The white player can only win if he captures all black pieces. Black plays with no royal piece. | |
| FIDE[Handicap({a8,h8},{})]::white[Limit(35)][Stalemate(loss)]:: - Black starts without his rooks, but white just has 35 moves to win, otherwise it looses. | |
| FIDE::pieces in {N,wQ,bR,Pa2}[Protean]:: - Just like FIDE, but there are the special Protean pieces: The Knights, the white Queen, the black Rooks and the Pawn at square a2. |
High-order mutators are mutators that receive one or more mutators as parameters.
Instead of using prefixes, the job can be done using high order mutator Apply, which syntax is [Apply(mutators, condition)] where the mutators are only applied if condition is true. The example FIDE::turn>40[Misere]:: becomes FIDE[Apply([Misere],turn>40)].
Other high-order mutators:
| Remove(mutators) : the rules defined by mutators are removed from the game. | |
| Inverse(mutator) : returns the inverse of mutator, if it exists. | |
| Complement(mutator) : the illegal moves turn legal, and vice versa. | |
| Twice(mutator) : apply the mutator twice | |
| Limit(mutator) : apply mutator repeatedly until fixed-point (limit) is reached | |
| Compose(mutators) : compose two mutators. Mostly useful in combination with other high-order mutators. |
Examples:
| FIDE[Remove([En-Passant])], returns a CV just like FIDE but without the en-passant rule. | |
| Inverse([Switch(3)]) : At each set of 3 turns, players do not switch sides, switching otherwise. | |
| Complement([Swap]) : A piece may swap its position with some other not in its capturing or moving range. |
Of course, if there are some problems defining what makes a mutator reasonable, there is an extra problem with high-order mutators and that is an interpretation one (e.g., what is the inverse of mutator X?)
Claude Chaunier, Torben Mogensen, Bill Taylor
back to top


Preference navigator
Repository
whisker
Bubble chart
Refactoring impact
Scatter chart
Refactoring impact
☰


SUM more SQL
Your data might rival the Harry Potter series in terms of volume and complexity.
Your data might rival the Harry Potter series in terms of volume and complexity.


mdevd
Software
skarnet.org
What has changed in mdevd
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
- execline
optional dependency bumped to <IP_ADDRESS>.
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
- nsss
optional dependency bumped to <IP_ADDRESS>.
- execline
optional dependency bumped to <IP_ADDRESS>.
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
- nsss
optional dependency bumped to <IP_ADDRESS>.
- execline
optional dependency bumped to <IP_ADDRESS>.
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
- execline
optional dependency bumped to <IP_ADDRESS>.
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
- execline
optional dependency bumped to <IP_ADDRESS>.
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
- New -O nlgroups option to mdevd, rebroadcasting
uevents to the netlink after handling them.
- The * and & action directives are now
triggered by all action types.
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
- New +, - and & command
directives supported in mdev.conf. These directives
spawn a command interpreted by the
execlineb
program launcher instead of /bin/sh.
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
- A -C option has been added to
mdevd. This triggers a coldplug when
mdevd is ready, for faithful mdev -d emulation.
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
- A -o outputfd option has been added to
mdevd.
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
- Everything now builds as PIC by default no matter
the toolchain's settings. Use the --disable-all-pic configure
option to build executables and static libraries as non-PIC.
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
- Optional nsss support added.
in <IP_ADDRESS>
in <IP_ADDRESS>
- skalibs
dependency bumped to <IP_ADDRESS>.
- The mdevd-netlink program doesn't exist anymore.
- mdevd now listens to the netlink itself.
- mdevd-coldplug does not print events
to stdout anymore. Instead, it makes the kernel trigger events.
in <IP_ADDRESS>


But, to do that having a graph is a good accesories. I will use graph more but i don't want my time taken to build table, as i am coding html using gedit(notepad). So I created this SimpGraph, just a simple engine to read div and its data attribute then build graph.


Interview: Chael Sonnen recalls fighting GSP ‘in a basement’ back in 2014
by Ram GilboaAs Bellator 234: Kharitonov vs Vassell gets ready to go in the city of Tel-Aviv, Israel, there have been some minor developments in another popular fighting field – war – that threaten to collide with the scheduled MMA event. Hundreds of rockets and missiles were launched from Gaza this week by the Islamic Jihad terrorist organization – the bulk of them landing a few dozen miles south of the location – with a few actually reaching Tel-Aviv on Wednesday. Without going into who fired at whom first, in the middle-east, on an MMA website; this flare-up has followed two years of gradual escalation involving all sides—Israel, and the various factions in Gaza. Closer to the Gaza border, a mass event such as Bellator’s would be cancelled by local authorities (on account of the current metallic rain) but the Jihad – perhaps MMA fans – so far seem to be largely leaving Tel-Aviv alone, for this round.
Chael Sonnen, recently retired from professional fighting, is now at the Sheraton Tel-Aviv hotel, in the glass-walled lobby floor overlooking the Mediterranean. The ceremonial weigh-ins for the Kharitonov vs Vassell event have just wrapped up in the conference room below, with Sonnen taking a small part in it—as a teammate for Austin Vanderford, and on promotional duties for the Bellator organization. Bellator is not new to Israel – mid-November in Tel-Aviv is becoming a tradition for them – but it is Chael Sonnen’s and his wife Britanny Smith first time in the state.
You landed here pretty much along with the missiles. It doesn’t bother you. Or does it?
Mmm, I’m not crazy about it! I don’t love the missiles, no.
Have you heard any sirens?
 And I didn’t know, I thought maybe that was a regular thing—everybody around seemed pretty calm. And then some Israelis told me, ‘No, the last time that happened was 3 years ago.’ So, everybody went on about their day like there was nothing to be worried about, so my wife, we did too.
It is only missiles.
That’s right, it’s only missiles.
Onto more pressing concerns. Favorite fighter right now?
Frankie Edgar. I think he’s going to go to 135, he said, and try to make a title run down there. I like him as a person, I like his style, I’ve always enjoyed it. I like that he changes weight classes, takes on anybody.
And on Bellator 234?
Yeah, I’ve got a teammate so I’m a little bit biased; Austin Vanderford. [In Tel-Aviv with his wife, UFC fighter Paige VanZant, who seems on vacation as he rests in preparation to take on Russia’s Grachik Bozinyan on the main card.]
I’m also curious to see how Linton [Vassell] does, quite frankly. I like Linton at heavyweight. I thought he’d be a small heavyweight, I saw him a couple of days ago, he said he was weighing 240 pounds, so, I think the narrative about him being too small is just not true, it’s wrong.
And Sergei [Kharitonov] is just such a good striker. I thought for many years that Sergei was the best heavyweight striker in the sport. I always thought Sergei versus Junior Dos Santos would be such a fun fight.
In your fighting days you famously fought some killers. Who was the most awesome killer among them, you think, Anderson?
Mmm, no, maybe. I’ve fought Georges St. Pierre in a basement, in California, 2014. That was the best fighter I’ve ever taken on. It’s a long story, but Kenny Florian set up the workout. And he said, ‘Hey, Georges is in town, do you want to work out tonight?’. And I said ‘Yes.’ But, I didn’t know he meant GSP—everybody calls GSP, GSP. Kenny sent me a text that said ‘Georges is in town’.
Anyway, that was it. I showed up at the basement and there is St. Pierre. And I do remember leaving that day and thinking, ‘You know, that guy is special. That guy is different than other people.’ And he had that strength, like that remarkable strength. And I never heard his opponents talk about that. I never heard his opponents talk about how strong he was, which surprised me, because it was… remarkable. Very strong man.
And as nice as he is strong.
Yeah, I would agree with that.
And in the cage, is there one, or a few guys in particular you’d want to tip your hat to?
There were some really good fighters—Paulo Filho comes to mind. He was a great fighter.
In those days, with Paulo Filho, you had a lot of words about Jiu-Jitsu. And about how Wrestling is superior and is the best base for MMA. Years later, that changed.
I’m a Jiu-Jitsu black belt. I believe in Jiu-Jitsu. I haven’t wrestled in a number of years, I only do Jiu-Jitsu. I think very highly of Jiu-Jitsu. But the fact is, though, that is in a second tier; it’s a much easier sport. Tough guys would go into wrestling. If you’re not as tough, you’d go to Jiu-Jitsu. That’s just the truth.
If you’re the toughest you’re going to Judo. Those guys are tough.
You think so?
Yes.
That surprises me.
It’s just falling and falling and falling and falling and falling and nothing else. Falling and standing back up and falling and standing.
I suppose if you look at that from that regard it’s a good point, that’s fair point.
But, so, you say wrestlers are the toughest.
Yeah, it’s just a tougher sport, it’s just a tougher thing to do. You know, Jiu-Jitsu I think is a lot more intelligent. It deserves a lot of credit; it gets a lot more tactical, and effective in terms of grappling. Wrestling, it’s just kind of hold you down, but Jiu-Jitsu can finish you. I think it deserves its respect.
You had some trouble of your own with commissions – what do you think about USADA these days? Is it too much?
I feel like USADA has really done a good job, and I feel like they’ve also been very fair; there’s very few organizations who could get something wrong, and then come and admit: ‘We got it wrong.’ And USADA has done that a number of times, and I think that shows integrity, and I think they get a little bit of a bad rap. Just because of the way it’s set up. I mean, they’re the judge, jury and executioner and that’s not a fair system. And I think they’ve got, you know, they’ve got a light shined on that, but it’s still the system. They do their due process and they’re not afraid to admit that they’ve one wrong, I think that’s got to mean something.
As long as we’re on possibly controversial topic – Dana White recently commented on this – do you have anything to say about Conor McGregor ’s recent allegations regarding sexual assault? What it means to the sport, if you think it will do anything to the sport at all?
I will tell you: I don’t know anything about it. I got that story very late, apparently that have been going on for a while in tabloids, I never even heard about it, and Dana [White] spoke about it—that’s really all I know. Is Dana said he’s talked to Conor, Conor says ‘it’s not me.’
Mr. Sonnen, Thank you for your time.
Thank you, enjoy the event.


.@KomodoPlatform Notary Node Elections is coming
In collaboration with @Chainzillaio, Vote coins will be distributed to all addresses including those that are stored on Ledger
Just hold $KMD on the date of snapshot to receive Vote coins and vote directly inside Magnum Wa...


Calendar.CalendarWeekrowDayComponent Class
Item Index
Properties
Properties
classNameBindings
Array
private
Default: `[ 'today:calendar-today', 'weekend' ]`
classNames
Array
private
Default: `[ 'day-cell' ]`
date
Number
private
Alias of day.date
.
day
Object
This should be passed into the component. It should be an Ember.Object with
date
, month
, and year
properties.
Ember.Object.create({ date: 31, month: 11, year: 2014 });
month
Number
private
Alias of day.month
.
today
Boolean
private
Computed property. True if day
is today.
weekend
Boolean
private
Computed property. True if day
is a weekend.
year
Number
private
Alias of day.year
.


Toggle navigation
Alpha-Viz
Dashboard
Introduction
Help
Stock Symbol
(current)
Metrics Configuration
Article Sentimemt
-1
1
Impact Score
Buy:
Average Artical Sentiment >= {{sentiBar}}
Average Impact Score >= {{impactBar}}
Insight
alpha
Return Rate
Strategy - Stock - Return Rate


|
Quick Links: |
#include <bmqt_hosthealthstate.h>
Public Types | |
| enum | Enum { e_UNKNOWN = 0, e_HEALTHY = 1, e_UNHEALTHY = 2 } |
Static Public Member Functions | |
| static bsl::ostream & | print (bsl::ostream &stream, HostHealthState::Enum value, int level=0, int spacesPerLevel=4) |
| static const char * | toAscii (HostHealthState::Enum value) |
| static bool | fromAscii (HostHealthState::Enum *out, const bslstl::StringRef &str) |
Enumeration for host health states.
See Component bmqt_hosthealthstate
| static bsl::ostream& bmqt::HostHealthState::print | ( | bsl::ostream & | stream, | |
| HostHealthState::Enum | value, | |||
| int | level = 0 , |
|||
| int | spacesPerLevel = 4 | |||
| ) | [static] |
Write the string representation of the specified enumeration value
to the specified output stream
, and return a reference to stream
. Optionally specify an initial indentation level
, whose absolute value is incremented recursively for nested objects. If level
is specified, optionally specify spacesPerLevel
, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects. If level
is negative, suppress indentation of the first line. If spacesPerLevel
is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level
). See toAscii
for what constitutes the string representation of a HostHealthState::Value
value.
| static const char* bmqt::HostHealthState::toAscii | ( | HostHealthState::Enum | value | ) | [static] |
Return the non-modifiable string representation corresponding to the specified enumeration value
, if it exists, and a unique (error) string otherwise. The string representation of value
matches its corresponding enumerator name with the BMQT_
prefix elided. Note that specifying a value
that does not match any of the enumerators will result in a string representation that is distinct from any of those corresponding to the enumerators, but is otherwise unspecified.
| static bool bmqt::HostHealthState::fromAscii | ( | HostHealthState::Enum * | out, | |
| const bslstl::StringRef & | str | |||
| ) | [static] |
Return true and fills the specified out
with the enum value corresponding to the specified str
, if valid, or return false and leave out
untouched if str
doesn't correspond to any value of the enum.


|
BrawlCrate v0.40a
Wii File Editor
|
Represents a single TrackInfo segment (with the assumption that there will be only one in a file.) Some unknown data (the Byte Table) is hardcoded in the constructor. More...
Public Member Functions | |
| CSTMTrackInfoStub (byte volume, byte pan) | |
Public Attributes | |
| byte | _volume |
| byte | _pan |
| short | _padding |
| CSTMReference | _byteTableReference |
| int | _byteTableCount |
| bint | _byteTable |
Represents a single TrackInfo segment (with the assumption that there will be only one in a file.) Some unknown data (the Byte Table) is hardcoded in the constructor.
|
inline |
| bint BrawlLib.SSBB.Types.Audio.CSTMTrackInfoStub._byteTable |
| int BrawlLib.SSBB.Types.Audio.CSTMTrackInfoStub._byteTableCount |
| CSTMReference BrawlLib.SSBB.Types.Audio.CSTMTrackInfoStub._byteTableReference |
| short BrawlLib.SSBB.Types.Audio.CSTMTrackInfoStub._padding |
| byte BrawlLib.SSBB.Types.Audio.CSTMTrackInfoStub._pan |
| byte BrawlLib.SSBB.Types.Audio.CSTMTrackInfoStub._volume |


I am currently in my 4th year of Computer Science, Software Practice degree at the University of Alberta. I love Software Engineering and Development and I am currently working as a Full Stack Developer Intern in Edmonton.
I thought it would be cool and helpful for someone to have all those details on a single platform, i.e., visit this website first, find the correct movie and see if its something they want to watch or no and from there get linked directly to Netflix...if not, it's a good side project!
Yes, it can but you need to know what you want to watch there; however, on this website, you can browse through many shows to make up your mind and then go get linked to Netflix
New Releases, Expiring soon, Season changes, details like rating, genre, plot, etc. all on one platform :) Isn't that amazing?!


Project: Smart Mirror by Pank and Simon
basic text place
Title 2
Master Thesis Handin Deadline
Days
Hours
Minutes
Seconds
Time to Friday
Days
Hours
Minutes
Seconds


J. P. Bello
Automatic Musical Genre Classification Of Audio Signals
G. Tzanetakis, G. Essl, P. Cook 2002
Deep Convolutional Neural Networks for Musical Source Separation
M. Miron, P. Chandna, G. Erruz, and H. Martel 2016
H. Zhao, C. Gan, A. Rouditchenko, C. Vondrick, J. McDermott, A. Torralba 2018
Top 10: Human-labels
female vocals, triple meter, acoustic, classical music, baroque period, lead vocals, string ensemble, major, compositional dominance of: lead vocals and melody
Top 10: Deep Learning
acoustic, string ensemble, classical music, period baroque, major, compositional dominance of: the arrangement, form, performance, rhythm and lead vocals.
Top 10: Human-labels
English, male vocals, rap, East Coast, breathy vocal, joyful lyrics and compositional dominance of: lyrics, melody, rhythm, accompanying vocals.
Top 10: Deep Learning
English, lead vocals, male vocals, rap, accompanying vocals, danceable and compositional dominance of: accompanying vocals, lead vocals, rhythm, lyrics.
End-to-end learning for music audio tagging at scale
J. Pons, O. Nieto, M. Prockup, E. Schmidt, A. Ehmann and X. Serra 2017
Gordon Wichern, iZotope 2017
Onsets and Frames: Dual-Objective Piano Transcription
C. Hawthorne, E. Elsen, J. Song, A. Roberts, I. Simon, C. Raffel, J. Engel, S. Oore, D. Eck 2018


----- o -----
"Do not worry too much about your difficulties in mathematics, I can assure you that mine are still greater." - Albert Einstein.
----- o -----
"Do not worry too much about your difficulties in mathematics, I can assure you that mine are still greater." - Albert Einstein.


Alright so you want a nav bar? To start off navigate to your scss folder and find the _nav.scss file. This is where the code that controls your navbar lives. Don’t touch it quite yet and lets take a look at the default nav options.
The basic nav is…you guessed it…pretty basic. But it can be a good place to get started. Just copy this code into the body of your html. I’d suggest at the very top, but that’s for you to decide.
Now we are going to get a bit more sophisticated. This nav has dropdowns. Just add a little plus or another image or symbol of your choosing to the li
text to let your users know there is more information tucked away. Full code below!
If you want to keep your dropdown’s rolling this is the menu for you. Nest a dropdown on a link inside another dropdown. Just remember you don’t want things to get too complex for your user to navigate!
Use this navigation to ensure users on mobile devices will be able to easily use your navigation. This nav displays like normal until you get to tablet size. Links will disappear and be replaced by the hamburger icon. JavaScript initiation is required for the mobile nav to work properly. After pasting the code into your HTML paste the following JavaScript into the bottom of your js/tuxedo.js file where specified.
So you put a dropdown on your main nav and you think it would be neat to have them on your mobile menu as well. The following snippet includes the code for the whole nav - desktop and mobile version included. Make sure you’ve initiated that JavaScript for everything to work correctly!
The following code is for putting a nested dropdown within your mobile nav. These nested dropdowns can easily be nested and nested - although be careful as it could become confusing for your users!
Navs come with a variety of helper classes to add variety to your webpages. The following snippets show you which classes change the base styling of your nav bar.
You can also make your nav fixed by adding the helper class below. Now your nav will stick to the top of your page no matter where you scroll.
By default you navbar overlaps with the content on the page. To keep your navbar on the top of your page - separate from other content add the .relative
helper class to your nav.


PrinterPageWidth()
Syntax
Result = PrinterPageWidth()Description
Return the width of the drawing area.
Parameters
None.
Return value
The width of the drawing area, in pixels. The number changes with the DPI of the printer. This means than a document printed at 75 DPI will have a drawing area 4 times smaller than a document printed at 150 DPI. This value refers to the client area, the one you can write on. It doesn't count the hardware printer margins, but doesn't add any 'soft' margins.
See Also
PrinterPageHeight()
Supported OS
All


library(data.table)
library(dplyr) #which is better? dplyr or data.table? or a combination of both?
library(stringr) #str_split usefull while tabulating model results
library(tidyr) #gather function usefull when listing model results
#modeling libs
library(caret)
library(rpart)
library(xgboost)
library(randomForest)
library(glmnet)
library(ROCR)
library(gbm)
library(ISLR)
#viz libs
library(ggplot2)
library(ggthemes)
library(rpart.plot)
library(gridExtra)
library(doParallel)
registerDoParallel(cores = 4)
This dataset records purchases of two types of orange juices and presents customer and product characteristics as features. The goal is to predict which of the juices is chosen in a given purchase situation.
But first let me give you a fact: the orange juice you buy today was likely squeezed last summer. They first kill it and then add the orange flavor before they pack and sell you. Ever wonder why your orange juice tastes the same, in all the seasons? Yes, orange juice is a dirty business. Long story short, don’t buy it.
Obviously most people buy it. That’s why we have a dataset like this. In this study we will call this phenomenal purchasing behaviour as The Kamikaze event.
data(OJ)
data <- data.table(OJ)
glimpse(data)
## Observations: 1,070
## Variables: 18
## $ Purchase <fct> CH, CH, CH, MM, CH, CH, CH, CH, CH, CH, CH, CH,...
## $ WeekofPurchase <dbl> 237, 239, 245, 227, 228, 230, 232, 234, 235, 23...
## $ StoreID <dbl> 1, 1, 1, 1, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,...
## $ PriceCH <dbl> 1.75, 1.75, 1.86, 1.69, 1.69, 1.69, 1.69, 1.75,...
## $ PriceMM <dbl> 1.99, 1.99, 2.09, 1.69, 1.69, 1.99, 1.99, 1.99,...
## $ DiscCH <dbl> 0.00, 0.00, 0.17, 0.00, 0.00, 0.00, 0.00, 0.00,...
## $ DiscMM <dbl> 0.00, 0.30, 0.00, 0.00, 0.00, 0.00, 0.40, 0.40,...
## $ SpecialCH <dbl> 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,...
## $ SpecialMM <dbl> 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,...
## $ LoyalCH <dbl> 0.500000, 0.600000, 0.680000, 0.400000, 0.95653...
## $ SalePriceMM <dbl> 1.99, 1.69, 2.09, 1.69, 1.69, 1.99, 1.59, 1.59,...
## $ SalePriceCH <dbl> 1.75, 1.75, 1.69, 1.69, 1.69, 1.69, 1.69, 1.75,...
## $ PriceDiff <dbl> 0.24, -0.06, 0.40, 0.00, 0.00, 0.30, -0.10, -0....
## $ Store7 <fct> No, No, No, No, Yes, Yes, Yes, Yes, Yes, Yes, Y...
## $ PctDiscMM <dbl> 0.000000, 0.150754, 0.000000, 0.000000, 0.00000...
## $ PctDiscCH <dbl> 0.000000, 0.000000, 0.091398, 0.000000, 0.00000...
## $ ListPriceDiff <dbl> 0.24, 0.24, 0.23, 0.00, 0.00, 0.30, 0.30, 0.24,...
## $ STORE <dbl> 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
#learn more about the variables
#?ISLR::OJ
training_ratio <- 0.75
set.seed(1234)
train_indices <- createDataPartition(y = data[["Purchase"]],
times = 1,
p = training_ratio,
list = FALSE)
data_train <- data[train_indices, ]
data_test <- data[-train_indices, ]
Let’s see a benchmark: a simple classification tree.
train_control <- trainControl(method = "cv", classProbs = T,
number = 10, summaryFunction = twoClassSummary,
selectionFunction = "oneSE")
set.seed(1981)
simple_tree_model <- train(Purchase ~ .,
method = "rpart",
data = data_train,
tuneGrid = data.frame(cp = seq(0.001, 0.1, 0.01)),
trControl = train_control,
metric = "ROC")
simple_tree_model
## CART
##
## 803 samples
## 17 predictor
## 2 classes: 'CH', 'MM'
##
## No pre-processing
## Resampling: Cross-Validated (10 fold)
## Summary of sample sizes: 723, 723, 722, 723, 723, 723, ...
## Resampling results across tuning parameters:
##
## cp ROC Sens Spec
## 0.001 0.8643546 0.8632653 0.7248992
## 0.011 0.8521673 0.8673469 0.7601815
## 0.021 0.8269380 0.8632653 0.7345766
## 0.031 0.7924076 0.8551020 0.7220766
## 0.041 0.7920785 0.8653061 0.7188508
## 0.051 0.7920785 0.8653061 0.7188508
## 0.061 0.7920785 0.8653061 0.7188508
## 0.071 0.7920785 0.8653061 0.7188508
## 0.081 0.7920785 0.8653061 0.7188508
## 0.091 0.7920785 0.8653061 0.7188508
##
## ROC was used to select the optimal model using the one SE rule.
## The final value used for the model was cp = 0.011.
According to oneSE rule, The simplest model within one standard error is the better choice. Thus, it picks cp 0.011 with AUC 0.85, although it is smaller than the first option above!
How does our Kamikaze event tree look like?
rpart.plot(simple_tree_model[["finalModel"]], type = 0)
## Warning: Bad 'data' field in model 'call' field.
## To make this warning go away:
## Call rpart.plot with roundint=FALSE,
## or rebuild the rpart model with model=TRUE.
Looks like loyalty, price diff and special CH are important for our tree.
Predicting a new observation is quite straight forward. We just follow the tree by using the rules. First decision is LoyalCH (Customer brand loyalty for Citrus Hill). If that score is greater than or equal to 0.45, we take the left branch. If not, then to the right. We use this method on each node to arrive to the final Kamikaze event: Intake of carcinogen substances into body using Citrus Hill or Minute Maid…
#predict on the test set
test_prob_rpart <- predict.train(simple_tree_model, newdata = data_test, type = "prob")
test_pred_rpart <- prediction(test_prob_rpart$MM, data_test[["Purchase"]])
rpart_perf <- performance(test_pred_rpart, measure = "tpr", x.measure = "fpr")
rpart_roc_frame <- data.frame(
model = "rpart",
FPR =<EMAIL_ADDRESS>TPR =<EMAIL_ADDRESS>cut_point =<EMAIL_ADDRESS>AUC <- paste0("AUC is: ", round(performance(test_pred_rpart<EMAIL_ADDRESS>2))
rpart_roc_frame %>%
ggplot() +
geom_line(aes(FPR, TPR, color = model), size = 2) +
scale_color_manual(values=c("darkgrey")) +
geom_abline(intercept = 0, slope = 1, linetype = "dotted", col = "black") +
scale_y_continuous(limits = c(0, 1), breaks = seq(0, 1, .1)) +
scale_x_continuous(limits = c(0, 1), breaks = seq(0, 1, .1)) +
xlab("False Positive Rate") + ylab("True Positive Rate") +
ggtitle(AUC) + theme_fivethirtyeight() +
theme(legend.position="none")
The AUC is very close to what we got via cross-validation indeed. Now we can leave this path and enter into the forest.
For random forests, mtry
sets the number of variables randomly chosen for a tree.
#choose the best in selectionFunction
train_Control <- trainControl(method = "CV",
number = 10,
classProbs = TRUE,
summaryFunction = twoClassSummary,
selectionFunction = "best",
verboseIter = FALSE)
# random forest. small medium and big forest with many trees
tune_grid_rf <- data.frame(mtry = c(3:6))
set.seed(1)
rf_100_fit <- train(Purchase ~ .,
method = "rf",
data = data_train,
metric = "ROC",
trControl = train_Control,
tuneGrid = tune_grid_rf,
ntree = 100,
importance = T)
set.seed(1)
rf_200_fit <- train(Purchase ~ .,
method = "rf",
data = data_train,
metric = "ROC",
trControl = train_Control,
tuneGrid = tune_grid_rf,
ntree = 200,
importance = T)
set.seed(1)
rf_400_fit <- train(Purchase ~ .,
method = "rf",
data = data_train,
metric = "ROC",
trControl = train_Control,
tuneGrid = tune_grid_rf ,
ntree = 400,
importance = T)
These will be better then the single tree of course.
Now time to train GBM: gradient boosting machine
#GBM
tune_grid_gbm <- expand.grid(n.trees = c(100, 200, 400), #how many tree to build
interaction.depth = c(3:6), #controls how large trees
shrinkage = c(0.001, 0.01, 0.1), #how conservative you are when building from the residual.
#keep in mind, it is lambda*g(X).
n.minobsinnode = c(4, 8)) #how complex trees to build. ensure 4, 8 observations in your node.
set.seed(1)
gbm_030_fit <- train(Purchase ~ .,
data = data_train,
method = "gbm",
metric = "ROC",
trControl = train_Control,
tuneGrid = tune_grid_gbm,
bag.fraction = 0.30,
verbose = FALSE)
set.seed(1)
gbm_060_fit <- train(Purchase ~ .,
data = data_train,
method = "gbm",
metric = "ROC",
trControl = train_Control,
tuneGrid = tune_grid_gbm,
bag.fraction = 0.60,
verbose = FALSE)
set.seed(1)
gbm_080_fit <- train(Purchase ~ .,
data = data_train,
method = "gbm",
metric = "ROC",
trControl = train_Control,
tuneGrid = tune_grid_gbm,
bag.fraction = 0.80,
verbose = FALSE)
And here comes XGBoost… A celebrated implementation of the gradient boosting idea.
#XGBoost
tune_grid_xgb <- expand.grid(nrounds = 200,
max_depth = c(3:6),
eta = c(0.02, 0.06),
gamma = 0,
colsample_bytree = c(0.6, 0.8),
min_child_weight = 1,
subsample = c(0.4, 0.8))
set.seed(1)
xgboost_fit <- train(Purchase ~ .,
data = data_train,
method = "xgbTree",
metric = "ROC",
trControl = train_Control,
tuneGrid = tune_grid_xgb)
Now we will compare these different models with the resamples function. We can pass them to a list and then generate boxplots.
#make a list
resamples_list <- resamples(list("tree" = simple_tree_model,
"rf_100" = rf_100_fit,
"rf_200" = rf_200_fit,
"rf_400" = rf_400_fit,
"gbm_0.30" = gbm_030_fit,
"gbm_0.60" = gbm_060_fit,
"gbm_0.80" = gbm_080_fit,
"xgboost" = xgboost_fit))
#extract, factorize and plot
resamples_list$values %>%
gather(key = "Resample", factor_key = F) %>%
setnames(c("Model~Metric", "Value")) %>% #dplyr rename doesnt work here, just setname
mutate(model = str_split(`Model~Metric`, "~", simplify = T)[,1],
metric = str_split(`Model~Metric`, "~", simplify = T)[,2]) %>%
mutate(model = factor(model, levels = c("tree",
"rf_100", "rf_200", "rf_400",
"gbm_0.30", "gbm_0.60", "gbm_0.80",
"xgboost"))) %>%
ggplot(aes(x= model, y= Value, fill = model)) +
geom_boxplot() +
ggtitle("A Murder by Machine Learning on the screen, starring Xgboost ") +
facet_grid(~metric) + theme_fivethirtyeight() +
theme(axis.text.x=element_blank()) +
scale_fill_brewer(palette="Set3")
Xgboost outperformed the others on ROC (almost 90%) and Specificity. We dig a bit deeper to see how it is performing on the test set.
#predict on the test set
test_prob_xg <- predict.train(xgboost_fit, newdata = data_test, type = "prob")
test_pred_xg <- prediction(test_prob_xg$MM, data_test[["Purchase"]])
xg_perf <- performance(test_pred_rpart, measure = "tpr", x.measure = "fpr")
xg_roc_frame <- data.frame(
model = "xgboost",
FPR =<EMAIL_ADDRESS>TPR =<EMAIL_ADDRESS>cut_point =<EMAIL_ADDRESS>AUC <- paste0("AUC is: ", round(performance(test_pred_xg<EMAIL_ADDRESS>2))
xg_roc_frame %>%
ggplot() +
geom_line(aes(FPR, TPR, color = model), size = 2) +
scale_color_manual(values=c("darkgrey")) +
geom_abline(intercept = 0, slope = 1, linetype = "dotted", col = "black") +
scale_y_continuous(limits = c(0, 1), breaks = seq(0, 1, .1)) +
scale_x_continuous(limits = c(0, 1), breaks = seq(0, 1, .1)) +
xlab("False Positive Rate") + ylab("True Positive Rate") +
ggtitle(AUC) + theme_fivethirtyeight() +
theme(legend.position="none")
It is performing quite good on test data as well. The result is very similar to the cross validation. Thanks to this study now we can predict consumer behaviour on some liquit poison advertised as orange juice.
This is not a particularly large dataset hence, performance measures might have large variances. When we are summurizing our results we should:
Keep It Simple & Skeptic: KISS!
We will inspect variable importance plots for 3 models: RF with 400, GBM with 0.8 and XGB. We are curious if similar variables are found to be the most important for them.
p1 <- ggplot(varImp(rf_400_fit))+ ggtitle('rf') +
theme_fivethirtyeight() +
theme(axis.text.x=element_blank())
p2 <- ggplot(varImp(gbm_080_fit))+ ggtitle('gbm') +
theme_fivethirtyeight() +
theme(axis.text.x=element_blank())
p3 <- ggplot(varImp(xgboost_fit))+ ggtitle('xgb') +
theme_fivethirtyeight() +
theme(axis.text.x=element_blank())
grid.arrange(p1, p2, p3, ncol=3)
Very similar.
Citrus Hill Loyalty is the most important variable in all of them. At the beginning the single tree also picked it as the most impontant and placed it to the top. In this project if our goal is to determine which customer will buy which liquit carcinogen substance then the most important variable will be the CH loyalty. Then comes the others like price and store related variables.
data <- data.table(Hitters)
data <- data[!is.na(Salary)]
data[, log_salary := log(Salary)]
data[, Salary := NULL]
train_control <- trainControl(method = "none")
# random forest mtry 2 and 10
set.seed(1)
rf_model_2 <- train(log_salary ~ .,
method = "rf",
data = data,
trControl = train_control,
tuneGrid = data.frame(mtry = c(2)),
importance = T # to calculate variable importance measures
)
set.seed(1)
rf_model_10 <- train(log_salary ~ .,
method = "rf",
data = data,
trControl = train_control,
tuneGrid = data.frame(mtry = c(10)),
importance = T # to calculate variable importance measures
)
p3 <- ggplot(varImp(rf_model_2))+ ggtitle('Rf / mtry 2') + theme_fivethirtyeight()
p4 <- ggplot(varImp(rf_model_10))+ ggtitle('Rf /mtry 10') + theme_fivethirtyeight()
grid.arrange(p4, p3, ncol=2)
It is interesting to see the similarities… However in mtry 10 the decline in importance is sharper, meaning the first ones have higher relative importance.
Obviously when we have a larger mtry, those variables are selected more often. Then their influence or weights are much greater. In mtry 2 case they cant dominate as they can’t be selected as much as the mtry 10 case.
In the same vein, we will estimate two gbm models and set bag.fraction to 0.1 first and to 0.9 in the second. (keeping The tuneGrids the same)
#GBM
tune_grid_gbm <- expand.grid(n.trees = c(500),
interaction.depth = c(5),
shrinkage = c(0.1),
n.minobsinnode = c(5))
set.seed(1)
gbm_01_fit <- train(log_salary ~ .,
data = data,
method = "gbm",
#metric = "ROC",
trControl = train_control,
tuneGrid = tune_grid_gbm,
bag.fraction = 0.10,
verbose = FALSE)
set.seed(1)
gbm_09_fit <- train(log_salary ~ .,
data = data,
method = "gbm",
#metric = "ROC",
trControl = train_control,
tuneGrid = tune_grid_gbm,
bag.fraction = 0.90,
verbose = FALSE)
p5 <- ggplot(varImp(gbm_01_fit))+ ggtitle('Gbm / bag frac 0.1') + theme_fivethirtyeight()
p6 <- ggplot(varImp(gbm_09_fit))+ ggtitle('Gbm / bag frac 0.9') + theme_fivethirtyeight()
grid.arrange(p5, p6, ncol=2)
Bag fraction is the fraction of the training set observations randomly selected to propose the next tree in the expansion (at each iteration).. When we select 0.1, we will use only 10% of the training data at each iteration! And keep in mind, almost anything can happen in a small sample size :)
90% bag fraction intuition is a bit like RF model with mtry 10. In larger sample sizes (large bag fraction) the important variable can dominate. Larger the bag fraction, higher the relative importance. That’s why we have a more extreme case in the plot on the right hand side. In small sample (small bag fraction) other variables can have more chance and thus, we see the plot on the left hand side: See how PutOuts jumped to the first place. That is what we mean by saying anything can happen in a small sample size.
Clearly there is a trade off here. We need to iterate and see based on our business objective. GBM can reach the desired accuracy with a larger number of base-learners and lower bag than the one with smaller amount of more carefully fitted base-learners with larger bag.
additional resources used: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3885826/