Dashboard
Pull Request
Issues
Marketplace
Explore
Settings
  Sign out
Overview
Repositories
Projects
Packages
Name
Description


This is me.
Text files. Just simple files full of text! Want to download one?
This was the first person to use Alphahex. Probably because he made it.


'br}
'br}
{\
The libnetcfg utility can be used to configure the libnet. Starting from perl 5.8 libnet is part of the standard Perl distribution, but the libnetcfg can be used for any libnet installation.
Without arguments libnetcfg displays the current configuration.
$ libnetcfg # old config ./libnet.cfg daytime_hosts ntp1.none.such ftp_int_passive 0 ftp_testhost ftp.funet.fi inet_domain none.such nntp_hosts nntp.none.such ph_hosts pop3_hosts pop.none.such smtp_hosts smtp.none.such snpp_hosts test_exist 1 test_hosts 1 time_hosts ntp.none.such # libnetcfg -h for help $
It tells where the old configuration file was found (if found).
The f(CW*(C`-h*(C' option will show a usage message.
To change the configuration you will need to use either the f(CW*(C`-c*(C' or the f(CW*(C`-d*(C' options.
The default name of the old configuration file is by default *(L"libnet.cfg*(R", unless otherwise specified using the -i option, f(CW*(C`-i oldfile*(C', and it is searched first from the current directory, and then from your module path.
The default name of the new configuration file is *(L"libnet.cfg*(R", and by default it is written to the current directory, unless otherwise specified using the -o option, f(CW*(C`-o newfile*(C'.
Graham Barr, the original Configure script of libnet.
Jarkko Hietaniemi, conversion into libnetcfg for inclusion into Perl 5.8.


{% extends 'base.html' %} {% block title %} Developer {% endblock title %} {% block content %}
For a more customized version or advance version for students/staff/parent, contact me at email<EMAIL_ADDRESS>You can also reach me on linkedin at http://linkedin.com/in/adigunsherif


What Does It Take To Keep Me Warm?
DIY sensing system to monitor home energy efficiency
Live Data
Help
Historical Data
Display data from:
1 Hour Ago
2 Hours Ago
4 Hours Ago
8 Hours Ago
12 Hours Ago
1 Day Ago
Or filter data from:
to
❮ Prev
1
2
3
Next ❯
×


// Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Copyright 2006 Google Inc. All Rights Reserved. /** * @fileoverview Set of objects that allow animation and visual effects to be * easily achieved. * * (Based loosly on my animation code for 13thparallel.org, with extra * inspiration from the DojoToolkit's modifications to my code) */ goog.provide('goog.fx'); goog.provide('goog.fx.Animation'); goog.provide('goog.fx.Animation.EventType'); goog.provide('goog.fx.Animation.State'); goog.provide('goog.fx.AnimationEvent'); goog.provide('goog.fx.easing'); goog.require('goog.Timer'); goog.require('goog.array'); goog.require('goog.events.Event'); goog.require('goog.events.EventTarget'); goog.require('goog.object'); //============================================================================== // Constants //============================================================================== /** * Default timeout for animations (in milliseconds). * @type {number} */ goog.fx.TIMEOUT = 20; /** * Ease in - Start slow and speed up. * @param {number} t Input between 0 and 1. * @return {number} Output between 0 and 1. */ goog.fx.easing.easeIn = function(t) { return t * t * t; }; /** * Ease out - Start fastest and slows to a stop. * @param {number} t Input between 0 and 1. * @return {number} Output between 0 and 1. */ goog.fx.easing.easeOut = function(t) { return 1 - Math.pow(1 - t, 3); }; /** * Ease in and out - Start slow, speed up, then slow down. * @param {number} t Input between 0 and 1. * @return {number} Output between 0 and 1. */ goog.fx.easing.inAndOut = function(t) { return 3 * t * t - 2 * t * t * t; }; /** * Constructor for an animation object. * @param {Array.<number>} start Array for start coordinates. * @param {Array.<number>} end Array for end coordinates. * @param {number} duration Length of animation in milliseconds. * @param {Function=} opt_acc Acceleration function, returns 0-1 for inputs 0-1. * @constructor * @extends {goog.events.EventTarget} */ goog.fx.Animation = function(start, end, duration, opt_acc) { goog.events.EventTarget.call(this); if (!goog.isArray(start) || !goog.isArray(end)) { throw Error('Start and end parameters must be arrays'); } if (start.length != end.length) { throw Error('Start and end points must be the same length'); } /** * Start point. * @type {Array.<number>} * @protected */ this.startPoint = start; /** * End point. * @type {Array.<number>} * @protected */ this.endPoint = end; /** * Duration of animation in milliseconds. * @type {number} * @protected */ this.duration = duration; /** * Acceleration function, which must return a number between 0 and 1 for * inputs between 0 and 1. * @type {Function|undefined} * @private */ this.accel_ = opt_acc; /** * Current coordinate for animation. * @type {Array.<number>} * @protected */ this.coords = []; }; goog.inherits(goog.fx.Animation, goog.events.EventTarget); /** * Events fired by the animation. * @enum {string} */ goog.fx.Animation.EventType = { /** * Dispatched when played for the first time OR when it is resumed. */ PLAY: 'play', /** * Dispatched only when the animation starts from the beginning. */ BEGIN: 'begin', /** * Dispatched only when animation is restarted after a pause. */ RESUME: 'resume', /** * Dispatched when animation comes to the end of its duration OR stop * is called. */ END: 'end', /** * Dispatched only when stop is called. */ STOP: 'stop', /** * Dispatched only when animation comes to its end naturally. */ FINISH: 'finish', /** * Dispatched when an animation is paused. */ PAUSE: 'pause', /** * Dispatched each frame of the animation. This is where the actual animator * will listen. */ ANIMATE: 'animate', /** * Dispatched when the animation is destroyed. */ DESTROY: 'destroy' }; /** * Enum for the possible states of an animation. * @enum {number} */ goog.fx.Animation.State = { STOPPED: 0, PAUSED: -1, PLAYING: 1 }; /** * A map of animations which should be cycled on the global timer. * @type {Object} * @private */ goog.fx.Animation.activeAnimations_ = {}; /** * An interval ID for the global timer. * @type {?number} * @private */ goog.fx.Animation.globalTimer_ = null; /** * Cycle all registered animations. * @private */ goog.fx.Animation.cycleAnimations_ = function() { goog.Timer.defaultTimerObject.clearTimeout(goog.fx.Animation.globalTimer_); // Cycle all animations at the "same time". var now = goog.now(); for (var hc in goog.fx.Animation.activeAnimations_) { goog.fx.Animation.activeAnimations_[hc].cycle(now); } goog.fx.Animation.globalTimer_ = goog.object.isEmpty(goog.fx.Animation.activeAnimations_) ? null : goog.Timer.defaultTimerObject.setTimeout( goog.fx.Animation.cycleAnimations_, goog.fx.TIMEOUT); }; /** * Register an animation to be cycled on the global timer. * @param {Object} animation The animation to register. */ goog.fx.Animation.registerAnimation = function(animation) { var hc = goog.getHashCode(animation); if (!(hc in goog.fx.Animation.activeAnimations_)) { goog.fx.Animation.activeAnimations_[hc] = animation; } // If the timer is not already started, start it now. if (!goog.fx.Animation.globalTimer_) { goog.fx.Animation.globalTimer_ = goog.Timer.defaultTimerObject.setTimeout( goog.fx.Animation.cycleAnimations_, goog.fx.TIMEOUT); } }; /** * Remove an animation from the list of animations which are cycled on the * global timer. * @param {Object} animation The animation to unregister. */ goog.fx.Animation.unregisterAnimation = function(animation) { var hc = goog.getHashCode(animation); delete goog.fx.Animation.activeAnimations_[hc]; // If a timer is running and we no longer have any active timers we stop the // timers. if (goog.fx.Animation.globalTimer_ && goog.object.isEmpty(goog.fx.Animation.activeAnimations_)) { goog.Timer.defaultTimerObject.clearTimeout(goog.fx.Animation.globalTimer_); goog.fx.Animation.globalTimer_ = null; } }; /** * Current state of the animation. * @type {goog.fx.Animation.State} * @private */ goog.fx.Animation.prototype.state_ = goog.fx.Animation.State.STOPPED; /** * Current frame rate. * @type {number} * @private */ goog.fx.Animation.prototype.fps_ = 0; /** * Percent of the way through the animation. * @type {number} * @protected */ goog.fx.Animation.prototype.progress = 0; /** * Timestamp for when animation was started. * @type {?number} * @protected */ goog.fx.Animation.prototype.startTime = null; /** * Timestamp for when animation was started. * @type {?number} * @protected */ goog.fx.Animation.prototype.endTime = null; /** * Timestamp for when last frame was run. * @type {?number} * @protected */ goog.fx.Animation.prototype.lastFrame = null; /** * Starts or resumes an animation. * @param {boolean=} opt_restart Whether to restart the * animation from the beginning if it has been paused. * @return {boolean} Whether animation was started. */ goog.fx.Animation.prototype.play = function(opt_restart) { if (opt_restart || this.state_ == goog.fx.Animation.State.STOPPED) { this.progress = 0; this.coords = this.startPoint; } else if (this.state_ == goog.fx.Animation.State.PLAYING) { return false; } goog.fx.Animation.unregisterAnimation(this); this.startTime = /** @type {number} */ (goog.now()); if (this.state_ == goog.fx.Animation.State.PAUSED) { this.startTime -= this.duration * this.progress; } this.endTime = this.startTime + this.duration; this.lastFrame = this.startTime; if (!this.progress) { this.onBegin(); } this.onPlay(); if (this.state_ == goog.fx.Animation.State.PAUSED) { this.onResume(); } this.state_ = goog.fx.Animation.State.PLAYING; goog.fx.Animation.registerAnimation(this); this.cycle(this.startTime); return true; }; /** * Stops the animation. * @param {boolean} gotoEnd If true the animation will move to the end coords. */ goog.fx.Animation.prototype.stop = function(gotoEnd) { goog.fx.Animation.unregisterAnimation(this); this.state_ = goog.fx.Animation.State.STOPPED; if (gotoEnd) { this.progress = 1; } this.updateCoords_(this.progress); this.onStop(); this.onEnd(); }; /** * Pauses the animation (iff it's playing). */ goog.fx.Animation.prototype.pause = function() { if (this.state_ == goog.fx.Animation.State.PLAYING) { goog.fx.Animation.unregisterAnimation(this); this.state_ = goog.fx.Animation.State.PAUSED; this.onPause(); } }; /** * Disposes of the animation. Stops an animation, fires a 'destroy' event and * then removes all the event handlers to clean up memory. */ goog.fx.Animation.prototype.disposeInternal = function() { if (this.state_ != goog.fx.Animation.State.STOPPED) { this.stop(false); } this.onDestroy(); goog.fx.Animation.superClass_.disposeInternal.call(this); }; /** * Stops an animation, fires a 'destroy' event and then removes all the event * handlers to clean up memory. * @deprecated Use dispose() instead. */ goog.fx.Animation.prototype.destroy = function() { this.dispose(); }; /** * Handles the actual iteration of the animation in a timeout * @param {number} now The current time. */ goog.fx.Animation.prototype.cycle = function(now) { this.progress = (now - this.startTime) / (this.endTime - this.startTime); if (this.progress >= 1) { this.progress = 1; } this.fps_ = 1000 / (now - this.lastFrame); this.lastFrame = now; if (goog.isFunction(this.accel_)) { this.updateCoords_(this.accel_(this.progress)); } else { this.updateCoords_(this.progress); } // Animation has finished. if (this.progress == 1) { this.state_ = goog.fx.Animation.State.STOPPED; goog.fx.Animation.unregisterAnimation(this); this.onFinish(); this.onEnd(); // Animation is still under way. } else if (this.state_ == goog.fx.Animation.State.PLAYING) { this.onAnimate(); } }; /** * Calculates current coordinates, based on the current state. * @param {number} t Percentage of the way through the animation as a decimal. * @private */ goog.fx.Animation.prototype.updateCoords_ = function(t) { this.coords = new Array(this.startPoint.length); for (var i = 0; i < this.startPoint.length; i++) { this.coords[i] = (this.endPoint[i] - this.startPoint[i]) * t + this.startPoint[i]; } }; /** * Dispatches the ANIMATE event. Sub classes should override this instead * of listening to the event. * @protected */ goog.fx.Animation.prototype.onAnimate = function() { this.dispatchAnimationEvent_(goog.fx.Animation.EventType.ANIMATE); }; /** * Dispatches the BEGIN event. Sub classes should override this instead * of listening to the event. * @protected */ goog.fx.Animation.prototype.onBegin = function() { this.dispatchAnimationEvent_(goog.fx.Animation.EventType.BEGIN); }; /** * Dispatches the DESTROY event. Sub classes should override this instead * of listening to the event. * @protected */ goog.fx.Animation.prototype.onDestroy = function() { this.dispatchAnimationEvent_(goog.fx.Animation.EventType.DESTROY); }; /** * Dispatches the END event. Sub classes should override this instead * of listening to the event. * @protected */ goog.fx.Animation.prototype.onEnd = function() { this.dispatchAnimationEvent_(goog.fx.Animation.EventType.END); }; /** * Dispatches the FINISH event. Sub classes should override this instead * of listening to the event. * @protected */ goog.fx.Animation.prototype.onFinish = function() { this.dispatchAnimationEvent_(goog.fx.Animation.EventType.FINISH); }; /** * Dispatches the PAUSE event. Sub classes should override this instead * of listening to the event. * @protected */ goog.fx.Animation.prototype.onPause = function() { this.dispatchAnimationEvent_(goog.fx.Animation.EventType.PAUSE); }; /** * Dispatches the PLAY event. Sub classes should override this instead * of listening to the event. * @protected */ goog.fx.Animation.prototype.onPlay = function() { this.dispatchAnimationEvent_(goog.fx.Animation.EventType.PLAY); }; /** * Dispatches the RESUME event. Sub classes should override this instead * of listening to the event. * @protected */ goog.fx.Animation.prototype.onResume = function() { this.dispatchAnimationEvent_(goog.fx.Animation.EventType.RESUME); }; /** * Dispatches the STOP event. Sub classes should override this instead * of listening to the event. * @protected */ goog.fx.Animation.prototype.onStop = function() { this.dispatchAnimationEvent_(goog.fx.Animation.EventType.STOP); }; /** * Returns an event object for the current animation. * @param {string} type Event type that will be dispatched. * @private */ goog.fx.Animation.prototype.dispatchAnimationEvent_ = function(type) { this.dispatchEvent(new goog.fx.AnimationEvent(type, this)); }; /** * Class for an animation event object. * @param {string} type Event type. * @param {goog.fx.Animation} anim An animation object. * @constructor * @extends {goog.events.Event} */ goog.fx.AnimationEvent = function(type, anim) { goog.events.Event.call(this, type); /** * The current coordinates. * @type {Array.<number>} */ this.coords = anim.coords; /** * The x coordinate. * @type {number} */ this.x = anim.coords[0]; /** * The y coordinate. * @type {number} */ this.y = anim.coords[1]; /** * The z coordinate. * @type {number} */ this.z = anim.coords[2]; /** * The current duration. * @type {number} */ this.duration = anim.duration; /** * The current progress. * @type {number} */ this.progress = anim.progress; /** * Frames per second so far. */ this.fps = anim.fps_; /** * The state of the animation. * @type {number} */ this.state = anim.state_; /** * The animation object. * @type {goog.fx.Animation} */ // TODO: This can be removed as this is the same as the target this.anim = anim; }; goog.inherits(goog.fx.AnimationEvent, goog.events.Event); /** * Returns the coordinates as integers (rounded to nearest integer). * @return {Array.<number>} An array of the coordinates rounded to * the nearest integer. */ goog.fx.AnimationEvent.prototype.coordsAsInts = function() { return goog.array.map(this.coords, Math.round); };


[Index] [1] [2] [3] [4] [5] [6] [7] [8]
HDFView displays datasets in a two-dimensional table, the TableView. The TableView allows you to view and change the values of an image's dataset. You can select rows and columns and plot the row/column data in a line plot. The current version of HDFView does not allow you to change data values of an HDF4 Vdata.
If a dataset has three or more dimensions you can only view two dimensions at a time. Using the Dataset Selection Dialog, you may select any two dimensions of the dataset to display and a third dimension to flip the two-dimension table along that dimension.
To open the entire contents of a dataset, double-click on the dataset or select the dataset, then choose the “Open” command from the Context menu. A new spreadsheet is created in the content panel of HDFView.
HDFView displays numerical datasets in a “spreadsheet”, which shows the data values in a grid. A one-dimensional dataset is displayed as a single column and a number of rows of dimension size. A two-dimensional dataset is displayed as a number of columns of the first dimension size and a number of rows of the second dimension size, i.e. dim[0]=height and dim[1]=width by default. You can change the order of the dimensions using the “Open As” command.
Spreadsheet with a 2-D dataset
Opening an entire large dataset may cause an ‘Out Of Memory Error’ because the Java Virtual Machine cannot create the required objects. HDFView provides options to select a subset of a dataset for display. You can also select dimensions and the order of dimensions to display, e.g., to switch the columns and rows.
To make a selection, select a dataset from the tree and choose the “Open As” command from the Context menu. The selection dialog box appears. You can make a selection by dragging the mouse on the preview image or entering the values of start, end, and stride. The figure below shows that a subset of size 120 x 236 is selected from a true color image with the size of 533 x 533.
The Dataset Selection dialog box
By default, a scalar dataset (e.g., a dataset or SDS of numbers) is displayed in a spreadsheet. You can also display a dataset as an image. To display a dataset as an image, click the Image radio button in the Dataset Selection dialog box and select a predefined color table for the dataset. This operation takes the data values of the dataset as values of an indexed array, i.e., as indices into a palette. The default palette will be used to create the image from the dataset if it does not have an attached palette. If the data values are not integers or have a range outside 0 to 255: they are binned into 256 equally spaced intervals.
The "Open As" option allows you to set a range of valid data values, as well as setting specific values to be considered invalid, when displaying a dataset as an image (see dataset selection dialog figure above). By setting these, any pixels (data points) whose values are outside the valid range will not be shown and pixels whose value has been set as an invalid value will be mapped to 0. As an example, the figure below shows a dataset with the value '55' set to be invalid:
A subset is determined by the start and end locations, and the stride. The “Start” array determines the starting coordinates of the subset to select. The “End” array determines the ending coordinates of the subset to select. The “Stride” array chooses array locations from the dataspace with each value in the stride array determining how many elements to move in each dimension. Setting a value in the stride array to 1 moves to each element in that dimension of the dataspace; setting a value of 2 in a location in the stride array moves to every other element in that dimension of the dataspace. In other words, the stride determines the number of elements to move from the start location in each dimension.
HDFView GUI uses a common-sense indexing scheme for selecting rows and columns. If the user wants a subset that begins at i,j the START coordinates will start at j, j instead of i-1, j-1.
The dataset used in the image above is an example of a 2-D integer dataset of size 8 X 9.
| 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
| 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 |
| 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
| 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
| 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 |
| 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 |
The following are a few examples of subsets of the 2-D int array.
The whole dataset -- start=(0, 0), end=(7, 8) and stride=(1, 1)
Subset -- start=(2, 3), end=(6, 7) and stride=(1, 1)
Subset with stride -- start=(2, 3), end=(5, 6) and stride=(2, 2)
For a three or more dimensional dataset, the first two dimensions are displayed as a 2-D spreadsheet, and the third dimension is chosen as the page number of the 2-D spreadsheet, i.e. dim[0]=height, dim[1]=width and dim[2]=depth by default. Using the “Open As” option to change the default order of dimensions, the user can flip the page forward or backward to look at the 2D data values at different positions along the third dimension. The current page number is displayed in the status bar of the HDFView.
To flip a data sheet of a 3-D dataset, use the “First”, “Previous”, “Next” or “Last” command on the tool bar.
The following figure shows how a 4-D integer dataset of size 5 x 4 x 3 x 2 is displayed. The data is displayed in a spreadsheet of 5 X 4 (dim0 by dim1), of page 2 (dim2), cutting locations 2 at dim3.
Spreadsheet with 4-D dataset
By default, HDFView chooses the first coordinate, dim[0], as the ROW index and the second coordinate, dim[1], as the COLUMN index. For example, a 2-D dataset of 8 X 9 (dim0=8, dim1=9) is displayed as eight rows and nine columns by default.
You can also swap the dimension order. However, swapping the dimension order does not change the data order. To change the data order, use the “Transpose” option. Swapping and transposing only apply to the data in the display and not to the data in the file.
Let us use the previous example to demonstrate this procedure.
| 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
| 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 |
| 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
| 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
| 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 |
| 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 |
By default, the dataset is displayed as eight rows and nine columns.
Default dimension order -- row index = dim[0], column index = dim[1]
Swap row and column dimensions to display the dataset as nine rows and eight columns. The order of data stays the same (counting from the location [0, 0], [0, 1], ... [2, 0], [2, 1], ...).
Swap row/column dimensions -- row index = dim[1], column index = dim[0]
In some cases, we also want to transpose the data (changing the data order) when we swap the row and column dimensions. To transpose the data, select the “Transpose” option from the drop-down menu. For example, transpose the data to display the dataset as nine rows and eight columns. The order of the data is also changed.
Transpose data -- row index = dim[1], column index = dim[0]
HDFView displays HDF4 Vdata and a simple, one-dimension HDF5 compound dataset (without a nested compound) as a 2-D table with rows as records and columns as fields/members.
Compound dataset
You can also select fields/members to display. For a contiguous selection, hold down the “Shift” key while clicking the first and last fields/members of your selection. For a discontiguous selection, hold down the “Ctrl” key while clicking the fields/members that you want to select.
Field/Member selection of a compound dataset
HDFView displays a nested HDF5 compound dataset as a flat list of members. The nested names are separated by “.” (a period). For example, if a compound dataset “A” has the following nested structure:
A --> a_name A --> b_name A --> c_name A --> nested_name --> a_name A --> nested_name --> c_name i.e. A = {a_name, b_name, c_name, nested_name{a_name, c_name}}
The flat list of members of the compound dataset “A” will be {a_name, b_name, c_name, nested_name->a_name, nested_name->c_name}}.
Nested compound dataset
HDFView displays multi-dimension compound datasets as a 2-D table with nested sub-columns. The members are shown in the sub-columns.
2-D compound dataset
Column or row data of numerical values can be displayed in a simple line plot. Select rows or columns by dragging the mouse on the rows or columns that you want to plot; then click the chart icon: . The row or column data is plotted against a column or row index, respectively.
The following figure shows that data of five columns are displayed in five lines of different colors. The horizontal labels are the row index of the 100 data points. The vertical labels are the ten points of equal data range with the maximum and minimum of the column data. The line legend is drawn at the right of the line plot with column names and line colors.
Line plot
You can change the values of a dataset in two ways: type data into the table cell or paste data from the system clipboard. HDFView rejects invalid data values. For example, it does not accept a floating point number into an integer dataset. The table below lists the rules for entering data. Any changes of data values only exist in memory. They are not saved to file until you choose “Save” from the File menu, or, when you dismiss the table, you will be asked if you want to save the changes to the file.
| Data type | Acceptable formats |
|---|---|
| byte | -127 to 128 |
| short | -32768 to 32767 |
| int | -2147483648 to<PHONE_NUMBER> |
| float, double | Numbers of the form “99.9” or “8”, and “-9.9” or “-9”, and “.9” or “-.9” Numeric overflow or underflow will be detected. |
| string | A string longer than the stored value will be silently truncated when written to the file. |
| unsigned byte | 0 to 255 |
| unsigned short | 0 to 65535 |
| unsigned int | 0 to<PHONE_NUMBER> |
Data values can be copied with “Copy” and “Paste”. Data can be copied within a spreadsheet or between two spreadsheets. To copy data, select the data cells to copy, then choose the “Copy” command from the Table menu or press Ctrl+C on the keyboard. Then select the cells to paste into and select the “Paste“ command from the Table menu or press Ctrl+V on the keyboard.
You can also copy and paste between HDFView and other applications. To copy external data from other applications such as a text editor or Microsoft Excel, select and copy data from the application, then paste the data into the HDFView TableView, and vice versa.
You can also change values by using predefined math functions. To change table values, select the data area and choose the “Math conversion” command from the Table menu. A list of predefined mathematic functions are provided. Select a function and enter the function parameters. The values of the selected data cells will be changed based on the mathematic function.
Writing table data into an ASCII file is nearly transparent. Select “Export data to Text File” from the Table menu, and the Save Current Data to Text File dialog box pops up for you to enter the name of the file. The data values of the current table will be written to the file. The data values are separated by the data delimiter specified by the user options. The text file does not contain any datatype and dataspace information..
Save current data to text file
You can fill the table cells directly from a text file. Choose the “Import Data From Text File” command from the Table menu and select the text file to import. The data values must be separated by a space or the delimiter specified in “User Options”. The cells of the table are filled row by row starting with the selected cell. The line breaks in the text file are not important. For example,
10 11 12 13 14 15 16 17 18 19 20 21
and
10 11 12 13 14 15 16 17 18 19 20 21
are the same.
A dataset can store reference values of other datasets in the same file.
A dataset can store object references of other datasets. You can open a dataset containing object references. You can then right click on any value in the dataset and it will give two options, to either open as a table or an image.
Dataset storing object references
If opened as a table, then the dataset of reference value “7428” is opened as shown below.
Dataset pointed by object reference
A dataset can store dataset region reference values. You can right click on any value to either show the dataset as a table or an image.
Dataset pointed by region reference
The table data can be written to a binary file. Select “Export Data to Binary File” from the Table menu. Select the order in which you want the bytes to be. The Save Current Data to Binary File dialog box pops up for you to enter the name of the file. The data values of the current table will be written to the file. The binary file does not contain any datatype and dataspace information. Currently, only the entire contents of the table are written to a binary file..
Save current data to binary file
You can fill the table directly from a binary file. Choose the “Import Data From Binary File” command from the Table menu and select the byte order. It is assumed that the user should know the data type in the binary file and the byte order. Select the binary file to import. The cells of the table are filled with the corresponding values.
[Index] [1] [2] [3] [4] [5] [6] [7] [8]


Brock Women in Computer Science
"Organization for not necessarily academic open-source development projects "
View on GitHub
Download .zip
Download .tar.gz
Welcome to Brock Women in Computer Science's page
We are still working on the content of our web page. . .stay tuned!


Beta This is a test version of the layout of this page. Take the survey to help us improve it
Collection
Rules and regulations for other general qualifications.
This collection sets out rules and regulations for the following qualifications:
You should also read our requirements for all qualifications .


Article Headings in TOC
All the headings in this article should be place in TOC.
============================================= || || || ========== ========= ========= || || || || || || || || || || || || || || || || || || || || || || || || || || || ========= ========= || || || =============================================
All the headings in this article should be place in TOC.
Because of we use article.toc-scope
as selector to limit scope, so all of this article's heading should not in TOC, even the heading has a id attribute.
Cause the heading don't has a id attribute,even though in toc scope, it won't be place in TOC.


Akan Names of Ghana
The Akan people of Ghana frequently
give their children names in accordance
with the day of the week in which they were born.
The day names they are given have a
meaning that is concerned with the soul
and character of the person.
The middle names on the other hand,
have considerably more varieties and can
refer to their birth order, twin status
or an ancestor's middle name.


prior_alpha_beta.Rd
The function prior_alpha_beta
determines both the parameters
alpha
and beta
that are used
in bayesian wavelet thresholding
of noisy data. Estimation is based on
minimizing the avarage of forecast error.
prior_alpha_beta(x, h, k, lags, par = c(0.5, 1), lower = c(0, 0), upper = c(3, 3), control = list(), wtfunlist = list(), ...)
| x | A vector or a time series containing the data (headline inflation). |
|---|---|
| h | An integer to set the desired horizon. |
| k | An integer to determine the number of observations to include in the out-of-sample set. |
| lags | A data frame generated by the function |
| par | Initial values for the parameters to be optimized over. |
| lower | Bounds on the variables for the "L-BFGS-B" method. See |
| upper | Bounds on the variables for the "L-BFGS-B" method. See |
| control | A list of control parameters. See |
| wtfunlist | A named list of parameters to pass to function |
| ... | Additional parameters to pass to function |
A numeric vector of length two.
# Example 1 pq <- lags(1, 1) ipca <- coreinf_br$ipca prior_alpha_beta( x = ipca, h = 2, k = 5, lags = pq, lower = c(0.2, 0.5), wtfunlist = list(type = "wavelet"), type = "hard" )#> [1] 0.2000000 0.7280555# Example 2 if (FALSE) { # Including the best priors for denoising wthr_wd <- list( filter.number = 1, family = c("DaubExPhase"), type = c("wavelet", "station") ) # Note: initial alpha and beta must be included such # that the appropriate structure of wthr_args is maitained # after the inclusion of estimated priors wthr_thr <- list( type = c("soft"), alpha = 0.5, beta = 1 ) wthr_args <- wav_args_wthr(wthr_wd, wthr_thr, 3) # Best priors estimation and inclusion in wthr_args args_tbl2 <- wthr_args$args_tbl %>% dplyr::mutate(ab = purrr::pmap(., ~purrr::possibly(prior_alpha_beta, NA)( ipca, 2, 4, pq, lower = c(0.4, 0.6), upper = c(0.6, 1.1), control = list(reltol = 0.01), wtfunlist = list(..1, ..2, ..3), type = ..4, lr = ..7)), alpha = purrr::map_dbl(ab, ~`[`(.x, 1)), beta = purrr::map_dbl(ab, ~`[`(.x, 2))) %>% dplyr::select(-ab) wthr_args[[1]] <- args_tbl2 # Denoising after including estimated priors wav_smooth(ipca, wthr_args) }


Construction of a national shrine not realistic – Numo Blafo III
The President of the GaDangme Council of Wulom?i (Chief Priests), Numo Blafo III, has said the construction of a national shrine is not feasible since traditional worshippers have different forms of worship.
According to him, although they are all referred to as traditionalists, it would be difficult to have all of them under one roof.
“I don’t know how a national shrine is going to be like because we traditionalists have different ways of worship though we are all traditionalists. For example, a Tigare [a deity] worshipper will not be comfortable at the same place with somebody who is worshipping something else,” he said in an interview on Accra-based radio station, Citi FM.
The Minister of Chieftaincy and Religious Affairs, Mr Samuel Kofi Dzamesi, on Wednesday, said at a press briefing that the government has received requests to build a national shrine for traditional leaders and that the request was being studied since it would not be out of place.
According to Mr Dzamesi, following plans for the construction of a national cathedral and an already existing national mosque, he has received requests from a group of Wulom?i [Ga Traditional Priests] for a traditional shrine.
But Numo Blafo said he was hearing of the request and plans for the first time.
“Well, I’m only hearing about it. I think this needs to be interrogated properly because we are talking about a shrine,” he said.
“I don’t have an idea how a national shrine is going to be like and what exactly will go into the construction of a national shrine. Though we are all traditionalists, we have our ways and the forms through which we go about our activities."
"So that is what I’m trying to comprehend as to how it’s going to be like...[maybe] it will be a consensus where we say ok, annually, we will meet here as in a convention and offer sacrifices...I don’t know,” he said.


Rutherford Rocket Labs is a client led, group project where our team needed to meet the ever changing requirements given to or negotiated from our client over a 4 day period. The ultimate goal being inventory tracking software for a rocket manufacturing warehouse.
This was the first time we were ever tasked to create a product for someone other than ourselves - which proved tricker than it sounds because clients have ever changing needs, expectations, and may not be techincal enough in nature to explain the functionality they are trying to obtain. The project began with a client Q+A session where we learned as much as we could about the clients process, how the software would be used, and who would be using it. Next we whipped up some simple wireframes and iterated over them until they were signed off by the client - and then we began to build. We followed agile methodology while working in vertical slices to accomplish each task, meeting in with the client every morning and mid-afternoon.


You are on the {{Branch}} branch. Click here to find out more. (
{{Version}}
)
{{GamemodeTitle}}
{{ProblemCount}}
{{gm.title}}
{{game.title}}


PuzzleScript!
PuzzleScript is an open-source HTML5 puzzle game engine.
Make A Game
First Steps
Gallery


The toddler was playing when he fell into a pot of sambhar at a party thrown by his family to celebrate the opening of a shop on November 18 in Shabad, Telangana state, said G. Narsaiah, an inspector with Shabad police.
Sambhar is a spicy lentil-based vegetable stew that is popular in southern India.
The boy accidentally moved the lid covering the pot and fell in, Narsaiah said. He was rushed to hospital but died of burn injuries.
His father has filed a complaint with police but no arrests have been made.
Second death
Two people, including a school principal, are being investigated by police for negligence resulting in death over a similar, but unconnected, incident on November 13.
In that case, a six-year-old kindergarten student named Behlapuram Reddy died after falling into a pot of sambhar at a school in Panyam village, in Kurnool district of Andhra Pradesh state.
Reddy rushed with his classmates into the dining hall at the start of the school’s lunch hour, said R.M. Basha, assistant sub-inspector of Panyam police.
“When the boy ran in, he fell into the sambhar bowl. No school authorities were available. Some local workers pulled him out and took him to the hospital,” Basha said.
In India, school lunches are cooked in large pots that can be up to four feet (1.2 meters) in diameter.
The child was treated for burns at the local hospital but succumbed to his injuries last week.
Reddy’s father registered a case at the Panyam police station later that evening and police are now investigating. The two people under investigation were being held on judicial remand.
Last month, a two-year-old boy died after he fell through the opening of an abandoned borewell in the southern state of Tamil Nadu.
Authorities were unable to save him despite a three-day rescue operation involving more than 500 people.
More International News Stories
-
Over 75,000 lbs. of salad in 22 states recalled in E. coli outbreak November 22, 2019
-
Israeli PM Netanyahu indicted for bribery, fraud and breach of trust November 22, 2019
-
Bacteria-infected mosquitoes take bite out of deadly dengue November 22, 2019
-
BMW, Daimler and Volkswagen fined €100m after forming cartel to buy steel November 21, 2019
-
Former South Carolina deputy arrested for sex with teen in patrol car November 21, 2019
-
US judge temporarily stops 1st federal execution in 16 years November 21, 2019
-
DC priest says he was ‘too busy’ to abuse parishioners November 21, 2019
-
Utah woman faces lewdness charge for being topless at home in front of stepchildren November 21, 2019
-
Teen who ran ‘slave for sale’ Craigslist ad on black classmate faces hate crime charges November 21, 2019


{% extends "global/Base.html" %} {% load otree_tags %} {% block title %} Solution to Understanding Question {{ num_q }} of {{ total_q }} {% endblock %} {% block content %} {% if player.training_answer_mine == 52 %}
Your answer {{player.training_answer_mine}} for your compensation was correct.
{% else %}Your answer {{player.training_answer_mine}} for your compensation was incorrect.
{% endif %} {% if player.training_answer_others == 48 %}Your answer {{player.training_answer_others}} for the other traveler's compensation was correct.
{% else %}Your answer {{player.training_answer_others}} for the other traveler's compensation was incorrect.
{% endif %}Suppose that you claim the antiques are worth 50 points and the other traveler claims they are worth 100 points. What would you and the other traveler receive in compensation from the airline?
Solution: You would receive 52 points and the other traveler 48 points.
Explanation: You and the other traveler made different claims and yours was lower. Hence your claim, equal to 50, was paid to both of you. In addition, you received a reward of 2 and in total got 50+2=52 points. The other traveler received a penalty of 2 and in total got 50-2=48 points.
{% next_button %}
{% include instructions %} {% endblock %}


AUGUST 9 St Teresa Benedicta of the Cross (Edith
Stein), Virgin & Martyr
Edith
Stein (October 12, 1891 – August 9, 1942) was a German-Jewish philosopher, a
Carmelite nun, martyr, and saint of the Catholic Church, who died at
COLLECT
God of our Fathers, who brought the Martyr Saint Teresa Benedicta of the Cross to know your crucified Son and to imitate him even until death, grant, through her intercession, that the whole human race may acknowledge Christ as its Saviour and through him come to behold you for eternity. Who lives and reigns with you in the unity of the Holy Spirit, one God, for ever and ever.
Preface of Virgins and Religious
or of Martyrs


Company Logo
Menu
Home
About Us
Contact Us
Help & Support
Create Account
Search
Log in to your account
Email address
Password
keep me signed in
Sign me in
Don't have an account?
Sign up
Sign in with your social network for quick access
Sign in with Facebook
Sign in with google


Defending champions Portugal qualify for Euro 2020
by Agency ReportCristiano Ronaldo scored his 99th international goal as reigning champions Portugal secured their place at the Euro 2020 finals on Sunday with a 2-0 victory away to Luxembourg.
Bruno Fernandes struck the opening goal on 39 minutes before Ronaldo tapped in a scrappy second late on to clinch second place in Group B behind winners Ukraine, who drew 2-2 in Serbia.
Portugal became the 17th nation to qualify for next year’s multi-host tournament, which kicks off in Rome on June 12, joining the likes of world champions France, Spain, Italy and England.
Fernando Santos’ side knew they would book their place at Euro 2020 with a win or by matching Serbia’s result from their game in Belgrade.
But Portugal were made to work hard on a heavy pitch by a Luxembourg team ranked 96th in the world that notably held France to a 0-0 draw in 2018 World Cup qualifying.
Sporting Lisbon midfielder Fernandes broke the deadlock before half-time, controlling Bernardo Silva’s pinpoint pass expertly before lashing in from 20 yards.
Ronaldo, who smacked in a hat-trick in Thursday’s 6-0 thrashing of Lithuania, moved to the brink of his international century four minutes from time.
Silva’s far-post cross was forced towards goal by Diogo Jota, with Anthony Moris getting a hand to the ball before Ronaldo turned in from the goalline.
Iranian striker Ali Daei holds the world record with 109 international goals scored between 1993 and 2006.
(AFP)


| Question | # | Name | Type | Required | Placeholder | Values | Labels |
|---|---|---|---|---|---|---|---|
| This interaction is a | 1 | futype | radio | Yes | other,ct | Other communication with veteran,CT visit and/or communication about CT results | |
| Follow-up date | 2 | sidof | text | Yes | Follow-up date | ||
| Date of baseline CT | 3 | sidoe | text | Yes | Date of baseline CT | ||
| Follow-up Coordinator | 4 | sico | text | Yes | Coordinator | ||
| Reason for scan | 5 | fursnscn | textarea | Yes | |||
| Have you taken antibiotics since your last CT scan | 6 | siabx | radio | Yes | n | No | |
| y | Yes | ||||||
| Is this an annual CT scan | 7 | siaex | radio | Yes | n | No | |
| y | Yes | ||||||
| During the past year, have you experienced any of these symptoms - Cough producing bloody material | 8 | siwcb | checkbox | b | Cough producing bloody material | ||
| During the past year, have you experienced any of these symptoms - Unexplained weight loss greater than 20 lbs | 9 | siwcl | checkbox | l | Unexplained weight loss greater than 20 lbs | ||
| During the past year, have you experienced any of these symptoms - Unexplained hoarseness | 10 | siwch | checkbox | h | Unexplained hoarseness | ||
| During the past year, have you experienced any of these symptoms - other | 11 | siwco | checkbox | o | Other | ||
| During the past year, have you experienced any of these symptoms - other specified | 12 | siwcos | text | Yes | Cough producing bloody material | ||
| If yes, have you seen a physician for these symptoms | 13 | siwcp | radio | n | No | ||
| y | Yes | ||||||
| If yes, have you seen a physician for this - whom | 14 | siwcw | text | Whom? | |||
| If yes, are you now experiencing symptoms | 15 | siwcn | radio | n | No | ||
| y | Yes | ||||||
| When did you most recently have a chest CT | 16 | siact | select-one | - | - | ||
| a | Less than 6 months ago | ||||||
| b | 6 months to 18 months ago | ||||||
| f | 18 months to 3 years ago | ||||||
| c | 3 years to 5 years ago | ||||||
| d | Over 5 years ago | ||||||
| e | Never | ||||||
| Have you been hospitalized in the past year | 17 | siho | radio | Yes | n | No | |
| y | Yes | ||||||
| What were you hospitalized for in the past year | 18 | sihow | text | For what? | |||
| What year were you hospitalized | 19 | sihod | text | YYYY | |||
| Where were you hospitalized | 20 | sihol | text | Where? | |||
| Have you had a diagnosis of cancer in the past year | 21 | sicd | radio | Yes | n | No | |
| y | Yes | ||||||
| What part of the body did you have cancer in | 22 | sicdl | select-one | - | - | ||
| br | Breast | ||||||
| co | Colon / rectum | ||||||
| li | Liver | ||||||
| lu | Lung / bronchus | ||||||
| ov | Ovary | ||||||
| pa | Pancreas | ||||||
| pr | Prostate | ||||||
| sk | Skin | ||||||
| st | Stomach | ||||||
| ut | Uterus | ||||||
| os | Other (specify) | ||||||
| What part of the body did you have cancer in - Other specify | 23 | sicdls | text | Other? | |||
| When were you diagnosed | 24 | sicdd | text | When were you diagnosed? | |||
| If lung cancer has been diagnosed, have you had surgery | 25 | silcs | radio | Yes | n | No | |
| y | Yes | ||||||
| o | N/A | ||||||
| When did you have surgery | 26 | silcsd | text | When? | |||
| Where did you have surgery | 27 | silcsl | text | Where? | |||
| If a lung cancer has been removed, is there evidence of a recurrence | 28 | sier | radio | Yes | n | No | |
| y | Yes | ||||||
| o | N/A | ||||||
| If a lung cancer has been removed, is there evidence of recurrence? | 29 | sierd | text | Describe | |||
| Since your last followup, have you smoked cigarettes at all, even a puff? | 30 | sisa | radio | n | No | ||
| y | Yes | ||||||
| o | Never smoked | ||||||
| On average, how many cigarettes did you smoke per day? | 31 | sicpd | text | ||||
| How many packs of cigarettes did you smoke per day (PPD)? | 32 | sippd | text | ||||
| Quit date | 33 | siq | text | ||||
| Reported pack years | 34 | sippy | text | Yes | |||
| Cumulative reported pack years | 35 | sippycu | text | Yes | |||
| Since we last asked, have you ever tried to quit smoking | 36 | sittq | radio | n | No | ||
| y | Yes | ||||||
| o | N/A | ||||||
| How many times have you quit smoking for at least 24 hours | 37 | sittqt | text | ||||
| Since we last asked what, if any, smoking cessation methods have you used? - Have not tried to quit - Have not tried to quit | 38 | sisca | checkbox | a | Have not tried to quit | ||
| Since we last asked what, if any, smoking cessation methods have you used? - Cold Turkey by completely stopping on your own with no other assistance | 39 | siscb | checkbox | b | Cold Turkey by completely stopping on your own with no other assistance | ||
| Since we last asked what, if any, smoking cessation methods have you used? - Tapering or reducing number of cigarettes smoked per day | 40 | siscc | checkbox | c | Tapering or reducing number of cigarettes smoked per day | ||
| Since we last asked what, if any, smoking cessation methods have you used? - Self-help material (e.g., brochure, cessation website) | 41 | siscd | checkbox | d | Self-help material (e.g., brochure, cessation website) | ||
| Since we last asked what, if any, smoking cessation methods have you used? - Individual consultation or cessation counseling | 42 | sisce | checkbox | e | Individual consultation or cessation counseling | ||
| Since we last asked what, if any, smoking cessation methods have you used? - Telephone cessation counseling hotline (e.g., 1-855-QUIT-VET, 1-800-QUIT-NOW) | 43 | siscf | checkbox | f | Telephone cessation counseling hotline (e.g., 1-855-QUIT-VET, 1-800-QUIT-NOW) | ||
| Since we last asked what, if any, smoking cessation methods have you used? - Peer support (e.g.; Nicotine Anonymous) | 44 | siscg | checkbox | g | Peer support (e.g., Nicotine Anonymous) | ||
| Since we last asked what, if any, smoking cessation methods have you used? - Nicotine replacement therapy (e.g., patch; gum, inhaler, nasal spray, lozenge) | 45 | sisch | checkbox | h | Nicotine replacement therapy (e.g., patch, gum, inhaler, nasal spray, lozenge) | ||
| Since we last asked what, if any, smoking cessation methods have you used? - Zyban | 46 | sisci | checkbox | i | Zyban | ||
| Since we last asked what, if any, smoking cessation methods have you used? - Hypnosis | 47 | siscj | checkbox | j | Hypnosis | ||
| Since we last asked what, if any, smoking cessation methods have you used? - Acupuncture / acupressure | 48 | sisck | checkbox | k | Acupuncture / acupressure | ||
| Since we last asked what, if any, smoking cessation methods have you used? - Other | 49 | siscl | checkbox | l | Other | ||
| Since we last asked what, if any, smoking cessation methods have you used? - Other (specify) | 50 | siscos | text | Yes | Other (specify) | ||
| Are you seriously thinking of quitting smoking | 51 | siqst | select-one | - | - | ||
| y | Yes, within the next 30 days | ||||||
| m | Yes, within the next 6 months | ||||||
| n | No, not thinking of quitting | ||||||
| o | N/A | ||||||
| Tobacco cessation provided: | 52 | siscmd | radio | Yes | d | Declined | |
| a | Advised to quit smoking -- VA resources provided | ||||||
| i | Interested in VA tobacco cessation medication. Encouraged Veteran to talk to provider or pharmacist about which medication option is best for you. | ||||||
| Communications method: In Person | 53 | fucmotip | checkbox | 1 | |||
| Communications method: Telephone | 54 | fucmotte | checkbox | 1 | |||
| Communications method: TeleHealth | 55 | fucmotth | checkbox | 1 | |||
| Communications method: Mailed letter | 56 | fucmotml | checkbox | 1 | |||
| Communications method: Message in Patient Portal | 57 | fucmotpp | checkbox | 1 | |||
| Communications method: Video-on-Demand (VOD) | 58 | fucmotvd | checkbox | 1 | |||
| Communications method: Other | 59 | fucmotot | checkbox | 1 | |||
| Other contact method | 60 | fucmotoo | text | Yes | |||
| Additional details | 61 | fucmotde | textarea | ||||
| Last CT date | 62 | fulctdt | date | Yes | |||
| Communications method: In Person | 63 | fucmctip | checkbox | 1 | |||
| Communications method: Telephone | 64 | fucmctte | checkbox | 1 | |||
| Communications method: TeleHealth | 65 | fucmctth | checkbox | 1 | |||
| Communications method: Mailed letter | 66 | fucmctml | checkbox | 1 | |||
| Communications method: Message in Patient Portal | 67 | fucmctpp | checkbox | 1 | |||
| Communications method: Video-on-Demand (VOD) | 68 | fucmctvd | checkbox | 1 | |||
| Communications method: Other | 69 | fucmctot | checkbox | 1 | |||
| Other contact method | 70 | fucmctoo | text | Yes | |||
| Additional details | 71 | fucmctde | textarea | ||||
| Has a new CT/LDCT been ordered? | 72 | funewct | radio | Yes | n | No | |
| y | Yes | ||||||
| Communication to pulmonary? | 73 | fucompul | radio | n | No | ||
| y | Yes |


{{totalFee}}
{{freight}}
{{intoWarehouseCost}}
{{unloadingCharge}}
{{shortBargeCost}}
{{extraCharge}}
{{other}}


Cookbook/FileCompression
File Compression
kdb+ has built-in optional file compression as of version 2.7.
FAQ
Q) How do I compress a file?
A) Use the -19! operator. e.g.
-19!(`:sourceFile;`:targetFile;logicalBlockSize;compressionAlgorithm;compressionLevel)
where
- logicalBlockSize is a power of 2 between 12 and 20 (pageSize or allocation granularity to 1MB - pageSize for AMD64 is 4kB, sparc is 8kB. Windows seems to have a default allocation granularity of 64kB). Note that this argument affects both compression speed and compression ratio (larger blocks can be slower and better compressed)
- compressionAlgorithm is one of the following, 0 - none, 1 - kdb+ ipc, 2 - gzip
- compressionLevel is between 0 and 9 (valid only for gzip, use 0 for other algorithms)
Return value - the compression level achieved, as a %.
q)`:test set asc 10000000?100; / create a test data file q) / compress input file test, to output file ztest, using a block size of 128kB (2 xexp 17), gzip level 6 q)-19!(`:test;`:ztest;17;2;6) 99.87667 q)get[`:test]~get`:ztest / check the compressed data is the same as the uncompressed data 1b
Q) How do I save directly to a compressed file?
A) Since v2.8 2011.11.21, kdb+ supports streaming file compression, i.e. the data is compressed as it is written to disk.
This is achieved through the overriding of "set", in that the lhs target of set can be a list describing the file or splay target, with the compression parameters. For example
(`:ztest;17;2;6) set asc 10000?`3 (`:zsplay/;17;2;6) set .Q.en[`:.;([]sym:asc 10000?`3;time:.z.p+til 10000;price:10000?1000.;size:10000?100)]
kdb+ compressed files/splays can also be appended to. e.g.
q)(`:zippedTest;17;2;6) set 100000?10;`:zippedTest upsert 100000?10;-21!`:zippedTest
Appending to files with an attribute (e.g. `p# on sym) causes the whole file to be read and rewritten. Currently, unless .z.zd is set accordingly, this would be rewritten in a non-compressed format regardless of its original format.
'compress new files' mode - active if .z.zd (zip defaults) present and valid. .z.zd can be set to an int vector of (blockSize;algo;zipLevel) to apply to all new files which do not have a file extension. .e.g
q).z.zd:(17;2;6);`:zfile set asc 10000?`3 -19!x and (`:file;size;algo;level) set x take precedence over .z.zd
To reset to not compress new files, use \x, e.g.
q)\x .z.zd
Since kdb+v2.8 2011.11.28, the zip params can be a dictionary of filenames!zipParams. The null ` entry in the dict is the default zipParams, or if no ` specified then default will be do not compress. e.g.
q)(`:splay/;``a`b!((17;2;9);(17;2;6);(17;2;6)))set([]a:asc 1000000?10;b:asc 1000000?10;c:asc 1000000?10)
N.B.
Do not use streaming compression with log files, as in the event of a crash, the log file will be unusable as it will be missing meta information from the end of the file. Streaming compression maintains the last block in memory and compresses/purges it as needed or latest on close of file handle.
Q) How do I decompress a file?
A) just read the file, e.g.
get`:compressedFile
If you want to store it again decompressed, then use
`:uncompressedFile set get `:compressedFile
Q) I want to use algorithm #2 (gzip). Do I need additional libraries??
A) Yes, but these may already be installed on your system. It binds dynamically to zlib (more info at http://zlib.net). For windows we chose to be compatible with the dlls from http://www.winimage.com/zLibDll/zlib125dll.zip. For linux and solaris you may find it convenient to install zlib using your package manager software, or consult your system administrator for assistance. Note that your will require the matching 32 or 64bit libs for kdb+, i.e. 32bit libs for 32bit kdb+, 64bit libs for 64bit kdb+.
Q) When compressing data, if the source file and the target file are on the same drive, it might run slowly. Why?
A) The compression routine is reading from the source file, compressing the data and writing to the target file. The disk is likely being given many seek requests. Try to locate the targetFile to a different physical disk, this will reduce the number of seeks needed.
Q) How can I tell if a file is compressed?
A)execute -21!`:filename
q)-21!`:testfile compressedLength | 2100716 uncompressedLength| 8000300 algorithm | 2 logicalBlockSize | 17
Q) Does the compression format support random access to the data?
A) Yes.
Q) Does the compression require column data to be compressed using the -19! operation, or will running gzip on column data also work?
A) Yes, you have to use the -19! operation as the file format is different to gzip.
Q) Is it be possible to compress only some partitions, or even only some columns for a table within a partition? (For instance, for a database partitioned by date.)
A) Yes, you can choose which files to compress, and which algorithm/level to use per file; the same kdb+ process can read compressed and uncompressed files. So for files that don't compress well, or have an access pattern that does not perform well with compression, you could leave those uncompressed.
Q) How fast is the decompression?
A) A single thread with full use of a core can decompress approx 300MB/s, depending on data/algorithm and level.
Q) Is there a performance impact?
A) People are often concerned about the cpu overhead associated with compression, but the actual cost is difficult to calculate. On the one hand, compression does trade cpu utilization for disk space savings. And up to a point, if you're willing to trade more CPU time, you can get more space savings. But by reducing the space used, you end up doing less disk I/O, which can improve overall performance if your workload is bandwidth-limited. The only way to really know the impact of compression on your disk utilization and system performance is to run your workload with different levels of compression and observe the results.
Q) When is decompression done and how long is decompressed data cached?
A) Files are mapped/unmapped on demand during a query, only the areas of the file that are touched are decompressed, i.e. it supports random access. Decompressed data is cached for the lifetime that a file is mapped. Since v2.7 2011.04.30 columns are mapped for the duration of the select.
Q) Say you're querying by date and sum over a date partitioned table, with each partition parted by sym - will the query just decompress parts of the column data for the syms in the query predicate?
A) Yes.
Q) Can I append to a compressed file?
A) Yes, since kdb+ v2.8 2011.11.21. Appending to compressed enum files was blocked in v3.0 2012.05.17 due to potential concurrency issues, hence these files should not be compressed.
Q) Which is better, ZFS compression or built-in kdb+ compression?
A) Currently, ZFS compression probably has an edge due to keeping more decompressed data in cache which is available to all processes.
Q) Is the compression or decompression multithreaded?
A) The reading or writing of a compressed file must NOT be performed concurrently from multiple threads. However, multiple files can be read or written from their own threads concurrently (one file per thread). For example, a par.txt'd historical database with slave threads will be using the decompression in a multithreaded mode.
Q) What's the difference among different logicalBlockSize (pageSize to 1MB) and compressionLevel (1 to 9 for gzip)? What's a standard recommendation?
A) The logicalBlockSize represents how much data is taken as a compression unit, and consequently the minimum size of a block to decompress. e.g. using a logicalBlockSize of 128kB, a file of size 128000kB would be cut into 100 blocks, and each block compressed independently of the others. Later, if a single byte is requested from that compressed file, a minimum of 128kB would be decompressed to access that byte. Fortunately those types of access patterns are rare, and typically you would be extracting clumps of data that make a logical block size of 128kB quite reasonable. Ultimately, you should experiment with what suits your data, hardware and access patterns best. A good balance for taq data and typical taq queries is to use algorithm 1 (the same algorithm as used for ipc compression) with 128kB blockSizes. For those who can accept slower performance but better compression, they can choose gzip with compression level 6.
Q) hcount`:compressedFile returns the uncompressed file length. Is this intentional?
A) Yes. In our defense, ZFS has similar issues - http://blog.buttermountain.co.uk/2008/05/10/zfs-compression-when-du-and-ls-appear-to-disagree
Compressed file size can be obtained from -21!`:compressedFile
Q) Is there a limit on the number of compressed files that can be open simultaneously?
A) Yes, currently the limit is 4096 files. There is no practical internal limit on the number of uncompressed files.
Q) Does kdb+ file compression use more memory than working with non-compressed files?
A) Due to the nature of working with vectors, kdb+ allocates enough space to decompress the whole vector, regardless of how much it finally uses. This reservation of memory is required as there is no backing store for the decompressed data, unlike with mapped files of non-compressed data which can always read the pages from file again should they have been dropped. However, this is reservation of memory only, and can be accommodated by increasing the swap space available - even though the swap should never actually be written to, the OS has to be kept happy that in the worst case scenario of decompressing the data in full, it could swap it out if needed. If you experience wsfull even when sufficient swap space is configured, check whether you have any soft/hard limits imposed with ulimit -v. Also be aware of your memory overcommit settings on linux, /proc/sys/vm/overcommit_memory
and /proc/sys/vm/overcommit_ratio - these control how careful linux is when allocating address space wrt available physical memory plus swap.
Q) What compression ratios should I expect?
A) Using real nyse trade data, we observed the gzip algorithm at level 9 compressing to 15% of original size, and the ipc compression algorithm compressing to 33% of original size.
Q) Do you have any benchmarking tips?
A) Perform your benchmarks on the same hardware setup as you would use for production and be aware of the disk cache - flush the cache before each test. The disk cache can be flushed on linux using
sync ; sudo echo 3 | sudo tee /proc/sys/vm/drop_caches
and on osx, the OS command 'purge' can be used.
Q) Can I use a hardware accelerator card to improve compression performance?
A) Yes. For example, the AHA367-PCIe 10.0 Gbits/sec GZIP Compression/Decompression Accelerator Card.
kdb+ v2.7 can use this card via the zlib shared library api. The card may be obtained directly from aha.com -
see http://aha.com/show_prod.php?id=38
This card was observed to be compatible with kdb+ 2.7 2010.08.24 on Linux 2.6.32-22-generic SMP Intel i5 750 @ 2.67GHz 8GB RAM.
Using sample NYSE quote data from 2010.08.05, 482 million rows, compression ratios and timings were observed as below.
The uncompressed size of the data was 12GB, which compressed to 1.7GB, yielding a compression ratio 7:1 (the card currently has a fixed compression level).
The time taken to compress the data was 65077mS with the AHA card enabled versus 552506mS using zlib compression in pure software. i.e. using the AHA card took 12% of the time to compress the same amount of data to the same level, achieving approx. a 10x speed up, using just one channel only. For those wishing to execute file compression in parallel using the peach command, all 4 channels on the card can be used.
The AHA zlib shared lib can be run in 3 modes - compression+decompression, compression only or decompression only. With kdb+ using just a single channel of the card, the decompression performance of the card was slightly slower than as in software, although when kdb+ was used in a multithreaded mode, increased overall performance was observed due to all 4 channels being used thereby freeing up the main cpu.
AHA also offer other cards, the AHA360PCIe (1 channel) and the AHA363PCIe (2 channel), however these have not yet been tested for compatibility.
Installation is very straightforward - unpack and plug-in the card, compile and load the driver, compile and install the zlib shared library. As a reference, it took less than 30 minutes from opening the box to having kdb+ use it for compression. A very smooth installation.
Runtime troubleshooting for the AHA 367 card
If you see the error message
aha367 - ahagz_api.c: open() call failed with error: 2 on device /dev/aha367_board
this likely means the kernel module has not been loaded. Remedy - go to the <aha install dir>/bin and execute sudo ./load_module and select the 367 card option.
Another accelerator card vendor (untested) - http://www.indranetworks.com/SCMX3.html
Q) Do I need to tweak the kernel settings in order to work with compressed files?
A) On linux, perhaps - it really depends on the size and number of compressed files you have open at any time, and the access patterns used. For example, random access to a compressed file will use many more kernel resources than sequential access.
If you find that kdb+ is seg faulting (crashing) when accessing compressed files, try increasing the linux kernel parameter vm.max_map_count
as root $ sysctl vm.max_map_count=16777216
and/or make a suitable change for this parameter more permanent through /etc/sysctl.conf
as root $ echo "vm.max_map_count = 16777216" | tee -a /etc/sysctl.conf $ sysctl -p
You can check current settings with
$ more /proc/sys/vm/max_map_count
Assuming you are using 128kB logical size blocks for your compressed files, a general guide is, at a minimum, set max_map_count to 1 map per 128kB of memory, or 65530, whichever is higher.
Q) Can I run kdb+ under gdb (the gnu debugger), and use compressed files?
A) You should only ever need to run gdb if you are debugging your own custom shared libs loaded into kdb+.
gdb will intercept SIGSEGV which should be passed to kdb+; to tell it to do so, issue the following command at the gdb prompt
(gdb) handle SIGSEGV nostop noprint
Q) I use kdb+ with R Server for Q, i.e. R as shared library loaded into kdb+. Does this work with compressed files?
A) R uses signal handling to detect stack overflows. This conflicts with kdb+'s use of signals for handling compressed files, causing kdb+ to crash. R's use of signals can be suppressed by setting the variable R_SignalHandlers (declared in Rinterface.h) to 0 when compiling the relevant R library.
Q) I'd like to use Transparent Huge Pages (THP) on Linux. Is this compatible with the kdb+ file compression?
A) No. We have had reports of systems stalling due to THP fragmentation. Disable THP either with the shell command
echo never >/sys/kernel/mm/redhat_transparent_hugepage/enabled
or more permanently via grub at boot time
transparent_hugepage=never
n.b. kdb+ must be restarted to pick up the new setting.


Interceptor boats arrive
by Staff ReporterAs part of security arrangements during the visit of President Ram Nath Kovind to the Ezhimala Naval Academy on Tuesday, two high-speed interceptor boats of the Indian Navy from Kochi Naval Base arrived at the Azhikal port on Monday.
A team led by Lieutenant Navaneet and Lieutenant Ishan came by the interceptor boats T-410 and T-315 here. U. Babu Gopinath, representative of the Minister of Ports and Highways, Senior Port Conservator M. Sudheer Kumar, Officer-in-Charge Captain Pratheesh, and Port Supervisor E.T. Namith received the naval staff.


| changelog | download | home | install | notes |
The command opentheory help is used to display tool help, including the options available for each command. Other than this, the main source for information is the OpenTheory project.
The opentheory tool is developed by Joe Leslie-Hurd.


Ian Paterson
Presented by Ian Paterson
|
Nuclear Fusion
|
Nuclear Fission
|
| Options: | What you Mine | Fissile Material (What you burn) |
|---|---|---|
| 1 | U235 |
U235 <- This is what we usually use |
| 2 | U238 |
Pu239 |
| 3 | Th232 |
U233 <- This is what we would like to use |
Watts Bar - Tennessee
Reactor pressure vessel for AP1000
6 = Previously molten material
Additional information:
Full list of III+ Gen designsTh-232 + neutron => Pa-233 => 27 days => U-233
U-233 + neutron => Fission products + Energy + more neutrons
This presentation: https://tinyurl.com/nyt9uor


This is the first page.
Push Page
Back
Page 2
Pop Page
This is the second page.
This is the second page.


--- layout: post title: "The Gigcast" --- The folks over at the Gigcast have nothing but kind things to say about Civil Wardrobe. Download the podcast here.


Species: Talapia
Habitat: Pond
Average Size: 100g
Stock: 500
Current Temp: 20 C
Recomendations: Feed 5 kg, 3 times a day 0.7 mm feed.
Species: Talapia
Habitat: Pond
Average Size: 150g
Stock: 450
Current Temp: 22 C
Recomendations: Feed 10 kg, 2 times a day 1 mm feed.
Species: Catfish
Habitat: Cage
Average Size: 300g
Stock: 200
Current Temp: 23 C
Recomendations: Feed 15 kg, 3 times a day 2 mm feed.
Species: Shrimp
Habitat: Pond
Average Size: 50g
Stock: 1000
Current Temp: 21 C
Recomendations: Feed 10 kg, 3 times a day 0.3 mm feed.


RPL(1) BSD General Commands Manual RPL(1) NAME rpl — replace strings in files SYNOPSIS rpl [-LhiwbqvsRepfdt] [-xSUFFIX] ⟨old_string⟩ ⟨new_string⟩ ⟨target_file ...⟩ DESCRIPTION Basic usage is to specify two strings and one or more filenames or directo‐ ries on the command line. The first string is the string to replace, and the second string is the replacement string. -h, --help A short help text. -L, --license Show the license and exit. -xSUFFIX Search only files ending with SUFFIX, e.g. “.txt”. May be speci‐ fied multiple times. -i, --ignore-case Ignore the case of old_string. -w, --whole-words Make old_string match only on word boundaries. -b, --backup Move the original files to filename~ before replacing them. -q, --quiet Quiet mode. -v, --verbose Verbose mode. -s, --dry-run Simulation mode, no files are changed. -R, --recursive Recurse into subdirectories. -e, --escape Expand escape sequences in old_string and new_string. Examples of escape sequences are ‘\n’ (new-line), ‘\t’ (tab), ‘\x42’ (hexadeci‐ mal number 42), ‘\033’ (octal number 033). -p, --prompt Prompt for confirmation before replacing each file. -f, --force Ignore errors when trying to restore permissions and file owner‐ ship. -d, --keep-times Keep modification times when replacing files. -t, --use-tmpdir Use a temporary directory for storing temporary files, usually the value of the environment variable TMPDIR. The default is to put temporary files in the same directory as the file being modified. -a, --all Do not ignore files and directories starting with . IMPLEMENTATION NOTES An effort has been made to make the program behave as much as the original rpl as necessary. Where it has been possible to make improvements, improvements have been made. This implementation lacks many of the bugs in the original. EXAMPLES Replace all occurences of “F” (on word boundaries) with “A” in all text files under the grades/ directory: $ rpl -Rwd -x'.txt' 'F' 'A' grades/ SEE ALSO find(1), sed(1). HISTORY This program was written for Debian as a free replacement for the non-free rpl program by Joe Laffey. AUTHORS Göran Weinholt<EMAIL_ADDRESS>Debian July 31, 2005 Debian


{% for r in restaurants %} {% endfor %}
{{len}}
Pick a restaurant:
{% for r in restaurants %}
{{r.rname}}
{% endfor %}
Name:
Number of people:
Pick a date:
Pick a time:
Make reservation
{% for r in reservations %}
{{r[0]}} on {{r[1]}} at {{r[2]}}, table {{r[3]}}
{% endfor %} Processed by container ID {{hostname}}


heavy: Robust Estimation Using Heavy-Tailed Distributions
Functions to perform robust estimation considering heavy-tailed distributions.
Currently, the package includes routines for linear regression, linear mixed-effect
models, multivariate location and scatter estimation, multivariate regression,
penalized splines, random variate generation and some support functions.
Downloads:
Reverse dependencies:
Linking:
Please use the canonical form
https://CRAN.R-project.org/package=heavy
to link to this page.


Represents a reassembly engine that takes in a number of small fragment byte arrays generated by a Fragmenter, and reassembles the large byte array that the fragments were generated from.
| Type Params | Return Type | Name and description |
|---|---|---|
|
int |
addFragment(byte[] fragment) Adds a fragment for reassembly. |
|
byte[] |
getData() Gets the reassembled data, if reassembly is complete. |
|
long |
getDataLength() Gets length of the data array to reassemble. |
|
int |
getFragmentCount() Gets the number of fragments successfully added during reassembly. |
|
int |
getFragmentLength() Gets length of each fragment. |
|
int |
getMaxFragmentCount() Gets the maximum number of fragments possible. |
|
int |
getMinFragmentCount() Gets the minimum number of fragments required to reassemble the data. |
|
boolean |
hasFinishedReassembly() Checks if the reassemble is complete. |
Adds a fragment for reassembly. A fragment may fail to be added if the reassembly is already complete, or if the fragment is malformed.
Gets the reassembled data, if reassembly is complete.
Gets length of the data array to reassemble.
Gets the number of fragments successfully added during reassembly.
Gets length of each fragment.
Gets the maximum number of fragments possible.
Gets the minimum number of fragments required to reassemble the data.
Checks if the reassemble is complete.


No more complex licensing and contracts. No more expensive and difficult to manage server farms. WestFax is a 100% cloud based HIPAA compliant fax solution.
Over 60% less expensive than traditional Fax server providers.
No more expensive and complex servers. 100% cloud-based.
We get your integration migrated fast with ZERO downtime.
Fax from your desktop, MFP device, EHR, EMR or phone.
No license required or complex seat management.
No more expensive piecemeal pricing. No more settling.
DOWNLOAD
OUR HIPAA SECURITY MATRIX
Download our simple 4 page report that distills
the WestFax HIPAA compliance measures into an easy to digest format.
We have a lot of experience migrating customers from RightFax.
FORM GOES HERE


|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Buffer
Encapsulates a sequence of bytes to be used for I/O operations.
| Field Summary |
|---|
| Fields inherited from interface org.ogf.saga.SagaObject |
|---|
NO_WAIT, WAIT_FOREVER |
| Method Summary | |
|---|---|
void |
close()
Non-blocking close of the buffer object. |
void |
close(float timeoutInSeconds)
Closes the buffer object. |
byte[] |
getData()
Retrieves the buffer data. |
int |
getSize()
Retrieves the current value of the buffer size. |
void |
setData(byte[] data)
Sets the buffer data. |
void |
setSize()
Sets the size of the buffer. |
void |
setSize(int size)
Sets the size of the buffer. |
| Methods inherited from interface org.ogf.saga.SagaObject |
|---|
clone, getId, getSession |
| Method Detail |
|---|
void setSize(int size) throws BadParameterException, IncorrectStateException, NoSuccessException
size
- the size.
IncorrectStateException
- is thrown when the buffer is closed.
BadParameterException
- is thrown when the implementation cannot handle the specified size.
NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.void setSize() throws BadParameterException, IncorrectStateException, NoSuccessException
IncorrectStateException
- is thrown when the buffer is closed.
BadParameterException
- is thrown when the implementation cannot handle the default size.
NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.int getSize() throws IncorrectStateException
IncorrectStateException
- is thrown when the buffer is closed.void setData(byte[] data) throws BadParameterException, IncorrectStateException, NoSuccessException
data
- the data.
IncorrectStateException
- is thrown when the buffer is closed.
BadParameterException
- is thrown when the implementation cannot handle the specified data buffer.
NoSuccessException
- is thrown when the operation was not successfully performed,
and none of the other exceptions apply.byte[] getData() throws DoesNotExistException, IncorrectStateException
IncorrectStateException
- is thrown when the buffer is closed.
DoesNotExistException
- is thrown when the buffer was created with size -1, and no
I/O operation has been done on it yet.void close()
void close(float timeoutInSeconds)
timeoutInSeconds
- he timeout in seconds.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


Germans are known for being sticklers for following rules. find out what you need to know to get by in this proud country.
For example, don’t expect to be served tap water at restaurants. In fact, don’t even ask for tap water. All you will get is a strange look, because bottled water is what’s on the menu.
Egyptians are known for their generosity and hospitality. Most families are conservative and religous, and so most etiquette is based on religious beliefs.
You should always eat with your right hand and enter a house with your right foot. The left side of the body is used for 'unclean' things. Also, wearing short shorts and skirts can be disrespectful to some people.
Contribute cultural travel tips and help people navigate your country


[§521-34] Authorization to confess judgment prohibited. A tenant may not authorize any person to confess judgment on a claim arising out of a rental agreement of any dwelling unit. An authorization in violation of this section is void. [L 1972, c 132, pt of §1]


--- title: Harmful Drinks in America layout: post ---
Wow, these are some sobering pics/stats. Glad I only drink water and coffee anymore ;-)


fun4j builds upon one central concept: functions as first class citizens. As the Java programming language does not have native support for functional programming we have to emulate it using object-oriented techniques: We need a Function object that allows to deal with functional abstractions. The base idea of a function is that it is a mapping that is applied to 0..n input arguments to result in one output value. This notion is expressed in the following definition of the Function interface:
package org.fun4j; public interface Function { /** * Apply this function to the given arguments. * * @param args the arguments passed to the function call * @return the result of applying the function to its arguments * */ Object apply(Object... args); }
Function objects implementing this interface can be passed as ordinary Object instances within Java code. So it's quite straightforward to use typical patterns of functional programming like the usage of higher-order functions to define transformations on Collections. I'll come back to this interesting topic shortly.
To create such a Function object in your Java code you can define it as an instances of anonymous classes like in the following code:
Function add = new Function(){ @Override public Object apply(Object... args) { return (Integer) args[0] + (Integer) args[1]; } };
This new Function object can now be invoked by calling its apply Method, here we using it to calculate 17 + 6:
System.out.println(add.apply(17,6));
Of course Functions can also defined as ordinary named classes like in the following definition:
public class Hash implements Function { @Override public Object apply(Object... args) { return new Integer(args[0].hashCode()); } }
This Function can then be used as follows:
Function hash = new Hash(); System.out.println(hash.apply("hello world"));
Both ways of creating functions as classes or as anonymous inner classes contain a lot of boilerplate coding even for simple function definitions. To ease the construction of function instances fun4j provides three alternative approaches.
fun4j provides a way to create a Function instance from any Java Method.
In the following code snippet you see how org.fun4j.Functions.functionFromMethod
is used
to create a sin
function from the static method Math.sin
.
import static org.fun4j.Functions.functionFromMethod; Function sin = functionFromMethod(Math.class.getMethod("sin", double.class)); System.out.println(sin.apply(Math.PI/2.0));
In the following example the zero-argument instance method getSize()
is used to create the function
size
.
Calling size.apply(box)
invokes the method call box.getSize()
.
Next the instance method contains(double x, double y)
is used to construct the function contains
.
Calling contains.apply(box, 40.0, 40.0)
invokes the mothd call
box.contains(40.0, 40.0)
Box box = new Box(0.0, 0.0, 100.0, 200.0); Function size = functionFromMethod(Box.class.getMethod("getSize", (Class<?>[]) null)); assertEquals(20000.0, size.apply(box)); Function contains = functionFromMethod(Box.class.getMethod("contains", double.class, double.class)); assertTrue((Boolean) contains.apply(box, 40.0, 40.0));
Using Functions.functionFromMethod(...)
drastically reduces boilerplate code.
If you want to get rid of filling in Method names and parameter types there is an even more
convenient mechanism available: contruction functions from methods in funcito style!
Funcito is a little framework that focusses on the construction of function instances for functional
programming frameworks like Functional Java, Guava and Jedi-core.
The resulting user code is very concise and clean, thus I have included function construction using the funcito idiom into fun4j.
The following example shows how the functions size
and contains
from the previous section
can be constructed using the fun4j funcito style syntax:
import static org.fun4j.Functions.callsTo; import static org.fun4j.Functions.functionFor; size = functionFor(callsTo(Box.class).getSize()); assertEquals(20000.0, size.apply(box)); // the 0.0 arguments don't represent actual values they just serve as placeholders for a double value: contains = functionFor(callsTo(Box.class).contains(0.0, 0.0)); assertTrue((Boolean) contains.apply(box, 40.0, 40.0));
The cool thing about this idea is that callsTo(Box.class)
generates a mock instance that
allows to write the candidate method exactly as any other method call.
Thus it's type safe at compile time and IDE code completion is available.
The only disadvantage: due to limitation of the CGLIB codegenerator this mechanism does not work for static methods.
Both Functions.functionFromMethod
and Functions.functionFor
allow to create functions
based on existing Java methods.
They do not provide a mechanism to write new functions from scratch.
In order to write new functions from scratch fun4j provides a way to define functions as lambda-terms in classic Lisp-syntax. Here is a short example that demonstrates the basic idea:
import static org.fun4j.Template.fn; Function add = fn("(lambda (x y) (+ x y))"); assertEquals(16, add.apply(9,7));
Obviuosly it's much more concise to define the function add
in this way then by using the
notorious Java anonymous inner class syntax.
Please follow this link to read a more in depth tutorial on using Lisp/Scheme in fun4j.
Now that we know how to construct Functional objects we want to know how fun4j can help us to use them in Java code.
Using Function can be very useful when dealing with Collections. Let's have a look at some examples.
First we define a Collection of Integers [1, 2, 3, 4]
and a Function pow2 that computes the square of an Integer.
Now we want to apply this function to each element in the collection.
A typical Java solution would explicitely iterate over the collection and collect the results of the function applications into a new Collection.
With fun4j we do this with a single statement: fun4j.map(pow2, col);
import static org.fun4j.Collections.asCollection; import static org.fun4j.Collections.map; // construct a collection from a set of arguments Collection<Integer> col = asCollection(1, 2, 3, 4); // define powers2 function: f(x) => x*x Function pow2 = new Function(){ @Override public Object apply(Object... args) { return (Integer)args[0] * (Integer)args[0]; } }; // map applies a function to all elements of a collection Collection<Integer> result = map(pow2, col); assertEquals("[1, 4, 9, 16]", result.toString());
Here you can see how map
is implemented:
public static <E, F> Collection<F> map(Function fun, Collection<E> col) { Collection<F> result = new ArrayList<F>(col.size()); for (E el : col) { result.add((F)fun.apply(el)); } return result; }
Functional languages feel at home with higher order functions like map, that take other functions as arguments and compose complex computations from simple functions.
Here is another example:
import org.fun4j.Predicate; import static org.fun4j.Collections.filter; // define a predicate that returns true for even numbers Predicate even = new Predicate() { @Override public Boolean apply(Object... args) { Integer i = (Integer) args[0]; return (i % 2 == 0); } }; // compute pow2 for all even numbers in col result = map(pow2, filter(even, col)); assertEquals("[4, 16]", result.toString());
Here we are computing the squares for all even numbers in our collection.
The method filter
returns a Collection of all elements
of the input Collection that match the filter predicate.
It might be noteworthy here that Predicate
is a covariant extension of
the Function
interface. A Predicate must always return a Boolean value.
public interface Predicate extends Function { @Override Boolean apply(Object... args); }
This works thanks to Java's support for covariant return types.
For details have a look at org.fun4j.compiler.Expression.compile(...)
where a special bridge method is generated to delegate to the covariant method.
Fun4j also provides classic higher order functions like foldleft
and foldright
.
Here comes an example where foldright
is used to sum up all elements of a Collection by sequentially
adding each element of the Collection to an accumulator, which is initialized with 0:
import static org.fun4j.Collections.foldright; Collection<Integer> col = asCollection(1 , 2, 3, 4, 5, 6, 7, 8, 9, 10); Function add = new Function() { public Object apply(Object... args) { return (Integer) args[0] + (Integer) args[1]; } }; Integer sum = foldright(add, 0, col); assertEquals(new Integer(55), sum);
After working through these examples you might think: "Ok, this looks nice. BUT writing simple operations like an addition function as an anonymous inner class is not an elegent solution...".
Yes, that a valid point. The fun4j answer to this issue is to either re-use existing Java methods by wrapping them to functions using
Functions.functionFromMethod
or Functions.functionFor
or to
write functions in traditional Lisp / Scheme Syntax.
follow this link to learn more more about this approach.
In this section I'm going to present some more advanced examples to demonstrate how typical problems can be solved using fun4j. The examples are based on examples from the Functional Java site. So these examples also allow you to directly compare the look and feel of both fun4j and Functional Java.
Checks for the existence of a String that has all lower case characters.
import static org.fun4j.Collections.asCollection; import static org.fun4j.Functions.functionFromMethod; import static org.fun4j.Template.define; Collection<String> col = asCollection("Hello", "There", "what", "DAY", "iS", "iT"); final Predicate isLowerCase = (Predicate) functionFromMethod(Character.class.getMethod("isLowerCase", char.class)); define("isLowerCase", isLowerCase); // 1. define function in Java Syntax: assertTrue( Collections.exists(new Predicate() { public Boolean apply(Object... args) { return Collections.forAll(isLowerCase, Collections.fromString((String) args[0])); } }, col) ); // 2. define function in LISP Syntax: assertTrue( Collections.exists(predicate("(lambda (str) (Collections.forAll isLowerCase (Collections.fromString str) ))"), col) );
Filters all elements from a Collection that fulfill a certain criteria. In this case, we use the even predicate to select only the even numbers from a list.
import static org.fun4j.Collections.*; Collection<Integer> col = asCollection(97, 44, 67, 3, 22, 90, 1, 77, 98, 1078, 6, 64, 6, 79, 42); Collection<<Integer> result = filter(predicate("(lambda (n) (zero? (% n 2)))"), col); System.out.println(result);
Reduces the list applying a function per element. In this case, the fold sums the elements with a starting value of 0.
Collection<Integer> col = asCollection(97, 44, 67, 3, 22, 90, 1, 77, 98, 1078, 6, 64, 6, 79, 42); Integer result = foldleft(fn("(lambda (i j) (+ i j))"), 0, col); assertEquals(1774, result);
Checks that all Strings in a colletcion have only lower case characters. In this case, the check fails because of the case of "There".
Collection<String> col = asCollection("hello", "There", "what", "day", "is", "it"); final Predicate isLowerCase = (Predicate) functionFromMethod(Character.class.getMethod("isLowerCase", char.class)); define("isLowerCase", isLowerCase); // 1. define function in Java Syntax: assertFalse( Collections.forAll(new Predicate() { public Boolean apply(Object... args) { return Collections.forAll(isLowerCase, Collections.fromString((String) args[0])); } }, col) ); // 2. define function in LISP Syntax: assertFalse( Collections.forAll(predicate("(lambda (str) (Collections.forAll isLowerCase (Collections.fromString str) ))"), col) );
Maps a function across a list of integers. This example adds 42 to each element of the list to produce a new list.
Collection<Integer> ints = asCollection(1, 2, 3); Collection<Integer> actual = Collections.map(fn("(lambda (i) (+ i 42))"), ints); assertEquals(asCollection(43, 44, 45), actual);
Sorts the given list:
Predicate intOrd = predicate("(lambda (x y) (> x y))"); Listlist = (List ) asCollection(97, 44, 67, 3, 22, 90, 1, 77, 98, 1078, 6, 64, 6, 79, 42); assertEquals(asCollection(1, 3, 6, 6, 22, 42, 44, 64, 67, 77, 79, 90, 97, 98, 1078), sort(list,intOrd)); // sorting is NOT destructive ! assertEquals(asCollection(97, 44, 67, 3, 22, 90, 1, 77, 98, 1078, 6, 64, 6, 79, 42), list);
Partial application allows to bind data to the Variables of a Function.
Take for example the Function add(m,n) => m + n
.
This function has two variables m
and n
.
The following code shows how to create a partial application by binding the values 17 to m
:
// org.fun4j.Template is the central facade to the fun4J API. // A default instance can be obtained by a static import: import static org.fun4j.Template.fun4j; Function add = new Function(){ public Object apply(Object... args) { return (Integer) args[0] + (Integer) args[1]; } }; Function add17 = fun4j.bind(add, 17); assertEquals(23, add17.apply(6));
As you can see a partially applied function is again a function.
Thus it can be evaluated by calling the apply()
method.
This short example demonstrate that partial application can be used to preserve state and to produce delayed computations that can be reached around in an application until it they are finally executed.
How can this be useful? Consider the computation of VAT. It can be considered as a partial
application of the function mul(x,y) => x * y
to the actual tax-rate.
The following code shows how this can be done with fun4j:
Function mul = new Function() { protected Object apply(Object... args) { Double x = (Double) args[0]; Double y = (Double) args[1]; return x * y; } }; Function germanVat = fun4j.bind(mul, 0.19); Function britishVat = fun4j.bind(mul, 0.175); System.out.println(germanVat.apply(495.00)); System.out.println(britishVat.apply(495.00));


21
Arad Destroyed
1 When the Canaanite, the king of Arad, who lived in the Negeb, heard that Israel was coming by the way of Atharim, he fought against Israel, and took some of them captive.
2 And Israel vowed a vow to the LORD and said, “If you will indeed give this people into my hand, then I will devote their cities to destruction.”
3 And the LORD obeyed the voice of Israel and gave over the Canaanites, and they devoted them and their cities to destruction. So the name of the place was called Hormah.
The Bronze Serpent
4 From Mount Hor they set out by the way to the Red Sea, to go around the land of Edom. And the people became impatient on the way.
5 And the people spoke against God and against Moses, “Why have you brought us up out of Egypt to die in the wilderness? For there is no food and no water, and we loathe this worthless food.”
6 Then the LORD sent fiery serpents among the people, and they bit the people, so that many people of Israel died.
7 And the people came to Moses and said, “We have sinned, for we have spoken against the LORD and against you. Pray to the LORD, that he take away the serpents from us.” So Moses prayed for the people.
8 And the LORD said to Moses, “Make a fiery serpent and set it on a pole, and everyone who is bitten, when he sees it, shall live.”
9 So Moses made a bronze serpent and set it on a pole. And if a serpent bit anyone, he would look at the bronze serpent and live.
The Song of the Well
10 And the people of Israel set out and camped in Oboth.
11 And they set out from Oboth and camped at Iye-abarim, in the wilderness that is opposite Moab, toward the sunrise.
12 From there they set out and camped in the Valley of Zered.
13 From there they set out and camped on the other side of the Arnon, which is in the wilderness that extends from the border of the Amorites, for the Arnon is the border of Moab, between Moab and the Amorites.
14 Wherefore it is said in the Book of the Wars of the LORD,
“Waheb in Suphah, and the valleys of the Arnon,
15 and the slope of the valleys
that extends to the seat of Ar,
and leans to the border of Moab.”
16 And from there they continued to Beer; that is the well of which the LORD said to Moses, “Gather the people together, so that I may give them water.”
17 Then Israel sang this song:
“Spring up, O well!—Sing to it!—
18 the well that the princes dug,
that the nobles of the people delved,
with the scepter and with their staffs.”
And from the wilderness they went on to Mattanah,
19 and from Mattanah to Nahaliel, and from Nahaliel to Bamoth,
20 and from Bamoth to the valley lying in the region of Moab by the top of Pisgah that looks down on the desert.
King Sihon Defeated
21 Then Israel sent messengers to Sihon king of the Amorites, saying,
22 “Let me pass through your land. We will not turn aside into field or vineyard. We will not drink the water of a well. We will go by the King's Highway until we have passed through your territory.”
23 But Sihon would not allow Israel to pass through his territory. He gathered all his people together and went out against Israel to the wilderness and came to Jahaz and fought against Israel.
24 And Israel defeated him with the edge of the sword and took possession of his land from the Arnon to the Jabbok, as far as to the Ammonites, for the border of the Ammonites was strong.
25 And Israel took all these cities, and Israel settled in all the cities of the Amorites, in Heshbon, and in all its villages.
26 For Heshbon was the city of Sihon the king of the Amorites, who had fought against the former king of Moab and taken all his land out of his hand, as far as the Arnon.
27 Therefore the ballad singers say,
“Come to Heshbon, let it be built;
let the city of Sihon be established.
28 For fire came out from Heshbon,
flame from the city of Sihon.
It devoured Ar of Moab,
and swallowed the heights of the Arnon.
29 Woe to you, O Moab!

He has made his sons fugitives,
and his daughters captives,
to an Amorite king, Sihon.
30 So we overthrew them;
Heshbon, as far as Dibon, perished;
and we laid waste as far as Nophah;
fire spread as far as Medeba.”
King Og Defeated
31 Thus Israel lived in the land of the Amorites.
32 And Moses sent to spy out Jazer, and they captured its villages and dispossessed the Amorites who were there.
33 Then they turned and went up by the way to Bashan. And Og the king of Bashan came out against them, he and all his people, to battle at Edrei.
34 But the LORD said to Moses, “Do not fear him, for I have given him into your hand, and all his people, and his land. And you shall do to him as you did to Sihon king of the Amorites, who lived at Heshbon.”
35 So they defeated him and his sons and all his people, until he had no survivor left. And they possessed his land.