--- title: Getting to know the fitzRoy package (AFL game statistics) author: Jacquie Tran date: 2019-01-12 slug: fitzroy-r-package-australian-football categories: - On-field analyses tags: - football - sports analytics - web scraping - r stats ---
(source: Wikimedia)
I shifted across the ditch early in 2018 to take up a role with High Performance Sport New Zealand. Remarkably, the one-year anniversary of our arrival here is right on the door step; I’ve learned so much in that time, particularly around qualitative methods and analyses. I enjoy the richness of insight that can be drawn from analysing text data, but a part of me does miss getting to work with numbers as much as I used to. And so, I decided I’d scratch the quant itch and get to know the fitzRoy
R package by James Day.
In my stint at the Geelong Cats Football Club (AFL), I spent a lot of time retrieving, cleaning, merging, and wrangling data sets. An eyeball estimate of my personal time tracking data suggests I spent 70-80% of my ‘analytics time’ doing data preparation in those years. Yikes.
Much to my dismay, the fitzRoy
package was first published to Github in January 2018, mere days after I finished up at Geelong FC. No doubt it would have been a massive time-saver for me if it had existed earlier!
Being both curious and a masochist (a great combination, I highly recommend it), I decided it was about time I checked out what fitzRoy
can do so I could grasp the reality of my potential time-savings had this package existed when footy analytics was part of my job. Onwards…
fitzRoy
is not on listed on CRAN yet, so you’ll need to install it with the help of the devtools
package. To install both packages:
install.packages("devtools")
devtools::install_github("jimmyday12/fitzRoy")
Once the fitzRoy
package has been installed, we can load it into our R session, along with other packages that will be used in this code-through.
library(fitzRoy)
library(dplyr)
library(knitr)
library(kableExtra)
library(ggplot2)
library(scales)
Let’s take a look at AFL match data that has been catalogued on the invaluable AFL Tables website. For this code-through, we’ll focus on matches played over the last 20 years.
# Retrieve the data from AFL Tables
afl_data_1998_2018 <- get_afltables_stats(
start_date = "1998-01-01", end_date = "2018-11-25")
# See variables in the data set
names(afl_data_1998_2018)
## [1] "Season" "Round"
## [3] "Date" "Local.start.time"
## [5] "Venue" "Attendance"
## [7] "Home.team" "HQ1G"
## [9] "HQ1B" "HQ2G"
## [11] "HQ2B" "HQ3G"
## [13] "HQ3B" "HQ4G"
## [15] "HQ4B" "Home.score"
## [17] "Away.team" "AQ1G"
## [19] "AQ1B" "AQ2G"
## [21] "AQ2B" "AQ3G"
## [23] "AQ3B" "AQ4G"
## [25] "AQ4B" "Away.score"
## [27] "First.name" "Surname"
## [29] "ID" "Jumper.No."
## [31] "Playing.for" "Kicks"
## [33] "Marks" "Handballs"
## [35] "Goals" "Behinds"
## [37] "Hit.Outs" "Tackles"
## [39] "Rebounds" "Inside.50s"
## [41] "Clearances" "Clangers"
## [43] "Frees.For" "Frees.Against"
## [45] "Brownlow.Votes" "Contested.Possessions"
## [47] "Uncontested.Possessions" "Contested.Marks"
## [49] "Marks.Inside.50" "One.Percenters"
## [51] "Bounces" "Goal.Assists"
## [53] "Time.on.Ground.." "Substitute"
## [55] "Umpire.1" "Umpire.2"
## [57] "Umpire.3" "Umpire.4"
## [59] "group_id"
Heaps to dig into here! For the purposes of this quick exploration, I’m going to focus on learning more from the attendance data.
Before we get stuck into analysis, a little bit of data cleaning and wrangling is required. Firstly, let’s create a data subset that focuses on attendance and other variables that might be useful to consider alongside attendance figures.
# Subset the data
attendance_data <- afl_data_1998_2018 %>%
select(Season, Round, Date, Local.start.time, Venue,
Attendance, Home.team, Away.team)
We also want the data organised so that one row = one match. To do this requires that each match is given a unique identifier.
# Create unique match IDs
attendance_data <- attendance_data %>%
mutate(match_id =
paste(Date, Home.team, Away.team, sep = "-"))
# Identify duplicate instances of the same match ID
attendance_data$dup <- duplicated(attendance_data$match_id)
# Organise the data so that one row = one match
attendance_data <- attendance_data %>%
filter(dup == FALSE) %>%
select(-dup)
# Check the first few rows to see
# what the data looks like now
head(attendance_data) %>%
kable("html") %>%
kable_styling()
| Season | Round | Date | Local.start.time | Venue | Attendance | Home.team | Away.team | match_id |
|---|---|---|---|---|---|---|---|---|
| 1998 | 1 | 1998-03-28 | 1410 | Princes Park | 20957 | Carlton | Adelaide | 1998-03-28-Carlton-Adelaide |
| 1998 | 2 | 1998-04-05 | 1410 | Football Park | 40602 | Adelaide | Fremantle | 1998-04-05-Adelaide-Fremantle |
| 1998 | 3 | 1998-04-12 | 1410 | Waverley Park | 20532 | St Kilda | Adelaide | 1998-04-12-St Kilda-Adelaide |
| 1998 | 4 | 1998-04-19 | 1410 | Football Park | 41476 | Port Adelaide | Adelaide | 1998-04-19-Port Adelaide-Adelaide |
| 1998 | 5 | 1998-04-26 | 1520 | Football Park | 39974 | Adelaide | Geelong | 1998-04-26-Adelaide-Geelong |
| 1998 | 6 | 1998-05-03 | 1410 | M.C.G. | 23041 | North Melbourne | Adelaide | 1998-05-03-North Melbourne-Adelaide |
Lastly, we want to distinguish regular season matches from finals, since attendance at finals matches is typically higher. We can do this by creating a new grouping variable that can be used to separate these competition phases during the analysis.
# Standardise the naming of finals rounds
attendance_data$Round <- recode(
attendance_data$Round,
QF = "Qualifying Final",
EF = "Elimination Final",
SF = "Semi Final",
PF = "Preliminary Final",
GF = "Grand Final",
.default = attendance_data$Round)
# Create new variable for competition phase
attendance_data <- attendance_data %>%
mutate(phase = case_when(
Round == "Qualifying Final" ~ "Finals",
Round == "Elimination Final" ~ "Finals",
Round == "Semi Final" ~ "Finals",
Round == "Preliminary Final" ~ "Finals",
Round == "Grand Final" ~ "Finals",
TRUE ~ "Regular season"
))
How have attendance figures changed from year to year? Let’s take a look at regular season matches first. We can investigate this visually. One approach is to plot one data point for the attendance at every match in every season^. This will produce a lot of dots (4,051 dots to be precise!), so we can also use a box plot to get a sense of central tendency within any given season.
^ I like to plot every data point available, at least in the exploratory phase of analysis, to get a sense for all of the data. If we only plot summary data (e.g., the box plots only - medians and interquartile ranges, totals per season, means with standard deviations), then we miss out on seeing the spread of the data.
# Subset to regular season matches only
attendance_regular_season <- attendance_data %>%
filter(phase == "Regular season")
# Create a list to store common theme options for use across plots
plotFeatures <- theme(
plot.title = element_text(size = 16),
plot.subtitle = element_text(size = 14),
axis.text.x = element_text(size = 11),
axis.title = element_text(size = 16),
axis.text.y = element_text(size = 11),
legend.position = "none")
# Build the plot
p <- ggplot(attendance_regular_season,
aes(x = Season, y = Attendance, group = Season))
p <- p + geom_boxplot(outlier.shape = NA, coef = 0)
p <- p + geom_point(alpha = 0.1, size = 3, colour = "#0072B2")
p <- p + scale_x_continuous(
breaks = seq(1998, 2018, by = 2))
p <- p + scale_y_continuous(
label = unit_format(unit = "k", scale = 1e-3),
limits = c(0, 95000),
breaks = seq(0, 90000, by = 10000))
p <- p + labs(
title = "Attendance at Australian Football League matches",
subtitle = "Regular season matches only, from 1998 to 2018",
x = "Season",
y = "# in attendance")
p <- p + plotFeatures
plot_attendance_regular_season <- p
# Display the plot
plot_attendance_regular_season
A couple things that stood out to me on initial inspection of this plot:
Ok, so what about attendance at finals matches? Let’s take a look:
# Subset to finals matches only
attendance_finals <- attendance_data %>%
filter(phase == "Finals")
# Build the plot
p <- ggplot(attendance_finals,
aes(x = Season, y = Attendance, group = Season))
p <- p + geom_boxplot(outlier.shape = NA, coef = 0)
p <- p + geom_point(alpha = 0.5, size = 3, colour = "#D55E00")
p <- p + scale_x_continuous(
breaks = seq(1998, 2018, by = 2))
p <- p + scale_y_continuous(
label = unit_format(unit = "k", scale = 1e-3),
limits = c(0, 105000),
breaks = seq(0, 100000, by = 10000))
p <- p + labs(
title = "Attendance at Australian Football League matches",
subtitle = "Finals matches only, from 1998 to 2018",
x = "Season",
y = "# in attendance")
p <- p + plotFeatures
plot_attendance_finals <- p
# Display the plot
plot_attendance_finals
With there being only a handful of finals matches in any given season, the year-to-year variation in median attendances is unsurprising, as is the within-season variation (as shown by the heights of the boxes, denoting interquartile ranges).
Anyone who follows the AFL competition could quickly surmise that some teams (like Collingwood, Hawthorn, Essendon) would more often play in front of large crowds, compared to other teams (like North Melbourne, the Gold Coast Suns). With this data set, we can quantify how much teams differ from each other in terms of the crowd sizes they play in front of.
For the histograms below, I’ve used bins of 2,500. Let’s take a look at crowd sizes when teams play at home:
# Build the plot
p <- ggplot(attendance_regular_season,
aes(x = Attendance, fill = Home.team))
p <- p + facet_wrap(~Home.team)
p <- p + geom_histogram(binwidth = 2500)
p <- p + plotFeatures
p <- p + scale_x_continuous(
label = unit_format(unit = "k", scale = 1e-3),
breaks = seq(0, 100000, by = 20000))
p <- p + labs(
title = "Distribution of crowd sizes when playing at HOME",
subtitle = "Regular season matches only, from 1998 to 2018",
x = "# in attendance",
y = "Count of games played per bin")
p <- p + plotFeatures
p <- p + theme(strip.text = element_text(size = 10))
plot_attendance_home <- p
# Display the plot
plot_attendance_home
Similarly, we can look at crowd sizes when teams play away:
# Build the plot
p <- ggplot(attendance_regular_season,
aes(x = Attendance, fill = Away.team))
p <- p + facet_wrap(~Away.team)
p <- p + geom_histogram(binwidth = 2500)
p <- p + plotFeatures
p <- p + scale_x_continuous(
label = unit_format(unit = "k", scale = 1e-3),
breaks = seq(0, 100000, by = 20000))
p <- p + labs(
title = "Distribution of crowd sizes when playing AWAY",
subtitle = "Regular season matches only, from 1998 to 2018",
x = "# in attendance",
y = "Count of games played per bin")
p <- p + plotFeatures
p <- p + theme(strip.text = element_text(size = 10))
plot_attendance_away <- p
# Display the plot
plot_attendance_away
Although I don’t work in footy now, I do feel a sense of calm that, through packages like fitzRoy
, others may be saved from some of the time-consuming, headache-inducing frustrations that can come with manually scraping, cleaning, and merging data sets across disparate sources…


Home
News
Contact
About
☰
Responsive Bottom Navbar Example
Resize the browser window to see how it works.
×
About
Services
Clients
Contact
open


Development
Set refresh token read providers
You can set order of BABELSHEET_REFRESH_TOKEN
providers in /src/services/producer/container.ts
for producer, and in /src/services/cli/container.ts
for CLI tool:
readProviders: [
container.resolve<InEnvStorage>('inEnvStorage'),
container.resolve<InFileStorage>('inFileStorage'),
container.resolve<InRedisStorage>('inRedisStorage'),
],
First .env.babelsheet file will be checked does it contain BABELSHEET_REFRESH_TOKEN
, if not, next data.json
file will be checked, and the last one will be redis storage. Feel free to change order of those providers, or creating new ones.
Set refresh token write provider
You can set BABELSHEET_REFRESH_TOKEN
write provider in /src/services/cli/container.ts
for CLI tool, and in /src/services/producer/container.ts
for producer. Notice that producer will only have ability to save BABELSHEET_REFRESH_TOKEN
when you run it locally, not in docker container - browser window will be opened automatically.
writeProvider: container.resolve<InEnvStorage>('inEnvStorage'),
You can change it to one of those three storages:
container.resolve<InEnvStorage>('inEnvStorage')
container.resolve<InFileStorage>('inFileStorage')
container.resolve<InRedisStorage>('inRedisStorage')
Feel free to add new providers.
Change translations storage from redis to file
Service is implemented to use redis as cache storage but can use another database or even in memory cache as well. There are various implementations in src/infrastracture/storage
. For fast production use it is recommended to use redis, but for local development and debugging in memory implementation can be used. There are some other implementations available now, like inFileStorage
. In order to change translations storage in file:
-
Open
/src/services/producer/container.ts
and change:storage: awilix.asClass(InRedisStorage)
to:storage: awilix.asClass(InFileStorage)
-
Open
/src/services/api/container.ts
and change:storage: awilix.asClass(InFileStorage)
to:fileRepository: awilix.asClass(FileRepository, { lifetime: awilix.Lifetime.SINGLETON }), storage: awilix.asClass(InFileStorage)
Producer will now save to data.json
file, and API will read from that file as well.
Scripts
npm run test - runs tests and generates coverage report
npm run test-watch - runs tests continuously and watches for changes
npm run format - formats code using prettier
npm run type-check - runs typescript checks
npm run build - compiles typescript
npm run lint - runs typescript linter
npm run lint-fix - runs typescript linter and fixes some common mistakes
npm run nsp - runs security check
npm run start-producer - runs redis producer
npm run start-api - runs api


@JRPictures It’s just too valley girl and grating for me to enjoy it.
I love her sub voice, but not her dub.


Enter something in the following inputs if you wish to reset the password for this account. If left blank, the password will not be changed.


Welcome to
Massages by André
In Home Therapeutic Massage Service
About Your Massage
The Swedish Massage is a full body massage, consisting of five main strokes:
effleurage, petrissage, tapotement, friction, and vibration.
The strokes are administered in a long, flowing style, and target major muscle groups.
The result is complete, pure relaxation.
Swedish massage also has health benefits.
Besides reducing stress levels,massage also improves circulation,
helps to reduce the buildup of harmful toxins, and may even reduce the appearance of stretch marks.
What To Expect
Never had a massage? What then can you expect?
These pointers will gently introduce the uninitiated to the wonderful world of getting a massage.
Expect that most of your body is going to be massaged in some fashion,
excluding the private zones or areas that you state are off limits.
A Swedish massage is a full body massage.
Expect that your therapist will attend to the specific parts you requested extra special attention on, or obey any wishes or restrictions you have.
Privacy and Comfort
Your privacy will be respected at all times, and comfort zone preserved.
While you will be partially nude for the massage, you will never be exposed.
You will be completely covered on the areas of the body that are not being worked on.
You will not be exposed to your therapist at any time before, during, or after your session.
We are careful and thoughtful so as not to expose you when unwrapping the next body part.
Packages
Full Body Massage - 60 Mins - $4500
Full Body Massage - 30 Mins - $2500
Focused Massage - 20 Mins - $1500
Travel
Portmore - $700
Spanish Town - $800
Schedule Your Appointment
Email<EMAIL_ADDRESS>or
Call<PHONE_NUMBER>


Our video game, the Aftermath, is a futuristic 2d platformer with a dystopian story: all fertile agricultural land on Earth is finally used up due to environmental problems such as drought and overproduction, something that can definitely happen in the near future. Because of this, all governments decide to launch a massive initiative to convert regions of the Earth into factory and production lines to produce parts for ships to send society into space and go to the nearest habitable planet GJ 832c. What happens, however, when someone can’t afford the trip to a new planet and to provide for themselves until then? They’re left behind. This is the second problem that we address in the story: wealth distribution. Because the main character is a poor farmer, his whole way of life is destroyed when agricultural land is used up and no longer yields profit. When society leaves, they are stuck in the industrial wasteland.
The objective of the game is to lead the main character through abandoned factory environments and collect 5 main parts of a ship so that they can leave the planet and join society on GJ 832c. Along the way they have to obtain 100 portions of fuel to power the ship and avoid mutant rats that have moved into the abandoned facilities.
We chose to make a video game because we feel strongly about both environmental decay as a result of human actions and uneven distribution of wealth, and felt an interactive medium would be the best way to allow for the player to feel an attachment to these issues. The game puts each viewer of the piece directly into this dystopian future and allows them to feel a unique connection to the story by wanting to guide our character to success. It uses silhouettes to exaggerate the abandoned atmosphere of the locations on Earth and a slow, sad piece of piano music plays to show how unfortunate the situation is. Once the player obtains each of the 5 key items and 100 portions of fuel, they successfully leave the planet and head for the rest of society.
If given more time we would have loved to complete more levels (ideally 5, since we want the player to get 100 fuels portions, and there are 20 per level), and come up with an outcome for the story/refine the story slides. We have a vision that sees the main character escaping the Earth at the end of the game, however they find that, after landing on the new planet, everyone there is dead because they were unable to make efficient use of the resources and many did not survive the trip. The point of this outcome is that humans are doomed to make the same mistakes that we have made in the past and that, instead of trying to fix our current issues, we would rather abandon them.


sealed Class AddrInfo
| Modifier and Type | Field |
|---|---|
IntNumber
|
ai_flags
|
IntNumber
|
ai_family
|
IntNumber
|
ai_socktype
|
IntNumber
|
ai_protocol
|
IntNumber
|
ai_addrlen
|
UnsafePointer
|
ai_canonname
|
UnsafePointer
|
ai_addr
|
UnsafePointer
|
ai_next
|
| Modifier and Type | Constructor |
|---|---|
AddrInfo |
constructor()
|
| Modifier and Type | Property accessor |
|---|---|
get IntNumber |
Flags
|
set |
Flags(IntNumber)
|
get IntNumber |
Family
|
set |
Family(IntNumber)
|
get IntNumber |
SocketType
|
set |
SocketType(IntNumber)
|
get IntNumber |
Protocol
|
set |
Protocol(IntNumber)
|
get IntNumber |
AddressLen
|
set |
AddressLen(IntNumber)
|
get UnsafePointer |
Address
|
sealed Class AddrInfoReader
| Modifier and Type | Field |
|---|---|
UnsafePointer
|
paddrinfo
|
UnsafePointer
|
prootinfo
|
| Modifier and Type | Constructor |
|---|---|
AddrInfoReader |
constructor(String, AddrInfo)
|
AddrInfoReader |
constructor(String, String, AddrInfo)
|
AddrInfoReader |
protected constructor()
|
| Type | Conversion Method |
|---|---|
AddrInfoReader |
cast(AddrInfoReader)
|
| Modifier and Type | Property accessor |
|---|---|
get BoolValue |
Available
|
sealed Class Socket
| Modifier and Type | Field |
|---|---|
Object
|
theHandle
|
| Modifier and Type | Constructor |
|---|---|
Socket |
constructor(IntNumber)
|
Socket |
constructor(IntNumber, IntNumber, IntNumber)
|
Socket |
protected constructor()
|
| Modifier and Type | Method |
|---|---|
Object |
bind(UnsafePointer, IntNumber)
|
Object |
listen(IntNumber)
|
BoolValue |
tryOpen(UnsafePointer, IntNumber)
|
IntNumber |
write(Array<system'ByteNumber>)
|
Object |
write(Array<system'ByteNumber>, IntNumber, IntNumber, ref<system'IntNumber>)
|
Object |
read(Array<system'ByteNumber>, IntNumber, IntNumber, ref<system'IntNumber>)
|
Socket |
accept()
|
Object |
shutdown(IntNumber)
|
Object |
iocommand(IntNumber, ref<system'IntNumber>)
|
Object |
option(IntNumber, IntNumber, BoolValue)
|
Object |
close()
|
Class SocketException
| Modifier and Type | Constructor |
|---|---|
Object |
raise()
|
SocketException |
new(String, IntNumber)
|
SocketException |
new(String)
|
SocketException |
protected constructor()
|
| Type | Conversion Method |
|---|---|
SocketException |
cast(SocketException)
|
| Modifier and Type | Property accessor |
|---|---|
get IntNumber |
ErrorCode
|
| Modifier and Type | Method |
|---|---|
String |
toPrintable()
|
| Modifier and Type | Name |
|---|---|
|
symbol #initializer
|
| Modifier and Type | Name |
|---|---|
IntNumber
|
symbol AF_INET
|
| Modifier and Type | Name |
|---|---|
IntNumber
|
symbol AF_UNSPEC
|
| Modifier and Type | Name |
|---|---|
IntNumber
|
symbol AI_PASSIVE
|
| Modifier and Type | Name |
|---|---|
IntNumber
|
symbol FIONBIO
|
| Modifier and Type | Name |
|---|---|
IntNumber
|
symbol INVALID_SOCKET
|
| Modifier and Type | Name |
|---|---|
IntNumber
|
symbol IPPROTO_TCP
|
| Modifier and Type | Name |
|---|---|
IntNumber
|
symbol SD_BOTH
|
| Modifier and Type | Name |
|---|---|
IntNumber
|
symbol SOCKET_ERROR
|
| Modifier and Type | Name |
|---|---|
IntNumber
|
symbol SOCK_STREAM
|
| Modifier and Type | Name |
|---|---|
IntNumber
|
symbol SOMAXCONN
|
| Modifier and Type | Name |
|---|---|
IntNumber
|
symbol TCP_NODELAY
|
| Modifier and Type | Name |
|---|---|
IntNumber
|
symbol WSAECONNRESET
|
| Modifier and Type | Name |
|---|---|
IntNumber
|
symbol WSAEWOULDBLOCK
|


{{ 'Please feel free to give any suggestions in order to improve this documentation.' | translate(entity.global) }}
{{ 'Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.' | translate(entity.global) }}
{{ 'Your support requests will not be processed via this form. To do this, please use the' | translate(entity.global) }} "{{ 'Create a ticket' | translate(entity.global) }}" {% if entity.locale != 'en' %}.{% else %}form.{% endif %}
{{ 'Thank you. Your feedback has been received' | translate(entity.global) }}.


the word 'wow' doesnt exactly do this trip justice.
the somewhat frank account of the trip:
a friend provided me with what he referred to as 'madman weed.' It was very high-grade hydroponically grown marijuana. it had crystals all over it and a very very spicey smell.
this was smoked in a 3' pipe. the pipe has a somewhat-resinated 'stash' in the middle. about 1/16oz of this marijuana was smoked.
this was followed by about 1/8th oz dried homegrown salvia.
this was in turn followed by 1/8th marijuana.
the following bowl was purely inspirational. it seems to me that 'mary' thought it would be a good idea to invite 'sally' over. So i combined equal proportions dried salvia leaves and dried, cooked (in other words, very finely chopped, very dry -- almost like a kitchen spice), marijuana leaves. The resulting smoke was filtered via an activated charcoal filter. it was incredible. two hits of the smoke were taken in quick sucession. before i could inhale another hit, a wave blew over me. it was incredible. a feeling like i had stepped through a threshold. i found the lighter, which had been in my hand, and further burnt the contents of the bowl, and further inhaling. visions sort of took over, with blips and dots flying across my eyes and pixelating my vision. my depth perception was about as unclear as on high-dose DXM (yeah, wow, me too... i didnt expect this!)
I sat down on the bed and waited a minute or two. those were two pretty intense minute. the salvia began to 'peak' in waves. this persisted until i picked up the pipe again.
for the last few weeks, the tree datura (brugmansia) i have dried has been staring at me. i feel like it wants me to take it again. i certainly love the plant. it is a small (about 8' tall) clone of a giant tree that made gorgeous flowers. its growing hydroponically, and has produced more leaves that I thought it ever would. the ones that it doesnt want get added to the 'datura pile.'
anyhow, I decided that tonight was a good night to try. I thought since I had nothing to do tomorrow, except have a meeting with Lester Sylvester Dexter, I should try it... if only for the dreams. I figured that if the plant stayed with me for a day or two, i could tough it out.
I placed a small leaf into the bowl, with no salvia or anything this time. just me and the datura.
She and I embraced for a few minutes.
Her touch carried me out of the hallway mj and sd had brought me to. It was an entirely different place. It seemed as though all three were definitely 'there,' but not in any sort of physical, visual, or other manifestation. I started music (just your average goa mixtape) after opening my eyes to find myself staring at the radio.
the room began to spin. i began to spiral downward, with swirling red and purplish blue dots flying around my eyes. vision turned to a darkish greengrey color, and the room simply disappeared. i dont know if my eyes were open or closed, it really didnt matter. after tiring of colored dots, i tried to sit up.
something inside me realized that navigation was necessary, and i began to start making things out. i crawled (literally) to the lightswitch and shut the lights out, and climbed back to bed. one of the three was persuading me to sleep, and dreams came not long thereafter.
i remember a dream about my back. voices were coming from nowhere, complaining about my back and all the drugs im on. (that is, that ive been prescribed)
i had some odd dream about myself being a martial artist, with waist-length black hair. this is particularly interesting to me, as ive been growing my hair longer over the last month or two. im hoping to have hair about that length.
siiiiiiigh. it was a wonderful trip. i felt rejuvenated the next day, and things regaring lawsuits and insurance companies are actually getting better since that very day. im getting paid, my back is getting fixed (or so they say), and I am learning more about the spirits.
i would definitely call the three an a+ combo, but take the brugmansia slowly. doses are cumulative over as much as three or four days!
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


 Seit mehr als 125 Jahren steht der Name Pfeiffer Vacuum für hochwertige Vakuumtechnik, ein umfassendes Komplettangebot in höchster Qualität und erstklassigen Service. Pfeiffer Balzers TPH-062 Turbo Pump GenTech. Pfeiffer TPH-062 Turbo Pump Rebuilt, New, Refurbished, Used, Repair. Vakuumtechnik und Vakuumpumpen vom führenden Anbieter. Buy the Pfeiffer TPH/TPU 055, 060, 062, 064, 071 Turbomolecular Vacuum Pump Plastic Vent Screw, PM033302
Pfeifer vacuum TPH 062 Handbücher. A J Vacuum repair / rebuild and service all Pfeiffer TPH 060, TPU 060, TPH 062, TPU 062 / PM P02 400 and PM P02 401 Turbo Pumps, Pfeiffer Backing Pumps along with all other Pfeiffer Vacuum Pumps and all other Pfeiffer Leak Detector Service and repair. The Pfeiffer Balzers TPH-062 turbo molecular high vacuum pumps have a pumping speed of 62 liters per second (l/s). The TPH 062 turbomolecular pump can be used for all general-purpose high vacuum applications. Pfeiffer TPH-062 Turbo Pump, ISO63 Inlet, Rebuilt – Provac. Pfeiffer Vacuum Operating Fluid Oil Reservoir for Pfeiffer Vacuum TPH 022 - TMH/U 071P Turbo Vacuum Pumps, PM 103 593 AT PM103593AT, Pfeiffer Vacuum Operating Fluid Oil Reservoir for Pfeiffer Vacuum TPH 022 - TMH/U 071P Turbo Vacuum Pumps, PM 103 593 AT PM103593AT, This PM103593 AT Operating Fluid Reservoir is designed Pfeiffer Vacuum Operating Fluid Oil Reservoir for Pfeiffer.
Fully Refurbished Pfeiffer Vacuum TPH 062 Turbo Vacuum. Pfeiffer Balzers TPH-240 PM P01 326 B/M4452 Turbo Vacuum Pump See more like this PFEIFFER VACUUM TPH 062 TURBO VACUUM PUMP PM P02 092-A REFURBISHED (B10) Refurbished. A J Vacuum repair / rebuild and service Pfeiffer TPH 060, TPH 062 Turbo Pumps and Turbo Pump Controllers along with all other Pfeiffer Vacuum Vacuum Rotary Vane Pumps, Pfeiffer Pump repair, Pfeiffer Leak Detector Repair and all other Pfeiffer Vacuum Rotary Vane pumps. Pfeiffer Vacuum TPH 060 (TPH060) Turbo Pump, ISO63.


Table of contents:
The Dockerfile for CBAT can be found in this directory.
To build the image:
docker build --tag cbat .
To run the container:
docker run -it cbat bash
To mount a local directory (e.g., your home directory) at /external
inside the container:
docker run -it -v ${HOME}:/external -w /external cbat bash
By default, the build use nproc
jobs. If you want to limit it to a specific number, provide an OPAM_JOBS
number as a build argument:
docker build --build-arg OPAM_JOBS=3 --tag cbat .
If you are building behind a proxy, provide http_proxy
and https_proxy
values as build arguments:
docker build --build-arg http_proxy=http://myproxy.com:1234 --build-arg https_proxy=http://myproxy.com:1234 --tag cbat .
Before installing, make sure you have the appropriate dependencies installed. First, there is OCaml:
The recommended way to install Ocaml is with OPAM. Instructions on downloading OPAM, and using OPAM to download Ocaml can be found here.
The following dependencies are needed to install Z3:
You can install the latest Z3 Ocaml bindings from the dev repo with:
opam pin add z3 --dev-repo
If you want to install the most recent stable release of Z3 from OPAM instead, you can run:
opam install z3
Next, there is the alpha release of BAP:
Instructions on downloading BAP from the testing repository can be found here.
Then, there are the following OCaml packages:
All of these can be installed with:
opam install core ounit2 re duneOptionally, you may install Boolector 3.2.1 from here to use with the
--ext-solver-path
option. For some queries, Boolector may be more performant than the standard Z3.
Then, to build and install the weakest precondition tools, simply run make
in this directory:
make
To uninstall and clean:
make clean
To run oUnit unit tests:
make test
To run oUnit integration tests:
make test.plugin.integration
To run oUnit tests with colored output, before running the above test commands, run
export OUNIT_CI=true
To build the API documentation, install odoc
:
opam install odoc
Then build the docs:
make doc
The documentation can then be viewed locally at lib/bap_wp/_build/default/_doc/_html/index.html
.


In section \ref{sec:separating-analysis} we modified our original metacircular interpreter to separate analysis from execution. We analyzed each expression to produce an execution function that took an environment as argument and performed the required operations. In our compiler, we will do essentially the same analysis. Instead of producing execution functions, however, we will generate sequences of instructions to be run by our register machine.
The function compile is the top-level dispatch in the compiler. It corresponds to the eval function of section \ref{sec:core-of-evaluator}, the analyze function of section \ref{sec:separating-analysis}, and the eval_dispatch entry point of the explicit-control-evaluator in section \ref{sec:eceval-core}. The compiler, like the interpreters, uses the expression-syntax functions defined in section \ref{sec:representing-expressions}.[1] Compile performs a case analysis on the syntactic type of the expression to be compiled. For each type of expression, it dispatches to a specialized code generator:
function compile(exp, target, linkage) { return is_self-evaluating(exp) ? compile_self_evaluating(exp, target, linkage) : is_quoted(exp) ? compile_quoted(exp, target, linkage) : is_variable(exp) ? compile_variable(exp, target, linkage) : is_assignment(exp) ? compile_assignment(exp, target, linkage) : is_definition(exp) ? compile_definition(exp, target, linkage) : is_conditional_expression(exp) ? compile(cond_if(exp), target, linkage) : is_function_expression(exp) ? compile_function_expression(exp, target, linkage) : is_block(exp) ? compile_block(begin_actions(exp), target, linkage) : is_conditional_statement(exp) ? compile_conditional_statement(exp, target, linkage) : is_application(exp) ? compile_application(exp, target, linkage) : error(exp, "Unknown expression type - - COMPILE"); }
Compile and the code generators that it calls take two arguments in addition to the expression to compile. There is a target, which specifies the register in which the compiled code is to return the value of the expression. There is also a linkage descriptor, which describes how the code resulting from the compilation of the expression should proceed when it has finished its execution. The linkage descriptor can require that the code do one of the following three things:
For example, compiling the expression 5 (which is self-evaluating) with a target of the val register and a linkage of next should produce the instruction
assign("val", constant(5));
Compiling the same expression with a linkage of return should produce the instructions
assign("val", constant(5)); go_to(reg("continue"));
In the first case, execution will continue with the next instruction in the sequence. In the second case, we will return from a function call. In both cases, the value of the expression will be placed into the target val register.
Each code generator returns an instruction sequence containing the object code it has generated for the expression. Code generation for a compound expression is accomplished by combining the output from simpler code generators for component expressions, just as evaluation of a compound expression is accomplished by evaluating the component expressions.
The simplest method for combining instruction sequences is a function called append_instruction_sequences. It takes as arguments any number of instruction sequences that are to be executed sequentially; it appends them and returns the combined sequence. That is, if $seq_1$ and $seq_2$ are sequences of instructions, then evaluating append_instruction_sequences($seq_1$, $seq_2$); produces the sequence $\textit{seq}_1$ $\textit{seq}_2$
Whenever registers might need to be saved, the compiler's code generators use preserving, which is a more subtle method for combining instruction sequences. Preserving takes three arguments: a set of registers and two instruction sequences that are to be executed sequentially. It appends the sequences in such a way that the contents of each register in the set is preserved over the execution of the first sequence, if this is needed for the execution of the second sequence. That is, if the first sequence modifies the register and the second sequence actually needs the register's original contents, then preserving wraps a save and a restore of the register around the first sequence before appending the sequences. Otherwise, preserving simply returns the appended instruction sequences. Thus, for example, preserving(list($\textit{reg}_1$, $\textit{reg}_2$), $\textit{seq}_1$, $\textit{seq}_2$); produces one of the following four sequences of instructions, depending on how $\textit{seq}_1$ and $\textit{seq}_2$ use $\textit{reg}_1$ and $\textit{reg}_2$:
By using preserving to combine instruction sequences the compiler avoids unnecessary stack operations. This also isolates the details of whether or not to generate save and restore instructions within the preserving function, separating them from the concerns that arise in writing each of the individual code generators. In fact no save or restore instructions are explicitly produced by the code generators.
In principle, we could represent an instruction sequence simply as a list of instructions. Append_instruction_sequences could then combine instruction sequences by performing an ordinary list append. However, preserving would then be a complex operation, because it would have to analyze each instruction sequence to determine how the sequence uses its registers. Preserving would be inefficient as well as complex, because it would have to analyze each of its instruction sequence arguments, even though these sequences might themselves have been constructed by calls to preserving, in which case their parts would have already been analyzed. To avoid such repetitious analysis we will associate with each instruction sequence some information about its register use. When we construct a basic instruction sequence we will provide this information explicitly, and the functions that combine instruction sequences will derive register-use information for the combined sequence from the information associated with the component sequences.
An instruction sequence will contain three pieces of information:
We will represent an instruction sequence as a list of its three parts. The constructor for instruction sequences is thus
function make_instruction_sequence(needs, modifies, statements) { return list(needs, modifies,statements); }
For example, the two-instruction sequence that looks up the value of the variable x in the current environment, assigns the result to val, and then returns, requires registers env and continue to have been initialized, and modifies register val. This sequence would therefore be constructed as
make_instruction_sequence(list("env", "continue"), list("val"), list(assign("val", op("lookup_variable_value"), constant("x"), reg("env")), go_to(reg("continue"))));
We sometimes need to construct an instruction sequence with no statements:
function empty_instruction_sequence() { return make_instruction_sequence(list(), list(), list()); }
The functions for combining instruction sequences are shown in section \ref{sec:combining-instruction-sequences}.


---
layout: sidebar
title: Templating
permalink: templating/
---
This is a tutorial on web templating.
Create a new page in the root of the frontend-training project called order.html and copy the following in to it:
{% highlight html %}
---
layout: default
title: Order
permalink: order/
---
Customer Details
Customer Name
Invoice Address
Email Address
Phone Number
Delivery Details
Customer Name
Delivery Address
Delivery Date
Order Items
| ID |
Image |
Description |
Price |
Gift Wrap |
| Item ID |
Item Image |
Item Description |
Item Price |
Gift Wrap |
Payment
Items Total
Delivery Charge
Order Total
Payment Method
{% endhighlight %}
Take a look at the following JSON data in _data/order.json:
{% highlight json %}
{
"id": "123ABC456",
"date": "2015-03-04T08:54:17+00:00",
"customer": {
"title": "Mr",
"forename": "Steve",
"surname": "Smith",
"addresses": [
{
"type": "delivery",
"address_1": "321 Evergreen Terrace",
"address_2": "Mannamead",
"town_city": "Plymouth",
"county": "Devon",
"postcode": "PL1 2AA",
"country": "United Kingdom"
},
{
"type": "invoice",
"address_1": "22 Acacia Avenue",
"address_2": "Crownhill",
"town_city": "Plymouth",
"county": "Devon",
"postcode": "PL2 3ZZ",
"country": "United Kingdom"
}
],
"payment_method": "PayPal",
"email"<EMAIL_ADDRESS>"phone": "07123456789"
},
"items": [
{
"id": "1234",
"description": "Powerball Supernova Neon Lighting",
"image": "http://ecx.images-amazon.com/images/I/81ccbRlUPML._SL1500_.jpg",
"price": 16.99,
"gift_wrap": true
},
{
"id": "2345",
"description": "Macbook 13 inch decal sticker Yoshi",
"image": "http://ecx.images-amazon.com/images/I/31crlvT6qoL.jpg",
"price": 5.99,
"gift_wrap": false
},
{
"id": "3456",
"description": "Google Chromecast",
"image": "http://ecx.images-amazon.com/images/I/817L4SMD2LL._SL1500_.jpg",
"price": 29.99,
"gift_wrap": false
}
],
"delivery_charge": 2.99,
"delivery_date": "2015-03-07"
}
{% endhighlight %}
Familiarise yourself with the Liquid templating engine syntax.
Consider how you would use Liquid to represent the JSON data into the HTML layout, similarly to this example solution. Not all the information you need is in the JSON data, so you will need to use some logic and filters to calculate some parts.


Does what it says on the tin.
Installs an application from an MSI file, usually on a fileshare.
If you can edit the MSI file... you get the picture.
Slide Notes
-This one... does what it says on the tin. Loads a Windows MSI installer file from somewhere on the network and installs it on the host.
-Again, Grouper in -online mode will tell you who can modify the source file. If that who is you, then... ding!
-This is the one I see most often in the wild so definitely check it out.


This package contains implementations for the four-state family of barcode symbologies. At present, it contains an implementation for the Royal Mail Customer Barcode.


Allen Yilun Lin
Studying social computing and spatial computing.
News
Jan 2019: My Microsoft internship paper is accepted to WWW 2019! Excited to be back to SF on May 13 (which happens to be my birthday 🎂).
Sept 2018: Finished a 3-month User Experience Research internship at Google with awesome mentors Jan Blom and Inna Tsirlin! Bye-bye free food and Bay Area and brace myself for Chicago winter! 🥶
April 2018: Presented our WWW 2018 paper that recommends data visualizations from Wikimedia Commons to augment news articles reading.
Dec 2017: A paper on automatically augmenting news articles with diverse types of data visualizations from Wikipedia has been accepted to WWW 2018! It will be my first WWW and my first time to visit Lyon, France! 😎
Dec 2017: I am starting a 3-month internship at Microsoft Research from January, 2018! I will work with wonderful mentors Justin Cranshaw and Scott Counts! Feeling excited! 🤩
Aug 2017 A paper about membership turnover and its effect on Wikipedia has been accepted to CSCW 2018!
May 2017: Presented our CHI 2017 paper that analyzed HCI issues in catastrophic car accidents that involved GPS. Yes, the presentation is available on Youtube!
Feb 2017: Went to CSCW 2017 and presented our work that addressed the article-as-concept assumption in Wikipedia-based research and technologies.
Jan 2017: Three papers accepted at CHI 2017! Please see Publication page for full details. Also selected as a student volunteer! See you in Denver this May!


By choosing “I agree” below you agree to Google’s Terms of Service. You also agree to our Privacy Policy, which describes how we process your information, including these key points:
Data we process when you use Community Calendar When you set up a Community Calendar Account, we store information you give us like your name, email address, and telephone number. When you use Community Calendar services to do things like create a new event or comment on other events, we store the information you create. When you search for a restaurant on Community Calendar Maps or watch a video from other events, for example, we process information about that activity – including information like the video you watched, device IDs, IP addresses, cookie data, and location. We also process the kinds of information described above when you use apps or sites that use Community Calendar services like ads, Analytics, and the event video player. Depending on your account settings, some of this data may be associated with your Community Calendar Account and we treat this data as personal information. You can control how we collect and use this data at My Setting. Why we process it We process this data for the purposes described in our policy, including to: Help our services deliver more useful, customized content such as more relevant search results; Improve the quality of our services and develop new ones; Deliver personalized ads, both on Community Calendar services and on sites and apps that partner with Community Calendar; Improve security by protecting against fraud and abuse; and Conduct analytics and measurement to understand how our services are used. Combining data We also combine data among our services and across your devices for these purposes. For example, we show you ads based on information from your use of Search, and we use data from trillions of search queries to build spell-correction models that we use across all of our services.


Ethernet is a networking technology whose standards operate in, and define, Data Link (L2) and Physical (L1) Layers.
It is the dominant technology for Local Area Networks.
Ethernet specifications comprises different L1 and L2 variations, but the frame format and addressing is basically the same across all variants.
MAC addressing allows devices to identify frame's destination without the overhead of deincapsulation.
Ethernet MAC addresses are 48 bits long, expressed as 12 hex digits, split in two parts:
e.g.: e8:11:32:4e:48:6b, e8:11:32 is the OUI assigned to Samsung.
The MAC address is stored in NIC's ROM. When the host boots, the MAC is copied into the RAM.
From then each device can send and receive frames, attaching source and destination MAC addresses to it.
When a device receives a frame, it checks if its MAC address matches the destination. If it does, it passes the frame to upper layers. If it doesn't, the frame is discarded.
MAC addresses can be represented with:
Composed by the L3 PDU, and a header+trailer of control informations, divided in fields.
There are two (minimally) different Ethernet frames: the Ethernet II (also called DIX) and IEEE 802.3 Ethernet Standards. TCP/IP uses the Ethernet II frame type.
Ethernet frames minimum size is 64 bytes, max size is 1518 bytes. From IEEE 802.3ac, max size has been extended to 1522 to accomodate for VLANs (Virtual Area Networks).

Combines with a broadcast network address, like a broadcast IP address (eg. <IP_ADDRESS>), to deliver the frame to every host on a local network.
Many fundamentals network protocols and mechanisms, like ARP and DHCP, rely on broadcast.
Combines with a multicast network address, like the multicast IPv4 allocation (<IP_ADDRESS> - <IP_ADDRESS>), to deliver the frame to a host group.
The switch has to build a MAC Table to make its decisions.
It's also called CAM table (content addressable memory).
Store and Forward Switching makes a forwarding decision only after receiving the entirety of the frame and error-checking it.
It is the main switching method in a Cisco LAN switch.
After receiving the frame, the switch computes its checksum (FCS). If it matches the FCS value the frame is forwarded through the appropriate exit port, otherwise it is dropped.
Cut-Through Switching makes a forwarding decision as soon as "enough" bytes of the frame as been received.
The actual forwarding process begins before the frame has been completely received.
There are two variants, both not verifying the checksum:
A buffer is a memory with the purpose of temporarily queuing something, continuously filled and emptied.
Switches use two types of memory buffer to store Ethernet frames before forwarding them:
Network and Data Link layers are those responsible for uniquely identifying the source and destination of the data exchange.
They both do that using addresses, but of different kind and for different purposes.
Network addresses are logical addresses (not tied to a specific device) required to deliver a packet from source to destination, either on the same or different networks.
IP addresses are structured and delivery operates by moving (routing) packets according to their structure.
You need two of those IP addresses: source and destination.
Data Link Layer (DLL or L2) addresses, also known as physical addresses (tied to the NIC), are used to reach another network interface in the same network (link).
DLL addresses, like MAC addresses, have no structure: 00:AA:BB:11:FF:01 and 00:AA:BB:11:FF:02 could be on different planets, for all we know.
L2 delivery operates on the assumption that end devices can communicate directly over the same link, just by sending frames with correct addressing onto the wire.
You need 2 MAC addresses: source and destination.
A gateway is a host (a router, almost always) in a network that knows how to reach other (specific) networks.
The default gateway is the router to which a host on a network will send every frame for which it has no specific gateway.
The default gateway is presumed to know what to do.
Default gateway either routes the packet to final destination or to another router, called next hop.
L2 addressing information is rewritten at every hop.
A host needs to know both the logical and physical addresses of the destination host to be able to generate and send the frame.
For IP addresses, you probably know IP addresses on your own network and you enter them manually.
For remote networks, you can learn IP address by configuring your device to use DNS (Domain Name System).
Remembering MAC Addresses would be much more trickier, but fortunately ARP (Address Resolution Protocol) relieves you of that need.
Think about it: we have 2 different sets of addresses both able to globally and uniquely identify hosts. Why?
If we started from scratch today, we could probably just use IPs.
The reality is that the Ethernet+IP addressing has been working pretty well for ~40 years and almost everything has been based on it. So the urge to change it's minimal.
To generate a frame, we need:
What ARP does is:
When an host needs to determine the destination MAC, it searches the destination IP in the ARP table to see if there's already a mapping.
It has two way of doing so, an active and a passive one:
Simple: the host listens to incoming frames, reads the source MAC and IP addresses, and if this mapping is not already on the ARP table, the mapping is added to it.
ARP entries are time stamped, they expire, and can be static.
If no host replies to the ARP request, the encapsulation fails, the frame is aborted and an error might be reported to the upper layers.
What we've seen until now only works on a local network, because broadcast (like ARP requests) doesn't propagate to other networks.
When the host recognizes that the IP address of which it wants to know the MAC address it's part of a remote network, it has to forward the frame to a (default) gateway.
This means it has to use the (default) gateway MAC address as the destination.
stefanauss@barney:~$ arp -a
? (<IP_ADDRESS>) associato a c0:4a:00:fc:28:9c [ether] su eth0
stefanauss@barney:~$ cat /proc/net/arp
IP address HW type Flags HW address Mask Device
<IP_ADDRESS> 0x1 0x2 c0:4a:00:fc:28:9c * eth0
C:\> arp -a
Interface: <IP_ADDRESS> on Interface 0x1
Internet Address Physical Address Type
<IP_ADDRESS> 00-e0-98-00-7c-dc dynamic
Router#show arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet <IP_ADDRESS> 0 001e.4a71.8f80 ARPA Vlan2000
Internet <IP_ADDRESS> 0 001e.4a21.af80 ARPA Vlan2000
Internet <IP_ADDRESS> - 001e.4a7b.5800 ARPA Vlan2093
Internet <IP_ADDRESS> 143 001e.4a71.8f80 ARPA Vlan2093
Internet <IP_ADDRESS> 21 001e.4a21.af80 ARPA Vlan2093
Internet <IP_ADDRESS> - 001e.4a7b.5800 ARPA Vlan2000
Internet <IP_ADDRESS> - 001e.4a7b.5800 ARPA Vlan2089
Internet <IP_ADDRESS> 0 001f.6c9c.7017 ARPA Vlan2089
Internet <IP_ADDRESS> 0 001f.6c9c.6c17 ARPA Vlan2089
ipconfig /release
ipconfig /renew
arp -s <IP_ADDRESS> 00-10-54-CA-E1-40
arp -d <IP_ADDRESS>
root@hostname# ip -s -s neigh flush all
<IP_ADDRESS> dev eth0 lladdr 00:00:0c:9f:f0:04 ref 42 used 17/0/65 REACHABLE
*** Round 1, deleting 1 entries ***
<IP_ADDRESS> dev eth0 ref 42 used 0/0/0 INCOMPLETE
*** Round 2, deleting 1 entries ***
*** Flush is complete after 2 rounds ***
root@hostname# arp -s <IP_ADDRESS> 00:0c:29:c0:94:bf
? (<IP_ADDRESS>) at e0:db:55:ce:13:f1 [ether] on eth0
? (<IP_ADDRESS>) at 00:e0:b1:cb:07:30 [ether] on eth0
? (<IP_ADDRESS>) at 00:0c:29:c0:94:bf [ether] PERM on eth1
root@hostname# arp -d <IP_ADDRESS>
? (<IP_ADDRESS>) at e0:db:55:ce:13:f1 [ether] on eth0
? (<IP_ADDRESS>) at 00:e0:b1:cb:07:30 [ether] on eth0
? (<IP_ADDRESS>) at <incomplete> eth1
The impact of broadcast communication can be very heavy for large enterprise networks and can greatly reduce throughput.
ARP broadcast traffic decreases significantly once the ARP tables start to get populated.
By issuing fake ARP replies that tries to get the wrong association on the ARP tables, an attacker can capture traffic originally intended for another host on the network.
Mitigation for ARP poisoning includes:


This is an experimental feature to export your stored data in CSV format.
Note: file uploads are not exported


I owe no one apology, Zarika fumes
by ALEX ISABOKENAIROBI, Kenya, Nov 17 – Kenya’s Fatuma Zarika said she owes no one apology after surrendering the Boxing Council (WBC) World Super Bantamweight title to Mexican Mexican Yamileth Mercado in Chihuahua, Mexico on Sunday.
A fuming Zarika, who was dethroned the title she has held for the last four years, lost convincingly 99-91, 98-92, 99-91 to the Mexican, and the Kenyan who is fondly referred as the ‘Iron First’ seemed to blame government for not ‘taking care of her’.
“I want to tell my fans I owe no one an apology, I know what I have done and I will not apologise to anyone. When I was getting the belt I was alone, I have been with the belt for four years and there’s nothing good that has come my way except SportPesa,” an angered Zarika lamented after the bout.
“When SportPesa went away no one took care of me, the government don’t want to take care it’s rather the belt be in Mexico where it will be taken care of at-least their (Mexico) government take care of their sports people and support them. I am only the one who feels the pain and know the problems I go through,” Zarika added.
The win was a sweet revenge for Mercado who lost the fight to Zarika in 2018 September in Nairobi in a split-point decision, which was her second title defence after having beaten Zambian Catherine Phiri in 2017.
However, the 34-year-old Zarika, who pocketed Sh 6million from the fight, has a rematch against Mercado in 90 days as stipulated by the contract they signed before the bout.
Zarika now has 32 wins, 13 losses and two draws while Mercado, 21, now has 13 wins and two losses.
(Visited 20 times, 20 visits today)


The British School is an international, not-for-profit school located in the heart of New Delhi. The 56-year old school offers high quality education to expatriate and local families by drawing on the best facets of a rich and culturally diverse community.
Bay Port High School started their IB Programme in 2011 and offers 12 subject choices. Biology HL being the only Group 4 subject is one of the reasons why their teacher, Kari Matuszak loves collaborating with TBS.
Brockton High School is a safe, supportive environment that provides 4,300 students with the knowledge, skills, values and behaviors necessary to become responsible and productive members of a diverse society.
Ritsumeikan Uji High School provides a unique bi-lingual and bi-cultural environment where students can develop academically and personally through various experiences inside Japan and around the world.
‘The group 4 project is a collaborative activity where students from different group 4 subjects work together on a scientific or technological topic, allowing for concepts and perceptions from across the disciplines to be shared … to “develop an understanding of the relationships between scientific disciplines and their influence on other areas of knowledge.” The project can be practically or theoretically based. Collaboration between schools in different regions is encouraged’.
Diploma Programme Biology Guide
IBOWe're not around right now. But you can send us an email and we'll get back to you, as Soon as Possible.


Setup Instructions
1. Go to Extensions page then My Extensions . Under PoD Gear click Activate and then Set as Component X
2. Go to Twitch Dashboard and select PoD Gear from the dropdown list in the Extension Panel
3. Type in your Account name and click submit. You may need to refresh your browser to see the extension on stream.
Your latest character used will be shown automatically. Report feedback/bugs on the #website_portal channel of our discord.


Class: Proposition
http://purl.org/net/veracity/Proposition
Annotations (3)
-
comment "A proposition can be any piece of web content which is identiﬁed by a URI - akin to a resource or statement via reiﬁcation in Semantic Web terms. Therefore the granularity of a proposition can range from a single statement through to an entire web page." (en)
-
label "proposition" (en)
-
term_status "stable" ()
Superclasses (1)
Disjoints (1)
Usage (7)


Wallet
Direct Subclass:
Constructor Summary
| Public Constructor | ||
| public |
constructor(signingConfirmation: *) Base class for libsimba Wallet implementations |
Member Summary
| Public Members | ||
| public |
|
Method Summary
| Public Methods | ||
| public abstract |
|
|
| public abstract |
generateWallet(passkey: string): Promise |
|
| public abstract |
getAddress(): Promise<string> |
|
| public abstract |
unlockWallet(passkey: string): Promise |
|
| public abstract |
|
| Protected Methods | ||
| protected abstract |
|
Public Constructors
public constructor(signingConfirmation: *) source
Base class for libsimba Wallet implementations
Params:
| Name | Type | Attribute | Description |
| signingConfirmation | * | {function} - an optional callback for requesting user permission to sign a transaction. Should resolve a promise with true for accept, and false (or reject) for reject. |
Public Members
public signingConfirmation: * source
Public Methods
public abstract deleteWallet() source
public abstract generateWallet(passkey: string): Promise source
Params:
| Name | Type | Attribute | Description |
| passkey | string | The pass key to lock the wallet |
public abstract unlockWallet(passkey: string): Promise source
Params:
| Name | Type | Attribute | Description |
| passkey | string | The pass key to unlock the wallet |


| Shop name | Shop description | Established |
|---|---|---|
| {{ shop.name }} | {{ shop.description }} | {{ shop.creation_date }} |
| Player name | Player id |
|---|---|
| {{ player.name }} | {{ player.id }} |
| Shop name | Player name | Item name | Item amount | Timestamp |
|---|---|---|---|---|
| {{ transaction.shopname }} | {{ transaction.playername }} | {{ transaction.itemname }} | {{ transaction.amount }} | {{ transaction.timestamp }} |
| Shop name | Shop description | Established |
|---|---|---|
| {{ shop.name }} | {{ shop.description }} | {{ shop.creation_date }} |


{% extends 'base.html' %} {% block content %} {% block script %} {% endblock %}
1. Service to others is the rent you pay for your room here on earth.
2. If my mind can conceive it, and my heart can believe it—then I can achieve it
3. Don’t count the days; make the days count
4. It isn’t the mountains ahead to climb that wear you out; it’s the pebble in your shoe


blog
facebook
RSS
Project title: POSITIVE
Personalized platform assisting seniors in healthy, fulfilled and active life.


What is a HashTable?
HashTable is a data structure which stores data in an associative manner. HashTable is quite similar
to a dictionary (key-value structure), where each data that needs to be stored is given a specific
key, and the corresponding data can be accessed using that key. HashTable is therefore implemented
as an array, where the indices represent the key and the data stored at that index of the array
represents the value.
The only problem here is that an array can have maximum size is of order O(106).
So when number of data points are more than the maximum size of an array, collisions will occur,
i.e. more than one data points will have same key and can't be stored in the array.
To overcome the above problem, we make hashtable as an array of
linkedList. So when ever we encounter a collision,
we just append the data point into the linkedlist.
Ultimately hashtable is just a dictonary with capability to handle colission.
Hashing
As we discussed earlier, HashTable is an array of linkedlist where the index represents key. Question
is how is a key for given data point defined?
This is where hashing comes into picture. Hashing is a function or a method which takes in data and
returns a value which is got by doing some computation on that data. To make it more clear let me
give an example :
Integer Hashing
String Hashing
If data is an Integer, than the key is the data itself, i.e. if you want to find whether there is '2' in the hashtable all you need to do is check the linkedlist at index '2' (2 is the key as well as the value). Problem with this hashing algorithm is that for integer with value more than the order O(106) then you can't store it, hence we modify the hashing algorithm by returning integer modulo 'm' (integer%m) where 'm' is the size of the hashtable array. By adding this small change to the algo, it will always return key that is less than 'm'.
If data is a String, hashing algorithm can't be same as that of integer hashing algorithm as the string
can't be represented as index. Hence we need to come up with good hashing algorithm which has less probability
of collisions. The most prominent hashing algorithm used for strings is :
Given a string 'str' of size 'n', we form a polynomial of the form
h(x) = (str[0]) xn-1 + (str[1]) xn-2 +
(str[2]) xn-3 + ............ + (str[n-1])
h(x) = Σ( (str[i]) xn-1-i ) for : 0 ≤ i < n
and x Ε R
So for a given 'x', hash value of a string 'str' is defined like h(x) where str[i] is the ascii value of that
letter. For eg: if str="abc" and x=50, hash value of the string str will be:
h(50) = (97) 502 + (98) 501 + 99 = 247499
But even this hashing algorithm has the same problem that integer hashing algorithm faced. If the value of 'x' is big
or the length of the string is large, hash value of the string might become of an order more than
O(106), due to which we can't store it. Hence solution is similar to that of integer hashing,
we modify the hash algorithm by returning h(x) modulo 'm' (h(x)%m) where 'm' is the size of the hashtable. With
this, hash value of a string will never be more than 'm'(size of the hash table) and we can store the string in the
hashtable at the index given by hash function.
You might be thinking why are we making a polynomial and why did we chose this hash function over thousand others?
To answer this question, we first need to know how to choose a hash function. As we already discused, there is 100%
guarantee of getting a collisions if we need to store number of data points that more than the maximum size of an array.
So we need to choose a hash function such that, probability of having same hash value for two different data points
is negligible.
And to achieve that, converting the string into a polynomial is the most efficient solution. If there are two polynomials
F(x) = ( a0 + a1 x1 +
a2 x2 + ............ + an xn ) %m
G(x) = ( b0 + b1 x1 +
b2 x2 + ............ + bn xn ) %m
According to Polynomial Theorm :
Probability( F(xi) = G(xi) ) ≤ n/m, for x Ε [0 , m-1]
So according to this, if we choose a 'm' which is much greater as compared to 'n', probability could become negligible
if( m >>> n ) Probability ≅ O(negligible)
Therefore, we choose 'm' of order O(106) and Prime
Implementation
//HashTable is array of linked list
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
//int mode[10] = {65701,44701,32297,50821,88789,22621,61843,31513,62921,49081};
struct node
{
int data;
struct node *next;
};
// Prime number and size of hashtable
int m = 88789;
struct node *hashtable[88789];
int hashing_string(char *a,int i,int j,int x)
{
int p=0;
for(int k=i;k<j+i;k++)
p = (p*x + a[k])%m;
return p;
}
int hashing_int(long long int a)
{
return a%m;
}
//Here the 'head' is the hashtable[hash], where 'hash' is the hash-value of string or integer
void hash_insert(struct node **head,int key)
{
struct node *temp;
temp = malloc(sizeof(struct node));
temp->data = key;
if((*head)==NULL)
(*head) = temp;
else
{
temp->next = (*head);
(*head) = temp;
}
}
void deleteatmid(struct node *head,int key)
{
struct node *temp;
temp = malloc(sizeof(struct node));
for(int i=0;i<key;i++)
{
temp = head;
head = head->next;
}
temp->next = head->next;
}
int *rolling_hash(char *a,int k,int x)
{
int *rolling_hash_values = malloc(sizeof(int)*(strlen(a)-k+1));
int t = hashing_string(a,0,k,x);
rolling_hash_values[0] = t;
int h=1;
for(int i=1;i<k;i++) h = ( h%m * x%m)%m;
// Calculate hash value for next window of text: Remove leading digit, add trailing digit
for(int i=0;i<strlen(a)-k;i++){
t = (x*(t - a[i]*h) + a[i+k])%m;
// We might get negative value of t, converting it to positive
if (t < 0) t = (t + m);
// To confirm that if 't' is same as hashing_string(a,i+1,k,x) then uncomment the next line`
// printf("%d %d\n",t,hashing_string(a,i+1,k,x));
rolling_hash_values[i+1] = t;
}
return rolling_hash_values;
}
//ablity to handle conflicts
int main()
{
char string_array[] = "HashtableAndHashing";
int rollingHash_size = 4;
int x = 25;
int *hashed_values = rolling_hash(string_array,rollingHash_size,x);
int n = strlen(string_array)-rollingHash_size+1;
for(int i=0;i<n;i++) printf("%d ",hashed_values[i]);
printf("\n");
return 0;
}
Run On IDE


{% load staticfiles %}
Total: £{{ cart.total }}
Your list is currently empty
Empty list
The total doesn't include write-in or virtual shop items.
Add a custom 'write-in' item
Want something not in the aisles? Find it in our suppliers websites and add it to the Description & Code boxes below. Price will be confirmed on acknowledging the order.
Description
Code


The term “brandy” is derived from the Dutch word for “burnt wine,” brandiwijn. Simply put, brandy is wine that has been distilled into a spirit and then aged in barrels. But, with centuries of human toil beside the still, brandy is a many-splendored thing. Brandy might be a very special old spirit, aged for decades in a place called Cognac, in western, coastal France. It might be a clear spirit often made from Muscat grapes in Peru near a seaside town called Pisco. It might be a clear distillate, called “eau de vie” (that’s “water of life”, if you’ve been paying attention, or even if you haven’t), made from raspberries, pears or cherries produced in Central and Western Europe.
Additionally, in the U.S. and some other countries, the word brandy can be used to describe a low-proof, sweetened and flavored spirit, often based upon neutral grain spirit and artificial flavoring—for example, “cherry brandy” or “apricot brandy” (historically, these would have had a brandy base).
But for this module, we’ll focus on the good stuff. Moreover, we’ll break them all into two rough groups: unaged grape spirits and aged grape spirits. Unaged grape spirits include eaux-de-vie, grappa and marc (more about those below).
Aged grape spirits include the basic category we call brandy, referring to a distilled wine that has been aged in oak for a specified time, usually at least six months or longer. These matured kinds include cognac (an area in central western France), armagnac (Gascony is another area in southwestern France) and calvados. Calvados is yet another area in France (Normandy in the northwest), but this one doesn’t use grapes to make its wine; it uses apples with a few pears thrown in for good measure.
If you can ferment wine and boil it, you can make brandy, and perhaps some old-school grappas may remind some people of a drink that is that basic. But a smart distiller knows that the grapes or the juice from which a brandy is made has to be in great shape.
Grappa used to be hot, fiery stuff; we will admit that. But a few decades ago, a handful of smart distillers began producing high quality, delicious grappa, because they were careful with the grapes they used. In the past, grappa was something you distilled from “pomace,” which is the leftovers of winemaking. Most grappa distillers took grapes that had been dumped out of a fermenter after their juice had been made into wine, sprayed some water on them and threw the gooey mess—often with stems, seeds and all—into a still, usually after a couple of months of other sundry winery work. It’s not surprising that old-style grappa was coarse and weird.
But a dynamic group of innovative distillers—Jacopo Poli, Antonella Bocchino, and Benito and Giannola Nonino come to mind—studied every aspect of grappa production in the 1970s to see if they could improve grappa production. The most important innovation they introduced was to rush the grape skins into the still as soon as they were removed from the fermenter. This change of tactic makes all the difference in the world; it produces grappas that taste remarkable fresh.
And like skillful distillers the world over, they also carefully cut heads and tails, reserving the heart for bottling. The top grappas are expensive, it is true, but they are difficult and expensive to make correctly. This new generation of grappa producers has turned this once-ridiculed spirit into a world-class distillate category.
As mentioned above, pisco is a distillate made from grapes and made in Chile or Peru. Each country has its own set of grapes from which they ferment wine and then distill pisco, but Peru definitely has the historical lead and a heck of a lot more material (different kinds of grapes) from which to distill. Peruvians also prefer the pot still while the Chileans lean toward continuous-still distillation. Pisco is far smoother than most grappas, because it is almost always made from distilled wine, and not from distilled grape-pomace.
Marc is a French spirit, a kind of grappa or pomace brandy made from leftover grapes and grape skins, only this time it’s made in France, much of it in the Burgundy region. There are other names the French use; ratafia is a common grappa-like spirit made in the Champagne region.
Cognac is a wine based brandy, made from Ugni Blanc grapes (there are very few other grape types grown in Cognac), twice distilled only in pot stills (a.k.a. alembic Charentais) and aged in Limousin (French) oak barrels for a minimum of two years. Even more importantly, Cognac is a place, where all these grapes must be grown and where this brandy must be aged. Cognac’s six demarcated growing districts are, in order of importance, Grande Champagne, Petite Champagne, Borderies, Fins Bois, Bons Bois and Bois à Terroirs. The two Champagnes are renowned for their chalky/limestone soil and account for what are the two longest-lived types of cognac, brandies that are especially deep and flavorful.
The Ugni Blanc grape might be unfamiliar to you, but it’s Italy’s most widely grown grape, Trebbiano. It doesn’t have much flavor (try a Trebbiano from Italy and you’ll see what we mean) but it hangs on to its acidity and even after distillation can hang on to its fruit flavors. Indeed the chalky, limestone soils of the Cognac region are such that the brandies made from Cognac’s grapes continue to show fruitiness even after decades in bottle. Though there are lots of reasons why cognac can be truly great, the limestone soils are the chief reason that cognac ages so remarkably well.
Cognac, like many things having to do with the vine, can get really complicated when it comes to legal classifications. But remember that the main reason French wine (and cognac) has so many rules, regulations and titles is to make a consistent, trustworthy product and then to convince someone that it’s worth paying a lot of money for that. So a category of cognac such as XO, which stands for Extra Old, is controlled to the extent that customers around the world like to believe that any XO cognac they see is old and venerable. Sometimes it’s even true.
The categories of cognac are VS (Very Special) or Three Star (aged at least two years in French oak barrels); VSOP (Very Superior Old Pale) or Five Star (aged at least four years in French oak barrels); and XO (Extra Old), Napoleon, Extra and Hors d’Age. This latter group has been aged in French oak barrels for at least six years.
Isn’t it funny that they use English words (Very Special and the like) to name these very French brandies? Yeah, well, they know exactly to whom they are selling.
The balmy, rural and hilly Armagnac district (a.k.a. Gascogne) is southeast of Bordeaux. The Armagnaçais make their brandies differently than their peers in Cognac do, preferring to employ unique, hybrid two-column stills, some of which are attached to flatbeds and driven around the countryside by so-called “roving distillers.” Distillation range is from 52-72 percent alcohol by volume. Some smaller producers use pot stills only, while others use a combination of both styles of stills.
They mostly use the prolific-growing, thick-canopied Ugni Blanc grape variety, along with far lesser amounts of Folle Blanche, Colombard and Baco. And they have minimum aging requirements in French oak barrels (black oak from the Monlezun forest), just like they do in Cognac. However, there are both continuous and pot stills in use in Armagnac, and many armagnac bottlings can seem a bit more rustic (and some would say interesting) than run-of- the-mill cognac.
Some commercial armagnacs are made in similar fashion to cognac. Most are not, and these tend to be the more expensive versions. They can be a more herbal, a little citrusy and a lot less smooth than great cognac. But some people think smooth is boring.
As with cognac, Armagnac has minimum aging requirements: for them, VS (Very Special) or Three Star is aged at least two years in French oak barrels; VSOP (Very Superior Old Pale) or Five Star is aged at least five years in French oak barrels); and XO (Extra Old), Napoleon or Extra is aged at least six years in French oak. Hors d’Age Armagnac is a special category in Armagnac: it has slumbered in French oak barrels for at least ten years. As with cognac, the best producers exceed these minimum aging requirements by many years.
One last note: don’t be fooled by people who tell you that the oldest armagnac (or cognac, for that matter) is the best. It depends upon your taste, and frankly, it depends upon the brandy. Some brandies taste wonderful when they’ve slept for twelve or fifteen years in a barrel. Some need twenty years to come to the loveliest balance of the fruit in the spirit and the spice and confection that comes from the barrel and the aging. Others break down chemically with excessive barrel aging. Just because it’s expensive and old doesn’t automatically mean that it’s legendary.
Calvados, from northwest France, shares much of the same aging nomenclature: Fine, Three Star or Original Calvados must be aged in French oak casks for at least two years. Vieux or Réserve Calvados are aged in French oak casks for at least three years. Vieux Réserve, VO or VSOP Calvados are aged in French oak casks for at least four years. And the special categories of Hors d’Age, Extra, XO or Age Inconnu are aged in French oak casks for a minimum of six years.
While most brandies could come from anywhere that grapes are grown and wine is made, the top brandies such as cognac, armagnac and calvados don’t seem to be vulnerable to imitation. There seems to be something unique that each region brings to the brandy they make, and each region prizes certain sub-zones far above others, though each is a part of the protected names embodied in the words cognac, armagnac and calvados.
Cognac is divided into six sub-zones, called Bois à Terroirs, Bons Bois, Fins Bois, Borderies, Petite Champagne and Grand Champagne. Other than a small strip of land in the Fins Bois, the best cognacs are produced in the latter three regions, where the limestone is the oldest and the chalk content is the highest.
Most cognac labels won’t list any particular region, but some do, and perhaps it indicates that the producer is rather proud of that cognac and where the grapes used to make it were grown. Many believe that Borderies provides a fat and even nutty character to cognac, while the longest-lived cognacs are grown in Grande Champagne, where the soil with the greatest content of chalk is found. If a district is cited on the label, the brandy must be 100 percent from that district.
But most cognacs are blends, skillful combinations of both greater and lesser regions. There is also a category called Fine Champagne or Grande Fine Champagne, and it represents a blend of Petite Champagne and Grande Champagne cognacs, with a minimum of 50 percent of the spirit coming from Grande Champagne.
Armagnac has three demarcated production zones: Bas-Armagnac, which has clay and alluvial soils; Ténarèze, where the soil is a mix of clay and limestone; and Haut-Armagnac, which has more sand and limestone. Most people think the best armagnacs are grown in Bas-Armagnac because of their freshness and vivacity, but a lot of people love Ténarèze just as much because of their ability to mature for long periods.
Calvados hails from the northwestern portion of France in beautiful Normandy and Brittany. Grapes don’t grow well in this cooler, even colder, seaside landscape but apples and pears do. Indeed there are dozens of species of each, and many distillers believe that it’s the myriad of species that make it possible to create a great apple-based brandy in this place.
Again, they have broken the area into sub-zones, with Pays d’Auge considered the best area of Normandy and of Calvados’ demarcated areas. Pays d’Auge is an area that requires that the calvados there be distilled twice only in pot stills. The other two districts are Calvados AOC, the largest, all-encompassing region and the one with the least exciting brandies, and Calvados Domfrontais, where both apple and pear ciders (minimum of 30 percent pears) are distilled.
The Armagnaçais have gotten a raw deal. They preceded Cognac’s practice of distilling by a couple of centuries (probably the 1300s A.D.) and yet their sales represent a fraction of the sales of cognac worldwide. Sometimes being first isn’t good enough.
Armagnac is a rural, heavily agricultural, and isolated place, while Cognac was the part of France that was owned by England for five hundred years. During that time, the British took feverishly to cognac, the brandy. Their turn as a world-dominant, nineteenth century power (it wasn’t so long ago that the phrase “the sun never sets upon the British Empire” was rampant because that empire encompassed the globe) meant that they shared their enthusiasm for the spirit with everybody else.
Armagnac is the product of a part of France that has been, at times, Basque country. The Basque people are a fascinating breed. Some historians postulate that they are, in fact, a separate strain of human species. Regardless, the Basque regions of France and Spain have customarily been isolationist, if not actively hostile to outsiders for millennia.
Cognac, on the other hand, didn’t practice distilling until the late sixteenth century, but within forty or fifty years was widely acclaimed for its great brandies and, ever since, for its great brandy marketing. The Cognaçais were quick to protect the name (lots of countries created imitation products called “conyac” and the like) and even quicker to understand that they needed to create a worldwide image of exclusivity and excellence in order to build a long-term market. It would be hard to fault their work, since many linguists consider “cognac” to be the most recognized French word around the world.
Things went along swimmingly until the arrival of the vine-eating phylloxera louse into Europe’s vineyards in the 1860s. The North American bug destroyed nearly all of Europe’s grape vines by 1880 and the remedy (grafting American vine stock onto established European vines) was difficult, labor-intensive and expensive, taking years to achieve. Meanwhile, whisky and gin took hold. As Winston Churchill once said, “My father drank brandy and soda. I drink whisky and soda.” The impact upon the brandy regions of France was huge. They grafted over to American stock as soon as they could, but many vineyard owners never recovered.
They eventually recovered, even in the midst of world wars. While whisky sales remain the largest category of aged spirit sales, and vodka and soju (see glossary) remain the world’s largest spirit categories, nobody is starving in Cognac, at least not among the growers and distillers. Indeed, the running joke is that the rich folks and owners in Cognac all drive Mercedes and Jaguars. Everybody else has to make do with lowly BMWs or Peugeots.
Tasting Brandy Once you reach the pinnacle of brandies (great XO cognacs, armagnacs or calvados or even some Spanish and American brandies), everything becomes a bit more difficult to distinguish. But that’s a good thing. If spirits are so delicious and complex that you aren’t sure which one to love more, then you are a lucky taster indeed.
But let’s start with the basics: what makes armagnac, cognac and calvados taste different from each other? Cognac is usually smooth and refined, while armagnac is robust and assertive, and calvados is, well, apple-like and should be the easiest to identify. And what makes an XO cognac so expensive and a VS cognac so (relatively) cheap? The answer is the time spent in oak barrels, which costs the distiller more in tax and labor. Sensory evaluation-wise, it’s a lot easier to spot flavors when there are identifiable differences between each of the brandies in front of you.
It should be clean and dry. Not bitter and not sweet.


Iterates over a collection, passing the current element and the memo to the block. Handy for building up hashes or reducing collections down to one object. Examples:
%w(foo bar).each_with_object({}) { |str, hsh| hsh[str] = str.upcase } #=> {'foo' => 'FOO', 'bar' => 'BAR'}
Note that you can‘t use immutable objects like numbers, true or false as the memo. You would think the following returns 120, but since the memo is never changed, it does not.
(1..5).each_with_object(1) { |value, memo| memo *= value } # => 1
[ show source ]
# File vendor/rails/activesupport/lib/active_support/core_ext/enumerable.rb, line 79 79: def each_with_object(memo, &block) 80: returning memo do |m| 81: each do |element| 82: block.call(element, m) 83: end 84: end 85: end
Collect an enumerable into sets, grouped by the result of a block. Useful, for example, for grouping records by date.
Example:
latest_transcripts.group_by(&:day).each do |day, transcripts| p "#{day} -> #{transcripts.map(&:class).join(', ')}" end "2006-03-01 -> Transcript" "2006-02-28 -> Transcript" "2006-02-27 -> Transcript, Transcript" "2006-02-26 -> Transcript, Transcript" "2006-02-25 -> Transcript" "2006-02-24 -> Transcript, Transcript" "2006-02-23 -> Transcript"
[ show source ]
# File vendor/rails/activesupport/lib/active_support/core_ext/enumerable.rb, line 22 22: def group_by 23: assoc = ActiveSupport::OrderedHash.new 24: 25: each do |element| 26: key = yield(element) 27: 28: if assoc.has_key?(key) 29: assoc[key] << element 30: else 31: assoc[key] = [element] 32: end 33: end 34: 35: assoc 36: end
Convert an enumerable to a hash. Examples:
people.index_by(&:login) => { "nextangle" => <Person ...>, "chade-" => <Person ...>, ...} people.index_by { |person| "#{person.first_name} #{person.last_name}" } => { "Chade- Fowlersburg-e" => <Person ...>, "David Heinemeier Hansson" => <Person ...>, ...}
[ show source ]
# File vendor/rails/activesupport/lib/active_support/core_ext/enumerable.rb, line 94 94: def index_by 95: inject({}) do |accum, elem| 96: accum[yield(elem)] = elem 97: accum 98: end 99: end
Returns true if the collection has more than 1 element. Functionally equivalent to collection.size > 1. Works with a block too ala any?, so people.many? { |p| p.age > 26 } # => returns true if more than 1 person is over 26.
[ show source ]
# File vendor/rails/activesupport/lib/active_support/core_ext/enumerable.rb, line 103 103: def many?(&block) 104: size = block_given? ? select(&block).size : self.size 105: size > 1 106: end
Returns true if none of the elements match the given block.
success = responses.none? {|r| r.status / 100 == 5 }
This is a builtin method in Ruby 1.8.7 and later.
[ show source ]
# File vendor/rails/activesupport/lib/active_support/core_ext/enumerable.rb, line 113 113: def none?(&block) 114: !any?(&block) 115: end
Calculates a sum from the elements. Examples:
payments.sum { |p| p.price * p.tax_rate } payments.sum(&:price)
The latter is a shortcut for:
payments.inject { |sum, p| sum + p.price }
It can also calculate the sum without the use of a block.
[5, 15, 10].sum # => 30 ["foo", "bar"].sum # => "foobar" [[1, 2], [3, 1, 5]].sum => [1, 2, 3, 1, 5]
The default sum of an empty list is zero. You can override this default:
[].sum(Payment.new(0)) { |i| i.amount } # => Payment.new(0)
[ show source ]
# File vendor/rails/activesupport/lib/active_support/core_ext/enumerable.rb, line 57 57: def sum(identity = 0, &block) 58: return identity unless size > 0 59: 60: if block_given? 61: map(&block).sum 62: else 63: inject { |sum, element| sum + element } 64: end 65: end