3 All analyses
3.1 Things we can do without access to IPD
3.1.1 Adjusting p-value for decision at hand
glms <- cache_rds({lst(
cld = glm(cld ~ trt, family = binomial, data = dat),
mort = glm(mort ~ trt, family = binomial, data = dat)
)}, dir = cache, file = "marginal_glms")
map(glms, summary)
## $cld
##
## Call:
## glm(formula = cld ~ trt, family = binomial, data = dat)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.0474 -1.0474 -0.9643 1.3132 1.4066
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.52428 0.07964 -6.583 4.61e-11 ***
## trt 0.21062 0.11142 1.890 0.0587 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1813.8 on 1349 degrees of freedom
## Residual deviance: 1810.3 on 1348 degrees of freedom
## AIC: 1814.3
##
## Number of Fisher Scoring iterations: 4
##
##
## $mort
##
## Call:
## glm(formula = mort ~ trt, family = binomial, data = dat)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.5994 -0.5994 -0.5445 -0.5445 1.9910
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.6255 0.1038 -15.655 <2e-16 ***
## trt -0.2083 0.1525 -1.366 0.172
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1146.5 on 1349 degrees of freedom
## Residual deviance: 1144.6 on 1348 degrees of freedom
## AIC: 1148.6
##
## Number of Fisher Scoring iterations: 4
conf_vector <- seq(from = 0.95, to = 0.7, length.out = 10)
power <- FALSE
i <- 1
while(power == FALSE){
pwr <- epiR::epi.sscc(OR = 0.7, # Coincides to risk difference of 8% based on 36% baseline risk
p0 = 0.36,
n = 1350,
conf.level = conf_vector[[i]],
power = NA)
power = pwr$power >= 0.9
i = i + 1
}
new_alpha <- 1 - conf_vector[[i]]
Before we get into more direct decision theory approaches, one simple way we can make decisions a little more local is just by re-evaluating our values of alpha and beta. Let’s use CLD as a rough proxy for risk of disability and say that maybe locally we are willing to risk more false positives in order to decrease our possibility of missing a true effect. Instead of the default assumption that a false positive is four times worse than a false negative let’s say in this case we decide that the potential harm from this intervention is such that we’re willing to risk a two to one trade off. If we fix the sample size and assume we woudn’t want to miss a risk difference of 8% (OR of 0.7) then this would equate to a p-value of 0.11.
This equates to a decision rule that “If I can be confident in the direction of the effect” using alpha/beta to weigh risks of false negative/positive then you act “as if” there is/is not a difference.
3.1.2 MCDA from marginals
In the first step we will need marginal probabilities with uncertainty from each outcome we’d like to include in the mcda. An easy way to do this is just to run a glm and then sample predicted probabilities from the variance covariance matrix.
3.2 Approaches that we need IPD for
3.2.1 Ordinal model
An alternative approach might be to arrange outcomes from best to worse and then use an ordinal model to run the analysis interpreting the treatment effect as a kind of improvement in quasi utility.
ord <- c("sepsis", "nec", "cld", "sev_ivh", "mort")
dat_ord_orig <- make_ord(data = pres_dat, name = "ord1", order = ord)
dat_ord_synth <- make_ord(data = pres_dat_syn, name = "ord1", order = ord)
ord_models <- cache_rds({
lst(
orig = rms::orm(ord1 ~ trt, data = dat_ord_orig),
synth = rms::orm(ord1 ~ trt, data = dat_ord_synth)
)
}, dir = cache, file = "ord_models")
ord_models
## $orig
## Logistic (Proportional Odds) Ordinal Regression Model
##
## rms::orm(formula = ord1 ~ trt, data = dat_ord_orig)
##
##
## Frequencies of Responses
##
## no_event sepsis nec cld sev_ivh mort
## 510 293 44 372 47 84
##
## Model Likelihood Discrimination Rank Discrim.
## Ratio Test Indexes Indexes
## Obs 1350 LR chi2 0.42 R2 0.000 rho 0.018
## Distinct Y 6 d.f. 1 g 0.032
## Median Y 2 Pr(> chi2) 0.5162 gr 1.033
## max |deriv| 2e-06 Score chi2 0.42 |Pr(Y>=median)-0.5| 0.123
## Pr(> chi2) 0.5162
##
## Coef S.E. Wald Z Pr(>|Z|)
## y>=sepsis 0.4685 0.0732 6.40 <0.0001
## y>=nec -0.4150 0.0733 -5.66 <0.0001
## y>=cld -0.5525 0.0743 -7.44 <0.0001
## y>=sev_ivh -2.2633 0.1050 -21.55 <0.0001
## y>=mort -2.7455 0.1235 -22.22 <0.0001
## trt 0.0641 0.0987 0.65 0.5163
##
##
## $synth
## Logistic (Proportional Odds) Ordinal Regression Model
##
## rms::orm(formula = ord1 ~ trt, data = dat_ord_synth)
##
##
## Frequencies of Responses
##
## no_event sepsis nec cld sev_ivh mort
## 508 288 51 359 47 97
##
## Model Likelihood Discrimination Rank Discrim.
## Ratio Test Indexes Indexes
## Obs 1350 LR chi2 0.69 R2 0.001 rho 0.023
## Distinct Y 6 d.f. 1 g 0.041
## Median Y 2 Pr(> chi2) 0.4053 gr 1.042
## max |deriv| 4e-06 Score chi2 0.69 |Pr(Y>=median)-0.5| 0.124
## Pr(> chi2) 0.4053
##
## Coef S.E. Wald Z Pr(>|Z|)
## y>=sepsis 0.4645 0.0746 6.23 <0.0001
## y>=nec -0.4041 0.0747 -5.41 <0.0001
## y>=cld -0.5632 0.0757 -7.44 <0.0001
## y>=sev_ivh -2.1686 0.1026 -21.14 <0.0001
## y>=mort -2.6018 0.1177 -22.11 <0.0001
## trt 0.0820 0.0985 0.83 0.4053
##
3.2.2 MCDA with conditional
A drawback of the ordinal model is that it doesn’t let us specify how much worse one outcome is than another. We can extend the marginal MCDA to account for combinations of outcomes being worse by leveraging our synthetic dataset. This could be extended further by having non-linear partial utilities or other considerations.
outs_prep <- c("mort", "sepsis", "nec", "cld_ivh")
mcda_comb_list <- cache_rds({
set.seed(124)
mcda_comb_orig_dat <- mcda_prep(outs_prep, data = pres_dat)
mcda_comb_orig <- do_mcda(4, mcda_comb_orig_dat)
set.seed(124)
mcda_comb_syn_dat <- mcda_prep(outs_prep, data = pres_dat_syn)
mcda_comb_syn <- do_mcda(4, mcda_comb_syn_dat)
lst(orig_dat = mcda_comb_orig_dat,
orig_mcda = mcda_comb_orig,
comb_dat = mcda_comb_syn_dat,
comb_mcda = mcda_comb_syn)
}, dir = cache, file = "comb_mcdas")


More information on the dragon curve can be found here.
Press the right arrow key to progress and press the left arrow key to go back. Alternatively, a mouse click can be used instead of the right arrow key.


+
Do calculations on pivot tables putting the results in either new rows or columns or replacing existing values
See the article in the file PostComputes.pdf in the STATS_TABLE_CALC directory under the location where extensions are installed for an explanation on how to use this procedure.
STATS TABLE CALC
SUBTYPE=:"subtype-a"..."subtype-k"
NEXTSUBTYPE="subtype1" ... "subtype-n"
PREVSUBTYPE="subtype1" ... "subtype-m"
PROCESS=PRECEDING** or ALL
PRINTLABELS=NO* or YES
/TARGET
DIMENSION=COLUMNS** or ROWS
LEVEL=number
OUTLEVEL = number
FORMULA = “formula for new values”
LOCATION=numbers or labels MODE=REPLACE** or BEFORE or AFTER
REPEATLOC=NO** or YES
LABEL = “label text”* ...
CUSTOMMODULE= “module name”
HIDEINPUTS = NO** or YES
/FORMAT
WIDTH=number in points
CELLFORMAT = “format expression”
DECIMALS=number
INVALID = “symbol for invalid values”
ALIGN = ASIS** or LEFTTOP or CENTER or RIGHTBOTTOM
/HELP
* Required
** Default
/HELP displays this text and does nothing else.
STATS TABLE CALC SUBTYPE="custom table"
/TARGET DIMENSION=columns LEVEL=-2 LOCATION=0 MODE=before LABEL="clerical+manager"
FORMULA="x[-'Clerical'] + x[-'Manager']".
While it works with most pivot tables, this cannot be used when there is true nesting of dimensions in the specified dimension except when using replace. Note that although Custom Tables output may appear to be nested, those tables do not have true nesting. Tables with multiple layer dimensions or multiple categories in one layer dimension are not supported.
SUBTYPE is the OMS table subtype It specifies which types of tables to process.
You can find the subtype by right clicking in the outline on an instance
or from Utilties > OMS identifiers.
The subtype name should be in quotes. Any extra matching outer quotes are removed.
Case and white space do not matter. Multiple subtypes can be specified.
SUBTYPE="*"
processes tables regardless of subtype.
By default, the immediately preceding table of the specified subtype is processed. Specify PROCESS=ALL to process all existing tables matching the specified subtypes.
By default, when selecting by the row or column header text, the lowest or innermost text is tested. LEVEL can be specified to use outer layers of the labels. LEVEL=-1, the default, is the innermost layer. More negative numbers move out. Positive numbers count in from the outside. LEVEL=1 is usually the first visible cell (level 0 is the dimension label).
In some cases, there may be invisible levels in-between what you see, so some experimentation may be required to find the level you need. The level specification only affects text matching. Column and row numbers always count at the innermost level.
Use PRINTLABELS=TRUE to display the full label structure of selected tables in the specified dimension in order to assist in specifying the level.
DIMENSION=COLUMNS, the default, indicates operating on columns. DIMENSION=ROWS causes rows to be operated on.
LOCATION specifies where the results should go. It can be one or more row or column numbers, or it can refer to the label value at the specified level. E.g., LOCATION=3 refers to the fourth column or row. LOCATION=“Total” refers to the column or row labelled “Total”. LOCATION=“Total” “Total” refers to the first two columns or rows labelled Total. All label references are case sensitive.
REPEATLOC specifies whether the specified location or sequence of
locations should be repeated for all instances of the LOCATION specification
For example, if LOCATION = 'a' 'b'
and REPEATLOC=YES, the location
specification would be treate as 'a' 'b' 'a' 'b' ...
until the end of the dimension.
It does not make sense to specify YES if the LOCATION specification is numeric.
MODE specifies how the location is interpreted.
If MODE=REPLACE, the values at column or row LOCATION are replaced.
Only this mode can be used in Statistics version 20 or earlier.
If MODE=BEFORE, a new column or row is inserted at that location,
and every later column or row is moved over by one. Use this mode to
create a new first column or row with LOCATION=0.
If MODE=AFTER, a new column or row is inserted after that location.
Use this mode to create a new last column or row.
OUTLEVEL, which can only be used with LOCATION=BEFORE or AFTER, specifies the level for the label of the new column or row. By default, it is the same as the LEVEL value, and it follows the same value logic.
LABEL specifies the label text for the target row or column. The label can be a single quoted string or a list of quoted strings. The labels are applied in order to the target columns. If there are more target columns than labels, the labels are recycled. For example, with LABEL= A B C, if there are four target columns, they will be labelled A B C A.
FORMULA specifies the computation to be carried out. For COLUMNS, it is applied to each row, and for ROWS, it is applied to each column. The entire formula must be enclosed in quotation marks.
The formula can use the standard arithmetic operators (use **
for power) and
standard mathematical functions such as min, max, mod, trunc, abs, exp,
log (base e, use log(x,10) for base 10).
It must be valid Python syntax except as explained below. See the Python
documentation, including the math module, for a complete list. The
math module is automatically imported so that functions such as
math.sqrt can be used.
Row or coumn values in the table can be referred to in three ways. All of these
are evaulated BEFORE any items are added to the tables.
References of the form xn
, where n is an integer e.g., x2
, refer to the absolute
column or row. Numbering starts from zero, so x0
is the first column or row.
References of the form x[n]
or x[-n]
refer to values to the left or right (above or below)
of the target location. E.g., x[-1]
refers to the location immediately left of the target location
if using columns or immediately above it for rows. x[1]
is the location immediately to the right.
x[0]
is the target location itself (before the target is inserted).
Example: suppose there are columns with labels a, b, and c, and the target
location is c. Then x[0]
refers to the value at c, x[-1]
refers to b, and x[-2]
refers to a, regardless of the mode setting.
References of the form x['string']
or x[-'string']
refer to values to the left or right
(above or below) of the target location where string is the value of the label at
the specified level. E.g., x[-"Clerical"]
refers to the nearest column to the left
of the target location that is labelled “Clerical”.
Note that the strings must be quoted. The bracket notation does NOT refer to Python dictionaries but is used here to refer to locations.
If a reference looks like a number, it is interpreted accordingly. So you can't refer to a label that is actually numeric. Such labels are typically data values, so you can get around this by assigning a value label. Here is an example using the employee data.sav file shipped with Statistics. The table has the education values in the rows, and the table calc command inserts a subtotal of grades 8 and 12 after the newly labelled value of 12. Of course this presumes that there are exactly two numbers to sum. Note also that the target location, “HS”, is repeated so that the calculation is done twice.
value labels educ 12 "HS".
CTABLES
/TABLE minority >educ [COUNT F40.0] BY jobcat
/CATEGORIES VARIABLES=minority educ jobcat ORDER=A TOTAL=YES.
STATS TABLE CALC SUBTYPE="custom table" PROCESS=ALL
/TARGET DIMENSION=rows LEVEL=-1 LOCATION="HS" "HS" "HS" MODE=after LABEL="HS Subtotal"
FORMULA="x[0] + x[-1]" .
CUSTOMMODULE can specify a Python module whose functions can be
used in the formula. This can be useful when you need to refer to values
outside the row or column of the current cell. See the example below.
To refer to a function defined in a begin program block in the current session,
use __main__
“ as the module name.
HIDEINPUTS=YES causes the input rows or columns in the formula to be hidden.
Specify WIDTH=number to set the width of the target columns to the specified values in points (one point = 1/72 inch). WIDTH cannot be used with DIMENSION=ROWS.
This subcommand specifies the format for the column or row.
CELLFORMAT="asis”, which is the default leaves the format unchanged in
REPLACE mode and uses the default format for new columns or rows.
Other formats are as specified in the Cell Formats dialog box list in the pivot table
editor. Examples include
"#,###.##"
and "##.#%"
.
The number of decimal places can be specified with the DECIMALS keyword.
ALIGN can be used to set the label alignment to top, center, or bottom for columns and left, center, or right for rows. However, this keyword has no effect in Statistics <IP_ADDRESS> or earlier.
INVALID specifies the symbol to be used when a value cannot be computed. By default, it is a blank.
A custom module can have access to the entire pivot table and/or one or more secondary tables. Here is an example where the total in a crosstabs table is used in calculation for each row.
CROSSTABS /TABLES=jobcat BY gender /CELLS=COUNT.
STATS TABLE CALC SUBTYPE='Crosstabulation'
/TARGET DIMENSION=COLUMNS LEVEL=-1 LOCATION="Total" MODE=REPLACE LABEL="Ratio"
CUSTOMMODULE="customexample"
FORMULA = "customexample.custom(datacells, ncells, datacells.GetValueAt(roworcol, 0))".
Here is the function in the customexample module:
def custom(datacells, ncells, value):
'''Calculate percent of total'''
x = float(datacells.GetUnformattedValueAt(ncells-1,2)) # total
return float(value) / x
Notes: The following variables are available for use in the formula as function parameters.
The GetUnformattedValueAt method returns a Unicode string. It must be converted to a float for computations.
One or more nearby tables can be used in parallel with the primary table in
computing new values.
Use PREVSUBTYPE or NEXTSUBTYPE to select the nearest previous or
following tables of the specified OMS subtypes. Don't use the * notation for the main table!
The values in the secondary tables
can be combined with or replace values in the first table by using a custom function.
Here is an example that copies significance results from CTABLES into new columns
in the primary table.
CTABLES /TABLE gender BY jobcat /COMPARETEST TYPE=PROP.
STATS TABLE CALC SUBTYPE='customtable' NEXTSUBTYPE ='Comparisons of Proportions'
/TARGET DIMENSION=COLUMNS LEVEL =-1 LOCATION="Count" "Count" "Count" MODE=AFTER LABEL="Sig."
CUSTOMMODULE="customexample"
FORMULA = "customexample.usesecondary(arg)".
Here is the custom function in customexample.py
def usesecondary(arg):
return arg['sdatacells'].GetValueAt(arg['roworcol'], arg['resultnumber'])
arg is a dictionary containing all of the fields listed above. Note that by passing arg, the other parameters such as seen above are not necessary, because those values are included in the arg dictionary. In addition, the following items of use for secondary tables are available in arg.
If more than one secondary table is specified, the lists will be in the order listed in NEXTSUBTYPE or PREVSUBTYPE, not in the order found in the Viewer. The same subtype should not be listed more than once. NEXTSUBTYPE and PREVSUBTYPE should avoid listing tables of the same type as the main table. The main table is searched for from the end of the Viewer backwards, and it could find the intended secondary table if it is the same type.
Columns or row locations are sequenced in the order they are specified in the LOCATION keyword.
In this example the formula specifies get a call to the custom function, but it can be combined with other value constructs.
Additional arguments can be supplied to the custom function in the style of the first example. If the formula specifies
FORMULA = "customexample.usesecondary(arg, fred=100)".
Then the function would be declared as
usesecondary(arg, fred)
and the value of fred would be 100 when the function is called.
Following is an example using two secondary tables. First, CTABLES is run and generates a main table and a chi-squared significance table for the categorical row variables. Then ONEWAY is run on the continuous variables. The first STATS TABLE CALC custom function (f) consolidates the mean and count statistics in the same column. The second STATS TABLE CALC command uses another custom function (g) to pick up the chi-squared significance values from the first table and the significance values from the ONEWAY table and adds all these as a final column of the main CTABLES table. The typical CTABLES b and c footnotes are removed from the significance values as the footnotes themselves are not copied.
After that, SPSSINC MODIFY TABLES is used to hide the now-redundant Count column in the table. The data file is employee data.sav, which is shipped with Statistics. The Python custom functions are in a module named dotwosecondarytables.py.
* Using employee data.sav shipped with Statistics.
* Custom Tables.
CTABLES
/VLABELS VARIABLES=salary minority salbegin gender jobcat DISPLAY=DEFAULT
/TABLE salary [MEAN] + minority [COUNT F40.0] + salbegin [MEAN] + gender [COUNT F40.0] BY jobcat
/CATEGORIES VARIABLES=minority gender jobcat ORDER=A KEY=VALUE EMPTY=INCLUDE MISSING=EXCLUDE
/SIGTEST TYPE=CHISQUARE ALPHA=0.05 INCLUDEMRSETS=YES CATEGORIES=ALLVISIBLE.
* move statistics.
STATS TABLE CALC SUBTYPE="Custom Table" PROCESS=PRECEDING
/TARGET DIMENSION=COLUMNS LEVEL = -1 LOCATION="Mean"
custommodule="dotwosecondarytables" formula="dotwosecondarytables.f(arg)"
REPEATLOC=YES LABEL="Statistics" MODE=REPLACE.
* p values for continuous variables against jobcat.
ONEWAY salary salbegin BY jobcat.
* add p values.
STATS TABLE CALC SUBTYPE="Custom Table" NEXTSUBTYPE='Pearson Chi Square Tests' 'ANOVA' PROCESS=PRECEDING
/TARGET DIMENSION=COLUMNS LOCATION=-1 OUTLEVEL=1
custommodule="dotwosecondarytables" formula="dotwosecondarytables.g(arg)" LABEL="P-Value"
MODE=AFTER.
* hide unwanted columns.
SPSSINC MODIFY TABLES subtype="custom table"
SELECT="Count"
REGEXP=NO DIMENSION= COLUMNS LEVEL = -1
PROCESS = PRECEDING HIDE=TRUE
/STYLES APPLYTO=DATACELLS.
------- dotwosecondarytables.py -------
import re
def f(arg):
"""Move Count statistic into Mean column
arg is the dictionary provided by STATS TABLE CALC and referenced in formula
formula="dotwosecondarytables.f(arg)"
"""
datacells = arg['datacells']
roworcol = arg['roworcol']
resultnumber = arg['resultnumber']
# prepare to track result columns
# table columns assumed to be for each column category
# Mean, Count
if arg['firsttable']:
arg['firsttable'] = False
ll = arg['labels']
t = arg['insertpoints'][resultnumber] # current target table location
v = datacells.GetValueAt(roworcol, t).rstrip()
if v == "":
v = datacells.GetValueAt(roworcol, t + 1)
return v
def g(arg):
"""return sig level from secondary tables or None
arg is the dictionary from STATS TABLE CALC and referenced as
formula="dotwosecondarytables.g(arg)"
"""
if arg['firsttable']:
# build dictionary of sig values - first from CTABLES chi-squared table
# then from ONEWAY anova table and store in arg dictionary
arg['firsttable'] = False
sdatacellslist = arg['sdatacells']
sptlist = arg['secondary']
llseclist = [item.RowLabelArray() for item in sptlist]
arg['llseclist'] = llseclist
arg['ll'] = arg['pt'].RowLabelArray() # main table labels
srowslist = [item.GetNumRows() for item in llseclist]
arg['sigdict'] = {}
# first do chi-squared table
llsec = llseclist[0]
for r in range(srowslist[0]):
if llsec.GetValueAt(r, 2) == "Sig.":
var = llsec.GetValueAt(r, 1)
arg['sigdict'][var] = sdatacellslist[0].GetValueAt(r, 0)
# anova table sig values
llsec = llseclist[1]
sigcol = sdatacellslist[1].GetNumColumns() - 1
for r in range(srowslist[1]):
sigval = sdatacellslist[1].GetValueAt(r, sigcol)
if sigval != "":
var = llsec.GetValueAt(r, 1)
arg['sigdict'][var] = sigval
# return sig value for current row if there is one in the secondary table
curlbl = arg['ll'].GetValueAt(arg["roworcol"], 1) #keyed by second level of row label as first is hidden "ROW"
if curlbl == "":
curlbl = arg['ll'].GetValueAt(arg["roworcol"], 2)
if curlbl in arg['sigdict']:
result = arg['sigdict'][curlbl]
result = re.sub(r",*b,*|c", "", result) # remove footnote superscripts, if any
del arg['sigdict'][curlbl] # only return sig value once
else:
result = ""
return result
© Copyright IBM Corp. 1989, 2014


CSS uses the @media rule to detect information about the device being used to access the website. For example, it can be used to detect the size of the device, its capabilities, and its orientation. For this course, we will be using it to detect size, but keep in mind that it is capable of much more.


org.jclouds.s3.domain
Classes
AccessControlList
BucketLogging
BucketMetadata
CannedAccessPolicy
CanonicalUser
CanonicalUserGrantee
EmailAddressGrantee
Factory
Grant
Grantee
GroupGrantee
GroupGranteeURI
ListBucketResponse
MutableObjectMetadata
ObjectMetadata
ObjectMetadataBuilder
Payer
Permission
S3Object
StorageClass


--- layout: post title: The origin of 20% time date: '2011-10-16T09:28:35-04:00' tags: [] tumblr_url: http://timothymorton.com/post/11522282672/the-origin-of-20-time ---
Six days shall thou hack, and deliver all thy features;
but the seventh day is a sabbath unto Quality of thy Code; in it thou shall not deliver any business value, nor thy tester, nor thy project manager, thy senior developer nor thy junior developer, nor any consultant or contractor that is within thy company.


Berkeley DB: txn_stat
txn_stat
#include <db.h>
int
txn_stat(DB_TXNMGR *txnp,
DB_TXN_STAT **statp, void *(*db_malloc)(size_t));
Description
method creates a statistical structure and copies pointers to it into
user-specified memory locations.
Statistical structure are created in allocated memory.
If
db_malloc is non-NULL, it is called to allocate the memory,
otherwise, the library function malloc(3)) is used.
The function db_malloc must match the calling conventions of
the malloc(3)) library routine.
Regardless, the caller is responsible for deallocating the returned
memory.
To deallocate the returned memory, free each returned memory pointer;
pointers inside the memory do not need to be individually freed.
The transaction region statistics are stored in a structure of type
DB_TXN_STAT. The following DB_TXN_STAT fields will be filled in:
- u_int32_t st_refcnt;
- The number of references to the region.
- u_int32_t st_regsize;
- The size of the region.
- DB_LSN st_last_ckp;
- The LSN of the last checkpoint.
- DB_LSN st_pending_ckp;
- The LSN of any checkpoint that is currently in progress. If
st_pending_ckp is the same as st_last_ckp there
is no checkpoint in progress.
- time_t st_time_ckp;
- The time the last completed checkpoint finished (as returned by
time(2)).
- u_int32_t st_last_txnid;
- The last transaction ID allocated.
- u_int32_t st_maxtxns;
- The maximum number of active transactions supported by the region.
- u_int32_t st_naborts;
- The number of transactions that have aborted.
- u_int32_t st_nactive;
- The number of transactions that are currently active.
- u_int32_t st_nbegins;
- The number of transactions that have begun.
- u_int32_t st_ncommits;
- The number of transactions that have committed.
- u_int32_t st_region_wait;
- The number of times that a thread of control was forced to wait before
obtaining the region lock.
- u_int32_t st_region_nowait;
- The number of times that a thread of control was able to obtain
the region lock without waiting.
- DB_TXN_ACTIVE * st_txnarray;
- A pointer to an array of st_nactive DB_TXN_ACTIVE structures,
describing the currently active transactions. The following fields of
the DB_TXN_ACTIVE structure will be filled in:
- u_int32_t txnid;
- The transaction ID as returned by txn_begin.
- DB_LSN lsn;
- The log sequence number of the transaction-begin record.
The txn_stat
function returns the value of errno on failure, and 0 on success.
Errors
If a fatal error occurs in Berkeley DB, the txn_stat function may fail and return
DB_RUNRECOVERY, at which point all subsequent database calls will also
return DB_RUNRECOVERY.
The txn_stat
function may fail and return errno
for any of the errors specified for the following Berkeley DB and C library
functions:
abort(3),
fcntl(3),
fprintf(3),
getpid(3),
malloc(3),
and
memset(3).
See Also
txn_abort,
txn_begin,
txn_checkpoint,
txn_close,
txn_commit,
txn_id,
txn_open,
txn_prepare,
txn_stat
and
txn_unlink.


| DOSE: |
20 mg |
insufflated |
PCP |
(powder / crystals) |
| |
repeated |
smoked |
Cannabis |
(fresh) |
The night started like any other one. I was chilling with my friends at the hill, smoking a few joints and relaxing. A couple of my friends walked by and told me that they were doing PCP later. I hadn't done any chemical drugs in a long time, as I respect the health of my body to most degrees. For some strange reason though, I decided that tonight was the night to do PCP.
I had experimented with the substance before, but never a strong dose, only little samplers. I know how bad the stuff is for you. I decided to do a full out dose of 20 mg, knowing that would be the perfect amount for me to explore a more full PCP high. I split the 20 mg dose into two seperate lines and inhaled. I decided to wait a few minutes, then smoked another joint to help bring the effects into motion. That's when the energy started to come.
Everything was so intense and extreme. I never had such a sense of what was really real infront of me, which is strange because one would figure that a disassociative would do the opposite. Violent thoughts ran through my head constantly.  Luckily I wasn't so out of control that I acted on these thoughts, though I can understand how a higher dose of this substance would make a person lose that control.
I ran, I jumped, I did pushups for no reason, I was king of my own reality. Everything was so easy to achieve with my hands... but I couldn't think well at all. Matters of might were nothing, yet matters of mental were impossible. They call it dummy dust for a reason.
After returning home, being around 3 hours from taking lines, my roommate was watching the movie Blade 2. What better movie could a man on PCP want? I found myself mesmerized by the blood and gore, wishing that I could take place in the fighting. Did I mention that I'm a passive blood wuss in real life? That's the power of this substance. Anyway, after watching that, it was late and I decided to try my hand at sleep, which I knew wouldn't be easy. I stayed up all that night thinking about kung-fu, then went to work the next day with a massive headache.
That is all.
Use don't abuse.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Following on from my opening post, one of the main hurdles preventing me from blogging was the setup of a blogging platform and the management of the hosting. Thankfully, Octopress and Heroku have provided a simple, effective and free way for me to publish my thoughts to the web. In this post I will explain how I got started with Octopress on Heroku.
 At this point your natural temptation may be to download and compile the source code directly. This will work for the most part, but any seasoned Ruby developer will advice you against this path.
When doing any serious Ruby development you most likely will be working on numerous projects that use a variety of different frameworks, each with their own specific Ruby and Gem version requirements. Managing multiple versions of Ruby and Gems manually is a rather daunting task.
Thankfully this problem has been solved already by RVM and Rbenv. Both RVM and Rbenv provide an isolated Ruby environment, encapsulating Ruby and Gems to specific versions. This allows each Ruby project on your system to run a targeted version of Ruby and Gems per project without concerning yourself with conflicts. I am not going to advocate either of these tools over each other, but I will be using RVM in this article. There are instructions on using Rbenv on the Octopress setup guide.
To install RVM, in Terminal run;
1
|
|
Once RVM has finished installing, you should add it to your shell as a command. Run the following command to update your .bash_profile
.
1
|
|
Finally you should update your Terminal sessions .bash_profile
to load the new profile settings.
1
|
|
Now you’re ready to install Ruby 1.9.2.
1
|
|
This command installs Ruby 1.9.2 as a Gem into your ~/.rvm/gems/
folder. Now within each Ruby application, you can create a .rvmrc
file that defines the Gem sets required by the project. For example, Octopress instructs RVM to use Ruby 1.9.2 by including the following in its .rvmrc
file.
1
|
|
Obtaining Octopress
The best way of getting Octopress is directly from Github. This will require your system to have Git installed. By cloning the Octopress project, obtaining updates in the future will be as easy as git pull origin master
. However you may prefer to fork the project on Github and then clone from your own repository. In this case, I am happy with the standard build of Octopress, so will clone it directly.
1
|
|
This will place an instance of Octopress into my ~/Projects/octopress
folder. You may wish to place it elsewhere, it does not matter where at this time.
Now change directory into the newly created local Git repository and check the Ruby version.
1 2 3 |
|
You should see the Ruby version you previously installed, the exact version number and details will differ depending on your platform and other environment variables. The Ruby environment is controlled by the RVM ~/Projects/octopress/.rvmrc
file I mentioned earlier.
Next we install Bundler into this project.
1 2 |
|
Taken from its own website, Bundler provides the following functionality;
Bundler manages an application’s dependencies through its entire life across many machines systematically and repeatably.
When the bundler install
command is invoked, it reads the required list of Gems from the projects Gemfile
. If you were inspect the Gemfile
for Octopress, you can see the project dependencies.
Finally, to install the default Octopress theme run the following command.
1
|
|
This will setup your local instance of Octopress with the standard theme. In my instance this command failed with the following message.
1 2 3 4 5 |
|
In some circumstances this will happen if you have a newer version of rake installed for whatever reason. Usually the Gemfile and Bundler will resolve these issues, but because both rake 0.9.2
and rake <IP_ADDRESS>
are matched in the Gemfile this conflict is not resolved. However in this case, following prescribed advice provides the expected outcome.
1 2 |
|
Octopress is now installed locally and is ready for you to begin blogging. You can use a plethora of hosting services with Octopress. As Octopress compiles a static version of your site, it would be perfectly possible just to publish the public/
folder to any standard HTTP server such as Apache or Nginx.
Because the contents of public/
folder is compiled by Octopress, by default the Git clone of the project will contain a .gitignore
file with an entry to ignore the public
folder. We need to remove this entry to ensure the public/
folders contents are included in our git repository and pushed upstream.
To remove the entry, edit the .gitignore
file remove the offending line.
Deployment to Heroku
Deployment to Heroku requires an account on Heroku. If you do not have an existing Heroku account, sign up for one now.
I am discovering that as with most things in Ruby, there is usually a Ruby Gem tailored to working with whatever Ruby service you require. Heroku is no different.
To install the Heroku Gem.
1
|
|
Now we have the Heroku Gem available, we can create our Heroku app. This does require an existing Heroku account, so if you still have not signed up with the Heroku service, now really is the time!
Note: To proceed you will need to have a SSH public key. Github have a great guide if you require help.
First we need to tell Heroku about our account. Using the heroku login
command, we can authenticate ourselves with the Heroku service.
1 2 3 4 5 6 |
|
If successful, the heroku login
command will upload our SSH public key automatically to the Heroku service. The reason for this is that you publish to Heroku using Git, and just like any other standard Git remote repository, connection is made over SSH.
Next we create an application on Heroku that will host this blog.
1 2 3 |
|
Well we have an app, but I don’t like the name. Heroku will generate a random name for applications if no name is supplied. After doing some research, I discovered you can provide a name, thus heroku create defreyssinet
would result in an application located at defreyssinet.heroku.com
. However it is not a disaster as we can rename any Heroku application after creating it.
To rename our app, within the ~/Projects/octopress
folder type.
1 2 3 |
|
This has updated the hostname on Heroku and rather neatly tidied up our local Git repository remote entries. It is possible to do this manually by logging on to the Heroku site and renaming the app there, then updating the local git repository remote entries.
1 2 |
|
At this point we have a Heroku app linked to our local Octopress Git repository. We can verify that our app has indeed been created by logging onto Heroku and selecting the My Apps menu item.
Now we have a local instance of Octopress and a host ready to accept our new blog. What is lacking is the content.
Creating a new post
As I mentioned earlier, Octopress is a static site generator rather than a fully fledged web application like Wordpress or Habari. This implies that there is a specific workflow in relation to publishing using Octopress. The typical publication flow for an article is as follows;
- Create an article –
rake new_post["title"]
- Write some content
- Review –
rake generate
- If more work required, return to step 2.
- Publish –
git push heroku <your app>
Before we get ahead of ourselves, it is time to setup the configuration of the blog using the _config.yaml
file found in the root of the project. All of the configuration settings are described in detail on the Configuring Octopress page. Before creating any content it is probably worth familiarizing and editing this file to your specific needs.
Creating an article simply uses the rake new_post["title"]
task. This creates a new file in the ~/Projects/octopress/source/_posts/
folder with a name composed of the date and the title. The extension will be .markdown
as we will be writing in Markdown format.
Note: We will only be working in the source/
folder and we must not touch the public/
folder. The rake generate
task compiles the contents of source/
and places it into public/
.
So lets go ahead and create an article. (I’m prefixing with bundle exec
here to avoid the version complaint seen earlier.)
1
|
|
Rake helpfully creates a new Markdown file called 2012-01-14-get-blogging-with-octopress-on-heroku
in the source/_posts
folder. Opening up the new file will reveal the following.
1 2 3 4 5 6 7 |
|
The header of this file contains some yaml front matter. There are additional options available to control the publication state and author. Personally I think the time of publication is less important, but this is easily fixed by removing the time index from the (Edit: don’t do this as it will mess up article ordering!). I have also turned off comments date:
entrycomments: false
for this post.
It is now possible to add some content to this page in Markdown format. We don’t need a title as the filename will become the title, so don’t start with a # my title
block.
1 2 3 4 5 6 7 8 9 10 11 |
|
With some content in place, we can generate our first blog post using the rake generate
task.
1 2 3 4 5 6 |
|
At this point Octopress has compiled the static version of our site. It is possible to load the public/index.html
folder into any browser to view our new content.
If like me you are using Mac OS X, you can use the POW zero-configuration rack server from 37signals to host your site locally.
With POW installed, the following commands will create a local web server hosting our Octopress site.
1 2 |
|
Now it is simply a case of navigating to http://octopress.dev to see the site we just compiled. This is a really quick and simple way of reviewing changes.
Users on other platforms that wish to test in a server environment locally just need to host their local public/
folder.
Previewing the site should present a page that looks similar to the screenshot below.
Looking good. At this point we can carry on editing and reviewing until we’re happy the post is ready. Remember that each time a change is made, an additional rake generate
task needs to be invoked before any changes will be available in the public/
folder.
Publishing to Heroku
The first post is completed, reviewed and ready for publication. This is where Heroku makes our lives very easy. First we need to check all of our changes into the local Git repository.
1 2 |
|
With the local repository up to date, we can push the repository to Heroku. Once the repository is pushed to Heroku it will be available immediately, so be sure you’re really ready to publish before pushing upstream.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Once the repository is pushed upstream, it will be available from the address configured in the Heroku app. In this case we named the app defreyssinet
so the site will be available from http://defreyssinet.heroku.com.
In conclusion
In this blog post we have covered how to create a blog using the Octopress static site generator and host it on Heroku. In particular we have covered provisioning a local development environment with POW, obtaining Ruby using RVM and cloning the Octopress project from Github. We created a new Heroku application instance using the Heroku cli interface. Then we discovered how the publishing cycle works with Octopress, revolving around the rake generate
task. Finally we pushed the Octopress blog to Heroku for production.
This article only scratches the surface of what Octopress offers, for more information I encourage everyone to read the official documentation.
Octopress will certainly not be to everyones tastes, but I hope this article has provided those with the slightest curiosity about Octopress some impetus to try it from themselves.


{% load i18n %} {% if not request_form.is_bound and not request_form.initial.subject %}
{% blocktrans %}If you want to ask a question that relates to you personally, like how you can achieve something or who you have to contact, you need publicly available information from that public body:{% endblocktrans %}
{% if public_body.url %}{% blocktrans %}Visit the website of this Public Body{% endblocktrans %}{% else %}{% blocktrans %}Click here to go to 115.de - the Public Body Service Hotline{% endblocktrans %}{% endif %}
{% blocktrans %}Please note that you shouldn't use this site to request personal information.{% endblocktrans %}
{% blocktrans %}In order to ask about a political state, you need to talk to people not public bodies. Please ask your Member of Parliament about the topic you are interested in:{% endblocktrans %}
{% blocktrans %}Click here to go to abgeordnetenwatch.de{% endblocktrans %}


I am a graduate of SFSU with a BSCS. Since then, I've spent two decades as a developer and serial entrepreneur.
My web-based skills include javascript, jQuery, Angular, mongoDB, node, and HTML/CSS/Bootstrap.
I live in northern Sonoma County - about 80 miles from San Francisco.


Livestream: FBI Tells Congress They Have Launched a Criminal Investigation Into Epstein Death
As the globalist house of cards collapses, powerful forces of kleptocracy are launching vicious counterattacks – join Alex Jones & share this broadcast!
Alex Jones delivers a bombshell development in the Epstein saga! Share this link!
RELATED: VIDEO: FBI NOW INVESTIGATING EPSTEIN’S DEATH AS A “CRIMINAL ENTERPRISE,” SAYS BOP DIRECTOR
Scan this code with your smartphone to follow Alex Jones on TikTok:
The Black Friday sales have arrived early! Get up to 70% off our hottest products as well as free-shipping and double Patriot Points while the sale lasts!


Explore recipes by region
French Crêpes
Whether sweet or savoury, the classic French Crêpes are perfect for any occasion and any time of day.
North African Chorba
A traditional soup mainly consumed in Morocco, Algeria, Tunisia and Libya during Ramadan


Student | Developer | Hobbyist
I'm Cass Schaufele.
Click here to get started.
Hi There!
I'm that guy in the background - when I'm not working, I'm studying, travelling, or going to hackathons.
I've been coding since high school and through college, and as a result I've picked up skills in front-end and back-end
development, not to mention a focus on user experience and product driven design.
I've also cut my teeth through internships - for more information on that, check out my resume.
Mouse over items for more information.
Also, feel free to contact me if you have any questions!
-
Dealer Tire
Web Development Intern
May 2013 - Aug 2013
At Dealer Tire, I worked with the Internal Libraries team to build a documentation and library integrity dashboard.
In addition, I performed edits on B2B web portals and implemented performance and legibility enhancing changes to several libraries.
-
Tech@Night
TechnicianAugust 2013 - Dec 2013
As a Tech@Night technician with Kent State Information Services, I provided personal technical support to on-campus students. This experience allowed me to gain insight into various technical problems that a user may face.
Also, I voluntarily assisted in the development and maintanance of various internal web apps.
Assistant Manager
Dec 2013 - May 2014
My elevation to assistant manager entailed the adoption of various responsibilities, such as ensuring swift, continuous operation of the Tech@Night service and handling any concerns or complaints fellow employees or users of our service had.
-
Goodyear
Technical Intern - BI, EDW
May 2014 - Dec 2014
As a technical intern with the Business Intelligence team inside Goodyear's Enterprise Data Warehouse, my primary responsibilities included creating detailed reports through SQL and performing maintenance on tables within our database.
I also participated in a number of tangential projects, including a group project to draft governance protocols for the ARIS toolset, the creation of automated Python scripts to perform analytics, and the development of table schema to hold the results of said analytics.
-
Flashstarts
Software Development Intern
My time at the Flashstarts Accelerator was split between two nascent startups: Schedulytics and Triple Analytics.
At Schedulytics, I served as a front-end developer in a team of 5, being responsible for co-designing the look, overall
feel, and layout of a scheduling webapp along with implementing its administrative interface.
With Triple Analytics, I rapidly prototyped an insurance authorization portal which leveraged statistical analysis
on clinical data. Along the way I learned a lot about system design, best practice for web applications, and a lot about HIPPA compliance.


This page shows the existing Log4j2 configuration. It also allows you to modify existing configuration. You can either modify the log level of existing logger or add a new logger.
Configuring properties related to Log4J2 loggers.
INFO - Information messages WARN - Warning messages ERROR - Error messages DEBUG - Debug messages TRACE - Trace messages FATAL - Fatal error messages
Figure 1: Monitor Logs
Log4J2 logger consist of the logger name, logger class and log level.
To add a new logger you need to provide the following,
Figure 2: Configure Log4J2 logger
There are two ways of configuring Log4J2 in WSO2 Carbon. Either by manually editing the log4j2.properties file or through the management console. Changes you made to Log4j2 configuration through the management console are written to log4j2.properties file, therefore those changes will be available after server restarts.


UK medics fight deadly measles outbreak in Samoa
by British High CommissionUK medics will help save lives in Samoa where a fatal outbreak of measles is affecting thousands of people.
The group of 13 British doctors and nurses left the UK for the Pacific island today (Friday, November 29) to help children who are suffering.
The support from the UK-aid funded UK’s Emergency Medical Team (UK EMT) follows an urgent request for British expertise from the Samoan government and the Australian Medical Assistance Team (AusMAT), who have spent the last two weeks tackling the outbreak.
Over 2,900 people in Samoa have so far been infected, and 39 people, including 35 children under four have died. A further 250 new cases were recorded in the last 24 hours.
Measles is a highly contagious virus that can spread to others through coughing and sneezing.
Each case can infect many other people and complications can lead to pneumonia, severe diarrhoea and encephalitis or inflammation of the brain.
The UK medics will focus on helping patients recover from these complications.
Over the past few years, childhood immunisation rates including measles has dropped significantly in Samoa making the country highly vulnerable to outbreaks. The majority of measles cases diagnosed in Samoa have been children and 90% of all deaths so far are of children under the age of five.
International Development Secretary Alok Sharma said:
“This deadly measles outbreak is having a devastating impact on the people of Samoa, particularly children, who urgently need our help.”
“The UK is stepping up to do all we can to prevent the further loss of life.”
The UK team’s work to treat Samoan children is part of a wider international push by UK aid to stop premature deaths, including through vaccinating against preventable diseases.
DFID supports various organisations that work to strengthen global health including the World Health Organisation, UNICEF and Gavi, an international vaccine alliance, who are hosting a replenishment summit in the UK next year.
The UK team flew out from Manchester Airport today and are expected to arrive in Samoa on Sunday, where they will embed with AusMAT, initially for two weeks.
Their work will begin in the main hospital in Samoa’s capital Apia on Monday morning.
UK-Med CEO David Wightwick said:
“Our mission is that people affected by disease outbreaks, conflict or natural disasters around the world receive the best quality emergency healthcare. Alongside our partners Humanity & Inclusion we’re pleased to be able to support our AUSMAT and Samoan healthcare colleagues who have been working tirelessly to save lives and alleviate suffering.
“We’re grateful that our team of dedicated clinicians are able to provide expert and specialist care to those affected by the measles outbreak in Samoa with funding from UK Aid from the British people”.


Modules
| artisanry | The main Artisanry object that holds and manages all receipts. |
| blueprint | The Blueprint is a receipt used by Artisanry. |
| artisanryutil | Converts the given input from strings to ItemStacks. |
| artisanryui | artisanryui is a static, global object that allows to replace the inventory with the Artisanry one. |


--- layout: post title: "The 80/24 rule" date: 2019-11-04 6:51 UTC description: "Write small blocks of code. How small? Here's how small." tags: [Code] image: "/content/binary/vertical-guideline-at-80-characters.png" image_alt: "Screen shot of editor with code, showing red vertical line at 80 characters." --- {% include JB/setup %}
{{ page.description }}
One of the most common questions I get is this:
If you could give just one advice to programmers, what would it be?
That's easy:
Write small blocks of code.
Small methods. Small functions. Small procedures.
How small?
You can't give a universally good answer to that question. Among other things, it depends on the programming language in question. Some languages are much denser than others. The densest language I've ever encountered is APL.
Most mainstream languages, however, seem to be verbose to approximately the same order of magnitude. My experience is mostly with C#, so I'll use that (and similar languages like Java) as a starting point.
When I write C# code, I become uncomfortable when my method size approaches fifteen or twenty lines of code. C# is, however, a fairly wordy language, so it sometimes happens that I have to allow a method to grow larger. My limit is probably somewhere around 25 lines of code.
That's an arbitrary number, but if I have to quote a number, it would be around that size. Since it's arbitrary anyway, let's make it 24, for reasons that I'll explain later.
The maximum line count of a C# (or Java, or JavaScript, etc.) method, then, should be 24.
To repeat the point from before, this depends on the language. I'd consider a 24-line Haskell or F# function to be so huge that if I received it as a pull request, I'd reject it on the grounds of size alone.
Most languages allow for flexibility in layout. For example, C-based languages use the ;
character as a delimiter. This enables you to write more than one statement per line:
var foo = 32; var bar = foo + 10; Console.WriteLine(bar);
You could attempt to avoid the 24-line-height rule by writing wide lines. That would, however, be to defeat the purpose.
The purpose of writing small methods is to nudge yourself towards writing readable code; code that fits in your brain. The smaller, the better.
For completeness sake, let's institute a maximum line width as well. If there's any accepted industry standard for maximum line width, it's 80 characters. I've used that maximum for years, and it's a good maximum.
Like all other programmers, other people's code annoys me. The most common annoyance is that people write too wide code.
This is probably because most programmers have drunk the Cool Aid that bigger screens make you more productive. When you code on a big screen, you don't notice how wide your lines become.
There's many scenarios where wide code is problematic:
Notice the red dotted vertical line that cuts through universe
. It tells me where the 80 character limit is.
The 80-character limit has a long and venerable history, but what about the 24-line limit? While both are, ultimately, arbitrary, both fit the size of the popular VT100 terminal, which had a display resolution of 80x24 characters.
A box of 80x24 characters thus reproduces the size of an old terminal. Does this mean that I suggest that you should write programs on terminals? No, people always misunderstand this. That should be the maximum size of a method. On larger screens, you'd be able to see multiple small methods at once. For example, you could view a unit test and its target in a split screen configuration.
The exact sizes are arbitrary, but I think that there's something fundamentally right about such continuity with the past.
I've been using the 80-character mark as a soft limit for years. I tend to stay within it, but I occasionally decide to make my code a little wider. I haven't paid quite as much attention to the number of lines of my methods, but only for the reason that I know that I tend to write methods shorter than that. Both limits have served me well for years.
Consider this example:
public ActionResult Post(ReservationDto dto) { var validationMsg = Validator.Validate(dto); if (validationMsg != "") return BadRequest(validationMsg); var reservation = Mapper.Map(dto); var reservations = Repository.ReadReservations(reservation.Date); var accepted = maîtreD.CanAccept(reservations, reservation); if (!accepted) return StatusCode( StatusCodes.Status500InternalServerError, "Couldn't accept."); var id = Repository.Create(reservation); return Ok(id); }
This method is 18 lines long, which includes the method declaration, curly brackets and blank lines. It easily stays within the 80-character limit. Note that I've deliberately formatted the code so that it behaves. You can see it in this fragment:
return StatusCode( StatusCodes.Status500InternalServerError, "Couldn't accept.");
Most people write it like this:
return StatusCode(StatusCodes.Status500InternalServerError, "Couldn't accept.");
That doesn't look bad, but I've seen much worse examples.
Another key to writing small methods is to call other methods. The above Post
method doesn't look like much, but significant functionality could be hiding behind Validator.Validate
, Repository.ReadReservations
, or maîtreD.CanAccept
. I hope that you agree that each of these objects and methods are named well enough to give you an idea about their purpose.
As I describe in my Humane Code video, the human brain can only keep track of about seven things. I think that this rule of thumb applies to the way we read and interpret code. If you need to understand and keep track of more than seven separate things at the same time, the code becomes harder to understand.
This could explain why small methods are good. They're only good, however, if they're self-contained. When you look at a method like the above Post
method, you'll be most effective if you don't need to have a deep understanding of how each of the dependencies work. If this is true, the method only juggles about five dependencies: Validator
, Mapper
, Repository
, maîtreD
, and its own base class (which provides the methods BadRequest
, StatusCode
, and Ok
). Five dependencies is fewer than seven.
Another way to evaluate the cognitive load of a method is to measure its cyclomatic complexity. The Post
method's cyclomatic complexity is 3, so that should be easily within the brain's capacity.
These are all heuristics, so read this for inspiration, not as law. They've served me well for years, though.
You've probably heard about the 80/20 rule, also known as the Pareto principle. Perhaps the title lead you to believe that this article was a misunderstanding. I admit that I went for an arresting title; perhaps a more proper name is the 80x24 rule.
The exact numbers can vary, but I've found a maximum method size of 80x24 characters to work well for C#.
Comments
As a matter of fact, terminals had 80 characters lines, because IBM punch cards, representing only 1 line, had 80 symbols (even though only the first 72 were used at first). However, I don't know why terminals settled for 24 lines! In Java, which is similar to C# in term of verbosity, Clean Code tend to push towards 20-lines long functions or less. One of the danger to make functions even smaller is that many more functions can create many indirections, and that becomes harder to keep track within our brains.
Some additional terminal sizing history in Mike Hoye's recent similarly-named post: http://exple.tive.org/blarg/2019/10/23/80x25/ Spoiler - Banknotes!


New Sonic the Hedgehog Trailer Features an Improved Sonic!
by Max EvryAfter months of waiting to get the first full look at the improved design for the Sonic the Hedgehog movie, Paramount Pictures has debuted the new trailer! Check out the new Sonic the Hedgehog trailer below!
RELATED: James Cameron Talks Clashes With Tim Miller on Terminator: Dark Fate
The film was originally set to hit theaters this past weekend but after very negative reviews from audiences surrounding the design of the iconic character, Paramount delayed the release to February 14, 2020 with the goal of redesigning Sonic to better fit his look from the video games.
Written by Patrick Casey (Golan the Insatiable), Josh Miller (Golan the Insatiable) and Oren Uziel (The Cloverfield Paradox), the film follows Tom Wachowski, a cop in the rural town of Green Hills, who decides to help Sonic escape from the government looking to capture him. The film is directed by Jeff Fowler and executive produced by Tim Miller (Terminator: Dark Fate).
RELATED: Sonic The Hedgehog Redesign Will Please Fans, Says Producer Tim Miller
The cast for Sonic the Hedgehog includes Jim Carrey (Kidding) as Sonic’s rival, Doctor Robotnik/Eggman, James Marsden (Westworld) as Wachowski, a police officer who teams up with Sonic; Adam Pally (The Mindy Project) as Tom’s fellow police officer, Tika Sumpter (Ride Along) , and Natasha Rothwell (Wonder Woman 1984). Ben Schwartz (Parks and Rec) provides the voice for Sonic in the film.
Sonic the Hedgehog and his all-new look will now hit theaters on Valentine’s Day, 2020.


Home
Get a Quote
Contract History
Browse Offers
Mint IntSwap
Withdraw
FAQ
Make a Withdrawal
Matured IntSwaps
TM
Contract
Contract Number:
Payout Available:
Transfer to address:
Amount to Withdraw:
Withdraw


Temperatures average 57°F (14°C) in January and 82°F (28°C) in July and there is high humidity. The best period is the autumn, October to December. May to September is hot and humid, with occasional typhoons.
For links to free global weather information, forecast services and extreme weather information see the Noonsite Weather Page.
* indicates port of entry


class AssetManager |
|
class BMPImporter |
|
data class BlockCoordinate
The main coordinate system used in this game. Everything is on an X-Y grid and we use this all over the place. You will see "blocks", "tiles", etc. This is our unit of measure... it is our KotCity atom. |
|
object CityFileAdapter : Debuggable |
|
data class CityMap
A map representing the city. The map hangs on to Buildings and Locations. The map is set up as a grid of BlockCoordinate and various layers hanging onto various values (desirability, crime, etc). |
|
data class CityTradeEntity : TradeEntity |
|
data class Contract : Debuggable |
|
object ContractChecker : Debuggable |
|
data class DesirabilityLayer : QuantizedMap<Double>
Represents a grid of "desirability values" that we store in the CityMap |
|
data class District |
|
class Inventory |
|
data class Location
Represents a pair of a building and its location in the city. |
|
class MapGenerator |
|
enum class MapMode |
|
data class MapTile |
|
data class NationalTradeEntity : HasContracts, HasInventory |
|
data class OutsideTradeEntity : TradeEntity, HasContracts, HasInventory |
|
object Prices |
|
open class QuantizedMap<T> |
|
object Slug |
|
enum class TileType
Represents if we have ground or water |
|
interface TradeEntity |
|
enum class Tradeable |
|
class TradeableCounter |
|
object Tunable |
|
enum class Zone
Type of zone, R/C/I |
|
data class Zot |
|
enum class ZotType |


Selenium
v.
Monitoring JavaMelody
Selenium
console
For more information about Selenium
please see the
docs
and/or visit the
wiki
.
Happy Testing!


[§425E-1113] Article not exclusive. This article shall not preclude an entity from being converted or merged under other law. [L 2003, c 210, pt of §1]


You want to format the message before it's written
The logger has several log destinations
The output goes to console and debug output window
Formatting - prefix each message by its index, and append newline
Optimizations:
use tss_ostringstream (each thread has its own ostringstream copy, to make writing faster: when logging of a message, we won't need to create the ostringstream first ; it's created only once per thread )
use a cache string (from optimize namespace), in order to make formatting the message faster
In this example, all output will be written to the console and debug window. It will be:
[1] this is so cool 1
[2] this is so cool again 2
[3] this is too cool 3


Everyone's Progress
Everyone:
- Transfer their important files to the main glitch project
- Prepare for Tuesday's MVP Presentation
CJ Lin:
- Improved shooting physics
- Helped debug shooting mechanics
Peter Michael:
- Got webserver to host website and run properly
- Streamed 2D pose estimation to website
Yan Zhe Ong:
- Worked wit Jasmine to debug shooting mechanics
Jasmine Woon:
- Worked with Yan to debug shooting mechanics
- Made the MVP video
Updates on Code
Everyone's code is now located in our gitlab! Intergration with everyone's part went more smoothly than expected. Everyone hopped on a call and using a shared glitch project, we carefully copied and pasted what was necessary for our MVP.
Our web server is hosted on the GPU. The Link can be found here! You may be warned that this site is risky but we promise this is not a malicious website! Click on advance settings and proceed on with the website
Alternatively, you can find our MVP here on glitch. The only difference between the two website is gltich will not incorperate the 2D pose estimation.
Updates on Ideas
With the MVP due this past week, everyone has been busily working on bugs and integration. As a result, we did not have much time to work on target features.
We also worked on presentation for our MVP. Check out our slides! In addition, check out our MVP video down below!
Plan for Next Week
Here are a couple of milestones that everyone plans on doing
Everyone:
- Incorperate feedback from the class and fix any bugs
CJ Lin:
Goals for Friday 5/7
- Work on menu overlays
Peter Michael:
Goals for Friday 5/7
- Work with Jasmine on getting the ability to place the hoop
Yan Zhe Ong:
Goals for Friday 5/7
- Rig 3D models from our TA, Luyang, NBA2K dataset
Jasmine Woon:
Goals for Friday 5/7
- Work with Peter on getting the ability to place the hoop
Blocking Issues
No blocking issue for now...


Learn automation by doing it. Right now, right here, in your browser.
NRE Labs is a no-strings-attached, community-centered initiative to bring the skills of automation within reach for everyone. Through short, simple exercises, all right here in the browser, you can learn the tools, skills, and processes that will put you on the path to becoming a Network Reliability Engineer.
NRE Labs assumes nothing about your background or training. Everything is contained in the browser, and there's something here for everyone.
This is first and foremost an educational tool aimed at helping the industry consume automation more readily. So you won't find any paywalls or creepy web trackers here.
NRE Labs is built on Antidote, an open source project published on Github under an Apache v2 license to make industry-wide participation a first-class citizen.


4 squares will appear on the screen, each a different color
Click the
red square as quickly as you can.
There will be 5 attempts followed by your results
Click in this box to start
results
Step 1: Enter your name and age in the box provided
Name:
Age:


The results of the "%OPERATORNAME%" calculation which was presented as: %FIRST% %OPERATOR% %SECOND% is....%RESULT%. You can perform another calculation here: %SHOWENTRY%


HELLO EVERYONE
This is the Research Project that is made to create media access for everyone with best controlling experience
MUSIC
Godzilla by Eminem
A New famous hit by Eminem
This is the Research Project that is made to create media access for everyone with best controlling experience
A New famous hit by Eminem


Salmon Cookies
Info About Salmon Cookies
Founded by Pat, 2016
Email Salmon Cookies!
Hours of Operation
Mon-Fri: 6am - 6pm
Check Out Our New Locations!
1st and Pike
SeaTac Airport
Seattle Center
Capitol Hill
Alki


Warnings for your attention
Review the following details:
Review your cohort
25
Apprentices
10
Incomplete records
£29,002
Total cost
Employer:
Acme Coventry Ltd
Reference:
98HGS3F
Note:
No note added
4 Mechatronics Engineers
Level: 4
Training code: 3246
2 Mechatronics Engineer apprenticeships above funding band maximum
The costs are above the £2,000 maximum value of the funding band for this apprenticeship. You'll need to pay the difference directly to the training provider - this can't be funded from your account.
| Name | Date of birth | Training dates | Cost | |
|---|---|---|---|---|
| Fidel McDuffy | 10 December 2001 | 11/2018 to 11/2020 | "£2,000 | Edit |
| Anna Folk | ---- | 11/2018 to 11/2020 | £2,200 | Edit |
| Kevin Field | 16 May 1999 | 11/2018 to 11/2020 | £1,500 | Edit |
| Billy Smith | 30 September 2001 | 11/2018 to 11/2020 | £2,200 | Edit |
2 Bakers
Level: 3
Training code: 9287
1 Bakery apprenticeship above funding band maximum
The costs are above the £2,000 maximum value of the funding band for this apprenticeship. You'll need to pay the difference directly to the training provider - this can't be funded from your account.
| Name | Date of birth | Training dates | Cost | |
|---|---|---|---|---|
| Fidel McDuffy | 1 October 2000 | 11/2018 to 11/2020 | £2,000 | Edit |
| Anna Folk | 30 June 2001 | 11/2018 to 11/2020 | £2,400 | Edit |


Latest
Get updates on new articles and trainings.
Join over 1400 other developers who get our content first.
More Articles
-
schedule Jun 23, 2014 create Christoph Burgdorf
Announcing our first workshop
As announced earlier this month, we were working on our website to launch it as soon as possible. The time has come!
-
schedule Jun 6, 2014 create Pascal Precht
We are thoughtram
We enjoy learning new stuff every day and we love teaching it to others even more.
Subscribe to our RSS Feed
Angular Master Class
Learn Angular in one of our upcoming public trainings or in-house workshops.
Join nowAngular
-
schedule Jul 26, 2017 create Dominic Elm
A web animations deep dive with Angular
Angular comes with a built-in animation system that lets us create powerful animations based on the Web Animations API. In...
-
schedule May 23, 2017 create Pascal Precht
Custom themes with Angular Material
Angular Material offers great theming capabilities for both, built-in and custom themes. In this article we'll explore how to make...
-
schedule May 8, 2017 create Pascal Precht
Angular Master Class - Redux and ngrx
Today we're super excited to announce that we finished working on our new Angular Master Class courseware. Read on for...
-
schedule Feb 27, 2017 create Christoph Burgdorf
Three things you didn't know about the AsyncPipe
This article explains three lesser known features of the AsyncPipe that help us to write better async code.
-
schedule Feb 21, 2017 create Pascal Precht
Using Zones in Angular for better performance
In this article we'll take a look at how to use Zone APIs to improve our app's performance!
-
schedule Feb 2, 2017 create Pascal Precht
Making your Angular apps fast
In this article we discuss tips and tricks to make Angular blazingly fast!
Git
-
schedule Feb 10, 2015 create Christoph Burgdorf
Understanding branches in Git
In this article we will take a deep dive into Git branches. We'll see how simple yet powerful the concept...
-
schedule Nov 18, 2014 create Christoph Burgdorf
The anatomy of a Git commit
In this article we explore what a Git commit looks like internally and how Git uses cryptographic tooling to enforce...
-
schedule Nov 2, 2014 create Christoph Burgdorf
Git Ninja Class in Amsterdam
We are very happy to announce that, with the help of our new partner De Voorhoede, we'll bring our Git...
-
schedule Aug 18, 2014 create Christoph Burgdorf
Going back in time to split older commits
Rebasing in Git allows you to go back in time to split older commits. In this article we'll explore how...
-
schedule Jul 5, 2014 create Pascal Precht
Git Ninja Class comes to Istanbul
Today we are happy to announce that our Git Master Class is coming to Istanbul! Read everything about this event...
-
schedule Jul 4, 2014 create Pascal Precht
Tickets are on sale now!
It's on! You can now buy the first bunch of tickets for our Git Ninja Class workshop in Hannover, Germany!...
Exploring Angular 1.3
-
schedule Jan 23, 2015 create Pascal Precht
ngMessages in Angular 1.3
In this article we're going to how the ngMessages module improves the way we handle validation messages when dealing with...
-
schedule Jan 14, 2015 create Pascal Precht
Go fast with $applyAsync in Angular 1.3
Angular 1.3 comes with a feature to share a running $digest cycle across multiple XHR calls. This articles details how...
-
schedule Jan 11, 2015 create Pascal Precht
Validators Pipeline in Angular 1.3
In this article we discuss a newly introduced feature called custom validators, so we don't have to hijack parsers and...
-
schedule Jan 2, 2015 create Pascal Precht
Binding to Directive Controllers in Angular 1.3
In this article we are going to take a look how to bind values to directive controllers to make them...
-
schedule Dec 22, 2014 create Pascal Precht
Disabling Debug Info in Angular 1.3
This article details how to give your app a performance boost in production environments with just a single line of...
-
schedule Dec 18, 2014 create Pascal Precht
ES6 Style Promises in Angular 1.3
Angular 1.3 starts streamlining its promise APIs with the ES2015 standard. This article details what these additions mean to us....
5thingsAngular
Get weekly updates on the latest and greatest happenings in the Angular world by thoughtram!
Tell me more


Connecting to Device
of
updated.
Add 5 to all my mobile numbers
Remove 5 to all my mobile numbers
By
Louis Oberlé


HOME
SERVICES
PROFILE
CONTACT
Get in touch with us!
Full Name
Email Address
Phone Number
Best Contact Method
Phone
Email
Message
Submit
© Copyright 2017 Kingston Media | All Rights Reserved | Site by
FHKP


Wellness Resources
HCW-HOSTED offers free mental health and wellness support to healthcare workers enrolled in the program. Healthcare workers may experience significant physical, psychological, social and financial stress while responding to the COVID19 pandemic.
These stressors are complicated by being physically distanced from loved ones and “normal routines” of coping.
HCW HOSTED’s ICARE Team is offering mental health and wellness services aimed at offering additional support and connection during this time.
Why
Let’s be real – the stress experienced by our healthcare workers could be beyond words. And, this is a long haul. Common reactions from this stress come in many forms (e.g., grief, anxiety, irritability, headaches, confusion, sleep disruption, changes in appetite, etc). On top of this HCW HOSTED workers are away from their loved ones and natural support systems or ‘normal’ coping resources.
We know people are resilient and will bounce back. And, we also know that connection is an antidote for resilience. SO - HCW HOSTED ICARE team’s mission is simple – we offer mental health and wellness supportaimed at promoting connection and mitigating the impact of this stress.
What
HCW HOSTED ICARE offers mental health support for healthcare workers enrolled in the HCW HOSTED program. Specifically, a group support meeting and individual mental health consultations are available. These meetings are private and confidential.
HCW HOSTED ICARE Team also is available to support HCW HOSTED members in connecting with existing mental health resources availablein the community (e.g., facilitating referrals through insurance providers, healthcare systems EAPs programs, etc.).
Who
Any HCW HOSTED members is eligible to receive ICARE support services.
HCW HOSTED’s ICARE team staffed by licensed mental health provider volunteers who have completed additional training in psychological first aid.
When
ICARE support meetings occur Mondays at 4pm and Tuesdays at 8pm (AZT). Individual consultations are available by request by emailing<EMAIL_ADDRESS>Where
HCW HOSTED members can join the ICARE meetings online using secured, private video conferencing software.
Your Wellness
HCW HOSTED’s ICARE is dedicated to building out connections to support our members wellness needs. We want to hear from you! Let us know what would help you during this time! An organized yoga session? Or an online bicycling meetup? Contact us on social media (see bottom of page), or email us at<EMAIL_ADDRESS>-
Substance Abuse and Mental Health Services Administration Disaster Distress Helpline:
1-800-985-5990
-
National Suicide Prevention Lifeline
1-800-273-TALK (8255)
-
Physician Support Line:
A physician (attending, resident, fellow or med student) can call 1-888-409-0141 between the hours of 8am to 1am ET 7 days a week and immediately gets connected to a US licensed psychiatrist to discuss any subject.
-
Psychiatry for All Physicians
Online closed physician group for all specialties interested in learning about psychiatry.
-
Netflix Watch Party
Watch a movie in sync with your remote friends, need Netflix app and Chrome browser, as well as Netflix subscription for anyone watching
-
Headspace App
Paid version currently free to end of year (need NPI #)
-
PFA Mobile (VA)
and PFA
Tutorial (U. of Minnesota)
Two apps about administering psychological first aid
- UCLA Mindfulness App
-
ACT Companion: The Happiness Trap
This free app, The ACT Companion: The Happiness Trap, will be available for free for the next few months. One of the creators is Russ Harris who is a very respected ACT therapist in Australia. Just use the code “TOGETHER” on the subscription page. (ACT stands for “Acceptance and Commitment Therapy, a relative new form of CBT that we practice a lot in our office)
-
A relatively new meditation app for people of color. It includes talks and meditations led by fabulous teachers, including Ruth King, Gina Sharpe, and Sebene Selassie.
-
Use of app extended to 90 days (usually 14 days)—it’s amazing, you can use on treadmill, outdoor runs, bike, lots of floor exercise, yoga and meditation
-
60-day free trial (usually 30 days), click on 30-day trial, use promo code EXTENDEDTRIAL and trial will go to 60 days and $0
-
Link to YouTube videos
-
30-day free streaming trial
-
Children's book "What is Corona Virus?" by Christine Borst, PhD, LMFT
-
For kids/families to learn about COVID-19
-
Center for the Study of Traumatic Stress
Helping Homebound Children Parent/Caregiver Helping Families Cope
-
Education about Coronavirus for children with autism
-
Audio stories for children Access thousands of e-books and audible books from the public library
-
3 months free access to learn a language
-
Watch 15 Broadway plays and musicals online
-
List of free virtual museum tours
-
Learn to draw with Mo Willems, artist
-
Daily videos with featured animals
-
Movement and mindfulness videos
-
Free yoga and mindfulness videos (and on YouTube), app free for 2 weeks
-
Learn dance routines by watching videos Mindful Schools is offering a daily mindfulness class for children on Tuesdays, Wednesdays, and Thursday at 1 pm EDT. Gene Beresin, MD, provides tips on how to discuss coronavirus with children. For information on Mass General Hospital's response to coronavirus visit YouTube
-
My Hero Is You: How Kids can Fight COVID-19
A lovely storybook for children on COVID-19. Free. Developed by a UN subgroup.They went through an extensive process-- involving 1,700 children, teachers, and caregivers-- to create this book to support children and their mental health around the stressors of Covid-19. You can read about the process as well as the various language translations
-
Center for the Study of Traumatic Stress
Comprehensive list of patient resources
-
UCLA Center for Autism Research and Treatment
Comprehensive list of resources for addressing COVID-19 issues for patients with autism
-
Substance Abuse and Mental Health Services Administration (SAMHSA)
24/7 helpline for assisting patients in finding referrals to treatment Domestic Violence e-tool.
-
COVID19 Harm Reduction Guidelines for Substance Use
From the Yale Program in Addiction Medicine
-
Mental Health and Psychosocial Aspects of COVID-19 Outbreak
Can be used to help you address your patients Discussion about the most commonly asked questions when starting telepsychiatry; must “purchase” but cost is free
-
Information for patients who are hourly workers Inexpensive and : Purchase online and have delivered to use for working at home (note shipping is $49, but overall price still fairly inexpensive) Another and Option: Purchase online and deliver or pick-up from store
-
Psychiatry of Pandemics: A Mental Health Response to Infection Outbreak
Prescient book written in 2019


Redis (REmote DIctionary Service) is an open-source networked in-memory key-value data store. First released in 2009, currently sponsored by VMware, and since then it have been ranked the most popular key-value store by DB-Engine. Redis creator Salvatore Sanfilippo refers to his project as a “data structure server” to capture its unique handling of complex data types and other features. Interested ? Enough talking, let’s get down to business.
Download Redis installer from here.
Installation is straight forward:
Start the Server go to Control Panel >> Administrative Tools >> Services , right click Redis Server and select Start.
Start the Client look for Redis Client (with red cube icon) in your start menu and open it. As you see it listens to port 6379 by default. You could ping your server by writing PING, if everything is good you will get PONG in return.
As we said before, Redis is a key-value store. We store value inside a key and retrieve it later using that key. We can use the command SET to store the value “fido” at key “server:name” (server replies with Ok if everything is good) (Note that we used colons [:] within our key. This is a valid character that often logically separates a key into segments. It’s merely a matter of convention, with no deeper meaning in Redis.)
SET server:name "fido"
To retrieve our value, we use GET command (server replies with “fido”)
GET server:name
You could also delete a given key and its associated value using DEL command and you can check for key existence using EXISTS (1 exists, 0 otherwise). We get and set multiple values in one command using MSET & MGET
MSET 1 valueA 2 valueB
MGET
1 2
Although Redis stores strings, it recognizes integers and provides some simple operations for them. If we want to keep a running total of something, we can create a count and then increment it with the INCR command (gives error for noninteger values).
SET count 2
INCR count
GET count
You can also increment by any integer (INCRBY) or decrement (DECR, DECRBY).
It is good to know that these simple operations are atomic in Radis.
You can tell Radis to hold a key only for a certain period of time (in seconds) using EXPIRE command. You can test how long a key will exist for with the TTL command. It returns the number of seconds until it will be deleted (-1 means the key will never expire). All keys are permanent by default.
Setting and expiring keys is so common that Redis provides a shortcut command called SETEX. Also at any moment before the key expires, you can remove the timeout by running PERSIST KeyName.
A common trick for keeping only recently used keys is to update the expire time whenever you retrieve a value. This will ensure that your most recently used keys will remain in Redis, while the least recently used keys will just expire as normal.
Redis like most DBMSs supports transactions. We begin the transaction with the MULTI command and execute it with EXEC command. So, wrapping two operations like SET and INCR in a single block will complete either successfully or not at all.
As you may guess from the server response inside the transaction, commands are not executed instantly. Instead, they are queued and then executed in sequence.
Similar to ROLLBACK in SQL, you can stop a transaction with the DISCARD command, which will clear the transaction queue. Unlike ROLLBACK, it won’t revert the database; it will simply not run the transaction at all. The effect is identical, although the underlying concept is a different mechanism (transaction rollback vs. operation cancellation).
Radis can store lists, hashes, sets, and sorted sets natively. These collection data types can contain a huge number of values (up to 2^32 elements or more than 4 billion) per key. That’s more than enough for all Facebook accounts to live as a list under a single key.
A list is a series of ordered values that can act both as queues (first value in, first value out) and as stacks (last value in, first value out). Some of the important commands for interacting with lists are RPUSH, LPUSH, LLEN, LRANGE, LPOP, and RPOP. You can immediately begin working with a key as a list, as long as it doesn’t already exist as a different type.
It really interesting to know that Redis provides message queuing APIs natively. So, assume you want to write a simple messaging system where multiple clients can push data to one side of the queue and one or more listeners pop data from the other side of the queue. Listeners should just listen for new data and pop them as they arrive.
now open another Redis client window and push a message into messages list
if you switched back to the blocking BRPOP command window, you will find it return the key, the popped value, and the time spent blocking
Sets are unordered collections with no duplicate values and are an excellent choice for performing complex operations between two or more key values, such as unions or intersections.
Sorted set is similar to a regular set, but now each value has an associated score. This score is used to sort the elements in the set. Sorted sets take something from each of the other collections data types. They are ordered like lists and are unique like sets. They have field-value pairs like hashes, but rather than string fields, they are instead numeric scores that denote the order of the values. Internally, sorted sets keep values in order, so inserts can take log(N) time to insert (where N is the size of the set), rather than the constant time complexity of hashes or lists.
ZUNIONSTORE Computes the union of numkeys sorted sets given by the specified keys, and stores the result in destination set. It is mandatory to provide the number of input keys (numkeys) before passing the input keys and the other (optional) arguments. Parameters needed:
In the above example we prepared two sorted sets, sset1 with elements (1 “one” 2 “two”) , sset2 with elements (1 “one” 2 “two” 3 “three”). Then tell Redis to merge these two sets with the following parameters:
Hash is a collections object that can hold any number of key-value pairs.
You may have been wondering, which database we working on. So far, we have interacted only with a single namespace. In Redis’s terminology, a namespace is called a database and is keyed by a number. S o far, we’ve always interacted with the default namespace 0 (also known as database 0).
This can be useful for running different applications against a single Redis server but still allow these multiple applications to trade data between each other.
Redis’s data types and the complex queries it can perform make it much more than a standard key-value store. It can act as a stack, queue, or priority queue; can be an object store (via hashes); and even can perform complex set operations such as unions, intersections, and subtractions (diff). It provides many atomic commands, and for those multistep commands, it provides a transaction mechanism. It has a built-in ability to expire keys, which is useful as a cache.
In this post we just introduced Redis as a data structure server. In later post we going to cover the advanced features of Redis.