---
layout: post
title: Storyboard Credit Mutuel
date: '2018-08-21T10:21:39+02:00'
categories:
- Storyboards
picture_url: https://film-Storyboards.tumblr.com/post/177202884306/Storyboards-credit-mutuel
---
Storyboard capsules TV
Client: Crédit Mutuel Agence: 109 Paris Producer: Carine La Haye


class: center, middle # Lecture : ### Generative Adversarial Networks Marc Lelarge --- # Learning high-dimension generative models The idea behing GANS is to train two netwroks jointly: * a discriminator $\mathbf{D}$ to classify samples as "real" or "fake" * a generator $\mathbf{G}$ to map a fixed distribution to samples that fool $\mathbf{D}$ .center[
] .footnote[ Goodfellow et al. [Generative adversarial nets](https://arxiv.org/abs/1406.2661). 2014. ] .credit[image: F. Fleuret] --- # GAN learning The discriminator $\mathbf{D}$ is a classifier and $\mathbf{D}(x)$ is interpreted as the probability for $x$ to be a real sample. The generator $\mathbf{G}$ takes as input a Gaussian random variable $z$ and produces a fake sample $\mathbf{G}(z)$. The discriminator and the generator are learned alternatively, i.e. when parameters of $\mathbf{D}$ are learned $\mathbf{G}$ is fixed and vice versa. -- When $\mathbf{G}$ is fixed, the learning of $\mathbf{D}$ is the standard learning process of a binary classifier (Sigmoid layer + BCE loss). -- The learning of $\mathbf{G}$ is more subtle. The performance of $\mathbf{G}$ is evaluated thanks to the discriminator $\mathbf{D}$, i.e. the generator .red[maximizes] the loss of the discriminator. --- # Learning of $\mathbf{D}$ The task of $\mathbf{D}$ is to distinguish real points $x_1,\dots, x_N$ from generated points $\mathbf{G}(z_1),\dots, \mathbf{G}(z_N)$. The last layer of $\mathbf{D}$ is a Sigmoid layer, then learning of $\mathbf{D}$ is done thanks to the binary cross-entropy loss: $$ \mathcal{L}(\mathbf{D},\mathbf{G}) = -\sum_{n=1}^N \log \mathbf{D}(x_n)+\log \left( 1-\mathbf{D}(\mathbf{G}(z_n))\right). $$ -- For a fixed generator $\mathbf{G}$, the optimal discriminator is $$ \mathbf{D}^* = \arg\min\mathcal{L}(\mathbf{D},\mathbf{G}). $$ --- # Learning of $\mathbf{G}$ The task of $\mathbf{G}$ is to fool the discriminator. For a fixed discriminator $\mathbf{D}$, the optimal generator is $$ \mathbf{G}^* = \color{red}{\arg\max} \mathcal{L}(\mathbf{D},\mathbf{G})= \arg\max -\sum_{n=1}^N \log \left( 1-\mathbf{D}(\mathbf{G}(z_n))\right). $$ In practice, the loss for $\mathbf{G}$ is often replaced by: $$ \mathbf{G}^* = \arg\max \sum_{n=1}^N \log \left(\mathbf{D}(\mathbf{G}(z_n))\right). $$ --- # Loss function for $\mathbf{G}$ .center[
] When the generator is weak compared to the discriminator, i.e. when $\mathbf{D}(\mathbf{G}(z)<<1$, the modified loss boosts the learning of the generator thanks to the high slope of $\log$ around zero. --- # GAN for 2-d point cloud Creating the generator and discriminator. ``` import torch import torch.nn as nn z_dim = 32 hidden_dim = 128 net_G = nn.Sequential(nn.Linear(z_dim,hidden_dim), nn.ReLU(), nn.Linear(hidden_dim, 2)) net_D = nn.Sequential(nn.Linear(2,hidden_dim), nn.ReLU(), nn.Linear(hidden_dim,1), nn.Sigmoid()) ``` The point cloud will be given as a numpy array X. --- ``` batch_size, lr = 50, 1e-4 nb_epochs = 500 optimizer_G = torch.optim.Adam(net_G.parameters(),lr=lr) optimizer_D = torch.optim.Adam(net_D.parameters(),lr=lr) for e in range(nb_epochs): np.random.shuffle(X) real_samples = torch.from_numpy(X).type(torch.FloatTensor) for real_batch in real_samples.split(batch_size): #improving D z = torch.empty(batch_size,z_dim).normal_() fake_batch = net_G(z) D_scores_on_real = net_D(real_batch) D_scores_on_fake = net_D(fake_batch) loss = -torch.mean(torch.log(1-D_scores_on_fake) + torch.log(D_scores_on_real)) optimizer_D.zero_grad() loss.backward() optimizer_D.step() # improving G z = torch.empty(batch_size,z_dim).normal_() fake_batch = net_G(z) D_scores_on_fake = net_D(fake_batch) loss = -torch.mean(torch.log(D_scores_on_fake)) optimizer_G.zero_grad() loss.backward() optimizer_G.step() ``` --- # Loss curves .center[
] Contrary to standard loss minimization, we have no guarantee here that the network will stabilize. It can very well oscillate without convergence. --- #GAN in action .center[
] A GAN fitting double moons. --- # Mode collapse The goal of a GAN is to find the best generator against any discriminator, i.e. $ \mathbf{G}^* = \arg\max \min_D \mathcal{L}(\mathbf{D},\mathbf{G}). $ But optimization alternates between finding the best generator agianst the current discriminator and finding the best discriminator against the current generator. In particular, we do not solve the $\max\min$ problem but alternate between the two problems. -- As a result, a possible equilibrium of the game observed in practice, is for the generator to generates only 'easy' samples, i.e. those most difficult to classify for the discriminator. --- # Mode collapse on MNIST .center[
] Those generated digits are clearly not following the origninal distribution of MNIST dataset and ones for example seems over-represented. --- # Conditional GAN .center[
] When labels are available, mode collapse can be mitigated (more details in practicals). .footnote[Mirza et al. [Conditional Generative Adversarial Nets](https://arxiv.org/abs/1411.1784). 2014.] --- # InfoGAN .center[
] Even when labels are not available, mode collapse can be mitigated (more details in practicals). .footnote[Chen et al. [InfoGAN: Interpretable Representation Learning by Information Maximizing Generative Adversarial Nets](https://arxiv.org/abs/1606.03657). 2016.] --- #IGAN in action .center[
] An InfoGAN fitting double moons. --- # Deep Convolutional GAN "Historical attempts to scale up GANs using CNNs to model images have been unsuccessful. (...) We also encountered difficulties attempting to scale GANs using CNN architectures commonly used in the supervised literature. However, after extensive model exploration we identified a family of architectures that resulted in stable training across a range of datasets and allowed for training higher resolution and deeper generative models." .footnote[Radford et al. [Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks](https://arxiv.org/abs/1511.06434). 2015.] --- # DC-GAN rules - replace pooling layers with strided convolutions in $\mathbf{D}$ and strided transposed convolution in $\mathbf{G}$. - use batchnorm in both $\mathbf{D}$ and $\mathbf{G}$. - remove fully connected hidden layers. - use `ReLU` in $\mathbf{G}$ except for the output using `Tanh`. - use `LeakyReLU` in $\mathbf{D}$ for all layers.


Memory buffers. More...
Data Structures | |
| struct | uv_buf_t |
A libuv buffer. More... | |
Macros | |
| #define | using_buf(bufref) |
| Use a buffer in a scope, freeing automatically when exiting. More... | |
| #define | using_buf_on_abort_free(bufref) |
| Use a buffer in a scope, freeing automatically only when an exception is thrown. More... | |
| #define | using_buf_owned(owned, bufref) |
| Use a potentially owned buffer in a scope. More... | |
Functions | |
| uv_buf_t | nodec_buf (const void *base, size_t len) |
| Initialize a libuv buffer, which is a record with a data pointer and its length. | |
| uv_buf_t | nodec_buf_str (const char *s) |
| Initialize a buffer from a string. | |
| uv_buf_t | nodec_buf_strdup (const char *s) |
| Initialize a buffer from a string. More... | |
| uv_buf_t | nodec_buf_null () |
Create a null buffer, i.e. nodec_buf(NULL,0) . | |
| uv_buf_t | nodec_buf_alloc (size_t len) |
| Create and allocate a buffer of a certain length. | |
| uv_buf_t | nodec_buf_realloc (uv_buf_t buf, size_t len) |
| Reallocate a buffer to a given new length. More... | |
| uv_buf_t | nodec_buf_ensure (uv_buf_t buf, size_t needed) |
Ensure a buffer has at least needed size. More... | |
| uv_buf_t | nodec_buf_ensure_ex (uv_buf_t buf, size_t needed, size_t initial_size, size_t max_increase) |
Ensure a buffer has at least needed size. More... | |
| uv_buf_t | nodec_buf_fit (uv_buf_t buf, size_t needed) |
Fit a buffer to needed size. More... | |
| uv_buf_t | nodec_buf_append_into (uv_buf_t buf1, uv_buf_t buf2) |
Append the contents of buf2 into buf1 . More... | |
| bool | nodec_buf_is_null (uv_buf_t buf) |
| Is this a null buffer?. More... | |
| void | nodec_buf_free (uv_buf_t buf) |
| Free a buffer. More... | |
| void | nodec_bufref_free (uv_buf_t *buf) |
| Free a buffer by reference. More... | |
| void | nodec_bufref_freev (lh_value bufref) |
| Free a buffer by reference value. More... | |
| void | nodec_bufref_nofreev (lh_value pv) |
| Don't free a buffer by reference value. More... | |
Memory buffers.
Buffers are the libuv
uv_buf_t` structure which contain a pointer to the data and their length. Buffer structures are small and always passed and returned by value.
The routines in this module ensure that all buffers actually are allocated with len + 1
where base[len] == 0
, i.e. it is safe to print the contents as a string as it will be zero terminated.
| struct uv_buf_t |
| #define using_buf | ( | bufref | ) |
Use a buffer in a scope, freeing automatically when exiting.
Pass the buffer by reference so it will free the final memory that bufref->base
points to (and not the initial value).
| bufref | a reference to the buffer to free after use. Example |
| #define using_buf_on_abort_free | ( | bufref | ) |
Use a buffer in a scope, freeing automatically only when an exception is thrown.
Pass the buffer by reference so it will free the final memory that bufref->base
points to (and not the initial value).
| bufref | a reference to the buffer to free after use. |
| #define using_buf_owned | ( | owned, | |
| bufref | |||
| ) |
Use a potentially owned buffer in a scope.
This is used for the async_read_bufx()
calls where the returned buffer might be owned (and must be freed), or not (and must not be freed). Pass the buffer by reference so it will free the final memory that bufref->base
points to (and not the initial value).
| owned | Only free the buffer if owned is true. |
| bufref | a reference to the buffer to free after use. |
Append the contents of buf2
into buf1
.
| buf1 | the destination buffer. |
| buf2 | the source buffer. |
buf1
that contains the contents of both. Ensure a buffer has at least needed
size.
| buf | The buffer to potentially reallocate. If buf is null, use 8kb for initial size, and after that use doubling of at most 4mb increments. |
| needed | the required size of the buffer. |
needed
length. | uv_buf_t nodec_buf_ensure_ex | ( | uv_buf_t | buf, |
| size_t | needed, | ||
| size_t | initial_size, | ||
| size_t | max_increase | ||
| ) |
Ensure a buffer has at least needed
size.
Like nodec_buf_ensure() but with customizable initial_size
and max_increase
.
Fit a buffer to needed
size.
Might increase the buffer size, or Reallocate to a smaller size if it was larger than 128 bytes with more than 20% wasted space.
| buf | the buffer to fit. |
| needed | the required space needed. |
needed
. | void nodec_buf_free | ( | uv_buf_t | buf | ) |
Free a buffer.
This is usually not used directly, but through using_buf().
| bool nodec_buf_is_null | ( | uv_buf_t | buf | ) |
Is this a null buffer?.
| buf | the buffer. |
true
if the buffer length is 0 or the base
is NULL
. Reallocate a buffer to a given new length.
See also nodec_buf_fit() and nodec_buf_ensure().
| uv_buf_t nodec_buf_strdup | ( | const char * | s | ) |
Initialize a buffer from a string.
This (re)allocates the string in the heap which is then owned by the buffer.
| void nodec_bufref_free | ( | uv_buf_t * | buf | ) |
Free a buffer by reference.
This is usually not used directly, but through using_buf().
| void nodec_bufref_freev | ( | lh_value | bufref | ) |
Free a buffer by reference value.
This is usually not used directly, but through using_buf().
| void nodec_bufref_nofreev | ( | lh_value | pv | ) |
Don't free a buffer by reference value.
Usually not used directly, but used by using_buf_owned()


Home
Logout
Profile
Available rides
Offer Rides
Ride requests
My rides
Rides made
Feedback
×
quantum computing
<EMAIL_ADDRESS>Home
Available rides
Offer Rides
Ride request
Acount Information
upload car image
Logout
Make a Ride Offer
Offer Ride


Treehouse Project #4 - A Photo Gallery with Search
Description
This is project 4 of 12 in the Front-End Web Development TechDegree curriculum.
I learned how to create a responsive photo gallery, dabbled for the first time with Javascript, and installed my first jQuery plugin.
Skills
- How to use JS to search into photo meta data
- How to install jQuery plugins
- Branching & commits via Git and Github
Built With
- HTML
- CSS
- Javascript
- jQuery


virus Farm pig infection influenza S-O aerosol pigs isolator guinea airborne detected samples {border-style air .-. px;} transmission #ffffff;} viruses aerosols group animals farms nasal viral novel []. dpi particles /(.-.) /(â€") China direct experimental infected positive spread swine contact model secretions experiments swine-origin dpi, isolators logcopies/m px; round {font-family Î¼m â€" (HN) Virus [], collected experiments, font-size particle rate using wind (FigureÂ A(HN) double; used ./. Sero- analysis blood border-color border-width epidemic farm human indicated models number peaked results second serum solid; strains titers {font-style {font-weight (., (TableÂ Figure Health January Results [,]. absent aerosols, air, animal avian bold content control courier; different distribution downwind eastern em; emerged group, health inoculation likely nasopharyngeal new pandemic placed pt;} range represents respiratory rounds shedding staff velocity


To talk to any of our B.Tech students, send an email to<EMAIL_ADDRESS>with
Civil Engineering
2016
Nagpur,Rajasthan
CSE
2016
Barnala, Punjab
CSE
2017
karnal,haryana
Civil Engineering
2017
Jaipur, Rajasthan
Electrical Engineering
2017
Ludhiana, Punjab
CSE
2017
Lucknow, UP
Mechanical Engineering
2017
Gondia, Maharashtra
Civil Engineering
2017
Lucknow,UP
Civil Engineering
2017
Jaipur,Rajasthan
CSE
2017
Hyderabad
Electrical Engineering
2017
Sikar, Rajasthan
Civil Engineering
2017
Lucknow,UP
Electrical Engineering
2017
Ludhiana, Punjab
CSE
2017
Lucknow, UP
Mechanical Engineering
2017
Gondia, Maharashtra
Civil Engineering
2017
Lucknow,UP
Electrical Engineering
2017
Ludhiana, Punjab
CSE
2017
Lucknow, UP
Mechanical Engineering
2017
Gondia, Maharashtra
Civil Engineering
2017
Lucknow,UP
Electrical Engineering
2017
Ludhiana, Punjab
CSE
2017
Lucknow, UP
Mechanical Engineering
2017
Gondia, Maharashtra
Civil Engineering
2017
Lucknow,UP


I am an iOS and Web Developer. I'm the founder and CTO of The App Brewery. I ❤ coffee and brew my own beers.
I started learning to code when I was 12 years old because I wanted to make my own video games. Over time, I have gained a wealth of experience designing and developing mobile and web applications.
But my best skill is actually in eating hot wings. I am the undisputed queen of hot wing challenges. Ghost Peppers and Carolina Reapers are my favourite snacks.


Guidance
Guidance and ideas for the effective design and use of school grounds and outdoor space.
PDF , 12.1MB , 124 pages
If you use assistive technology (such as a screen reader) and need a version of this document in a more accessible format, please email<EMAIL_ADDRESS>. Please tell us what format you need. It will help us if you say what assistive technology you use.
The document, ‘schools for the future: designing school grounds’, is full of information, guidance and ideas to inspire the best possible designs for school grounds.
The guide also includes examples of schools that have used the development of their grounds to enhance the educational, recreational and social needs of their pupils.
Published: 11 March 2014
Updated: 1 July 2015
From: Education Funding Agency


I am a second year Computer Science major at the Georgia Institute of Technology. I am very passionate about Full-Stack Web Development. I am continuing to expand my portfolio by completing side projects that interest me. I am currently seeking expereince in the realm of software development through an internship.
Proficient in: Java, JavaScript, HTML
Familiar with: CSS
Object-oriented programming, React.js, Express.js, Node.js, React-Bootstrap, Google Firebase, git, npm, Figma, Web design, Linear algebra, Discrete mathemetatics
Buisness Website
http://www.flexultralounge.com/
Developed the front-end in React.js, Bootstrap, CSS
Created buisness webpage which provided safety precautions being taken during the COVID-19 pandemic which resulted in increased customer safety and profits.
Full-Stack Web Application
Developed the front-end in React.js, Bootstrap, CSS
Built the back-end in Node.js, Express.js, Google Firebase
FYCourse helps its users find the right courses to build marketable skills to get a job in software development. The goal was to help bridge the gap between developing skills and getting a job in software development. We solve this problem by helping people find courses that meet their needs and provide them a community for support.


Download
Download the latest version here — awsm.css.
Minified — awsm.min.css (≈3 Kb after gzip).
You also can download tarball of the project.
unpkg
Also you can use unpkg for link latest or exact version of library:
<link rel="stylesheet" href="https://unpkg.com/awsm.css/dist/awsm.min.css">
Get more information about the unpkg CDN on unpkg.com.
PostCSS API
If you install npm package, you can use library as PostCSS plugin:
const postcss = require('postcss');
const awsm = require('awsm.css');
postcss([awsm()]).process('a {color: red}').then(result => {
console.log(result.css); // awsm.css prepends your CSS
});
License
awsm.css licensed under the MIT.
The MIT License places almost no restrictions on what you can do with this lib. You are free to use it in commercial projects as long as the copyright is left intact.
Credits
Thanks to Anastasia Medvedeva for photo & video used in examples.


You can connect and contribute anytime to the project
You can use this toolkit as is, or you can develop your own!
A powerful resource to empower experts and communities
It is open and free for anybody


6 Data Modeling with Regression
Now that we are equipped with data visualization skills from Chapter 3, data wrangling skills from Chapter 5, and an understanding of the “tidy” data format from Chapter 4, we now proceed to discuss once of the most commonly used statistical procedures: regression. Much as we saw with the Grammar of Graphics in Chapter 3, the fundamental premise of (simple linear) regression is to model the relationship between
- An outcome/dependent/predicted variable \(y\)
- As a function of a covariate/independent/predictor variable \(x\)
Why do we have multiple labels for the same concept? What’s their root? Regression, in its simplest form, can be viewed in two ways:
- For Prediction: You want to predict an outcome variable \(y\) based on the information contained in a set of predictor variables. You don’t care so much about understanding how all the variables relate and interact, but so long as you can make good predictions about \(y\), you’re fine.
- For Explanation: You want to study the relationship between an outcome variable \(y\) and a set of explanatory variables, determine the significance of any found relationships, and have measures summarizing these.
In this chapter, we use the flights
data frame in the nycflights13
package to look at the relationship between departure delay, arrival delay, and other variables related to flights. We will also discuss the concept of correlation and how it is frequently incorrectly implied to also lead to causation. This chapter also introduces the broom
package, which is a useful tool for summarizing the results of regression fits in “tidy” format.
Needed packages
Let’s load all the packages needed for this chapter (this assumes you’ve already installed them). If needed, read Section 2.3 for information on how to install and load R packages.
library(nycflights13)
library(ggplot2)
library(dplyr)
library(broom)
6.1 Datasets
6.1.1 Professor evaluations
A study conducted at the University of Texas in Austin available at openintro.org investigated associations between teacher evalutions and various attributes of the instructor.
- Question: Can we explain a professor’s teaching evaluation score using these attritubes?
- Outcome variable \(y\): Average teaching score, based on students evaluations between 1 and 5
- Explanatory variables \(x\)
- their rank: teaching, tenure track, or tenured
- their ethnicity: minority or non-minority
- their (binary) gender: male or female
- their language: whether or not english was their mother tongue
- their age:
- their average “beauty” rating, based on a panel of 6 students’ scores between 1 and 10.
First let’s load the data and look at a random sample of 5 rows:
load(url("http://www.openintro.org/stat/data/evals.RData"))
evals <- evals %>%
select(score, ethnicity, gender, language, age, bty_avg, rank)
| score | ethnicity | gender | language | age | bty_avg | rank | |
|---|---|---|---|---|---|---|---|
| 349 | 5.0 | minority | male | english | 50 | 3.33 | teaching |
| 397 | 4.8 | not minority | male | english | 45 | 3.33 | teaching |
| 165 | 3.6 | not minority | male | english | 63 | 4.33 | teaching |
| 451 | 4.4 | not minority | female | non-english | 60 | 4.33 | tenure track |
| 143 | 4.3 | not minority | male | english | 58 | 3.83 | tenured |
6.1.2 Country-by-country life expectancies in 2007
The gapminder
package contains the gapminder
data frame, which contains development data about various countries for 5-year intervals between 1952 and 2007
- Question: What variables are associated with life expectancy for all countries in 2007? In other words, can we identify variables that can explain variation in life expectancy between countries.
- Outcome variable \(y\): Mean life expectancy
- Explanatory variables \(x\)
- continent
- GDP per capita
First let’s load the data and look at a random sample of 5 rows:
library(gapminder)
gapminder2007 <- gapminder %>%
filter(year == 2007) %>%
select(country, lifeExp, continent, gdpPercap)
| country | lifeExp | continent | gdpPercap |
|---|---|---|---|
| Kenya | 54.1 | Africa | 1463.2 |
| Gambia | 59.4 | Africa | 752.7 |
| Benin | 56.7 | Africa | 1441.3 |
| Norway | 80.2 | Europe | 49357.2 |
| Congo, Dem. Rep. | 46.5 | Africa | 277.6 |
6.1.3 Credit card balance
The ISLR
package contains the Credit
data frame, which contains information on Credit balances. Unfortunately, I don’t have information on which population this data was drawn from, so we can’t generalize any of these results.
- Question: What variables are associated with how much credit card debt an individual has
- Outcome variable \(y\)
Balance
- Explanatory variables
- \(x_1\)
Income
: Income in $1000’s - \(x_2\)
Limit
: Credit limit
- \(x_1\)
First let’s load the data and look at a random sample of 5 rows:
library(ISLR)
Credit <- Credit %>%
select(Balance, Income, Limit)
| Balance | Income | Limit | |
|---|---|---|---|
| 382 | 849 | 101.8 | 8029 |
| 289 | 863 | 16.7 | 5274 |
| 246 | 0 | 34.5 | 2001 |
| 257 | 0 | 25.9 | 1774 |
| 126 | 0 | 27.6 | 2531 |
6.1.4 Biopics
Let’s look at the biopics
dataset in the fivethirtyeight
package. After loading the package, run ?biopics
in the console to read the help file. This data is from the article “Straight Outta Compton” Is The Rare Biopic Not About White Dudes.
First let’s load the data and look at a random sample of 5 rows:
library(fivethirtyeight)
biopics <- biopics %>%
select(title, box_office, person_of_color, subject_sex) %>%
# Remove those that are missing
filter(!is.na(box_office))
| title | box_office | person_of_color | subject_sex |
|---|---|---|---|
| Invictus | 37500000 | TRUE | Male |
| Music Within | 153000 | TRUE | Male |
| Dallas Buyers Club | 27300000 | FALSE | Male |
| Catch Me If You Can | 164000000 | FALSE | Male |
| Selma | 52100000 | TRUE | Male |
6.2 One numerical x: Professor evaluations
6.2.1 Exploratory data analysis
Let’s
- Model the outcome variable y: teacher evaluation score
- Using explanatory variable x: beauty score
Let’s plot the data:
ggplot(evals, aes(x=bty_avg, y=score)) +
geom_point() +
labs(x="Beauty Score", y="Teaching Score")
The above suffers from overplotting; let’s break it up with a little random jitter added to the points. Note, we are only altering the visualization of the points; the original data is the same.
ggplot(evals, aes(x=bty_avg, y=score)) +
geom_jitter() +
labs(x="Beauty Score", y="Teaching Score")
6.2.2 Correlation coefficient
The correlation coefficient between teacher evaluation score and beauty score weakly positive:
cor(evals$score, evals$bty_avg)
| correlation |
|---|
| 0.187 |
6.2.3 Simple linear regression
Let’s
- Fit a simple linear regression using the command
lm(y ~ x, data)
below: - Output the table in tidy data format using the
tidy()
function from thebroom
package.
lm(score~bty_avg, data=evals) %>%
tidy()
| term | estimate | std.error | statistic | p.value |
|---|---|---|---|---|
| (Intercept) | 3.880 | 0.076 | 50.96 | 0 |
| bty_avg | 0.067 | 0.016 | 4.09 | 0 |
Let’s plot the regression line with a new layer called + geom_smooth(method="lm")
:
ggplot(evals, aes(x=bty_avg, y=score)) +
geom_point() +
labs(x="Beauty Score", y="Teaching Score") +
geom_smooth(method="lm")
Let’s ignore the grey bars now (which are “error” bars) by adding the argument se=FALSE
to geom_smooth
ggplot(evals, aes(x=bty_avg, y=score)) +
geom_point() +
labs(x="Beauty Score", y="Teaching Score") +
geom_smooth(method="lm", se=FALSE)
6.2.4 Observed values, fitted values, and residuals
- Red point: Observed point \((x,y) = (\mbox{beauty score}, \mbox{teaching score}) = (7.333, 4.9)\). Observed value \(y=4.9\)
- Red square: Fitted point \((x,\widehat{y}) = (\mbox{beauty score}, \mbox{fitted teaching score}) = (7.333, 4.369)\). Fitted value \(\widehat{y} = 4.369\). Why 4.371? From table above: \(\widehat{y} = b_0 + b_1 x = 3.880 + 0.067 \times 7.333 = 4.369\)
- Length of blue arrow: Residual (i.e. error) \(y - \widehat{y} = 4.9 - 4.369 = 0.531\)
Let’s extract point-by-point information now:
- for all 463 points in our plot, in other words
- for all 463 instructors in the study, in other words
- for all 463 rows in the
evals
data frame
using the augment()
function from the broom
package. This function augments the original data by adding new information resulting from the regression. Let’s look at 5 arbitrarily chosen rows. (Note that the first row in the table corresponds to the red points and blue arrow in Figure 6.5):
point_by_point_info <- lm(score~bty_avg, data=evals) %>%
augment() %>%
select(score, bty_avg, .fitted, .resid)
| score | bty_avg | .fitted | .resid |
|---|---|---|---|
| 4.9 | 7.333 | 4.369 | 0.531 |
| 3.6 | 6.667 | 4.325 | -0.725 |
| 4.9 | 3.500 | 4.114 | 0.786 |
| 3.3 | 2.333 | 4.036 | -0.736 |
| 4.4 | 4.667 | 4.191 | 0.209 |
The periods in the variable names indicated that they are new information that was added to the original dataset. In particular
6.2.5 Residual analysis
Recall the residuals can be thought of as “lack-of-fit”, or “left-overs”, or “errors”. Ideally, we want there to be no systematic pattern to the residuals. What does this mean?
- The residuals should be on average 0.
- The spread of the residuals should be consistent.
- The value of the residuals should not depend on the value of x
Let’s look at the residuals two ways. First, recall in Figure 6.5 above we plotted:
- On the y-axis: \(y\) teaching score
- On the x-axis: \(x\) beauty score
Instead, in Figure 6.6 below let’s plot
- On the y-axis: \(y-\widehat{y}\) residual instead
- On the x-axis: \(x\) beauty score (same as before)
You can think of Figure 6.6 as Figure 6.5, but with the blue line flattened out. Does it seem like there is no systematic pattern to the residuals?
Here are some hypothetical examples where there is a systematic pattern to the residuals:
The second way to look at the residuals is using a histogram:
ggplot(point_by_point_info, aes(x=.resid)) +
geom_histogram(binwidth = 0.25) +
labs(x="Residual")
This histogram seems to indicate that we have more positive residuals than negative. Since Residual = \(y-\widehat{y} > 0\) when \(y > \widehat{y}\), it seems our fitted professor score from the regression model have a slight tendency of being small than the actually observed score.
This histogram has a slight left-skew in that there is a long tail on the left. Another way to say this is this data exhibit a negative skew. Here are examples of an ideal and less than ideal patterns of residuals.
In fact, we’ll see later on that we would like the residuals to be normally distributed with mean 0. In other words, be bell-shaped and centered at 0!
6.2.6 Best fitting lines
Regression lines are also known as “best fitting lines”. But what do we mean by best? Let’s unpack the criteria that is used by regression to determine best. Recall the plot in Figure 6.5) where for a professor with a beauty average score of \(x=7.333\)
- The observed value \(y=4.9\) was marked with a red circle
- The fitted value \(\widehat{y} = 4.369\) on the regression line was marked with a red square
- The residual \(y-\widehat{y} = 4.9-4.369 = 0.531\) was the length of the blue arrow.
Let’s do this for another arbitrarily chosen professor whose beauty score was \(x=2.333\). The residual in this case is \(2.7 - 4.036 = -1.336\).
Let’s do this for another arbitrarily chosen professor whose beauty score was \(x=3.667\). The residual in this case is \(4.4 - 4.125 = 0.2753\).
Let’s do this for another arbitrarily chosen professor whose beauty score was \(x=6\). The residual in this case is \(3.8 - 4.28 = -0.4802\).
Now let’s say we repeated this process for all 463 professors in our dataset. Regression minimizes the sum of all 463 arrow lengths squared. In other words, it minimizes the sum of the squared residuals:
\[ \sum_{i=1}^{n}(y_i - \widehat{y}_i)^2 \]
We square the arrow lengths so that positive and negative deviations of the same amount are treated equally. That’s why alternative names for the simple linear regression line are the least-squares line and the best fitting line. It can be proven via calculus and linear algebra that this line uniquely minimizes the sum of the squared arrow lengths.
For the regression line in the plot, the sum of the squared residuals is 131.868.
6.3 One categorical x: Worldwide life expectancy
6.3.1 Exploratory data analysis
Let’s load the country-by-country life expectancy gapminder2007
data frame that we created in the “Datasets” Section 6.1.2.
lifeExp_by_continent <- gapminder2007 %>%
group_by(continent) %>%
summarize(median = median(lifeExp))
| continent | median |
|---|---|
| Africa | 52.93 |
| Americas | 72.90 |
| Asia | 72.40 |
| Europe | 78.61 |
| Oceania | 80.72 |
The median life expectancy in Africa in was 52.93. Let’s look at a boxplot of life expectancy and mark the median for Africa in red.
ggplot(gapminder2007, aes(x=continent, y=lifeExp)) +
geom_boxplot() +
geom_hline(yintercept = 52.93, col="red", size=1) +
labs(x = "Continent", y="Life expectancy (years)")
Let’s look number of years difference relative to Africa’s median.
ggplot(gapminder2007, aes(x=continent, y=lifeExp-52.93)) +
geom_boxplot() +
geom_hline(yintercept = 0, col="red", size=1) +
labs(x="Continent", y="Difference in life expectancy (years)")
6.3.2 Simple linear regression
Note that while the boxplots in Figure 6.11) involved medians, regression involves means. Using the gapminder2007
data frame again, let’s compute mean life expectancy instead of median.
gapminder2007 %>%
group_by(continent) %>%
summarize(mean = mean(lifeExp))
| continent | mean |
|---|---|
| Africa | 54.81 |
| Americas | 73.61 |
| Asia | 70.73 |
| Europe | 77.65 |
| Oceania | 80.72 |
Let’s now compute the regression table. Recall:
lm(lifeExp ~ continent, data=gapminder2007)
is a regression where- \(y\) is the numerical outcome variable life expectancy
- \(x\) is the categorical explanatory/predictor variable continent
- We then pipe this into
tidy()
from thebroom
package. All this does is output the regression table in a clean format; “tidy data” format as seen in Chapter 4 in fact! - You can think of the following two lines of code as a
generate_regression_table()
function:
lm(lifeExp ~ continent, data=gapminder2007) %>%
tidy()
| term | estimate | std.error | statistic | p.value |
|---|---|---|---|---|
| (Intercept) | 54.81 | 1.03 | 53.45 | 0 |
| continentAmericas | 18.80 | 1.80 | 10.45 | 0 |
| continentAsia | 15.92 | 1.65 | 9.67 | 0 |
| continentEurope | 22.84 | 1.70 | 13.47 | 0 |
| continentOceania | 25.91 | 5.33 | 4.86 | 0 |
What are these values? Recall:
- Africa is treated as the “baseline for comparison”.
- The intercept of 54.81 corresponds to the mean life expectancy of Africa.
- It was chosen for no other reason than it is first alphabetically. You can manually specify which continent to use as baseline, but we leave that to a more advanced course.
- continentAmericas was created by the regression.
- It is the additional mean life expectancy of the Americas above and beyond the baseline of comparison which is Africa. Note that 18.80 = 73.61 - 54.81, the difference in mean life expectancies of the Americas and Africa from the table of continent means above.
- Same goes for Asia, Europe, and Oceania
- What are std.error, statistic, and p.value? We’ll see this later in the course after we’ve seen statistical inference, but here’s a preview:
- std.error is the standard error: it quantifies the uncertainy
- statistic and p.value: these inform us on the statistical significance
To really bring home what the values in the regression table are, let’s subtract the mean life expectancy for Africa of 54.81 from each of the 5 mean life expectancies we computed in the table above and add a new column.
gapminder2007 %>%
group_by(continent) %>%
summarize(mean = mean(lifeExp)) %>%
mutate(compare_to_africa = round(mean - 54.81,2))
| continent | mean | compared_to_africa |
|---|---|---|
| Africa | 54.81 | 0.00 |
| Americas | 73.61 | 18.80 |
| Asia | 70.73 | 15.92 |
| Europe | 77.65 | 22.84 |
| Oceania | 80.72 | 25.91 |
6.3.3 Observed values, fitted values, and residuals
Let’s extract point-by-point information now:
- for all 142 points in the five boxplots in Figure 6.11)
- for all 142 countries in our dataset
- for all 142 rows in the
gapminder2007
data frame
point_by_point_info <- lm(lifeExp ~ continent, data=gapminder2007) %>%
augment() %>%
select(lifeExp, continent, .fitted, .resid)
Note:
lm(lifeExp ~ continent, data=gapminder2007)
is the regression from earlier- We then pipe this into
augment()
from thebroom
package. All this does is output point-by-point information in a clean format; “tidy data” format as seen in Chapter 4 in fact! - We then only select the
lifeExp
,continent
,.fitted
, and.resid
columns. We don’t need the rest, so let’s keep our output clean.
Let’s look at a random sample of 5 of these 142 rows:
| lifeExp | continent | .fitted | .resid | |
|---|---|---|---|---|
| 89 | 52.91 | Africa | 54.81 | -1.900 |
| 104 | 78.10 | Europe | 77.65 | 0.449 |
| 61 | 70.96 | Asia | 70.73 | 0.236 |
| 15 | 72.39 | Americas | 73.61 | -1.218 |
| 65 | 80.55 | Europe | 77.65 | 2.897 |
6.3.4 Residual analysis
Recall our discussion on residuals from Section @ref(residual_analysis) where there were two ways to visualize the residuals to see if there is a systematic pattern to them:
- A plot with residuals on the y-axis and the predictor (in this case continent) on the x-axis
- A histogram of all residuals
First, let’s plot the residuals vs continent using geom_jitter()
again because of overplotting issues. Note here we control the amount of jitter horizontally by setting the width
argument. Doesn’t seem to bad!
ggplot(point_by_point_info, aes(x=continent, y=.resid)) +
geom_jitter(width=0.1) +
labs(x="Continent", y="Residual") +
geom_hline(yintercept=0, col="blue", size =1)
However, there is one clear outlier in Asia. It has the smallest residual, hence also has the smallest life expectancy in Asia. Let’s see who the 5 countries with the shortest life expectancy are:
gapminder2007 %>%
filter(continent == "Asia") %>%
select(country, lifeExp) %>%
arrange(lifeExp)
| country | lifeExp |
|---|---|
| Afghanistan | 43.83 |
| Iraq | 59.55 |
| Cambodia | 59.72 |
| Myanmar | 62.07 |
| Yemen, Rep. | 62.70 |
Second, let’s look at a histogram of all 142 residuals:
ggplot(point_by_point_info, aes(x=.resid)) +
geom_histogram(binwidth = 5) +
labs(x="Residual")
Looks pretty good!
6.4 Two numerical x: Credit card balance
We now move from simple linear regression, which involves a single explanatory/predictor variable, to multiple regression, which involves more than one explanatory/predictor variable.
6.4.1 Exploratory data analysis
Let’s load the Credit card balance Credit
data frame that we created in the “Datasets” Section 6.1.3.
Now that we have two numerical predictors, an ideal way to visualize this data is with a 3D scatterplot. Unfortunately this is beyond the scope of this book, so let’s do the next best thing and look at two separate scatterplots of the outcome variable \(y\) credit card balance in dollars with
- Explanatory/predictor variable \(x\) being credit limit in dollars
- Explanatory/predictor variable \(x\) being income in $1000 units
ggplot(Credit, aes(x=Limit, y=Balance)) +
geom_point() +
labs(x="Credit limit (in $)", y="Credit card balance (in $)") +
geom_smooth(method="lm", se=FALSE)
ggplot(Credit, aes(x=Income, y=Balance)) +
geom_point() +
labs(x="Income (in $1000)", y="Credit card balance (in $)") +
geom_smooth(method="lm", se=FALSE)
In both cases, there seems to be a positive relationship. Let’s look at the correlation coefficient in both cases.
cor(Credit$Limit, Credit$Balance)
| correlation |
|---|
| 0.862 |
cor(Credit$Income, Credit$Balance)
| correlation |
|---|
| 0.464 |
In both cases, the correlation coefficient indicates a strong linear relationship, in particular between credit limit and credit card balance! Makes sense! Note however there were a few individuals who had balances of 0!
What if in instead we looked the correlation coefficient between income and credit card balance, where income was in dollars and not thousands of dollars? i.e. we multiply Income by 1000?
cor(Credit$Income * 1000, Credit$Balance)
| correlation |
|---|
| 0.464 |
We see it is the same! We say that correlation coefficient is invariant to linear transformations! In other words
- The correlation between \(x\) and \(y\) will be the same as
- The correlation between \(a\times x + b\) and \(y\) where \(a, b\) are numerical values (real numbers in mathematical terms)
6.4.2 Multiple regression
Let’s now compute the regression table
lm(Balance ~ Limit + Income, data=Credit) %>%
tidy()
| term | estimate | std.error | statistic | p.value |
|---|---|---|---|---|
| (Intercept) | -385.18 | 19.46 | -19.79 | 0 |
| Limit | 0.26 | 0.01 | 44.95 | 0 |
| Income | -7.66 | 0.39 | -19.90 | 0 |
Whereas in simple linear regression with a single numerical predictor, for multiple linear regression with two numerical predictors, the regression line is now a regression plane. In other words, a flat surface! See the interactive 3D scatterplot with a regression plane added here.
How do we interpret the three values that define the plane?
- Intercept: -$385.18. In this case, the intercept doesn’t have a practical interpretation as no one can have a credit card balance of less than $0. It is used merely to situation the plane.
- Limit: $0.26. Now that we have multiple variables to consider, we have to add a caveat to our interpretation: all other things being equal, for every increase in one dollar in credit limit, there is an associated increase of on average 26 cents in credit card balance. Note:
- Again, we are not making any causal statements, only statements relating to the association between credit limit and balance
- The all other things being equal related to the other explanatory/predictor variables, in this case only one: Income. This is equivalent to saying “holding income constant, we observed an associated increase of $0.26 in credit card balance for every dollar increase in credit limit”
- Income: -$7.66. Negative? Say what? Didn’t we see in Figure 6.15) that the relationship was positive and that the correlation between Income and credit card balance was positive?
Here is a histogram of all nrow(Credit)
values of Limit
where the vertical red lines cut up the data into quartiles.
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
In other words,
- 25% of people had credit limits between $0 and $3088. Let’s call this group “low” credit limit bracket.
- 25% of people had credit limits between $3088 and $4622. Let’s call this group “medium-low” credit limit bracket.
- 25% of people had credit limits between $4622 and $5873. Let’s call this group “medium-high” credit limit bracket.
- 25% of peopel had credit limits over $5873. Let’s call this group “high” credit limit bracket.
Figure 6.17) is actually the same as Figure 6.15), but now with colors distinguishing the credit limit brackets. We now see that for the
- low
- medium-low
- medium-high
income bracket groups, the strong positive relationship between credit card balance and income disappears! Only for the high bracket does the relationship stay somewhat positive. In this example credit limit is a confounding variable for credit card balance and income.
Alternatively, we could also have used facets, where each facet has roughly 25% of people based on the credit limit bracket. However, IMO the above plot is easier to read.
6.5 One numerical x and one categorical x: Professor evaluations
Let’s revisit the professor evaluation data introduced in Section 6.1.1. In Section @ref(#onenumerical) we studied the relationship between
- \(y\): outcome variable of teacher evaluation score
- \(x\): numerical explanatory variable of beauty score
Now let’s say we want to also consider age instead of beauty score and a categorical explanatory/predictor variable: the binary gender of the professor. Our modeling situation now becomes
- y: outcome variable of teacher evaluation score
- predictor variables
- \(x_1\): numerical explanatory/predictor variable of age
- \(x_2\): categorical explanatory/predictor variable of gender
6.5.1 Exploratory data analysis
ggplot(evals, aes(x=age, y=score, col=gender)) +
geom_jitter() +
labs(x="Age", y="Teaching Score", color="Gender") +
geom_smooth(method="lm", se=FALSE)
We notice some interesting trends:
- There are almost no women faculty over the age of 60.
- Fitting separate regression lines for men and women, we see they have different slopes. We see that the associated effect of increasing age seems to be much harsher for women than men. In other words, they have different slopes.
6.5.2 Multiple regression
Let’s now compute the regression table
lm(score ~ age + gender, data=evals) %>%
tidy()
| term | estimate | std.error | statistic | p.value |
|---|---|---|---|---|
| (Intercept) | 4.4841 | 0.1253 | 35.792 | 0.0000 |
| age | -0.0087 | 0.0026 | -3.280 | 0.0011 |
| gendermale | 0.1906 | 0.0525 | 3.632 | 0.0003 |
The modeling equation for this is:
\[ \begin{align} \widehat{y} &= b_0 + b_1 x_1 + b_2 x_2 \\ \widehat{score} &= b_0 + b_{age} age + b_{male} \mathbb{1}[\mbox{is male}] \\ \end{align} \]
What this looks like is in Figure 6.20) below.
We see that:
- Females are treated as the baseline for comparison for no other reason than “female” is alphabetically earlier than “male”. The \(b_{male} = 0.1906\) is the vertical “bump” that men get in their teaching evaluation scores. Or more precisely, it is the average difference in teaching score that men get relative to the baseline of women
- Accordingly, the intercepts are (which in this case make no sense since no professor can have age 0):
- for women: \(b_0\) = 4.484
- for men: \(b_0 + b_{male}\) = 4.484 + 0.191 = 4.675
- Both men and women have the same slope. In other words, in this model the associated effect of age is the same for men and women: all other things being equal, for every increase in 1 in age, there is on average an associated decrease of \(b_{age}\) = -0.0086 in teaching score
Hold up: Figure 6.20) is different than Figure 6.19)! What is going on? What we have in the original plot is an interaction effect between age and gender!
6.5.3 Interaction effects
We say a model has an interaction effect if the associated effect of one variable depends on the value of another variable.
Let’s now compute the regression table
lm(score ~ age * gender, data=evals) %>%
tidy()
| term | estimate | std.error | statistic | p.value |
|---|---|---|---|---|
| (Intercept) | 4.8830 | 0.2052 | 23.795 | 0.0000 |
| age | -0.0175 | 0.0045 | -3.918 | 0.0001 |
| gendermale | -0.4460 | 0.2654 | -1.681 | 0.0935 |
| age:gendermale | 0.0135 | 0.0055 | 2.446 | 0.0148 |
The model formula is
\[ \begin{align} \widehat{y} &= b_0 + b_1 x_1 + b_2 x_2 + b_3 x_1x_2\\ \widehat{score} &= b_0 + b_{age} age + b_{male} \mathbb{1}[\mbox{is male}] + b_{age,male}age\mathbb{1}[\mbox{is male}] \\ \end{align} \]
6.6 Two categorical x: Biopics
Before we conduct an exploratory data analysis of the biopics
data, let’s first have a discussion \(\log\)-transformations.
6.6.1 log-transformations
Let’s consider a histogram of the box office revenues for the biopics
dataset
ggplot(biopics, aes(x=box_office)) +
geom_histogram() +
labs(x="Box office revenue")
In Figure 6.21), we see there is a right-skew to both the x-values. This is because there are a few Hollywood blockbusters being compared with many (likely) smaller-scale independent films. Let’s look at the top 5 and bottom 5 grossing movies in this dataset:
| title | box_office | person_of_color | subject_sex |
|---|---|---|---|
| American Sniper | 350000000 | FALSE | Male |
| The Blind Side | 256000000 | TRUE | Male |
| Lincoln | 182000000 | FALSE | Male |
| A Beautiful Mind | 171000000 | FALSE | Male |
| Catch Me If You Can | 164000000 | FALSE | Male |
| title | box_office | person_of_color | subject_sex |
|---|---|---|---|
| Caravaggio | 3150 | FALSE | Male |
| Set Fire to the Stars | 3270 | FALSE | Male |
| My Dinner with Andre | 5070 | FALSE | Male |
| My Dinner with Andre | 5070 | FALSE | Male |
| Kid Cannabis | 5570 | FALSE | Male |
The scale of box office revenue is completely different! Hence, in Figure 6.21), it’s really hard to see what’s going on at the lower-end.
Let’s unskew this variable and compare not absolute differences, but rather, relative differences i.e. differences in “order of magnitude” using a log10()
transformation:
ggplot(biopics, aes(x=log10(box_office))) +
geom_histogram() +
labs(x="log10(Box office revenue)")
We can see a little better what’s going on at the lower end of the box office revenue scale. However the values on the axes require a little thinking to process. For example at \(x=7\), this corresponds to movies with revenue of \(10^7 = 10,000,000\) dollars. So instead, let’s rescale the x-axis so that it displays the data in their original units.
ggplot(biopics, aes(x=box_office)) +
geom_histogram() +
scale_x_log10() +
labs(x="Box office revenue (log10-scale))")
Note that
- The two plots are identical, but the values on the x-axis are different.
- In both Figure 6.22) Figure 6.23), equivalent distances on each axes correspond to not equivalent absolute differences, but equivalent relative/multiplicative differences. So for example, the horizontal distance on the plot from Budget =
1e+05
= \(10^5\) to Budget =1e+06
= \(10^6\) is equal to the horizontal distance on the plot from Budget =1e+06
= \(10^6\) to Budget =1e+07
= \(10^7\).
6.6.2 Exploratory data analysis
Let’s now consider the box office gross earnings in the US of these movies on a log10 scale:
ggplot(biopics, aes(x=subject_sex, y=box_office)) +
facet_wrap(~person_of_color, nrow = 1) +
scale_y_log10() +
geom_boxplot() +
labs(x="Subject sex", y="Box office revenue (log10-scale)", title="Person of color?")
It seems in this dataset, men of color had the highest median box office gross. Let’s look at a table of means instead of medians.
biopics %>%
group_by(person_of_color, subject_sex) %>%
summarise(mean_box_office = mean(box_office)) %>%
arrange(desc(mean_box_office))
| person_of_color | subject_sex | mean_box_office |
|---|---|---|
| TRUE | Male | 31648028 |
| FALSE | Male | 22871074 |
| TRUE | Female | 20035820 |
| FALSE | Female | 18088799 |
Keep in mind two things though. First, the sample sizes are different:
biopics %>%
group_by(person_of_color, subject_sex) %>%
summarise(n = n()) %>%
arrange(desc(n))
| person_of_color | subject_sex | n |
|---|---|---|
| FALSE | Male | 268 |
| FALSE | Female | 93 |
| TRUE | Male | 61 |
| TRUE | Female | 15 |
Second, can we generalize these results to all movies? How was the selection of movies sampled? Is it a representative sample of all movies, or was their a systematic reason these were included?
6.6.3 Multiple regression
Let’s now compute the regression table. Let’s jump straight into considering a model that incorporates an interaction term as described earlier.
lm(box_office ~ person_of_color * subject_sex, data=biopics) %>%
tidy()
| term | estimate | std.error | statistic | p.value |
|---|---|---|---|---|
| (Intercept) | 18088799 | 3964762 | 4.5624 | 0.0000 |
| person_of_colorTRUE | 1947021 | 10638573 | 0.1830 | 0.8549 |
| subject_sexMale | 4782275 | 4601541 | 1.0393 | 0.2993 |
| person_of_colorTRUE:subject_sexMale | 6829933 | 11941509 | 0.5719 | 0.5677 |
The model formula is
\[ \begin{align} \widehat{y} &= b_0 + b_1 x_1 + b_2 x_2 + b_3 x_1x_2\\ \widehat{score} &= b_0 + b_{color}\mathbb{1}[\mbox{of color}] + b_{male} \mathbb{1}[\mbox{is male}] + b_{color,male}\mathbb{1}[\mbox{of color}]\mathbb{1}[\mbox{is male}] \\ \end{align} \]
Recreate four group means from the Table 6.15 above:
- Female not of color: 18088799 = 18088799 = \(b_0\). Note: Women not of color are the baseline group.
- Male not of color: 22871074 = 18088799 + 4782275 = \(b_0 + b_{male}\)
- Female of color: 20035820 = 18088799 + 1947021 = \(b_0 + b_{color}\)
- Male of color: 31648028 = 18088799 + 1947021 + 4782275 + 6829933 = \(b_0 + b_{color} + b_{male} + b_{color,male}\). Note: \(b_{color,male}\) is the interaction term.
6.7 Inference for regression
6.7.1 Refresher: Professor evaluations data
Let’s revisit the professor evaluations data that we analysized using multiple regression with one numerical and one categorical predictor. In particular
- \(y\): outcome variable of teacher evaluation
score
- predictor variables
- \(x_1\): numerical explanatory/predictor variable of
age
- \(x_2\): categorical explanatory/predictor variable of
gender
- \(x_1\): numerical explanatory/predictor variable of
library(ggplot2)
library(dplyr)
library(broom)
load(url("http://www.openintro.org/stat/data/evals.RData"))
evals <- evals %>%
select(score, ethnicity, gender, language, age, bty_avg, rank)
First, recall that we had two competing potential models to explain professors’ teaching scores:
- Model 1: No interaction term. i.e. both male and female profs have the same slope describing the associated effect of age on teaching score
- Model 2: Includes an interaction term. i.e. we allow for male and female profs to have different slopes describing the associated effect of age on teaching score
6.7.2 Refresher: Visualizations
Recall the plots we made for both these models:
6.7.3 Refresher: Regression tables
Last, let’s recall the regressions we fit. First, the regression with no interaction effect: note the use of +
in the formula.
lm(score ~ age + gender, data=evals) %>%
tidy()
| term | estimate | std.error | statistic | p.value |
|---|---|---|---|---|
| (Intercept) | 4.4841 | 0.1253 | 35.792 | 0.0000 |
| age | -0.0087 | 0.0026 | -3.280 | 0.0011 |
| gendermale | 0.1906 | 0.0525 | 3.632 | 0.0003 |
Second, the regression with an interaction effect: note the use of *
in the formula.
lm(score ~ age * gender, data=evals) %>%
tidy()
| term | estimate | std.error | statistic | p.value |
|---|---|---|---|---|
| (Intercept) | 4.8830 | 0.2052 | 23.795 | 0.0000 |
| age | -0.0175 | 0.0045 | -3.918 | 0.0001 |
| gendermale | -0.4460 | 0.2654 | -1.681 | 0.0935 |
| age:gendermale | 0.0135 | 0.0055 | 2.446 | 0.0148 |
6.7.4 New output: Confidence intervals
Let’s recompute the regression tables, but with a new argument added: tidy(conf.int=TRUE)
. This will add the 95% confidence intervals to our outputs. First, the regression with no interaction effect: note the use of +
in the formula.
lm(score ~ age + gender, data=evals) %>%
tidy(conf.int=TRUE)
| term | estimate | std.error | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|
| (Intercept) | 4.4841 | 0.1253 | 35.792 | 0.0000 | 4.2379 | 4.7303 |
| age | -0.0087 | 0.0026 | -3.280 | 0.0011 | -0.0139 | -0.0035 |
| gendermale | 0.1906 | 0.0525 | 3.632 | 0.0003 | 0.0875 | 0.2937 |
Second, the regression with an interaction effect: note the use of *
in the formula.
lm(score ~ age * gender, data=evals) %>%
tidy(conf.int=TRUE)
| term | estimate | std.error | statistic | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|
| (Intercept) | 4.8830 | 0.2052 | 23.795 | 0.0000 | 4.4797 | 5.2863 |
| age | -0.0175 | 0.0045 | -3.918 | 0.0001 | -0.0263 | -0.0087 |
| gendermale | -0.4460 | 0.2654 | -1.681 | 0.0935 | -0.9676 | 0.0755 |
| age:gendermale | 0.0135 | 0.0055 | 2.446 | 0.0148 | 0.0027 | 0.0244 |
6.7.5 Refresher: Residual analysis
Let’s compute the residuals using augment()
to see if there is a pattern.
point_by_point_info <- lm(score ~ age * gender, data=evals) %>%
augment() %>%
select(score, age, gender, .fitted, .resid)
First the histogram:
ggplot(point_by_point_info, aes(x=.resid)) +
geom_histogram(binwidth = 0.25) +
labs(x="Residual")
Second, the residuals as compared to the predictor variables:
- \(x_1\): numerical explanatory/predictor variable of
age
- \(x_2\): categorical explanatory/predictor variable of
gender
ggplot(point_by_point_info, aes(x=age, y=.resid)) +
geom_point() +
labs(x="age", y="Residual") +
geom_hline(yintercept=0, col="blue", size =1) +
facet_wrap(~gender)


Event Management
Home
create event
logout
All events
Event name:
{{meow.event_name}}
Event city:
{{meow.event_city}}
Event lattitude:
{{ meow.event_lattitude}}
Event longitude:
{{ meow.event_longitude}}
delete
edit


Stocks Climb After Kudlow Talks Up Trade Progress: Markets Wrap
by Samuel Potter(Bloomberg) -- European and Asian stocks climbed alongside U.S. equity futures on Friday after a senior American official signaled progress on a trade deal between the world’s two largest economies. Treasuries slipped with the yen and gold retreated.
The Stoxx Europe 600 Index rose led by mining stocks as almost every major national gauge in the region advanced. Contracts for all three main U.S. benchmarks were also in the green after White House economic adviser Larry Kudlow said an agreement is “coming down to the short strokes.” Equities climbed in Seoul, Tokyo and Sydney but fell in Shanghai. China’s yuan strengthened against the dollar.
Concerns about the chances of the U.S. and China completing a phase-one pact had propelled Treasuries earlier this week, and acted as a headwind to a stock rally that keeps taking American gauges to record highs. The S&P 500 closed slightly higher on Thursday, though a mixed bag of global economic data has also given investors plenty to think about.
Next up is Friday’s U.S. retail sales report, which will show whether consumption bounced back in October after a drop the previous month.
Traders also have one eye on the unrest in Hong Kong, where concerns have fed through to money markets. Liquidity conditions in foreign-exchange are the tightest since the late 1990s. Stocks closed little changed to end the Hang Seng Index’s worst week since early August.
These are the main moves in markets:
Stocks
- Futures on the S&P 500 Index increased 0.3% as of 10:20 a.m. London time.
- The Stoxx Europe 600 Index climbed 0.3%.
- The MSCI Asia Pacific Index jumped 0.5%.
- The MSCI Emerging Market Index increased 0.4%.
Currencies
- The Bloomberg Dollar Spot Index was little changed.
- The euro was little changed at $1.1021.
- The British pound declined 0.1% to $1.2875.
- The onshore yuan gained 0.1% to 7.013 per dollar.
- The Japanese yen dipped 0.2% to 108.66 per dollar.
Bonds
- The yield on 10-year Treasuries gained two basis points to 1.84%.
- The yield on two-year Treasuries increased one basis point to 1.61%.
- Germany’s 10-year yield increased one basis point to -0.34%.
- Britain’s 10-year yield advanced two basis points to 0.726%.
- Japan’s 10-year yield decreased less than one basis point to -0.068%.
Commodities
- West Texas Intermediate crude dipped 0.5% to $56.47 a barrel.
- Iron ore gained 1.8% to $83.30 per metric ton.
- Gold fell 0.5% to $1,464.70 an ounce.
©2019 Bloomberg L.P.


We are currently readying to launch our new website. In the meantime, if you need to get in contact with us then please email us or call us on:
01234 000000
Service will resume as soon as possible.


bit_count(i)
Return the number of bits set in the integer i
.
For nonnegative inputs, bit_count
will return the number of bits set in the two's complement
representation of i
. For negative inputs, it returns a negative number whose magnitude
is one greater than the number of bits not set in the two's complement representation of i
.
bit_count(5)
// 2


---
title: A short introduction to Git
layout: presentation
---
# Computational Science Seminar
### A short introduction to version control with Git
Will Usher, Tom Russell & Roald Lemmen
---
# Agenda
1. intro
1. concepts
1. live coding
1. summary
1. next steps
---
## Resources
These slides are available from:
- https://nismod.github.io/presentations/a-short-intro-to-git.html
Further resources are available from the website:
- https://nismod.github.io/git-novice/
A list of commands used in the session is available for quick reference:
- https://nismod.github.io/git-novice/commands/
---
## Introduction
* Given the limited time we can only give you a flavour of version control
* This session will provide a bit of theory and a bit of practical demonstration
* A more detailed practical will be scheduled for next term
* Version control (and git in particular) has a steep learning curve – do ask
for help getting started
* There are many resources for self learning
* Software Carpentry
* Courses within the University of Oxford
* The Research Support team in SOGE
---
## Motivation!
![Climbing with a rope](../fig/git-climbing-rope.png)
---
## Motivations
- Ability to move back, try things out, 'unlimited undo'
- Log of changes to code
- Working together, not accidentally overwriting
- There is only one 'latest' version
- Remote backup (in the cloud)
Opportunities
- Publishing code in citeable form
- Open-source integration with testing, code quality, documentation
---
## Concepts
- **repository**
a place for a project
- **commit**
a small set of changes, which accumulate to make a **history** of commits
- **remote** repository
a place to share a project (Gitlab, Github)
- **branch**
a way to separate work on new versions, bug-fixes or features
---
## Commits
![Changes Are Saved Sequentially](../fig/play-changes.svg)
---
## Repository
![Commit changes to a repository](../fig/git-repository.svg)
---
## Remote
![Remote Repository After Creation](../fig/git-remote.svg)
---
## Remote
![Remote Repository After remote-add](../fig/git-remote.1.svg)
---
## Remote
![Remote Repository After First Push](../fig/git-remote.2.svg)
---
## Branch
![Different Versions Can be Saved](../fig/versions.svg)
---
## Merge
![Multiple Versions Can be Merged](../fig/merge.svg)
---
## Collaborating with git
![Github flow](../fig/github-flow.png)
[https://guides.github.com/introduction/flow/](https://guides.github.com/introduction/flow/)
---
## Live coding in progress
![Kermit typing](../assets/img/typing-kermit.gif)
---
## Summary
Starting out
`git init`
`git clone`
--
Committing
`git add ...`
`git commit -m "..."`
--
Information
`git status`
`git log`
---
## Summary
Remotes
`git push`
`git pull`
--
Branches
`git branch ...`
`git merge ...`
`git checkout ...`
---
## Git Documentation
`git --help`
Git manual
- https://git-scm.com/docs/git
Git book
- https://git-scm.com/book/en/v2
Cheatsheet from Github
- https://education.github.com/git-cheat-sheet-education.pdf
---
## Thanks!
Questions?
[https://nismod.github.io/presentations/a-short-intro-to-git.html](https://nismod.github.io/presentations/a-short-intro-to-git.html)
<EMAIL_ADDRESS>roald.lemmen@ouce.ox.ac.uk


--- layout: post title: Scott Guthrie - ASP.NET MVC Special Event date: '2009-07-01T00:41:00.001+01:00' author: solrevdev tags: modified_time: '2009-07-01T00:41:50.470+01:00' blogger_id: tag:blogger.com,1999:blog-31446756.post-6811921839676219777 blogger_orig_url: http://www.solrevdev.com/2009/07/scott-guthrie-aspnet-mvc-special-event.html ---
I’m off to Microsoft in Reading on Friday to see the ASP.NET MVC session by Scott Guthrie. Fantastic stuff!


The first step in converting sugar to ATP starts with Glycolysis. This is a multi step series of enzyme conversions of one 6 carbon glucose molecule into a pair of 3 carbon Pyruvate molecules.
In addition to the two Pyruate molecules, this process produces 2 ATP and 2 NADH molecules. The cell will use these two NADH molecules later to either ferment the Pyruvate if no oxygen is present, or the NADH will be saved for aerobic respiration and converted into more ATP.
For our discussion, we'll assume oxygen is present and move on to the next step, Aerobic Respiration. The pyruvates are next sent on to the Kreb Cycle.


Prepare your next holiday by setting the laundry on Thursday.
Save energy by opening the curtains and letting the natural light in on the afternoons.


{{post.created | date: 'MMM d, y'}}
{{ exploration.description }}
Original post has been deleted.
Originally shared by:
Status: {{post.gStatus}}
Your goal is to do this {{post.occurrences}} times on a {{post.gRecurringRecurrence}} basis.
All habits follow the pattern cue - routine - reward. Your targeted cue for this habit is {{post.cues}}. Your targeted reward is {{post.rewards}}.
This goal is a {{post.gImportance}}. You’ve committed to start working on it on {{post.gStartDate | date: 'longDate'}} and complete it by {{post.gEndDate | date: 'longDate'}}.
{{post.files.length}} files attached


{% extends "app/layout.html" %} {% block content %}
A Dynamic Information Framework for Water Resources Management in the Aral Sea Basin
Simulation and visualization of water and energy linkages in Amu Darya and Syr Darya river systems through public and open-source data and modeling platforms.


Computer Science
It is more than just video games.
Picture
Name
Tom Allen
Michael Bradshaw
Alex McAllister
David Toth
Return Home


That IP address doesn't correspond to your configuration file.
Are you sure you have the correct one?
Another thing you can do is load the client into a debugger and
examine the ConnectionFactory instance returned from JNDI.
It contains the properties used to connect to the server.
-Tim
_____
From<EMAIL_ADDRESS><EMAIL_ADDRESS>On Behalf Of Wayne Iriwn
Sent: Monday, 23 January 2006 8:48 AM
To<EMAIL_ADDRESS>Subject: Re: [openjms-user] Cannot connect to queue crossing Internet
I added all kinds of tracing on the client and it is complaining that the
connection is refused and lists the internal IP address for my OpenJMS
server, which is meaningless at the client. I think the wrong address is
being sent by OpenJMS server to this client.
Here is a portion of the log
DEBUG read(length=1) [channelId=1, available=45] -- Sun 2006.01.22
03:34:34.950PM CST
DEBUG read(length=1) [channelId=1, available=44] -- Sun 2006.01.22
03:34:34.950PM CST
DEBUG read(length=14) [channelId=1, available=43] -- Sun 2006.01.22
03:34:34.965PM CST
DEBUG read(length=1) [channelId=1, available=29] -- Sun 2006.01.22
03:34:34.965PM CST
DEBUG read(length=2) [channelId=1, available=28] -- Sun 2006.01.22
03:34:34.965PM CST
DEBUG read(length=25) [channelId=1, available=26] -- Sun 2006.01.22
03:34:34.965PM CST
DEBUG send(type=0x20, channel=2) -- Sun 2006.01.22 03:34:45.872PM CST
DEBUG ping [channel=2] -- Sun 2006.01.22 03:34:45.872PM CST
DEBUG send(type=0x50, channel=2) -- Sun 2006.01.22 03:34:45.872PM CST
DEBUG send(type=0x51, channel=32769) -- Sun 2006.01.22 03:34:45.887PM CST
DEBUG ping [channel=2] - end -- Sun 2006.01.22 03:34:45.965PM CST
DEBUG Failed to connect to <IP_ADDRESS>:1234 -- Sun 2006.01.22
03:34:54.450PM CST java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at
org.exolab.jms.net.socket.SocketManagedConnection.createSocket(SocketManaged
Connection.java:209)
at
org.exolab.jms.net.socket.SocketManagedConnection.createSocketProtected(Sock
etManagedConnection.java:261)
at
org.exolab.jms.net.socket.SocketManagedConnection.createSocket(SocketManaged
Connection.java:182)
at
org.exolab.jms.net.socket.SocketManagedConnection.<init>(SocketManagedConnec
tion.java:114)
at
org.exolab.jms.net.tcp.TCPManagedConnection.<init>(TCPManagedConnection.java
:75)
at
org.exolab.jms.net.tcp.TCPManagedConnectionFactory.createManagedConnection(T
CPManagedConnectionFactory.java:98)
at
org.exolab.jms.net.connector.DefaultConnectionPool.createManagedConnection(D
efaultConnectionPool.java:221)
at
org.exolab.jms.net.connector.AbstractConnectionManager.allocateConnection(Ab
stractConnectionManager.java:140)
at
org.exolab.jms.net.connector.AbstractConnectionFactory.getConnection(Abstrac
tConnectionFactory.java:167)
at
org.exolab.jms.net.connector.AbstractConnectionManager.getConnection(Abstrac
tConnectionManager.java:208)
at
org.exolab.jms.net.connector.AbstractConnectionManager.getConnection(Abstrac
tConnectionManager.java:187)
at
org.exolab.jms.net.connector.ConnectionContext.getConnection(ConnectionConte
xt.java:122)
at
org.exolab.jms.net.orb.UnicastDelegate.readObject(UnicastDelegate.java:216)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at
org.exolab.jms.net.util.SerializationHelper.read(SerializationHelper.java:13
7)
at org.exolab.jms.net.connector.Response.read(Response.java:174)
at org.exolab.jms.net.multiplexer.Channel.invoke(Channel.java:169)
at
org.exolab.jms.net.multiplexer.MultiplexedManagedConnection.invoke(Multiplex
edManagedConnection.java:344)
at
org.exolab.jms.net.multiplexer.MultiplexedConnection.invoke(MultiplexedConne
ction.java:86)
at
org.exolab.jms.net.connector.ManagedConnectionHandle$ConnectionHandle.invoke
(ManagedConnectionHandle.java:263)
at org.exolab.jms.net.orb.UnicastDelegate.invoke(UnicastDelegate.java:153)
at org.exolab.jms.net.proxy.Proxy.invoke(Proxy.java:102)
at
org.exolab.jms.server.net.RemoteServerConnectionFactory__Proxy.createConnect
ion(RemoteServerConnectionFactory__Proxy.java:19)
at
org.exolab.jms.client.net.JmsServerStubImpl.createConnection(JmsServerStubIm
pl.java:172)
at org.exolab.jms.client.JmsConnection.<init>(JmsConnection.java:174)
at
org.exolab.jms.client.JmsConnectionFactory.createConnection(JmsConnectionFac
tory.java:284)
at
org.exolab.jms.client.JmsConnectionFactory.createConnection(JmsConnectionFac
tory.java:266)
----- Original Message -----
From: Tim<EMAIL_ADDRESS>Anderson
To<EMAIL_ADDRESS>Sent: Sunday, January 22, 2006 2:20 PM
Subject: RE: [openjms-user] Cannot connect to queue crossing Internet
Those aren't exceptions. They state what method is being invoked on the
server.
What exception stack trace do you get on the client?
_____
From<EMAIL_ADDRESS><EMAIL_ADDRESS>On Behalf Of Wayne Iriwn
Sent: Monday, 23 January 2006 7:06 AM
To<EMAIL_ADDRESS>Subject: Re: [openjms-user] Cannot connect to queue crossing Internet
I have removed the internalHost and tried again. Still the same results as
the first log sent.
Are these exceptions in the log important, I am not using RMI, but perhaps
it is under the covers.
14:00:47.766 DEBUG [ORB-Worker-1] - Invoking public abstract
org.exolab.jms.net.proxy.Proxy org.exol
ab.jms.net.registry.Registry.lookup(java.lang.String) throws
java.rmi.NotBoundException,java.rmi.Rem
oteException on<EMAIL_ADDRESS><EMAIL_ADDRESS>14:00:48.257 DEBUG [ORB-Worker-1] - Invoking public abstract
org.exolab.jms.server.ServerConnection
org.exolab.jms.server.ServerConnectionFactory.createConnection(java.lang.Str
ing,java.lang.String,jav
a.lang.String) throws javax.jms.JMSException on
org.exolab.jms.server.net.RemoteServerConnectionFact
<EMAIL_ADDRESS>----- Original Message -----
From: Tim<EMAIL_ADDRESS>Anderson
To<EMAIL_ADDRESS>Sent: Sunday, January 22, 2006 1:37 PM
Subject: RE: [openjms-user] Cannot connect to queue crossing Internet
If you specify the internalHost attribute, then it will be visible to
clients,
It is encoded in the server URI as the "alt" parameter.
This is used in the connection factories bound in JNDI.
-Tim
_____
From<EMAIL_ADDRESS><EMAIL_ADDRESS>On Behalf Of Wayne Iriwn
Sent: Monday, 23 January 2006 5:26 AM
To<EMAIL_ADDRESS>Subject: Re: [openjms-user] Cannot connect to queue crossing Internet
Is it normal for the internal IP address of the server to be showing up at
the client? That seems to be strange. Would JNDI be providing that
address?
----- Original Message -----
From: Tim<EMAIL_ADDRESS>Anderson
To<EMAIL_ADDRESS>Sent: Sunday, January 22, 2006 5:21 AM
Subject: RE: [openjms-user] Cannot connect to queue crossing Internet
You don't need to set internalHost. Its only used in situations where
you have clients connecting from both inside and outside the firewall.
See:
http://openjms.sourceforge.net/config/reference.html#TcpConfiguration
From the logs, it looks like the client has sucessfully connected to the
JNDI
service, but has failed to create a JMS connection, possibly due to
authentication
problems.
-Tim
_____
From<EMAIL_ADDRESS><EMAIL_ADDRESS>On Behalf Of Wayne Iriwn
Sent: Sunday, 22 January 2006 2:07 PM
To<EMAIL_ADDRESS>Subject: [openjms-user] Cannot connect to queue crossing Internet
I am trying to put together a JMS protoype system to test JMS
communications.
I am using openjms-0.7.7-alpha-3 on Sun Java 1.5.0_06-b05.
I have a remote client behind a firewall/router that I am trying to send a
message to a queue on a server behind a firewalled router. This should be a
standard arrangement.
The client is basically running the Sender example. I have configured the
jndi.properties file on the client to point to the servers router IP address
and port 1234.
I have setup port forwarding on the servers router 1234 port to the servers
IP address and port 1234.
I have configured the openjms.xml file as follows
<?xml version="1.0"?>
<!-- Definitions at
http://openjms.sourceforge.net/config/reference.html#ConnectionFactories -->
<Configuration>
<DatabaseConfiguration>
<!-- Info at
http://dev.mysql.com/doc/refman/5.1/en/cj-configuration-properties.html -->
<RdbmsDatabaseConfiguration
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/jmsdb"
user="xxxx"
password="xxxxxxx"
maxActive="10"
maxIdle="10" />
</DatabaseConfiguration>
<AdminConfiguration script="${openjms.home}\bin\startup.bat" />
<ServerConfiguration host="<IP_ADDRESS>" embeddedJNDI="true" />
<Connectors>
<Connector scheme="tcp">
<ConnectionFactories>
<ConnectionFactory name="ConnectionFactory" />
<QueueConnectionFactory name="JmsQueueConnectionFactory" />
<TopicConnectionFactory name="JmsTopicConnectionFactory" />
</ConnectionFactories>
</Connector>
<TcpConfiguration internalHost="localhost" port="1234" jndiPort="1234"
adminPort="1234" bindAll="true" />
</Configuration>
When I run the test, it does not work. The client end reports
java.net.ConnectionException: javax.jms.JMSException: Failed to connect to
<IP_ADDRESS>:1234
The server log looks like
20:58:53.150 INFO [main] - Creating RdbmsAdapter for com.mysql.jdbc.Driver
20:58:53.861 INFO [main] - Removed expired messages.
20:58:53.861 INFO [main] - Registering Garbage Collection every 60000 for
memory.
20:58:53.861 INFO [main] - Registering Garbage Collection every 120000 for
other resources.
20:58:53.871 DEBUG [main] - addConsumerEntry(key=sub2,
destination=topic1-true, clientID=null, durable=true)
20:58:54.021 DEBUG [main] - getMessageHandles,130
20:58:54.021 DEBUG [main] - addConsumerEntry(key=sub1,
destination=topic1-true, clientID=null, durable=true)
20:58:54.021 DEBUG [main] - getMessageHandles,0
20:58:54.041 INFO [main] - Creating server interface for the tcp connector
20:58:54.071 DEBUG [main] - Created an instance of
org.exolab.jms.server.net.RemoteServerConnector as a server interface
20:58:54.232 DEBUG [main] - Acceptor accepting requests at
URI=tcp://<IP_ADDRESS>:1234/
20:58:54.242 INFO [main] - Server accepting connections on
tcp://<IP_ADDRESS>:1234/?alt=localhost
20:58:54.252 INFO [main] - JNDI service accepting connections on
tcp://<IP_ADDRESS>:1234/?alt=localhost
20:58:54.252 INFO [main] - Admin service accepting connections on
tcp://<IP_ADDRESS>:1234/?alt=localhost
20:58:54.282 DEBUG [main] - Bound connection factory ConnectionFactory
20:58:54.282 DEBUG [main] - Bound connection factory
JmsQueueConnectionFactory
20:58:54.282 DEBUG [main] - Bound connection factory
JmsTopicConnectionFactory
20:59:06.289 DEBUG [tcp://<IP_ADDRESS>:1234/[acceptor]] -
Multiplexer(uri=tcp://3<IP_ADDRESS>:62582/, client=false
20:59:06.459 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
receive(length=43) [channelId=1, available=0, space=2048]
20:59:06.459 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
handleRequest() [channel=1]
20:59:06.469 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
handleRequest() [channel=1] - end
20:59:06.479 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=43]
20:59:06.479 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=41]
20:59:06.479 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=39]
20:59:06.479 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=38]
20:59:06.479 DEBUG [ORB-Worker-1] - read(length=30) [channelId=1,
available=37]
20:59:06.489 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=7]
20:59:06.489 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=6]
20:59:06.489 DEBUG [ORB-Worker-1] - read(length=4) [channelId=1,
available=4]
20:59:06.489 DEBUG [ORB-Worker-1] - Invoking public abstract
org.exolab.jms.net.proxy.Proxy
org.exolab.jms.net.registry.Registry.lookup(java.lang.String) throws
java.rmi.NotBoundException,java.rmi.RemoteException on
<EMAIL_ADDRESS>20:59:06.539 DEBUG [ORB-Worker-1] - waitForSpace() [channelId=1,
remoteSpace=2048]
20:59:06.539 DEBUG [ORB-Worker-1] - send(length=493) [channelId=1,
remoteSpace=2048]
20:59:06.980 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
receive(length=36) [channelId=1, available=0, space=2048]
20:59:06.980 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
handleRequest() [channel=1]
20:59:06.980 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
handleRequest() [channel=1] - end
20:59:06.980 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=36]
20:59:06.990 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=34]
20:59:06.990 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=32]
20:59:06.990 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=31]
20:59:06.990 DEBUG [ORB-Worker-1] - read(length=30) [channelId=1,
available=30]
20:59:06.990 DEBUG [ORB-Worker-1] - Invoking public abstract
javax.naming.NameParser
org.codehaus.spice.jndikit.NamingProvider.getNameParser() throws
javax.naming.NamingException,java.lang.Exception on
<EMAIL_ADDRESS>20:59:07.000 DEBUG [ORB-Worker-1] - waitForSpace() [channelId=1,
remoteSpace=1555]
20:59:07.000 DEBUG [ORB-Worker-1] - send(length=68) [channelId=1,
remoteSpace=1555]
20:59:07.481 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
receive(length=36) [channelId=1, available=0, space=2048]
20:59:07.481 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
handleRequest() [channel=1]
20:59:07.481 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
handleRequest() [channel=1] - end
20:59:07.481 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=36]
20:59:07.481 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=34]
20:59:07.481 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=32]
20:59:07.481 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=31]
20:59:07.491 DEBUG [ORB-Worker-1] - read(length=30) [channelId=1,
available=30]
20:59:07.491 DEBUG [ORB-Worker-1] - Invoking public abstract
javax.naming.NameParser
org.codehaus.spice.jndikit.NamingProvider.getNameParser() throws
javax.naming.NamingException,java.lang.Exception on
<EMAIL_ADDRESS>20:59:07.491 DEBUG [ORB-Worker-1] - waitForSpace() [channelId=1,
remoteSpace=1487]
20:59:07.501 DEBUG [ORB-Worker-1] - send(length=68) [channelId=1,
remoteSpace=1487]
20:59:07.901 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
receive(length=358) [channelId=1, available=0, space=2048]
20:59:07.901 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
handleRequest() [channel=1]
20:59:07.901 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
handleRequest() [channel=1] - end
20:59:07.901 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=358]
20:59:07.901 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=356]
20:59:07.901 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=354]
20:59:07.901 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=353]
20:59:07.901 DEBUG [ORB-Worker-1] - read(length=30) [channelId=1,
available=352]
20:59:07.911 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=322]
20:59:07.911 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=321]
20:59:07.911 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=320]
20:59:07.911 DEBUG [ORB-Worker-1] - read(length=25) [channelId=1,
available=318]
20:59:07.911 DEBUG [ORB-Worker-1] - read(length=8) [channelId=1,
available=293]
20:59:07.911 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=285]
20:59:07.911 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=284]
20:59:07.911 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=282]
20:59:07.911 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=281]
20:59:07.921 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=280]
20:59:07.921 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=279]
20:59:07.921 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=278]
20:59:07.921 DEBUG [ORB-Worker-1] - read(length=20) [channelId=1,
available=276]
20:59:07.921 DEBUG [ORB-Worker-1] - read(length=8) [channelId=1,
available=256]
20:59:07.921 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=248]
20:59:07.921 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=247]
20:59:07.921 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=245]
20:59:07.921 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=244]
20:59:07.921 DEBUG [ORB-Worker-1] - read(length=8) [channelId=1,
available=242]
20:59:07.931 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=234]
20:59:07.931 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=233]
20:59:07.931 DEBUG [ORB-Worker-1] - read(length=22) [channelId=1,
available=231]
20:59:07.931 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=209]
20:59:07.931 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=208]
20:59:07.931 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=207]
20:59:07.931 DEBUG [ORB-Worker-1] - read(length=19) [channelId=1,
available=205]
20:59:07.931 DEBUG [ORB-Worker-1] - read(length=8) [channelId=1,
available=186]
20:59:07.941 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=178]
20:59:07.941 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=177]
20:59:07.941 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=175]
20:59:07.941 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=174]
20:59:07.941 DEBUG [ORB-Worker-1] - read(length=10) [channelId=1,
available=172]
20:59:07.941 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=162]
20:59:07.941 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=161]
20:59:07.941 DEBUG [ORB-Worker-1] - read(length=9) [channelId=1,
available=159]
20:59:07.941 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=150]
20:59:07.941 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=149]
20:59:07.951 DEBUG [ORB-Worker-1] - read(length=8) [channelId=1,
available=148]
20:59:07.951 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=140]
20:59:07.951 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=139]
20:59:07.951 DEBUG [ORB-Worker-1] - read(length=8) [channelId=1,
available=138]
20:59:07.961 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=130]
20:59:07.961 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=129]
20:59:07.961 DEBUG [ORB-Worker-1] - read(length=21) [channelId=1,
available=127]
20:59:07.961 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=106]
20:59:07.961 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=105]
20:59:07.961 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=103]
20:59:07.961 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=102]
20:59:07.961 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=101]
20:59:07.961 DEBUG [ORB-Worker-1] - read(length=21) [channelId=1,
available=99]
20:59:07.971 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=78]
20:59:07.971 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=77]
20:59:07.971 DEBUG [ORB-Worker-1] - read(length=13) [channelId=1,
available=75]
20:59:07.971 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=62]
20:59:07.971 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=61]
20:59:07.971 DEBUG [ORB-Worker-1] - read(length=22) [channelId=1,
available=59]
20:59:07.971 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=37]
20:59:07.971 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=36]
20:59:07.971 DEBUG [ORB-Worker-1] - read(length=5) [channelId=1,
available=34]
20:59:07.971 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=29]
20:59:07.971 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=28]
20:59:07.981 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=27]
20:59:07.981 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=26]
20:59:07.981 DEBUG [ORB-Worker-1] - read(length=4) [channelId=1,
available=25]
20:59:07.991 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=21]
20:59:07.991 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=20]
20:59:07.991 DEBUG [ORB-Worker-1] - read(length=17) [channelId=1,
available=18]
20:59:07.991 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=1]
20:59:07.991 DEBUG [ORB-Worker-1] - Invoking public abstract
java.lang.Object
org.codehaus.spice.jndikit.NamingProvider.lookup(javax.naming.Name) throws
javax.naming.NamingException,java.lang.Exception on
<EMAIL_ADDRESS>20:59:08.001 DEBUG [ORB-Worker-1] - waitForSpace() [channelId=1,
remoteSpace=1419]
20:59:08.001 DEBUG [ORB-Worker-1] - send(length=670) [channelId=1,
remoteSpace=1419]
20:59:08.382 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
notifyRead(read=1026) [channelId=1, remoteSpace=1775]
20:59:08.382 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
receive(length=45) [channelId=1, available=0, space=2048]
20:59:08.382 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
handleRequest() [channel=1]
20:59:08.382 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
handleRequest() [channel=1] - end
20:59:08.392 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=45]
20:59:08.392 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=43]
20:59:08.392 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=41]
20:59:08.392 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=40]
20:59:08.392 DEBUG [ORB-Worker-1] - read(length=30) [channelId=1,
available=39]
20:59:08.392 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=9]
20:59:08.392 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=8]
20:59:08.392 DEBUG [ORB-Worker-1] - read(length=6) [channelId=1,
available=6]
20:59:08.402 DEBUG [ORB-Worker-1] - Invoking public abstract
org.exolab.jms.net.proxy.Proxy
org.exolab.jms.net.registry.Registry.lookup(java.lang.String) throws
java.rmi.NotBoundException,java.rmi.RemoteException on
<EMAIL_ADDRESS>20:59:08.402 DEBUG [ORB-Worker-1] - waitForSpace() [channelId=1,
remoteSpace=1775]
20:59:08.402 DEBUG [ORB-Worker-1] - send(length=502) [channelId=1,
remoteSpace=1775]
20:59:08.883 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
receive(length=39) [channelId=1, available=0, space=2048]
20:59:08.883 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
handleRequest() [channel=1]
20:59:08.883 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
handleRequest() [channel=1] - end
20:59:08.883 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=39]
20:59:08.883 DEBUG [ORB-Worker-1] - read(length=2) [channelId=1,
available=37]
20:59:08.883 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=35]
20:59:08.883 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=34]
20:59:08.883 DEBUG [ORB-Worker-1] - read(length=30) [channelId=1,
available=33]
20:59:08.893 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=3]
20:59:08.893 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=2]
20:59:08.893 DEBUG [ORB-Worker-1] - read(length=1) [channelId=1,
available=1]
20:59:08.893 DEBUG [ORB-Worker-1] - Invoking public abstract
org.exolab.jms.server.ServerConnection
org.exolab.jms.server.ServerConnectionFactory.createConnection(java.lang.Str
ing,java.lang.String,java.lang.String) throws javax.jms.JMSException on
<EMAIL_ADDRESS>20:59:08.913 DEBUG [ORB-Worker-1] - waitForSpace() [channelId=1,
remoteSpace=1273]
20:59:08.913 DEBUG [ORB-Worker-1] - send(length=482) [channelId=1,
remoteSpace=1273]
20:59:09.283 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
notifyRead(read=1037) [channelId=1, remoteSpace=1828]
20:59:21.341 DEBUG [ManagedConnectionReaper1] - send(type=0x20,
channel=32769)
20:59:21.341 DEBUG [ManagedConnectionReaper1] - ping [channel=32769]
20:59:21.351 DEBUG [ManagedConnectionReaper1] - send(type=0x50,
channel=32769)
20:59:21.421 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
send(type=0x51, channel=2)
20:59:21.441 DEBUG [ManagedConnectionReaper1] - ping [channel=32769] - end
20:59:36.342 DEBUG [ManagedConnectionReaper1] - ping [channel=32769]
20:59:36.342 DEBUG [ManagedConnectionReaper1] - send(type=0x50,
channel=32769)
20:59:36.412 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
send(type=0x51, channel=2)
20:59:36.432 DEBUG [ManagedConnectionReaper1] - ping [channel=32769] - end
20:59:51.344 DEBUG [ManagedConnectionReaper1] - ping [channel=32769]
20:59:51.344 DEBUG [ManagedConnectionReaper1] - send(type=0x50,
channel=32769)
20:59:51.424 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
send(type=0x51, channel=1)
20:59:51.444 DEBUG [ManagedConnectionReaper1] - ping [channel=32769] - end
20:59:52.856 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
disconnected [channel=2]
20:59:52.856 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
disconnected [channel=32769]
20:59:52.856 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
disconnected [channel=1]
20:59:52.856 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
Connection<EMAIL_ADDRESS>closed by
peer, destroying
20:59:52.866 DEBUG [tcp://3<IP_ADDRESS>:62582/[server]-Multiplexer] -
Detected disconnection of caller=tcp://3<IP_ADDRESS>:62582/. Cleaning up
resources
20:59:53.877 DEBUG [EventManager-Worker-0] - GC Threshold=517720 Free=755408
I have tested this successfully inside the a LAN, but when I try to cross
the Internet, it fails. Is seems so close to conencting.
The biggest anomaloy is that the client is reporting it cannot connect to
the IP address <IP_ADDRESS>, which is the DHSCP address of my server inside
the router. I don't believe that the client should every be seeing the
internal IP address. Is this a bug in OpenJMS or a miss configuration on my
behalf.
Anyone got any suggestions?
|


Components
{% block colors %}Colors
{% include '../components/colors.html' %}
Icons
{% include '../components/icons.html' %}
Typography
{% include '../components/typography.html' %}
Lists
{% include '../components/lists.html' %}
Tables
{% include '../components/tables.html' %}
Forms
{% include '../components/forms.html' %}
Page Elements
{% block page_block_inner %} {% block page_titles %}Page-titles
{% include '../page-elements/page-titles.html' %}
UX Elements
{% block uxinner %} {% block transitions %}Transitions
{% include '../ux-elements/transitions.html' %}
UI-elements
{% include '../ux-elements/ui-elements.html' %}


Create easily adoptable labs (only a browser is needed)
Inform students how to create accessible software
Demonstrate the importance of creating accessible software
Learn about designing the web for the Deaf and Hard-of-Hearing community.
Learn more about designing the web for color blind individuals.
Learn more about Screen Readers.
Learn more about designing the web for individuals with motor and dexterity impairments.


Let's play Rock, Paper, Scissors, Lizard, Spock! The rules are easy:
Scissors cuts Paper, Paper Covers Rock, Rock crushes Lizard, Lizard poisons Spock, Spock smashes Scissors, Scissors decapitates Lizard, Lizard eats Paper, Paper disproves Spock, Spock vaporizes Rock and - as it always has - Rock crushes Scissors. Check out this really cool flowchart:


Language Types and How They Differ
Visual Languages
A visual language is a programming language which eliminates text-based programming and replaces that process by using elements. Whilst text-based programming such as scripting and object-oriented programming makes you think and process the procedure as a computer does, visual languages allow you to build programs in a way that makes sense to humans. A well-used example of visual language programming can be found in Scratch, which is utilised in schools as a gateway to computer science and programming.
Scratch is a program which allows its users to program their own interactive games, stories and produce animations. What it does is through an intuitive interface where the user can simply drag-and-drop elements which dictate how the animation takes place. These projects can then be downloaded as a standalone file and ran without the use of the Scratch IDE. This does require the use of Flash, so the program must be used on a device which supports this.
The general purpose of a visual Language is to introduce more people, particularly children, to the world of programming. From this stage, the user can move on to the other forms of programming and eventually begin to understand how a computer thinks and how this can be utilised in programming.
A great example of visual programming can be found here, which is called ‘Space Chomp’ created by the user ‘jsh’. This project is readily available on the Scratch website here.
Scripting Languages
A scripting language is a programming language which supports programs that are automatically executed at runtime. Where they differ greatly from some programming languages is that they do not need to be compiled to be executed. This means the script is interpreted rather than compiled. The more well-known example of a scripting language is JavaScript.
JavaScript is a scripting language which allows a developer to create content that can dynamically update, control forms of multimedia such as audio and video, or pretty much anything else which can be included in a website. Much like other programming languages, JavaScript can store data by using variables, operate on specific strings of text, and run processes if a certain condition is met. JavaScript is how developers make websites interactive, as this scripting language allows clients to experience animations on a website, one of the most notable being the use of slideshows. Without the use of JavaScript, websites would appear bland to a user whilst navigating, giving the user a negative impression of the website owner.
Much like other programming languages, JavaScript and other scripting languages can be developed in a simple text editor such as notepad or brackets. The files only need the correct file extension in order to be recognised as a script. In the case of JavaScript, the file must be referenced in the webpage’s head tag, which means the file will be loaded when the webpage is loaded.
An example of JavaScript can be found below, which dislays a different message depending on your time.
Markup Languages
A markup language is a programming language that uses tags to outline/define elements of a selected document. Unlike many other programming languages, a markup language is readable to people who lack computing experience and does not follow regular programming syntax found within an application or JavaScript script. One of the most common example of a markup language is HTML.
HTML (HyperText Markup Language) is the markup language used as the backbone of websites. Unlike XML (another popular example), HTML uses predetermined tags which are used to represent the content and structure of a webpage. The most common and easy to utilise examples of HTML tags are the html, head, body, div, p and h1 tags. Each of these tags is used to represent different elements on a webpage, allowing the maximum customisation and control of the webpage. Whilst HTML cannot be used to format the webpage very easily; there are other languages available to do just that, particularly CSS (Cascading Style Sheet).
HTML can be authored in any text-editor, ranging from notepad to brackets. The file only needs to be saved with the necessary file extension to be registered as an HTML file, and then be displayed by your browser.
An example of HTML can be found on this very webpage! Here are the barebones of the navigation bar that spans the top of your browser window.


Hotkeys
Pause/resume recorder
Insert callback
Insert move to current mouse position
Options
Element selection strategy
Use path of element
Use text of element
Wait for
displayed
element (use
findDisplayed
)


{% extends "layout_task-list.html" %} {% block page_title %} Money Claims Prototype {% endblock %} {% block home_link %} /prototype-14/index {% endblock %} {% block content %} {% include "includes/phase_banner_beta.html" %} Sorry, you can't use the service You must be 18 or over to use the service. {% endblock %}
You must be 18 or over to use the service.