Modern programming languages abstract a lot of low-level details of how our code works. Nonetheless, a good understanding of underlying computer science concepts can help you write better code… and pass technical interviews 😉 Let’s talk about two fundamental data structures everyone needs to know: arrays and linked lists.
So what are arrays and linked lists? Let’s think low-level.
An array is a collection of variables (or objects) that is stored in a memory as a consecutive block of data.
When an array is declared, an appropriately sized block of memory is reserved.
An array has a constant size. The memory “following” the array might be already in use, so we can’t just make the array “longer” to store more elements.
Each element in the array has some index i
that tells us where the element is
in the array.
Element’s address (where it is located in the memory) can be easily computed. We
need the address of the beginning of the array (called base address), and an
index i
of that element:
element_address = base_address + i * element_size
This is important, because it allows us to quickly access any element with a known index.
An array is just a block of memory containing a number of variables or objects.
All elements are stored in order, one after another.
On the contrary, in a linked list there is no particular order in which list’s elements are located in memory: they might be non-consecutive and out-of-order. This is because memory is allocated as we create elements, on as-needed basis.
In a (singly) linked list each element is represented by:
- the element itself
- a pointer
next_element
(represented by arrows on the illustration) to the next element in the list
We have to keep a pointer (usually called head
) to the first element in the
list. Often, we want to keep a pointer (usually called tail
) to the last
element in the list for fast access. To summarize:
Element contains:
value - value/object we're storing
next_element - pointer to the next element in the list
LinkedList contains:
head - pointer to the first element in the list
tail - pointer to the last element in the list
Dynamic array
Arrays always have a constant size. What can we do if you want to add another element to an already full array?
We can: 1) create a new, bigger array, 2) copy all elements from the old array to it, 3) add the new element at the end.
Dynamic arrays use this approach. To add a new element:
A) If there is space in the underlying array — just add the element
B) If
there is no more space for a new element — create a new, bigger array (typically
twice the size), copy all elements from the old array, and add the new
element at the end (see illustration below).
Size (or logical size) is the number of elements that are stored in our data structure. Capacity is the maximum number of elements that could fit in the underlying array. For example, on the illustration below, initial capacity of the array is 2 and its size is 1.
Are those… turtles?😱
Yes.
Notice that sometimes inserting a new element happens very fast (case A), but sometimes we need to copy an entire array (case B). Thus, occasionally an insertion will take longer (as indicated by those adorable turtles).
How much longer? That depends on the number of elements in the array — copying an array takes linear time.
That’s quite sluggish, isn’t?
Well, yeah, dynamic arrays are not always fast. But those slow insertions are not happening that often…
It can be proved that inserting an element into a dynamic array takes, on average, constant time.
Wait, how can this be true?
A “proper” proof is beyond the scope of this article, but I’ll try to give you an intuitive explanation.
When doubling the size of the array, we have to copy some number of elements (let’s call that number x
).
Newly allocated, bigger array will have x
“free spots”, so next x
insertions will be fast.
The “cost” of copying the array is proportional to x
, but it is “amortized” over x
insertions. Thus, average cost “per insertion” is constant.
If you’re still confused (or curious), you might want to watch this excellent video on Coursera:
Hey, but what about this extra memory we reserved? What happens when we remove elements?
Good question. Imagine a full dynamic array with a capacity of 10 000 elements. Now, let’s suppose we remove 9 000 elements.
If we don’t resize the underlying array, our data structure will only use 10% of the allocated space. That’s not good.
Just as we increased the capacity of the array when adding elements, we should reduce the capacity when removing elements.
Typically, when the size of a dynamic array drops below a certain percentage of it’s capacity, we move all elements to a new, smaller array.
Like when adding elements, just the other way around!
But I always just added and removed elements without think about any of those things!
Many high-level programing languages provide functionality of dynamic arrays “out of the box”. JavaScript engines do magic that allows programmer to add and remove elements from the array as he pleases. In Python, lists are implemented using dynamic arrays with some extra cleverness added.
Abstracting such details allows you to focus on solving the problem at hand and makes developing software easier.
We talked about 3 fundamental data structures: arrays, lists and dynamic arrays. But we barely scratched the surface.
In the next part we will compare those data structures. We will investigate operations supported by them, and their time complexity.
Thanks for reading!


Predictive Models for Severe Sepsis in Adult ICU Patients
Joseph Guillén, Jiankun Liu, Margaret Furr, Tianyao Wang
Agenda
- Overview of severe sepsis
- Problem and objectives
- Models and results
- Conclusions and future research
Severe Sepsis Definition
- A syndrome of organ dysfunction in the setting of infection
- Accepted clinical definitions are imprecise and miss 1/8 cases
- High lactate concentration reflects organ
hypoperfusion and is a quantitative method of
determining mortality risk in sepsis
- Our definition is therefore:
High lactate (>4 mmol/L) plus infection (blood
culture acquisition)
Severe Sepsis Treatment
- Early time to antimicrobial therapy
- Early fluid resuscitation
- Vital and maximizing outcomes
Lactate Clearance
- Strongly associated with improved outcomes
- Delayed clearance indicative of organ dysfunction or continual shock
- More aggressive resuscitation for patients with high risk of delayed clearance
Objectives
- Build predictive models for the early detection of severe sepsis based on clinical data
- For patients identified as having severe sepsis, build predictive models for lactate clearance
Data
- Source:
MIMIC-II database -- contains comprehensive data for about 32,000 patients
from multiple ICUs at the Beth Israel Deaconess Medical Center from 2001 to 2008.
- Cohort:
24 hours model: 3446
48 hours model: 2889
latate clearance: 938


Pyblosxom is a lightweight blog system. It was originally a Python clone of Blosxom but has since evolved into a blog system of its own reminiscent of Blosxom.
Pyblosxom focuses on three things:
simplicity
Pyblosxom stores all data on the file system in plain text files. This allows you to use any text editor to create, update and manipulate entries. You can also use existing text-manipulation tools, version control, scripts, grep, ... for managing your blog.
Pyblosxom can run as a CGI script, WSGI component or you can use it to statically compile your website into HTML/XML files.
Your workflow is your workflow.
extensibility
Pyblosxom has a plugin framework enabling you to augment and enhance Pyblosxom’s default behavior. Plugins are written in Python. We maintain a list of plugins in the plugin registry on the website.
Plugins aren’t hard to write. We’re happy to help you write plugins.
community
There are several hundred Pyblosxom users out there all of whom have different needs. Pyblosxom is used on a variety of operating systems in a variety of environments. We have the standard open source project fare: mailing lists, IRC channel, wiki, ...
Pyblosxom is built to let you use existing text-manipulation tools without having to build the whole ecology from scratch.
Pyblosxom can be run as:
You can learn more about Pyblosxom on the website.
Pyblosxom is a small open source project and while there is a community, it’s pretty small. Pyblosxom’s features are great but make it a niche blog system.
Pyblosxom is a file-based blog system. Each blog entry is a separate file stored in a directory hierarchy on your file system. By default, the hierarchy is a category tree meaning each blog entry belongs in a single category. By default, mtimes are used as the blog entry timestamp. There are plugins that change this behavior, but require extra configuration to use.
There are a lot of other blog systems out there. If it’s apparent that Pyblosxom won’t work for you, don’t force it—use something else.
Entries, categories, storage:
Themes:
Plugins:
See the website for details on the mailing lists, IRC, source code, issue tracker, and everything else.
If you’re installing for the first time, be sure to read Installing Pyblosxom in the manual (INSTALL if you’re looking at the source).
If you’re upgrading from a previous Pyblosxom version, read Upgrading Pyblosxom in the manual (UPGRADE if you’re looking at the source) as well as What’s New in the manual (WHATSNEW if you’re looking at the source) which covers what’s new in this version and what you’ll need to change in your blog.
The source tarball comes with a docs/ directory which contains the Pyblosxom manual for that version of Pyblosxom.
The manual for the most current version and past versions of Pyblosxom can be found on the website.
Pyblosxom is written for and by people like you. If you’re using Pyblosxom, please contribute something back whether it’s reporting a bug, fixing something, adding a new flavour, blogging about Pyblosxom, telling your friends, writing a plugin, or hanging out with us on IRC.
Details on where we hang out and such are on the website.
If you have a problem with Pyblosxom, please report it!
There are several different ways to report a bug, but all bugs should eventually make their way into our issue tracker.
If you’re able to fix the bug, that helps a ton! Please attach a patch file to the bug report or send the patch as an attachment to the pyblosxom-devel mailing list.
When sending a patch, it helps a lot to know the details of the bug as well as how you fixed it and whether there are outstanding issues.
Tests are written with the Python unittest module and don’t require any additional test frameworks.
To run the tests, do:
python setup.py test
This will build Pyblosxom, then run the tests.
If you would like to add tests to the test suite, please do and send us patches!


consecutive and simultaneous interpreting from Danish and English to Polish and from Polish to Danish
workshops/ lectures in Danish and Polish about Poland and Denmark for companies and organisations
individual and group lessons in Danish and Polish at all levels
Lech Wałęsa, Aleksander Kwaśniewski (former Presidents of Poland), Tadeusz Mazowiecki (former Prime Minister of Poland), Anker Jørgensen, Anders Fogh Rasmussen (former Prime Ministers of Denmark) , Uffe Ellemann-Jensen (former Foreign Minister of Denmark)
Carlsberg, CIBE, Danish Crown, Dansk Tipstjeneste, DISA, ENEA, IKEA, Inter-IKEA, INWIDO, Leo-Pharma, Novo Nordisk, Skandinavisk Tobakskompagni
Boersens Executive Club, Gladsaxe Kommune (the municipality of Gladsaxe), IG Metall Vorstand (a German trade union), LO (a Danish association of trade unions), City courts and the Eastern Regional Court (Denmark), Kvindeligt Arbejderforbund, SID, 3F (trade unions), Hospitals, The Danish Ministry for Foreign Affairs


Functions to set initial conditions for the BSSN class. Functions are called via a config setting in VacuumSim class. More...
#include "bssn.h"
Go to the source code of this file.
Functions | |
| void | cosmo::bssn_ic_awa_stability (BSSN *bssn, real_t A) |
| Set flat vacuum spacetime initial conditions, plus small "noise" fluctuations. More... | |
| void | cosmo::bssn_ic_awa_linear_wave (BSSN *bssn) |
| Initialize with a "linear" wave propagating in the x-direction. More... | |
| void | cosmo::bssn_ic_awa_linear_wave (BSSN *bssn, real_t A, int dir) |
| Initialize with a "linear" wave propagating in the 'dir'-direction. More... | |
| void | cosmo::bssn_ic_awa_linear_wave_desitter (BSSN *bssn) |
| Initialize with a "linear" wave propagating in the x-direction, on top of a deSitter spacetime. More... | |
| void | cosmo::bssn_ic_awa_gauge_wave (BSSN *bssn) |
| AwA Gauge Wave Test. | |
| void | cosmo::bssn_ic_awa_gauge_wave (BSSN *bssn, int dir) |
| AwA Gauge Wave Test, setting wave propagation direction. | |
| void | cosmo::bssn_ic_awa_shifted_gauge_wave (BSSN *bssn) |
| void | cosmo::bssn_ic_awa_shifted_gauge_wave (BSSN *bssn, int dir) |
| AwA Shifted Gauge Wave Test. | |
| void | cosmo::bssn_ic_kasner (BSSN *bssn, real_t px) |
| AwA Shifted Gauge Wave Test. | |
Functions to set initial conditions for the BSSN class. Functions are called via a config setting in VacuumSim class.
| void cosmo::bssn_ic_awa_linear_wave | ( | BSSN * | bssn | ) |
Initialize with a "linear" wave propagating in the x-direction.
AwA test.
| void cosmo::bssn_ic_awa_linear_wave | ( | BSSN * | bssn, |
| real_t | A, | ||
| int | dir | ||
| ) |
Initialize with a "linear" wave propagating in the 'dir'-direction.
AwA test.
| void cosmo::bssn_ic_awa_linear_wave_desitter | ( | BSSN * | bssn | ) |
Initialize with a "linear" wave propagating in the x-direction, on top of a deSitter spacetime.
Solution should behave, at linear order, as a damped wave equation. Should be run as a vacuum sim (todo: clean up)


Next: Order of Execution, Previous: Summary of Conditional Execution Clauses, Up: Overview of the Loop Facility
The loop named construct gives a name for the block of the loop.
The loop initially construct causes its forms to be evaluated in the loop prologue, which precedes all loop code except for initial settings supplied by the constructs with, for, or as.
The loop finally construct causes its forms to be evaluated in the loop epilogue after normal iteration terminates.
For more information, see Miscellaneous Clauses.


Match the colors and see how long you can survive!
Color Gate 3D is a fast paced test of your reflexes on Android and iOS. Simply tap left or right to move and match the color of the ball to the color of the gate while dodging bombs and survive as long as possible!


CM Buzdar, Pervaiz Elahi refute rumours of differences between govt allies | Pakistan - Geo.tv
by Web DeskLAHORE: Punjab Chief Minister Usman Buzdar on Thursday met the speaker of the provincial assembly, Chaudhry Pervaiz Elahi, at the CM House to discuss the country's ongoing political situation.
In the meeting also attended by Elahi's son and a member of the National Assembly (MNA), Moonis, and Federal Housing Minister Tariq Bashir Cheema, the two leaders refuted claims of differences between the ruling Pakistan Tehreek-e-Insaf (PTI) government's coalition parties.
Elahi said his party, the Pakistan Muslim League-Quaid-e-Azam (PML-Q), was in alliance with the PTI and would continue to be so. The coalition was stronger than before and that the wishes of those trying to create cracks in the allyship would remain futile, he said, stressing that he was, is, and would remain in coalition with Buzdar.
The Punjab CM seconded the PML-Q leader, saying those conspiring to create misunderstandings would never be successful. Both agreed to further stabilise the working relationship.
Buzdar lauded the senior Elahi for running Punjab Assembly in a satisfactory manner, noting that they had collaboratively worked for the prosperity and progress of the province's people and would continue to do so.


Welcome to Campus Library
Books
New
Update
Delete
Search
User
New
Update
Delete
Search
Check-in/Check-out
Book Reservation
Manage
About Us
Logout
Add User
First name
Last name
Phone
Email
Date Of Birth
User type
Student
Professor
Library staff
Address line 1
Address line 2
City
State
Country
Pincode
Clear
Save


| Top |
| cairo_path_t * | cairo_copy_path () |
| cairo_path_t * | cairo_copy_path_flat () |
| void | cairo_path_destroy () |
| void | cairo_append_path () |
| cairo_bool_t | cairo_has_current_point () |
| void | cairo_get_current_point () |
| void | cairo_new_path () |
| void | cairo_new_sub_path () |
| void | cairo_close_path () |
| void | cairo_arc () |
| void | cairo_arc_negative () |
| void | cairo_curve_to () |
| void | cairo_line_to () |
| void | cairo_move_to () |
| void | cairo_rectangle () |
| void | cairo_glyph_path () |
| void | cairo_text_path () |
| void | cairo_rel_curve_to () |
| void | cairo_rel_line_to () |
| void | cairo_rel_move_to () |
| void | cairo_path_extents () |
Paths are the most basic drawing tools and are primarily used to implicitly generate simple masks.
cairo_path_t *
cairo_copy_path (cairo_t *cr
);
Creates a copy of the current path and returns it to the user as a cairo_path_t. See cairo_path_data_t for hints on how to iterate over the returned data structure.
This function will always return a valid pointer, but the result
will have no data (data==
and
NULL
num_data==0
), if either of the following
conditions hold:
path->status
will be set to
CAIRO_STATUS_NO_MEMORY
.cr
is already in an error state. In this case
path->status
will contain the same status that
would be returned by cairo_status()
. the copy of the current path. The caller owns the
returned object and should call cairo_path_destroy()
when finished
with it.
Since 1.0
cairo_path_t *
cairo_copy_path_flat (cairo_t *cr
);
Gets a flattened copy of the current path and returns it to the user as a cairo_path_t. See cairo_path_data_t for hints on how to iterate over the returned data structure.
This function is like cairo_copy_path()
except that any curves
in the path will be approximated with piecewise-linear
approximations, (accurate to within the current tolerance
value). That is, the result is guaranteed to not have any elements
of type CAIRO_PATH_CURVE_TO
which will instead be replaced by a
series of CAIRO_PATH_LINE_TO
elements.
This function will always return a valid pointer, but the result
will have no data (data==
and
NULL
num_data==0
), if either of the following
conditions hold:
path->status
will be set to
CAIRO_STATUS_NO_MEMORY
.cr
is already in an error state. In this case
path->status
will contain the same status that
would be returned by cairo_status()
. the copy of the current path. The caller owns the
returned object and should call cairo_path_destroy()
when finished
with it.
Since 1.0
void
cairo_path_destroy (cairo_path_t *path
);
Immediately releases all memory associated with path
. After a call
to cairo_path_destroy()
the path
pointer is no longer valid and
should not be used further.
Note: cairo_path_destroy()
should only be called with a
pointer to a cairo_path_t returned by a cairo function. Any path
that is created manually (ie. outside of cairo) should be destroyed
manually as well.
Since 1.0
void cairo_append_path (cairo_t *cr
,const cairo_path_t *path
);
Append the path
onto the current path. The path
may be either the
return value from one of cairo_copy_path()
or
cairo_copy_path_flat()
or it may be constructed manually. See
cairo_path_t for details on how the path data structure should be
initialized, and note that path->status
must be
initialized to CAIRO_STATUS_SUCCESS
.
Since 1.0
cairo_bool_t
cairo_has_current_point (cairo_t *cr
);
Returns whether a current point is defined on the current path.
See cairo_get_current_point()
for details on the current point.
Since 1.6
void cairo_get_current_point (cairo_t *cr
,double *x
,double *y
);
Gets the current point of the current path, which is conceptually the final point reached by the path so far.
The current point is returned in the user-space coordinate
system. If there is no defined current point or if cr
is in an
error status, x
and y
will both be set to 0.0. It is possible to
check this in advance with cairo_has_current_point()
.
Most path construction functions alter the current point. See the
following for details on how they affect the current point:
cairo_new_path()
, cairo_new_sub_path()
,
cairo_append_path()
, cairo_close_path()
,
cairo_move_to()
, cairo_line_to()
, cairo_curve_to()
,
cairo_rel_move_to()
, cairo_rel_line_to()
, cairo_rel_curve_to()
,
cairo_arc()
, cairo_arc_negative()
, cairo_rectangle()
,
cairo_text_path()
, cairo_glyph_path()
, cairo_stroke_to_path()
.
Some functions use and alter the current point but do not
otherwise change current path:
cairo_show_text()
.
Some functions unset the current path and as a result, current point:
cairo_fill()
, cairo_stroke()
.
cr |
a cairo context |
|
x |
return value for X coordinate of the current point |
|
y |
return value for Y coordinate of the current point |
Since 1.0
void
cairo_new_path (cairo_t *cr
);
Clears the current path. After this call there will be no path and no current point.
Since 1.0
void
cairo_new_sub_path (cairo_t *cr
);
Begin a new sub-path. Note that the existing path is not affected. After this call there will be no current point.
In many cases, this call is not needed since new sub-paths are
frequently started with cairo_move_to()
.
A call to cairo_new_sub_path()
is particularly useful when
beginning a new sub-path with one of the cairo_arc()
calls. This
makes things easier as it is no longer necessary to manually
compute the arc's initial coordinates for a call to
cairo_move_to()
.
Since 1.2
void
cairo_close_path (cairo_t *cr
);
Adds a line segment to the path from the current point to the
beginning of the current sub-path, (the most recent point passed to
cairo_move_to()
), and closes this sub-path. After this call the
current point will be at the joined endpoint of the sub-path.
The behavior of cairo_close_path()
is distinct from simply calling
cairo_line_to()
with the equivalent coordinate in the case of
stroking. When a closed sub-path is stroked, there are no caps on
the ends of the sub-path. Instead, there is a line join connecting
the final and initial segments of the sub-path.
If there is no current point before the call to cairo_close_path()
,
this function will have no effect.
Note: As of cairo version 1.2.4 any call to cairo_close_path()
will
place an explicit MOVE_TO element into the path immediately after
the CLOSE_PATH element, (which can be seen in cairo_copy_path()
for
example). This can simplify path processing in some cases as it may
not be necessary to save the "last move_to point" during processing
as the MOVE_TO immediately after the CLOSE_PATH will provide that
point.
Since 1.0
void cairo_arc (cairo_t *cr
,double xc
,double yc
,double radius
,double angle1
,double angle2
);
Adds a circular arc of the given radius
to the current path. The
arc is centered at (xc
, yc
), begins at angle1
and proceeds in
the direction of increasing angles to end at angle2
. If angle2
is
less than angle1
it will be progressively increased by
2*M_PI
until it is greater than angle1
.
If there is a current point, an initial line segment will be added
to the path to connect the current point to the beginning of the
arc. If this initial line is undesired, it can be avoided by
calling cairo_new_sub_path()
before calling cairo_arc()
.
Angles are measured in radians. An angle of 0.0 is in the direction
of the positive X axis (in user space). An angle of
M_PI/2.0
radians (90 degrees) is in the
direction of the positive Y axis (in user space). Angles increase
in the direction from the positive X axis toward the positive Y
axis. So with the default transformation matrix, angles increase in
a clockwise direction.
(To convert from degrees to radians, use degrees * (M_PI /
180.)
.)
This function gives the arc in the direction of increasing angles;
see cairo_arc_negative()
to get the arc in the direction of
decreasing angles.
The arc is circular in user space. To achieve an elliptical arc,
you can scale the current transformation matrix by different
amounts in the X and Y directions. For example, to draw an ellipse
in the box given by x
, y
, width
, height
:
cairo_save (cr); cairo_translate (cr, x + width / 2., y + height / 2.); cairo_scale (cr, width / 2., height / 2.); cairo_arc (cr, 0., 0., 1., 0., 2 * M_PI); cairo_restore (cr);
cr |
a cairo context |
|
xc |
X position of the center of the arc |
|
yc |
Y position of the center of the arc |
|
radius |
the radius of the arc |
|
angle1 |
the start angle, in radians |
|
angle2 |
the end angle, in radians |
Since 1.0
void cairo_arc_negative (cairo_t *cr
,double xc
,double yc
,double radius
,double angle1
,double angle2
);
Adds a circular arc of the given radius
to the current path. The
arc is centered at (xc
, yc
), begins at angle1
and proceeds in
the direction of decreasing angles to end at angle2
. If angle2
is
greater than angle1
it will be progressively decreased by
2*M_PI
until it is less than angle1
.
See cairo_arc()
for more details. This function differs only in the
direction of the arc between the two angles.
cr |
a cairo context |
|
xc |
X position of the center of the arc |
|
yc |
Y position of the center of the arc |
|
radius |
the radius of the arc |
|
angle1 |
the start angle, in radians |
|
angle2 |
the end angle, in radians |
Since 1.0
void cairo_curve_to (cairo_t *cr
,double x1
,double y1
,double x2
,double y2
,double x3
,double y3
);
Adds a cubic Bézier spline to the path from the current point to
position (x3
, y3
) in user-space coordinates, using (x1
, y1
) and
(x2
, y2
) as the control points. After this call the current point
will be (x3
, y3
).
If there is no current point before the call to cairo_curve_to()
this function will behave as if preceded by a call to
cairo_move_to(cr
, x1
, y1
).
cr |
a cairo context |
|
x1 |
the X coordinate of the first control point |
|
y1 |
the Y coordinate of the first control point |
|
x2 |
the X coordinate of the second control point |
|
y2 |
the Y coordinate of the second control point |
|
x3 |
the X coordinate of the end of the curve |
|
y3 |
the Y coordinate of the end of the curve |
Since 1.0
void cairo_line_to (cairo_t *cr
,double x
,double y
);
Adds a line to the path from the current point to position (x
, y
)
in user-space coordinates. After this call the current point
will be (x
, y
).
If there is no current point before the call to cairo_line_to()
this function will behave as cairo_move_to(cr
, x
, y
).
cr |
a cairo context |
|
x |
the X coordinate of the end of the new line |
|
y |
the Y coordinate of the end of the new line |
Since 1.0
void cairo_move_to (cairo_t *cr
,double x
,double y
);
Begin a new sub-path. After this call the current point will be (x
,
y
).
cr |
a cairo context |
|
x |
the X coordinate of the new position |
|
y |
the Y coordinate of the new position |
Since 1.0
void cairo_rectangle (cairo_t *cr
,double x
,double y
,double width
,double height
);
Adds a closed sub-path rectangle of the given size to the current
path at position (x
, y
) in user-space coordinates.
This function is logically equivalent to:
cairo_move_to (cr, x, y); cairo_rel_line_to (cr, width, 0); cairo_rel_line_to (cr, 0, height); cairo_rel_line_to (cr, -width, 0); cairo_close_path (cr);
cr |
a cairo context |
|
x |
the X coordinate of the top left corner of the rectangle |
|
y |
the Y coordinate to the top left corner of the rectangle |
|
width |
the width of the rectangle |
|
height |
the height of the rectangle |
Since 1.0
void cairo_glyph_path (cairo_t *cr
,const cairo_glyph_t *glyphs
,int num_glyphs
);
Adds closed paths for the glyphs to the current path. The generated
path if filled, achieves an effect similar to that of
cairo_show_glyphs()
.
Since 1.0
void cairo_text_path (cairo_t *cr
,const char *utf8
);
Adds closed paths for text to the current path. The generated
path if filled, achieves an effect similar to that of
cairo_show_text()
.
Text conversion and positioning is done similar to cairo_show_text()
.
Like cairo_show_text()
, After this call the current point is
moved to the origin of where the next glyph would be placed in
this same progression. That is, the current point will be at
the origin of the final glyph offset by its advance values.
This allows for chaining multiple calls to to cairo_text_path()
without having to set current point in between.
Note: The cairo_text_path()
function call is part of what the cairo
designers call the "toy" text API. It is convenient for short demos
and simple programs, but it is not expected to be adequate for
serious text-using applications. See cairo_glyph_path()
for the
"real" text path API in cairo.
Since 1.0
void cairo_rel_curve_to (cairo_t *cr
,double dx1
,double dy1
,double dx2
,double dy2
,double dx3
,double dy3
);
Relative-coordinate version of cairo_curve_to()
. All offsets are
relative to the current point. Adds a cubic Bézier spline to the
path from the current point to a point offset from the current
point by (dx3
, dy3
), using points offset by (dx1
, dy1
) and
(dx2
, dy2
) as the control points. After this call the current
point will be offset by (dx3
, dy3
).
Given a current point of (x, y), cairo_rel_curve_to(cr
, dx1
,
dy1
, dx2
, dy2
, dx3
, dy3
) is logically equivalent to
cairo_curve_to(cr
, x+dx1
, y+dy1
, x+dx2
, y+dy2
, x+dx3
, y+dy3
).
It is an error to call this function with no current point. Doing
so will cause cr
to shutdown with a status of
CAIRO_STATUS_NO_CURRENT_POINT
.
cr |
a cairo context |
|
dx1 |
the X offset to the first control point |
|
dy1 |
the Y offset to the first control point |
|
dx2 |
the X offset to the second control point |
|
dy2 |
the Y offset to the second control point |
|
dx3 |
the X offset to the end of the curve |
|
dy3 |
the Y offset to the end of the curve |
Since 1.0
void cairo_rel_line_to (cairo_t *cr
,double dx
,double dy
);
Relative-coordinate version of cairo_line_to()
. Adds a line to the
path from the current point to a point that is offset from the
current point by (dx
, dy
) in user space. After this call the
current point will be offset by (dx
, dy
).
Given a current point of (x, y), cairo_rel_line_to(cr
, dx
, dy
)
is logically equivalent to cairo_line_to(cr
, x + dx
, y + dy
).
It is an error to call this function with no current point. Doing
so will cause cr
to shutdown with a status of
CAIRO_STATUS_NO_CURRENT_POINT
.
cr |
a cairo context |
|
dx |
the X offset to the end of the new line |
|
dy |
the Y offset to the end of the new line |
Since 1.0
void cairo_rel_move_to (cairo_t *cr
,double dx
,double dy
);
Begin a new sub-path. After this call the current point will offset
by (x
, y
).
Given a current point of (x, y), cairo_rel_move_to(cr
, dx
, dy
)
is logically equivalent to cairo_move_to(cr
, x + dx
, y + dy
).
It is an error to call this function with no current point. Doing
so will cause cr
to shutdown with a status of
CAIRO_STATUS_NO_CURRENT_POINT
.
Since 1.0
void cairo_path_extents (cairo_t *cr
,double *x1
,double *y1
,double *x2
,double *y2
);
Computes a bounding box in user-space coordinates covering the points on the current path. If the current path is empty, returns an empty rectangle ((0,0), (0,0)). Stroke parameters, fill rule, surface dimensions and clipping are not taken into account.
Contrast with cairo_fill_extents()
and cairo_stroke_extents()
which
return the extents of only the area that would be "inked" by
the corresponding drawing operations.
The result of cairo_path_extents()
is defined as equivalent to the
limit of cairo_stroke_extents()
with CAIRO_LINE_CAP_ROUND
as the
line width approaches 0.0, (but never reaching the empty-rectangle
returned by cairo_stroke_extents()
for a line width of 0.0).
Specifically, this means that zero-area sub-paths such as
cairo_move_to()
;cairo_line_to()
segments, (even degenerate cases
where the coordinates to both calls are identical), will be
considered as contributing to the extents. However, a lone
cairo_move_to()
will not contribute to the results of
cairo_path_extents()
.
cr |
a cairo context |
|
x1 |
left of the resulting extents |
|
y1 |
top of the resulting extents |
|
x2 |
right of the resulting extents |
|
y2 |
bottom of the resulting extents |
Since 1.6
typedef struct { cairo_status_t status; cairo_path_data_t *data; int num_data; } cairo_path_t;
A data structure for holding a path. This data structure serves as
the return value for cairo_copy_path()
and
cairo_copy_path_flat()
as well the input value for
cairo_append_path()
.
See cairo_path_data_t for hints on how to iterate over the actual data within the path.
The num_data member gives the number of elements in the data array. This number is larger than the number of independent path portions (defined in cairo_path_data_type_t), since the data includes both headers and coordinates for each portion.
cairo_status_t |
the current error status |
|
cairo_path_data_t * |
the elements in the path |
|
the number of elements in the data array |
Since 1.0
cairo_path_data_t is used to represent the path data inside a cairo_path_t.
The data structure is designed to try to balance the demands of efficiency and ease-of-use. A path is represented as an array of cairo_path_data_t, which is a union of headers and points.
Each portion of the path is represented by one or more elements in the array, (one header followed by 0 or more points). The length value of the header is the number of array elements for the current portion including the header, (ie. length == 1 + # of points), and where the number of points for each element type is as follows:
%CAIRO_PATH_MOVE_TO: 1 point %CAIRO_PATH_LINE_TO: 1 point %CAIRO_PATH_CURVE_TO: 3 points %CAIRO_PATH_CLOSE_PATH: 0 points
The semantics and ordering of the coordinate values are consistent
with cairo_move_to()
, cairo_line_to()
, cairo_curve_to()
, and
cairo_close_path()
.
Here is sample code for iterating through a cairo_path_t:
int i; cairo_path_t *path; cairo_path_data_t *data; path = cairo_copy_path (cr); for (i=0; i < path->num_data; i += path->data[i].header.length) { data = &path->data[i]; switch (data->header.type) { case CAIRO_PATH_MOVE_TO: do_move_to_things (data[1].point.x, data[1].point.y); break; case CAIRO_PATH_LINE_TO: do_line_to_things (data[1].point.x, data[1].point.y); break; case CAIRO_PATH_CURVE_TO: do_curve_to_things (data[1].point.x, data[1].point.y, data[2].point.x, data[2].point.y, data[3].point.x, data[3].point.y); break; case CAIRO_PATH_CLOSE_PATH: do_close_path_things (); break; } } cairo_path_destroy (path);
As of cairo 1.4, cairo does not mind if there are more elements in
a portion of the path than needed. Such elements can be used by
users of the cairo API to hold extra values in the path data
structure. For this reason, it is recommended that applications
always use data->header.length
to
iterate over the path data, instead of hardcoding the number of
elements for each element type.
Since 1.0
cairo_path_data_t is used to describe the type of one portion of a path when represented as a cairo_path_t. See cairo_path_data_t for details.
Since 1.0


above |
Li The Clinging, Flame |
|
below |
K'an The Abysmal, Water |
Before Completion. Success.
But if the little fox, after nearly completing the crossing,
Gets his tail in the water,
There is nothing that would further.
Fire over water:
The image of the condition before transition.
Thus the superior man is careful
In the differentiation of things,
So that each finds its place.
Six at the beginning means:
He gets his tail in the water.
Humiliating.
Nine in the second place means:
He brakes his wheels.
Perseverance brings good fortune.
Six in the third place means:
Before completion, attack brings misfortune.
It furthers one to cross the great water.
Nine in the fourth place means:
Perseverance brings good fortune.
Remorse disappears.
Shock, thus to discipline the Devil's Country.
For three years, great realms are awarded.
Six in the fifth place means:
Perseverance brings good fortune.
No remorse.
The light of the superior man is true.
Good fortune.
Nine at the top means:
There is drinking of wine
In genuine confidence. No blame.
But if one wets his head,
He loses it, in truth.


In the
Raised by text box enter the name of the person who we should contact regarding this enquiry.
In the
Message text box, enter your enquiry.
Click the
send button. Your message is sent to Western Union, and a message is returned to indicate that your message has been received successfully. At this point you can add a further message or return to the list of Conversations.
TO VIEW THE MESSAGES IN A CONVERSATION
You will see a red alert at the top of your screen if you have an incoming message waiting, In the list of Conversations, any Conversation with an unread message will also be highlighted.
Click on the blue 'page' icon
to view the messages in a conversation.
TO REPLY TO A MESSAGE
Click the green 'plus' icon
next to the conversation. Enter your message. Click the
send button.
Note that you can add or change the consignment reference at any time.
TO CLOSE A CONVERSATION
If the conversation is finished, mark it CLOSED by clicking the orange 'handshake' icon.
You will be asked for feedback on how we dealt with your enquiry. Select
OK or
Unsatisfactory in the Rating column.
Either you or the Western Union Controller can decide to close a conversation. Depending on which party closes the message, and whether your feedback is required, you will see one of the following messages:
AGENT REQUESTED CLOSE
AGENT REQUESTED CLOSE, AWAITING FEEDBACK
CLOSED BY AGENT
CONTROLLER IS CLOSING, AWAITING AGENT FEEDBACK
CLOSED BY CONTROLLER
When you click the
OK or
Unsatisfactory button, a screen appears on which you can provide feedback.
In the
Closed by text box enter your name.
In the
Comments text box enter any additional text you would like Western Union to see. The Western Union controller will review your comments, and they may be used for training and quality monitoring purposes.
Finally, click the
finish button.


{% extends 'layout.html' %} {% block content %}
Any CSS you write here will be loaded into < header >< / header > as dip.css
Any JavaScript you write here will be loaded into < footer >< / footer > as dip.js
Any tag, CSS or JavaScript added here will be loaded into < header >< / header > in raw form
Any tag, CSS or JavaScript added here will be loaded into < footer >< / footer > in raw form


Pig Dice
Player 1:
Player 2:
Start Game!
Rules:
Each turn, a player repeatedly rolls a die until either a 1 is rolled or the player decides to "hold"
If player gets a 1, they receive no points and the next player will go
If player receives any number other than 1, it is added to their turn total and the player continues to roll
If a player chooses to "hold", their turn total is added to their total score and the next player will go.
The first player to hit 100 wins
VS
Roll
Hold
Current:
Total:
Current:
Total:
, you are the winner!
Pigs around the world will forever hold you in the highest regard. You are now Lord Piggly.
Play Again?
, you are the winner!
Pigs around the world will forever hold you in the highest regard. You are now Lord Piggly.
Play Again?


Bangladesh Railway
User Profile
(current)
Home
(current)
Train Rent
Train Route
Purchas Ticket
Purchas History
Disabled


AvatarUser {{subscription?.user?.email}} Gateway {{subscription.gateway}} Cancelled {{subscription.cancelled ? 'Yes' : 'No' }} On Grace Period {{subscription.on_grace_period ? 'Yes' : 'No' }} Renews At {{subscription.renews_at ? (subscription.renews_at | formattedDate) : '-'}} Ends At {{subscription.ends_at ? (subscription.ends_at | formattedDate) : '-'}} Created At {{subscription.created_at | formattedDate}} Nothing to Display.Seems like no subscriptions exist on the site yet.


2 references to RunspaceRepository
System.Management.Automation (2)
engine\CommandBase.cs (1)
489
return ((LocalRunspace)this.Context.CurrentRunspace).
RunspaceRepository
;
engine\hostifaces\LocalConnection.cs (1)
879
foreach (PSSession psSession in this.
RunspaceRepository
.Runspaces)


Updates are posted on Twitter at @Jay_N_T and in the Discovery Telegram Group. You can always reach out by email.


Class 3 Homework
For this week's homework, we are going to use advanced CSS to style our homework1.html. Save your homework2.css file as homework3.css and have at it!
Here are this week's homework activities:
- Create several divs of various widths, heights, and colors. Use margin to push them around the page.
- Make some of the <div>'s into links (anchors). Then, make the background color of the div change on mouse over.
- Try to position some of the <div>'s relative-ly in a vertical line down the middle of the page.
- Create a class that you can use with <span> tags to make some text twice the default size.
- Extra credit: Use images as links and change them on mouseover. This one is challenging BUT VERY FUN! Try searching for "Turn links into images CSS".
You can always check the Class 3 slides for help.
When you're done, make a zip file from your project folder and email (or send it via Slack) it to your instructor!


Playground
A test bed for the controllers defined under
controllers
@hopsoft/prefetch-turbolinks-controller
Autosuggest
Copy-Code
Copy
© 2020 Hopsoft. All rights reserved.
GitHub


Introduction to One Down
One Down is a Filipino-American multimedia publishing platform on the rise. With a growing Facebook following of 47,000+ people, this company wanted to redesign their website to have an official website that was on par with other leading cultural media publishers like mitú, and buzzfeed. The stakeholders I communicated with on a weekly basis were Grazian Moreno (Director of Marketing and Brand Partnerships) and Leo Albea (Co-Founder & Creative Director).
Responsibilities
- Engage users to click through pages and spend some time browsing the site.
- Highlight the upcoming series, Breaking the Tabo, for Filipino American History Month.
- Echo the company’s brand in the redesign
Listening to the data and the core stakeholders
- Users mostly viewed the site through a mobile device
Bumps along the road
For the Editorial and Video sections of the site, I couldn't seem to find an option to make one section of the page a different color than the rest of the page, so I injected CSS thanks to the site’s Business plan features.
In the Videos section, my initial goal was to create a gallery view of all the media content One Down produced. However, I was sourcing these videos from Youtube and Facebook, which meant that the videos were squares or rectangles.
- There was no option to edit the rectangles and turn the viewport into a square
- The older videos either weren’t available or warned that I didn’t have ownership of the video content
The last episode and article of the FAHM series garnered a lot of traction (engagement the day the article was posted was 186 then shot up to 1,044 the following day). The article was flooded with comments and what happened during this turnout/event was something I didn’t expect. One of the stakeholders wanted to know if there was a forum feature to continue the discussion elsewhere but there wasn’t one that I read was available. In addition, I didn’t know if Squarespace articles had a comment cap at the time.
Initial digital design sketches
Solution
What I learned
At the end of October, the site visitors and user engagement didn’t match up with the big numbers coming from the Facebook platform, but there was still progress. This is the first internship I worked on where I got to access data logistics and read how the site was performing.


Time line of Savage the BeesWax's life:
- 1080 - Discoverd inside a well by the Bishop of Centebury.
- 1081 - Given the name Savage Mulgrew by Robin during his driving test at the BatCave.
- 1500 - Ends World Hunger. Solves the AIDS crisis and prevents World war 3.
- 1988 - Enters the witness protection program when he witness ketchup being sprayed on top of a mayo sandwich.
- 2000 - MVP of the World series. Lead the series with numerous categories. Notable stats include 30 HR, 200 RBI and 5600 S0. Gave birth to a penguin during the middle of the 6th inning in game 7.
- 3014 - Discovered Sukiyaki by cross-breeding a mango and an elephant. Wins the noble peace prize for his contribution to gardening.
Championships
- National Wrestling Alliance
- NWA World Tag Team Championship
- NWA Hall of Fame (Class of 889)
- Sumo Hall of Fame
- 499lb class Heavy Weight Championship
- Gold medal in the Bantom Weight Tag Team Championship (1987)
Finishing Moves
- Rock the cradle dunk
- Space invader 360 with a biscuit
- Gam sandwich with a pickle
- Piledriver
- Double Drop superplex home run
- Double Drop Kick


--- layout: post title: "The Liskov Substitution Principle as a profunctor" description: "With a realistic example in C#." date: 2021-12-06 6:52 UTC tags: [Software Design] image: "/content/binary/lsp-pipes.png" image_alt: "The Liskov Substitution Principle illustrated with flanged pipes." --- {% include JB/setup %}
{{ page.description }}
Like the previous article on Postel's law as a profunctor, this article is part of a series titled Some design patterns as universal abstractions. And like the previous article, it's a bit of a stretch to include the present article in that series, since the Liskov Substitution Principle (LSP) isn't a design pattern, but rather a software design principle or heuristic. I still think, however, that the article fits the spirit of the article series, if not the letter.
As was also the case for the previous article, I don't claim that any of this is new. Michael Feathers and Rúnar Bjarnason blazed that trail long before me.
In more or less natural language, the LSP states that subtypes must preserve correctness. A subtype isn't allowed to change behaviour in such a way that client code breaks.
Note that subtypes are allowed to change behaviour. That's often the point of subtyping. By providing a subtype, you can change the behaviour of a system. You can, for example, override how messages are sent, so that an SMS becomes a Slack notification or a Tweet.
If client code 'originally' supplied correct input for sending an SMS, this input should also be valid for posting a Tweet.
Specifically (paraphrasing the Wikipedia entry as of early November 2021):
There's a bit more, but in this article, I'll focus on those rules. The first two we already know. Since any function is already a profunctor, we know that functions are contravariant in input and covariant in output.
The LSP, however, isn't a rule about a single function. Rather, it's a rule about a family of functions. Think about a function a -> b
as a pipe. You can replace the pipe segment with another pipe segment that has exactly the same shape, but replacing it with a flanged pipe also works, as long as the input flange is wider, and the nozzle narrower than the original pipe shape.
On the other hand, if you narrow the pipe at the input and widen it at the output, spillage will happen. That's essentially what the LSP states: The upper, green, flanged pipe is a good replacement for the supertype (the blue pipe in the middle), while the lower, orange, flanged pipe is not useful.
The previous article already described that visual metaphor when it comes to co- and contravariance, so this article will focus on pre- and postconditions. My conjecture is that this is just another take on co- and contravariance.
When encountering statements about subtypes and supertypes, most people tend to think about object inheritance, but that's just one example. As I've previously outlined, anything that can 'act as' something else is a subtype of that something else. Specifically, an interface implementation is a subtype of the interface, and the interface itself the supertype.
Consider, as a supertype example, this interface from my book Code That Fits in Your Head:
public interface IReservationsRepository { Task Create(int restaurantId, Reservation reservation); Task<IReadOnlyCollection<Reservation>> ReadReservations( int restaurantId, DateTime min, DateTime max); Task<Reservation?> ReadReservation(int restaurantId, Guid id); Task Update(int restaurantId, Reservation reservation); Task Delete(int restaurantId, Guid id); }
Specifically, in this article, I'll focus exclusively on the ReadReservations
method. You can imagine that there's an interface with only that method, or that when subtyping the interface in the following, we vary only that method and keep everything else fixed.
What might be the pre- and postconditions of the ReadReservations
method?
The most basic kind of precondition is captured by the parameter types. In order to be able to call the method, you must supply an int
and two DateTime
instances. You can't omit any of them or replace one of the DateTime
values with a Guid
. In a statically typed language, this is obvious, and the compiler will take care of that.
Both int
and DateTime
are value types (struct
s), so they can't be null. Had one of the parameters been a reference type, it'd be appropriate to consider whether or not null constitutes valid input.
So far, we've only discussed static types. Of course a subtype must satisfy the compiler, but what other pre-conditions might be implied by ReadReservations
?
The purpose of the method is to enable client code to query a data store and retrieve the reservations for a particular restaurant and in a particular time interval.
Is any restaurantId
acceptable? 1
? 0
? -235
?
It's probably a distraction that the restaurant ID is even an int
. After all, you don't add IDs together, or multiply one with another one. That an ID is an integer is really just a leaky implementation detail - databases like it best when IDs are integers. I should actually have defined the restaurant ID as an opaque object with Value Object semantics, but I didn't (like other humans, I'm imperfect and lazy). The bottom line is that any number is as good as any other number. No precondition there.
What about the two DateTime
parameters? Are DateTime.MinValue
or DateTime.MaxValue
valid values? Probably: If you'd like to retrieve all reservations in the past, you could ask for DateTime.MinValue
as min
and DateTime.Now
as max
. On the other hand, it'd be reasonable to require that min
should be less than (or equal to?) max
. That sounds like a proper precondition, and one that's difficult to express as a type.
We may also consider it a precondition that the object that implements the ReadReservations
method is properly initialised, but I'll take that as a given. Making sure of that is the responsibility of the constructor, not the ReadReservations
method.
To summarise, apart from the types and other things handled by the compiler, there's only one additional pre-condition: that min
must be less than max
.
Are there any postconditions?
The code base for the book obeys Command-Query Separation. Since ReadReservations
returns data, it must be a Query. Thus, we can assume that calling it isn't supposed to change state. Thus, postconditions can only be statements about the return value.
Again, static typing takes care of the most fundamental postconditions. An implementation can't return a double
or an UriBuilder
. It must be a Task
, and that task must compute an IReadOnlyCollection<Reservation>
.
Why IReadOnlyCollection
, by the way? That's my attempt at describing a particular postcondition as a type.
The IReadOnlyCollection<T> interface is a restriction of IEnumerable<T>
that adds a Count
. By adding the Count
property, the interface strongly suggests that the collection is finite.
IEnumerable<T>
implementations can be infinite sequences. These can be useful as functional alternatives to infinite loops, but are clearly not appropriate when retrieving reservations from a database.
The use of IReadOnlyCollection
tells us about a postcondition: The collection of reservations is finite. This is, however, captured by the type. Any valid implementation of the interface ought to make that guarantee.
Is there anything else? Is it okay if the collection is empty? Yes, that could easily happen, if you have no reservations in the requested interval.
What else? Not much comes to mind, only that we'd expect the collection to be 'stable'. Technically, you could implement the GetEnumerator
method so that it generates Count
random Reservation
objects every time you enumerate it, but none of the built-in implementations do that; that's quite a low bar, as postconditions go.
To summarise the postconditions: None, apart from a well-behaved implementation of IReadOnlyCollection<Reservation>
.
According to the LSP, a subtype should be allowed to weaken preconditions. Keep in mind that I consider an interface implementation a subtype, so every implementation of ReadReservations
constitutes a subtype. Consider the SQL Server-based implementation:
public async Task<IReadOnlyCollection<Reservation>> ReadReservations( int restaurantId, DateTime min, DateTime max) { var result = new List<Reservation>(); using var conn = new SqlConnection(ConnectionString); using var cmd = new SqlCommand(readByRangeSql, conn); cmd.Parameters.AddWithValue("@RestaurantId", restaurantId); cmd.Parameters.AddWithValue("@Min", min); cmd.Parameters.AddWithValue("@Max", max); await conn.OpenAsync().ConfigureAwait(false); using var rdr = await cmd.ExecuteReaderAsync().ConfigureAwait(false); while (await rdr.ReadAsync().ConfigureAwait(false)) result.Add(ReadReservationRow(rdr)); return result.AsReadOnly(); } private const string readByRangeSql = @" SELECT [PublicId], [At], [Name], [Email], [Quantity] FROM [dbo].[Reservations] WHERE [RestaurantId] = @RestaurantId AND @Min <= [At] AND [At] <= @Max";
This implementation actually doesn't enforce the precondition that min
ought to be less than max
. It doesn't have to, since the code will run even if that's not the case - the result set, if min
is greater than max
, will always be empty.
While perhaps not useful, weakening this precondition doesn't adversely affect well-behaved clients, and buggy clients are always going to receive empty results. If this implementation also fulfils all postconditions, it's already LSP-compliant.
Still, could it weaken preconditions even more, or in a different way?
As Postel's law suggests, a method should be liberal in what it accepts. If it understands 'what the caller meant', it should perform the desired operation instead of insisting on the letter of the law.
Imagine that you receive a call where min
is midnight June 6 and max
is midnight June 5. While wrong, what do you think that the caller 'meant'?
The caller probably wanted to retrieve the reservations for June 5.
You could weaken that precondition by swapping back min
and max
if you detect that they've been swapped.
Let's assume, for the sake of argument, that we make the above ReadReservations
implementation virtual
. This enables us to inherit from SqlReservationsRepository
and override the method:
public override Task<IReadOnlyCollection<Reservation>> ReadReservations( int restaurantId, DateTime min, DateTime max) { if (max < min) return base.ReadReservations(restaurantId, max, min); return base.ReadReservations(restaurantId, min, max); }
While this weakens preconditions, it breaks no existing clients because they all 'know' that they must pass the lesser value before the greater value.
Postel's law also suggests that a method should be conservative in what it sends. What could that mean?
In the case of ReadReservations
, you may notice that the result set isn't explicitly sorted. Perhaps we'd like to also sort it on the date and time:
public override async Task<IReadOnlyCollection<Reservation>> ReadReservations( int restaurantId, DateTime min, DateTime max) { var query = min < max ? base.ReadReservations(restaurantId, min, max) : base.ReadReservations(restaurantId, max, min); var reservations = await query.ConfigureAwait(false); return reservations.OrderBy(r => r.At).ToList(); }
This implementation retains the weakened precondition from before, but now it also explicitly sorts the reservations on At
.
Since no client code relies on sorting, this breaks no existing clients.
While the behaviour changes, it does so in a way that doesn't violate the original contract.
While we've used terms such as weaken preconditions and strengthen postconditions, doesn't this look an awful lot like co- and contravariance?
I think it does, so let's rewrite the above implementation using the Reader profunctor.
First, we'll need to express the original method in the shape of a function like a -> b
- that is: a function that takes a single input and returns a single output. While ReadReservations
return a single value (a Task
), it takes three input arguments. To make it fit the a -> b
mould, we have to convert those three parameters to a Parameter Object.
This enables us to write the original implementation as a function:
Func<QueryParameters, Task<IReadOnlyCollection<Reservation>>> imp = q => base.ReadReservations(q.RestaurantId, q.Min, q.Max);
If we didn't want to weaken any preconditions or strengthen any postconditions, we could simply call imp
and return its output.
The above weakened precondition can be expressed like this:
Func<QueryParameters, QueryParameters> pre = q => q.Min < q.Max ? new QueryParameters(q.RestaurantId, q.Min, q.Max) : new QueryParameters(q.RestaurantId, q.Max, q.Min);
Notice that this is a function from QueryParameters
to QueryParameters
. As above, it simply swaps Min
and Max
if required.
Likewise, we can express the strengthened postcondition as a function:
Func<Task<IReadOnlyCollection<Reservation>>, Task<IReadOnlyCollection<Reservation>>> post = t => t.Select(rs => rs.OrderBy(r => r.At).ToReadOnly());
The Select
method exists because Task
forms an asynchronous functor.
It's now possible to compose imp
with pre
and post
using DiMap
:
Func<QueryParameters, Task<IReadOnlyCollection<Reservation>>> composition = imp.DiMap(pre, post);
You can now call composition
with the original arguments:
composition(new QueryParameters(restaurantId, min, max))
The output of such a function call is entirely equivalent to the above, subtyped ReadReservations
implementation.
In case you've forgotten, the presence of a lawful DiMap
function is what makes something a profunctor. We already knew that functions are profunctors, but now we've also seen that we can use this knowledge to weaken preconditions and strengthen postconditions.
It seems reasonable to conjecture that the LSP actually describes a profunctor.
It seems to me that the profunctor composition involved with the LSP always takes the specialised form where, for a function a -> b
, the preprocessor (the contravariant mapping) always takes the form a -> a
, and the postprocessor (the covariant mapping) always takes the form b -> b
. This is because polymorphism must preserve the shape of the original function (a -> b
).
We already know that something contravariant in input and covariant in output is a profunctor candidate, but the Liskov Substitution Principle is usually expressed in terms of pre- and postconditions. Subtypes may weaken preconditions and strengthen postconditions, but not the other way around.
Evidence suggests that you can phrase these rules as a profunctor specialisation.
Comments
I think this depends on the language and your perspective on subtype polymorphism. In Java, a subclass
Y
of a superclassX
can override a methodm
onX
that has return typeb
with a method onY
that has return typec
providedc
is a subtype ofb
. To be clear, I am not saying that the instance returned fromY::m
can have runtime-typec
, though that is also true. I am saying that the compile-time return type ofY::m
can bec
.With this in mind, I am willing to argue that the postprocessor can take the form
b -> c
providedc
is a subtype ofb
. As the programmer, that is how I think ofY::m
. And yet, if someone has a instance ofY
with compile-time typeX
, then callingm
returns something with compile-time typeb
by composing myb -> c
function with the naturalc -> b
function from subtype polymorphism to get theb -> b
function that you suggested is required.Tyson, thank you for writing. Yes, true, that nuance may exist. This implies that the LSP is recursive, which really isn't surprising.
A function
a -> b
may be defined for typesa
andb
, where both are, themselves, polymorphic. So, ifa
is HttpStyleUriParser andb
is MemberInfo, we'd have a functionFunc<HttpStyleUriParser, MemberInfo>
(orHttpStyleUriParser -> MemberInfo
if we want to stick with an ML-style type signature - we can imagine that it's an F# function).If
Func<HttpStyleUriParser, MemberInfo>
is our polymorphic target signature, according to C# co- and contravariance, we're allowed to vary both input and output. We can, for example, widen the input type to UriParser and restrict the output type to Type. Thus, aspecific
function of the typeFunc<UriParser, Type>
is compatible with a general function of the typeFunc<HttpStyleUriParser, MemberInfo>
:Func<HttpStyleUriParser, MemberInfo> general = specific;
Thus, you're correct that both pre- and postprocessor may take the form
a' -> a
andb -> b'
, wherea'
is a supertype ofa
, andb
is a supertype ofb'
. This is true for C# function delegates, since they're defined with thein
andout
keywords. You can putin
andout
on your own interface definitions as well, but most people don't bother (I rarely do, either).As with all practical recursion you need base cases to stop the recursion. While you can define polymorphic functions (or classes) where input parameters and return types are themselves polymorphic, etc., these should still obey the LSP.


--- layout: page title: Lean Prover Zulip Chat Archive permalink: archive/144837PRreviews/95216documentationPRs.html ---
https://github.com/leanprover/mathlib/pull/400 and https://github.com/leanprover/mathlib/pull/395 are pure documentation, and can be merged.
... and have now been merged!
{% endraw %}


GREAT MONEY OPPORTUNITY FOR PV! READ!
Posted: Sat Apr 07, 2007 12:58 pm
Ej's new words:
"Current work 4-7-2007
I have had several emails recently asking about the next update for both the top down (TD) and first person (FP) versions of the game.
First let me start off by saying that I have been working on an update for TD. It still needs some more work but is certainly in process.
What I decided to do is change the modeler tool, the FP map maker, and the FP game itself over to DirectX 9. I think DirectX9 has a long development life left in it because DirectX 10 only works with Vista and the whole world is not going to move to Vista over night so game development will continue in DirectX 9 for a few more years at least. You might remember that I converted to DX9 a while back but it didn't work out that well. The EXE size went way up and didn't work well for some people. Microsoft put out a new version of the DX9 software development kit in about the middle of last year that is much better.
So here is the idea behind me spending this kind of time converting to DX9. These large RPG games are way too much work for someone to do mostly alone as I have so far. So I have decided that I wont do it alone anymore. I will be posting an FP development job web page that will list tasks I need done for FP and how much each task is worth.
It might look something like this (this is only a sample and could change)
New Dreg character model - $100
Full set of Dreg character models with all armors - $250
New dungeon in area Xxxxxxx with cave theme - $200
New dungeon in area Xxxxxxx with tomb theme - $200
Good side main city street layout with outer wall - $300
If you decide to help with FP then you would send an email with the job you want and if the task is still available I would send you the 3D modeler or the Map maker. The jobs would have to be done within a reasonable amount of time and approved by me. Once approved then THE FP GAME owes you the amount the task was worth. What that means is you get paid a % of the game profits until the amount the game owes you had been paid to you. Of course right now FP is free and it will stay that way for a while. Yes the 3D modeler and Map maker will use version control and encryption so they don't get misused.
I will be advertising these jobs on several message boards where game development types of people go, so there may be people working on FP that have never even played Xenimus.
This method of doing things gives everyone an interest in making the game successful.
FP is just too big for me to develop alone so if nobody is interested in helping then development will stop.
There are many different paths this plan could take."
I'm in no way saying people should focus on Xen over PV, but we have some very skilled models here who could pound out some models in a short time, making hundreds for PV.
"Current work 4-7-2007
I have had several emails recently asking about the next update for both the top down (TD) and first person (FP) versions of the game.
First let me start off by saying that I have been working on an update for TD. It still needs some more work but is certainly in process.
What I decided to do is change the modeler tool, the FP map maker, and the FP game itself over to DirectX 9. I think DirectX9 has a long development life left in it because DirectX 10 only works with Vista and the whole world is not going to move to Vista over night so game development will continue in DirectX 9 for a few more years at least. You might remember that I converted to DX9 a while back but it didn't work out that well. The EXE size went way up and didn't work well for some people. Microsoft put out a new version of the DX9 software development kit in about the middle of last year that is much better.
So here is the idea behind me spending this kind of time converting to DX9. These large RPG games are way too much work for someone to do mostly alone as I have so far. So I have decided that I wont do it alone anymore. I will be posting an FP development job web page that will list tasks I need done for FP and how much each task is worth.
It might look something like this (this is only a sample and could change)
New Dreg character model - $100
Full set of Dreg character models with all armors - $250
New dungeon in area Xxxxxxx with cave theme - $200
New dungeon in area Xxxxxxx with tomb theme - $200
Good side main city street layout with outer wall - $300
If you decide to help with FP then you would send an email with the job you want and if the task is still available I would send you the 3D modeler or the Map maker. The jobs would have to be done within a reasonable amount of time and approved by me. Once approved then THE FP GAME owes you the amount the task was worth. What that means is you get paid a % of the game profits until the amount the game owes you had been paid to you. Of course right now FP is free and it will stay that way for a while. Yes the 3D modeler and Map maker will use version control and encryption so they don't get misused.
I will be advertising these jobs on several message boards where game development types of people go, so there may be people working on FP that have never even played Xenimus.
This method of doing things gives everyone an interest in making the game successful.
FP is just too big for me to develop alone so if nobody is interested in helping then development will stop.
There are many different paths this plan could take."
I'm in no way saying people should focus on Xen over PV, but we have some very skilled models here who could pound out some models in a short time, making hundreds for PV.


Scott Henninger
Unread
"The original notion of
design patterns stems from Christopher Alexander’s
notion of pattern languages for Architecture [2]. A key
perspective of this work was the dual utility of patterns
serving as a common vocabulary by which people can
succinctly communicate well-known solutions to
recurring problems and a systematic language for
developing holistic solutions by composing patterns at
different levels of abstraction. Patterns are used to
leverage the experience of system designers and
capture not only descriptions of solutions to recurring
problems, but also the context addressed by the
solutions, the means by which problem requirements
are satisfied and examples of the solution"


DELETE https://apis.wso2.com/api/am/admin/v0.15/throttling/policies/advanced/{policyId}
Deletes an Advanced level throttling policy.
apim:tier_manage
i
DELETE https://localhost:9443/api/am/admin/v0.15/throttling/policies/advanced/a0c9f368-b7d2-4eec-a757-f67034160208
Authorization: Bearer f7058af8-65a3-36c0-8d61-bc30476755c7
HTTP/1.1 200 OK
curl -k -X DELETE -H "Authorization: Bearer f7058af8-65a3-36c0-8d61-bc30476755c7" https://localhost:9443/api/am/admin/v0.15/throttling/policies/advanced/a0c9f368-b7d2-4eec-a757-f67034160208
| Type | Name | Description | Schema | Default |
|---|---|---|---|---|
| Path |
policyId required |
Thorttle policy UUID |
String | |
| Header |
If-Match optional |
Validator for conditional requests; based on ETag (Will be supported in future). |
String | |
| Header |
If-Unmodified-Since optional |
Validator for conditional requests; based on Last Modified header (Will be supported in future). |
String |
| HTTP Code | Description | Schema |
|---|---|---|
200 |
OK. Resource successfully deleted. |
|
404 |
Not Found. Resource to be deleted does not exist. |
Error |
412 |
Precondition Failed. The request has not been performed because one of the preconditions is not met (Will be supported in future). |
Error |
GET https://apis.wso2.com/api/am/admin/v0.15/throttling/policies/advanced/{policyId}
Retrieves an Advanced Policy.
apim:tier_view
i
GET https://localhost:9443/api/am/admin/v0.15/throttling/policies/advanced/ea4ee02d-6cfb-4eea-9e30-3f548783160b
Authorization: Bearer f7058af8-65a3-36c0-8d61-bc30476755c7
HTTP/1.1 200 OK
Content-Type: application/json
{
"policyId": "ea4ee02d-6cfb-4eea-9e30-3f548783160b",
"policyName": "50KPerMin",
"displayName": "50KPerMin",
"description": "Allows 50000 requests per minute",
"isDeployed": true,
"defaultLimit": {
"type": "RequestCountLimit",
"timeUnit": "min",
"unitTime": 1,
"requestCount": 50000
},
"conditionalGroups": []
}
curl -k -H "Authorization: Bearer f7058af8-65a3-36c0-8d61-bc30476755c7" https://localhost:9443/api/am/admin/v0.15/throttling/policies/advanced/ea4ee02d-6cfb-4eea-9e30-3f548783160b
| Type | Name | Description | Schema | Default |
|---|---|---|---|---|
| Path |
policyId required |
Thorttle policy UUID |
String | |
| Header |
If-None-Match optional |
Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resource (Will be supported in future). |
String | |
| Header |
If-Modified-Since optional |
Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource (Will be supported in future). |
String |
| HTTP Code | Description | Schema |
|---|---|---|
200 |
OK. Policy returned |
AdvancedThrottlePolicy |
304 |
Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future). |
|
404 |
Not Found. Requested Policy does not exist. |
Error |
406 |
Not Acceptable. The requested media type is not supported. |
Error |
PUT https://apis.wso2.com/api/am/admin/v0.15/throttling/policies/advanced/{policyId}
Updates an existing Advanced level throttling policy.
apim:tier_manage
i
PUT https://localhost:9443/api/am/admin/v0.15/throttling/policies/advanced/a0c9f368-b7d2-4eec-a757-f67034160208
Authorization: Bearer f7058af8-65a3-36c0-8d61-bc30476755c7
Content-Type: application/json
{
"policyName": "100KBP2Min",
"displayName": "100KBP2Min",
"description": "description of the policy",
"defaultLimit": {
"type": "BandwidthLimit",
"timeUnit": "min",
"unitTime": 2,
"dataAmount": 100,
"dataUnit": "KB"
},
"conditionalGroups": [
{
"description": "Sample description about condition group",
"conditions": [
{
"type": "IPCondition",
"invertCondition": false,
"ipConditionType": "IPSpecific",
"specificIP": "<IP_ADDRESS>",
"startingIP": null,
"endingIP": null
},
{
"type": "HeaderCondition",
"invertCondition": false,
"headerName": "Host",
"headerValue": "<IP_ADDRESS>"
},
{
"type": "QueryParameterCondition",
"invertCondition": false,
"parameterName": "name",
"parameterValue": "admin"
},
{
"type": "JWTClaimsCondition",
"invertCondition": true,
"claimUrl": "claimUrl0",
"attribute": "claimAttr0"
}
],
"limit": {
"type": "RequestCountLimit",
"timeUnit": "sec",
"unitTime": 60,
"requestCount": 0
}
}
]
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"policyId": "a0c9f368-b7d2-4eec-a757-f67034160208",
"policyName": "100KBP2Min",
"displayName": "100KBP2Min",
"description": "description of the policy",
"isDeployed": true,
"defaultLimit": {
"type": "BandwidthLimit",
"timeUnit": "min",
"unitTime": 2,
"dataAmount": 100,
"dataUnit": "KB"
},
"conditionalGroups": [
{
"description": "Sample description about condition group",
"conditions": [
{
"type": "IPCondition",
"invertCondition": false,
"ipConditionType": "IPSpecific",
"specificIP": "<IP_ADDRESS>",
"startingIP": null,
"endingIP": null
},
{
"type": "HeaderCondition",
"invertCondition": false,
"headerName": "Host",
"headerValue": "<IP_ADDRESS>"
},
{
"type": "QueryParameterCondition",
"invertCondition": false,
"parameterName": "name",
"parameterValue": "admin"
},
{
"type": "JWTClaimsCondition",
"invertCondition": true,
"claimUrl": "claimUrl0",
"attribute": "claimAttr0"
}
],
"limit": {
"type": "RequestCountLimit",
"timeUnit": "sec",
"unitTime": 60,
"requestCount": 0
}
}
]
}
curl -k -X PUT -H "Authorization: Bearer f7058af8-65a3-36c0-8d61-bc30476755c7" -H "Content-Type: application/json" https://localhost:9443/api/am/admin/v0.15/throttling/policies/advanced/a0c9f368-b7d2-4eec-a757-f67034160208 -d @data.json
| Type | Name | Description | Schema | Default |
|---|---|---|---|---|
| Path |
policyId required |
Thorttle policy UUID |
String | |
| Body |
body required |
Policy object that needs to be modified |
AdvancedThrottlePolicy (AdvancedThrottlePolicy) | |
| Header |
Content-Type required |
Media type of the entity in the body. Default is application/json. |
String |
application/json |
| Header |
If-Match optional |
Validator for conditional requests; based on ETag (Will be supported in future). |
String | |
| Header |
If-Unmodified-Since optional |
Validator for conditional requests; based on Last Modified header (Will be supported in future). |
String |
| HTTP Code | Description | Schema |
|---|---|---|
200 |
OK. Policy updated. |
AdvancedThrottlePolicy |
400 |
Bad Request. Invalid request or validation error. |
Error |
404 |
Not Found. The resource to be updated does not exist. |
Error |
412 |
Precondition Failed. The request has not been performed because one of the preconditions is not met (Will be supported in future). |
Error |


Cluster data is refreshing.
(click to refresh)
Last refresh: {{vm.state.lastRefresh | timestamp }} ({{vm.state.lastRefresh | relativeTime }})


| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
DEFAULT_DIVIDER |
1 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
public static final double |
FRAME_DIFF_FAST |
400.0 |
public static final double |
FRAME_DIFF_NORMAL |
800.0 |
public static final double |
FRAME_DIFF_SLOW |
1600.0 |
public static final double |
FRAME_DIFF_VERY_FAST |
200.0 |
public static final double |
FRAME_DIFF_VERY_SLOW |
3200.0 |
public static final double |
MAX_DECREASE |
0.0 |
public static final double |
MAX_INCREASE |
1.0 |
public static final double |
RATE |
0.1 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
DEFAULT_INITIAL_ACTION_SEQUENCE_COUNT |
1000 |
private static final int |
DEFAULT_INITIAL_NODE_COUNT |
1000 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
FACTORY_FORBID_UNTIL_SECONDS |
600 |
private static final int |
SECOND_ENGINEERINGBAY_FORBID_UNITL_SECONDS |
900 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
STARPORT_FORBID_UNTIL_SECONDS |
900 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
SECOND_ARMORY_FORBID_UNITL_SECONDS |
900 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
DEFAULT_POINT_BOX_SIZE |
16 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final boolean |
DEFAULT_FILLED |
true |
private static final int |
DEFAULT_RADIUS |
5 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final boolean |
DEFAULT_VERTICES_FILLED |
false |
private static final int |
DEFAULT_VERTICES_RADIUS |
5 |
private static final boolean |
DEFAULT_VERTICES_SHOWN |
true |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
DEFAULT_ARROW_ANGLE_DEG |
30 |
private static final boolean |
DEFAULT_ARROW_DIRECTION_SHOWN |
true |
private static final int |
DEFAULT_ARROW_LENGTH |
5 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final double |
DEFAULT_CHOKEPOINT_VECTOR_LENGTH |
64.0 |
private static final int |
DEFAULT_CHOKEPOINT_VECTOR_ROTATION |
90 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
BLOCKING_MINERAL_POINT_RADIUS |
16 |
private static final int |
POLYGON_VERTEX_RADIUS |
5 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
GAME_SPEED |
0 |
private static final int |
MAX_POLYGON_EDGE_LENGTH |
100 |
private static final int |
MINERAL_BLOCK_RANGE |
64 |
private static final int |
UNIT_FLAG |
1 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
DEFAULT_MIN_DISTANCE |
256 |
private static final int |
DEFAULT_SEARCH_STEP_DISTANCE |
200 |
private static final int |
EXPAND_MULTIPLIER_MAX |
5 |
private static final int |
SKIP_DISTANCE_TO_CHOKEPOINT |
256 |
private static final int |
TILE_RADIUS_AROUND_UNITS_SEARCH |
1 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
protected static final int |
ALPHA_MAX |
90 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final double |
INFLUENCE_BASE |
0.3 |
private static final double |
INFLUENCE_CHOKEPOINT |
5.7 |
private static final double |
INFLUENCE_COMPANIONS |
1.2 |
private static final double |
INFLUENCE_ENEMIES |
0.9 |
private static final double |
INFLUENCE_INITIAL |
1.2 |
private static final double |
TOTAL_RETREAT_DISTANCE |
224.0 |
private static final int |
TURN_RADIUS |
10 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
public static final int |
BASELOCATIONS_TIME_PASSED |
300 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private final int |
vectorLength |
320000 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
TURN_RADIUS |
10 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
TURN_RADIUS |
10 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
MIN_HEALTH |
30 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
CHOKE_POINT_PATH_INDEX |
4 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
SEARCH_STEP_DISTANCE |
200 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
EXTRA_GROUND_WEAPON_RANGE |
64 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
protected static final double |
CONFIDENCE_THRESHHOLD |
0.5 |
private static final int |
CONFIDENCE_TILE_RADIUS |
15 |
private static final int |
DEFAULT_DETECTION_TILERANGE |
10 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
HEAL_PIXEL_DISTANCE |
96 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
SUPPORT_PIXEL_DISTANCE |
64 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
REPAIR_PIXEL_DISTANCE |
128 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
MAX_SIEGE_TILE_RANGE |
12 |
private static final int |
MIN_SIEGE_TILE_RANGE |
6 |
| Modifier and Type | Constant Field | Value |
|---|---|---|
private static final int |
FRAME_UPDATE_DIFF |
24 |
private static final int |
MAX_TIME_UNTIL_OUTDATED |
20 |


{% extends "site_base.html" %} {% load i18n %} {% load flatblock_tags %} {% block head_title %}{% trans "Server Error" %}{% endblock %} {% block body %}
We're sorry but a server error has occurred. We've been notified and will look into it as soon as possible.\"\r\n
\r\nPerhaps you would like to create a ticket?


hovr2pi -- Musings of Chris Simmons
Below is a collated list of all of the projects, websites and code bases that keep me busy.
- Personal Website with
- talks,
- projects,
- publications,
- presentations,
- course lectures and
- random bits of unix geekery
- thermonaut.org -- High Accuracy Ab Initio Extrapolative Thermochemistry Database
- install.hovr2pi.org -- Install scripts, hacks and reminders to me on how to install stuff


5 Recursion
5.5 Primitive Recursive Functions
In the previous section, we leaned about the primitive recursive function called the "successor", one that was used by Peano in his axioms. There are other primitive recursive functions as well, and these are usually given as axioms (i.e., without proof):
- the "zero function"
- the "projection function"
- "identity function"
These combined with the Peano axioms allow us to define other primitive recursive functions.
5.5.1 Addition
In the literature, the definition for Peano addition is done in the following manner:
a + 0 = a,
a + S(b) = S(a + b)
where S
is the successor function defined in the previous section.
First we have an identity function: any number that has zero added to it yields the result of the number itself.
Secondly, a number, when added with the successor of another number is equal to the successor of the two numbers combined. Let's take a look at an example:
- The number 0, when applied to the successor function yields 1 (
S(0) = 1
) - Therefore,
a + S(0) = a + 1
- By Peano's definition of addition then, we have
a + 1 = S(a + 0)
- Which then gives
a + 1 = S(a)
In other words, the successor of a
is a + 1
.
These rules for addition are sometimes given in the following pseudo code:
add(0, x) = x
add(succ(n), x) = succ(add(n, x))
In LFE, we'd like to maintain symmetry with this. We could try to construct a function that had both definitions as pattern arguments, thus alleviating the need for two function definitions. However, to perfectly map the pseudo code to LFE, we'd have to put a function call in our pattern... and that's not possible.
If, though, we do a little algebraic juggling, we can work around this. In our
pseudo code we have two parameters: succ(n)
and x
. If we apply a
"predecessor" function to succ(n)
, we'll just have n
-- which would
do nicely for a matched function argument in LFE. But we'll also need to apply
this predecessor function to the n
on the other side of the equation.
Let's create such a "predecessor" function:
Now, we can recast the canonical form above using the workaround of the
predecessor
primitive recursive function, allowing us to use one function
to define Peano's addition axiom:
All of this may seem rather absurd, given what we do in every-day programming. Remember, though: the verbosity of these axioms and their derived definitions serves to explicitly show that no assumptions are being made. With a foundation of no assumption, we can be certain that each brick we lay on top of this sound (if possibly baroque) basis will be unshakable (baring the random proof by Gödel, of course).
5.5.2 Subtraction
Next up, let's take a look at subtraction:
sub(0, x) = x
sub(pred(n), x) = pred(sub(n, x))
Similar to addition above, we make some adjustments for the convenience of pattern matching:
Due to the manner in which we have defined our functions, the usual usage is
reversed for our subtract
function. The first operand is not the number
that is being subtracted from, but rather the number that is being subtracted.
We can see this in action if we put our definitions in a file called
prf.lfe
(named for "primitive recursive functions") and slurp
it in
the LFE REPL:
5.5.3 Multiplication
The last one of these that we will look at is multiplication, and then we'll move on to something a little more complicated :-)
mult(0, x) = 0
mult(succ(n), x) = x + (x * n)
Again, using our pattern workaround:


Configuration
These settings are not persistent: they will be reset when WebMon is restarted. To make them permanent you
need open the WebMon WAR file and edit the WEB-INF/classes/config.properties
file instead.
To prevent overwriting these settings upon WAR upgrading you may store the configuration file to /etc/webmon.properties (or any other location,
as specified in the WEB-INF/web.xml file).


Man Utd Coach On Mourinho's 'Circus' Return
by SL InternationalOle Gunnar Solskjaer was the man who replaced Jose Mourinho at Manchester United, and the Red Devils manager has now commented on the Portuguese's return to the Premier League.
Read: Five Players Mourinho Could Sign In January
Mourinho was appointed manager of Tottenham Hotspur on Thursday morning following the sacking of Mauricio Pochettino the evening before.
The Portuguese endured a difficult third season at Old Trafford, which resulted in a exit in December last year following a 3-1 loss to rivals Liverpool.
"When it's like this, you like Jose coming back," Solskjaer, as per Sky Sports.
"It's going to be a spectacle and a circus and Nemanja has a sense of humour."
Pochettino was heavily linked with a move to United when Mourinho was sacked, but Solskjaer insists he is not worried about his job with the Argentine now a free agent.
"It doesn't bother me at all because I've got the best job in the world.
"I am sure if you are in or out of a job and you are a manager, you would want this job, so it doesn't really matter whatever happens around it.
"I've got to focus on my job at Manchester United and do it as well as I can. I speak with Ed (Woodward) and the owners all the time about how we are going to move the club forward.
"That doesn't change if some other clubs change their managers."


Portfolio
Academic Experience
ECE233 - Introduction to Digital Systems
Guitar Hero FPGA Board
Each week, every lab would add a piece of functionality to a Guitar Hero game on an FPGA board provided by the school. Using schematic design and small bits of Verilog to implement functionality. Checked digital logic using output waveforms.
ECE230 - Intro to Embedded Systems
Capstone Color Indicator Project
Lab Assignments
Mini Projects
Combine concepts discussed over the ten week class period into one system using a Texas Instruments MSP430. My partner and I implemented a color indicator that took in serial console input and used UART communication to tell the microcontroller what color the LED should light up, what angle the servo should point out, and what letter the seven-segment display should show.
Each week, we were introduced to a different part of the Texas Instruments MSP430 microcontroller in guided labs where we would implement something using the provided documentation to learn C coding, ARM assembly, and how to navigate different pieces of technological documentation.
Each student was required to complete a minimum of five mini-projects which took the concepts from the labs and implemented them together into one system. This meant combining timers and different hardware to accomplish different objectives with varied difficulties.
Work Experience
Hancock County Highway Department
Day-To-Day Operations
Online Dashboard
As an Engineering Intern, besides the assigned task in my discipline, I also got to expereience different civil engineering tasks such as bridge inspections, road maintencance decisions, government presentations, and permit approval processes.
Organized and revized Access database into a SQLite database with more efficient formulas which could be accessed via an online dashboard on computer or mobile for field workers. Helped to make field workers more efficient by digitizing paper work orders, allowing workers to see tasks in process while still out in the field.
Allison Transmissions
Online Dashboard
Regulatory Compliance
Configured collected data to be presented via an online dashboard which project teams could download and use in simulations and for further product calculations and improvements. Worked with established Snowflake database to import, alter, summarize, graph, and present data to all project line teams.
Collected VOC (Voice of Customer) feedback to improve internal product change submission process in regards to the company's regulations committee. Presented solution to higher up executives in hopes of receiving approval for the project to continue.


ABOUT US
Delivery technical Service
Placeholder text commonly used to demonstrate the visual form of
a document or a typeface without relying on meaningful content
Lorem ipsum may
Our technician have decades of practical,infield experience besides factory training.This means they
have the knowledge and skills needed to diagnose and repair any appliance you may have
Placeholder text commonly used to demonstrate the visual form of
a document or a typeface without relying on meaningful content
Lorem ipsum may
Our qualified team strive for ensuring your
satisfaction,while offering the highest
levels of.
Our qualified team strive for ensuring your
satisfaction,while offering the highest
levels of.
Our qualified team strive for ensuring your
satisfaction,while offering the highest
levels of.
Here is the easiest way to reach us,Write us a
message and we will get back
55 Bloomfield Ave,Pinedale,WY 82941,United
States
0700001000
sim@moringa.com


Pick your poison
Never have to go to school again or never have to pay for food again
never pay for food
never go to school
This is a required question
Team Edward or Team Jacob
edward
jacob
This is a required question
Drake and Josh or Zoey 101
Drake and Josh
Zoey 101
This is a required question
Florida or California
florida
califorina
This is a required question
Canada or RUSSIA
canada
russia
This is a required question
15 ft of snow or 105 degrees F
snow
heatwave
This is a required question
Disney or Nick
disney
nick
This is a required question
would you rather eat a 1,000 chicken wings or hike up hill for 30 miles
give me the chicken wings
i rather hike to my death
This is a required question
never make it to school on time or have your mom always be 30 minutes late to pick you up from practice
never be on time for school
awkwardly sit with the coach
This is a required question
only be able to email your friends or only be able to call them on the phone
email
phone
This is a required question
- -


DiceCoefficient(minLength: Int = 1, maxLength: Int = Int.MAX_VALUE)
Allows to measure the similarity of texts according to the Dice coefficient. The dice coefficient measures the percentage of n-grams, which occur in both texts. It always evaluates to a heuristic value within the interval 0,1. Texts that reach a greater heuristic value are considered to be more similar than texts that reach a smaller heuristic value. The dice coefficient can also be applied to texts with different lengths.


Freestyle
Freestyle is the last stroke in the individual medley.
Event Distances
Short Course Yards
- 50 yards
- 100 yards
- 200 yards
- 500 yards
- 1000 yards
- 1650 yards
Long Course Meters
- 50 meters
- 100 meters
- 200 meters
- 400 meters
- 800 meters
- 1500 meters
Home


Currently, I'm in my last year at California State University: East Bay, majoring in Multimedia. I work as the graphic designer for my school's newspaper The Pioneer
as well as both a graphic designer and assistant manager at Limitless Escape Games in Livermore.
My abilities range as far as creating marketing advertisements to shooting graduation photos.
Take a look at my portfolio if you'd like to see some examples of my work!
In my free time, you can catch me fending off the demons of Argus, escorting the Payload, or trying to beat the clock
in an escape room. If you like what you saw or had any comments, let me know here!


Public Member Functions | |
Constructors and Destructor | |
| DTDHandler () | |
| Default Constructor. | |
| virtual | ~DTDHandler () |
| Destructor. | |
The DTD handler interface | |
| virtual void | notationDecl (const XMLCh *const name, const XMLCh *const publicId, const XMLCh *const systemId)=0 |
| Receive notification of a notation declaration event. | |
| virtual void | unparsedEntityDecl (const XMLCh *const name, const XMLCh *const publicId, const XMLCh *const systemId, const XMLCh *const notationName)=0 |
| Receive notification of an unparsed entity declaration event. | |
| virtual void | resetDocType ()=0 |
| Reset the DocType object on its reuse. |
If a SAX application needs information about notations and unparsed entities, then the application implements this interface and registers an instance with the SAX parser using the parser's setDTDHandler method. The parser uses the instance to report notation and unparsed entity declarations to the application.
The SAX parser may report these events in any order, regardless of the order in which the notations and unparsed entities were declared; however, all DTD events must be reported after the document handler's startDocument event, and before the first startElement event.
It is up to the application to store the information for future use (perhaps in a hash table or object tree). If the application encounters attributes of type "NOTATION", "ENTITY", or "ENTITIES", it can use the information that it obtained through this interface to find the entity and/or notation corresponding with the attribute value.
The HandlerBase class provides a default implementation of this interface, which simply ignores the events.
| DTDHandler::DTDHandler | ( | ) |
Default Constructor.
| virtual DTDHandler::~DTDHandler | ( | ) | [virtual] |
Destructor.
| virtual void DTDHandler::notationDecl | ( | const XMLCh *const | name, | |
| const XMLCh *const | publicId, | |||
| const XMLCh *const | systemId | |||
| ) | [pure virtual] |
Receive notification of a notation declaration event.
It is up to the application to record the notation for later reference, if necessary.
If a system identifier is present, and it is a URL, the SAX parser must resolve it fully before passing it to the application.
| name | The notation name. | |
| publicId | The notation's public identifier, or null if none was given. | |
| systemId | The notation's system identifier, or null if none was given. |
| SAXException | Any SAX exception, possibly wrapping another exception. |
Implemented in HandlerBase, and DefaultHandler.
| virtual void DTDHandler::unparsedEntityDecl | ( | const XMLCh *const | name, | |
| const XMLCh *const | publicId, | |||
| const XMLCh *const | systemId, | |||
| const XMLCh *const | notationName | |||
| ) | [pure virtual] |
Receive notification of an unparsed entity declaration event.
Note that the notation name corresponds to a notation reported by the notationDecl() event. It is up to the application to record the entity for later reference, if necessary.
If the system identifier is a URL, the parser must resolve it fully before passing it to the application.
| SAXException | Any SAX exception, possibly wrapping another exception. |
| name | The unparsed entity's name. | |
| publicId | The entity's public identifier, or null if none was given. | |
| systemId | The entity's system identifier (it must always have one). | |
| notationName | The name of the associated notation. |
Implemented in HandlerBase, and DefaultHandler.
| virtual void DTDHandler::resetDocType | ( | ) | [pure virtual] |
Reset the DocType object on its reuse.
This method helps in reseting the DTD object implementation defaults each time the DTD is begun.
Implemented in HandlerBase, and DefaultHandler.


Back to shop
Billing
Billing
Full name:
Email:
Billing address:
City:
Country:
Province/State:
Order Summary
Subtotal
Delivery
Free
Total to pay
Place order
Complimentary Shipping & Returns
er {}


All our pizzas are made with hand-thrown thin crust, baked in real wood ovens.
Choose from one of these sizes:
Small (12")
Medium (14")
Large (17")
Meat Pies:
Vegetarian Pies:


I would like to ask you to participate in data collection to gain a broad sense of people's impressions and feelings about the ukulele, whether positive or negative; their participation in ukulele groups, or lack thereof; and some demographic information to see if these opinions and experiences can be in any way mapped to social demographic. These results will inform my PhD thesis. The survey is for anyone and you should not feel that a lack of knowledge or experience with the instrument should keep you from forming an opinion on it.
The survey includes ten questions in total but all questions are optional and you need not answer all (or any) of them if you do not wish to. Questions are informal and may be answered as formally or informally, in as much or as little detail as you like. Your participation in this study is entirely voluntary.
The information you provide is confidential and there is no risk to you as a participant, but anonymised quotes may be used. Your IP address is anonymous to SurveyMonkey and I will not be collecting your location (except for the extent to which you choose to answer question 6, 'Where do you live?'). Results from the survey will be treated as a source of background information for my PhD thesis, alongside literature-based research and interviews with others.
No personal identifying information will appear in any publications resulting from this study.
If you have any questions regarding this study or would like additional information please contact<EMAIL_ADDRESS>By filling in this survey you indicate that you understand its purpose and consent to the use of the data as indicated above.
Thank you for your cooperation. Click the button below to begin.


We have dogs!
- drive cross-media methodologies
- enhance real-time initiatives
- innovate holistic infomediaries
- seize seamless technologies
- innovate open-source content
- generate visionary ROI
- productize open-source ROI
- incubate killer paradigms
- drive real-time markets
- deliver sexy action-items
- embrace e-business supply-chains
- grow bricks-and-clicks markets
- engage bleeding-edge e-tailers


Multiple instances
Same class, but not updated
Alternative content for the map
Map with multiple plotted cities legends that handle different criteria
Alternative content for the legend
Alternative content for the legend2
Alternative content for the map
All example for jQuery Mapael are available here.