---
title: "Assignment 2 - Tor Jensen, Margaret Köhn, Timo Klingler and Janette Wiget"
output: html_document
---

```{r, include = FALSE}
#loading the required packages for the report and set options
require("rvest")
require("xml2")
require("readr")
require("stringr")
require("ggplot2")
require("ggthemes")
require("scales")
require("viridis")
require("raster")
require("sp")
require("splitstackshape")
require("dplyr")
options(scipen=999)
```

The following data analyis is based on data from the website "I paid a pribe" [link](http://www.ipaidabribe.com) and addresses the topic of corruption. Especially in the developing countries, as india in our case, we can observe a high density of corruption. Corruption has many dimensions which are all related to political, economic, social and environmental effects. All the effects have a serious impact on the individual community and country. This is why it is essential to take the aspect of corruption into account when analysing a certain economy. Our data analysis will provide general information about the occurrence of corruption in india and will give an overview regarding its distrubtion along certain subsets:

  * Dataset about the last 1000 reports
      + Scraping data from web
      + Data cleaning
  * Data analysis
      + Basic summary of dataset
      + Records per day
      + Relationship between views and amount
      + Getting the right understanding of the numbers
      + GDP per Capita and Amount of bribes paid
      + Total Amount of Bribe: Geographical plot

---

## Creating the dataset about the last 1000 reports

```{r, eval = FALSE}
# Creating a dataset by scraping data from the "I Paid a Bribe"" website, linking to pre-scraped dataset below this block

# General considerations about the layout of the website:
# Data about the bribe; time, place, amount, category, etc. is available from the main search page.
# The full text describing the event is only available from the link itself.
# Can get most of the data from the main "search", without having to go through every link that has been pulled

## Initialize dataframe with the desired data columns
df <- data_frame(title = character(),
                 amount = character(),
                 dep = character(),
                 trans = character(),
                 views = character(),
                 city = character(),
                 date = character(),
                 time = character())

## initialize empty dataframe for
dftemp <- data_frame()

## Scrape data from "I paid a bribe" website

for (i in 0:99) { #loop through first 100 pages, 10 results per page = 1000
  link <- paste("http://www.ipaidabribe.com/reports/paid?page=",i*10, sep = "") # Create hyperlink based on loop function
  print(paste("processing", i, sep = " ")) # progress report
  main <- read_html(link, encoding = "UTF-8") # define the static part of link references

  title <- main %>%
    html_nodes(".heading-3 a") %>%
    html_text()

  amount <- main %>% # feed `main.page` to the next step
    html_nodes(".paid-amount span") %>% # get the CSS nodes
    html_text() # extract the link text

  dep <- main %>% # feed `main.page` to the next step
    html_nodes(".name a") %>% # get the CSS nodes
    html_text() # extract the link text

  trans <- main %>% # feed `main.page` to the next step
    html_nodes(".transaction a") %>% # get the CSS nodes
    html_text() # extract the link text

  views <- main %>% # feed `main.page` to the next step
    html_nodes(".overview .views") %>% # get the CSS nodes
    html_text() # extract the link text

  city <- main %>% # feed `main.page` to the next step
    html_nodes(".location") %>% # get the CSS nodes
    html_text() # extract the link text

  date <- main %>% # feed `main.page` to the next step
    html_nodes(".date") %>% # get the CSS nodes
    html_text() # extract the link text

  time <- main %>% # feed `main.page` to the next step
    html_nodes(".time-span") %>% # get the CSS nodes
    html_text() # extract the link text

  dftemp <- cbind(title, amount, dep, trans, views, city, date, time) # bind the variables together into a 10 by n dataframe
  df <- rbind(df,dftemp) # rbind the temp dataframe for this page to the main dataframe

  Sys.sleep(1) # timer, wait 1 second
  cat(" done!\n") #progress report
}

#clean unused variables from workspace
rm("title", "amount", "dep", "trans", "views", "city", "date", "time", "dftemp", "i")

## Split the city column into a city and state column

df$states <- lapply(strsplit(as.character(df$city), "\\,"), "[", 2)
df$city <- lapply(strsplit(as.character(df$city), "\\,"), "[", 1)
```

```{r, eval = FALSE, echo = FALSE}
## Clean and order dataset, force correct data types, factors for faceting and checking number of levels
clean <- function(df) {
df$title <- df$title %>% # clean text
  str_replace_all(pattern = "\\n" , replacement = " ") %>%
  str_trim()

df$dep <- df$dep %>%
  as.factor() # convert to factor

df$trans <- df$trans %>%
  as.factor() # convert to factor

df$amount <- df$amount %>% # clean text from amount and convert to numeric
  str_replace_all(pattern = "Paid INR" , replacement = " ") %>%
  str_replace_all(pattern = "," , replacement = "") %>%
  str_trim() %>%
  as.numeric()

df$views <- df$views %>% # clean text from views and convert to numeric
  str_replace_all(pattern = "views" , replacement = " ") %>%
  str_trim() %>%
  as.numeric()

df$city <- df$city %>% # clean text from city
  as.character() %>%
  str_trim() %>%
  as.factor() # conver tot factor

df$states <- df$states %>% # clean text from states
  as.character(df$states) %>%
  str_trim() %>%
  as.factor() # convert to factor

df$time <- as.numeric(str_extract(df$time,"[0-9]*"))*!grepl("minutes|hours",df$time) # clean hours and minutes out of time stamp and change to whole number of days

df$date <- as.Date(df$date, format("%B %d, %Y")) # convert the date column to date format

df <- df[, c(1,2,3,4,5,6,9,7,8)] # rearrange columns

return (df)

}

df <- clean(df)
```

After we have applied string manipulation and other data cleaning methods we are able to have a first look at the values by ordering the number in a descening and ascending order. First, we observe one single value that is incredibly high. The following amount of money is equivalent to 113 million euros and this "only" for a birth certificate. This value falsify our analyis and could therefore be removed also because of its high likelness of being an unlikely entry. Second, the head function reveals quite a few instances of Rs 1. This is not necessarily wrong but considering the fact that 1 Rs is 1.4 eurocent this is extremely unlikely. On the contrary we can argue that given the relative poverty these results could still be reasonable. In this case we can't really argue for setting a minimum threshold for bribes.

```{r, eval = FALSE, include = FALSE}
# futher Data cleaning

## look at headers and footers for obvious outliers in bribe size

### sorted in descending value
df %>%
  arrange(desc(amount)) %>%
  head(5)

### sorted in ascending order
df %>%
  arrange(desc(desc(amount))) %>%
  head(5)

## look for missing values in the character variables (title, dep, trans, city, state)
dfmissing <- df %>% filter(title == "" | dep == "" | trans == "" | city == "" | states == "") %>% head(5)
# only a single entry with no data

## count number of rows with NA values
narows <- nrow(df[!complete.cases(df),])
# total number is 0, no need to filter out NA values

## test for misassigned values in either
duplicate <- match(df$city,df$states)
duplicate2 <- match(df$states,df$city)
dupcheck <- df[!is.na(duplicate),]
dupcheck2 <- df[!is.na(duplicate2),]
# 3 values come up, city name is capital name, chandigarh is a state and an area so no problem

## filter based on the above criteria
df <- df %>%
  filter(dep != "", amount < max(amount))  # Remove entry with missing data and remove the

## remove unwanted variables again used
rm("dfmissing", "narows", "duplicate", "duplicate2", "dupcheck", "dupcheck2")

```

```{r}
# Import the common csv file from github to work on, at end of project remove this reference, lines to be removed marked with [X]

df_raw <- read_csv("https://raw.githubusercontent.com/TorJensen/Assignment-2/master/df.csv") # read csv file from github [X]
df_raw <- df_raw[,2:10] # remove the rownames column - [X]

df <- df_raw # define df
rm(df_raw) # remove df_raw from the environment
```

---

## Basic summary of dataset

```{r, echo = FALSE}
df <- df %>%
  filter(dep != "", amount < max(amount))

# exploratory data analysis

summary(df)
```

The basic summary shows large differences between the mean and median amounts and the third quartile. The mean difference indicates that a relatively small amount of large bribes are pulling up the mean, while the vast majority of bribes reported are relatively small. Almost half of the bribes are reported from Bangalore, and about 2/3rds of the bribes are recorded within the top 5 departments. The reporting period ends on the 12th of October, so we only have 1 month worth of data, which limits the time/weekeday/seasonality analsysis options available.

Having a clooser look at the distribution of bribes submitted per day, we can see that the majority of information in our dataset was submitted on one single day last month (see below). This is definitely an outlier compared to the other days wher we count about 10-30 reports in average per day. Having a look at the datasets' other variables assigned to that specific day, it seems like that all the other values of the varibles didn't show any significant variances and thus can be said that the bribes on that day are reasonably well-distributed across states and departments. The most possible explanation connected to this observation is probably the fact of an excisting barrage of spam / incorrect reports.

```{r, echo = FALSE}
# plot showing amount of records per day
p <- ggplot(df %>% group_by(date) %>% summarise(count = n()),aes(date, count))
p + geom_bar(stat = "identity") +
  labs(x="Date", y="Count", title="Records per day") +
  theme(plot.title = element_text(lineheight=.8, face="bold", vjust=1))
```

Although the chance that we are dealing with an error source here is quite likely, a quick google news search for october reveals that an article was posted in Times of India on the 11th of October, which could still be a possible explanation for the sudden spike or at least for a part of it [link](http://timesofindia.indiatimes.com/city/chennai/Chennai-corporation-takes-no-action-on-corruption/articleshow/49316078.cms). The article is not only reporting on corruption, but also is directly refering on the "I paid a bribe" website as the have gathered information from the webpage.

```{r, echo = FALSE}
# narrow down the dataset to entries made on October 12
df_lump <- df %>%
  filter(date == min(date)) # filter the data based on the earliest day in the dataset

summary(df_lump) # show summary data
```

Accoring to the previous summary there doesn't seem to be any significant relation. We can only observe few outliers which are for medium-sized amounts. Consequently, we can assume that the outlier status seems to be driven by other things than size in general. (WHAT DO WE WANT TO SAY WITH THAT?)

---

## Relationship between views and amount paid

Building on the previous discussion, another possible relation to have a further look at is the amount of views compared to the amount of money paid. As shown in the graph below, it is difficult to argue for a strong relation between those two factors.

```{r, echo = FALSE}
# looking at the relation between views and amount of data - do higher value bribe reports attract more attention?
p2 <- ggplot(df,aes(views, log(amount)))
p2 + geom_point(alpha = 0.4) + # lower alpha (transparency) to be able to identify clusters of data
  labs(x="Views", y="log(Amount)", title="Relationship Between Views and Amount of Data") +
  theme(plot.title = element_text(lineheight=.8, face="bold", vjust=1))
```

---

## Getting the right perspective about the numbers

There are 27 states and 17 departments (with 40 transaction types) in the 1000 records we have mined, so an analysis looking at transaction type level by state, for example, would need more than 1000 data points in order to be able to get a reasonable analysis (assuming some degree of normality.) Instead we decided to focus on higher level summaries, specific departments or specific states.

```{r, echo = FALSE}
levelcount <- lapply(df,levels) %>% summary
levelcount
```

In the gathered data we can see that most bribes are paid to the department of Municipal Services, especially for issuing a birth certification. Facing this situation, we wanted to find out if there are any reasons for the high rate of corruption in this sector. Apart from the fact that the Indian citizens mostly have to pay bribes for every service they ask for, the high birth rate in India is probably the main reason for this circumstance. The more urgent the need for a document, the higher the amount the people have to pay for a certain service. Furthermore, we have aggregated the amounts of bribes paid per department. The resulting visualisations are showing us that there is not just a wide selection of corruption in the sector of Municipal Services, but also generate these public authorities by far the highest amount of money. Relating to the high birth rate in India, as mentioned above, it is probably the easiest and most common way to be bribed. Due to the complicated tax and licensing systems and corrupt police system, the bribe payments in the departments of “Income Tax” and “Police” belong to the highest in India.

```{r, echo = FALSE}
# Number of bribes and their sizes, by variables in various combinations, these can be called throughout the text:

### below are some tables looking at the...

#...department
df_dep <- df %>%
  group_by(dep) %>%
  summarise(count = n(), amount = sum(amount))%>%
  mutate(avgamount = round(amount/count)) %>%
  arrange(desc(avgamount))

#...state
df_state <- df %>%
  group_by(states) %>%
  summarise(count = n(), amount = sum(amount))%>%
  mutate(avgamount = round(amount/count)) %>%
  arrange(desc(count))

#...department and transaction type
df_deptrans <- df %>%
  group_by(dep,trans) %>%
  summarise(count = n(), sum = sum(amount))%>%
  mutate(avgamount = round(sum/count)) %>%
  select(dep, trans, count, avgamount)

df_deptrans[with(df_deptrans, order(desc(count))),]
#...state and city
df_statecity <- df %>%
  group_by(states, city) %>%
  summarise(count = n(), sum = sum(amount)) %>%
  mutate(avgamount = round(sum/count))

#...state and department, the thougth was that some departments could be more corrupt in some areas compared to others, hard to tell with so few data for so many sates.
df_statedep <- df %>%
  group_by(states, dep) %>%
  summarise(count = n(), sum = sum(amount)) %>%
  mutate(avgamount = round(sum/count)) %>%
  arrange(desc(count))

#...number of views by state, are some states viewed more frequently, do states with lots of reports have more views, do states with a higher value of bribes have more views
df_stateviews <- df %>%
  group_by(states) %>%
  summarise(count = n(), views = sum(views), amount = sum(amount)) %>%
  mutate(avgviews = round(views/count), avgamount = round(amount/count))

#...number of views by department, are some departments viewed more frequently, do departments with lots of reports have more views, do departments with higher bribe value have more views.
df_depviews <- df %>%
  group_by(dep) %>%
  summarise(count = n(), views = sum(views), amount = sum(amount)) %>%
  mutate(avgviews = round(views/count), avgamount = round(amount/count))

#Does number of views level out with time?
df_viewsdate <- df %>%
  group_by(date) %>%
  summarise(count = n(), views = sum(views)) %>%
  mutate(avgviews = round(views/count))

head(df_deptrans[with(df_deptrans, order(desc(count))),],5)
head(df_deptrans[with(df_deptrans, order(desc(avgamount))),],5)
```

We can observe that the most pervasive bribes aren't necessarily the largest one. Although this isn't very suprising, these graphs and tables emphasize the risk that you possibly have to face corruption everywhere you go and  in every interaction the state is involved. Ration cards are especially important as they are necessary to benefit from the fuel subsidies the indian government gives, and to access the public food distribution systems. For the less frequent but higher value amounts, it is striking that the issuing of [new PAN cards](http://www.indiacgny.org/pdf/pan_faq.pdf), which are not just used to pay taxes, but also as proof of identity and are necessary to enter most financial transactions, are either bought on false from corrupt officials, or those officials extort people who need it.

The graphs below display the top 5 departments ordered by the number of bribes reported and the transactions with the highest amounts in average.

```{r, echo = FALSE}

### Bribes per department

bribe_dep <- aggregate(amount ~ dep, df, sum)
bribe_dep$dep <- as.character(bribe_dep$dep)

bribe_dep[which(with(bribe_dep, dep == "Municipal Services")), c(1)] <- "Mun. Services"
bribe_dep[which(with(bribe_dep, dep == "Food, Civil Supplies and Consumer Affairs")), c(1)] <- "Food/Civil Supplies"
bribe_dep[which(with(bribe_dep, dep == "Stamps and Registration")), c(1)] <- "Stamps and Reg."
bribe_dep[which(with(bribe_dep, dep == "Commercial Tax, Sales Tax, VAT")), c(1)] <- "Com./Sales/VAT"
bribe_dep[which(with(bribe_dep, dep == "Customs, Excise and Service Tax")), c(1)] <- "Cust./Ex./Serv"

bribe_dep <- bribe_dep %>% filter(dep != "") %>% arrange(desc(amount))

bribe_dep$dep <- as.factor(bribe_dep$dep)

bribe_dep$dep <- factor(bribe_dep$dep,levels(bribe_dep$dep)[c(8, 6, 11, 15, 2, 9, 16, 5, 3, 10, 14, 13, 4, 7, 17, 1, 12)])

p3 = ggplot(bribe_dep, aes(x = dep, y = amount, fill = dep))
p3 + geom_bar(stat="identity") +
  theme_tufte() +
  scale_y_continuous(labels=comma) +
  labs(x="", y="Amount", title="Bribe Amount per Department") +
  theme(axis.text.x = element_blank(),
        legend.position = "none",
        plot.title = element_text(lineheight=.8, face="bold", vjust=1)) +
  facet_wrap(~ dep, scales = "free_x") +
  scale_fill_viridis(discrete = TRUE)
```

---

## GDP per Capita and the amount of bribes paid

The following code lines and its resulting graph are questioning the relation between the GDP per capita of each state and the average amount of money paid per bribe in a certain state. In order to get the needed information, the data from our dataset is complemented by tables scraped from two different wikipedia sources.

```{r, echo = FALSE}
# Bribe amounts
bribe_sta <- aggregate(amount ~ states, df, sum)
bribe_n <- df %>% group_by(states) %>% count(states) # create column with number of bribes per state
bribe_sta$n <- bribe_n$n # add column with number of bribes per state to amount of bribes per state
bribe_sta <- bribe_sta[-c(9),] # remove Hardoi
bribe_sta[which(with(bribe_sta, states == "Orissa")), c(1)] = "Odisha" #rename columns

# Download India GDP data

ind.gdp = read_html("https://en.wikipedia.org/wiki/List_of_Indian_states_by_GDP") %>%
  html_nodes(xpath = '//*[@id="mw-content-text"]/table[2]') %>%
  html_table() %>% data.frame # then convert the HTML table into a data frame

names(ind.gdp) <- c("states", "co_ru")

ind.gdp$co_ru = as.numeric(gsub("," , "" , ind.gdp$co_ru)) # remove commas from indian number notation
ind.gdp = ind.gdp %>% mutate(gdp = co_ru * 10000000) %>% as.data.frame() %>% select(states, gdp)# 1 crore is 10 million, convert to unit measure and stick it in a new dataframe
ind.gdp[which(with(ind.gdp, states == "Chattisgarh")), c(1)] = "Chhattisgarh"
ind.gdp[which(with(ind.gdp, states == "Jammu & Kashmir")), c(1)] = "Jammu and Kashmir"
ind.gdp[which(with(ind.gdp, states == "Andaman & Nicobar Islands")), c(1)] = "Andaman and Nicobar Islands"

# Download India population data

ind.pop = read_html("https://en.wikipedia.org/wiki/List_of_states_and_union_territories_of_India_by_population") %>%
  html_nodes(xpath = '//*[@id="mw-content-text"]/table[2]') %>%
  html_table() %>% data.frame %>% select(State.or.union.territory, Population..2011.Census..12.....of.Population.of.India..13.)

names(ind.pop) <- c("states", "population")

ind.pop <- ind.pop[-c(37), ] # remove rows 37, India, from population
ind.pop[which(with(ind.pop, states == "Manipurβ")), c(1)] = "Manipur"
ind.pop$population <-  str_extract(ind.pop$population, "(?<=\\d{19}...)[0-9,]*") %>% str_replace_all(",","") %>% as.numeric()

# Combine bribe_sta, ind.gdp and ind.pop

ind.df <- rbind(bribe_sta, data.frame(states = setdiff(ind.pop$states, bribe_sta$states), amount = rep(0,10), n = rep(0, 10)))

ind.gdp <- rbind(ind.gdp, data.frame(states = setdiff(ind.df$states, ind.gdp$states), gdp = rep(0,3)))

ind.df <- left_join(ind.df, ind.gdp, by = c("states" = "states"))
ind.df <- left_join(ind.df, ind.pop, by = c("states" = "states"))
ind.df <- mutate(ind.df, gdp_cap = gdp/as.numeric(population)) #create new colun with gdp per capita
ind.df <- mutate(ind.df, m_per_b = amount/n)

# Remove NA values from dataset

rm.nan <- function(x)
do.call(cbind, lapply(x, is.nan))

ind.df[rm.nan(ind.df)] <- 0
```

The resulting graph from above is raising the question whether states with a higher GDP per capita have a higher/lower frequency of people paying bribes. The question relating to a general relationship between those to factors can best be examined by the performance of a regression analysis.
According to the regression plot there does not seem to be a strong relaton between GDP per Capita and the average amount of money spent. Nevertheless, it can be argued that there is a slight tendancy of moving towards the fact that states with a higher GDP per Capita come along with a higher amount paid per bribe than average. Which would obviously also make sense as those people have more ressources to spend.

```{r, echo = FALSE}
p4 <- ggplot(ind.df, aes(gdp_cap, log(m_per_b)))
p4 + geom_point() +
  labs(x="GDP per Capita", y="log(Amount per Bribe)", title="GDP/Capita and Amount of Bribes Paid") +
  theme(plot.title = element_text(lineheight=.8, face="bold", vjust=1))
```

In the last part of our data analysis we have created a map of India showing the total amount of bribes by each state. The resulting map illustrates, that the highest number of bribes can be observed in the Southern part of India, particularly in Kerala, Tamil Nadu, Karnataka. Jammu and Kashmir has also an high amount of bribes. In conclusion, we can say that the bribes are more concentrated in the North and South of India, near the borders to Pakistan and the Indian Ocean. Here we have a total amount of bribes paid of about 2,000,000.  In the inside of the country the level of bribes paid decreases in comparison to the external states. One reason for this circumstance could be the high number of citizens in these regions compared to the other states in India. We could also speculate about the question whether people have less internet access in the inner states of the countries or whether their level of education is lower so that they simply don't have the knowledge about the website we're taking the data from.

```{r, message = FALSE, echo = FALSE}

## Visualize bribe/state

ind.map <- getData("GADM", country="IND", level=1)

bribe_s <- select(bribe_sta, states, amount)

am.count <- rbind(bribe_s, data.frame(states = setdiff(ind.map$NAME_1, bribe_s$states), amount = rep(0, 12)))

am.count <- am.count[-c(38),]
am.count <- am.count[- grep("Andaman and Nicobar", am.count$states),]

am.count[which(with(am.count, states == "Uttarakhand")), c(1)] <- "Uttaranchal"

am.count <- am.count[order(am.count$states, decreasing = FALSE),]

ind.map <- fortify(ind.map)

am.count$index <- as.numeric(tapply(ind.map$id, ind.map$id, length))
am.count <- data.frame(amount = am.count$amount, index = am.count$index)

am.count <- expandRows(am.count, "index")

ind.map$count <- am.count$amount

p5 <- ggplot() +
  geom_polygon(data = ind.map, aes(x=long, y=lat, group=group, fill = count), colour = "black") +
  scale_fill_gradient("Bribes paid \nby state ", low="yellow",high="red", breaks = c(0, 1e+06, 2e+06, 3e+06, 4e+06),
                      labels=c("0", "1M", "2M", "3M", "4M")) +
  labs(x="", y="", title="Total Amount of Bribes by State") +
  theme(axis.ticks.y = element_blank(),axis.text.y = element_blank(),
        axis.ticks.x = element_blank(),axis.text.x = element_blank(),
        plot.title = element_text(lineheight=.8, face="bold", vjust=1))
p5


If you see more ways in which the template can be standardized, please do point this out. The subparagraphs option was added to prevent possible clashes with tables.

Most users simply want a professional-looking PDF without fiddling with any options, and I would suggest that the default behaviour of LaTeX best achieves this. Adding coloured links to a document will also force colour copiers out of black-and-white mode, which makes it slower to print; and they come out quite faint if printed in greyscale.

We discussed the option of enabling `colorlinks` only if `citecolor`, `urlcolor`, `linkcolor`, or `toccolor` are set by the user, which would simplify the template, but require adding code to the LaTeX writer. Still, this would alleviate your concern about forcing users to look up colour names.


Oh we'll have to abstract out the pattern from https://github.com/brownplt/pyret-lang/commit/fd278b1db4782dc6b1e807cdd77a24c94b9539f8#diff-513890bc2bd618b462d3b814b861e024R2847 so we get the right behavior.


this commit closes #3 #6 and #7


Better link: https://github.com/brownplt/pyret-lang/blob/master/src/js/base/runtime-anf.js#L2844


I got a question about rawhid (searched a smaller commit to comment on):

Why does the descriptor needs to describe the IN and OUT report size? The host can send/receive and kind of data packets and (at least on avr) the packets are somehow mangled in USB_EP_SIZE packets. Is this just the former way to use it? I have no idea whats the sense of the RawHID descriptor, or how to set those values.

In your test program (which is outdated, we both know) is a bug. If you code the rawhid properly you can differenciate between IN, OUT and FEATURE reports. If you do not use a separate endpoint for the OUT report (like on teensy) you need to specify the type. https://github.com/NicoHood/Arduino/commit/9b66f5d348c33846de431b961226505c090114e2

If you still care to fix it, feel free to do (havent tested on windows at all)
https://github.com/NicoHood/HID/commit/425db99664e4b8660f6f6935c9f17dcb52709d15


That works, but the whole idea of a function is so you don't have to repeat code. Right now you are repeating a series of if statements. You can just pass in the value through the function.

```javascript
function checkResult(e) {
  var computer = blahblahblah // some magic to get the computers rock paper or scissor
  // if you recall the $(e.currentTarget).data("something"), you can get the rock, paper or scissor option here.
  // now you can write your if statements
}
```


I'm not sure what exactly you mean by this comment, but I just updated the PR to include a blue line for fleet fuel range, yellow line for flagship fuel range, and red line for beyond flagship fuel range


@sjaakd, does it work if you revert the surefire version back to 2.18.1?


Is Solr running ok? Any errors? Did it build OK too?


So modify it and make it search near the vehicle.

On 8 November 2015 at 16:57, Daniel Stuart <notifications@github.com> wrote:

> great, but isn't it better to search units near the vehicle instead
> player? Because we don't need a too large radius for a kart, but we do need
> it for a tempest.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/TAWTonic/Altis-Life/commit/022cf6c018a7c4e57c5401e946c547994d679cc2#commitcomment-14263804>
> .
>

--
Sincerely,

Colin


How do you know your plugin spec isn't implemented in emulators on any ILP64 systems?
On such systems, **int is a 64-bit type, NOT a int32_t**.

Maybe you think you're adding backwards compatibility.  It's quite the opposite.  Use `int`.


maybe just add an ALL_STATUS constant


This looks like it should be three commits: One for whitespace, one for using some of the extracted functions, and one for adding the test. Please at least separate the whitespace changes into their own commit and change the commit message on this to include describing the functional changes in cash-flow.scm.


Go neovim! 🙏🏼


:+1: You could use an object for snakes and ladders as well.

```ruby
var snakes = {
                          "3": "22",
                            etc.
                       }
snakes["3"]
```


You got it!


Or, if `startTimer` returns a value and `endTimer` consumes the starting time, then we can use these functions as well!


hmmmm ... you may wanna add it back since https://github.com/Thomas-Tsai/partclone/commit/b95db70d79354b426c434f828a7ed199a3fe9c4a


:tada:


123 la la la


@scottellis will you check if this is still necessary in Jethro? And when it is, use this commit instead:
https://github.com/victronenergy/meta-victronenergy/commit/fdb81e75f9cd426ba5cd0644928ea6b9fceef760


1234 yyy ooo wow !


This file is now complete, until Bootstrap 4 is released - if it is released by the middle of February 2016, we might consider trialling V4 in Minion.


+++ Andrew Dunning [Nov 08 15 10:18 ]:
>   Most users simply want a professional-looking PDF without fiddling with
>   any options, and I would suggest that the default behaviour of LaTeX
>   best achieves this. Adding coloured links to a document will also force
>   colour copiers out of black-and-white mode, which makes it slower to
>   print; and they come out quite faint if printed in greyscale.

I agree that this is a good reason to make black the default.

I hadn't considered the possibility that the main text color
might be something else.  That is undoubtedly rare.  Perhaps
instead of hard-coding black we could just go with hyperref
defaults, i.e. not set citecolor at all unless a value is
given?  If this requires setting a `colorlinks` variable in
the LaTeX writer if `citecolor`, `urlcolor`, `linkcolor`,
or `toccolor` is set, that's not a difficult change to make.

>   We discussed the option of enabling colorlinks only if citecolor,
>   urlcolor, linkcolor, or toccolor are set by the user, which would
>   simplify the template, but require adding code to the LaTeX writer.
>   Still, this would alleviate your concern about forcing users to look up
>   colour names.


I have copied the text from abbereviation-mark.txt after this commit, they works well for me, especially in Notepad and LibreOffice 5.0.3.


Saying "dammit" doesn't mean someone translates something wrongly but (s)he should  do it by him(her)self if the translation is late.


no, i didn't do any runtime tests on ccgx (yet). And am now happy to leave that to you or @scottellis


This would work, but you are missing a `}` on the last line.


I would suggest having the list look like this:

static const char *uiscale_names[] = {
		"auto",
		"1x",
		"2x",
		"3x",
		"4x",
		"5x",
		"custom",
		0
	};


If you're aiming at a pristine LaTeX document, then why not leave the big red frames around links? Again, this removes the difficulty with hardcoding "black" while still allowing for greyscale printing by default. (If you don't like these frames, then enabling hidelinks by default is what you're looking for)

But I don't think most users want no colours for links. What's the proportion of PDF made with Pandoc/LateX that are actually printed these days?

I'm okay with making choices and making changes in pandoc templates, but this one commit in my opinon doesn't do a good job for most use case and only leads to making writers set more options.

To conclude, I suggest either:

```
             colorlinks=$if(colorlinks)$true$else$false$endif$,
             citecolor=$if(citecolor)$$citecolor$$else$blue$endif$,
             urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
             linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
             pdfborder={0 0 0}}
```

or

```
             colorlinks=true,
             citecolor=$if(citecolor)$$citecolor$$else$blue$endif$,
             urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
             linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
             pdfborder={0 0 0}$if(nohidelinks)$$else$,
             hidelinks$endif$}
```

or simply reverting this commit and have colours by default (like an html output for instance).


non è necessaio inizializzare questa variabile


ack


The logic is in the function! Now you just need the html :)

```html
Bill: <input type="text" id="bill"/>
<!-- create the other inputs here -->
<button onClick="tipCalculate()">Calculate Bill</button>
```


for heroic


Also, you might add crosshair_scale to the check as it is the 4th CVAR that scales an attribute of the UI.


You can pass parameters, but it's a bit more complicated to get it working with parameters. Let's remove them for now so the line should be

`function tipCalculate() {`


This is missing quotes around `bill`.


You need a `.value` here, just like line 4.


Looks like this should be "Images" instead of "Image".

Related: you'll probably want to make that lowercase (sense these folders are case sensitive) and update your file paths. :+1:


Instead of using tip, which should be a text input, you should probably create a <div> called message.

```html
<div id="message"></div>
```

Now what you can do is `$("#message")` or `document.getElementById("message")`.

```javascript
$("#message").html("Please enter an amount");
```


@MSGhero no, it doesn't affect this issue at all. As you may know i've started work on it earlier, but haven't finished it. I will write down my thoughts on it next week on slack (i want to break some existing behavior, like origin handling).


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/OAuthConfig.java` in line 46.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/OAuthConfig.java` in line 49.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/OAuthConfig.java` in line 91.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/OAuthConfig.java` in line 99.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/OAuthConfig.java` in line 103.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/ThymeleafConfiguration.java` in line 17.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/ThymeleafConfiguration.java` in line 18.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/ThymeleafConfiguration.java` in line 20.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 65.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 66.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 68.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 70.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 81.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 86.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 87.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 88.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 89.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 94.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 95.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 96.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 97.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/AccessConfirmationController.java` in line 22.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


(updated the code snippet above https://github.com/jgm/pandoc-templates/commit/a84f822c30fde1802131c1c7d69d6ebae4550f72?diff=unified#commitcomment-14264295)


@IIvec: Sorry, I cannot take part at the discussion in the forum, no google-account.


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/OAuthConfig.java` in line 46.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/OAuthConfig.java` in line 49.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/OAuthConfig.java` in line 99.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/OAuthConfig.java` in line 91.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/OAuthConfig.java` in line 103.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/ThymeleafConfiguration.java` in line 17.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/ThymeleafConfiguration.java` in line 18.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/main/java/com/schmeisky/ThymeleafConfiguration.java` in line 20.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 65.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 66.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 68.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 70.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 81.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 86.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 87.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 88.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 89.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 94.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 95.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 96.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


*This commit introduced an issue unrelated to the diff. This is probably a logically related issue. It occurred in `src/test/java/com/schmeisky/ApprovalStoreTest.java` in line 97.*

Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


Line contains spacing inconsistencies.

*Detected by SpaceConsistencyBear with severity 1 while running section `default`.*


Keh :3


It seems it caches more then we need, and it's hard to track such behaviour, so that's why I removed it.


I was about to know how many jumps are available to my fleet not only flagship (blue line).
In line 233 I just read "ship->JumpsRemaining()" and was afraid of just including my Flagship into the calculations ;)


Ah, good spot, thanks. I'll do that (both).


Wasn't the idea to remove all `session_start()` calls? Why do we need this call?


Very good point. We could reduce it to 6 for sure, or create a reusable object outside of the spec for future expectations.


The borders also do not appear by default, and are only turned on when `colorlinks` is enabled. The primary function of a PDF is to have a document that can be printed consistently; if electronic consumption is the intent, a more appropriate format should be used. Adding `colorlinks` to the writer would have the same effect as your first suggestion. This is probably the most flexible way to handle it in the template:

```tex
\hypersetup{breaklinks=true,
            unicode=true,
$if(title-meta)$
            pdftitle={$title-meta$},
$endif$
$if(author-meta)$
            pdfauthor={$author-meta$},
$endif$
$if(subtitle)$
            pdfsubject={$subtitle$},
$endif$
$if(keywords)$
            pdfkeywords={$for(keywords)$$keywords$$sep$; $endfor$},
$endif$
$if(colorlinks)$
            colorlinks=true,
$endif$
$if(citecolor)$
            citecolor=$citecolor$,
$endif$
$if(urlcolor)$
            urlcolor=$urlcolor$,
$endif$
$if(linkcolor)$
            linkcolor=$linkcolor$,
$endif$
            pdfborder={0 0 0}}
```


(I can bundle the necessary changes in with #141 if desired.)


 ABOUT-NLS          - Notes on the Free Translation Project.
 AUTHORS            - VLC authors.
 COPYING            - The GPL license.
+COPYING.LIB        - The LGPL license.
 INSTALL            - Installation and building instructions.
 NEWS               - Important modifications between the releases.
 README             - This file.
@@ -37,14 +38,16 @@ THANKS             - VLC contributors.
 bin/               - VLC binaries.
 bindings/          - libVLC bindings to other languages.
 compat/            - compatibility library for operating systems missing
-                     essential functionnalities.
-contrib/           - external libraries retrieving facilities for systems that
-                     don't have package manager.
+                     essential functionalities.
+contrib/           - Facilities for retrieving external libraries and building
+                     them for systems that don't have the right versions.
 doc/               - Miscellaneous documentation.
 extras/analyser    - Code analyser and editor specific files.
 extras/buildsystem - different buildsystems specific files.
 extras/misc        - Files that don't fit in the other extras/ categories.
 extras/package     - VLC packaging specific files such as spec files.
+extras/tools/      - Facilities for retrieving external building tools needed
+                     for systems that don't have the right versions.
 include/           - Header files.
 lib/               - libVLC source code.
 modules/           - VLC plugins and modules. Most of the code is here.


Agree with hugoroy.


Line is longer than allowed. (117 > 80)

*Detected by LineLengthBear with severity 1 while running section `pythoncheck`.*


Cool works great, good job you said extra info I'd have been searching high and low to find it :)


you dont need a for loop you just need to increment i each time the function is ran.. so i++ at the end


For 2.18.1 it works for testing a complete test class, but not for individual methods (like before).


Nice. However, please adhere to the style of existing code: four spaces for indentation and blocks in braces, even single-line.