class: center, top, title-slide # STAT 155, Lecture Slides 1 ## Introduction and Getting Started with R ### Bryan Martin --- # Outline 1. Brief Course Overview 2. Introduction to R, RStudio, and R Markdown 3. Getting started with data .middler[**Goal:** Create a functional R Markdown document utilizing basic R functionality (Homework 1)] --- # Expectations What you should expect from me... * your learning will be my priority * you will be treated like an adult and with respect * your feedback will be valued * timely feedback on assignments * understandable and well-paced lectures (tell me if they are not!) * an attempt at making statistics as fun for you as it is for me! --- # Expectations What I will expect from you... * regular attendance * timely assignments that represent your best work * a respectful and engaged classroom * a desire and effort to learn challenging material --- # Slack Engagement .pull-left[ ### Bad questions: * How do you do problem 2? * Here's my code and it's broken. How do I fix it? ] .pull-right[ ### Good questions: * Here's a snippet of code I used for problem 2:
`formatted code snippet`
It returned the following error:
`formatted error message`
Does anyone know why? I already tried... * I don't understand the concept from Slide 18 today. Could anyone elaborate on why... ] --- # Slack Engagement .pull-left[ ### Bad answers: * Here's my solution * Fool! You should already know the answer to this! Your trivial question is no match for my superior intellect! ] .pull-right[ ### Good answers: * This error message occurs because your variable is a string instead of a numeric. Have you tried checking... * I think you have a bug in line 3 of the code you posted. You have more left parentheses than right parentheses so the line is incomplete. ] --- # Why R? R is a programming language designed for statistical analysis. -- * open-source * free * large and active community of developers and users * great analysis tools * great visualization tools -- * great user interface... --- # Why RStudio? RStudio is an integrated development environment (IDE) designed to make your life easier. -- * Organizes scripts, files, plots, code console, ... * Highlights syntax * Helpful interactive graphical interface * Will make an efficient, reproducible workflow *much* easier -- * R Markdown integration... --- # Why R Markdown? * Interface between code, output, and writing * Self-contained analyses * Creates HTML, PDF, slides (like these!), webpages, ... -- * Required for your labs! --- class: inverse .middler[.huge[Part 1: Introduction to R Utilities]] --- # Operators ```r # Addition 6 + 3 ``` ``` ## [1] 9 ``` ```r # Subtraction 6 - 3 ``` ``` ## [1] 3 ``` ```r # Multiplication 6 * 3 ``` ``` ## [1] 18 ``` ```r # Division 6 / 3 ``` ``` ## [1] 2 ``` --- # Comparison Operators ```r # Greater than 6 > 3 ``` ``` ## [1] TRUE ``` ```r # Less than 6 < 3 ``` ``` ## [1] FALSE ``` ```r # Equal to 6 == 3 ``` ``` ## [1] FALSE ``` ```r 6 == 3 + 3 ``` ``` ## [1] TRUE ``` --- # Comparison Operators ```r # Not equal to 6 != 3 ``` ``` ## [1] TRUE ``` ```r 6 < 6 ``` ``` ## [1] FALSE ``` ```r # Less than or equal to 6 <= 6 ``` ``` ## [1] TRUE ``` --- # Logical Operators ```r # and (6 < 3) & (1 < 3) ``` -- ``` ## [1] FALSE ``` -- ```r # and (2 < 3) & (1 < 3) ``` -- ``` ## [1] TRUE ``` -- ```r # or (6 < 3) | (1 < 3) ``` -- ``` ## [1] TRUE ``` -- ```r # a bit harder... (6 < 3) | (1 < 3) & (6 < 3) ``` -- ``` ## [1] FALSE ``` --- # Object Types ```r class(7) ``` ``` ## [1] "numeric" ``` ```r class("7") ``` ``` ## [1] "character" ``` ```r is.numeric(7) ``` ``` ## [1] TRUE ``` ```r is.numeric("7") ``` ``` ## [1] FALSE ``` --- # Object Types ```r is.character(7) ``` ``` ## [1] FALSE ``` ```r is.character("7") ``` ``` ## [1] TRUE ``` ```r is.na(7) ``` ``` ## [1] FALSE ``` ```r is.na(0/0) ``` ``` ## [1] TRUE ``` --- # Object Types ```r as.character(7) ``` ``` ## [1] "7" ``` ```r as.numeric("7") ``` ``` ## [1] 7 ``` ```r as.numeric("7") + 3 == 10 ``` ``` ## [1] TRUE ``` ```r "7" + 3 == 10 ``` ``` ## Error in "7" + 3: non-numeric argument to binary operator ``` --- # Assigning Variables ```r x <- 7 x ``` ``` ## [1] 7 ``` ```r x + 3 ``` ``` ## [1] 10 ``` ```r x == 7 ``` ``` ## [1] TRUE ``` ```r as.character(x) ``` ``` ## [1] "7" ``` ```r y <- 3 x + y ``` ``` ## [1] 10 ``` --- # Workspaces ```r # List all defined objects ls() ``` ``` ## [1] "x" "y" ``` ```r # Remove an object rm("x") ls() ``` ``` ## [1] "y" ``` ```r x ``` ``` ## Error in eval(expr, envir, enclos): object 'x' not found ``` --- # Workspaces ```r x <- 7 ls() ``` ``` ## [1] "x" "y" ``` ```r # Use with caution!  * Computers completely ignore comments (in R, any line preceded by `#`) * Comments do not impact the functionality of your code at all. -- ### So why do them... -- * Commenting a code allows you to write notes for readers of your code only * Usually, that reader is you! * Coding without comments is ill-advised, bordering on impossible -- * Sneak peak at functions... --- ```r #' Wald-type t test #' @param mod an object of class \code{bbdml} #' @return Matrix with wald test statistics and p-values. Univariate tests only. waldt <- function(mod) { # Covariance matrix covMat <- try(chol2inv(chol(hessian(mod))), silent = TRUE) if (class(covMat) == "try-error") { warning("Singular Hessian! Cannot calculate p-values in this setting.") np <- length(mod$param) se <- tvalue <- pvalue <- rep(NA, np) } else { # Standard errors se <- sqrt(diag(covMat)) # test statistic tvalue <- mod$param/se # P-value pvalue <- 2*stats::pt(-abs(tvalue), mod$df.residual) } # make table coef.table <- cbind(mod$param, se, tvalue, pvalue) dimnames(coef.table) <- list(names(mod$param), c("Estimate", "Std. Error", "t value", "Pr(>|t|)")) return(coef.table) } ``` --- ## Comment Style Guide * When starting out, you should comment most lines * Frequent use of comments should allow most comments to be restricted to one line for readability * A comment should go above its corresponding line, be indented equally with the next line, and use a single `#` to mark a comment * Use a string of `-` or `=` to break your code into easily noticeable chunks * Example: `# Data Manipulation -----------` * RStudio allows you to collapse chunks marked like this to help with clutter -- * There are exceptions to every rule! Usually, comments are to help **you**! --- ## Example of when I break my own rules * Here's a snippet of a long mathematical function I wrote (lots code emitted with ellipses for space). * In order to help myself read through it later, I divided the function into major steps marked by easily visible comments I can see when scanning through ```r objfun <- function(theta, W, M, X, X_star, np, npstar, link, phi.link) { ### STEP 1 - Negative Log-likelihood # extract matrix of betas (np x 1), first np entries b <- utils::head(theta, np) # extract matrix of beta stars (npstar x 1), last npstar entries b_star <- utils::tail(theta, npstar) ... ### STEP 2 - Gradient # define gam gam <- phi/(1 - phi) ``` --- ## A final plea * Being a successful programmer *requires* commenting your code * Want to understand code you wrote >24 hours ago without comments? -- .center[![David](davidsmall.gif)] .center[.small[I just learned you can add gifs to R Markdown slides. Expect a lot of these]] -- * If you still aren't convinced... -- * Clear commenting is required for this course --- layout:false class: inverse .middler[.huge[Part 2: Using RStudio and R Markdown]] --- # RStudio Interface By default... * *Top left*: Editor pane. Browse and edit scripts and data with tabs * *Top right*: List of objects in your Environment (recall `ls()`), code History * *Bottom left*: Console for running R code line-by-line (`>` prompt) * *Bottom right*: Files, plots, packages, help files --- # Editor * Your workflow should be contained here (**not** your console) * Primarily used for writing and editing .R scripts -- * Try opening a file now using *File > New File > R Script*, write two lines of simple code * Click `Run` in the bar above your script. What happens? * Click on one of the lines of code. Press `Ctrl`/`⌘` + `Enter`. What happens? -- .center[**Important:** Every part of your R workflow belongs in this window!] --- layout: true # Environment & History * If you didn't already, define a variable in your R Script and run it * What happens in your Environment tab? -- * Type `install.packages("palmerpenguins")` in your Console. * Now add `library(palmerpenguins)` and `data(penguins)` to your script and run it.  * Note: We will delve deeper into data later! -- * Remove one of your variables and see what happens. --- * Click on the History tab to see what it contains. Try searching! -- * Select a line from your history and click `To Source`. What happens? -- * Useful for adding lines that you tested in your Console to your scripts -- .pushdown[.center[**Summary:** Useful to quickly browse what you have defined in your environment]] --- layout: false layout: true # Console --- * The quick and easy way to run individual lines of code * Nothing you do here is saved as part of your workflow! -- * Useful for debugging, testing code, iterating a plot until you like it ... * Once you get what you were looking for, add it to your script files! * **Never** manipulate your data in the console. Your workflow should always be **reproducible!** --- ## Incomplete Code What if we start a command, but do not finish it? ```r > 5 - + ``` Two options: * Press `Esc` to exit and *not* execute the line * Complete the command --- layout: false # Files, Plots, Packages, Help * We will explore this tab more as we get into functions and visualization * Files is used to browse the files on your computer * Useful for opening files/data, moving files you are working with * *Use caution!* Changing files here is the same as changing them on your computer. If you delete something, it's gone! * Plots are used to display plots you create in R * Help is used to browse help files of functions. You can explore these by preceding a function name with `?`. Try `?sqrt` to see. * Packages shows all the packages you currently have installed (we will get more into this later!) --- class: inverse .middler[.huge[Brief Intermission: File Organization]] --- layout:true # File Names Matter --- .middler[![lion](lionking.jpg)] --- .pull-left[ ## Bad * `newfinal2actualFINALnew.docx` * `asdfasdf.R` * `analy$i$ functions!.R` * `stuff.R` * Cluttered * Uninformative * Spaces * Special characters other than `_` and `-` ] .pull-right[ ## Good * `stat302_lab1.Rmd` * `analysis_functions.R` * `analysisFunctions.R` * `2020-01-08_labWriteup.Rmd` * Meaningful * Concise * camelCase or using `_` to distinguish words * Machine sortable ] --- ## Summary * Machine readable * Human readable * Plays well with default ordering -- * `01_draft.Rmd`, `02_draft.Rmd` , ... , `11_draft.Rmd` * `2018-05-05_resume.docx`, `2019-02-17_resume.docx`, `2020-01-08_resume.docx` --- layout: false layout: true # File Organization Matters --- .middler[![](disorganized.gif)] --- Easier to start with best practice rather than fix things later! -- 1. Somewhere on your computer, create the folder `STAT155` 2. Within that folder, create the subfolders `Homeworks` and `Projects` 3. Within your Homeworks folder, create a subfolder `homework1` -- .pushdown[May seem excessive for now, but this will come in handy when labs start including extra files such as data and figures!] --- layout: false # All done! For now... .middler[![](files.gif)] --- layout: true # R Markdown --- Let's try making an R Markdown file: 1. Choose *File > New File > R Markdown...* 2. Make sure *HTML Output* is selected and click OK 3. Save the file in your new folder, call it `homework1.Rmd` * *Hint:* Follow along, because this will become your Homework 1 submission! 4. Click the *Knit HTML* button * After it is done, browse to the file location using the `Files` tab. What do you notice? * Click *Open in Browser* to view the full HTML --- ## R Markdown Headers The header of .Rmd files is YAML (YAML Ain't Markup Language) code 5. Change `title` to "Homework 1" 6. Change `author` to your name in quotes 7. Change `date` to the due date in quotes -- Congrats! You have a functional .Rmd that will soon be your Homework 1 submissions! --- ## R Markdown Syntax (Thanks to Charles Lanfear, UW Sociology, for this very concise summary) --- .pull-left[ ## Output **bold/strong emphasis** *italic/normal emphasis* .forcehead[Header] ## Subheader ### Subsubheader ] .pull-right[ ## Syntax <pre> **bold/strong emphasis** *italic/normal emphasis* # Header ## Subheader ### Subsubheader </pre> ] --- .pull-left[ ## Output 1. Ordered lists 1. Are real easy 1. Even with sublists 1. Or when lazy with numbering * Unordered lists * Are also real easy + Also even with sublists [URLs are trivial](http://www.uw.edu) ![pictures too](http://depts.washington.edu/uwcreate/img/UW_W-Logo_smallRGB.gif) ] .pull-right[ ## Syntax <div style="width:400px;overflow:auto"> <pre> 1. Ordered lists 1. Are real easy 1. Even with sublists 1. Or when lazy with numbering * Unordered lists * Are also real easy + Also even with sublists [URLs are trivial](http://www.uw.edu) ![pictures too](http://depts.washington.edu/uwcreate/img/UW_W-Logo_smallRGB.gif) </div> </pre> ] --- .pull-left[ ## Output You can put some math `\(y= \left( \frac{2}{3} \right)^2\)` right up in there. `$$\frac{1}{n} \sum_{i=1}^{n} x_i = \bar{x}_n$$` Or a sentence with `code-looking font`. Or a block of code: ``` y <- 1:5 z <- y^2 ``` ] .pull-right[ ## Syntax <div style="width:400px;overflow:auto"> <pre> You can put some math $y= \left(\frac{2}{3} \right)^2$ right up in there `$$\frac{1}{n} \sum_{i=1}^{n} x_i = \bar{x}_n$$` Or a sentence with `code-looking font`. Or a block of code: ``` y <- 1:5 z <- y^2 ``` </pre> ] </div> --- ## Helpful Links * [R Markdown: The Definitive Guide](https://bookdown.org/yihui/rmarkdown/) * [R Markdown Cheatsheet](https://www.rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf) --- ## R Code within R Markdown As you saw in Short Lab 1, we can run and execute R code within R Markdown. To do so encase your code as follows. ```{r, eval = TRUE, echo = TRUE} # Your code goes here! ``` You can click the green triangle in the corner to evaluate that code chunk to preview the results without compiling the entire document --- ## Useful Code Chunk Parameters Parameters go into the opening brackets `{r}` and are separated by commas. Here are some you might find useful (checkout the guide links above for more): * `echo=FALSE`: Hide R code but keep results * `eval=FALSE`: Do not execute the R code * `include=FALSE`: Hides all output (useful to load packages at the beginning of your document) * `cache=TRUE`: Stores the results of the chunk, and only re-runs if the chunk is changed. Useful for files that take a while to compile * `fig.height=5, fig.width=5`: modify the dimensions of any plots that are generated in the chunk (units are in inches) --- ## In-Line R Code You can also include and execute R code directly in the text of your .Rmd! For example, say we define a variable ```r x <- 7 ``` If I want to reference this variable in text, I can do so directly by writing using ticks and starting with r. So if I type: The variable I want to reference is `r x`. what will appear is: The variable I want to reference is 7. --- ## In-Line R Code * This allows you to easily see where your values came from! * This prevents any typos in translating coding results to text! * This allows you to modify your analysis without needing to copy and paste updated results into your text! --- layout: false class: inverse .middler[.huge[Part 3: Data Types]] --- layout: true # Vectors --- * A **vector** is a set of values of the same type * We create vectors using the function `c()` ```r c(16, 3, 0, 7, -2) ``` ``` ## [1] 16 3 0 7 -2 ``` * We can shorthand vectors counting up (or down) using `:` ```r 1:5 ``` ``` ## [1] 1 2 3 4 5 ``` --- * We can also generate vectors using functions such as `rep()` and `seq()` ```r # Sequence from 1 to 20, incrementing by 5 seq(1, 20, by = 5) ``` ``` ## [1] 1 6 11 16 ``` ```r # Repeat each element of a vector 3 times each rep(c(1, 2), each = 3) ``` ``` ## [1] 1 1 1 2 2 2 ``` ```r # Repeat an entire vector 3 times rep(c(1, 2), 3) ``` ``` ## [1] 1 2 1 2 1 2 ``` --- * We index vectors using `[index]` after the vector name ```r x <- 1:5 x[3] ``` ``` ## [1] 3 ``` * If we use a negative index, we return the vector with that element removed ```r x[-4] ``` ``` ## [1] 1 2 3 5 ``` --- ## Vector Arithmetic **Vectorization**, or applying functions across vectors/arrays, is one of R's most powerful capabilities ```r y <- -5:-1 y ``` ``` ## [1] -5 -4 -3 -2 -1 ``` ```r x + y ``` ``` ## [1] -4 -2 0 2 4 ``` ```r x * y ``` ``` ## [1] -5 -8 -9 -8 -5 ``` --- Be careful! R **recycles**, repeating elements of shorter vectors to match longer vectors. This is incredibly useful when done on purpose, but can also easily lead to hard-to-catch bugs in your code! ```r 2 * x ``` ``` ## [1] 2 4 6 8 10 ``` ```r c(1, -1) * x ``` ``` ## Warning in c(1, -1) * x: longer object length is not a multiple of shorter ## object length ``` ``` ## [1] 1 -2 3 -4 5 ``` ```r c(1, -1) + x ``` ``` ## Warning in c(1, -1) + x: longer object length is not a multiple of shorter ## object length ``` ``` ## [1] 2 1 4 3 6 ``` --- We can apply many functions component-wise to vectors, including comparison operators. ```r x >= 3 ``` ``` ## [1] FALSE FALSE TRUE TRUE TRUE ``` ```r y < -2 ``` ``` ## [1] TRUE TRUE TRUE FALSE FALSE ``` ```r (x >= 3) & (y < -2) ``` ``` ## [1] FALSE FALSE TRUE FALSE FALSE ``` ```r x == c(1, 3, 2, 4, 5) ``` ``` ## [1] TRUE FALSE FALSE TRUE TRUE ``` --- ## Boolean Vectors In code, entries that are `TRUE` or `FALSE` are called **booleans**. These are incredibly important, because they can be used to give your computer conditions. What will the following code do? ```r x[x > 3] <- 3 x ``` -- ``` ## [1] 1 2 3 3 3 ``` --- ## Boolean Vectors We can also do basic arithmetic with booleans. `TRUE` is encoded as `1` and `FALSE` is encoded as `0`. ```r # First reset x x <- 1:5 sum(x >= 3) ``` -- ``` ## [1] 3 ``` -- ```r mean(x >= 3) ``` -- ``` ## [1] 0.6 ``` -- What is this last quantity telling us? -- By taking the mean, we are looking at the **proportion** of our vector that is `TRUE`! --- We can also get more complicated with our indexing. ```r # Return the second and third elements of y[c(2, 3)] ``` ``` ## [1] -4 -3 ``` ```r # Return the values of x greater than 3 x[x >= 3] ``` ``` ## [1] 3 4 5 ``` ```r # Values of x that match the index of the values of y that are less than -2 x[y < -2] ``` ``` ## [1] 1 2 3 ``` ```r # which() returns the index of entries that are TRUE which(y < -2) ``` ``` ## [1] 1 2 3 ``` --- We can compare entire vectors using `identical()` ```r identical(x, -rev(y)) ``` ``` ## [1] TRUE ``` What do you think the function `rev()` is doing in the code above? *Hint:* Use `?rev` to read the help files for the function --- ## Vector Data Types Note that vectors can only have one type of data. So we can do ```r c(1, 2, 3) ``` ``` ## [1] 1 2 3 ``` ```r c("a", "b", "c") ``` ``` ## [1] "a" "b" "c" ``` but when we try ```r c(1, "b", 3) ``` ``` ## [1] "1" "b" "3" ``` R will force the entries vector to be of the same type! This is a common source of bugs. --- ## Names We can assign names to the entries of our vectors using `names()`. This can be useful to label our data. Note that arithmetic doesn't change the names of our elements. ```r my_vec <- c(1, 2, 3) names(my_vec) <- c("a", "b", "c") my_vec ``` ``` ## a b c ## 1 2 3 ``` ```r my_vec + 1 ``` ``` ## a b c ## 2 3 4 ``` We can then access the names as their own vector by calling `names()` again. ```r names(my_vec) ``` ``` ## [1] "a" "b" "c" ``` --- ## Useful functions for vectors * `max()`, `min()`, `mean()`, `median()`, `sum()`, `sd()`, `var()` * `length()` returns the number of elements in the vector * `head()` and `tail()` return the beginning and end vectors * `sort()` will sort * `summary()` returns a 5-number summary * `any()` and `all()` to check conditions on Boolean vectors * `hist()` will return a crude histogram (we'll learn how to make this nicer later) You will need some of these for Lab 1! If you are unclear about what any of them do, use `?` before the function name to read the documentation. You should get in the habit of checking function documentation a lot! --- layout: false layout: true # Matrices --- * **Matrices** are two-dimensional extension of vectors, they have **rows** and **columns** * We can create a matrix using the function `matrix()` ```r my_matrix <- matrix(c(x, y), nrow = 2, ncol = 5, byrow = TRUE) my_matrix ``` ``` ## [,1] [,2] [,3] [,4] [,5] ## [1,] 1 2 3 4 5 ## [2,] -5 -4 -3 -2 -1 ``` ```r # Note: byrow = FALSE is the default my_matrix2 <- matrix(c(x, y), nrow = 2, ncol = 5) my_matrix2 ``` ``` ## [,1] [,2] [,3] [,4] [,5] ## [1,] 1 3 5 -4 -2 ## [2,] 2 4 -5 -3 -1 ``` .center[*Warning:* be careful not to call your matrix `matrix`! Why not?] --- We can also generate matrices by column binding (`cbind()`) and row binding (`rbind()`) vectors ```r cbind(x, y) ``` ``` ## x y ## [1,] 1 -5 ## [2,] 2 -4 ## [3,] 3 -3 ## [4,] 4 -2 ## [5,] 5 -1 ``` ```r rbind(x, y) ``` ``` ## [,1] [,2] [,3] [,4] [,5] ## x 1 2 3 4 5 ## y -5 -4 -3 -2 -1 ``` --- ## Indexing and Subsetting Matrices Indexing a matrix is similar to indexing a vector, except we must index both the row and column, in that order. ```r my_matrix ``` ``` ## [,1] [,2] [,3] [,4] [,5] ## [1,] 1 2 3 4 5 ## [2,] -5 -4 -3 -2 -1 ``` ```r my_matrix[2, 3] ``` -- ``` ## [1] -3 ``` -- ```r my_matrix[2, c(1, 3, 5)] ``` -- ``` ## [1] -5 -3 -1 ``` --- Also similarly to vectors, we can subset using a negative index. ```r my_matrix ``` ``` ## [,1] [,2] [,3] [,4] [,5] ## [1,] 1 2 3 4 5 ## [2,] -5 -4 -3 -2 -1 ``` ```r my_matrix[-2, -4] ``` ``` ## [1] 1 2 3 5 ``` ```r # Note: Leaving an index blank includes all indices my_matrix[, -c(1, 3, 4, 5)] ``` ``` ## [1] 2 -4 ``` --- ```r my_matrix[, -c(1, 3, 4, 5)] ``` ``` ## [1] 2 -4 ``` ```r is.matrix(my_matrix[, -c(1, 3, 4, 5)]) ``` ``` ## [1] FALSE ``` What happened here? When subsetting a matrix reduces one dimension to length 1, R automatically coerces it into a vector. We can prevent this by including `drop = FALSE`. ```r my_matrix[, -c(1, 3, 4, 5), drop = FALSE] ``` ``` ## [,1] ## [1,] 2 ## [2,] -4 ``` ```r is.matrix(my_matrix[, -c(1, 3, 4, 5), drop = FALSE]) ``` ``` ## [1] TRUE ``` --- ## Filling in a Matrix We can fill in a matrix using indices. This is commonly done in statistical computing. In R, you should always start by initializing an empty matrix of the right size. ```r my_results <- matrix(NA, nrow = 3, ncol = 3) my_results ``` ``` ## [,1] [,2] [,3] ## [1,] NA NA NA ## [2,] NA NA NA ## [3,] NA NA NA ``` --- Then I can replace a single row (or column) using indices as follows. ```r my_results[2, ] <- c(2, 4, 3) my_results ``` ``` ## [,1] [,2] [,3] ## [1,] NA NA NA ## [2,] 2 4 3 ## [3,] NA NA NA ``` We can also fill in multiple rows (or columns) at once. (Likewise, we can also do subsets of rows/columns, or unique entries). Note that **recycling** applies here. ```r my_results[c(1, 3), ] <- 7 my_results ``` ``` ## [,1] [,2] [,3] ## [1,] 7 7 7 ## [2,] 2 4 3 ## [3,] 7 7 7 ``` --- ## Matrix Entry Types Matrices, like vectors, can only have entries of one type. ```r rbind(c(1, 2, 3), c("a", "b", "c")) ``` ``` ## [,1] [,2] [,3] ## [1,] "1" "2" "3" ## [2,] "a" "b" "c" ``` --- ## Functions on Matrices Let's create 3 matrices for the purposes of demonstrating matrix functions. ```r mat1 <- matrix(1:6, nrow = 2, ncol = 3, byrow = TRUE) mat1 ``` ``` ## [,1] [,2] [,3] ## [1,] 1 2 3 ## [2,] 4 5 6 ``` ```r mat2 <- matrix(1:6, nrow = 3, ncol = 2) mat2 ``` ``` ## [,1] [,2] ## [1,] 1 4 ## [2,] 2 5 ## [3,] 3 6 ``` --- ```r mat3 <- matrix(5:10, nrow = 2, ncol = 3, byrow = TRUE) mat3 ``` ``` ## [,1] [,2] [,3] ## [1,] 5 6 7 ## [2,] 8 9 10 ``` --- ### Matrix Sums `+` ```r mat1 + mat3 ``` ``` ## [,1] [,2] [,3] ## [1,] 6 8 10 ## [2,] 12 14 16 ``` ### Element-wise Matrix Multiplication `*` ```r mat1 * mat3 ``` ``` ## [,1] [,2] [,3] ## [1,] 5 12 21 ## [2,] 32 45 60 ``` --- ### Matrix Multiplication `%*%` ```r mat_square <- mat1 %*% mat2 mat_square ``` ``` ## [,1] [,2] ## [1,] 14 32 ## [2,] 32 77 ``` ### Column Bind Matrices `cbind()` ```r cbind(mat1, mat3) ``` ``` ## [,1] [,2] [,3] [,4] [,5] [,6] ## [1,] 1 2 3 5 6 7 ## [2,] 4 5 6 8 9 10 ``` --- ### Transpose `t()` ```r t(mat1) ``` ``` ## [,1] [,2] ## [1,] 1 4 ## [2,] 2 5 ## [3,] 3 6 ``` ### Column Sums `colSums()` ```r colSums(mat1) ``` ``` ## [1] 5 7 9 ``` ### Row Sums `rowSums()` ```r rowSums(mat1) ``` ``` ## [1] 6 15 ``` --- ### Column Means `colMeans()` ```r colMeans(mat1) ``` ``` ## [1] 2.5 3.5 4.5 ``` ### Row Means `rowMeans()` ```r rowMeans(mat1) ``` ``` ## [1] 2 5 ``` ### Dimensions `dim()` ```r dim(mat1) ``` ``` ## [1] 2 3 ``` --- ### Determinent `det()` ```r det(mat_square) ``` ``` ## [1] 54 ``` ### Matrix Inverse `solve()` ```r solve(mat_square) ``` ``` ## [,1] [,2] ## [1,] 1.4259259 -0.5925926 ## [2,] -0.5925926 0.2592593 ``` ### Matrix Diagonal `diag()` ```r diag(mat_square) ``` ``` ## [1] 14 77 ``` --- ## A note on `diag()` `diag()` can also be used to generate diagonal matrices by supplying a vector ```r diag(c(1, 2, 3)) ``` ``` ## [,1] [,2] [,3] ## [1,] 1 0 0 ## [2,] 0 2 0 ## [3,] 0 0 3 ``` Supplying an integer will produce an identity matrix of that dimension ```r diag(3) ``` ``` ## [,1] [,2] [,3] ## [1,] 1 0 0 ## [2,] 0 1 0 ## [3,] 0 0 1 ``` --- ## Names We can assign names to the rows and columns, using `rownames()` and `colnames()`, respectively. Similarly to `names()` for vectors, we then access them by calling the function again. ```r colnames(mat1) <- c("var1", "var2", "var3") rownames(mat1) <- c("sample1", "sample2") mat1 ``` ``` ## var1 var2 var3 ## sample1 1 2 3 ## sample2 4 5 6 ``` ```r mat1 * 2 ``` ``` ## var1 var2 var3 ## sample1 2 4 6 ## sample2 8 10 12 ``` --- ## Names We can assign names to the rows and columns, using `rownames()` and `colnames()`, respectively. Similarly to `names()` for vectors, we then access them by calling the function again. ```r rownames(mat1) ``` ``` ## [1] "sample1" "sample2" ``` ```r colnames(mat1) ``` ``` ## [1] "var1" "var2" "var3" ``` --- ## Tables in R Markdown It is easy to go from matrices to tables using R Markdown. There are several methods (check the cheatsheet link and Google for alternatives). I will present one easy method here, but what you use is up to you! ```r # We need to load the knitr and kableExtra package library(knitr) library(kableExtra) ``` ```r my_tab <- data.frame(mat1) kable_styling(kable(mat1)) ``` <table class="table" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> </th> <th style="text-align:right;"> var1 </th> <th style="text-align:right;"> var2 </th> <th style="text-align:right;"> var3 </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> sample1 </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 3 </td> </tr> <tr> <td style="text-align:left;"> sample2 </td> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 6 </td> </tr> </tbody> </table> What happened with the row and column names? --- layout: false class: inverse .middler[.huge[Part 4: R Coding Style Guide]] --- layout: true # R Coding Style Guide --- ## Who are you to tell me how to type? We will be using a mix of the [Tidyverse Style Guide](https://style.tidyverse.org/) by Hadley Wickham and the [Google Style Guide](https://google.github.io/styleguide/Rguide.html). Please see the links for details, but I will summarize some main points here and throughout the class as we learn more functionality, such as functions and packages. You will be graded on following good code style! --- ## Object Names Use either underscores (`_`) or big camel case (`BigCamelCase`) to separate words within an object name. Do not use dots `.` to separate words in R functions! ```r # Good day_one day_1 DayOne # Bad dayone ``` --- ## Object Names Names should be concise, meaningful, and (generally) nouns. ```r # Good day_one # Bad first_day_of_the_month djm1 ``` --- ## Object Names It is *very* important that object names do not write over common functions! ```r # Very extra super bad c <- 7 t <- 23 T <- FALSE mean <- "something" ``` Note: `T` and `F` are R shorthand for `TRUE` and `FALSE`, respectively. In general, spell them out to be as clear as possible. --- ## Spacing Put a space after every comma, just like in English writing. ```r # Good x[, 1] # Bad x[,1] x[ ,1] x[ , 1] ``` Do not put spaces inside or outside parentheses for regular function calls. ```r # Good mean(x, na.rm = TRUE) # Bad mean (x, na.rm = TRUE) mean( x, na.rm = TRUE ) ``` --- ## Spacing with Operators Most of the time when you are doing math, conditionals, logicals, or assignment, your operators should be surrounded by spaces. (e.g. for `==`, `+`, `-`, `<-`, etc.) ```r # Good height <- (feet * 12) + inches mean(x, na.rm = 10) # Bad height<-feet*12+inches mean(x, na.rm=10) ``` There are some exceptions we will learn more about later, such as the power symbol `^`. See the [Tidyverse Style Guide](https://style.tidyverse.org/) for more details! --- ## Extra Spacing Adding extra spaces ok if it improves alignment of `=` or `<-`. ```r # Good list( total = a + b + c, mean = (a + b + c) / n ) # Also fine list( total = a + b + c, mean = (a + b + c) / n ) ``` --- ## Long Lines of Code Strive to limit your code to 80 characters per line. This fits comfortably on a printed page with a reasonably sized font. If a function call is too long to fit on a single line, use one line each for the function name, each argument, and the closing `)`. This makes the code easier to read and to change later. ```r # Good do_something_very_complicated( something = "that", requires = many, arguments = "some of which may be long" ) # Bad do_something_very_complicated("that", requires, many, arguments, "some of which may be long" ) ``` *Tip! Try RStudio > Preferences > Code > Display > Show Margin with Margin column 80 to give yourself a visual cue!* --- ## Assignment We use `<-` instead of `=` for assignment. This is moderately controversial if you find yourself in the right (wrong?) communities. ```r # Good x <- 5 # Bad x = 5 ``` --- ## Semicolons In R, semi-colons (`;`) are used to execute pieces of R code on a single line. In general, this is bad practice and should be avoided. Also, you never need to end lines of code with semi-colons! ```r # Bad a <- 2; b <- 3 # Also bad a <- 2; b <- 3; # Good a <- 2 b <- 3 ``` --- ## Quotes and Strings Use `"`, not `'`, for quoting text. The only exception is when the text already contains double quotes and no single quotes. ```r # Bad 'Text' 'Text with "double" and \'single\' quotes' # Good "Text" 'Text with "quotes"' 'A link' ``` --- Phew! All done for now. Follow these rules and your code will be looking .middler[![fab](fab.gif)]


23 December 2005
The Ministry of Health in Indonesia has confirmed two additional cases of human infection with the H5N1 avian influenza virus.
The first case occurred in an 8-year-old boy from Central Jakarta. He developed symptoms of fever and cough on 8 December. He was hospitalized on 13 December, and died on 15 December.
Family members and close contacts were placed under observation and tested for possible infection, however, none have developed symptoms. Investigations have been undertaken to determine the source of the boy's exposure and samples from pigeons around his household are being tested.
The second case occurred in a 39-year-old man from East Jakarta. He first reported symptoms of fever, headache, cough and shortness of breath on 9 December. He was hospitalized on 11 December and died on 12 December.
Family members and close contacts were placed under observation. Investigations are being undertaken to determine the source of the man’s exposure. While he did not keep poultry in his household, chickens and other birds were found in his neighbourhood. Samples from these birds have been taken and are undergoing tests to determine whether they may have been the source of infection.
These newly confirmed cases bring the total number in Indonesia to 16. Of these cases, 11 were fatal.


Runs a backtest for a cloud project.
While running the backtest, a progress bar shows to keep you up-to-date on the status of the backtest.
After running the backtest, the resulting statistics and a link to the full results on QuantConnect are logged.
You can use the --open
option to automatically open the full results in the browser after the backtest has finished.
If you have a local copy of the cloud project, you can use the --push
option to push local modifications to the cloud before running the backtest.


class: center, middle # Practical Haskell Performance Tim McGilchrist .bottom[![lambda](/talks/lambda-jam-2016-performance/green-lambda.png)] --- class: center, middle, section-white background-image: url(/talks/lambda-jam-2016-performance/background-image03.jpg) # Introduction ??? * spend a lot of time with abstractions * Haskell hides the evaluation model * Limits in hardware * Continue using high level abstractions without significant penalty * Get 80% of the performance with minimum effort --- # Hardware .center[![xeon](/talks/lambda-jam-2016-performance/intel_xeon_e5_2600_v2_chip_scheme_678x452.jpg)] ??? * Xeon Haswell Chip from a few years ago * 10 cores, 25Mb L3 Cache * likes locality of reference in memory * chasing pointers breaks that * optimised for working in the Cache https://gist.github.com/jboner/2841832 --- # Typical Pipeline Program Reads data off storage, does some processing and then writes back to storage. .center[![compute](/talks/lambda-jam-2016-performance/Architecture.svg)] ??? * reading largish chunks of data from disk * performing some computation, (computing stats, filtering, choosing) * writing out largish data * typical pipeline * actually most of our architecture looks like this, composable building blocks --- # Cost Because we use AWS, there is a direct link between a days computing and the angriness of our pointy haired boss. .center[![mark](/talks/lambda-jam-2016-performance/Phb.png)] ??? * why do we care about cost? * cost of a good car most months * performance but not at the cost of correctness * often worth the effort to optimise, operational costs greater than engineering cost. --- # Optimising "The art of poking stacks, trawling asm and black magic." ??? * Optimisation is fickle * Often context sensitive * may require facial hair * Ambiata view on our performance concerns --- # Haskell IO 100% of time spent reading and writing to disk? ??? * obviously this -- This raises two issues 1. How do we efficiently read in enough data without blowing our memory budget? 2. Is it safe? What about IO Exceptions and cleaning up? ??? * Not sacficing performance for correctness or stability. * Producing fast wrong results costs $$$ --- # ByteString Lazy vs cat Using straight ByteString lazy ``` haskell runStatisticsBSL :: InputPath -> OutputPath -> IO () runStatisticsBSL (InputPath i) (OutputPath o) = BSL.readFile i >>= BSL.writeFile o ``` ??? * straight bytestring will read everything into memory * tested on 31G psv file. -- ```shell > ./hatchet sample.psv output.psv \ 2.72s user 35.20s system 53% cpu 1:10.79 total ``` -- ```shell > time cat sample.psv > output.psv \ 1.70s user 49.06s system 65% cpu 1:17.49 total ``` ??? * Bytestring sufficiently fast. * Composability is a problem --- # Conduit * Promises composable building blocks * Constant memory usage on large / infinite streams -- ``` haskell runStatisticsC :: InputPath -> OutputPath -> IO () runStatisticsC (InputPath i) (OutputPath o) = runResourceT . runConduit $ CB.sourceFile i =$= CB.sinkFile o ``` ??? * newtype wrapper around FilePath * add stages in between =$= * already present as a dependency * default buffer size in conduit is too small, using ambiata fork with better value -- ```shell > ./hatchet sample.psv output.psv \ 4.46s user 34.81s system 49% cpu 1:19.35 total ``` ??? * sufficiently fast enough performance * nicer building blocks without IO cost * IO probably isn't your bottleneck * parallel read / download --- # Data Types ``` haskell data Row = Row { rowId :: RowId , rowSpend :: Double , rowItems :: Int , rowDate :: UTCTime , rowState :: Text } deriving (Eq, Show) ``` Each row in our file gets parsed into this structure. ??? * Point out good code style for types -- ``` shell some-id | 150.0 | 5 | 10/3/2016 | NSW ``` ??? * Pipe Separated data the one true enterprise format. --- # Data Type Size ``` shell some-id | 150.0 | 5 | 10/3/2016 | NSW ``` Raw size of a line is 38 Bytes. -- ``` haskell rowId :: RowId -- 6 words + 2N bytes , rowSpend :: Double -- 3 words (2 on 32 bit) , rowItems :: Int -- 2 words , rowDate :: UTCTime -- 6 words , rowState :: Text -- 6 words + 2N bytes ``` Becomes 43 words * 8 or 344 Bytes on 64 bit machine. ??? * increase of 8 times * not really ideal situation, why is it like that? --- # Memory Layout * Value Representation .center[![layout](/talks/lambda-jam-2016-performance/Memory_layout.jpg)] ``` haskell data Row = Row { rowId :: RowId , rowSpend :: Double , rowItems :: Int ... } deriving (Eq, Show) ``` ??? * Ideally you may think that memory is laid out like this. * No pointer chasing which remember our CPU doesn't really like --- # Memory Layout * Value Representation .center[![layout](/talks/lambda-jam-2016-performance/Memory_layout.jpg)] * Reference Representation .center[![layout](/talks/lambda-jam-2016-performance/Memory_layout_pointers.jpg)] ??? * Acutally it looks more like this * Potential cache misses for each pointer chase. * Want to avoid chasing pointers, makes CPU sad and slow * Move towards the layout we actually want --- # Optimising via newtype ``` haskell newtype RowId = RowId Text deriving (Eq, Show) ``` * constructors defined via newtype are free * purely a compile-time idea * takes no space and costs no instructions ??? * There's no excuse for bad types. * What about for other types? --- # Boxed vs Unboxed Values What are they? * Boxed * * most types in Haskell * represented by a pointer to a heap object * Unboxed * primitive values e.g. raw machine types * cannot be directly defined ??? * boxed, represented by a pointer to a heap object * unboxed, no pointers or heap allocation are involved * built into the language and GHC * want something like unboxed for best memory performance --- # UNPACK All The Things As a general rule, scalar fields, such as Int and Double, should always be unpacked. -- ``` haskell data Row = Row { rowId :: {-# UNPACK #-} RowId , rowSpend :: {-# UNPACK #-} Double , rowItems :: {-# UNPACK #-} Int , rowDate :: {-# UNPACK #-} UTCTime , rowState :: {-# UNPACK #-} Text } deriving (Eq, Show) ``` -- * Syntatically noisey ??? * looks like rubbish * Is there a better way? --- # Better Unpacking * Use `-funbox-strict-fields` for all files which contain data types. ``` haskell -- other language pragmas -- {-# OPTIONS_GHC -funbox-strict-fields #-} module Hatchet.Data (Row(..)) where ``` --- # How do I know? Scalar fields can always be unpacked. Things that can't be unpacked: * Sum Types (Types with many constructors) * Polymorphic fields (How would you know what's there?) -- Try draw boxes representing your data types, think about how they might be represented in memory. --- # Strict Data Types By default always use strict data types. -- Haskell being lazy, why should this be the case? -- Think about repeated adding a value to a lazy data structure. -- .center[![layout](/talks/lambda-jam-2016-performance/lazy_hash.jpg)] ??? * performing some calculation on Row 1, repeatedly. * builds up a series of thunks (un-evaluated functions) * building up thunks is expensive --- # Strict Row ``` haskell data Row = Row { rowId :: !RowId , rowSpend :: !Double , rowItems :: !Int , rowDate :: !UTCTime , rowState :: !Text } deriving (Eq, Show) ``` * Add bang patterns to everything ??? This simple thing alone goes a long way to avoiding common laziness problems, suchs as space leaks. Hold on good Sir, I have a recursive data structure. Most of my data types aren't recursive. --- # Strict Recursive ``` haskell data Exp = Infix !Op Exp Exp | Constant !Type !Value data Op = Add | Subtract | Multiply | Divide ``` * select the non-recursive parts to make strict ??? * Here it makes sense for OP to be strict but perhaps not Exp * Similarly for Constant * Perhaps the recursive part isn't that large, experiment with making it strict too. --- # Data Summary We've covered a bunch of things to optimise your data structures: * Choosing the right types * use newtype liberally * make data structures strict * unpacking data types --- # Final Data Type ``` haskell -- other language pragmas -- {-# OPTIONS_GHC -funbox-strict-fields #-} module Hatchet.Data (Row(..)) where data Row = Row { rowId :: !RowId , rowSpend :: !Double , rowItems :: !Int , rowDate :: !UTCTime , rowState :: !Text } deriving (Eq, Show) ``` --- class: center, middle, section-white background-image: url(/talks/lambda-jam-2016-performance/background-image03.jpg) # Functions ??? * Optimising your actual computations isn't always such a clear cut thing. * In general we lean towards having function arguments as lazy. --- # Why Lazy Functions? Consider this code ``` haskell any :: (a -> Bool) -> [a] -> Bool any p = or . map p ``` ??? * Explain needing to map everything in p before or gets a look at it. ie it does more work than it need to compute the answer. --- # Forcing Computation Consider this computation: ``` haskell sum :: [Row] -> Int sum = let loop acc = \case [] -> acc (x:xs) -> loop (acc + (rowSpend x)) xs in loop 0 ``` ??? * going back to a previous example of computing a something across a series of Rows. * The accumulation part of that needs to be strict * it'll build up a series of thunks for each Row it sees, basically a space leak --- # Forcing Computation Sometimes it does make sense to force the arguments to a function. ``` haskell sum :: [Row] -> Int sum = let loop !acc = \case -- Force acc [] -> acc (x:xs) -> loop (acc + (rowSpend x)) xs in loop 0 ``` ??? * The accumulation part of that needs to be strict * Another technique we've used --- # Remove Polymorphism Imagine we wrote our code with this type signature ``` haskell add :: Real a => a -> a -> a add rowSpend acc = acc + rowSpend ``` ??? * Well written using most common form * May be a bad choice for performance sensitive area like an inner loop * You monster, my beautiful polymorphic code -- ``` haskell add :: Int -> Int -> Int ``` ??? * you may already know what the types are so use them * this will perform better than as a monomorphic version * if you do use it with multiple types --- # Specialise If however it really is used polymorphically you can use `SPECIALIZE` to give GHC a hint of what it's used for ``` haskell {-# SPECIALIZE add :: Int -> Int -> Int #-} {-# SPECIALIZE add :: Double -> Double -> Double #-} add :: Real a => a -> a -> a ``` ??? * can go even further with printing core and inspecting assembly. --- # Tools * Dump RTS statistics * raw information like GC Time, Memory usage * add `-rtsopts` to ghc-options in cabal * run with `+RTS -sstderr` -- * Time profiling * shows where program is spending time * add `-prof -auto-all -caf-all -fforce-recomp` * run with `+RTS -p` -- * Space profiling * shows memory usage over time * various options available * differ in how the live heap is broken down -- * Criterion * framework for executing and analysing benchmarks * pretty output and graphs --- # Conclusion By default, use strict data types and lazy functions. * Think about the evaluation model * Plan your data types * Force evaluation where necessary * Measure performance ??? * Johan Tibell's presentations --- class: center, middle # Thanks! Tim McGilchrist @lambda_foo Master Commander of Big Data @ Ambiata Thanks!


{# Copyright 2015-2016 Capstone Team G 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. #} {% extends "_wrapper.html" %} {% block headtitle %}Lintable | Account Registration{% endblock %} {% block pagetitle %}Account Registration{% endblock %} {% block content %}
Make sure you enter a valid email address, since we'll send an account activation email there.


Welcome to UVA's Research Computing Learning Portal
Research Computing at the University of Virginia provides computational, scientific programming, and data analysis workshops, many of which are offered in partnership with the UVA Library Research Data Services and UVA Health Sciences Library websites. This site compiles RC workshop and tutorial materials as well as interactive exercises for students to review or study at their own pace.


Somethings that represents "Us"...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Send me your messages through the contact tab link.
You can contribute your code to my github repository for new data.
Github Link
Learn and add details about/in about your club.
Learn and add details about/in basics for this website's development.
You can browse and suggest edits for tabs.
Send your photoshop queries/suggestions to me.


Previous score: 0 | Projectiles in memory: 0
Thanks for playing! Click here to return to the misc index.


The following phrasal verbs have been found:
A phrasal verb is a verb that is made up of a main verb together with an adverb or a preposition, or both.
Examples:
It is considered informal to use a lot of phrasal verbs in a text.


Final Project Style Guide
Normal Colors
Dark Mode Colors
Fonts
I have chosen to use the following fonts for my site:
- RocknRoll One: Used for headlines.
- Roboto: Used for the primary font.
Elevator Pitch
Hi, how are you? I’m Stockton Cannon, a Computer Science student at BYU-Idaho. I understand you are in the Dairy Industry; I actually grew up on a dairy farm in Shelley, Idaho. It’s amazing to see how much technology has impacted the entire industry. Hard to believe that not too long ago milking was done by hand instead of by machine. This huge adoption of technology is one of the main reasons I decided to pursue a Computer Science degree, it seems to be just as relevant in the field as any agricultural program.
One project I’ve recently been working on is updating or creating websites for many different farmers. From self-promotion to providing online resources to companies that work with you, these websites have been incredibly beneficial. The fact that you are running a dairy after decades of industry shaking changes tells me you know how to adapt and improve. If you are willing to do the same with an effective website, please let me know.
Purpose Statement
The purpose of this website is two-fold. Firstly, provide an environment for casual dairy consumers to increase brand recognition, showcase the facilities of Cannon Dairy, and promote dairy consumption. Secondly, the site will act as a virtual business card, and companies who wish to do business with Cannon Dairy will better be able to see what services can be provided. In specific, online resources will be provided to help provide more specific information about Cannon Dairy. With this multi-targeting strategy, it will be important to create the website in way that caters to be audiences.
Audience Statement
This website will be directed towards a wide audience of dairy consumers. Anyone who is likely to consume milk products throughout their daily life is a primary target. The needs of this group will be basic information about the dairy industry and showcasing a live dairy environment. In addition to this base audience, a more specific target will be placed on individuals with an agricultural or dairy background. For these individuals, more in-depth information will be available. More than likely this website will be accessed through desktops and laptops. However, there is a definite possibility that mobile devices will also be used.
Misson Statement
The mission of Cannon Dairy is to combine cutting-edge innovation inside the dairy industry with old-school work ethic and values to continually provide a quality product. Started in 1960 by Alan Cannon Junior, Cannon Dairy has continued his legacy of hard-work and an attitude that says, “if you’re gonna do it, do it right”. Since 1960 Cannon Dairy has grown from a small operation to a thriving business. Innovation has lead a giant part in this unparalleled growth, and Cannon Dairy prides itself on being at the front of the line on all technological advancements.
Persona and Scenario Ideas
User’s Name: Curtis Smith
- Role: Farm Manager
- Age: 36
- Motivations: Quickly and Efficiently locate information about Cannon Dairy
- Goals: Make informed decisions that benefit the organization
- Technical Ability: Average
User’s Name: Garett Whitaker
- Role: Generic Dairy Service Provider
- Age: 25
- Motivations: Locate needs of dairies and provide services
- Goals: locate any problems with Cannon Dairy that his company can solve
- Technical Ability: High


We believe the quickest way to succeed is to help others succeed.
We develop, build and insure property.But more than the Real
Estate property developers, we are human developers.
Perry West is located in the heart of Kilimani area,
at the intersection of Muringa road and
Elgeyo Marakwet road. The project ... composes of 2 blocks, 15 floors of 140 units altogether, 2 basement layers providing ample parking space.
The Jade Residency offers luxury living within the city.
Offering luxury apartments that are... centrally located in Kilimani area in Nairobi
These luxury furnished apartments comprises of 2 and 3
bedrooms beautifully landscaped gardens, that provide... a cozy feeling of a home away from home.


Components' localization system provides services, helpers and directives which help to provide localized content.
The selection of the language is primariliy based on the browers selected primary language
.
At the core of components localization system there is a
language selection rule which is applied to choose the suitable language for different
contexts, its effects depending on the features using it.
The transl8Number
filter shows number like <IP_ADDRESS> if the selected language
is german and like 1,000,000,000 for all other languages.
Translations are done with the help of the transl8 tool.
The transl8
filter translates messages for keys. For the key 'everything_ok' you get the translation
"{{'everything_fine'|transl8}}"
If there is a translation for the selected language (including english and german), it it is selected. For all other languages the fallback is english. If there is no english translation, it searches for a german translation. Note that there should always be a german translation for everything. If not, you'll get an error.
iDAI.components provides a means to organize content in a way that allows its localized delivery to end-users. In idai.components itself it is used to determine the language of the link titles of the footer and navbar, though it is intended that other applications make use of the content localization system to provide services to deliver localized content.
The language selection gets performed for the requesting user individually on the basis of its selected browser language. To work properly, there is an underlying organization principle which has to be used accordingly. The available languages and organization of the items has to be done by the developer beforehand, using a defined data structure, so that the system can figure out which content can be delivered in which languages.
The links from the footer and navigation bar section are directly generated from the contents of info/content.json (by convention). It serves us as an example to demonstrate the usage of the data structure.
{ "children": [ { "id": "navbar", "children":[{ "id": "about", "title": { "de": "Über Arachne", "en": "About Arachne" } }, ...
A few things to note:


Entech Security Files Storage Area Login Info
Please log in to access the files, folders, and sensitive data in Entech. For ID and password, please use the ID and password provided by the web server manager offline.


@* * Copyright 2019 HM Revenue & Customs * * 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. *@ @(params: Map[String, Any]) @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "Sign in to your secure account now") { @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.salutation(params)
New HMRC reply ready to view
To see your new secure message:
From HMRC Team
}


Get insights that help your business grow.
Discover the benefits of data analytics and make better decisions regarding revenue, customer experience, and overall efficiency.
-
10k+
-
314
-
12M+


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@Beta public interface VolumeAttachmentApi
Provides synchronous access to Volume Attachments. This API strictly handles attaching Volumes to Servers. To create and manage Volumes you need to use one of the following APIs: 1. The Cinder API If your OpenStack deployment is Folsom or later and it supports the Cinder block storage service, use this API.
2. The nova-volume API
If your OpenStack deployment is Essex or earlier and it supports the nova-volume extension, use this API.
,
VolumeApi
,
VolumeAttachmentAsyncApi
| Method Summary | |
|---|---|
VolumeAttachment |
attachVolumeToServerAsDevice(String volumeId,
String serverId,
String device)
Attach a Volume to a Server. |
boolean |
detachVolumeFromServer(String volumeId,
String serverId)
Detach a Volume from a server. |
VolumeAttachment |
getAttachmentForVolumeOnServer(String volumeId,
String serverId)
Get a specific Volume Attachment for a Volume and Server. |
com.google.common.collect.FluentIterable<? extends VolumeAttachment> |
listAttachmentsOnServer(String serverId)
List Volume Attachments for a given Server. |
| Method Detail |
|---|
com.google.common.collect.FluentIterable<? extends VolumeAttachment> listAttachmentsOnServer(String serverId)
serverId
- The ID of the Server
VolumeAttachment getAttachmentForVolumeOnServer(String volumeId, String serverId)
volumeId
- The ID of the VolumeserverId
- The ID of the Server
VolumeAttachment attachVolumeToServerAsDevice(String volumeId, String serverId, String device)
serverId
- The ID of the ServervolumeId
- The ID of the Volumedevice
- The name of the device this Volume will be identified as in the Server (e.g. /dev/vdc)
boolean detachVolumeFromServer(String volumeId, String serverId)
volumeId
- The ID of the VolumeserverId
- The ID of the Server
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


What is Virtual Learning?
It seems Virtual Learning is all anyone is talking about these days. For many people, it’s been a real challenge; recent events have led to some companies being catapulted into the virtual world without much chance to plan.
As such, it’s no surprise that quite a lot of people are still wondering: what exactly is Virtual Learning, anyway?
Put simply, Virtual Learning is exactly the same educational experience one would normally have in any given context, except that it’s done virtually through a Virtual Learning Environment (VLE) instead of being delivered face-to-face. Rather than getting participants together with an instructor in a conference room or classroom, an online platform is used to facilitate learning.
Equip youself with the practical tools you need to drive your own learning and development at work.
Read more about our Growth learning mindset workshop.
This comes with its own benefits, and some challenges; so what are the main differences between the two approaches?
Differences between face-to-face / Virtual Learning
Accessibility
The biggest difference between Virtual Learning (VL) and face-to-face (F2F) Learning is accessibility. While F2F requires participants to physically be present in a room together, there’s no such requirement for VL. Anyone with internet access and the appropriate login details can access a VL session, and they don’t lose time or money on transportation.
As technology continues to improve, Virtual Learning continues to be more accessible for participants with additional needs - with Zoom bringing out live automatic captioning for example, so hard of hearing individuals can participate in training in real time without the need for an interpreter or other such accommodations.
Adaptation Challenges
The most common mistake made by those trying virtual for the first time is taking the exact same content they had planned for F2F training sessions, and presenting it on camera instead.
There’s no quicker way to disengage your audience!
 Virtual Learning material should be redesigned to fit the online context, using your platform’s unique tools to create engagement.
How to implement Virtual Learning
Choosing the right Virtual Learning Environment can be tricky. There’s a lot of options out there, and it’s not always easy to know which one’s right for you. Here’s a quick run-down of the most popular:
Zoom
Here at VTT, we’re big fans of Zoom! It’s low-budget, simple to access and has a large range of features. Breakout Rooms, presenting from your slide deck, reactions and filters… Zoom has everything you need to get started with Virtual Learning.
MS Teams
Microsoft Teams is a solid platform for Virtual Learning. It was originally designed with office-wide collaboration in mind, rather than Virtual Learning, but Microsoft is putting in a lot of work to catch up to their rivals; they’ve promised updates with a lot of new features coming soon.
Cisco WebEx Training Centre
WebEx has a lot of features, but it’s quite high budget compared to the other options on the market. It can be a little unintuitive to learn, but once you’ve got a handle on it you can deliver some great content.
Design for Virtual
We’ve mentioned this already, but it’s so important we need to say it again! Your training materials should be designed with Virtual Learning in mind to make the most of the platform you’ve chosen.
Keep it regular
One of the benefits of Virtual Learning is that, due to its ease of access and time flexibility, it can be implemented with much less disruption than face-to-face learning. As such, VL can be run more regularly, allowing better learning transfer and reinforcement of the material.
Several bitesize sessions have proven to be much more effective in the long run than one long session; get your team set up with regular short workshops, rather than boring them to death with a full-day event!
If you’re in the process of moving to Virtual Learning and are in need of some guidance, our team will always be happy to help! Contact us to discuss how we can best assist you on your virtual journey.


type T12 : 1 .. 2 % Use to specify bit range
var d : nat2 := 2#1100 % Two byte natural number
% At this point bits(d, T12) = 2#10
bits (d, T12) := 2#01
% At this point d = 2#1010
var n : nat1 := 0 % A one byte variable set to zero
bits (n, 7) := 1 % n now contains the pattern 10000000
| (a) | typeSpec | % Subrange type | |||
| (b) | compileTimeIntegerExpression |
In form (a) the subrange type specifies a range from L to M (for least and most significant). This is a little confusing because the subrange is written L .. M with L on the left and M on the right, but in a number, the least significant bit is on the right and the most significant is on the left. The subrange type can be either the name of a type, for example T12, or an explicit subrange, for example 3 .. 7. The values in the explicit subrange must be compile time values.
Form (b) represents the range n .. n where n is the non-negative value of the expression. In other words, both L and M equal n. The expression can be any non-negative integer value or natural number value.
If the expression expn is a variable reference, the bits operation can be assigned to, but cannot be passed to, a var parameter. For example, in the above, bits (d, T12) has the value 2#01 assigned to it. For this assignment to be allowed, the expression expn must be a natural number type (nat, nat1, nat2 or nat4).


Websites can be written in plain HTML or in "Markdown". If you are not familiar with it yet, Markdown allows you to write using an easy-to-read, easy-to-write plain text format that will be automatically converted in plain HTML.
Find more details about markdown here:
https://daringfireball.net/projects/markdown/syntax
| You | also | HTML | |||
| can | use | too! |
Sometimes, there is content that you want to include in several pages, like headers, footers, or other UI parts.
Instead of duplicating the markup code, you can simply include
them, like this:
You can also import data...
...and use it in a template, like this:


@(loanOffer: PreparedOffer, email:(String,String))(implicit messages: Messages, flash: Flash) @admin.admintemplate("offer details"){
Send offer to:
Name:
Business Name:
Loan Amount:
Interest Rate:
Term:
Monthly Payment Amount:
Total amount to pay:
Total interest to pay:
@email._1
@email._2
@loanOffer.businessName
@java.text.NumberFormat.getCurrencyInstance.format(loanOffer.loanValue)
@java.text.NumberFormat.getPercentInstance.format(loanOffer.offerAPR)
@loanOffer.term Months
@java.text.NumberFormat.getCurrencyInstance.format(loanOffer.getPmt)
@java.text.NumberFormat.getCurrencyInstance.format(loanOffer.totalToPay)
@java.text.NumberFormat.getCurrencyInstance.format(loanOffer.totalInterestToPay)


--- title: My favorate tools list # Schedule page publish date. date: 2015-02-16T12:30:55 lastmod: 2015-02-16T12:30:55 draft: false authors: - Ming Su abstract: >- My favorate tools list. abstract_short: My favorate tools list. # Is this a featured talk? (true/false) selected: false # Projects (optional). # Associate this talk with one or more of your projects. # Simply enter your project's folder or file name without extension. # E.g. `internal-project` references # `content/project/internal-project/index.md`. # Otherwise, set `projects` to be empty. projects: - su2015miyunnsf - su2018miyunnsf # Tags (optional). tags: - linux - ubuntu - debian - fvwm - zsh - mutt - wps - okular - R - matlab - conky - ranger - remind - wyrd - html5 - firefox - uzbl - abook - vim - remmina - ssh - mocp - vlc - mysql - iciba.com - virtualbox - qalc - texlive - tmux - python - nutstore - lftpd - gimp # Links (optional). url_pdf: '' url_slides: '' url_video: '' url_code: '' # Featured image # To use, add an image named `featured.jpg/png` to your page's folder. image: caption: '' focal_point: Right ---
I prefer to use command line tools (CLI). Here is a list that I am using and enjoying.


Please select the tools:
Cutadapt
FASTX-Toolkit
Collapser
Trimmer
Only FastQ
Clipper
Quality Filter
Quality Trimmer
Quality Masker
Kraken
Reaper
Tally
Minion
Send email
Set default


emoncms.org lists a 'averaging' input process, which hasn't yet been implemented, yet would be really useful..
I'm measuring windspeed (as it impacts on thermal loss) and take a measurement every 20 secs, but it can vary several hundred percent between readings (gusts).
...Anyone managed to average inputs vis emoncms by alternative means?
Paul
Re: Weather data in emoncms
Hi Paul, interesting question, how are these readings sampled and processed ?
Are you receiving a processed average for the last 20secs or a raw windspeed reading every 20secs.?
If the latter, I question whether emoncms will be able to give you accurate readings even if averaging was applied. For something that normally changes slowly like ambient temp 20 sec samples will do the job as we can be pretty sure of what's happening during the 20secs between readings, Wind speed measurements however, as you say can vary wildly between samples almost rendering then useless. For example if the sample rate were to coincide with gusts, imagine an exaggerated scenario where the wind speed was 85mph for 16 secs and then 10mph for 4 secs, if this cycle repeated consistently the average wind speed is 70mph but depending on where in the 20sec cycle the sample was taken a reading of of 10mph or 85mph could be expected, in fact there would be a 1 in 5 chance the result would be a 10mph average .
Would it be possible to significantly increase the sample rate and average the samples before reporting ? eg sample once per second for 20 seconds and divide the sum of the readings by 20.
If this is already being done or requires further smoothing, can the reporting period be extended to 1min or 5mins to sample a greater span of variation or if you have you own processing stage/sketch could it be modified to report an average of the last 10 or 20 "20sec readings" every 20 seconds?
I'm not aware of a way to average in emoncms, but in this instance with something as unpredictable and as rapidly changeable as wind speed I think more samples would be needed to be of more use.
Paul
Re: Weather data in emoncms
Paul, I'm using node-red to parse weather data from a nearby weather station via an API, and feeding that into emoncms, which I presume has already had some averaging applied because it also supplies wind gust data, which is usually higher than the 'wind' data.
You have raised a few interesting points, which I need to clarify with the data provider, especially re exactly what processing has been done, and then maybe increase the sample rate and build an avenging feature into my node-red flow, before it hits emoncms.
Paul
Re: Weather data in emoncms
Just found the Met Offices windspeed model;
'....Because wind is an element that varies rapidly over very short periods of time it is sampled at high
frequency (every 0.25 sec) to capture the intensity of gusts, or short-lived peaks in speed, which inflict
greatest damage in storms. The gust speed and direction are defined by the maximum three second
average wind speed occurring in any period.
A better measure of the overall wind intensity is defined by the average speed and direction over the
ten minute period leading up to the reporting time. Mean wind over other averaging periods may also
be calculated....'
Paul
Re: Weather data in emoncms
Sounds reasonable, how does that compare with your providers data?
Re: Weather data in emoncms
Sounds reasonable, how does that compare with your providers data?
No comparison whatsoever!
It's clear when examining the data stream that there is no averaging at all at source, and rather that try to do the sums remotely, it's easier to find another data stream..
Fortunately, I live 2 miles from an International Airport, who submit accredited METAR weather data direct to the NOAA Weather Service, who just happen to have a api!!
So by calling the api via node-red, I have successfully parsed the resultant XML, and then feed the data into emoncms for further processing, logging and visualizations.
Paul
Re: Weather data in emoncms
Which data provider where you using previously?
Sometime back you were using wunderground which I took a look at yesterday afternoon, As an experiment I created a custom interfacer for emonhub which makes a call every 3mins (to stay within the Free API call limits) I left it running over night and the results seem quite stable yes they vary as you would expect but not to the degree you experienced.
Were you using another provider up till yesterday ?
How is the latest provider panning out ? I see only one wind speed is given is that an average or a snapshot?
I'm not finding much detail on the data values at all.
Paul
Re: Weather data in emoncms
I was accessing data from an 'experimental' weather station situated on the nearby airport's apron (via Wunderground's api). Initially, the data was good & reliable, but then the precipitation stopped recording and wind gusts became sporadic, so I began looking for a replacement, having a choice of several personal weather stations - all of which feed into Wunderground.
The new provider is the official airport weather station, which provides data for safe air travel, hence it is accurate! and yes, the windspeed is averaged over a 30 minute period (which is the METAR update frequency).
I too noticed that the 'wind gusts' was missing, but then found that they do not include irrelevant data in METAR's, so instead of repeating 'Snow-depth = 0' throughout summer, they only add it when they get snow! the same applies with wind-gusts, and I notice this morning that the xml is showing gusts - see the history towards the bottom of this page.
The disappearing 'wind_gust_kt' label did cause me some problems with the XML parsing, but eventually got around it by;
var gusts = 0;
if (typeof METARdata.wind_gust_kt != "undefined") {
gusts = METARdata.wind_gust_kt[0];
}
So if the label is missing, it returns gusts = 0.
Paul
Re: Weather data in emoncms
I take it you are now accessing the new provider directly and not via wunderground, correct ?
For snowfall inserting zero is ideal but would the gusts value be more accurate if it fell back to the wind speed value instead? if nothing else it might make graphs clearer.
It's not as straight forward as I would of expected to find the right data source.
Paul
Re: Weather data in emoncms
I now get them direct from NOAA - the American National Weather Centre who collate airport weather data globally.
That's a good idea about falling wind-gusts back to wind-speed, I'll add that tonight!
I think that you have to compromise when selecting a weather station, I would ideally have wanted rainfall to be included, but strangely, the METAR does not include it.
Paul
Re: Weather data in emoncms
"I would ideally have wanted rainfall to be included, but strangely, the METAR does not include it." That's because it's not relevant. What is relevant is the rain intensity and the runway state (for braking). The current TAF for your airport says:
EGCN 291101Z 2912/2921 21018KT 9999 SCT030 TEMPO 2912/2921 21022G32KT PROB40 TEMPO 2915/2921 7000 SHRA - the last bit meaning a 40% probability between 4pm and 10pm of showers of rain ("SHRA") - but not heavy (+) nor light (-), and between 1pm and 10 pm the wind is forecast to gust to 32 knots. The ATIS (spoken, broadcast on an aeronautical frequency) may include something like "wet damp damp", meaning the runway is wet in the touchdown zone, damp in the middle and damp at the stop end.
Re: Weather data in emoncms
Thanks Robert.
This weather thing becomes an obsession, having spent the last 2 hours trying to write a August-Roche-Magnus approximation into javascript.
My lack of a basic coding knowledge always lets me down!!
Paul
Re: Weather data in emoncms
If you look at the source of this page - you'll find it in the .js file listed in the header.
Re: Weather data in emoncms
Good thinking! It just needed a little tweak, but apart from that it dropped straight into node-red, and now I've successfully got humidity logged in emoncms too.
Paul
Re: Weather data in emoncms
Hi,
I managed to plot moving averages in multigraph. It may interest you.
Have a look here
Eric


Reports invalid arguments passed to methods with parameters annotated as @PropertyKey.
These arguments should be valid property keys in the respective properties files.
Also verifies that the resourceBundle
argument of the @PropertyKey annotation is an existing resource bundle.


--- title: Main Nav layout: layout-docs category: Standard icon: mainnav js: true order: 2 --- {% capture default_navbar_example %} {% endcapture %} {% capture dropdown_navbar_example %} {% endcapture %} {% capture mega_menu_navbar_example %} {% endcapture %} {% capture searchbar_navbar_example %}
{% endcapture %} {% capture item_width_navbar_example %} {% endcapture %} {% capture fullwidth_navbar_example %}All .gov.sg informational services shall adopt a Global Primary Navigation Panel across all pages.
.navbar
class which is now deprecated
and may not longer receive updates or fixes. While .navbar
may work, it is
recommended that you use .sgds-navbar
instead, which would also not clash
with other css frameworks like Bootstrap.
Main nav that has a dropdown for secondary selection. Suitable for medium-sized websites.
Main nav with a mega menu for secondary selection. Suitable for large-sized websites.
To add search bars to your main mav, please import sgds.js
.
To make make a full width navbar, You can wrap .sgds-container.is-fluid
around sgds-navbar
The sgds-navbar
component supports 3 types of direct children containers:
.sgds-navbar-brand
The .sgds-navbar-brand
container is visible across all device sizes and always sits at the left
.sgds-navbar-menu
The .sgds-navbar-menu
is to the right of .sgds-navbar-brand
, and hidden on mobile
devices (<1024px wide).
Its children can further be positioned with:
.sgds-navbar-start
Positioned at the left on desktop and top on mobile.
.sgds-navbar-end
Positioned at the right on desktop and bottom on mobile.
Since the .sgds-navbar-menu
element is hidden on mobile devices, you can add a
.sgds-navbar-burger
button inside .sgds-navbar-brand
to toggle the visibility of the navbar menu.
Main navigation should:


TRUE LIES A film review by Michael John Legeros Copyright 1994 Michael John Legeros
Directed by James Cameron Written by Cameron, based on a screenplay by Claude Zidi, Simon Michael, and Didier Kaminka. Cast Arnold Schwarzenegger, Jamie Lee Curtis, Tom Arnold, Bill Paxton, Tia Carrere, Art Malik, Eliza Dushku, Grant Heslov, and Charleton Heston MPAA Rating "R" (for language, gore, violence, and sexual references) Running Time 141 minutes
===
"Women.  - Arnold to Schwarzenegger
What is James Cameron up to now? His new movie, TRUE LIES, is *easily* the most entertaining film of the year. Forget SPEED, THE LION KING, and FORREST GUMP, here's a blockbuster that swats those aside like houseflys. Talk like a tag line and you'd say that TRUE LIES is "more exciting than SPEED, more charming than KING, and more humorous than GUMP." Unquote. With T2 talent Arnold Schwarzenegger in the lead, James Cameron has delivered the best Bond movie that Albert Broccoli never made.
So why are some critics complaining?
TRUE LIES opens in the Alps (!) with secret agent Harry Tasker (Schwarzenegger) emerging from an icy lake at the edge of a heavily guarded compound. Bathed in blue light (of course), he strips off his wetsuit only to reveal a perfectly pressed tuxedo. With a dash of cologne for good measure, Harry steps from the bushes and into the chateau. Just like that.
Inside is a party and that's no trouble with Harry. He mingles, he flirts, and speaks six different languages. He even dances the tango before the inevitable Hasty Exit.
Sound familiar?
The Wall came down and peace came up and, now, we have bug-eyed Easterners as the token spy-movie villains. Stereotypes and all. Tom Clancy might complain, but not James Cameron. His fun starts when Agent Harry Tasker goes *home*. No, not to some slinky siren from the French Riviera, but, rather, to a quiet neighborhood outside D.C.
At home is Helen (Curtis), a legal secretary with (what she think is) a boring husband with a boring job. Together, they have one kid and one dog, but neither is enough to keep Harry home from "business trips" and "working late."
That is, until Simon (Paxton) shows up.
He's an oily used-car salesman who, get this, is masquerading as spy to seduce Mrs. Tasker! Harry finds out and, once his neck veins stop bulging, executes a wicked revenge that leads to such complications as Helen's induction into "service" and the couple's abduction by terrorists.
With enough action and plot for *three* films, TRUE LIES begs the question: when is enough enough for James Cameron? Not content to make a spy movie, he's also created a *spoof* of a spy movie. A spoof, mind you, that's funnier than anything out now. Watch Arnie butt heads with a pair of pinschers in the opening scene, if you don't believe me.
But *after* the guns and gags have run their course, the film is still only half-finished. TRUE LIES is also about jealousy and the *extreme* reactions of a husband who thinks his wife is having an affair. Cameron pulls no punches here; Harry's abusive treatment of Helen includes one of the strongest scenes you'll see this summer.
Timely stuff, which begs the question: why the misogyny? Has James Cameron crossed to the other side of the field, after the fight-back feminism of T2 and ALIENS? Has the director's personal life finally soured the "sensitive guy" who's best known for letting his heroines act tougher than his heroes?
Jamie Lee Curtis *does* get her due. Of sorts. Her empowerment comes at the end, with a cute coda that has the couple living happily every after. But the transformation is slight and nothing at all along the lines of either Linda Hamilton (T2) or Sigourney Weaver (ALIENS).
The men fare worse. Both Arnie and (Tom) Arnold are as far from PC as can be. Their collective locker-room wisdom is off-color, to say the least, but they are no less appealing than, say, any racist character in a Quintin Tarantino film. They work in *spite* of their questionable behavior.
The chemistry between Arnie and Jamie alone is worth the price of admission. Sure, Arnie is a bit stiff for suave, but what range he *does* have is put to great use, including some of the lengthiest leers in film history. Curtis is wonderful and, with her costar, makes TRUE LIES seem light years away from either HERCULES IN NEW YORK or HALLOWEEN. Their best scene is Harry's rescue of Helen from a speeding-to-its-doom limo. Watch the looks.
Tom Arnold is surprisingly solid as Harry's scene-stealing partner. He now has a career. Bill Paxton, who once said some very bad things to the Terminator, is an over-the-top, raunchy riot as Simon. Art Malik, good as the Hissable Villain, gets a great double-take near the end. And even Charleton Heston breezes through with two tart scenes as an agency head.
Only Tia Carrere sticks out like a sore thumb. She has the looks, but the not the chops, to hold her own with these pros.
Cameron's script, adapted from the little known French farce LA TOTALE, has more wit than the genre typically permits. But, then again, a James Cameron film typically *defines* the genre it's in and not vice versa. Watch how deftly the director mixes campy comedy and sexy sincerity into Helen's strip tease (don't ask). It's the best scene in the film.
Last, but by no means least, are the show-stoppers. Try a horse chasing a motorcycle onto the roof of a skyscraper. Or a public restroom shootout that's a ballet with bullets. Or a great car chase through the Florida Keys sans section of bridge. Scene after scene after stunt after stunt-- all as a fabulous $100 million dollar reminder of why James Cameron is one of the top technically accomplished filmmakers on the planet.
BOTTOM LINE: TRUE LIES is the most entertaining film of the year. Period. Go see it a third time.
Grade: A
.
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


speech2text¶
speech2text¶
Data Layer for Speech-to-Text models
-
class
data.speech2text.speech2text.
Speech2TextDataLayer
(params, model, num_workers, worker_id)[source]¶ Bases:
open_seq2seq.data.data_layer.DataLayer
Speech-to-text data layer class.
-
__init__
(params, model, num_workers, worker_id)[source]¶ Speech-to-text data layer constructor. See parent class for arguments description. Config parameters: * num_audio_features (int) — number of audio features to extract. * input_type (str) — could be either “spectrogram” or “mfcc”. * vocab_file (str) — path to vocabulary file. * dataset_files (list) — list with paths to all dataset .csv files. * augmentation (dict) — optional dictionary with data augmentation
parameters. Can contain “time_stretch_ratio”, “noise_level_min” and “noise_level_max” parameters, e.g.:
{ 'time_stretch_ratio': 0.05, 'noise_level_min': -90, 'noise_level_max': -60, }
For additional details on these parameters see
data.speech2text.speech_utils.augment_audio_signal()
function.
-
_parse_audio_element
(id_and_audio_filename)[source]¶ Parses audio from file and returns array of audio features. :param id_and_audio_filename: tuple of sample id and corresponding
audio file name.Returns: source audio features as np.array
, length of source sequence, sample id.Return type: tuple
-
_parse_audio_transcript_element
(element)[source]¶ Parses tf.data element from TextLineDataset into audio and text. :param element: tf.data element from TextLineDataset.
Returns: source audio features as np.array
, length of source sequence, target text as np.array of ids, target text length.Return type: tuple
-
static
get_optional_params
()[source]¶ Static method with description of optional parameters.
Returns: Dictionary containing all the parameters that can be included into the params
parameter of the class__init__()
method.Return type: dict
-
static
get_required_params
()[source]¶ Static method with description of required parameters.
Returns: Dictionary containing all the parameters that have to be included into the params
parameter of the class__init__()
method.Return type: dict
-
input_tensors
¶ Dictionary with input tensors.
input_tensors["source_tensors"]
contains:- source_sequence (shape=[batch_size x sequence length x num_audio_features])
- source_length (shape=[batch_size])
input_tensors["target_tensors"]
contains:- target_sequence (shape=[batch_size x sequence length x num_audio_features])
- target_length (shape=[batch_size])
-
iterator
¶ Underlying tf.data iterator.
-
speech_utils¶
-
data.speech2text.speech_utils.
augment_audio_signal
(signal, fs, augmentation)[source]¶ Function that performs audio signal augmentation.
Parameters: - signal (np.array) – np.array containing raw audio signal.
- fs (float) – frames per second.
- augmentation (dict) – dictionary of augmentation parameters. See
get_speech_features_from_file()
for specification and example.
Returns: np.array with augmented audio signal.
Return type: np.array
-
data.speech2text.speech_utils.
get_speech_features
(signal, fs, num_features, pad_to=8, features_type='spectrogram', window_size=0.02, window_stride=0.01, augmentation=None)[source]¶ Function to convert raw audio signal to numpy array of features.
Parameters: - signal (np.array) – np.array containing raw audio signal.
- fs (float) – frames per second.
- num_features (int) – number of speech features in frequency domain.
- pad_to (int) – if specified, the length will be padded to become divisible
by
pad_to
parameter. - features_type (string) – ‘mfcc’ or ‘spectrogram’.
- window_size (float) – size of analysis window in milli-seconds.
- window_stride (float) – stride of analysis window in milli-seconds.
- augmentation (dict, optional) – dictionary of augmentation parameters. See
get_speech_features_from_file()
for specification and example.
Returns: np.array of audio features with shape=[num_time_steps, num_features]. audio_duration (float): duration of the signal in seconds
Return type: np.array
-
data.speech2text.speech_utils.
get_speech_features_from_file
(filename, num_features, pad_to=8, features_type='spectrogram', window_size=0.02, window_stride=0.01, augmentation=None)[source]¶ Function to convert audio file to numpy array of features.
Parameters: - filename (string) – WAVE filename.
- num_features (int) – number of speech features in frequency domain.
- features_type (string) – ‘mfcc’ or ‘spectrogram’.
- window_size (float) – size of analysis window in milli-seconds.
- window_stride (float) – stride of analysis window in milli-seconds.
- augmentation (dict, optional) –
None or dictionary of augmentation parameters. If not None, has to have ‘time_stretch_ratio’, ‘noise_level_min’, ‘noise_level_max’ fields, e.g.:
augmentation={ 'time_stretch_ratio': 0.2, 'noise_level_min': -90, 'noise_level_max': -46, }
Returns: np.array of audio features with shape=[num_time_steps, num_features].
Return type: np.array


#include <stDBMTree.h>
Inheritance diagram for stDBMTree< ObjectType, EvaluatorType >:
First implementation is based on original code by Agma Traina, Bernard Seeger and Caetano Traina
Main modifications from original code are intent to turn it an object oriented compliant code.
Finish the implementation.
Definition at line 1111 of file stDBMTree.h.
|
|
This type is a collection of objects. Definition at line 1193 of file stDBMTree.h. |
|
|
This type is a memory node. Definition at line 1198 of file stDBMTree.h. |
|
|
This type is a memory node to execute the slim-down algorithm. Definition at line 1203 of file stDBMTree.h. |
|
|
This is the class that abstracs an result set. Reimplemented from stMetricTree< ObjectType, EvaluatorType >. Definition at line 1188 of file stDBMTree.h. |
|
|
This type is a subtree info. Definition at line 1208 of file stDBMTree.h. |
|
|
These constants are used to define the choose sub tree method.
Definition at line 1117 of file stDBMTree.h. |
|
|
These constants are used to define the split method.
Definition at line 1144 of file stDBMTree.h. |
|
|
Creates a new metric tree using a given page manager. This instance will not claim the ownership of the given page manager. It means that the application must dispose the page manager when it is no loger necessary.
|
|
|
Dispose all used resources, ie, it is the destructor method.
|
|
|
This method adds an object to the metric tree.
|
|
|
This method travels through the tree validating the hole tree. |
|
|
This method will delete any node that has only one entry. |
|
|
Returns the Choose Method name. Definition at line 1351 of file stDBMTree.h. |
|
|
Returns the greatest estimated distance between two objects. |
|
|
Returns the height of the tree. Reimplemented from stMetricTree< ObjectType, EvaluatorType >. Definition at line 1236 of file stDBMTree.h. |
|
|
Returns the MaxOccupation of the nodes. Reimplemented from stMetricTree< ObjectType, EvaluatorType >. Definition at line 1261 of file stDBMTree.h. |
|
|
Returns the MinOccupation of the nodes. Reimplemented from stMetricTree< ObjectType, EvaluatorType >. Definition at line 1277 of file stDBMTree.h. |
|
|
Returns the number of nodes of this tree. Reimplemented from stMetricTree< ObjectType, EvaluatorType >. Definition at line 1301 of file stDBMTree.h. |
|
|
Definition at line 1306 of file stDBMTree.h. |
|
|
Returns the number of objetcs of this tree. Reimplemented from stMetricTree< ObjectType, EvaluatorType >. Definition at line 1294 of file stDBMTree.h. |
|
|
This method travels through the tree gathering information about the number of objects in the tree. |
|
|
Returns the current split method. Definition at line 1333 of file stDBMTree.h. |
|
|
This method returns information about the tree like FatFactor, mean object size and others.
Reimplemented from stMetricTree< ObjectType, EvaluatorType >. |
|
|
Returns the radius of the tree. Definition at line 1247 of file stDBMTree.h. |
|
|
Gets the maximum user data size available in this tree.
Definition at line 1426 of file stDBMTree.h. |
|
|
This method will perform a Incremental K-Nearest Neighbor query. |
|
|
Returns if the split method has already been called. Definition at line 1254 of file stDBMTree.h. |
|
|
This method returns if this tree reinsert objects that are covered by the subtrees of a node.
Definition at line 1361 of file stDBMTree.h. |
|
|
This method returns if this tree remove the farthest object when there is an object with greater distance than the new object and no space in a node to add the new object.
Definition at line 1391 of file stDBMTree.h. |
|
|
Creates a dump of the tree which can be viewed by MAMViewer.
|
|
|
Initializes the MAMView module. It will restart he
|
|
|
Sets the visualization output directory.
Definition at line 1556 of file stDBMTree.h. |
|
|
This method will perform a K-Nearest Neighbor query using a global priority queue based on chained list to "enhance" its performance. We believe that the use of a priority queue during the search in the leaf nodes will force the radius to converge faster than the normal nearest query. This implementation may replace the original implementation if it proves to be better.
|
|
|
This method will perform a K-Nearest Neighbor query using a global priority queue based on chained list to "enhance" its performance. We believe that the use of a priority queue during the search in the leaf nodes will force the radius to converge faster than the normal nearest query. This implementation may replace the original implementation if it proves to be better.
|
|
|
Optimizes the structure of this tree by executing the Slim-Down algorithm. Reimplemented from stMetricAccessMethod< ObjectType, EvaluatorType >. |
|
|
This method will return the object in the tree that has the distance 0 to the query object. In other words, the query object itself. If there are more elements that has distance 0 to the query object, this method will return the first found. The object pointed by sample will not be destroyed by this method.
|
|
|
This method will perform a range query. The result will be a set of pairs object/distance.
|
|
|
Reads an additional user data. This feature allows users to write additional information in to the free area of the header page. The available space will deppends on the size of the header page (see the page manager documentation for more details).
Definition at line 1466 of file stDBMTree.h. |
|
|
Sets the Choose Method name.
Definition at line 1343 of file stDBMTree.h. |
|
|
Returns the MaxOccupation of the nodes. Definition at line 1268 of file stDBMTree.h. |
|
|
Sets the MinOccupation of the node. Definition at line 1284 of file stDBMTree.h. |
|
|
Definition at line 1310 of file stDBMTree.h. |
|
|
This method sets if this tree will reinsert objects that are covered by the subtrees of a node.
Definition at line 1371 of file stDBMTree.h. |
|
|
This method sets if this tree remove the farthest object when there is an object with greater distance than the new object and no space in a node to add the new object.
Definition at line 1402 of file stDBMTree.h. |
|
|
Sets the tree split method.
Definition at line 1320 of file stDBMTree.h. |
|
|
Writes an additional user data. This feature allows users to write additional information in to the free area of the header page. The available space will deppends on the size of the header page (see the page manager documentation for more details).
Definition at line 1446 of file stDBMTree.h. |


Brakes can be noisy and squeak if the distance to the rim hasn't been set
correctly.
All parts of the brake and cables must be clean. The brake pads must not be worn.
This procedure explains the importance of toe-in when positioning brake
pads. A brake pad has a toe (the front) and a heel (the
back).
Note: This solution is effective for traditional rim brakes but not for
V-brakes.
-
Look at the brake pads and see how they are aligned with the wheel rim.
Most people assume that the distance between the rim and the front and the back of
the pad must be the same. However, this is not the case.
-
Align the brake pad with some toe-in.
Toe-in means that the front of the pad must be slightly closer to the rim. As the
wheel moves forward, the brake pad will contact the rim gradually, and this eliminates the
squeaky noise.
Always check that the brake pad is not touching the tire (too high) or under the rim (too
low).


Choose the right you are interested in. Then you can choose which muscle you want to train the most.
Everything depends on your goals. Keep in mind that good training is balanced training.


Valid Until:
Valid After:
Common Name:
City:
State:
Country:
Organization:
Common Name:
City:
State:
Country:
Organization:


--- layout: default title: "404: Page not found" permalink: 404.html ---
Sorry, we've misplaced that URL or it's pointing to something that doesn't exist.
Head home to try finding it again or contact me on twitter @AlexSorokoletov.
Instead, read these recent posts :books:


This page should redirect you to either:
If not, please select one of the links above as appropriate.


Repository Configuration¶
Whenever a new repository is created, Titan will store metadata about the associated container image that is then stored with each commit and used to instantiate containers in the appropriate runtime context. The following information is taken from the original container image:
Image Name
Image Tag
Image Digest
Environment Variables
Volume Mappings
Exposed Ports
Image Configuration¶
Whenever Titan creates a new container from a commit, Titan will attempt to use
the identical image that was used to create the commit. For images that have
been pushed to a registry, this is accomplished through the image digest, which
ensures that an exact match is used. There are cases where the digest doesn’t
exist, such as when using images built locally that have not been pushed to a
registry, or when the image came from a private registry that is no longer
available. In these cases, the image name and tag is used instead. For example,
if the postgres:11
image is specified, Titan will prefer the digest of that
image, as new images (corresponding to Postgres minor releases) may be pushed
under that tag. But in the event that digest can’t be found, Titan will
attempt to use whatever image corresponds to postgres::11
at that point in
time. Radically changing the image configuration (most notably volume mappings)
can have unintended consequences and cause the repository to fail to be
created.
Attention
There is currently no way to override the image attributes to change which image to use for a repository. This capability will be added in a future release.
Attention
Titan does not currently perform rigorous compatibility checks when pushing commits to a remote. It is possible to push radically different commits (different images, different volume mappings) that can cause significant issues when trying to switch between commits in a repository. Be careful that you are only pushing and pull compatible commits.
Port Forwarding¶
By default, Titan will forward any exposed ports on the container to the local
system. For example, running a PostgreSQL image will by default make the
container available at localhost:5432
. To disable this behavior, use the
-P
option when cloning or running a repository. Custom port mappings can
be created using additional context-specific configuration options, described
below.
Additional Configuration¶
Additional context-specific configuration can be specified when cloning or running a repository, but that configuration will not be persisted with the commits. For example, you can choose to forward ports differently (or not at all) on your workstation, run the containers on alternate docker networks, or use a different storage class for volumes in Kubernetes. This configuration may not translate across runtime environments (for example, a Docker network may not exist on a different system, or may not make sense at all in a Kubernetes environment), so you will have to specify it each time a repository is run or cloned. Once configured, this configuration will continue to be used for subsequent checkouts or commits.


# extends 'base_doc.html' # block content_doc
gae-init is nothing more than a collection of pretty awesome stack, organized in a small project to kickstart your next Google App Engine project.
If you are already created a few App Engine projects you are aware of the fact that you need to spend some time setting up the project, getting the latest libraries, copying from older projects snippets that you've written already many times and you have to do some more boring stuff. This project is solving exactly that problem. It comes with the most nessesery stuff that are needed in any modern web application. No more wasting time on dealing with tools and start working on your next big thing right away!
gae-init is always up to date with the latest libraries and following the best practices. Check out the full feature list, get started with the tutorial or simply fork it.
I'm Lipis and I'm the guy behind this project. Yes I've finished the Getting Started Tutorial and after that I've read most of the manual. This project wouldn't be here without the old fellas, Mr. Tim and Mr. Chris that contributed with ideas, code, RedBulls, other stuff and the pretty awesome logo that was made by Mr. Kostas. Also special thanks goes to gmist, joernhees and stefanlindmark for testing and contributing with their time, code and ideas.
Some may ask why not using something that is already there like gae-boilerplate or flask-appengine-template. The answer is that, among other many things, gae-boilerplate's base.html is huge, unreadable and a bit chaotic compare to gae-init's base.html and that flask-appengine-template doesn't even have the pretty useful user sign-in.
# endblock


The Hope Foundation
Registered under Societies Registration Act 8811860
Home
About Us
HOPE
Health
Old Age Support
Plant With Purpose
Education
Gallery
Contact us
View Larger Map
Office Address
The HOPE Foundation
Bhavan's Campus, Munshi Nagar,
Andheri (West), Mumbai 400 058.
Tel. No. : (91)-(022)-26289777,
Register
Name:
Age:
Email:


Go back
Sign out
Sign in
Install Your Pi
Gallery
Remote, real-time oven monitoring
About us ▸
◂ Back
The Team
Team FruitCakes is a group of seven students from Gothenburg University.
Create a TwitchTV account
, used by PieChecker to sign in and stream your oven
Generate configuration files
for your PieChecker
Put the files on the PieChecker SD card