Answers to Front-end Job Interview Questions - CSS Questions. Pull requests for suggestions and corrections are welcome!
float
s and how they work.
* { box-sizing: border-box; }
do? What are its
advantages?
display
property and can you give a few
examples of its use?
inline
and
inline-block
?
relative
,
fixed
, absolute
and static
ally
positioned element?
translate()
instead of absolute
positioning,
or vice-versa? And why?
The browser determines what styles to show on an element depending on the
specificity of CSS rules. We assume that the browser has already
determined the rules that match a particular element. Among the matching
rules, the specificity, four comma-separate values,
a, b, c, d
are calculated for each rule based on the
following:
a
is whether inline styles are being used. If the property
declaration is an inline style on the element, a
is 1, else
0.
b
is the number of ID selectors.c
is the number of classes, attributes and pseudo-classes
selectors.
d
is the number of tags and pseudo-elements selectors.
The resulting specificity is not a score, but a matrix of values that can
be compared column by column. When comparing selectors to determine which
has the highest specificity, look from left to right, and compare the
highest value in each column. So a value in column b
will
override values in columns c
and d
, no matter
what they might be. As such, specificity of 0,1,0,0
would be
greater than one of 0,0,10,10
.
In the cases of equal specificity: the latest rule is the one that counts. If you have written the same rule into your stylesheet (regardless of internal or external) twice, then the lower rule in your style sheet is closer to the element to be styled, it is deemed to be more specific and therefore will be applied.
I would write CSS rules with low specificity so that they can be easily
overridden if necessary. When writing CSS UI component library code, it is
important that they have low specificities so that users of the library
can override them without using too complicated CSS rules just for the
sake of increasing specificity or resorting to !important
.
margin
s,
padding
s, font-size
s of all elements are reset
to be the same. You will have to redeclare styling for common
typographic elements.
I would choose resetting when I have a very customized or unconventional site design such that I need to do a lot of my own styling and do not need any default styling to be preserved.
float
s and how they work.
Float is a CSS positioning property. Floated elements remain a part of the
flow of the page, and will affect the positioning of other elements
(e.g. text will flow around floated elements), unlike
position: absolute
elements, which are removed from the flow
of the page.
The CSS clear
property can be used to be positioned below
left
/right
/both
floated elements.
If a parent element contains nothing but floated elements, its height will be collapsed to nothing. It can be fixed by clearing the float after the floated elements in the container but before the close of the container.
The .clearfix
hack uses a clever CSS
pseudo selector
(:after
) to clear floats. Rather than setting the overflow on
the parent, you apply an additional class clearfix
to it.
Then apply this CSS:
Alternatively, give overflow: auto
or
overflow: hidden
property to the parent element which will
establish a new block formatting context inside the children and it will
expand to contain its children.
z-index
and how stacking context is formed.
The z-index
property in CSS controls the vertical stacking
order of elements that overlap. z-index
only affects elements
that have a position
value which is not static
.
Without any z-index
value, elements stack in the order that
they appear in the DOM (the lowest one down at the same hierarchy level
appears on top). Elements with non-static positioning (and their children)
will always appear on top of elements with default static positioning,
regardless of HTML hierarchy.
A stacking context is an element that contains a set of layers. Within a
local stacking context, the z-index
values of its children
are set relative to that element rather than to the document root. Layers
outside of that context — i.e. sibling elements of a local stacking
context — can’t sit between layers within it. If an element B sits on top
of element A, a child element of element A, element C, can never be higher
than element B even if element C has a higher z-index
than
element B.
Each stacking context is self-contained - after the element’s contents are
stacked, the whole element is considered in the stacking order of the
parent stacking context. A handful of CSS properties trigger a new
stacking context, such as opacity
less than 1,
filter
that is not none
, and
transform
that is notnone
.
Note: What exactly qualifies an element to create a stacking context is listed in this long set of rules.
A Block Formatting Context (BFC) is part of the visual CSS rendering of a
web page in which block boxes are laid out. Floats, absolutely positioned
elements, inline-blocks
, table-cells
,
table-caption
s, and elements with overflow
other
than visible
(except when that value has been propagated to
the viewport) establish new block formatting contexts.
Knowing how to establish a block formatting context is important, because without doing so, the containing box will not contain floated children. This is similar to collapsing margins, but more insidious as you will find entire boxes collapsing in odd ways.
A BFC is an HTML box that satisfies at least one of the following conditions:
float
is not none
.position
is neither static
nor
relative
.
display
is table-cell
,
table-caption
, inline-block
,
flex
, or inline-flex
.
overflow
is not visible
.In a BFC, each box’s left outer edge touches the left edge of the containing block (for right-to-left formatting, right edges touch).
Vertical margins between adjacent block-level boxes in a BFC collapse. Read more on collapsing margins.
div
method -

.
.clearfix
class above.
overflow: auto
or overflow: hidden
method -
Parent will establish a new block formatting context and expand to
contains its floated children.
In large projects, I would write a utility .clearfix
class
and use them in places where I need it.
overflow: hidden
might clip children if the children is
taller than the parent and is not very ideal.
CSS sprites combine multiple images into one single larger image. It is a commonly-used technique for icons (Gmail uses it). How to implement it:
background-image
, background-position
and
background-size
properties defined.
Advantages:
:hover
pseudo-states.
Blinking wouldn’t be seen.
autoprefixer
to automatically add vendor prefixes to
your code.
These techniques are related to accessibility (a11y).
width: 0; height: 0
. Make the element not take up any space
on the screen at all, resulting in not showing it.
position: absolute; left: -99999px
. Position it outside of
the screen.
text-indent: -9999px
. This only works on text within the
block
elements.
Even if WAI-ARIA is the ideal solution, I would go with the
absolute
positioning approach, as it has the least caveats,
works for most elements and it’s an easy technique.
Before Flex became popular (around 2014), the float
-based
grid system was the most reliable because it still has the most browser
support among the alternative existing systems (flex, grid). Bootstrap was
using the float
approach until Bootstrap 4 which switched to
the flex
-based approach. As of writing (2020),
flex
is the recommended approach for building grid systems
and has
decent browser support.
For the adventurous, they can look into
CSS Grid Layout, which uses the shiny new grid
property; it is even better
than flex
for building grid layouts and will be the de facto
way to do so in the future.
Yes. An example would be transforming a stacked pill navigation into a fixed-bottom tab navigation beyond a certain breakpoint.
Yes, there are several ways to color shapes (including specifying attributes on the object) using inline CSS, an embedded CSS section, or an external CSS file. Most SVG you’ll find around the web use inline CSS, but there are advantages and disadvantages associated with each type.
Basic coloring can be done by setting two attributes on the node:
fill
and stroke
. fill
sets the
color inside the object and stroke
sets the color of the line
drawn around the object. You can use the same CSS color naming schemes
that you use in HTML, whether that’s color names (that is
red
), RGB values (that is rgb(255,0,0)
), Hex
values, RGBA values, etc.
<rect
x="10"
y="10"
width="100"
height="100"
stroke="blue"
fill="purple"
fill-opacity="0.5"
stroke-opacity="0.8"
/>
The above fill="purple"
is an example of a
presentational attribute. Interestingly, and unlike inline styles
like style="fill: purple"
which also happens to be an
attribute, presentational attributes can be
overriden by CSS
styles defined in a stylesheet. So, if you did something like
svg { fill: blue; }
it would override the purple fill we’ve
defined.
Yes, there are four types of @media properties (including screen):
all
- for all media type devicesprint
- for printersspeech
- for screenreaders that “reads” the page out loud
screen
- for computer screens, tablets, smart-phones etc.
Here is an example of print
media type’s usage:
Firstly, understand that browsers match selectors from rightmost (key selector) to left. Browsers filter out elements in the DOM according to the key selector and traverse up its parent elements to determine matches. The shorter the length of the selector chain, the faster the browser can determine if that element matches the selector. Hence avoid key selectors that are tag and universal selectors. They match a large number of elements and browsers will have to do more work in determining if the parents do match.
BEM (Block Element Modifier) methodology recommends that everything has a single class, and, where you need hierarchy, that gets baked into the name of the class as well, this naturally makes the selector efficient and easy to override.
Be aware of which CSS properties trigger reflow, repaint, and compositing. Avoid writing styles that change the layout (trigger reflow) where possible.
Advantages:
Disadvantages:
Likes:
Dislikes:
node-sass
, which is a binding for LibSass
written in C++. I have to frequently recompile it when switching between
node versions.
@
, which can be
confused with native CSS keywords like @media
,
@import
and @font-face
rule.
Use @font-face
and define font-family
for
different font-weight
s.
This part is related to the above about writing efficient CSS. Browsers match selectors from rightmost (key selector) to left. Browsers filter out elements in the DOM according to the key selector and traverse up its parent elements to determine matches. The shorter the length of the selector chain, the faster the browser can determine if that element matches the selector.
For example with this selector p span
, browsers firstly find
all the
elements and traverse up its parent all
the way up to the root to find the

element. For a
particular
, as soon as it finds a

, it knows that the

matches and can stop its matching.
A CSS pseudo-element is a keyword added to a selector that lets you style
a specific part of the selected element(s). They can be used for
decoration (:first-line
, :first-letter
) or
adding elements to the markup (combined with content: ...
)
without having to modify the markup (:before
,
:after
).
:first-line
and :first-letter
can be used to
decorate text.
.clearfix
hack as shown above to add a
zero-space element with clear: both
.
:before
and
:after
. Encourages separation of concerns because the
triangle is considered part of styling and not really the DOM.
The CSS box model describes the rectangular boxes that are generated for
elements in the document tree and laid out according to the visual
formatting model. Each box has a content area (e.g. text, an image, etc.)
and optional surrounding padding
, border
, and
margin
areas.
The CSS box model is responsible for calculating:
The box model has the following rules:
width
,
height
, padding
, border
s, and
margin
s.
height
is specified, a block element will be as high
as the content it contains, plus padding
(unless there are
floats, for which see below).
width
is specified, a non-floated block element will
expand to fit the width of its parent minus padding
.
height
of an element is calculated by the content’s
height
.
width
of an element is calculated by the content’s
width
.
padding
s and border
s are not part
of the width
and height
of an element.
* { box-sizing: border-box; }
do? What are its
advantages?
box-sizing: content-box
applied,
and only the content size is being accounted for.
box-sizing: border-box
changes how the
width
and height
of elements are being
calculated, border
and padding
are also being
included in the calculation.
height
of an element is now calculated by the content’s
height
+ vertical padding
+ vertical
border
width.
width
of an element is now calculated by the content’s
width
+ horizontal padding
+ horizontal
border
width.
padding
s and border
s as
part of our box model resonates better with how designers actually
imagine content in grids.
display
property and can you give a few
examples of its use?
none
, block
, inline
,
inline-block
, flex
, grid
,
table
, table-row
, table-cell
,
list-item
.
display |
Description |
|---|---|
none |
Does not display an element (the elementv no longer affects the layout of the document). All child element are also no longer displayed. The document is rendered as if the element did not exist in the document tree |
block |
The element consumes the whole line in the block direction (which is usually horizontal) |
inline |
Elements can be laid out beside each other |
inline-block |
Similar to inline , but allows some
block properties like setting width and
height
|
table |
Behaves like the
 element
|
table-row |
Behaves like the
 element
|
table-cell |
Behaves like the  element
|
list-item |
Behaves like a
 element which allows it to
define list-style-type and
list-style-position
|
inline
and
inline-block
?
I shall throw in a comparison with block
for good measure.
block |
inline-block |
inline |
|
|---|---|---|---|
| Size | Fills up the width of its parent container. | Depends on content. | Depends on content. |
| Positioning |
Start on a new line and tolerates no HTML elements next to it
(except when you add float )
|
Flows along with other content and allows other elements beside it. | Flows along with other content and allows other elements beside it. |
Can specify width and height |
Yes | Yes | No. Will ignore if being set. |
Can be aligned with vertical-align |
No | Yes | Yes |
| Margins and paddings | All sides respected. | All sides respected. |
Only horizontal sides respected. Vertical sides, if specified, do
not affect layout. Vertical space it takes up depends on
line-height , even though the border and
padding appear visually around the content.
|
| Float | - | - |
Becomes like a block element where you can set vertical
margins and paddings.
|
relative
, fixed
,
absolute
and static
ally positioned element?
A positioned element is an element whose computed
position
property is either relative
,
absolute
, fixed
or sticky
.
static
- The default position; the element will flow into
the page as it normally would. The top
, right
,
bottom
, left
and
z-index
properties do not apply.
relative
- The element’s position is adjusted relative to
itself, without changing layout (and thus leaving a gap for the element
where it would have been had it not been positioned).
absolute
- The element is removed from the flow of the page
and positioned at a specified position relative to its closest
positioned ancestor if any, or otherwise relative to the initial
containing block. Absolutely positioned boxes can have margins, and they
do not collapse with any other margins. These elements do not affect the
position of other elements.
fixed
- The element is removed from the flow of the page
and positioned at a specified position relative to the viewport and
doesn’t move when scrolled.
sticky
- Sticky positioning is a hybrid of relative and
fixed positioning. The element is treated as
relative
positioned until it crosses a specified threshold,
at which point it is treated as fixed
positioned.
Yes. Flexbox is mainly meant for 1-dimensional layouts while Grid is meant for 2-dimensional layouts.
Flexbox solves many common problems in CSS, such as vertical centering of
elements within a container, sticky footer, etc. Bootstrap and Bulma are
based on Flexbox, and it is probably the recommended way to create layouts
these days. Have tried Flexbox before but ran into some browser
incompatibility issues (Safari) in using flex-grow
, and I had
to rewrite my code using inline-blocks
and math to calculate
the widths in percentages, it wasn’t a nice experience.
Grid is by far the most intuitive approach for creating grid-based layouts (it better be!) but browser support is not wide at the moment.
Note that these two 2 approaches are not exclusive.
Making a website responsive means the some elements will respond by adapting its size or other functionality according to the device’s screen size, typically the viewport width, through CSS media queries, for example, making the font size smaller on smaller devices.
@media (min-width: 601px) {
.my-class {
font-size: 24px;
}
}
@media (max-width: 600px) {
.my-class {
font-size: 12px;
}
}
A mobile-first strategy is also responsive, however it agrees we should default and define all the styles for mobile devices, and only add specific responsive rules to other devices later. Following the previous example:
A mobile-first strategy has 2 main advantages:
Both responsive and adaptive design attempt to optimize the user experience across different devices, adjusting for different viewport sizes, resolutions, usage contexts, control mechanisms, and so on.
Responsive design works on the principle of flexibility - a single fluid website that can look good on any device. Responsive websites use media queries, flexible grids, and responsive images to create a user experience that flexes and changes based on a multitude of factors. Like a single ball growing or shrinking to fit through several different hoops.
Adaptive design is more like the modern definition of progressive enhancement. Instead of one flexible design, adaptive design detects the device and other features and then provides the appropriate feature and layout based on a predefined set of viewport sizes and other characteristics. The site detects the type of device used and delivers the pre-set layout for that device. Instead of a single ball going through several different-sized hoops, you’d have several different balls to use depending on the hoop size.
Both have these methods have some issues that need to be weighed:
Retina is just a marketing term to refer to high resolution screens with a pixel ratio bigger than 1. The key thing to know is that using a pixel ratio means these displays are emulating a lower resolution screen in order to show elements with the same size. Nowadays we consider all mobile devices retina defacto displays.
Browsers by default render DOM elements according to the device resolution, except for images.
In order to have crisp, good-looking graphics that make the best of retina displays we need to use high resolution images whenever possible. However using always the highest resolution images will have an impact on performance as more bytes will need to be sent over the wire.
To overcome this problem, we can use responsive images, as specified in
HTML5. It requires making available different resolution files of the same
image to the browser and let it decide which image is best, using the html
attribute srcset
and optionally sizes
, for
instance:

It is important to note that browsers which don’t support HTML5’s
srcset
(i.e. IE11) will ignore it and use
src
instead. If we really need to support IE11 and we want to
provide this feature for performance reasons, we can use a JavaScript
polyfill, e.g. Picturefill (link in the references).
For icons, I would also opt to use SVGs and icon fonts where possible, as they render very crisply regardless of resolution.
translate()
instead of
absolute
positioning, or vice-versa? And why?
translate()
is a value of CSS transform
.
Changing transform
or opacity
does not trigger
browser reflow or repaint but does trigger compositions; whereas changing
the absolute positioning triggers reflow
.
transform
causes the browser to create a GPU layer for the
element but changing absolute positioning properties uses the CPU. Hence
translate()
is more efficient and will result in shorter
paint times for smoother animations.
When using translate()
, the element still occupies its
original space (sort of like position: relative
), unlike in
changing the absolute positioning.


Hi, I've got an EmonTx v3 hooked up to measure individual circuits in my house, and I'm seeing a weird problem. First up, I'm in Australia, so running ~250V @ 50Hz. My Tx is connected via an AC adapter.
The problem I'm seeing is that when I have one of the SCT-013-000 sensors connected to a particular circuit, the Tx reads 0W on the primary (red) wire, yet I know that the circuit is drawing power, because my internet connection and a bunch of other power points are connected to that circuit (verified by switching the breaker off).
I've tested all of my CTs and all of the Tx inputs, and when the CT and input are connected to another circuit, I get non-zero readings. I've also verified that I've got the right mains wiring using one of those AC detector pen-like things. It beeps for the wire in question when the circuit breaker is on, and is quiet when the breaker is off.
Can anyone help me figure out what's going on? I wonder if there could be some way that the circuit is wired up incorrectly, such that stuff can still draw power, but the CT won't detect anything?
Thanks for any help!
Bodhi
Re: Power monitor trouble-shooting
Ah, sorry. Should this go in the "Questions and support" forum?
Re: Power monitor trouble-shooting
Do you have a feel for how much power is being drawn on that circuit? If you plug in a really beefy load like an electric kettle or toaster, does anything show up then?
Re: Power monitor trouble-shooting
dBC it's got at least a laptop charger and a few other things that draw at least 20W or so. When I was testing everything to make sure, the CTs could easily pick up the laptop charger.
Good idea about trying something powerful, I'll give that a shot...
Re: Power monitor trouble-shooting
Unfortunately, 20 W on an input that's good to 24 kW is really, really pushing the limit on what you can measure with a 10-bit ADC. You can't expect a reasonably accurate reading until the power gets towards an order of magnitude bigger than that.
Re: Power monitor trouble-shooting
Robert, fair enough. I was expecting to see something though, even if it wasn't terribly accurate. The input was precicely zero though, whereas the other inputs, such as the light circuit will "measure" < 20W, it will actually show a noise-floor of a couple of Watts when everything is off.
Re: Power monitor trouble-shooting
Have you restarted the emonTx since you plugged the CT in?
The software detects the used inputs and works those, ignoring the ones that don't have a plug in. And those do report exactly zero to emonCMS.
Re: Power monitor trouble-shooting
Yes, restarted several times. I actually took it back to my desk to disable that part of the firmware, so that all inputs are always read, and it is still reporting zero (I have 4 CTs plugged in, so that feature isn't so important for me anyway).
I tested the CT->emonTx->serial (and wireless, from a RaspberryPi) with a laptop charger plugged into the same circuit actually (it has a two-wire cord to the plug that I could split so as to clamp around one), and it could measure ~15W, but using the same CT on the active wire of the circuit itself, I get zero.
I think I might call my electrician to come and have a look.


TECH WEEK 7
The SkateBoard
The skateboard involved using the cross linked and the longitudinal wood peices. Gluing the peices together was a real challenge as the wood would dry and the skateboard would not take its shape.
The seven minute constraint forced us to work in pairs to get the peices together glued in the vaccum bag. The air was sucked out to curve the sides of the board.


Olin Self Study (OSS) is a graduation requirement for all Olin students. An OSS is an opportunity for students to go in depth into a topic that they are interested in. My OSS focuses on learning advanced machine shop techniques and putting these new skill together to create a Tesla Turbine.
NOTE: This website is being updated as I work on the project. Come back for more!
Nikolai Tesla patented the bladeless tubine in 1913. While conventional turbines have blades that fluid pushes on to turn, the Tesla Turbine uses flat disks and the boundary layer effect to create a spinning motion. The fluid is pumped parallel to the blades and the viscosity of the fluid drags the disks around. Tesla believed that his turbine would be more efficient than conventionial turbines but did not have the manufacturing capabilities to prove the efficiency during his time. Efficiency of the Tesla Turbine today is estimated to have a maximum of 95%.
1. Cut Aluminum bar stock to 1.5" x 1" x 0.75".
2. Machine outer dimensions.
3. Drill 4X 0.129" holes.
4. Drill 0.438" holes.
5. Counterbore 4X 0.219".
6. Tap 1/4-18 NPT.
1. Cut 0.375" thick clear polycarbonate stock to 5" x 5".
2. Clamp polycarbonate to fixture.
3. Drill 8X 0.107" holes.
4. Drill 8X 0.201" hole.
5. Counterbore 8X 0.375".
6. Machine center hole.
7. Bolt piece to fixture through outer bolt circle.
8. Machine outer profile.
1. Cut 1.75" aluminum bar to 5" x 5.125"
2. Cut corners off as shown .
3. Clamp in vise so at least 1.450" of material is above clamps.
4. Drill 0.5" hole at (2.725", 2.5") from top left corner of stock, set as origin.
5. CNC mill outter profile, large circular pocket, and small circular pocket. Use a 3 flute 3/4" HSS roughing end mill.
6. Finish outter profile, large circular pocket, and small circular pocket with a 3 flute 3/4" HSS end mill.
7. Spot drill perimeter holes with a mill drill.
8. Chamfer all edges with a mill drill.
9. Drill and rollform tap perimeter holes. Be sure to use correct drill for rollform tapping.
10. Mill O-ring groove with 2 flute 3/32" carbide end mill.
Flip piece over
1. Machine piece to correct width. Finishing pass with a face mill.
2. CNC pockets with 2 flute 1/4" end mill.
3. Chamfer all edges with a mill drill.
4. Drill and rollform tap bolt circle. Be sure to use correct drill for rollform tapping.
Turn piece in vise so that the base of the housing is facing up.
1. CNC mounting slots.

1. Finish outlet face.
2. Mill inlet pocket.
3. Drill inlet holes.
4. Drill and tap inlet block mounting holes.
1. Cut 2" long, 2" diameter aluminum stock.
2. Machine pulley from stock first.
3. Rough and finish 1.250" diameter side.
Flip piece around in 3-jaw chuck.
1. Bring piece to proper length.
2. Drill 0.5" hole through entire piece.
3. Drill 0.75" hole to depth shown.
4. Bore 0.8745" diameter hole.
5. Bore 0.6245" diameter hole. Use a precision gauge pin to determine if tolerance is reached.
6. Rough and finish remaining outer profile.
7. Machine external groove.
8. Machine internal groove.
9. Remove tool radius left on profile.
Set in V-blocks on mill and set origin to center of piece.
1. Drill and counterbore the bolt circle.
1. Cut 3.6" long piece from 416 1/2 hard stainless steel.
2. Rough and finish 0.500" diameter and 1.300" diameter profiles. Note the 0.001" tolerance.
3. Remove rool radius where specified.
Flip piece around in 3-jaw chuck.
1. Bring piece to proper length.
2. Rough and finish the 0.3748" diameter profile. Note the 0.0003" tolerance. Let the piece cool down to room temperature before taking measurements for final pass.
3. Rough and finish 0.2498" diameter profile. Note the 0.0003" tolerance. Let the piece cool down to room temperature before taking measurements for final pass.
4. Rough and finish the remaining profile.
5. Remove tool radius where specified.
Mount piece in 0.5" collet and collet block and use V-blocks to mount in mill vise.
1. Drill and tap bolt circle.
1. Cut 1.5" x 1.5" aluminum stock from 0.150" plate.
2. Face piece to final thickness.
3. Set origin at the center of the piece.
4. Drill outer bolt circle.
5. Countersink outer bolt circle.
6. Drill and ream center 0.501" hole.
Bolt piece to fixture through the countersunk holes.
1. Machine outer profile.


Jack Ma, Jedi, and surfing: These are the 10 juiciest details from Fast Company’s deep dive into WeWork
by Theron Mohamed, Business Insider US- Fast Company published a deep dive into the relationship between WeWork cofounder and former CEO Adam Neumann and SoftBank CEO Masayoshi Son, the coworking startup’s biggest backer.
- Son compared Neumann to Alibaba’s founder Jack Ma and likened WeWork to Amazon to justify its astronomical valuation, Fast Company reported.
- The magazine story also includes Neumann’s comments on subjects such as Saudi’s crown prince, and details about how he likes to surf.
- Scroll down for the 10 best bits from the Fast Company story.
- For more stories on WeWork, click here.
1. “The last person I felt this with was Jack Ma”
SoftBank CEO Masayoshi Son reportedly told WeWork’s cofounder and former boss Adam Neumann that he reminded him of Alibaba’s founder, the driving force behind Son’s most successful investment ever.
“The last person I felt this with was Jack Ma,” Neumann recalled Son saying to him before WeWork’s IPO collapsed, Neumann was pushed out, and SoftBank bailed out his startup.
Son was so impressed by Neumann that he drew up the terms of a $4.4 billion investment on an iPad in the back of his car, and he and Neumann signed at the bottom, Neumann told Fast Company.
“When Masa chose to invest in me for the first time, he only met me for 28 minutes. Okay?” Neumann told the magazine.
Read more about this story here.
2. “Masa is a Jedi”
Neumann reportedly compared WeWork to Amazon to make its astronomical valuation look cheap by comparison.
He likened WeWork to Amazon when it only sold books and music, and pledged to expand from desk rentals into education, exercise, networking, and other sectors just as the e-commerce titan widened its offering, Fast Company reported.
“Masa is a Jedi,” Neumann told the magazine, referring to SoftBank’s Son and the Amazon narrative he pushed for WeWork. “He has a lot of superpowers.”
Read more about this story here.
3. “Adam’s only boss is Rebekah”
Neumann’s wife, Rebekah, played an integral role in drafting WeWork’s IPO prospectus, according to Fast Company.
Rebekah served as the company’s branding chief and founded WeGrow, its private school in Manhattan. She was also a member of the committee – later disbanded – that was tasked with choosing Adam’s successor as head of WeWork.
“Adam’s only boss is Rebekah,” a WeWork executive told Fast Company.
4. Neumann’s surfing process is like “helicopter skiing on a bunny hill”
Neumann relies on an “unusual number of instructors and guides” when he surfs, Fast Company said, citing people who have watched him ride waves.
The WeWork cofounder is often towed out from the shore by jet skis rather than paddling himself, which surfers view as “bizarre and unnecessary,” the magazine said.
The process is comparable to “helicopter skiing on a bunny hill,” it added.
After Neumann surfed with Laird Hamilton – one of the sport’s legends – in Hawaii, WeWork took part in a $32 million financing round for Laird Superfood, Fast Company reported.
5. “If only MBS would listen to me, I could counsel him on how to be a better leader”
Neumann reportedly said he could help Saudi Arabia’s crown prince, Mohammad bin Salman, recover after his country was implicated in the gruesome death of Washington Post columnist Jamal Khashoggi.
“If only MBS would listen to me, I could counsel him on how to be a better leader,” Neumann said, a WeWork insider told Fast Company.
Neumann held talks last year with the Saudis about a possible role for WeWork in Project Neom, the crown prince’s planned metropolis, the magazine reported.
6. One of Neumann’s outfits was inspired by Jared Kushner’s Harvard roommate
Neumann wore traditional Indian clothing for his meeting with Narenda Modi, the nation’s prime minister, in January 2016.
His outfit choice was inspired by what Jared Kushner’s Harvard roommate wore to Kushner’s birthday party on the night before Neumann flew to India, according to Fast Company.
7. “We haven’t really had a torpedo below the waterline”
One of WeWork’s earliest investors may have jinxed the startup by highlighting its lack of problems.
“We haven’t really had a torpedo below the waterline,” Bruce Dunlevie, a partner at Benchmark Capital and a WeWork board member, told Fast Company in April. “The company has been lucky to not have a really negative thing happen to it.”
Benchmark was an early investor in Uber, Twitter, Snapchat, Instagram, Dropbox, and other technology companies. The venture capital firm seemed to cool on WeWork as it didn’t take part in later financing rounds.
Dunlevie became more and more concerned by Neumann’s behavior, such as his sale of stock ahead of the company’s IPO, Fast Company reported.
8. “You can sell the space like an airline”
After Neumann resigned as CEO, SoftBank’s Son spent four days at a WeWork in Tokyo, analyzing WeWork’s business and members’ usage patterns, Fast Company reported.
“We realized that not everyone shows up at work all the time,” someone familiar with the study told the magazine. “So you can sell the space like an airline.”
The comments suggest WeWork may double down on “hotdesking” by selling access to its coworking spaces by the day or hour, instead of renting them out on a monthly basis.
SoftBank is aiming for WeWork to turn a profit and generate positive cash flow in 18 months’ time, Fast Company said.
9. Neumann discussed turning WeWork into a “monopoly”
Neumann talked about turning WeWork into a “monopoly” during a company meeting, a WeWork executive told Fast Company.
When the executive raised the legal and regulatory risks of dominating a market and driving up prices, Neumann “shrugged” and said he would use a different term, the executive told the magazine.
10. SoftBank’s Son was “disturbed” by a report of Neumann smoking weed
A Wall Street Journal story published in September included an account of Neumann allegedly smoking weed on a private-jet trip to Israel.
The report “disturbed” Son as weed is outlawed in Japan, and he viewed the transporting of drugs across country lines as indicative of poor judgment and a legal risk, Fast Company reported.
Under mounting pressure from investors and other board members, Neumann stepped down as CEO six days later.


The Problem that My Invention Solves is..
When you need the perfect oven for hamburgers or cupcakes
Most Important Features:
- cooks stuff
- the oven turns into a hamburger
- body is blue
Who Will Use It?
people who like hamburgers
It will Cost: $999.99
About the Inventor
I'm the inventor, Mitch and I like Hamburgers.


Programming Languages: Experience in HTML programming using CSS, Python, Javascript
Group File Communication: Experience using GitHub repositories and gitbash programs
Waterloo Career Center Ambassador: Working with others to organize and actively participate in tours and activities for promoting the Waterloo Career Center to students and others who are interested
Text Based Adventure Browser Game:Lost In Time, a showcase of my personal work in JavaScript and HTML
Certificates: Microsoft Technology Associate: Introduction to Programming Using JavaScript (2019) and Introduction to Programming Using HTML and CSS (2020); Official recognition of my abilities to program code in JavaScript HTML and CSS


LockBasedTxMgr a simple implementation of interface `txmgmt.TxMgr`. This implementation uses a read-write lock to prevent conflicts between transaction simulation and committing
type LockBasedTxMgr struct {
// contains filtered or unexported fields
}
func NewLockBasedTxMgr(ledgerid string, db privacyenabledstate.DB, stateListeners []ledger.StateListener, btlPolicy pvtdatapolicy.BTLPolicy, bookkeepingProvider bookkeeping.Provider, ccInfoProvider ledger.DeployedChaincodeInfoProvider) (*LockBasedTxMgr, error)
NewLockBasedTxMgr constructs a new instance of NewLockBasedTxMgr
func (txmgr *LockBasedTxMgr) Commit() error
Commit implements method in interface `txmgmt.TxMgr`
func (txmgr *LockBasedTxMgr) CommitLostBlock(blockAndPvtdata *ledger.BlockAndPvtData) error
CommitLostBlock implements method in interface kvledger.Recoverer
func (txmgr *LockBasedTxMgr) GetLastSavepoint() (*version.Height, error)
GetLastSavepoint returns the block num recorded in savepoint, returns 0 if NO savepoint is found
func (txmgr *LockBasedTxMgr) Name() string
Name returns the name of the database that manages all active states.
func (txmgr *LockBasedTxMgr) NewQueryExecutor(txid string) (ledger.QueryExecutor, error)
NewQueryExecutor implements method in interface `txmgmt.TxMgr`
func (txmgr *LockBasedTxMgr) NewTxSimulator(txid string) (ledger.TxSimulator, error)
NewTxSimulator implements method in interface `txmgmt.TxMgr`
func (txmgr *LockBasedTxMgr) RemoveStaleAndCommitPvtDataOfOldBlocks(blocksPvtData map[uint64][]*ledger.TxPvtData) error
RemoveStaleAndCommitPvtDataOfOldBlocks implements method in interface `txmgmt.TxMgr` The following six operations are performed: (1) contructs the unique pvt data from the passed blocksPvtData (2) acquire a lock on oldBlockCommit (3) checks for stale pvtData by comparing [version, valueHash] and removes stale data (4) creates update batch from the the non-stale pvtData (5) update the BTL bookkeeping managed by the purge manager and update expiring keys. (6) commit the non-stale pvt data to the stateDB This function assumes that the passed input contains only transactions that had been marked "Valid". In the current design, kvledger (a single consumer of this function), filters out the data of "invalid" transactions and supplies the data for "valid" transactions only.
func (txmgr *LockBasedTxMgr) Rollback()
Rollback implements method in interface `txmgmt.TxMgr`
func (txmgr *LockBasedTxMgr) ShouldRecover(lastAvailableBlock uint64) (bool, uint64, error)
ShouldRecover implements method in interface kvledger.Recoverer
func (txmgr *LockBasedTxMgr) Shutdown()
Shutdown implements method in interface `txmgmt.TxMgr`
func (txmgr *LockBasedTxMgr) ValidateAndPrepare(blockAndPvtdata *ledger.BlockAndPvtData, doMVCCValidation bool) ( []*txmgr.TxStatInfo, []byte, error, )
ValidateAndPrepare implements method in interface `txmgmt.TxMgr`


#include <sysc/datatypes/fx/sc_fxval_observer.h>
Definition at line 141 of file sc_fxval_observer.h.
◆ sc_fxval_fast_observer()
| sc_dt::sc_fxval_fast_observer::sc_fxval_fast_observer |
( |
| ) |
|
|
inlineprotected |
◆ ~sc_fxval_fast_observer()
| virtual sc_dt::sc_fxval_fast_observer::~sc_fxval_fast_observer |
( |
| ) |
|
|
inlineprotectedvirtual |
◆ construct()
| void sc_dt::sc_fxval_fast_observer::construct |
( |
const sc_fxval_fast & |
| ) |
|
|
inlinevirtual |
◆ destruct()
| void sc_dt::sc_fxval_fast_observer::destruct |
( |
const sc_fxval_fast & |
| ) |
|
|
inlinevirtual |
◆ read()
| void sc_dt::sc_fxval_fast_observer::read |
( |
const sc_fxval_fast & |
| ) |
|
|
inlinevirtual |
◆ write()
| void sc_dt::sc_fxval_fast_observer::write |
( |
const sc_fxval_fast & |
| ) |
|
|
inlinevirtual |
◆ default_observer
The documentation for this class was generated from the following file:


% FORTH(1) % Richard Howe % November 2016
forth - a forth interpreter
forth [-s file] [-e string] [-l file] [-m size] [-VthvL] [-] [files]
A Forth interpreter built around a library, libforth, that implements a complete Forth interpreter.
This interpreter is available at here.
Command line switches must be given before any files, unless that switch takes a file as an argument.
This saves the working memory of the Forth interpreter to a file, which can later be loaded with the "-l" option. If a core file has been invalidated this will not be saved, invalidation occurs when an unrecoverable error has been detected that would prevent any recovery or meaningful execution with the current image.
Evaluate a Forth string passed in as an argument.
After all the files have been read from and any core files have been loaded this will make the Forth interpreter read from stdin, the core file will be saved after stdin has been read from and there is no more work to do, if the "-d" or "-s" flags have been specified.
Print out a short help message and exit unsuccessfully.
Turn verbose mode on, more information will be printed out, to stderr, about what is happening in the interpreter. Usually the interpreter is as silent as possible.
Specify the virtual machines memory size in kilobytes, overriding the default memory size. This is mutually exclusive with "-l".
This option loads a forth core file generated from the "-d" option of a previous run. This core file is not portable and must be generated on the same platform as it was generated. It can only be specified once per run of the interpreter.
Stop processing any more command line options and treat all arguments after this as files to be executed, if there are any.
Print version and interpreter information and exit successfully.
If the line editing library is compiled into the executable, which is a compile time option, then when reading from stdin this will use a line editor to read in a line at a time. This option implies -t.
If a file, or list of files, is given, read from them one after another and execute them. The dictionary and any stored Forth blocks will persist, as will values on the stack.
If no files are given to execute stdin will be read from.
./forth
Execute any commands given from stdin
./forth -t file1.4th file2.4th
Execute file "file1.4th", then "file2.4th", then read from stdin
./forth file1.4th
Execute file "file1.4th".
./forth -s file1.4th
Execute file "file1.4th", the produce a "forth.core" save file.
./forth -s -l forth.core
Load a "forth.core" file, read from stdin and execute any commands given, then dump the new core file to "forth.core".
The interpreter returns zero on success and non zero on failure.
The Forth interpreter and the library that implements it are released under the MIT license. Copyright (c) Richard Howe, 2016.
This program will return a non-zero value on failure, and zero on success.
libforth(3)
If you find a bug, or would like to request a new feature, please Email me at:
howe.r.j.89 [ at ] gmail . com
The interpreter has not been battle hardened yet so there is likely behavior that is non-standard (for no reason) or just outright incorrect.
This small Forth interpreter is based on a de-obfuscated entrant into the IOCCC by buzzard. The entry described a Forth like language which this derives from. You can use this library to evaluate Forth strings or as an embeddable interpreter. Work would need to be done to get useful information after doing those evaluations, but the library works quite well.
main.c is simply a wrapper around one the functions that implements a simple REPL.
This project implements a Forth interpreter library which can be embedded in other projects, it is incredibly minimalistic, but usable. To build the project a C compiler is needed, and a copy of Make, type:
make help
For a list of build options. By running:
make run
Will build the interpreter and run it, it will then read from stdin.
To build the documentation other programs may be needed, such as pandoc and the markdown script, but these steps are optional.
Forth is an odd language that has a loyal following groups, but it is admittedly not the most practical of language as it lacks nearly everything the modern programmer wants in a language; safety, garbage collection, modularity and clarity. It is however possible to implement a fully working interpreter in a one to two kilobytes of assembly, those kilobytes can make a functional and interactive programming environment, giving a high ratio of utility memory used.
From the Wikipedia article we can neatly summarize the language:
"Forth is an imperative stack-based computer programming language
and programming environment.
Language features include structured programming, reflection (the
ability to modify the program structure during program execution),
concatenative programming (functions are composed with juxtaposition)
and extensibility (the programmer can create new commands).
...
A procedural programming language without type checking, Forth features
both interactive execution of commands (making it suitable as a shell
for systems that lack a more formal operating system) and the ability
to compile sequences of commands for later execution."
Given the nature of the Forth language it does not make for a terribly good embeddable scripting language, but it is simple to implement and can be fun to use. This interpreter is based off a previous IOCCC in a file called buzzard.2.c, it is a descendant of that file.
Before using and understanding this library/interpreter it is useful to checkout more literature on Forth such as Thinking Forth by Leo Brodie for a philosophy of the language, Starting Forth (same Author), Jonesforth which is a specific implementation of the language in x86 assembly and Gforth, a more modern and portable implementation of the language.
It is important to realize that Forth is really more a philosophy and collection of ideas than a specific reference implementation or standard. It has been said that an intermediate Forth user is one who has implemented a Forth interpreter, something which cannot be said about other languages nor is possible given their complexity.
The saying "if you have seen one Forth implementation, you have seen one Forth implementation" applies, nearly every single Forth implementation has its own idea of how to go about things despite standardization efforts - in keeping with this, this library has its own idiosyncrasies.
 This simple kernel is then used to build a more compliant and usable Forth implementation by defining words that build upon those provided by the base system.
Apart from this file there are other sources of information about the project:
As can the code, which is small enough to be comprehensible:
And the forth startup code:
The startup code is well commented and shows how the core interpreter is extended to a more function Forth environment.
The source file libforth.c can be converted to a more readable webpage by first converting the source to markdown with convert script, the converting that to HTML in the usual fashion
main.c simple calls the function main_forth() in libforth.c, this function initializes a Forth environment and puts the user in a REPL where you can issue commands and define words. See the manual pages for list of command line options and library calls. All commands are given using Reverse Polish Notation (or RPN),
So:
2+(2*4)
Becomes:
4 2 * 2 +
And brackets are no longer needed. Numbers of pushed on to the variable stack automatically and commands (such as '*' and '+') take their operands off the stack and push the result. Juggling variables on the stack becomes easier over time. To pop a value from the stack and print it there is the '.' word.
So:
2 2 + .
Prints:
4
The simplicity of the language allows for a small interpreter, the loop looks something like this:
1) Read in a space delimited Forth WORD.
2) Is this WORD in the dictionary?
FOUND) Are we in IMMEDIATE mode?
IMMEDIATE-MODE) Execute WORD.
goto 1;
COMPILE-MODE) Compile WORD into the dictionary.
goto 1;
NOT-FOUND) Is this actually a number?
YES) Are we in IMMEDIATE mode?
IMMEDIATE-MODE) Push Number onto the stack.
goto 1;
COMPILE-MODE) Compile a literal number.
goto 1;
NO) Error! Handle error
goto 1;
Given that we are reading in space delimited words if follows that the above expression:
2 2 + .
Would not work if we did:
2 2+ .
Or:
2 2 +.
As "2+" and "+." would be parsed as words, which may or may not be defined and if they are do not have the behavior that we want. This is more apparent when we do any kind of string handling.
The Forth execution model uses Threaded Code, the layout of a word header follows from this.
A Forth word is defined in the dictionary and has a particular format that varies between implementations. A dictionary is simply a linked list of Forth words, the dictionary is usually contiguous and can only grow. The format for our Forth words is as follows:
Briefly:
And in more detail:
.------------------------------------------------.----------------.
| Word Header | Word Body |
.---------------.-----.------.-------------------.----------------.
| NAME ... | PWD | MISC | CODE WORD or DATA | DATA ... |
.---------------.-----.------.-------------------.----------------.
____
NAME = The name, or the textual representation, of a Forth
word, it is a variable length field that is ASCII NUL
terminated, the MISC field has an offset that points
to the begining of this field if taken off the PWD
position (not value). The offset is in machine words,
not characters.
___
PWD = A pointer to the previously declared word.
____
MISC = A complex field that can contains a CODE WORD, a
"hide" bit and the offset from the PWD field to the
beginning of NAME
_________ ____
CODE WORD or DATA = This will be RUN if the following DATA is a pointer
to the CODE WORDs of previously defined words. But it
could be any CODE WORD.
____
DATA = This could be anything, but it is most likely to be
a list of pointers to CODE WORDs of previously defined
words if this optional DATA field is present.
All fields are aligned on the Forth virtual machines word boundaries.
The MISC field is laid out as so:
.-------------------------------------------------------------------------------.
| <- Least Significant Bit Most Significant Bit -> |
.-------------------------------------------------------------------------------.
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
.-------------------------------------------------------------------------------.
| CODE WORD | HD | NAME OFFSET |
.-------------------------------------------------------------------------------.
_________
CODE WORD = Bits 0-6 are a code word, this code word is always run
reguardless of whether we are in compiling or command
mode
__
HD = Bit 7 is the Hide Bit, if this is true then when
compiling or executing words the word will be hidden from the
search.
___________
NAME OFFSET = Bits 8 to 15 are the offset to the words name. To find the
beginning of the words name we take this value away from
position of this words PWD header. This value is in
machine words, and so the beginning of the NAME must be aligned
to the virtual machine words boundaries and not character, or byte,
aligned. The length of this field, and the size of the input buffer,
limit the maximum size of a word.
Depending on the virtual machine word size, or cell size, there may be more bits above bit '15', the most significant bit, in the MISC field. These bits are not used and should be set to zero.
And the dictionary looks like this:
[ Special 'fake' word ]
.
/|\
|
.-------.-----.----------------------.
| NAME | PWD | Rest of the word ... |
.-------.-----.----------------------.
.
/|\
|
~~~~~
The rest of the dictionary
~~~~~
|
.-------.-----.----------------------.
| NAME | PWD | Rest of the word ... |
.-------.-----.----------------------.
.
/|\
|
.-------.-----.----------------------.
| NAME | PWD | Rest of the word ... |
.-------.-----.----------------------.
.
/|\
|
[ Previous Word Register ]
Searching of the dictionary starts from the Previous Word Register and ends at a special 'fake' word.
Defining words adds them to the dictionary, we can defined words with the ':' words like this:
: two-times 2 * ;
Which defined the word "two-times", a word that takes a value from the stack, multiplies it by two and pushes the results back onto the stack.
The word ':' performs multiple actions; it is an immediate word that reads in the next space delimited word from the input stream and creates a header for that word. It also switches the interpreter into compile mode, compiling words will be compiled into that word definition instead of being executed, immediate words are executed as normal. ';' is also an immediate word, it compiles a special word exit into the dictionary which returns from a word call and switches the interpreter back into command mode. This type of behavior is typical of Forth implementations.
The way this interpreter works is that is emulates an idealized machine, one built for executing Forth directly. As such it has to make compromises and treats certain sectors of memory as being special, as shown below (numbers are given in hexadecimal and are multiples of the virtual machines word-size which is either 16, 32 or 64 bit depending on compile time options.
Where the dictionary ends and the variable and return stacks begin depends on how much memory was allocated to the interpreter (with a minimum of 2048 words), the default is 32768 words, and the following diagram assumes this:
.-----------------------------------------------.
| 0-3F | 40-7BFF |7C00-7DFF|7E00-7FFF|
.-----------------------------------------------.
| Registers | Dictionary... | V stack | R stack |
.-----------------------------------------------.
V stack = The Variable Stack
R stack = The Return Stack
Each may be further divided into special sections:
At the beginning of the Forth virtual machine there is a section used for registers, modifying them arbitrary can cause undefined behavior to occur which will most likely cause the virtual machine to be terminated.
NAME LOCATION DESCRIPTION
DECIMAL HEX
0-1 0-1 Unused
2-5 2-5 Push integer word
DIC 6 6 Dictionary pointer
RSTK 7 7 Return stack pointer
STATE 8 8 Interpreter state; compile or command mode
BASE 9 9 Base conversion variable
PWD 10 A Pointer to last defined word
SOURCE_ID 11 B Input source selector (-1 = string input,
0 = file input)
SIN 12 C String input pointer
SIDX 13 D String input index (index into SIN)
SLEN 14 E String input length (length of SIN)
START_ADDR 15 F Pointer to start of VM
FIN 16 10 File input pointer
FOUT 17 11 File output pointer
STDIN 18 12 File pointer to stdin, if available
STDOUT 19 13 File pointer to stdout, if available
STDERR 20 14 File pointer to stderr, if available
ARGC 21 15 Count of arguments passed to program,
if available
ARGV 22 16 An array of pointers to NUL terminated
ASCII strings, if available, of ARGC
length
DEBUG 23 17 Turn debugging on/off if enabled
INVALID 24 18 If non zero, this interpreter is invalid
TOP 25 19 Stored version of top of stack
INSTRUCTION 26 1A Stored version of instruction pointer
STACK_SIZE 27 1B Size of the variable stack
ERROR_HANDLER 28 1C Action to take on error
THROW 29 1D Used for throw/catch
SCRATCH_X 30 1E Fixed scratch variable for the user
SCRATCH_Y 31 1F Fixed scratch variable for the user
Apart from the constraints that the dictionary begins after where the registers are and before where V stack is there are no set demarcations for each region, although currently the defined word region ends before 0x200 leaving room between that and 0x7BFF for user defined words.
.----------------------------------------------------------------.
| 40-??? | ???-??? | ???-7BFF |
.----------------------------------------------------------------.
| Special read word | Interpreter word | Defined word ... |
.----------------------------------------------------------------.
Special read word = A word called on entrance to the interpreter,
it calls itself recursively (as a tail call). This
word cannot be 'found', it does not have a name.
Interpreter word = Any named (not 'invisible' ones) interpreter word
gets put here.
Defined word = A list of words that have been defined with ':'
Each word is also given with its effect on the variable stack, any other effects are documented (including the effects on other stacks). Each entry looks like this:
Where 'word' is the word being described, the contents between the parenthesis describe the stack effects, this word expects one number to be one the stack, 'y', and returns a number to the stack 'z'.
There are three types of words.
These invisible words have no name but are used to implement the Forth. They are all immediate words.
Push the next value in the instruction stream onto the variable stack, advancing the instruction stream.
Compile a pointer to the next instruction stream value into the dictionary.
Save the current instruction stream pointer onto the return stack and set the pointer instruction stream pointer to point to value after run.
These words are named and are immediate words.
Read in a new word from the input stream and compile it into the dictionary.
Make the previously declared word immediate. Unlike in most Forth implementations this is used after the words name is given not after the final ';' has been reached.
So:
: word immediate ... ;
Instead of:
: word ... ; immediate
A comment, ignore everything until the end of the line.
read is a complex word that implements most of the input interpreter, it reads in a Forth word (up to 31 characters), if this word is in the dictionary it will either execute the word if we are in command mode or compile a pointer to the executable section of the word if in compile mode. If this word is not in the dictionary it is checked if it is a number, if it is then in command mode we push this value onto the variable stack, if in compile mode then we compile a literal into the dictionary. If it is none of these we print an error message and attempt to read in a new word.
Pop an address and push the value at that address onto the stack.
Given an address and a value, store that value at that address.
Pop a character address and push the character value at that address onto the stack. Note that this access is not checked for being within range of the virtual machines memory, but it is still relative to the start address of virtual machine memory.
Given a character address, store a character value at that address, like 'c@' the address is relative to the virtual machines starting address.
Pop two values, subtract 'y' from 'x' and push the result onto the stack.
Pop two values, add 'y' to 'x' and push the result onto the stack.
Pop two values, compute the bitwise 'AND' of them and push the result on to the stack.
Pop two values, compute the bitwise 'OR' of them and push the result on to the stack.
Pop two values, compute the bitwise 'XOR' of them and push the result on to the stack.
Perform a bitwise negation on the top of the stack.
Pop two values, compute 'y' shifted by 'x' places to the left and push the result on to the stack.
Pop two values, compute 'y' shifted by 'x' places to the right and push the result on to the stack.
Pop two values, multiply them and push the result onto the stack.
Pop two values, divide 'x' by 'y' and push the result onto the stack. If 'y' is zero and error message is printed and 'x' and 'y' will remain on the stack, but execution will continue on as normal.
Pop two unsigned values, compare them (y < x) and push the result onto the stack, the comparison will be unsigned.
Pop two values, compare them (y > x) and push the result onto the stack. The comparison will be unsigned.
Pop the return stack and set the instruction stream pointer to that value.
Get a value from the input and put it onto the stack.
Put a character to the output stream returning a success value.
Pop a value from the return stack and push it to the variable stack.
Pop a value from the variable stack and push it to the return stack.
Jump unconditionally to the destination next in the instruction stream.
Pop a value from the variable stack, if it is zero the jump to the destination next in the instruction stream, otherwise skip over it.
Pop a value from the variable stack and print it to the output either as a ASCII decimal or hexadecimal value depending on the BASE register. A return status is pushed onto the stack, greater or equal to zero is a success, negative is a failure. Failure can occur because of an invalid base in the BASE register, or because the output could not be written to.
Push the next value in the instruction stream onto the variable stack and advance the instruction stream pointer over it.
Write a value into the dictionary, advancing the dictionary pointer.
Pop two values, perform a test for equality and push the result.
Swap two values on the stack.
Duplicate a value on the stack.
Drop a value.
Duplicate the value that is next on the stack.
Find a word in the dictionary pushing a pointer to that word onto the variable stack.
Push the current stack depth onto the stack, the value is the depth of the stack before the depth value was pushed onto the variable stack.
Push the address of the stack pointer onto the stack, before sp@ was executed:
1 2 sp@ . . .
Prints:
2 2 1
Set the address of the stack pointer.
Push the difference between the startup time and now, in milliseconds. This can be used for timing and implementing sleep functionality, the counter will not increase the interpreter is blocking and waiting for input, although this is implementation dependent.
This word is a primitive used to implement 'evaluate' and 'include-file', it takes a boolean to decide whether it will read from a file (1) or a string (0), and then takes either a forth string, or a file-id.
Execute a command with the systems command interpreter.
The following compiling words are part of the File Access Word set, a few of the fields need explaining in the stack comments. "file-id" refers to a previously opened file as returned by "open-file", "ior" refers to a return status provided by the file operations. "fam" is a file access method,
Close an already opened file.
Open a file, given a Forth string (the 'c-addr' and the 'u' arguments), and a file access method, which is defined within "forth.fth". Possible file access methods are "w/o", "r/w" and "r/o" for read only, read-write and write only respectively.
Delete a file on the file system given a Forth string.
Read in 'u' characters into 'c-addr' given a file identifier.
Write 'u' characters from 'c-addr' to a given file identifier.
Get the file position offset from the beginning of the file given a file identifier.
Reposition a files offset relative to the beginning of the file given a file identifier.
Attempt to flush any buffered information written to a file.
Rename a file on the file system named by the first string ('c-addr1' and 'u1') to the second string ('c-addr2' and 'u2').
Defined words are ones which have been created with the ':' word, some words get defined before the user has a chance to define their own to make their life easier.
Push the address of the register that controls the interpreter state onto the stack, this value can be written to put the interpreter into compile or command modes.
Write 'exit' into the dictionary and switch back into command mode.
This pushes the address of a variable used for input and output conversion of numbers, this address can be written to and read, valid numbers to write are 0 and 2 to 36 (not 1).
Pushes a pointer to the previously define word onto the stack.
Push a pointer to the dictionary pointer register.
Push a pointer to the register pointer register.
Push the current dictionary pointer (equivalent to "h @").
Immediately switch into command mode.
Switch into compile mode
Write zero into the head of the dictionary and advance the dictionary pointer, push a address to the zero written into the dictionary. This is usually used after in a word definition that changes the control flow, after a branch for example.
This creates a word header for a word without a name and switches to compile mode, the usual ';' finishes the definition. It pushes a execution token onto the stack that can be written into the dictionary and run, or executed directly.
Begin an if-else-then statement. If the top of stack is true then we execute all between the if and a corresponding 'else' or 'then', otherwise we skip over it.
Abstract Examples:
: word ... bool if do-stuff ... else do-other-stuff ... then ... ;
: word ... bool if do-stuff ... then ... ;
and a concrete examples:
: test-word if 2 2 + . cr else 3 3 * . cr ;
0 test-word
4 # prints 4
1 test-word
9 # prints 9
Is a simple and contrived example.
See 'if'.
See 'if'.
This marks the beginning of a loop.
Loop back to the corresponding 'begin' if the top of the stack is zero, continue on otherwise.
Push the number representing the ')' character onto the stack.
Print a tab.
Prints a newline.
This will read the input stream until encountering a ')' character, it is used for comments.
Allocate a number of cells in the dictionary.
The stack comment documents this word entirely.
The stack comment documents this word entirely.
The stack comment documents this word entirely. This word rotates three items on the variable stack.
The stack comment documents this word entirely. This word rotates three items on the variable stack, in the opposite direction of "rot".
Write a single character out to the output stream.
The file forth.fth contains many defined words, however those words are documented within that file and so as to avoid duplication will not be mentioned here. This file is not loaded automatically, and so should be run like this:
Unix:
./forth -t forth.fth
Windows
forth.exe -t forth.fth
Usually in computing a 'word' refers to the natural length of integer in a machine, the term 'machine word' is used to invoke this specific meaning, a word in Forth is more analogous to a function, but there are different types of Forth words; immediate and compiling words, internal and defined words and finally visible and invisible words.
The distinction between a machine word and a Forth word can lead to some confusion.
There is only one dictionary in a normal Forth implementation, it is a data structure that can only grow in size (or at least it can in this implementation) and holds all of the defined words.
When we referring to a stack, or the stack, we refer to the variable stack unless otherwise stated (such as the return stack). The variable, or the stack, holds the result of recent operations such as addition or subtraction.
Forth implementations are two (or more) stack machines. The second stack is the return stack which holds the usual function call return values as well as temporary variables.
A defined word is one that is not implement directly by the interpreter but has been create with the ':' word. It can be an immediate word, but does not have to be.
In this mode we compile words unless those words are immediate words, if the are then we immediately execute them.
In this mode, regardless of whether we are in command or compile mode we execute words or push them on to the stack.
A Forth block is primitive way of managing persistent storage and this version of block interface is more primitive than most. A block is a contiguous range of bytes, usually 1024 of them as in this instance, and they can be written or read from disk. Flushing of dirty blocks is not performed in this implementation and must be done 'manually'.
The interpreter code is written in C99, and is written to be portable, however porting it to embedded platforms that lack a C standard library (which is most of them) would mean replacing the most of the C standard library functions used, and implementing a new I/O mechanism for reading, printing and block storage.
The interpreter has been tested on the following platforms:
And the different virtual machine word size options (32 and 64 bit machine words) have been tested. There is no reason it should not also work on 16-bit platforms.
libforth is also available as a Linux Kernel Module, on a branch of libforth, see https://github.com/howerj/libforth/tree/linux-kernel-module. This is module is very experimental, and it is quite possible that it will make your system unstable.
This Forth interpreter is in no way compliant with any of the standards relating to Forth, such as ANS Forth, or previous Forth standardization efforts. However attempts to support words and behavior typical of these standards are made.
Some important deviations are:
In most Forths the "immediate" word goes after a words definition instead of inside it like this:
: word ... ; immediate
Instead this interpreter does it:
: word immediate ... ;
This behavior will not be changed for the foreseeable future, although it is the biggest difference. This is due to how the internals of the interpreter work.
A word can be called immediately before the terminating semi-colon has been reached, in the middle of a word definition. This makes the recurse keyword redundant but means using a previous definition of a word with the same name more difficult (but can be done). This might be a candidate for behavior that should be made more compliant.
'ok' is not printed after a successful command execution , this is for two reasons, firstly because of limitations in the implementation, and secondly there is no reason for cluttering up the output window with this. The implementation should be silent by default.
As mentioned in the standards compliance section, this Forth does things in a non-standard way. Apart from that:
Due to the way Windows opens stdin, stdout, and stderr, there are problems reading in binary files, this can be remedied quite easily with some code that executes before main_forth is called.
int main(int argc, char **argv) {
_setmode(_fileno(stdin), _O_BINARY);
_setmode(_fileno(stdout), _O_BINARY);
return main_forth(argc, argv);
}


GBTIDL FITS files¶
GBTIDL SDFITS sessions can be loaded as pyspeckit.ObsBlock objects using the GBTSession reader:
gbtsession = pyspeckit.readers.GBTSession('AGBTsession.fits')
API¶
GBTIDL SDFITS file¶
GBTIDL SDFITS files representing GBT observing sessions can be read into pyspeckit. Additional documentation is needed. Nodding reduction is supported, frequency switching is not.
- class pyspeckit.spectrum.readers.gbt.GBTSession(sdfitsfile) [github] [bitbucket]¶
A class wrapping all of the above features
Methods
Load an SDFITS file or a pre-loaded FITS file
Methods
- load_target(target, **kwargs) [github] [bitbucket]¶
Load a Target...
- reduce_all() [github] [bitbucket]¶
- reduce_target(target, **kwargs) [github] [bitbucket]¶
Reduce the data for a given object name
- class pyspeckit.spectrum.readers.gbt.GBTTarget(Session, target, **kwargs) [github] [bitbucket]¶
A collection of ObsBlocks or Spectra
Methods
Container for the individual scans of a target from a GBT session
Methods
- reduce(obstype='nod', **kwargs) [github] [bitbucket]¶
Reduce nodded observations (they should have been read in __init__)
- pyspeckit.spectrum.readers.gbt.average_IF(block, debug=False) [github] [bitbucket]¶
Average the polarizations for each feed in each IF
- pyspeckit.spectrum.readers.gbt.average_pols(block) [github] [bitbucket]¶
Average the polarizations for each feed in each IF
- pyspeckit.spectrum.readers.gbt.count_integrations(sdfitsfile, target) [github] [bitbucket]¶
Return the number of integrations for a given target (uses one sampler; assumes same number for all samplers)
- pyspeckit.spectrum.readers.gbt.dcmeantsys(calon, caloff, tcal, debug=False) [github] [bitbucket]¶
from GBTIDL’s dcmeantsys.py ; mean_tsys = tcal * mean(nocal) / (mean(withcal-nocal)) + tcal/2.0
- pyspeckit.spectrum.readers.gbt.find_feeds(block) [github] [bitbucket]¶
Get a dictionary of the feed numbers for each sampler
- pyspeckit.spectrum.readers.gbt.find_matched_freqs(reduced_blocks, debug=False) [github] [bitbucket]¶
Use frequency-matching to find which samplers observed the same parts of the spectrum
WARNING These IF numbers don’t match GBTIDL’s! I don’t know how to get those to match up!
- pyspeckit.spectrum.readers.gbt.find_pols(block) [github] [bitbucket]¶
Get a dictionary of the polarization for each sampler
- pyspeckit.spectrum.readers.gbt.identify_samplers(block) [github] [bitbucket]¶
Identify each sampler with an IF number, a feed number, and a polarization
- pyspeckit.spectrum.readers.gbt.list_targets(sdfitsfile, doprint=True) [github] [bitbucket]¶
List the targets, their location on the sky...
- pyspeckit.spectrum.readers.gbt.read_gbt_scan(sdfitsfile, obsnumber=0) [github] [bitbucket]¶
Read a single scan from a GBTIDL SDFITS file
- pyspeckit.spectrum.readers.gbt.read_gbt_target(sdfitsfile, objectname, verbose=False) [github] [bitbucket]¶
Give an object name, get all observations of that object as an ‘obsblock’
- pyspeckit.spectrum.readers.gbt.reduce_blocks(blocks, verbose=False, average=True, fd0=1, fd1=2) [github] [bitbucket]¶
Do a nodded on/off observation given a dict of observation blocks as produced by read_gbt_target
- pyspeckit.spectrum.readers.gbt.reduce_gbt_target(sdfitsfile, objectname, verbose=False) [github] [bitbucket]¶
Wrapper - read an SDFITS file, get an object, reduce it (assuming nodded) and return it
- pyspeckit.spectrum.readers.gbt.round_to_resolution(frequency, resolution) [github] [bitbucket]¶
kind of a hack, but round the frequency to the nearest integer multiple of the resolution, then multiply it back into frequency space
- pyspeckit.spectrum.readers.gbt.sigref(nod1, nod2, tsys_nod2) [github] [bitbucket]¶
Signal-Reference (‘nod’) calibration ; ((dcsig-dcref)/dcref) * dcref.tsys see GBTIDL’s dosigref
- pyspeckit.spectrum.readers.gbt.totalpower(calon, caloff, average=True) [github] [bitbucket]¶
Do a total-power calibration of an on/off data set (see dototalpower.pro in GBTIDL)
- pyspeckit.spectrum.readers.gbt.uniq(seq) [github] [bitbucket]¶


62 S. Broadway | Peru, Indiana 46970 |<PHONE_NUMBER>
Our amazing team
Kay Garland
Manager
Larry Parker
Lead HairDresser
Diana Pertersen
Nail Specialist
Family is our number one priority, and that's what we consider ourselves here, family. So come on in and meet our, we are always open to adding another to our family.


DVWA is a PHP/MySQL web application that is intentionally vulnerable. The goal is to learn common web vulnerabilities and improve your security skills by training yourself on your own server. 3 levels are available (low, medium and high) to perform those following attacks :
The lowest level is usually pretty easy to bypass but the high level as a best practice presents the right way to protect your application.
The installation is pretty easy, you simply need to extract the zip archive found on DVWA official website in the root directory of your web server. You will then have to configure a dedicated database because DVWA comes with two small tables.
A full tutoriel (fr) is available and you could find a lot of videos on Youtube about how to exploit the vulnerabilities.


--- layout: page ---
{{ site.data.skills | array_to_sentence_string }}
{{job.start}} - {{job.end}}
{{job.achievements}}
{{job.responsibilities}}


Get Started
Calcite Bootstrap is an Esri custom theme and a custom build system for Bootstrap 3. The theme is based on Calcite Web - a web adaptation of Calcite, the desktop framework for ArcGIS Pro. Calcite Bootstrap was built for developers who have experience working with Bootstrap and would like to use the Calcite theme in their web pages and apps.
For instructions on how to get up and running, check out the instructions on the Calcite Bootstrap Github repo until I figure out how to inline a markdown file.
In order to support an organization's ArcGIS Online theme resource in an app, but still use Calcite Boostrap as the baseline theme, this template can serve as a structure outline for importing specific SASS files: /lib/sass/calcite-bootstrap.scss.
In this structure where it says @import "themes/org-theme"
this will not be handled automatically. The presence of this @import
serves as a means for you to test a sample theme locally. To use shared themes, you must have a means to check for the Shared Theme resource within your app. If you have it supported, you can choose to use any number of the theme variables set within the theme resource. (For instance, you may choose to utilize an organization's header background and header text colors from their theme resource, but use Calcite Bootstrap for everything else). Read more about the supported values on our blog.
In the event an organization does not have a shared theme, all the Shared Theme values have been set to Calcite defaults. This is what !default
is doing. It will use any other value that comes in from higher up the chain, but if there is nothing, it will default to Calcite Bootstrap styling.
The ArcGIS Online Shared Theme variables are then mapped to legitimate Bootstrap variables and those Bootstrap variables are used to set styling for all Bootstrap components in the expansions/bootstrap-defaults.scss file and the optional expansion files.
//============================
// Import Calcite theme
//============================
@import "themes/calcite-bootstrap";
//============================
// Import AGO theme resource
//============================
@import "themes/org-theme";
// ┌────────────────────┐
// │ AGO Theme Defaults │
// └────────────────────┘
//## Calcite by Default
$header-background: #fff !default;
$header-text: #4c4c4c !default;
$body-background: #fff !default;
$body-text: #4c4c4c !default;
$body-link: #0079c1 !default;
$button-background: $body-link !default;
$button-text: $body-bg !default;
$logo-small: '' !default;
// ┌──────────────────┐
// │ AGO to Bootstrap │
// └──────────────────┘
$navbar-default-bg: $header-background;
$navbar-default-color: $header-text;
$body-bg: $body-background;
$text-color: $body-text;
$link-color: $body-link;
$link-hover-color: darken($link-color, 10%);
$btn-primary-bg: $button-background;
$btn-primary-color: $button-text;
$btn-primary-border: $button-background;
//============================
// Apply theme to Bootstrap
//============================
@import "expansions/bootstrap-defaults";
//=============================
// Import (optional) Calcite web expansion
//=============================
@import "expansions/calcite-bootstrap-expansion-vars";
@import "expansions/calcite-bootstrap-expansion";


DatabaseCollection
extends DatabaseClass
in package
implements
Iterator, Countable
A class that stores a list of database objects. Useful only through a descendant class.
Interfaces, Classes and Traits
- Iterator
- Countable
Table of Contents
- $connection : DatabaseConnection
- Stores a reference to the connection object.
- $items : array<string|int, mixed>
- Internal items array.
- $iteratorKey : int
- Stores the iterator key for the iterator interface.
- $removedItems : array<string|int, mixed>
- Internal array for removed (but not yet deleted) items.
- __construct() : mixed
- Constructor.
- add() : int
- Adds an item to the collection. If the item is already in the collection it will not be added again. If the item was previously removed (not disposed) it will become accessible again under a new index number.
- addArray() : int
- Adds items from an array. Items will not be added if their classes are not allowed in the collection.
- addNew() : DatabaseObject
- Creates a new item and add it to the collection.
- count() : int
- Returns the number of items in this collection.
- current() : DatabaseObject
- Interface method. Returns the current iterator item.
- dispose() : void
- Removes the item from the collection. No matter if it is accessible or was previously removed, no reference to it will be kept and no further actions will be performed on it.
- find() : null|DatabaseObject
- Finds an item that has an specific property with an specific value. If more than one item matches the combination the first one will be returned.
- findAll() : array<string|int, mixed>
- Finds all items that has an specific property with an specific value.
- getItemsClass() : string
- Returns the class name of the items that this collection works with. Must be implemented by a descendant class.
- getItemsSelectStatement() : string
- Returns a SELECT statement that is used to select objects for this collection. Parameters can be used in the statement, for a named parameter use a ":" followed by the parameter's name (ex SELECT * FROM table ORDER BY :field), for a positional parameter just use a "?". Must be implemented by a descendant class.
- getRemovedItems() : array<string|int, mixed>
- Returns an array containing references to the removed items.
- getSQLStatement() : string|null
- Returns a DML statament for this object. The statement returned varys according to the request type parameter and will be used to select, delete, update or insert data relevant to this object. Parameters can be used in the statement, for a named parameter use a ":" followed by the parameter's name (ex SELECT * FROM table ORDER BY :field), for a positional parameter just use a "?". Must be implemented by a descendant class.
- index() : bool|int
- Gets the index of an item.
- item() : DatabaseObject
- Gets an item by it's index.
- key() : int
- Interface method. Returns the current iterator key.
- next() : void
- Interface method. Advances the iterator key.
- remove() : void
- Makes the item inaccessible in the collection, but keeps a reference to it so it can be deleted from the database later. You can make a removed item accessible again by adding it to the collection again.
- removedCount() : int
- Gets the number of removed items.
- rewind() : void
- Interface method. Sets the iterator key back to beginning.
- valid() : bool
- Interface method. Tells if the current iterator key is valid.
Properties
$connection
Stores a reference to the connection object.
protected
DatabaseConnection
$connection
= null
$items
Internal items array.
protected
array<string|int, mixed>
$items
= []
$iteratorKey
Stores the iterator key for the iterator interface.
protected
int
$iteratorKey
= -1
$removedItems
Internal array for removed (but not yet deleted) items.
protected
array<string|int, mixed>
$removedItems
= []
Methods
__construct()
Constructor.
public
__construct(DatabaseConnection $connection) : mixed
Parameters
- $connection : DatabaseConnection
-
A reference to the connection.
Return values
mixed —add()
Adds an item to the collection. If the item is already in the collection it will not be added again. If the item was previously removed (not disposed) it will become accessible again under a new index number.
public
add(DatabaseObject $item) : int
Parameters
- $item : DatabaseObject
-
The item to add.
Tags
Return values
int —The index of the item.
addArray()
Adds items from an array. Items will not be added if their classes are not allowed in the collection.
public
addArray(array<string|int, mixed> $array) : int
Parameters
- $array : array<string|int, mixed>
-
An array of database objects.
Return values
int —The number of added items.
addNew()
Creates a new item and add it to the collection.
public
addNew(mixed ...$extra) : DatabaseObject
Parameters
- $extra : mixed
-
Any number of parameters of any kind, passed to the object constructor.
Return values
DatabaseObject —The new item.
count()
Returns the number of items in this collection.
public
final count() : int
Return values
int —Number of items.
current()
Interface method. Returns the current iterator item.
public
final current() : DatabaseObject
Return values
DatabaseObject —dispose()
Removes the item from the collection. No matter if it is accessible or was previously removed, no reference to it will be kept and no further actions will be performed on it.
public
dispose(int|DatabaseObject $item) : void
Parameters
- $item : int|DatabaseObject
-
Item to dispose or it's index. If an index is used it will not be possible to dispose removed items, only accessible ones.
Tags
Return values
void —find()
Finds an item that has an specific property with an specific value. If more than one item matches the combination the first one will be returned.
public
find(string $property, mixed $value) : null|DatabaseObject
Parameters
- $property : string
-
Property's name.
- $value : mixed
-
Property's value.
Return values
null|DatabaseObject —An item or Null if no items match.
findAll()
Finds all items that has an specific property with an specific value.
public
findAll(string $property, mixed $value) : array<string|int, mixed>
Parameters
- $property : string
-
Property's name.
- $value : mixed
-
Property's value.
Return values
array<string|int, mixed> —An array containing all the items that matched the property/value combination.
getItemsClass()
Returns the class name of the items that this collection works with. Must be implemented by a descendant class.
public
abstract static getItemsClass() : string
It's better to return a fully qualified class name.
Return values
string —Class name
getItemsSelectStatement()
Returns a SELECT statement that is used to select objects for this collection. Parameters can be used in the statement, for a named parameter use a ":" followed by the parameter's name (ex SELECT * FROM table ORDER BY :field), for a positional parameter just use a "?". Must be implemented by a descendant class.
public
abstract static getItemsSelectStatement() : string
Tags
Return values
string —An SQL SELECT statement.
getRemovedItems()
Returns an array containing references to the removed items.
public
getRemovedItems() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of database objects.
getSQLStatement()
Returns a DML statament for this object. The statement returned varys according to the request type parameter and will be used to select, delete, update or insert data relevant to this object. Parameters can be used in the statement, for a named parameter use a ":" followed by the parameter's name (ex SELECT * FROM table ORDER BY :field), for a positional parameter just use a "?". Must be implemented by a descendant class.
public
static getSQLStatement(int $type) : string|null
Parameters
- $type : int
-
One the DatabaseConnection::STATEMENT_* constants. Currently only STATEMENT_SELECT is used with collections.
Tags
Return values
string|null —An SQL statement or null if there are no statement for that type.
index()
Gets the index of an item.
public
index(DatabaseObject $item) : bool|int
Parameters
- $item : DatabaseObject
-
A DatabaseObject
Return values
bool|int —The index of the item or False if the item isn't in the collection. Be careful to not evaluate 0 (zero) as False.
item()
Gets an item by it's index.
public
item(int $index) : DatabaseObject
Parameters
- $index : int
-
Index of the item.
Tags
Return values
DatabaseObject —key()
Interface method. Returns the current iterator key.
public
final key() : int
Return values
int —next()
Interface method. Advances the iterator key.
public
final next() : void
Return values
void —remove()
Makes the item inaccessible in the collection, but keeps a reference to it so it can be deleted from the database later. You can make a removed item accessible again by adding it to the collection again.
public
remove(int|DatabaseObject $item) : void
Parameters
- $item : int|DatabaseObject
-
Item to remove or it's index.
Tags
Return values
void —removedCount()
Gets the number of removed items.
public
removedCount() : int
Return values
int —rewind()
Interface method. Sets the iterator key back to beginning.
public
final rewind() : void
Return values
void —valid()
Interface method. Tells if the current iterator key is valid.
public
final valid() : bool
Return values
bool —True if valid.


Foster's Flashers
Study
Create
History
Pick your Knowledge
Select Artists
Monty Python
Eric Idle
John Cleese
Select
Show Response
Next


--- title: 'A comment on the novel transformation of the response in " Senolytics decrease senescent cells in humans: Preliminary report from a clinical trial of Dasatinib plus Quercetin in individuals with diabetic kidney disease"' author: Jeff Walker date: '2019-10-02' slug: a-comment-on-the-novel-transformation-of-the-response-in-senolytics-decrease-senescent-cells-in-humans-preliminary-report-from-a-clinical-trial-of-dasatinib-plus-quercetin-in-individuals-with-diabetic-kidney-disease categories: - stats 101 tags: - fake data keywords: - tech ---
Motivation: https://pubpeer.com/publications/8DF6E66FEFAA2C3C7D5BD9C3FC45A2#2 and https://twitter.com/CGATist/status/1175015246282539009
tl;dr: Given the transformation done by the authors, for any response in day_0 that is unusually small, there is automatically a response in day_14 that is unusually big and vice-versa. Consequently, if the mean for day_0 is unusually small, the mean for day_14 is automatically unusually big, hence the elevated type I error with an unpaired t-test. The transformation is necessary and sufficient to produce the result (meaning even in conditions where a paired t-test isn’t needed, the transformation still produces elevated Type I error).
Pubpeer and Twitter alerted the world to interesting looking figures from a recent publication. The paper itself is on a pair of drugs that target senescent cells to reduce the number of senescent cells in a tissue. The raw response is a count of senescent cells before (day 0) and after (day 14) treatment. I read the paper quickly but don’t see a control.
The figures in the paper (and tweeted) clearly show that the 1) analyzed response is not a raw count and 2) the value of the two responses for individual \(i\) are symmetric about the mean response. A pubpeer query got this response from an author:
To test for effects on % reduction in senescent cells WITHIN subjects without confounding effects of variations of initial senescent cell burden among subjects, data are expressed as % of values at day 0 + day 14 for each subject, i.e. value at time 0 for subject 1 is: absolute value at day 0 for subject 1/(absolute value at day 0 for subject 1 + absolute value at day 14 for subject 1) x 100. Thus, % at day 0 + % at day 14 for subject 1 = 100.
It’s pretty easy to see this is the case looking at the figures. I commented to twitter
Some later responses noted the perfect, negative correlation among the response, but the underlying problem is, fundamentally, the perfect, negative correlation within individuals, which occurs because the transformation necessarily makes an individual’s day 0 and day 14 measures symmetric about the mean (that is “perfect, negative correlation within individuals”) – see the two figures at the end of this post. Given the transformation, then, for any response in day_0 that is unusually small, there is automatically a response in day_14 that is unusually big and vice-versa. Consequently, if the mean for day_0 is unusually small, the mean for day_14 is automatically unusually big, hence the elevated type I error.
Anyway, my response went un-noticed and, motivated by a new twitter post from Andrew Althouse, I decided to revisit the issue using a simulation to check my understanding of what the transformation does and why it inflates Type I error.
The response is a count, which is not Gaussian. Regardless, this initial simulation uses a normal (conditional) response.
n <- 9
mu <- 100 # overall mean
sigma_w <- 10 # variation within ID
amp_vals <- c(0.001, 0.66, 1) # rho = 0, ~0.3, 0.5
n_iter <- 10^4 # number of simulated data sets per amp_val
# vectors of p-values with different t-tests
p.norm_unpaired <- numeric(n_iter)
p.norm_paired <- numeric(n_iter)
p.count_unpaired <- numeric(n_iter)
p.count_paired <- numeric(n_iter)
# of vector of pre-post correlations just to check my rho
r <- numeric(n_iter)
t1_table <- data.frame(matrix(NA, nrow=6, ncol=length(amp_vals)))
row.names(t1_table) <- c("Among:Within", "rho", "trans unpaired", "trans paired", "raw unpaired", "raw paired")
set.seed(1) # so the results are precisely reproducible
for(amp in amp_vals){ # controls among:within variance
sigma_a <- amp*sigma_w # variation among ID
# fill in first two rows of results table
t1_table["Among:Within", which(amp_vals==amp)] <- amp^2
rho <- (amp*sigma_w)^2/((amp*sigma_w)^2 + sigma_w^2)
t1_table["rho", which(amp_vals==amp)] <- rho
# not a super efficient simulation but the for loop is more readable
for(iter in 1:n_iter){
mu_i <- rnorm(n=n, mean=mu, sd=sigma_a) # means of each ID
count_0 <- rnorm(n, mean=mu_i, sd=sigma_w) # counts at day 0
count_14 <- rnorm(n, mean=mu_i, sd=sigma_w) # counts at day 14
norm_0 <- count_0/(count_0 + count_14) # transformed response
norm_14 <- count_14/(count_0 + count_14) # transformed response
r[iter] <- cor(count_0, count_14)
p.norm_unpaired[iter] <- t.test(norm_0, norm_14, var.equal=FALSE)$p.value
p.norm_paired[iter] <- t.test(norm_0, norm_14, paired=TRUE)$p.value
p.count_unpaired[iter] <- t.test(count_0, count_14, var.equal=FALSE)$p.value
p.count_paired[iter] <- t.test(count_0, count_14, paired=TRUE)$p.value
}
# build the table of type I error
t1_table[3:6, which(amp_vals==amp)] <- c(
sum(p.norm_unpaired < 0.05)/n_iter,
sum(p.norm_paired < 0.05)/n_iter,
sum(p.count_unpaired < 0.05)/n_iter,
sum(p.count_paired < 0.05)/n_iter
)
}
| Sim1 | Sim2 | Sim3 | |
|---|---|---|---|
| Among:Within | 0.000 | 0.436 | 1.000 |
| rho | 0.000 | 0.303 | 0.500 |
| trans unpaired | 0.169 | 0.170 | 0.176 |
| trans paired | 0.048 | 0.052 | 0.050 |
| raw unpaired | 0.048 | 0.023 | 0.009 |
| raw paired | 0.048 | 0.053 | 0.051 |
The table of type I errors shows
Here are the residuals of the linear model version of the unpaired t-test. The y-axis is the residual and the x-axis is the ID. The residuals are perfectly symmetric about zero, with one value of each individual above zero and the other below zero.
day <- as.factor(rep(c("day_0", "day_14"), each=n))
count <- c(norm_0, norm_14)
id <- as.character(rep(1:n, times=2))
m1 <- lm(count ~ day)
res <- residuals(m1)
qplot(id, res, color=day) +
ylab("Residuals") +
NULL
The perfect, negative correlation of the residuals is more explicitly shown with a scatterplot of day_14 residuals vs. day_0 residuals.
There is some discussion on twitter and pubpeer on the mechanism of the inflated type I error; is it 1) the unpaired t-test, 2) the transformation, or 3) combination of both? The unpaired t-test is not the mechanism, because without the transformation, the unpaired t-test is conservative (fewer type I error than nominal) not liberal. It is the transformation that inflates the error. But, because of what a paired t-test does (it tests b-a = 0), it is unaffected by the transformation.


SELECT
Select
×
Modal title
Select
This is my textarea to be replaced with CKEditor.
This is my textarea to be replaced with TinyMCE 4 editor.


Cumulative Record. Teacher Suite
The scenario of exam procedure
Prepare the exam list for selected group and course
Error: Please enter a valid group/course data
Enter a group name:
Enter a course name:
ID
Test Id
Group
Student
Course
Teacher
Assigned Time
Exam Time
Rate
{{exam.Key}}
{{exam.testId}}
{{exam.group}}
{{exam.studentName}}
{{exam.course}}
{{exam.teacher}}
{{exam.assignedTS}}
{{exam.executeTS}}
{{exam.rate}}
PASS
Pass an exam
Error: Please enter a valid ID/course data for UNPASSED test
Congratulation: The exam has been approved!
Enter a student unique Id:
Enter a course name:
Enter an exam rate:
Back to Main Page
Officer Page
Student Page


Note that the content is not cached. Each time a tab is selected the content is rendered anew
(e.g. if a component is nested in the tab content, ngOnInit will be called again).
Content 1 - Initially Loaded: {{getTimeLoaded(1) | date:'medium'}}
Content 2 - Initially Loaded: {{getTimeLoaded(2) | date:'medium'}}
Content 3 - Initially Loaded: {{getTimeLoaded(3) | date:'medium'}}
Content 4 - Initially Loaded: {{getTimeLoaded(4) | date:'medium'}}
Content 5 - Initially Loaded: {{getTimeLoaded(5) | date:'medium'}}


{% extends "bootstrap/base.html" %} {% import "bootstrap/utils.html" as utils %} {% block title %}Votes for 2019 euro parliament and Referendum{% endblock %} {# Then, inside the head block, we apply these. To not replace the header, ``super()`` is used: #} {% block head %} {{super()}} {%- endblock %} {% block content %}
| County Code | County Name | Max voters | Difference voters Total | Difference voters rural | Difference voters urban | Difference presence |
|---|---|---|---|---|---|---|
| {{ county.code }} | {{ county.name }} | {{ county.max_voters }} | {{ county.voters_total }} | {{ county.voters_rural }} | {{ county.voters_urban }} | {{ county.presence_str }} |


We are a fast growing Nigerian Hair brand focused on providing quality wigs, weaves and other hair accessories to our esteemed clients and customers. Our drive for customer satisfaction has endeared us to women all around Nigeria.
We are embarking on a training for mothers and even single women on the of children's hair for school, church and other social events.
Your Baby girls deserve that Disney Princess experience.... You can make that happen!
Venue: Whatsapp chat group
Amount: N 1,000
Copyright © Mimishairdom 2020