Dave Thomas (http://pragprog.com/pragdavePragDave) writes about user interface in his latest post. He talks about Naked Objects:
A Naked Objects system provides mechanism, but little in the way of policy. When I describe this, some folks have a strong reaction against the idea. "Without high-level policy imposed by the GUI (scripting, or series of modal dialogs that have to be filled in in a proscribed order) how can we ensure our users do everything that needs to be done?" they ask. And its a good question. Experienced users, folks who understand the domain, love Naked Object systems because they get the control and flexibility they need to get the job done. But inexperienced users can be confounded by that same flexibility—"what should I do now?". (In a way, this also relates back to the Dreyfus model of skills acquisition: beginners need to be guided, while experts need to be left alone to get on with their jobs.)I think that dichotomy -- flexible tools for experts, guided applicatins for beginners -- isn't entirely correct. I believe good user interfaces are built up out of heuristics -- you guess what the user wants to do next, you guess what information they need to know, and in what order. It's just guessing (which is why it's based on heuristics, not rules), but doing it right is very important.
This guessing is no less useful for an expert than a beginner, though the answers you'll come up with are much different for the two. The expert may not need guidance, but a well-honed UI can save them from navigation, and that looks just like guidance. This is all especially true of an application that is data-rich, with complex relations among data -- exactly the sort of systems that Naked Objects are addressing.
In my experience with application development, domain objects can be implemented in a fairly stable manner. They can be abstract, normalized, and elegant.  An abstract UI is almost an oxymoron. An elegant UI is elegant based on user interactions, not an intrinsic elegance. Binding the UI to the objects themselves doesn't seem like an good, or even particularly powerful idea.  That's not an impossible goal, but it's not what Naked Objects is trying to sell.
My post on status notification web pattern was about enabling the heuristics that make a good UI -- it lets you easily move the user through the system, predicting where they may want to go next. This shouldn't be confused with back-button-breaking web applications that make the user go through a particular navigation (often with overuse of POST). That's, and other modal, restricted, highly-directed systems are simply poor implementations, they shouldn't be an indictment of guidance as a tool that can help all users, at all levels.


Adding some unicode characters to the page to make sure they are properly handled. At sentry, we like 🚢🚢🚢. We also like 🍕, 🍺 and 🐕. (Some people might actually prefer 🐈⬛ but the test author is a dog person, so 🤷♂).


from . import utilities as utili
import logging
import matplotlib
import matplotlib.pyplot as plt
from numpy import argsort
from scipy.signal import find_peaks as peak_find
matplotlib.use('TkAgg')
function to find peaks given a prominence and data
:param data: y_data as an np array
:param prominence: height from top of base to tip as a float
:param height: optional, the minimum height of any peaks found
:param width: the minimum width of any peaks found
:return: peak_info, a dict containing information of the found peaks details such as center indices,
edge indices and amplitudes. Note all are sorted in order of amplitude
def peak_finder(data, prominence, height=0, width=0):
logging.debug(f'finding peaks based on prominence of {prominence}')
do a routine looping through until the right number of peaks is found
find the peak positions in the data
peaks, properties = peak_find(
data, prominence=prominence, height=height, width=width)
peaks = list(peaks) # convert to a list
amps = list(properties['peak_heights']) # store the heights
we will sort below in order of amplitudes
sorted_indices = argsort(amps)[::-1]
peak_info = {
'center_indices': sort_lists(
sorted_indices, peaks), 'right_edges': sort_lists(
sorted_indices, list(
properties['right_bases'])), 'left_edges': sort_lists(
sorted_indices, list(
properties['left_bases'])), 'amplitude': sort_lists(
sorted_indices, amps)}
return peak_info
given a list of indices and a list to sort sort the list using the sorted_indices order
:param sorted_indices: a list of indices in the order they should be e.g. [0,4,2,3]
:param list_to_sort: the list which needs to be sorted in the indice order from sorted_indices
:return: sorted list
def sort_lists(sorted_indices, list_to_sort):
return [list_to_sort[i] for i in sorted_indices]
given a prominence and y_data find the peak_info which contains center indices. a redundant function which will be
replace by peak_finder
:param prominence:
:param y_data:
:param find_all:
:return:
def find_cents(prominence, y_data, find_all=False):
logging.debug(f'finding centre values based on prominence of {prominence}')
peak_info = peak_finder(
y_data,
prominence,
height=0,
width=0) # find the peak centers
if find_all:
return peak_info
center_indices = peak_info[‘center_indices’]
return peak_info
automatic peak finding routine which finds peaks given a user supplied prominence, and presents the peaks until user
is happy
:param prominence: height from noise to tip of peaks
:param x_data: x_data as np array
:param y_data: y_data as np array
:return: peak_info is a dict containing information about the peaks e.g. centers etc. also prominence used to find
these peaks
def auto_peak_finder(prominence, x_data, y_data):
while True:
peak_info = find_cents(prominence, y_data, find_all=True)
plt.plot(x_data, y_data)
peak_coordinates = [x_data[ind] for ind in peak_info['center_indices']]
for xc in peak_coordinates:
plt.axvline(x=xc)
print(
f"Peak finder requires user input, please look at the following plot with prominence={prominence}")
plt.show()
ans = input(
"If you are happy with the plot, type y. If not then please type a new prominence ")
if ans == 'y':
break
else:
try:
prominence = float(ans)
except ValueError:
print("You entered an incorrect answer! Trying again...")
plt.close()
return peak_info, prominence
as the user to find the peak properties one by one, i.e. the centers, then amplitudes then sigmas.
:param x_data: np array of x data
:param y_data: np array of y data
:return: peak_info dict containing data on peaks
def user_peak_finder(x_data, y_data):
peak_info = {'center_values': (), 'amplitude': (), 'sigma': ()}
for key, peak_value in peak_info.items():
while True:
to_plot = peak_value
if key == 'sigma':
cents = peak_info['center_values']
to_plot = [(cents[i] - width / 2, cents[i] + width / 2)
for i, width in enumerate(to_plot)]
print(
f"Peak finder requires user input, please look at the following plot of values for {key}: {peak_value}")
plot_values(key, to_plot, x_data, y_data)
ans = input(
"If you are happy with the plot, type y. If not then please type a list of values seperated by commas ")
if ans == 'y':
break
else:
try:
peak_value_ = ans.split(',')
peak_value = [float(i) for i in peak_value_]
except ValueError:
print("You entered an incorrect answer! Trying again...")
plt.close()
peak_info[key] = peak_value
return peak_info
plot the values of the data and any centers etc.
:param key: the key of what is being plotted
:param list_of_values: a lisst of the values that are being plotted e.g. center values
:param x_data: an np array of x data
:param y_data: an np array of y data
:return:
def plot_values(key, list_of_values, x_data, y_data):
plt.plot(x_data, y_data)
if key == 'center_values':
for xc in list_of_values:
plt.axvline(x=xc)
elif key == 'amplitude':
for yc in list_of_values:
plt.axhline(y=yc)
elif key == 'sigma': # these have to be passed in as band edges
for band in list_of_values:
plt.axvspan(band[0], band[1], alpha=0.1, color='red')
plt.show()
decide which interactive peak finder to use, i.e. the completely user guided one or the prominence based automatic one
:param x_data: np array of x data
:param y_data: np array of y data
:param type: str: which type of peak finder to use
:param prominence: optional, the prominence to pass to the auto peak finder
:return: peak_info dict containing information of the peaks, and the prominence used
def interactive_peakfinder(x_data, y_data, type='auto', prominence=1):
logging.debug('finding centres of peaks with user guided routine')
if type == 'user':
peak_info = user_peak_finder(x_data, y_data)
prominence = None
else:
peak_info, prominence = auto_peak_finder(prominence, x_data, y_data)
center_indices = peak_info['center_indices']
peak_info['center_values'] = x_data[center_indices]
return peak_info, prominence
match the centers of peaks using some indices of guesses for the center and the actual data. uses a peak finder and
finds the closest peak to each of the provided guesses
:param center_indices: a list of indices of the centers
:param y_data: np array of y data
:param prominence: prominence used to find the centers. if this is too high then too few peaks will be found
:return: a list of center indices
def match_peak_centres(center_indices, y_data, prominence=1):
while True:
peak_info_ = find_cents(prominence, y_data, find_all=True)
center_indices_ = utili.find_closest_indices(
peak_info_['center_indices'],
center_indices) # the indices might be slightly off so fix that
if len(center_indices_) == len(center_indices):
break
elif len(center_indices_) > len(center_indices):
center_indices_ = center_indices_[
:len(center_indices)] # as they're in order of prominence
break
else:
increase prominence until we get more than or equal to number.
prominence *= 10
do something smarter!
center_indices = [peak_info_['center_indices'][i] for i in center_indices_]
return center_indices
given the data call the interactive_peakfinder which will launch a user guided routine to find peaks. then pull
from this the results of that e.g. centers and widths etc
:param x_data: np array of x data
:param y_data: np array of y data
:param type: type of user guided routine to use
:param prominence: prominence to pass to user guided routine
:return: int number of peaks being used, peak info dictionary, peak_info_dict containing information of the peaks,
prominence used to find peaks
def find_peak_details(x_data, y_data, type='auto', prominence=1):
logging.debug(
f'finding peak details based on prominence of {prominence}, and user provided details:'
f'no_peak')
peak_info, prominence = interactive_peakfinder(
x_data, y_data, type, prominence)
no_peaks = max(len(value) for value in peak_info.values())
center = peak_info['center_values']
amplitude = peak_info['amplitude']
sigma = peak_info.get('sigma', ())
for i, sig in enumerate(sigma):
x1 = x_data[0] + sig # this is a bit dodgy??
this finds the closest x value to the width plus the first
sigma[i] = utili.find_closest_indices(x_data, x1)
x value. should really do this from the raw widths
type = ["LorentzianModel" for i in range(no_peaks)]
peak_info_dict = {}
peak_info_dict['center'], peak_info_dict['amplitude'], peak_info_dict['sigma'], \
peak_info_dict['type'] = center, amplitude, sigma, type
return no_peaks, peak_info_dict, prominence
user guided routine to find peak parameter bounds given inputs
:param x_data: np array of x data
:param y_data: np array of y data
:param no_peaks: no of peaks as int
:param peak_info_dict: dictionary containing all the peak information
:return: bounds dictionary containing user defined bounds on all the keys in peak_info_dict
def make_bounds(x_data, y_data, no_peaks, peak_info_dict):
logging.debug(f'making bounds based on: no_peaks:{no_peaks}, '
f'peak_info_dict: {peak_info_dict}')
bounds = {}
for key in peak_info_dict:
while True:
ans = input(f"Do you want to create bounds for {key}? \n"
f"Current values are: {peak_info_dict[key]} \n"
f"type y or n")
if ans == 'y':
bounds[key] = interactive_bounds(
x_data, y_data, len(peak_info_dict[key]))
break
elif ans == 'n':
break
else:
print("incorrect answer, please type y or n")
return bounds
interactive bound find for the data
:param x_data: np array of x data
:param y_data: np array of y data
:param no_bounds: how many bounds to create.
:return: bounds as a list of values for whatever is being calculated.
def interactive_bounds(x_data, y_data, no_bounds: int):
bounds = [(0, 0) for i in range(no_bounds)]
while True:
plt.plot(x_data, y_data)
for bound in bounds:
plt.axvspan(bound[0], bound[1], alpha=0.1, color='red')
print(f"current bounds are: {bounds}")
plt.show()
ans = input(
f"Please enter a list of values for the bounds, comma delimited. You must enter {2*no_bounds}"
f" numbers. type y if you are happy with these bounds")
if ans == 'y':
break
else:
try:
bounds = ans.split(',')
bounds = [float(i) for i in bounds]
if len(bounds) != 2 * no_bounds:
raise ValueError("incorrect no of bounds passed")
else:
bounds = [(bounds[2 * i], bounds[2 * i + 1])
for i in range(no_bounds)]
except Exception as e:
print("You entered an incorrect answer! Trying again...")
plt.close()
return bounds


Coming Soon
The attractions you were looking for are still going through the vetting process. This is a rigorous process so that we can ensure that you only see the best of the best. Happy Dubaing!


|
motley-php
Useful PHP utility classes and programs
|
Check smoothly for error conditions. More...
Public Member Functions | |
| __construct (int $errLvl=E_USER_ERROR) | |
| Class constructor. More... | |
| getErrorLevel () | |
| Get the instance error level. More... | |
| setErrorLevel (int $errLvl=E_USER_ERROR) | |
| Set the instance error level. More... | |
| getFailCount () | |
| Get the number of check fails since last reset. More... | |
| resetFailCount () | |
| Reset the number of check fails to zero. More... | |
| getPassCount () | |
| Get the number of check passes since last reset. More... | |
| resetPassCount () | |
| Reset the number of check passes to zero. More... | |
| checkTrue ($cond, string $failMsg="") | |
| Check that a condition is exactly strictly true. More... | |
| checkFalse ($cond, string $failMsg="") | |
| Check that a condition is exactly strictly false. More... | |
| checkNotTrue ($cond, string $failMsg="") | |
| Check that a condition is exactly strictly not true. More... | |
| checkNotFalse ($cond, string $failMsg="") | |
| Check that a condition is exactly strictly not false. More... | |
| checkIsZero ($cond, string $failMsg="") | |
| Check that a condition is zero. More... | |
| checkIsNull ($cond, string $failMsg="") | |
| Check that a condition is null. More... | |
| checkIsNotNull ($cond, string $failMsg="") | |
| Check that a condition is not null. More... | |
Static Public Member Functions | |
| static | isAssociativeArray ($var) |
| Test if a variable in an associative array. More... | |
| static | describeVar ($var, int $maxLength=80) |
| Describe a variable type and value(s) as a length limited string. More... | |
Protected Attributes | |
| $errorLevel = E_USER_ERROR | |
| Error level to use for this instance. More... | |
| $failCount = 0 | |
| Number of check fails since reset. More... | |
| $passCount = 0 | |
| Number of check passes since reset. More... | |
Check smoothly for error conditions.
Checking via a separate package can also sometimes make it easier to acheive 100% unit test code coverage without resorting to code ignore blocks.
Definition at line 14 of file Checker.php.
| Motley\Checker::__construct | ( | int | $errLvl = E_USER_ERROR | ) |
Class constructor.
| $errLvl | - The php error level this instance will trigger us a check fails. Multiple class instances can be instantiated at different error levels. |
Definition at line 23 of file Checker.php.
| Motley\Checker::getErrorLevel | ( | ) |
Get the instance error level.
Definition at line 29 of file Checker.php.
| Motley\Checker::setErrorLevel | ( | int | $errLvl = E_USER_ERROR | ) |
Set the instance error level.
| $errLvl | - The php error level used if a check fails. |
Definition at line 35 of file Checker.php.
| Motley\Checker::getFailCount | ( | ) |
Get the number of check fails since last reset.
Definition at line 41 of file Checker.php.
| Motley\Checker::resetFailCount | ( | ) |
Reset the number of check fails to zero.
Definition at line 46 of file Checker.php.
| Motley\Checker::getPassCount | ( | ) |
Get the number of check passes since last reset.
Definition at line 52 of file Checker.php.
| Motley\Checker::resetPassCount | ( | ) |
Reset the number of check passes to zero.
Definition at line 57 of file Checker.php.
| Motley\Checker::checkTrue | ( | $cond, | |
| string | $failMsg = "" |
||
| ) |
Check that a condition is exactly strictly true.
| $cond | - The condition to check. |
| $failMsg | - The message to display if the check fails. |
Definition at line 64 of file Checker.php.
| Motley\Checker::checkFalse | ( | $cond, | |
| string | $failMsg = "" |
||
| ) |
Check that a condition is exactly strictly false.
| $cond | - The condition to check. |
| $failMsg | - The message to display if the check fails. |
Definition at line 81 of file Checker.php.
| Motley\Checker::checkNotTrue | ( | $cond, | |
| string | $failMsg = "" |
||
| ) |
Check that a condition is exactly strictly not true.
| $cond | - The condition to check. |
| $failMsg | - The message to display if the check fails. |
Definition at line 98 of file Checker.php.
| Motley\Checker::checkNotFalse | ( | $cond, | |
| string | $failMsg = "" |
||
| ) |
Check that a condition is exactly strictly not false.
| $cond | - The condition to check. |
| $failMsg | - The message to display if the check fails. |
Definition at line 115 of file Checker.php.
| Motley\Checker::checkIsZero | ( | $cond, | |
| string | $failMsg = "" |
||
| ) |
Check that a condition is zero.
| $cond | - The condition to check. |
| $failMsg | - The message to display if the check fails. |
Definition at line 132 of file Checker.php.
| Motley\Checker::checkIsNull | ( | $cond, | |
| string | $failMsg = "" |
||
| ) |
Check that a condition is null.
| $cond | - The condition to check. |
| $failMsg | - The message to display if the check fails. |
Definition at line 149 of file Checker.php.
| Motley\Checker::checkIsNotNull | ( | $cond, | |
| string | $failMsg = "" |
||
| ) |
Check that a condition is not null.
| $cond | - The condition to check. |
| $failMsg | - The message to display if the check fails. |
Definition at line 166 of file Checker.php.
|
static |
Test if a variable in an associative array.
| $var | - The variable to test. |
Definition at line 185 of file Checker.php.
Referenced by Motley\Test\CheckerTest\testIsAssociativeArray().
|
static |
Describe a variable type and value(s) as a length limited string.
| $var | - The variable to describe. |
| $maxLength | - Optional, the maximum length of the result. |
Definition at line 201 of file Checker.php.
Referenced by Motley\Test\CheckerTest\testDescribeVar().
|
protected |
Error level to use for this instance.
Definition at line 16 of file Checker.php.
|
protected |
Number of check fails since reset.
Definition at line 17 of file Checker.php.
|
protected |
Number of check passes since reset.
Definition at line 18 of file Checker.php.


Megadrought likely triggered the fall of the Assyrian Empire
| Source: | Yale University |
| Summary: | The Neo-Assyrian Empire, centered in northern Iraq and extending from Iran to Egypt — the largest empire of its time — collapsed after more than two centuries of dominance at the fall of its capital, Nineveh, in 612 B.C.E. Despite a plethora of cuneiform textual documentation and archaeological excavations and field surveys, archaeologists and historians have been unable to explain the abruptness and finality of the historic empire's collapse. |
The Neo-Assyrian Empire, centered in northern Iraq and extending from Iran to Egypt — the largest empire of its time — collapsed after more than two centuries of dominance at the fall of its capital, Nineveh, in 612 B.C.E.
Despite a plethora of cuneiform textual documentation and archaeological excavations and field surveys, archaeologists and historians have been unable to explain the abruptness and finality of the historic empire's collapse.
Numerous theories about the collapse have been put forward since the city and its destruction levels were first excavated by archaeologists 180 years ago. But the mystery of how two small armies — the Babylonians in the south and the Medes in the east — were able to converge on Nineveh and completely destroy what was then the largest city in the world, without any reoccupation, has remained unsolved.
A team of researchers — led by Ashish Sinha, California State University, Dominguez Hills, and using archival and archaeological data contributed by Harvey Weiss, professor of Near Eastern archaeology and environmental studies at Yale — was able for the first time to determine the underlying cause for the collapse. By examining new precipitation records of the area, the team discovered an abrupt 60-year megadrought that so weakened the Assyrian state that Nineveh was overrun in three months and abandoned forever. The research was published in Science Advances on Nov. 13.
Assyria was an agrarian society dependent on seasonal precipitation for cereal agriculture. To its south, the Babylonians relied on irrigation agriculture, so their resources, government, and society were not affected by the drought, explains Weiss.
The team analyzed stalagmites — a type of speleothem that grows up from a cave floor and is formed by the deposit of minerals from water — retrieved from Kuna Ba cave in northeast Iraq. The speleothems can provide a history of climate through the oxygen and uranium isotope ratios of infiltrating water that are preserved in its layers. Oxygen in rainwater comes in two main varieties: heavy and light. The ratio of heavy to light types of oxygen isotopes are extremely sensitive to variations in precipitation and temperature. Over time, uranium trapped in speleothems turns into thorium, allowing scientists to date the speleothem deposits.
Weiss and the research team synchronized these findings with archaeological and cuneiform records and were able to document the first paleoclimate data for the megadrought that affected the Assyrian heartland at the time of the empire's collapse, when its less drought-affected neighbors invaded. The team's research also revealed that this megadrought followed a high-rainfall period that facilitated the Assyrian empire's earlier growth and expansion.
"Now we have a historical and environmental dynamic between north and south and between rain-fed agriculture and irrigation-fed agriculture through which we can understand the historical process of how the Babylonians were able to defeat the Assyrians," said Weiss, adding that the total collapse of Assyria is still described by historians as the "mother of all catastrophes."
Through the archaeology and history of the region, Weiss was able to piece together how the megadrought data were synchronous with Assyria's cessation of long-distance military campaigns and the construction of irrigation canals that were similar to its southern neighbors but restricted in their agricultural extent. Other texts noted that the Assyrians were worrying about their alliances with distant places, while also fearing internal intrigue, notes Weiss.
"This fits into a historical pattern that is not only structured through time and space, but a time and space that is filled with environmental change," says Weiss. "These societies experienced climatic changes that were of such magnitude they could not simply adapt to them," he adds.
With these new speleothem records, says Weiss, paleoclimatologists and archaeologists are now able to identify environmental changes in the global historical record that were unknown and inaccessible even 25 years ago. "History is no longer two-dimensional; the historical stage is now three-dimensional," said Weiss.
Weiss' previous research defined the 2200 B.C.E. global megadrought that generated societal collapse from the Mediterranean to China.
In addition to Weiss, researchers from California State University-Dominguez Hills, Xi'an Jiaotong University, University of Minnesota, University of Colorado-Boulder, University of Illinois-Chicago, University of Ankara, and University of Southern California contributed to the study.
make a difference: sponsored opportunity
Story Source:
Materials provided by Yale University.
Note: Content may be edited for style and length.
Journal Reference:
- Ashish Sinha, Gayatri Kathayat, Harvey Weiss, Hanying Li, Hai Cheng, Justin Reuter, Adam W. Schneider, Max Berkelhammer, Selim F. Adalı, Lowell D. Stott, R. Lawrence Edwards. Role of climate in the rise and fall of the Neo-Assyrian Empire. Science Advances, 2019; 5 (11): eaax6656 DOI: 10.1126/sciadv.aax6656
Cite This Page:
| MLA | Yale University. "Megadrought likely triggered the fall of the Assyrian Empire." ScienceDaily. ScienceDaily, 14 November 2019. <www.sciencedaily.com/releases/2019/11/191114115951.htm>. |
| APA | Yale University. (2019, November 14). Megadrought likely triggered the fall of the Assyrian Empire. ScienceDaily. Retrieved November 16, 2019 from www.sciencedaily.com/releases/2019/11/191114115951.htm |
| Chicago | Yale University. "Megadrought likely triggered the fall of the Assyrian Empire." ScienceDaily. www.sciencedaily.com/releases/2019/11/191114115951.htm (accessed November 16, 2019). |


This sample shows a basic Viewer displaying a document with two elements in it. The elements are black squares.
Because it is a Viewer, the shapes are not editable or movable. You are actually moving the view, not the shapes.
By default a Viewer can be dragged to move and shift-dragged (or dragged with two fingers) to zoom, but cannot be rotated.


statsmodels.nonparametric.kernel_regression.KernelReg¶
-
class
statsmodels.nonparametric.kernel_regression.
KernelReg
(endog, exog, var_type, reg_type='ll', bw='cv_ls', defaults=None)[source]¶ Nonparametric kernel regression class.
Calculates the conditional mean
E[y|X]
wherey = g(X) + e
. Note that the “local constant” type of regression provided here is also known as Nadaraya-Watson kernel regression; “local linear” is an extension of that which suffers less from bias issues at the edge of the support.- Parameters
- endog: array-like
This is the dependent variable.
- exog: array-like
The training data for the independent variable(s) Each element in the list is a separate variable
- var_type: str
The type of the variables, one character per variable:
c: continuous
u: unordered (discrete)
o: ordered (discrete)
- reg_type: {‘lc’, ‘ll’}, optional
Type of regression estimator. ‘lc’ means local constant and ‘ll’ local Linear estimator. Default is ‘ll’
- bw: str or array_like, optional
Either a user-specified bandwidth or the method for bandwidth selection. If a string, valid values are ‘cv_ls’ (least-squares cross-validation) and ‘aic’ (AIC Hurvich bandwidth estimation). Default is ‘cv_ls’. User specified bandwidth must have as many entries as the number of variables.
- defaults: EstimatorSettings instance, optional
The default values for the efficient bandwidth estimation.
- Attributes
- bw: array_like
The bandwidth parameters.
Methods
aic_hurvich
(bw[, func])Computes the AIC Hurvich criteria for the estimation of the bandwidth.
cv_loo
(bw, func)The cross-validation function with leave-one-out estimator.
fit
([data_predict])Returns the mean and marginal effects at the data_predict points.
Returns the R-Squared for the nonparametric regression.
sig_test
(var_pos[, nboot, nested_res, pivot])Significance test for the variables in the regression.
loo_likelihood


Contents
- Installation
- Getting Started
- Comments
- Productions
- Global Code
- Terminals
- Strings
- Regular Expressions
- Naming tokens
- External (C) scanners
- Tokenizers
- Longest Match
- Priorities and Associativity
- Token Priorities
- Operator Priorities
- Rule Priorities
- Actions
- Speculative Actions
- Final Actions
- Embedded
- Pass Actions
- Default Actions
- Attributes and Action Specifiers
- Global State
- Parse Nodes
- Misc
- Symbol Table
- Whitespace
- Ambiguities
- Error Recovery
- Parsing Options
- Grammar Grammar
1. Installation
To build:
'gmake'
(only available with source code package)
To test: 'gmake
test' (only
available with source code package)
To install, 'gmake install' (binary or source code
packages)
2. Getting Started
2.1. Create your grammar, for example, in the file "my.g":
E: E '+' E | "[abc]";
2.2. Convert grammar into parsing tables:
% make_dparser my.g
2.3. Create a driver program, for example, in the file
"my.c":
#include <stdio.h>
#include <dparse.h>
extern D_ParserTables parser_tables_gram;
int
main(int argc, char *argv[]) {
char s[256], *ss;
D_Parser *p = new_D_Parser(&parser_tables_gram, 0);
if (fgets(s,255,stdin) && dparse(p, s, strlen(s))
&& !p->syntax_errors)
printf("success\n");
else
printf("failure\n");
}
2.4. Compile:
% cc -I/usr/local/include my.c my.g.d_parser.c -L/usr/local/lib
-ldparse
2.5. Run:
% a.out
a=
syntax error, '' line 1
failure
%
% a.out
a+b
success
%
We'll come back to this example later.
3. Comments
Grammars can include C/C++ style comments.
EXAMPLE
// My first grammar
E: E '+' E | "[abc]";
/* is this right? */
4. Productions
4.1. The first production is the root of your grammar (what you
will be trying to parse).
4.2. Productions start with the non-terminal being defined
followed by a colon ':', a set of right hand sides seperated by '|'
(or)
consisting of elements (non-terminals or terminals).
4.3. Elements can be grouped with parens '(', and the normal
regular expression symbols can be used ('+' '*' '?' '|').
EXAMPLE
program: statements+ | comment* (function | procedure)?;
4.4.
NOTE: Instead of
using '[' ']' for optional elements we use the more familar and
consistent '?' operator. The square brackets are reserved for
speculative actions (below).
5. Global Code
Global (or static) C code can be intermixed with productions by
surrounding the code with brackets '{'.
EXAMPLE
{ void dr_s() { printf("Dr. S\n"); }
S: 'the' 'cat' 'and' 'the' 'hat' { dr_s(); } | T;
{ void twain() { printf("Mark Twain\n"); }
T: 'Huck' 'Finn' { twain(); };
6. Terminals
6.1. Strings terminals are surrounded with single quotes.
For example:
block: '{' statements* '}';
whileblock: 'while' '(' expression ')' block;
6.2. Regular expressions are surrounded with double quotes.
For example:
hexint: "(0x|0X)[0-9a-fA-F]+[uUlL]?";
NOTE: only the simple
regular expression operators are currently supported (v1.3). This
include parens, square parens, ranges, and '*', '+', '?'. If you
need something more, request a feature or implement it yourself; the
code is in scan.c.
6.3 Terminal modifiers
Terminals can contain embbed escape codes. Including the
standard C escape codes, the codes \x and \d permit inserting hex and
decimal ASCII characters directly.
Tokens can be given a name by appending the $name option.
This is useful when you have several
tokens which which represent the same string (e.g.
','). For example,
function_call: function '(' parameter (
',' $name 'parameter_comma' parameter) ')';
It is now possible to use $0.symbol == ${string parameter_comma}
to differentiate ParseNode ($0) between
a parameter comma node and say an initialization comma.
Terminals ending in '/i' are case insensitive.
For example 'hi'/i matches 'HI', 'Hi' and "hI' in addition to 'hi'.
6.3. External (C) Scanners
There are two types of external scanners, those which read a
single terminal, and those which are global (called for every
terminal).
Here is an example of a scanner for a single terminal.
Notice how it can be mixed with regular string terminals.
{
extern char *ops;
extern void *ops_cache;
int ops_scan(char *ops, void *ops_cache, char **as,
int *col, int *line, unsigned short *op_assoc, int
*op_priority);
}
X: '1' (${scan ops_scan(ops, ops_cache)} '2')*;
The user provides the 'ops_scan' function. This example is
from tests/g4.test.g in the source distribution.
The second type of scanner is a global scanner:
{
#include "g7.test.g.d_parser.h"
int myscanner(char **s, int *col, int *line, unsigned short *symbol,
int *term_priority, unsigned short
*op_assoc, int *op_priority)
{
if (**s == 'a') {
(*s)++;
*symbol = A;
return 1;
} else if (**s == 'b') {
(*s)++;
*symbol = BB;
return 1;
} else if (**s == 'c') {
(*s)++;
*symbol = CCC;
return 1;
} else if (**s == 'd') {
(*s)++;
*symbol = DDDD;
return 1;
} else
return 0;
}
${scanner myscanner}
${token A BB CCC DDDD}
S: A (BB CCC)+ SS;
SS: DDDD;
Notice how the you need to include the header file generated by
make_dparser which contains the
token
definitions.
6.4. Tokenizers
Tokenizers are non-context sensitive global scanners which
produce only one token for any given input string. Some
programming languages (for example
C)
are easier to specify using a tokenizer because (for example) reserved
words can be handled simply by lowering the terminal priority for
identifiers.
EXAMPLE:
S : 'if' '(' S ')' S ';' | 'do' S 'while' '(' S ')' ';' | ident;
ident: "[a-z]+" $term -1;
The sentence:
if ( while ) a;
is legal because
while cannot
appear at the start of
S and
so
it doesn't conflict with the parsing of
while
as an
ident in that position.
However, if a tokenizer is specified, all tokens will be possible
at each position and the sentense will produce a syntax error.
DParser provides two
ways to specify tokenizers: globally as an option (-T) to
make_dparser and locally with a
${declare tokenize ...} specifier (see the ANSI C grammar for an
example). The ${declare tokenize ...} declartion allows a
tokenizer to be specified over a subset of the parsing states so that
(for example) ANSI C could be a subgrammar of another larger grammar.
Currently the parse states are not split so that the productions
for the substates must be disjoint.
6.5 Longest Match
Longest match lexical ambiguity resolution is a technique used
by seperate phase lexers to help decide (along
with lexical priorities) which single token to select for a given input
string. It is used in the definition of ANSI-C, but not in C++
because of a snafu in the definition of templates whereby templates of
templates (List<List <Int>>) can end with the right shift
token ('>>"). Since
DParser
does not have a seperate lexical phase, it does not require longest
match disambiguation, but provides it as an option.
There are two ways to specify longest match disabiguation:
globally as an option (-l) to
make_dparser
or locally with with a ${declare ... longest_match}. If global
longest match disambiguation is
ON,
it can be locally disabled with {$declare ... all_matches} . As
with Tokenizers above, local declarations operate on disjoint subsets
of
parsing states.
7. Priorities and Associativity
Priorities can very from MININT to MAXINT and are
specified as integers. Associativity can take the values:
assoc : '$unary_op_right' | '$unary_op_left' | '$binary_op_right'
|
'$binary_op_left' | '$unary_right' | '$unary_left'
|
'$binary_right' | '$binary_left' | '$right' | '$left' ;
7.1. Token Prioritites
Termininal priorities apply after the set of matching strings
has
been found and the terminal(s) with the highest priority is selected.
Terminal priorities are introduced after a terminal by the specifier
$term. We saw an example of
token priorities with the definition of
ident.
EXAMPLE:
S : 'if' '(' S ')' S ';' | 'do' S 'while' '(' S ')' ';' | ident;
ident: "[a-z]+" $term -1;
7.2. Operator Priorities
Operator priorities specify the priority of a operator symbol
(either a terminal or a non-terminal). This corresponds to the
yacc or
bison %left etc. declaration.
However, since
DParser
is
doesn't require a global tokenizer, operator priorities and
associativities are specified on the reduction which creates the token.
Moreover, the associativity includes the operator usage as well
since it cannot be infered from rule context. Possible operator
associativies are:
operator_assoc : '$unary_op_right' | '$unary_op_left' |
'$binary_op_right'
|
'$binary_op_left' | '$unary_right' | '$unary_left'
|
'$binary_right' | '$binary_left';
EXAMPLE:
E: ident op ident;
ident: '[a-z]+';
op: '*' $binary_op_left 2 |
'+' $binary_op_left 1;
7.3. Rule Priorities
Rule priorities specify the priority of the reduction itself and
have the possible associativies:
rule_assoc: '$right' | '$left';
Rule and operator priorities can be intermixed and are
interpreted at run time (
not
when
the tables are built). This make it possible for user-defined
scanners to return the associativities and priorities of tokens.
8. Actions
Actions are the bits of code which run when a reduction
occurs.
EXAMPLE
S: this | that;
this: 'this' { printf("got this\n"); };
that: 'that' { printf("got that\n"); };
8.1 Speculative Action
Speculative actions occur when the reduction takes place during
the speculative parsing process. It is possible
that the reduction will not be part of the final parse or that it will
occur a different number of times. For example:
S: this | that;
this: hi 'mom';
that: ho 'dad';
ho: 'hello' [ printf("ho\n"); ];
hi: 'hello' [ printf("hi\n"); ];
Will print both 'hi' and 'ho' when given the input 'hello dad' because
at the time hello is reduced, the following token is not known.
8.2 Final Actions
Final actions occur only when the reduction must be part of any
legal final parse (committed). It is possible to do final actions
during parsing or delay them till the entire parse tree is constructed
(see Options). Final actions are executed in order and in number
according the the single final unambiguous parse.
S: A S 'b' | 'x';
A: [ printf("speculative e-reduce A\n"); ]
{ printf("final e-reduce A\n"); };
On input:
xbbb
Will produce:
speculative e-reduce A
final e-reduce A
final e-reduce A
final e-reduce A
8.3 Embedded Actions
Actions can be embedded into rule. These actions are executed
as if they were replaced with a synthetic production with a single null
rule containing the actions. For example:
S: A { printf("X"); } B;
A: 'a' { printf("a"); };
B: 'b' { printf("b"); };
On input:
ab
Will produce:
aXb
8.4 Pass Actions
DParser supports
multiple pass compilation. The passes are declared at the top of
the grammar, and the actions are associated with individual rules.
EXAMPLE
${pass sym for_all postorder}
${pass gen for_all postorder}
translation_unit: statement*;
statement
: expression ';' {
d_pass(${parser}, &$n, ${pass sym});
d_pass(${parser}, &$n, ${pass gen});
}
;
expression : integer
gen: { printf("gen integer\n"); }
sym: { printf("sym integer\n"); }
| expression '+' expression $right 2
sym: { printf("sym +\n"); }
;
A pass name then a colon indicate that the following action is
associated with a particular pass. Passes can be either
for_all or
for_undefined (which means that the
automatic traversal only applies to rules without actions defined for
this pass). Furthermore, passes can be
postorder,
preorder, and
manual (you have to call
d_pass yourself). Passes can
be initiated in the final action of any rule.
8.5 Default Actions
The special production "
_"
can be defined with a single rule whose actions become the default when
no other action is specified. Default actions can be specified
for speculative, final and pass actions and apply to each seperately.
EXAMPLE
_: { printf("final action"); }
gen: { printf("default gen action"); }
sym: { printf("default sym action"); }
;
9. Attributes and Action Specifiers
9.1. Global State (
$g)
Global state is declared by
define'ing
D_ParseNodeGlobals (see the ANSI C
grammar for a similar declaration for symbols). Global state can be
accessed in any action with
$g.
Because
DParser handles
ambiguous parsing global state can be accessed on different speculative
parses. In the future automatic splitting of global state may be
implemented (if there is demand). Currently, the global state can be
copied and assigned to
$g to
ensure that the changes made only effect subsequent speculative parses
derived from the particular parse.
EXAMPLE
[ $g = copy_globals($g);
$g->my_variable = 1;
]
The symbol table (Section 10) can be used to manage state
information safely for different speculative parses.
9.2. Parse Node State
Each parse node includes a set of system state variables and can
have a set of user-defined state variables. User defined parse
node state is declared by
define'ing
D_ParseNodeUser. Parse node
state is accessed with:
$# - number of child nodes
$$ - user parse node
state
for parent node (non-terminal defined by the production)
$X (where X is a number)
-
the user parse node state of element X of the production
$nX - the system parse
node state of element X of the production
The system parse node state is defined in
dparse.h which is installed with
DParser. It contains such
information as the symbol, the location of the parsed string, and
pointers to the start and end of the parsed string.
9.3. Misc
${scope} - the current
symbol table scope
${reject} - in
speculative actions permits the current parse to be rejected
10. Symbol Table
The symbol table can be
updated down different speculative paths while sharing the bulk of the
data. It defines the following functions in the file (dsymtab.h):
struct D_Scope *new_D_Scope(struct D_Scope *st);
struct D_Scope *enter_D_Scope(struct D_Scope *current, struct D_Scope
*scope);
D_Sym *NEW_D_SYM(struct D_Scope *st, char *name, char *end);
D_Sym *find_D_Sym(struct D_Scope *st, char *name, char *end);
D_Sym *UPDATE_D_SYM(struct D_Scope *st, D_Sym *sym);
D_Sym *current_D_Sym(struct D_Scope *st, D_Sym *sym);
D_Sym *find_D_Sym_in_Scope(struct D_Scope *st, char *name, char *end);
'new_D_Scope' creates a new scope below 'st' or NULL for a 'top level'
scope. 'enter_D_Scope' returns to a previous scoping level.
NOTE: do not simply assign ${scope} to a previous scope as any updated
symbol information will be lost. 'commit_D_Scope' can be used in
final actions to compress the update list for the top level scope and
improve efficiency.
'find_D_Sym' finds the most current version of a symbol in a given
scope. 'UPDATE_D_SYM' updates the value of symbol (creates a
difference record on the current speculative parse path).
'current_D_Sym' is used to retrive the current version of a symbol, the
pointer to which may have been stored in some other attribute or
variable. Symbols with the same name should not be created in the
same scope. The function 'find_D_Sym_in_Scope' is provided to
detect this case.
User data can be attached to symbols by
define'ing
D_UserSym. See the ANSI C
grammar for an example.
Here is a full example of scope usage (from tests/g29.test.g):
#include <stdio.h>
typedef struct My_Sym {
int value;
} My_Sym;
#define D_UserSym My_Sym
typedef struct My_ParseNode {
int value;
struct D_Scope *scope;
} My_ParseNode;
#define D_ParseNode_User My_ParseNode
}
translation_unit: statement*;
statement
: expression ';'
{ printf("%d\n", $0.value); }
| '{' new_scope statement* '}'
[ ${scope} = enter_D_Scope(${scope}, $n0.scope); ]
{ ${scope} = commit_D_Scope(${scope}); }
;
new_scope: [ ${scope} = new_D_Scope(${scope}); ];
expression
: identifier ':' expression
[
D_Sym *s;
if (find_D_Sym_in_Scope(${scope}, $n0.start_loc.s,
$n0.end))
printf("duplicate identifier line %d\n",
$n0.start_loc.line);
s = NEW_D_SYM(${scope}, $n0.start_loc.s, $n0.end);
s->user.value = $2.value;
$$.value = s->user.value;
]
| identifier '=' expression
[ D_Sym *s = find_D_Sym(${scope}, $n0.start_loc.s, $n0.end);
s = UPDATE_D_SYM(${scope}, s);
s->user.value = $2.value;
$$.value = s->user.value;
]
| integer
[ $$.value = atoi($n0.start_loc.s); ]
| identifier
[ D_Sym *s = find_D_Sym(${scope}, $n0.start_loc.s, $n0.end);
if (s)
$$.value = s->user.value;
]
| expression '+' expression
[ $$.value = $0.value + $1.value; ]
;
integer: "-?([0-9]|0(x|X))[0-9]*(u|U|b|B|w|W|L|l)*" $term -1;
identifier: "[a-zA-Z_][a-zA-Z_0-9]*";
11. Whitespace
Whitespace can be specified two ways: C function which can be
user-defined, or as a subgrammar. The default whitespace parser
is
compatible with C/C++ #line directives and comments. It can be
replaced with any user specified function as a parsing option (see
Options).
Additionally, if the (optionally) reserved production
whitespace is defined, the
subgrammar
it defines will be used to consume whitespace for the main grammar.
This subgrammar can include normal actions.
EXAMPLE
S: 'a' 'b' 'c';
whitespace: "[ \t\n]*";
Whitespace can be accessed on a per parse node basis using the
functions:
d_ws_before and
d_ws_after, which return the start
of the whitespace before
start_loc.s
and after
end respectively.
12. Ambiguities
Ambiguities are resolved automatically based on priorities and
associativities. In addition, when the other resolution
techniques
fail, user defined ambiguity resolution is possible. The default
ambiguity handler produces a fatal error on an unresolved
ambiguity. This behavior can be replaced with a user defined
resolvers the signature of which is provided in
dparse.h.
If the
verbose_level
flag is set, the default ambiguity handler will print out parenthesized
versions of the ambiguous parse trees. This may be of some
assistence in disambiguating a grammar.
13. Error Recovery
DParser implements an error recovery scheme appropriate
to
scannerless parsers. I haven't had time to investigate all the
prior work in this area, so I am not sure if it is novel. Suffice
for now that it is optional and works well with C/C++ like grammars.
14. Parsing Options
Parser are instantiated with the function
new_D_Parser. The resulting data
structure contains a number of user configurable options (see
dparser.h). These are provided
reasonable default values and include:
- initial_globals - the
initial global variables accessable through $g
- initial_skip_space_fn - the initial
whitespace function
- initial_scope - the initial symbol
table scope
- syntax_error_fn - the function
called
on a syntax error
- ambiguity_fn - the
function called on an unresolved ambiguity
- loc - the initial
location
(set on an error).
In addtion, there are the following user configurables:
- sizeof_user_parse_node -
the sizeof D_ParseNodeUser
- save_parse_tree - whether
or not the parse tree should be save once the final actions have been
executed
- dont_fixup_internal_productions - to
not convert the Kleene star into a variable number of children from a
tree of reductions
- dont_merge_epsilon_trees
-
to not automatically remove ambiguities which result from trees of
epsilon reductions without actions
- dont_use_eagerness_for_disambiguation
- do not use the rule that the longest parse which reduces to the same
token should be used to disambiguate parses. This rule is used to
handle the case (if then else?)
relatively cleanly.
- dont_use_height_for_disambiguation
- do not use the rule that the least deep parse which reduces to the
same token should be used to disabiguate parses. This rule is
used
to handle recursive grammars relatiively cleanly.
- dont_compare_stacks -
disables comparing stacks to handle certain exponential cases during
ambiguous operator priority resolution. This feature is
relatively
new, and this disables the new code.
- commit_actions_interval -
how often to commit final actions (0 is immediate, MAXINT is
essentially
not till the end of parsing)
- error_recovery - whether or not to
use error recovery (defaults ON)
An the following result values:
- syntax_errors - how many
syntax errors (if error_recovery
was on)
This final value should be checked to see if parse was successful.
15. Grammar Grammar
DParser is fully
self-hosted (would you trust a parser generator which wasn't?).
The grammar grammar is
here (Grammar Grammar).


CodeMeetup brings coders together by pair programming!
You can read more about pair programming HERE!


Test page
{% include "showicons.html" %} {% staticall %}Some images
Benefits of django-static
- Uses slimmer
- Full control over your static serving
- Rewrites urls in .css files for static serving
- Uses symbolic links to make it easy to set up aggressive caching in fronting web server (e.g. nginx)


Cello may have been the first publicly released browser to default to dark text on a light but warmer yellow background. I could not find any reading on this (or the browser in general), especially since the browser was poorly made/maintained, and not in use for very long. However, the mere mention of this in class, ignited my curiosity in how we’ve grown to understand the effects of screen color warmth, what’s been done in response, and what could be on the horizon. Hopefully, throughout this essay I can make concepts from existing vision science literature more accessible.
Disclaimer, staring at the sun or a clear blue sky is far worse for your retinas than looking at screens at night, however, using blue light screens at night will be worse for your sleep schedule and quality.
Color warmth (on a color wheel) is what we tend to think of as warmth from a design perspective. In fig. 1. (https://www.mgxcopy.com/mindshare/wp-content/uploads/2015/05/2000px-BYR_color_wheel.svg_.png), colors to the left of center are cold, while colors to the right are warm. This design knowledge will be unintuitive in the context of this essay, so put this concept aside for now.
Color temperature (measured in Kelvin) is the measurement of how intense/hot a light source is. For instance, the sun/a clear blue sky is the most powerful light source we can measure, clocking in around 15-27 thousand Kelvin, whereas candle light, which is one of the coolest light sources we can measure, clocks in at a much lower 1.7 thousand Kelvin see fig. 2. (https://en.wikipedia.org/wiki/Color_temperature#Categorizing_different_lighting). This definition is what I will be referring to throughout this essay.
A person’s Circadian Rhythm is essentially their internal clock, which dictates when the body should be awake or asleep. This cycle tends to line up with 24 hour day cycles. Staying up very late would be one example of interfering with/delaying this cycle. This process is regulated by the body’s production of melatonin. I will explore this further.
This discovery is only about twenty years old, but since then vision science literature has exploded with research on the topic – adding further confirmations to the original concept, further expanding on a variety health detriments ranging from obesity to cancer, and comparing different lighting or temporal scenarios. But don’t believe me, the creators of f.lux have curated a list of over 50 articles (up until 2016) pertaining to just about every angle of the topic (f.lux, 2016).
In fig. 3, a light frequency spectrum from fluxometer shows us a breakdown of a high intensity light – what humans would perceive as pure white daylight. Notice the subtle grey bell curve around 480nm near the blue area on the left of the graph. All light within this bell curve is known colloquially as “blue light”, due to its midpoint situated comfortably within the blue frequencies. Note how it actually includes some violet and many of the green frequencies as well. This band of light can be harmful because it interferes with the body’s circadian rhythm, especially when perceived during non-daylight hours (Morita et al., 1996).
Our eyes have photoreceptors called ipRGC’s which specifically target this band of blue light. These ipRGC’s are home to the melanopsin photopigment, which is a key mediator in the body’s melatonin production. When we view light frequencies within the blue light band, melanopsin will suppress melatonin production, effectually delaying the body’s circadian rhythm. Existing literature commonly refers to this result as a circadian phase shift. In layman’s terms, if you look at a bright light very late in the evening, your body might want to go to bed an hour later and wake up an hour later, shifting your whole sleep schedule back an hour (Berson et al., 2002).
What’s so bad about this?
One of the most often cited papers in this field reports that using light emitting screens (they studied e-readers specifically) before bedtime resulted in people taking longer to fall asleep and experiencing less REM sleep (they had poorer quality sleep), leading to the aforementioned circadian phase shift, which caused more drowsiness the following morning and longer to fully “wake up” (Chang et al., 2015). A later study, abstracted this idea by subjecting people to intermittent bright pulses of light, and had similar findings in terms of effects on sleep and alertness (Gronfier et al., 2004).
In 2009 a computer software application called f.lux was created to reduce the negative effects of using screens at night. f.lux mimics the cycle of a 24 hour day, using location based sunrise/sunset times to match the color temperature of a screen, to that of the ambient color temperature outside. LCD/computer screens tend to be 50-60% as bright as daylight, but to our eyes, this is a close approximation, which is still very hot. The program uses a blue light filter to reduce the amount of blue light, to achieve the proper color temperature. Very late at night (while we should be asleep!) f.lux will lower the color temperature to roughly 2% of natural daylight. This results in a reduced impact on our eyes and sleep patterns, than traditional screen usage at night (fluxometer, 2016) (f.lux, 2016).
The biggest problem with this will be obvious to anyone who already uses f.lux or similar software (such as Apple Night Shift – which is awful in comparison): reducing the color temperature of our screens has a very destructive effect on the output color frequency spectrum. Once the blues (and greens) are gone, everything looks orange. It is difficult to use interfaces which rely on color luminance – especially for contrast, and images just look bad. However, there could be an applicable solution coming soon.
A 2016 study began with this problem and claimed to have found a solution which is the best of both worlds: screen color temperature which is not harmful to the eye and completely orange. Rather than simply compressing the blue light frequencies as f.lux does, this study was able to convincingly reconstruct images on a computer screen through spectral re-synthesis using colors as far outside of the melanopic blue light band as possible.
Their testing used a proof-of-concept Matlab program to convert 2mb images at about 20 frames per second, however, if this technology passes further testing and undergoes significant optimization, it is within reason that in the next few years this could be incorporated into to f.lux or a new software to replace it (Shih et al., 2016).
Use a blue light blocker, if you're planning to work late. Please don't use Apple Night Shift.


Before Change
sounds_qs = Sound.objects.bulk_query_solr(where, order_by, slice_size, (i, ))
add_sounds_to_solr(sounds_qs)
except SolrException as e:
console_logger.error("failed to add sound batch to solr index, reason: %s", str(e))
raise
// Get all sounds that should not be in solr and remove them if they are
sound_qs = Sound.objects.exclude(processing_state="OK", moderation_state="OK")
After Change
def handle(self, *args, **options):
// Get all sounds moderated and processed ok
sounds_to_index = Sound.objects.filter(processing_state="OK", moderation_state="OK")
console_logger.info("Reindexing %d sounds to solr", sounds_to_index.count())
add_all_sounds_to_solr(sounds_to_index)


Administrator Page
---Create, Delete, or View Tasks---
Task ID
Message:
To Number:
Time Stamp
#
Task ID
Message
To Number
Time


Third-Party Resources
A collection of third-party software projects that integrate with SITE_NAME.
Please submit additions and corrections
on GitHub.
Deployment Tools
API Wrappers
- jwulf/healthchecks.io – API wrapper in Javascript. Supports pinging.
- MyPropertyOffice/node-hchk – API wrapper in Javascript. Supports listing, creating, updating, deleting, pausing and pinging checks. Supports listing integrations.
- gyde-tv/checks – API wrapper in Ruby. Supports pinging.
- kristofferahl/go-healthchecksio – API wrapper in Go. Supports listing, creating, updating, deleting, pausing, pinging.
- frozzare/go-healthchecks – API wrapper in Go. Supports pinging and failing.
- healthchecks/hchk – API wrapper & CLI in Python. Supports creating, pinging.
- crontask.sh – bash wrapper to use in crontab. Supports pinging.
- SmartCronHelper – A cron shell wrapper. Automatically registers and pings cron jobs listed in crontab.
- davehope/HealthChecksIOStatusReport – PowerShell module. Supports pinging.
Plugins & Integrations
Other
- HealthTray – Watch your healthchecks in Windows system tray.
- healthchecks/dashboard – A standalone HTML page showing the status of the checks in your account.
- runitor - A command runner with Healthchecks.io integration to keep your scripts and containers simple.


Idly sambar
INGREDIENTS
- Split pigeon peas (tuvar dal/arhar dal) soaked 1/2 cup
- Turmeric powder 1/4 cup
- Oil 4 tablespoons
- Tamarind 1 lemon sized ball
- Mustard seeds 1/2 teaspoon
- Whole dry red chillies broken 4
- Fenugreek seeds (methi dana) 1/2 teaspoon
- Asafoetida 1/4 teaspoon
- Green chillies slit 4
- Curry leaves 10-12
- Drumsticks 2½ inch pieces 2
- Sambhar powder 1 1/2 teaspoon
- Salt to taste
PROCEDURE
-
Pressure-cook the dal in two and half cups of water with turmeric powder and one teaspoon oil for three whistles. Open lid once the pressure has reduced. Mash the cooked dal lightly with a wooden spoon.
- Soak tamarind in one-cup warm water, extract pulp and set aside.
- Heat the remaining oil in a thick-bottomed pan. Add mustard seeds. When they splutter add dry red chillies, fenugreek seeds and asafoetida.
- Stir and add green chillies, curry leaves and drumsticks and cook for one minute on medium heat stirring briefly.
- Add sambhar powder, salt and one cup water.
- Reduce heat and simmer for six to eight minutes or till drumsticks are cooked. Add tamarind pulp, boiled dal and simmer for two to three minutes.
-
Serve hot with steamed rice.


In the generalized Roy model, the marginal treatment effect (MTE) can be used as a building block for constructing conventional causal parameters such as the average treatment effect (ATE) and the average treatment effect on the treated (ATT) (Heckman, Urzua, and Vytlacil 2006 <doi:10.1162/rest.88.3.389>). Given a treatment selection model and an outcome model, the function mte() estimates the MTE via local instrumental variables (or via a normal selection model) and also the projection of MTE onto the 2-dimensional space of the propensity score and a latent variable representing unobserved resistance to treatment (Zhou and Xie 2018 <https://scholar.harvard.edu/files/xzhou/files/zhou-xie_mte2.pdf>). The object returned by mte() can be used to estimate conventional parameters such as ATE and ATT (via average()) or marginal policy-relevant treatment effects (via mprte()).
| Version: | 0.1.0 |
| Depends: | R (≥ 3.3.0) |
| Imports: | KernSmooth (≥ 2.5.0), mgcv (≥ 1.8-19), sampleSelection (≥ 1.2-0), stats |
| Published: | 2018-08-05 |
| Author: | Xiang Zhou [aut, cre] |
| Maintainer: | Xiang Zhou <xiang_zhou at fas.harvard.edu> |
| BugReports: | https://github.com/xiangzhou09/localIV |
| License: | GPL (≥ 3) |
| URL: | https://github.com/xiangzhou09/localIV |
| NeedsCompilation: | no |
| CRAN checks: | localIV results |
| Reference manual: | localIV.pdf |
| Package source: | localIV_0.1.0.tar.gz |
| Windows binaries: | r-devel: localIV_0.1.0.zip, r-release: localIV_0.1.0.zip, r-oldrel: localIV_0.1.0.zip |
| OS X binaries: | r-release: localIV_0.1.0.tgz, r-oldrel: localIV_0.1.0.tgz |
Please use the canonical form https://CRAN.R-project.org/package=localIV to link to this page.


What's PaymentBridge?
PaymentBridge is a tool that allows Bitcoin Cash and Bitcoin users who don't have a Payment Protocol compatible wallet to pay BitPay invoices. You just have to paste the Payment Protocol link and use your Bitcoin ABC / BU / XT (other wallets won't work!!!). After this tool shows
you the address and the amount, a transaction should be made (but not broadcast!) and should be pasted in this tool, to complete the purchase. The payment can be cancelled in any step. It's safe to use this tool, in the worst case, you'll likely get a refund from BitPay.
This tool is no way made in affiliation with or endorsed by BitPay.
Everything is done on your device, except the use of BitPay's servers.


{% extends "base.html" %} {% load static %} {% block main %}
Troupon is a marketing service that offers its subscribers daily discount coupons. Typical Troupon deals focus on local restaurants, stores, services, events and regional products. Today, there are zero million registered Groupon users worldwide.
Troupon is a global e-commerce marketplace connecting millions of subscribers with local merchants by offering activities, travel, goods and services in more than 45 countries. Troupon was launched in November 2015, and the first market for Troupon was Lagos, followed soon thereafter by Aba, Port Harcourt and Abuja.


"<!--
" is a line comment (same as "//
").
In JScript, the following are ignored if they are at the end of the script (i.e., just followed by whitespace lines):
Either:
-->
" followed by
anything except new lines and finally followed by another "-->
"; or-->
"."-->
" at the end of the last line of the script causes
the line to be ignored unless the "-->
" occurs within a
comment. The last non-whitespace line of the script is ignored if it ends
with "-->
" and doesn't contain "//
" or
"<!--
" (but not in eval
).
In SpiderMonkey, "-->
" on any line that starts with just
whitespace and comments is treated as a line comment (same as
//
). (Also, ;version=1.6, 1.7 or 1.8
or
1;e4x=1
enables E4X "<!-- -->
" comments.)
In Carakan, Nitro and V8, "-->
" on any line that starts
with just whitespace (but not comments) is treated as a line comment (same
as "//
").
See also http://wiki.whatwg.org/wiki/Web_ECMAScript#HTML_comments


 Or experience again? How about wanting to create a world that not only you would enjoy but others as well? Is your imagination on the verge of breaking free but is bound by the rules of reality? Then look no further than our Virtual Seed of Creation.
There's no limit to your imagination
With the Virtual Seed of Creation -- VSOC -- you can experience the worlds of others, or create worlds of your own. What you can imagine, you can create. Whether it's just a world filled with nothing but the night sky, or a vast mmo that spans over an entire planet, there's no limit. The only limit is your imagination.


{% extends 'home/base.html' %} {% load humanize %} {% load staticfiles %} {% load performance_extras %} {% load progress_extras %} {% load i18n %} {% block content %}
| District | # Health Centers to Mop-up | {{ spray_areas_to_mopup_label }} | {{ structures_to_mopup_90_label }} | TLA days needed for areas needed to reach 90% |
|---|---|---|---|---|
| {{ location.name }} | {{ location.health_centers_to_mopup }} | {{ location.spray_areas_to_mopup }} | {{ location.structures_to_mopup }} | {{ location.mopup_days_needed|mopup_days_needed }} |
| Total | {{ totals.health_centers_to_mopup }} | {{ totals.spray_areas_to_mopup }} | {{ totals.structures_to_mopup }} | {{ totals.mopup_days_needed|mopup_days_needed }} |
* These estimates are based on only those catchments that have already been visited.
* To sort a column, click on the column name
{% include 'definitions-and-conditions.html' %}


FontComposition
public struct FontComposition : Hashable
Contains information about font used in DeckView
.
This should always be used with one of the initializers.
The default values are as follows:
- fontName: systemFontName (Depending on the iOS version this is either
SanFrancisco
orHelvetica
) - fontColor: #0c1e3d
- fontSize: 12
-
The
UIFont
object is combined with the parameters from the initializers.Note: If the font is not found, parameters will be reset to the the default font and default font size 12
Declaration
Swift
public var font: UIFont { get }
-
Will initialize
FontComposition
with all available parameters.Declaration
Swift
public init(name: String, color: UIColor, size: CGFloat)
Parameters
name
The name of the font. When the custom font is used, make sure that the font name matches the overall style.
color
font color
size
font size
-
Will initialize
FontComposition
only usingname
andsize
. As color is not part of these parameters, the default color will be used.Declaration
Swift
public init(name: String, size: CGFloat)
Parameters
name
The name of the font. When the custom font is used, make sure that the font name matches the overall style.
size
font size
-
Will initialize
FontComposition
using only color.
As font size and name are not part of this initializer, the default settings for these parameters will be used.Declaration
Swift
public init(color: UIColor)
Parameters
color
font color
-
Will initialize
FontComposition
with color andUIFont
.Declaration
Swift
public init(font: UIFont, color: UIColor)
Parameters
font
UIFont
object with name and sizecolor
font color
-
The default composition for
FontComposition
Check the variables declaration to receive the default values for every parameter.Declaration
Swift
public static let defaultComposition: FontComposition


This documentation is for version {{ version }}, which is not released yet. Grab the source code from Github to install this version. You can go to the documentation for the last release here.
{% else %}This documentation is for the {{ release }} release. You can install it with pip:
pip install --upgrade --no-deps statsmodelsor conda:
conda install statsmodelsDocumentation for the current development version is here. {% endif %}
Grab the source from Github. Report bugs to the Issue Tracker. Have a look at our Developer Pages.


Client
The Mies framework uses the mies
library to implement event handling for both the client and server.
mies.subscribe
mies
talks in routes. Establish a route handler block.
mies
.subscribe("/helloworld")
mies.action
Once you subscribe to a route, you can attach action
handlers, which listen for interactions from the user.
For example, let's say you wanted to listen for a click
on an element:
mies
.subscribe("/helloworld")
.click(function() {
console.log(this)
})
The following HTML is all you will have to write (note the data-action
attribute):

Click Me!

Any click on that element will fire the action
handler.
mies.publish
Call a route on the server
mies.publish("/helloworld")
If you're using Express
to build out your server, you would catch publish
calls with something like:
app.post("/helloworld", function(request, response) {
response.end("hello world");
})
To catch responses broadcast by the server following this call use mies.broadcast
mies.broadcast
Once you subscribe to a route, you can attach broadcast
handlers, which listen for messages from calls to that route:
mies
.subscribe("/helloworld")
.broadcast(function() {
// Executes in the scope of the returned JSON object.
//
console.log(this)
})
.publish("/helloworld")
mies.error
Catch any errors broadcast by the server following a mies.publish
event.
mies
.subscribe("/helloworld")
.error(function(error) {
// #error is the descriptive error string broadcast by the server.
//
console.log(error)
})
mies.join
mies
can be used purely on the client side. If you would like to connect it to a server, allowing mies.publish
and mies.broadcast
hooks, you will call mies.join
mies
.subscribe("/helloworld")
.join("adhoc", sessionId, function() {
mies.publish("/helloworld");
})
join
expects its first argument to be the name of a group. This can be any string. Clients which join
different groups (think of them as rooms) will only receive messages for that group.
It is normal, and most common, to assign all your clients to a single group.
join
expects its second argument to be a session id
. All clients must retrieve a session id
either by logging in with a username and password, or by requesting a (non-authenticating) session id
directly.
// POST to /login to fetch an authenticating #sessionId
//
jQuery.post("/login", {
username<EMAIL_ADDRESS>password: "password"
}, function(sessId) {
mies.join("adhoc", sessionId, function() {...})
});
// GET /login to fetch non-authenticating #sessionId
//
jQuery.get("/login", function(sessionId) {
mies.join("adhoc", sessionId, function() {...})
});


Setting up your environment
This project enables Visual Studio users on Windows to copmile and execute Swift programs.
Install swift for windows
The project is based on https://swiftforwindows.codeplex.com. You can download the latest package from there.
- Download SwiftForWindows from https://swiftforwindows.codeplex.com
- You can install SwiftForWindows via the installer, but it's not a hard recommendation. You can just extract the content of WinRoot\SwiftForWindows into a folder on your local machine, e.g. D:\swiftForWindows
- Add the binaries path of SwiftForWindows (e.g. D:\SwiftForWindows\Swift\bin) to your local %PATH% variable.
- Restart Visual Studio so that it re-reads the %PATH% variable.
- Edit SwiftBuild.targets in your project. Make sure that paths are correct in this file.
- You can now start editing main.swift
Run and debug
To run the project, press Ctrl+F5. Visual Studio will:
- Compile the swift code.
- If any compile errors occur, they will be displayed in Visual Studio Errors window.
- Link object files to a Windows executable
- Start the generated executable.
Note: Debugging is not supported in this version of Swift For Visual Studio
Resources
- SwiftForWindows
The swift compiler build for Windows, used in this project. - Syntax Highlighting Pack
Useful extension for syntax highlighting with Swift support. - Swift language
The official page of the Swift language.


| Submissions open | April 4, 2017 |
| Submissions close | May 15, 2017 |
| Public testing | May 20, 2017 |
| Results announced | May 21, 2017 |
Public rating out of 5 (weighted 20%) |
Gameplay out of 10 (weighted 40%) |
Aesthetics out of 10 (weighted 30%) |
Innovation out of 10 (weighted 10%) |
Additional Bonus of 3% for XML with minimal errors |
Maps could be any gamemode, but must be no larger than 16v16 . |
|
| XML documents were to be included with the submission. | |
| Authors were allowed to be author on up to 3 maps, but only their top scored map was counted. | |
| Maps previously submitted to Stratus Network could not be entered into this contest. |
| First Place | Strato, 3 months of Stratus+, winner tag on discord |
| Second Place | 3 months of Stratus+, runner up tag on discord |
| Third Place | 3 months of Stratus- |
| # | Map | Public rating / 5 (20% weight) | Gameplay / 10 (40% weight) | Aesthetics / 10 (30% weight) | Innovation / 10 (10% weight) | Bonus 3% | Total |
| 16th | Boat Blitz | 2.91 | 5.4 | 3.29 | 5.83 | 0 | |
| 4th | Boulders | 3.45 | 6.14 | 8.29 | 5.86 | 0 | |
| 7th | Campgrounds | 3.33 | 5.67 | 6.83 | 5.83 | 0 | |
| 12th | Curly Wools II | 3.24 | 5.8 | 6.57 | 6.42 | 0 | |
| 6th | Dorreak | 3.48 | 6 | 7.57 | 5.43 | 0 | |
| 15th | Ender-fortress | 2.89 | 5.2 | 3.17 | 8 | 0 | |
| 5th | Grenouille de l'armee | 3.32 | 6.33 | 8 | 5.5 | 0 | |
| 3rd | Jactus | 3.55 | 8 | 7 | 5.33 | 0 | |
| 13th | Mijuku | 3.52 | 5.33 | 5.83 | 5.83 | 0 | |
| 1st | Pond | 3.67 | 7.2 | 8.83 | 7 | 0 | |
| 8th | Puyt | 3.43 | 7.4 | 5.33 | 5.17 | 0 | |
| 11th | The Hills | 3 | 6 | 6.83 | 6.67 | 0 | |
| 18th | Three Choices | 2.9 | 4.75 | 4.2 | 8.6 | 0 | |
| 14th | Tower Blast | 3.63 | 4.4 | 4.2 | 8 | 0 | |
| 17th | Trapp | 2.64 | 5.5 | 4.5 | 5.83 | 0 | |
| 9th | Tribe | 3.23 | 6.25 | 6.17 | 7.5 | 0 | |
| 2nd | Verlate | 3.22 | 7 | 8 | 6.43 | 0 | |
| 10th | Xyth II King | 3.16 | 5 | 6.29 | 8.86 | 0 |


Main Menu - Resources
Resources:
- Install Adobe PDF Reader
- Common Application
- College/Financial Aid Glossary
- College
Resources for Students and Families
- Loan Comparison Tool
- $10,000.00 Scholarship
Reports:
- The Top 50 Colleges that will Kill your Retirement
- Ivy League Admission Statistics
- Respectable Schools for the Average Student
- Early & Often: Designing a Comprehensive
System of Financial Aid Information


Description
-
Command line system information tool ported to iOS
Compatibility
-
Supports all iOS Versions
Dependencies
-
gawk
In this version
-
0.4
- Updated to latest neofetch release
September 26, 2019
Previous Releases
-
0.3
- Initial Release
August 20, 2019
Known Issues
- No known issues. Report issues using the contact info below.
Credits
Report Issues to
-<EMAIL_ADDRESS>- Skylar#5039 (Discord)


Life Saving Drugs
Add Medicine
Medicine
Quantity
Select purpose
Anaplylactic shock
cardiogenic shock
peripheral circulatory collapse
status eplipticus
acute respiratory failure
Medicine used in:
Add Medicine
Update Medicine
Delete Medicine
Back
Medicines Stock
Search Medicines
Anaplylactic Shock
Cardiogenic Shock
Peripheral Circulatory Collapse
Status Eplipticus
Acute Respiratory Failure


|
1.13 CommandAPI
3.0
An API for the command UI introduced in Minecraft 1.13
|
Welcome to the documentation for the CommandAPI. The CommandAPI lets you create vanilla Minecraft commands which utilize the new command features which were implemented in Minecraft 1.13, including but not limited to:
/execute
commandDeveloper's Note:
This is a pretty important section, I would recommend reading before implementing the CommandAPI in your own projects. This section tells you about setup which is not stated anywhere else in the documentation. Think of it as the "knowledge you should know before using this API".
The CommandAPI does not follow the "standard" method of registering commands. In other words, commands which are registered with the CommandAPI will be registered as pure vanilla Minecraft commands as opposed to Bukkit or Spigot commands. This means that the following implications exist:
plugin.yml
fileThis documentation is split into the major sections that build up the CommandAPI. It's been designed in such a way that it should be easy to find exactly what you want to help you get started with the CommandAPI, how it's structured and how to make effective use of it. Each step of the way, the documentation will include examples which showcase how to use the CommandAPI.
You can use the side bar on the left to access the various sections of the documentation and can change the theme to your liking using the paintbrush icon in the top left corner.
Using the search icon in the top left corner, typing "Example" will show a list of examples which are included throughout the documentation.
Whenever a new version of the CommandAPI comes out, the version number changes _(as you'd expect)_. In the same manner, if any changes to the documentation were made, the documentation version number changes. Ensure you keep up to date on the latest changes to the documentation (You can view the documentation version at the top of the page) when new versions of the CommandAPI are released. This changelog below gives a brief overview of the changes to pages that were made between each version of the documentation, as only the latest version of the documentation is hosted online.
pom.xml
fileSuggestedStringArgument
, use .overrideSuggestions()
insteadCustomArgument
DynamicSuggestedArgument
now has access to the CommandSender
object


How it works
Simple and easy
1
Install the our plugin for WooCommerce, Shopify, Magento, PrestaShop
2
Your customer connect their messaging service during checkout
3
Order notifications are automatically send via the messaging service
4
Use your new channel to provide support and marketing


3. Functions
Small
"The first rule of functions is that they should be small. The second rule of functions is that they should be smaller than that."
"In the eighties we used to say that a function should be no bigger than a screen-full.
[...] when VT100 screens were 24 lines by 80 columns [..]"
"Functions should hardly ever be 20 lines long."
Blocks and Indenting
"[..] blocks within if statements, else statements, while statements, and so on should be one line long.
Probably that line should be a function call. Not only does this keep the enclosing function small, but it also adds documentary value
because the function called within the block can have a nicely descriptive name."
"Therefore, the indent level of a function should not be greater than on or two."
Do One Thing
"FUNCTIONS SHOULD DO ONE THING. THEY SHOULD DO IT WELL. THEY SHOULD DO IT ONLY."
"[...] steps of the function are one level of abstraction below the stated name of the function."
"After all, the reason we write functions is to decompose a larger concept (in other words, the name of the function)
into a set of steps at the next level of abstraction."
"So, another way to know that a function is doing more than "one thing" is if you can extract another function from it with a
name that is not merely a restatement of its implementation."
Sections within Functions
"Functions that do one thing cannot be reasonably divided into sections."
One Level of Abstraction per Function
"In order to make sure our functions are doing "one thing", we need to make sure that the statements within our functions are all
at the same level of abstraction."
Reading Code from Top to Bottom: The Stepdown Rule
"We want the code to read like a top-down narrative. We want every function to be followed by those at the next level of abstraction
so that we can read the program, descending one level of abstraction at a time as we read down the list of functions.
I call this The Stepdown Rule."
"Making the code read like a top-down set of TO paragraphs is an effective technique for keeping the abstraction level consistent."
Switch Statements
"By their nature, switch statements always do N things. [And, of course, if/else chains as well]"
"[...] we can make sure that each switch statement is buried in a low-level class and is never repeated."
"There are several problems [...] First, it's large [...], it will grow. Second, it very clearly does more than one thing.
Third, it violates the Single Responsibility Principle (SRP) [...] But most the worst problem with this function is that that
there are an unlimited number of other functions that will have the same structure."
Use Descriptive Names
"The smaller and more focused a function is, the easier it is to choose a descriptive name."
"Don't be afraid to make a name long. A long descriptive name is better than a short enigmatic name.
A long descriptive name is better than a long descriptive comment."
"Choosing descriptive names will clarify the design of the module in your mind and help you to improve it.
It is not at all uncommon that hunting for a good name results in a favorable restructuring of the code."
"Be consistent in your names. Use the same phrases, nouns, and verbs in the function names you choose for your modules."
Function Arguments
"The ideal number of arguments for a function is zero (niladic). [...] More than three (polyadic) requires very special
justification - and then shouldn't be used anyway."
"Arguments are even harder from a testing point of view."
Common Monadic Forms
"There are two very common reasons to pass a single argument into a function.
You may asking a question about that argument [...]
Or You may be operating on that argument, transforming it into something else and returning it."
"These two uses are what readers expect when they see a function. You should choose names that make the distinction clear,
and always use the two forms in a consistent context."
Flag Arguments
"Flag arguments are ugly. Passing a boolean into a function is a truly terrible practice."
"[...] this function does more than one thing. It does one thing if the flag is true and another if the flag is false."
Dyadic Functions
"The parts we ignore are where the bugs will hide."
"There are times, of course, where two arguments are appropriate. [...] [for example] ordered components of a single value!"
"Dyads aren't evil, and you will certainly have to write them. However, you should be aware that they come at a cost
and should take advantage of what mechanisms may be available to you to convert them into monads."
Triads
"The issues of ordering, pausing, and ignoring are more than doubled. I suggest you think very carefully before creating a triad."
Argument Objects
"When a function seems to need more than two or three arguments, it is likely that some of those arguments ought
to be wrapped into a class of their own. [See Data Transfer Object (DTO) Design Pattern]"
Argument Lists
"If the variable arguments [in a variable number of arguments] are all treated identically, [...]
then they are equivalent to a single argument [...]"
"Functions that take variable arguments can be monads, dyads, or even triads.
But it would be a mistake to give them more arguments than that."
Verbs and Keywords
"In the case of a monad, the function and argument should form a very nice verb/noun pair.
For example, write(name) is very evocative. An even better name might be writeField(name) [...]"
"Using this form we encode the names of the arguments into the function name. [...]
This strongly mitigates the problem of having to remember the ordering of the arguments."
Have No Side Effects
"Side effects are lies. Your function promises to do one thing, but it also does other hidden things."
"Temporal couplings are confusing, especially when hidden as a side effect.
If you must have a temporal coupling, you should make it clear in the name of the function."
Output Arguments
"Anything that forces you to check the function signature is equivalent to a double-take.
It's a cognitive break and should be avoided."
"In general output arguments should be avoided.
If your function must change the state of something, have it change of its owning object."
Command Query Separation
"Functions should either do something or answer something, but not both. [...] Doing both often leads to confusion."
"The real solution is to separate the command from the query so that the ambiguity cannot occur."
Prefer Exceptions to Returning Error Codes
"[...] [error codes] does lead to deeply nested structures.
When you return an error code, you create the problem that the caller must deal with the error immediately."
"On the other hand, if you use exceptions instead of returned error codes, then the error processing code
can be separated from the happy path code and can be simplified."
Extract Try/Catch Blocks
"They confuse the structure of the code and mix error processing with normal processing.
So it is better to extract the bodies of the try and catch blocks out into functions of their own."
Error Handling is One Thing
"Functions should do one thing. Error handling is one thing. Thus, a function that handles errors should do nothing else."
The Error.java Dependency Magnet
"Returning error codes usually implies that there is some class or enum in which all the error codes are defined. [...]
Classes like this are a dependency magnet; many other classes must import and use them.
Thus, when the Error enum changes, all those classes need to be recompiled and redeployed."
"When you use exceptions rather than error codes, then new exceptions are derivatives of the exception class.
They can be added without forcing any recompilation or redeployment."
Don't Repeat Yourself
"Duplication may be the root of all evil in software."
"It would appear that since the invention of the subroutine, innovations in software development have been an ongoing
attempt to eliminate duplication from our source code."
Structured Programming
"Dijkstra said that every function, and every block within a function, should have one entry and one exit.
[...] those rules serve little [not significant] benefit when functions are very small."
"[...] occasional multiple return, break, or continue statements does no harm and can sometimes even be
more expressive than the single-entry, single-exit rule."
"[...] goto [...] should be avoided."
How Do You Write Functions Like This?
"The first draft might be clumsy and disorganized, so you wordsmith it and restructure it and refine it until
it reads the way you want it to read."
"So then I massage and refine that code, splitting out functions, changing names, eliminating duplication.
I shrink the methods and reorder them. Sometimes I break out whole classes, all the while keeping the tests passing."


Griezmann Laments Playing Position At Barca
by SL InternationalFC Barcelona superstar Antoine Griezmann has opened up about his struggles since arriving at the club, and hinted that he would prefer to play in the role currently occupied by Lionel Messi.
Read: Ronaldo Facing Two-Year Ban?
Griezmann joined Barca at the beginning of the season from Atletico Madrid for a reported fee of €120 million (R1.9 billion), and was expected to form a prolific partnership with Lionel Messi and Luis Suarez.
Things have not quite gone to plan for the 2018 FIFA World Cup winner, though, as he has struggled to perform on the left side of Barcelona's attack, with either Messi or Suarez being deployed in his preferred central position.
The 28-year-old was questioned about his role at Barca after France's 2-1 win over Moldova on Thursday night, and he revealed that he is still getting used to the positional shift.
Earn Airtime & Data With Soccer Laduma''s Social Media App - Download Now
"It is certain that playing in the axis is better for me," Griezmann said, as reported by RMC.
"I have my bearings. I've been managing this position for years and years.
"I have a new club. I have to adapt. I am still learning. I knew on arrival that it was going to be hard, I knew it very well."
Click through the gallery below to see the 10 most expensive players of all time:
Griezmann became the sixth most expensive player of all time upon joining Barcelona, but has scored just four goals in 15 appearances for the Blaugrana since.


{% trans badge_url=nomination.badge.get_absolute_url(),
badge_title=nomination.badge.title,
nomination_url=nomination.get_absolute_url(),
user_name=nomination.nominee,
user_url=nomination.nominee.get_absolute_url() %}
You were nominated
for the badge {{ badge_title }}.
Want to accept?
{% endtrans %}


|
mime-form-decode
|
#include <SimpleParser.h>
Public Member Functions | |
| SimpleParser (ClientInterface *client, Object *obj) | |
| virtual void | parse (unsigned char c) |
| void | close () |
Public Attributes | |
| ClientInterface * | client |
| Object * | obj |
Definition at line 10 of file SimpleParser.h.
| SimpleParser::SimpleParser | ( | ClientInterface * | client, |
| Object * | obj | ||
| ) |
Definition at line 5 of file SimpleParser.cpp.
References mime::ClientInterface::data_start().
|
inlinevirtual |
Reimplemented from mime::Parser.
Definition at line 17 of file SimpleParser.h.
References mime::ClientInterface::data_end().
|
virtual |
Implements mime::Parser.
Definition at line 11 of file SimpleParser.cpp.
References mime::ObjectParser::client, mime::ClientInterface::data(), and mime::ObjectParser::obj.
|
inherited |
Definition at line 14 of file ObjectParser.h.
Referenced by mime::Base64Parser::close(), mime::QuotedPrintableParser::close(), mime::ObjectParser::ObjectParser(), parse(), mime::AnyObjectParser::parse(), mime::Base64Parser::parse(), mime::QuotedPrintableParser::parse(), and mime::MultipartParser::parse().
|
inherited |
Definition at line 15 of file ObjectParser.h.
Referenced by mime::Base64Parser::close(), mime::QuotedPrintableParser::close(), mime::ObjectParser::ObjectParser(), parse(), mime::AnyObjectParser::parse(), mime::Base64Parser::parse(), mime::QuotedPrintableParser::parse(), and mime::MultipartParser::parse().


|
About me
👤 I'm a Junior Assistant Professor (RTD-A) in the Department of Information Engineering at the University of Padova 🇮🇹.
🧳 Previous positions:
Mar 2018 - Sept 2019: Postdoctoral Scholar, Department of Mechanical Engineering, University of California, Riverside 🇺🇸, advisor: Fabio Pasqualetti.
Oct 2015 - June 2016: Visiting Scholar, Control Group, University of Cambridge 🇬🇧, supervisor: Rodolphe Sepulchre.
Oct 2014 - Feb 2018: Ph.D. Student, Automatic Control Group, University of Padova 🇮🇹, supervisor: Augusto Ferrante.
🔬 My research interests are in the area of Systems and Control Theory. Topics of interest include:
analysis and control of network systems
learning and data-driven control
quantum information and control
📃 Curriculum Vitæ
|


Using CloudFormation Stacks
Using CloudFormation Stacks
When you use AWS CloudFormation, you work with templates and stacks.  Whenever you create a stack, AWS CloudFormation provisions the resources that are described in your template. The examples on this site emphasize the refactoring of larger solutions into multiple nested stacks for the purpose of re-use. (read more)
If you deploy a number of different solutions using CloudFormation you'll soon spot sections of code that are copy and pasted between templates. By using nested stacks you'll increase the reusability of your code and increase the density of your deployments by avoiding the 200 resources per stack limit. (read more)
As stated on the CloudFormation examples page in the AWS documentation there is some variation to the capabilities of each AWS region so the idea that you can come up with simplistic component templates that will work anywhere is a difficult task. Examples of such limitations are new features like, as of 2016, the NAT gateway which is not yet available in all regions. (read more)
The examples page has a launch button to quickly check out an example, more than likely you'll want to make some tweaks to the templates to customize them to you needs. All of the code is available on GitHub


| Active Ships | Skin | Killmarks | Base Fitting | Notes |
| Ark CARGO-0 | Star Captain | ??? | ARK-ARMOR | extreme armor meta hauling |
| Bowhead CHONKER-0 | Rosada Dawn | ??? | BOWHEAD-UNDOCK | chonky red laser boops |
| Dominix Navy Issue MS4-0 | Spirit | 0 | DOMINIX-NAVY-34-OMEGA | running security missions |
| Impel CARGO-0 | Star Captain | 0 | IMPEL-CARGO | running distribution missions |
| Legion DEPOT-0 | Oasis of Faith | 0 + 24 | LEGION-POLARIZED | all depots must die! |
| Praxis MINE-0 | Versus Blueforce | 0 | PRAXIS-ORE | daily mining challenges |
| Proteus PROWL-0 | Kopis Edge | 19 | PROTEUS-UNDOCK | covert cloak is overpowered |
| Punisher SPEED-0 | ??? | 0 | PUNISHER-50MN-CHEAP | gotta move fast? |
| Sin "PvP"-0 | Versus Blueforce | 0 | SIN-UNDOCK | chonky proteus pvp |


Recipe 19.11. Reading Lines with Continuation CharactersCredit: Alex Martelli ProblemYou have a file that includes long logical lines split over two or more physical lines, with backslashes to indicate that a continuation line follows. You want to process a sequence of logical lines, "rejoining" those split lines. SolutionAs usual, our first idea for a problem involving sequences should be a generator: def logical_lines(physical_lines, joiner=''.join): logical_line = [ ] for line in physical_lines: stripped = line.rstrip( ) if stripped.endswith('\\'): # a line which continues w/the next physical line logical_line.append(stripped[:-1]) else: # a line which does not continue, end of logical line logical_line.append(line) yield joiner(logical_line) logical_line = [ ] if logical_line: # end of sequence implies end of last logical line yield joiner(logical_line) if _ _name_ _=='_ _main_ _': text = 'some\\\n', 'lines\\\n', 'get\n', 'joined\\\n', 'up\n' for line in text: print 'P:', repr(line) for line in logical_lines(text, ' '.join): print 'L:', repr(line) When run as a main script, this code emits: <c>P: 'some\\\n' P: 'lines\\\n' P: 'get\n' P: 'joined\\\n' P: 'up\n' L: 'some lines get\n' L: 'joined up\n'</c> DiscussionThis problem is about sequence-bunching, just like the previous Recipe 19.10. It is therefore not surprising that this recipe, like the previous, is a generator (with an internal structure quite similar to the one in the "other" recipe): today, in Python, sequences are often processed most simply and effectively by means of generators. In this recipe, the generator can encompass just a small amount of generality without introducing extra complexity. Determining whether a line is a continuation line, and of how to proceed when it is, is slightly too idiosyncratic to generalize in a simple and transparent way. I have therefore chosen to code that functionality inline, in the body of the logical_lines generator, rather than "factoring it out" into separate callables. Remember, generality is good, but simplicity is even more important. However, I have kept the simple and transparent generality obtained by passing the joiner function as an argument, and the snippet of code under the if _ _name_ _= ='_ _main_ _' test demonstrates how we may want to use that generality, for example, to join continuation lines with a space rather than with an empty string. If you are certain that the file you're processing is sufficiently small to fit comfortably in your computer's memory, with room to spare for processing, and you don't need the feature (offered in the version of logical_lines shown in the "Solution") of ignoring whitespace to the right of a terminating \\, a solution using a plain function rather than a generator is simpler than the one shown in this recipe's Solution: def logical_lines(physical_lines, joiner=''.join, separator=''): return joiner(physical_lines).replace('\\\n', separator).splitlines(True) In this variant, we join all of the physical lines into one long string, then we replace the "canceled" line ends (line ends immediately preceded by a backslash) with nothing (or any other separator we're requested to use), and finally split the resulting long string back into lines (keeping the line endsthat's what the true argument to method splitlines is for). This approach is a very different one from that suggested in this recipe but possibly worthwhile, if physical_lines is small enough that you can afford the memory for it. I prefer the "Solution"'s approach because giving semantic significance to trailing whitespace is a poor user interface design choice. See AlsoRecipe 19.10; Perl Cookbook recipe 8.1; Chapter 1 for general issues about handling text; Chapter 2 for general issues about handling files. |


In combination, we found that ceftriaxone and lansoprazole block the hERG channel responsible for prolonging the QT interval on the electrocardiogram.
We used a computational model of the human ventricular myocyte (ref) to simulate the action potential for the hERG block we observed for ceftriaxone, lansoprazole, and the combination from our laboratory experiments. We ran the model for a ventricular action potential paced at 1 Hz with baseline conditions and the current blocks observed in the electrophysiology experiments. We evaluated the action potential duration at 70% of repolarization (APD70).
We observed a block of 10% for the combination of 1 μM lansoprazole/ 100 μM ceftriaxone and 55% for 10 μM lansoprazole/ 100 μM ceftriaxone. For % block, the action potential prolongation was ms.
Adjust the percent block by and dragging to see the changes in the model and results.