Questions which have a clear and unambiguous answer.
Wording without fluff or jargon
So that we offer help if a customer makes a mistake
Inputs so that even if the user strays from the "normal use case" their data can still be used.
Use the field set to represent a set of form controls e.g ADDRESS DETAILS or Payments. The headings separate sections on the page and make it easy for the user to navigate the form.

ADDRESS DETAILS

Use a sub section heading when there are multiple inputs to answer. For example radio buttons or check boxes. The sub section heading contains the "question text" in these situations.

Home address

A good label significantly helps form conversion by adding clarity without overwhelming users.
The purpose of the label is to indicate what data is required in the field. All input fields are required to have labels.
Labels should be clear and easy to understand. If the label is ambiguous, users will either guess an answer causing problems down the track, or leave the form altogether.
PHONE NUMBER
Field length that goes over 60 characters as this creates poor readability. In an extreme case 90 Characters is an absolute maximum.
<input id="firstName" name="firstName" type="text" maxlength="24" class="control control-input control-input--text"></input>
<input id="male">Male></input>
<input id="male">Male></input>
<select class="control control-input control-input--select"></select>
<input type="checkbox" class="copy">This is my postal address
This is my postal address
Alerts are to following the following pattern. Advise the user what has happened and - if applicable - what the next steps are.

Disclaimer
text-small


|
|
|
|
|
Forward this email between the four desktop webmails of Gmail, Outlook.com, Yahoo and AOL. A mushroom will appear every time you get a step right. A red block indicates the step this webmail is at. If you get a red block or no new mushroom, you must go back to the previous webmail to forward it again.
Find the right order to win !
Rémi
@HTeuMeuLeu


| # | Name | Subject ID |
|---|
| # | File Name | Description | File Type | File Link | SubjectId |
|---|
| # | Question | Right Answer | Wrong Answers | Chapter | SubjectId |
|---|
| # | Question | Answer | SubjectId |
|---|
| # | Name | Subject ID |
|---|
| # | File Name | Description | File Type | File Link | SubjectId |
|---|
| # | Question | Right Answer | Wrong Answers | Chapter | SubjectId |
|---|
| # | Question | Answer | SubjectId |
|---|


About IOS - CLI Migrator
It has three main applitcation:
- Cli search
cli search is a forum where the latest IOS and polaris commands / configurations are available. Ciso uses is given the below options to choose from
- Cli migration
- Add new IOS- Polaris CLI map


Structurizr for Java
This GitHub repository is a Java library to create software architecture models that are compatible with Structurizr, a SaaS to create web-based software architecture diagrams. In summary:
- Create a software architecture model using Java code, either manually or by extracting information from an existing codebase.
- Upload the model (as a JSON document) to Structurizr using the web API.
- Visualise and share the resulting software architecture diagrams (example).


--- layout: post title: Today's question - creating record relationships from the ServiceAPI categories: [] tags: serviceapi dotnet-serviceapi-client status: publish type: post published: true meta: {} ---
In HPRM records may have a variety of different relationships, from 'Redaction of' to 'Related to'. These relationships are managed in both the SDK and ServiceAPI via the child collection construct. To add a relationship you add a new item to the ChildRelationships collection, to remove a relationship you remove an item from this collection.
This code will create a new relationship using the .Net client for the ServiceAPI.
TrimClient trimClient = new TrimClient("http://MyHost]/ServiceAPI"); trimClient.Credentials = System.Net.CredentialCache.DefaultCredentials; Record record = new Record() { Uri =<PHONE_NUMBER> }; record.ChildRelationships = new List<RecordRelationship>() { new RecordRelationship() { RelatedRecord = new RecordRef() { Uri =<PHONE_NUMBER>}, RelationType = RecordRelationshipType.IsRelatedTo }}; trimClient.Post<RecordsResponse>(record);
Assuming you are using jQuery this code will create a record relationship from Javascript, the complete code can be found here.
$().ready(function () { $('#recordRelationship').submit(function () { var data = { "Uri": $("input[name=Uri]").val() } data["ChildRelationships"] = [{ "RecordRelationshipRelatedRecord": $("input[name=RelatedUri]").val(), "RecordRelationshipRelationType": "IsRelatedTo" }]; $.ajax({ url: "Record", type: 'POST', contentType: 'application/json', data: JSON.stringify(data) }) .done(function (response, statusText) { alert("success"); }) .fail(function (xhr) { var err = eval("(" + xhr.responseText + ")"); alert(err.ResponseStatus.Message); }); return false; }); });


Development Blog
Mar 10 - Christmas?
Packages came today! First a small box from Singapore containing $60 worth of displays. (not all for me...)
Funnily enough the contents were marked as a gift on the customs forms, but they were honest with the dollar amount.
Next, two much larger boxes arrived from DuPont containing the sample Pyralux kaptan circuit board material that I requested
a couple of weeks ago. You have to give DuPont credit for being incredibly generous, I sent them an email asking if they would
be willing to sell/send me a single sheet of one of their cheaper products since you can't buy the stuff in small amounts from
distributors. After asking a few questions about my project they instead opted to send me 12sq. feet of two of their nicest materials.
Obviously they don't have smaller-sized boxes, the few sheets of each material came in a large box with a few inches of cardboard and
plastic padding. I've uploaded a couple of images of the displays and kaptan on the media page. (A few were taken with my phone
camera and they're terribly fuzzy...)
Mar 9 - Hardware Design & Spring Break
I've put together a "ToDo" list on the hardware page, indicating what and when things are going to have to be done. Along with that I've set
up the references page so that as I choose non-trivial components I'll be adding links to their datasheets there.
I'm going to try to get the component planning done over the spring break in addition to designing a few small breakout boards for
the sensors and OLED display. The displays I ordered a few weeks ago should be arriving tomorrow and I want to set one of them up
so I can prototype drivers.
Mar 5 - GitHub
There is now a public GitHub for this project at:
https://github.com/BMellor/intelliDesk
Mar 5 - Website Up!
I've gotten the website (sorta) put together. Right now everything is just placeholders, but hopefully some content will start appearing over the next few weeks.
I'm planning to update this blog at least weekly to keep me on track with development (and to stop me from forgetting everything I just worked on... )
I'm pretty lazy when it comes to this type of stuff, we'll have to see how the blog works out.


{{ "" | safeHTML }} {{ with .Site.Params.about.headline }} {{ . }} {{ end }} {{ if and .Site.Params.about.headline .Site.Params.about.description }} {{ end }} {{ with .Site.Params.about.description }} {{ . | markdownify }} {{ end }} {{ with .Site.Params.about.headline }} My focus {{ end }} {{ if and .Site.Params.about.headline .Site.Params.about.description }} {{ end }} {{ with .Site.Params.about.description }} Experience is everything: To design functional digital experiences that engage with the user and deliver effective journeys. {{ end }} {{ with .Site.Params.about.buttonText }} {{ . }} {{ end }}
{{ . | markdownify }}
Experience is everything: To design functional digital experiences that engage with the user and deliver effective journeys.


But be aware: Security through obscurity is no security at all.
Can offer a small layer of protection against brute force attacks.
define( 'DISALLOW_FILE_EDIT', true );
Ensures that input is secure before using it in your code.
What if we had a very narrow set of valid responses?
function ga_validate_yes_no( $some_input ) {
if ( in_array( $some_input, array( 'yes', 'no' ), true ) ) {
return $some_input;
}
}
Be sure to use strict type checking.
// will evaluate to integer 1 during loose comparisons
$untrusted_input = '1 malicious string';
// == would have evaluated to true, but === evaluates to false
if ( 1 === $untrusted_input ) {
echo '
Valid data
';
} else {
wp_die( 'Invalid data' );
}
is_bool()
is_float()
is_int()
is_numeric()
is_string()
Removes the elements we don't want from data.
sanitize_text_field()
absint()
esc_url_raw()
sanitize_email()
sanitize_file_name()
sanitize_key()
sanitize_title()
esc_html()
esc_url()
esc_js()
esc_attr()


What's New Scaper!
Scrape the website and add your notes on new items you want to try!
Scape What's New


It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters,as oppos ed to using 'Content here,
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters,as oppos ed to using 'Content here,
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters,as oppos ed to using 'Content here,
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters,as oppos ed to using 'Content here,
Lead Designer
Lead Marketer
Lead Developer
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut eaque, laboriosam veritatis, quos non quis ad perspiciatis, totam corporis ea, alias ut unde.
Free Web Design
Contact Us Now


It is often convenient to attach more than one event handler for an event. EventDispatcher allows you to stack event handlers upon one another, rather than replacing them outright. The event will propogate from the top of the stack to the bottom, but can be stopped by any handler along the way.
To push an event handler onto the stack, use the push_handlers method:
def on_key_press(symbol, modifiers): if symbol == key.SPACE fire_laser() window.push_handlers(on_key_press)
As a convenience, the @event decorator can be used as an alternative to push_handlers:
@window.event def on_key_press(symbol, modifiers): if symbol == key.SPACE fire_laser()
One use for pushing handlers instead of setting them is to handle different parameterisations of events in different functions. In the above example, if the spacebar is pressed, the laser will be fired. After the event handler returns control is passed to the next handler on the stack, which on a Window is a function that checks for the ESC key and sets the has_exit attribute if it is pressed. By pushing the event handler instead of setting it, the application keeps the default behaviour while adding additional functionality.
You can prevent the remaining event handlers in the stack from receiving the event by returning a true value. The following event handler, when pushed onto the window, will prevent the escape key from exiting the program:
def on_key_press(symbol, modifiers): if symbol == key.ESCAPE: return True window.push_handlers(on_key_press)
You can push more than one event handler at a time, which is especially useful when coupled with the pop_handlers function. In the following example, when the game starts some additional event handlers are pushed onto the stack. When the game ends (perhaps returning to some menu screen) the handlers are popped off in one go:
def start_game(): def on_key_press(symbol, modifiers): print 'Key pressed in game' return True def on_mouse_press(x, y, button, modifiers): print 'Mouse button pressed in game' return True window.push_handlers(on_key_press, on_mouse_press) def end_game(): window.pop_handlers()
Note that you do not specify which handlers to pop off the stack -- the entire top "level" (consisting of all handlers specified in a single call to push_handlers) is popped.
You can apply the same pattern in an object-oriented fashion by grouping related event handlers in a single class. In the following example, a GameEventHandler class is defined. An instance of that class can be pushed on and popped off of a window:
class GameEventHandler(object): def on_key_press(self, symbol, modifiers): print 'Key pressed in game' return True def on_mouse_press(self, x, y, button, modifiers): print 'Mouse button pressed in game' return True game_handlers = GameEventHandler() def start_game() window.push_handlers(game_handlers) def stop_game() window.pop_handlers()


Contains many functions useful for monitoring and reporting the results of clinical trials and other experiments in which treatments are compared. LaTeX is used to typeset the resulting reports, recommended to be in the context of 'knitr'. The 'Hmisc', 'ggplot2', and 'lattice' packages are used by 'greport' for high-level graphics.
| Version: | 0.7-1 |
| Depends: | Hmisc (≥ 3.17-0), data.table |
| Imports: | rms (≥ 4.4-1), lattice, latticeExtra, ggplot2, Formula, survival, methods |
| Published: | 2016-04-10 |
| Author: | Frank E Harrell Jr |
| Maintainer: | Frank E Harrell Jr <f.harrell at vanderbilt.edu> |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| URL: | http://biostat.mc.vanderbilt.edu/Greport, https://github.com/harrelfe/greport |
| NeedsCompilation: | no |
| Materials: | README NEWS |
| CRAN checks: | greport results |
| Reference manual: | greport.pdf |
| Package source: | greport_0.7-1.tar.gz |
| Windows binaries: | r-devel: greport_0.7-1.zip, r-release: greport_0.7-1.zip, r-oldrel: greport_0.7-1.zip |
| OS X binaries: | r-release: greport_0.7-1.tgz, r-oldrel: greport_0.7-1.tgz |
| Old sources: | greport archive |
Please use the canonical form https://CRAN.R-project.org/package=greport to link to this page.


Running NodeRED on Heroku with Salesforce
I am a big fan of NodeRED, so I was delighted to see nodes available to connect to Salesforce.
Since the package was a little behind and support for platform events was still missing, I had a chat with Jeff and we agreed that I would maintain the package moving forward.
I updated the package dependencies to current version and made two main changes to the functionality:
- allow credentials to be read from environment variables. This allows for easy deployment to Heroku
- Support for Salesforce platform events
Deployment to Heroku is a breeze, but requires a few steps that I document here.
The instructions require a basic understanding how Heroku works, so you might want to check out a tutorial first. There are some challenges to overcome:
- I want to be able to test local and on the server
- Storage on Heroku is ephemeral. Any changes written to the server's file system get reset on restart
- Deployment should happen via version control
Prerequisites
- Current version of NodeJS installed (I usually stick to the LTS version)
- GIT client installed (or GIT as part of your favorite IDE)
- Heroku CLI (a.k.a Toolbelt) installed. Install using
npm install -g heroku-cli
Project setup (Command line work)
- Create a new directory
NodeRedDemo
and change into it - Initialize a new project
npm init
- fill in suitable defaults - Create a file
.gitignore
(content see below) - add NodeRED and the Salesfore nodes
npm install -s node-red node-red-contrib-salesforce
- add a line into
package.json
(see sample below) in scripts:"start": "node-red --settings ./.node-red/settings.js --userDir ./.node-red"
- create the directories
scripts
and.node-red
- copy the
settings.js
file fromnode_modules/node-red
to.node-red
- We will edit that file later - initialize git:
git init
- add initial files to git:
git add --all
andgit commit -m "initial creation"
- login to heroku
heroku login
- add Heroku:
heroku create
- deploy:
git push heroku master
Your application should be running on Heroku now. To learn how to use NodeRED, check out a tutorial. Besides running on Heroku you can start the application on local too. Just use npm start
and load localhost:1880.
What is missing: protect your NodeRED editor, connect to Salesforce and of course: create your flows.
Keep in mind: every time you redeploy or restart the app, anything stored, including your flow definitions, gets lost.
For permanent results I create my flows in the local instance of NodeRED and commit the flow file (in the .node-red directory) to git, so it becomes part of the deployment.
Utility scripts
In my script directory I have 2 scripts one local.sh
and one heroku.sh
. Remember: the scripts directory is excluded from git. The scripts are my shortcuts to setup the right environment variables, so heroku and local run with the same credentials. In my NodeRED flows I named the connection to Salesforce SFDC
. This is used as prefix for the environment variables. You could set the variables in the Heroku UI too.
settings.js
To setup NodeRED security, check the documentation. Eventually I will reconfigure my instance to authenticate aginst Salesforce, but that's a different story for a different time.
flowFile: (process.env.NODE_RED_FLOWFILE) ? process.env.NODE_RED_FLOWFILE : 'flows.json',
adminAuth: {
type: 'credentials',
users: [{
username: process.env.NODE_RED_USERNAME,
password: process.env.NODE_RED_PASSWORD,
permissions: '*'
}]
},
local.sh
!/bin/bash
export NODE_RED_USERNAME=RedAdmin
export NODE_RED_PASSWORD=[somepassword]
export SFDC_UserName=[salesforceuser]
export SFDC_PassWord=[password]
export SFDC_ConsumerKey=[somekey]
export SFDC_ConsumerSecret=[somesecret]
# Start in debug mode, remove --inspect if you don't need it
node --inspect node_modules/node-red/red.js --settings ./.node-red/settings.js --userDir ./.node-red
heroku.sh
You can do all this in the web GUI too
!/bin/bash
heroku config:set NODE_RED_USERNAME=RedAdmin
heroku config:set NODE_RED_PASSWORD=[somepassword]
heroku config:set SFDC_UserName=[salesforceuser]
heroku config:set SFDC_PassWord=[password]
heroku config:set SFDC_ConsumerKey=[somekey]
heroku config:set SFDC_ConsumerSecret=[somesecret]
.gitignore
node_modules/
scripts/
.npm
#NodeRed runtime stuff
.node-red/.config.json
.node-red/.sessions.json
.node-red/*.backup
package.json
{
"name": "nodereddemo",
"version": "0.2.1",
"description": "NodeRed Demo as Salesforce Middleware",
"engines": {
"node": ">8.0"
},
"scripts": {
"start": "node-red --settings ./.node-red/settings.js --userDir ./.node-red",
"debug": "node-red --inspector --settings ./.node-red/settings.js --userDir ./.node-red",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"nodered",
"salesforce",
"middleware"
],
"author"<EMAIL_ADDRESS>"license": "ISC",
"dependencies": {
"node-red": "^0.18.2",
"node-red-contrib-salesforce": "0.2.1",
"node-red-dashboard": "^2.6.2"
}
}
More on NodeRED, and Salesforce to follow in future posts.
As usual YMMV
Posted by Stephan H Wissel on 14 February 2018 | Comments (2) | categories: Heroku NodeRED Salesforce


Margin - Shorthand Property
To shorten the code, it is possible to specify all the margin properties in one property.
The margin property is a shorthand property for the following individual margin property.
- margin-top
- margin-right
- margin-bottom
- margin-left
If the margin property has four values:
margin:25px 50px 75px 100px;
- top margin is 25px
- right margin is 50px
- bottom margin is 75px
- left margin is 100px
If the margin property has three values:
margin:25px 50px 75px
- top margin is 25px;
- right and left margins are 50px;
- bottom margin is 75px;
If the margin property has two values:
margin:25px 50px;
- top and bottom margin are 25px.
- left and right margin are 50px.
If the margin property has one value:
margin:25px;
- all four margins are 25px;


{% extends "templates/panoptic_base.html" %} {% block title %}Panoptic - Donate{% endblock %} {% block meta_block %} {% include "templates/includes/meta_block.html" %} {% endblock %} {% block content %} We will Watch the Watchmen {{ frappe.utils.md_to_html(settings.donate_pitch) }} Donate Now Donated already? Ask your friends to donate as well. {% endblock %}


Hi, it’s nice to meet you! My name is Alphonce Kipngeno. I’m a photographic web developer based in Nairobi. It would be great to stay in touch.
Author: ALPHONCE


If you are interested, please contact us!
Phone Number:<PHONE_NUMBER>
Email<EMAIL_ADDRESS>When in doubt, go on Vacation :)


| Module | FFMpeg::MainOptions |
| In: |
lib/ffmpeg/main_options.rb
|
Set the duration specified in seconds. hh:mm:ss[.xxx] syntax is also supported
duration "600"
or
duration "00:10:00"
Set the input time offset in seconds.
This option affects all the input files that follow it. The offset is added to the timestamps of the input files. Specifying a positive offset means that the corresponding streams are delayed by ‘offset’ seconds.
offset "600"
or
offset "00:10:00"
Seek to given time position in seconds. hh:mm:ss[.xxx] syntax is also supported.
seek "600"
or
seek "00:10:00"
Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd", "ntsc-svcd", … ). All the format options (bitrate, codecs, buffer sizes) are then set automatically. Nevertheless you can specify additional options as long as you know they do not conflict with the standard.
target "vcd"


Aug 19, 2009: processing time: 0.02s | © 2000-2009 Attackpoint LLC contact | about orienteering | development | donate


$ whoami
Igor Laboriehttps://github.com/ilaborie/
Follow my Twitter account: @ilaborie
$ whoami
Prez is just a basic HTML slideshow system
Prez is build on modern web components: HTML5, CSS3.
The dynamic part is written in CoffeeScript.
It's also use great JavaScript libraries:
Zepto.js,
Moment.js,
Prism,
Hammer.js
I've just want to create my own slideshow system
Why create another HTML5 slideshow system?
Just for fun!
=> Others slideshows system are probably better than mine...
Prez support mobile devices with tap
and swipe
events.
Thanks to Hammer.js
To avoid move with mouse click just remove the hammer.js from index.html.


Neologia
Installation
#lang
in the Racket programming language, and can be installed as part of the
Racket ecosystem.
Instructions
- First, make sure you have a relatively recent version of Racket installed.
- Open a terminal and run
raco pkg install neologia
. - Run your files using
racket <mylexicon.rkt>
command, or open them in Dr. Racket and hit the play button.


Lecture 15 Cross-Section Modeling
This lecture uses the following packages:
tidyverse
GGally
15.1 Introduction
Modeling data gives you the possibility of predicting outside of the sample of data you have to extrapolate to observational units you have not observed (inference). In this lecture we will focus on how to do this in a cross-sectional setting (i.e., not over time). We will be trying to create a model of salary for recent college graduates. The result will be a model and a set of parameter estimates that can be used to predict the salary for a recent graduate our modeling process did not see (i.e., extrapolate).
15.2 Data
The National Science Foundation (NSF) runs the National Survey of College Graduates. We’ll use this data to compare salaries for different majors. For the rest of this lecture, I’ll assume you’ve downloaded the 2015 zip file and extracted the contents to a folder named “nscg”.
15.2.1 Layout
The raw data is in a fixed width format, so we’ll need to know what the layout is.
library(tidyverse)
layout <- read_table("data/nscg/LAYOUTPCG15.TXT", skip = 2, col_types = "ciciicc") %>%
slice(2:n())
Let’s see if there are any gaps by seing if there is a difference between the start and the last ending plus 1.
summary(layout$START - (lag(layout$END) + 1))
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0 0 0 0 0 0 1
15.2.2 Data Dictionary
The data dictionary is stored in an Excel file:
library(readxl)
dict <- read_xlsx("data/nscg/Dpcg15.xlsx")
The data dictionary provides more detail than the layout file, which is useful for identifying the variables we want to work with.
15.2.3 The 2015 National Survey of College Graduates
Processing this whole file will take some time.
raw_survey <- read_fwf("data/nscg/EPCG15.DAT", fwf_widths(layout$LENGTH, col_names = layout$LABEL))
For the factor variables, we can look at the Ppcg15.sas
file for the mappings from integer values into character vectors. The below functions accept a vector of integers and return a character vector.
15.2.4 Variable Definitions
From looking at the Excel file, we can determine the label mapping for each variable. The label mapping name is in the SAS_FMT
column. We can then look at the Ppcg15.sas
file to see the corresponding mapping. We just need to edit these mappings slightly so they fit into a factor definition. (There do exist packages that will do this for you, but the following process gives you more control.)
ethnicity <- function(x) {
factor(
x,
levels = 1:7,
labels = c(
"Asian, non-Hispanic ONLY",
"American Indian/Alaska Native, non-Hispanic ONLY",
"Black, non-Hispanic ONLY",
"Hispanic, any race",
"White, non-Hispanic ONLY",
"Non-Hispanic Native Hawaiian/Other Pacific Islander ONLY",
"Multiple Race"
)
)
}
work_activities <- function(x) {
work_mapping <- matrix(
ncol = 2, byrow = TRUE,
data = c(
"01", "Accounting, finance, contracts",
"02", "Basic res.-study to gain sci. knwldg prima. for its own sake",
"03", "Apld. res.-study to gain sci. knwldg to meet recognized need",
"04", "Dev.-knowledge from res. for the prod. of materials, devices",
"05", "Design of equipment, processes, structures, models",
"06", "Computer applications, programming, systems development",
"07", "Human Resources - inc. recruiting, personnel dev, training",
"08", "Managing or supervising people or projects",
"09", "Production, operations, maintenance (e.g., chip production)",
"10", "Prof. services (healthcare, fin. serv., legal serv., etc.)",
"11", "Sales, purchasing, marketing",
"12", "Quality or productivity management",
"13", "Teaching",
"14", "Other work activity"
)
)
return(factor(x, levels = work_mapping[,1], labels = work_mapping[,2]))
}
fields <- function(x) {
field_mapping <- matrix(
ncol = 2, byrow = TRUE,
data = c(
11, "Computer and information sciences",
12, "Mathematics and statistics",
21, "Agricultural and food sciences",
22, "Biological sciences",
23, "Environmental life sciences",
31, "Chemistry, except biochemistry",
32, "Earth, atmospheric and ocean sciences",
33, "Physics and astronomy",
34, "Other physical sciences",
41, "Economics",
42, "Political and related sciences",
43, "Psychology",
44, "Sociology and anthropology",
45, "Other social sciences",
51, "Aerospace, aeronautical and astronautical engineering",
52, "Chemical engineering",
53, "Civil and architectural engineering",
54, "Electrical and computer engineering",
55, "Industrial engineering",
56, "Mechanical engineering",
57, "Other engineering",
61, "Health",
62, "Science and mathematics teacher education",
63, "Technology and Technical Fields",
64, "Other S&E related fields",
71, "Management and administration fields",
72, "Education, except science and math teacher education",
73, "Social service and related fields",
74, "Sales and marketing fields",
75, "Art and Humanities Fields",
76, "Other Non-S&E fields"
)
)
return(factor(x, levels = as.numeric(field_mapping[,1]), labels = field_mapping[,2]))
}
locations <- function(x) {
location_mapping <- matrix(
ncol = 2, byrow = TRUE,
data = c(
"099", "US, Unspecified",
"100", "Albania",
"102", "Austria",
"103", "Belgium",
"104", "Bulgaria",
"109", "France",
"110", "Germany, not specified",
"116", "Greece",
"119", "Ireland",
"120", "Italy",
"126", "Netherlands",
"128", "Poland",
"132", "Romania",
"134", "Spain",
"136", "Sweden",
"137", "Switzerland",
"138", "United Kingdom, not specified",
"139", "England",
"140", "Scotland",
"142", "Northern Ireland",
"148", "Europe, not specified",
"149", "Central Europe, not specified",
"150", "Eastern Europe, not specified",
"152", "Northern Europe, not specified",
"153", "Southern Europe, not specified",
"154", "Western Europe, not specified",
"156", "Serbia/Montenegro/Kosovo",
"160", "Croatia",
"180", "USSR",
"186", "Belarus (Byelarus)",
"187", "Russia",
"193", "Ukraine",
"202", "Bangladesh",
"207", "China",
"210", "India",
"212", "Iran",
"213", "Iraq",
"214", "Israel",
"215", "Japan",
"216", "Jordan",
"217", "Korea, not specified",
"218", "South Korea",
"222", "Lebanon",
"223", "Macao",
"227", "Nepal",
"229", "Pakistan",
"231", "Philippines",
"232", "Qatar",
"233", "Saudi Arabia",
"236", "Sri Lanka",
"238", "Taiwan",
"239", "Thailand",
"240", "Turkey",
"242", "Vietnam",
"245", "Asia, not specified",
"247", "East Asia, not specified",
"252", "Middle East, not specified",
"255", "Southeast Asia, not specified",
"257", "Southwest Asia, not specified",
"301", "Canada",
"304", "North America, not specified",
"312", "El Salvador",
"315", "Mexico",
"318", "Central America, not specified",
"337", "Cuba",
"339", "Dominican Republic",
"343", "Jamaica",
"353", "Caribbean, not specified",
"375", "Argentina",
"377", "Brazil",
"379", "Colombia",
"380", "Ecuador",
"385", "Peru",
"388", "Venezuela",
"389", "South America, not specified",
"408", "Cameroon",
"415", "Egypt",
"417", "Ethiopia",
"421", "Ghana",
"436", "Morocco",
"437", "Mozambique",
"440", "Nigeria",
"449", "South Africa",
"462", "Africa, not specified",
"463", "Central Africa, not specified",
"464", "Eastern Africa, not specified",
"468", "North Africa, not specified",
"469", "Western Africa, not specified",
"470", "Southern Africa, not specified",
"471", "Eritrea",
"501", "Australia",
"514", "New Zealand",
"527", "Oceania, not specified"
)
)
return(factor(x, levels = location_mapping[,1], labels = location_mapping[,2]))
}
survey <- raw_survey %>%
transmute(
age = U_DEM_AGE,
gender = factor(U_DEM_GENDER),
race_ethnicity = ethnicity(U_DEM_MULTIPLE_RACE_ETHNICITY_CAT),
years_since_degree = 2015 - M_ED_MR_DEGREE_AWARD_YR,
degree_type = factor(
M_ED_MR_DEGREE_TYPE,
levels = 1:4,
labels = c('Bachelors', 'Masters', 'Doctorate', 'Professional')
),
current_location = locations(U_RESPONDENT_LOCATION_STATE_COUNTRY),
highschool_location = locations(L_ED_HS_SCHOOL_ST_CTRY_CD),
school_in_US = M_ED_MR_SCHOOL_REGION_US_NONUS == 'Y',
moved = current_location != highschool_location,
r1 = M_ED_MR_SCHOOL_CARNEGIE_CLS == "11",
field_of_study_group = factor(case_when(
O_ED_HD_MAJOR_ED_GRP_MAJOR_NEW == 1 ~ 'Computer and mathematical sciences',
O_ED_HD_MAJOR_ED_GRP_MAJOR_NEW == 2 ~ 'Biological, agricultural and environmental life sciences',
O_ED_HD_MAJOR_ED_GRP_MAJOR_NEW == 3 ~ 'Physical and related sciences',
O_ED_HD_MAJOR_ED_GRP_MAJOR_NEW == 4 ~ 'Social and related sciences',
O_ED_HD_MAJOR_ED_GRP_MAJOR_NEW == 5 ~ 'Engineering',
O_ED_HD_MAJOR_ED_GRP_MAJOR_NEW == 6 ~ 'S&E-Related Fields',
O_ED_HD_MAJOR_ED_GRP_MAJOR_NEW == 7 ~ 'Non-S&E'
)),
field_of_study = fields(O_ED_HD_MAJOR_ED_GRP_MINOR_NEW),
in_school = case_when(
N_ED_REF_WK_ENROLL_FT_PT_IND == '1' ~ TRUE,
N_ED_REF_WK_ENROLL_FT_PT_IND == '2' ~ TRUE,
TRUE ~ FALSE
),
work_activity = work_activities(F_JOB_WRK_ACTIVITY_PRIMRY),
salary = ifelse(H_JOB_SALARY_ANN == 9999998, NA, H_JOB_SALARY_ANN),
income = ifelse(H_JOB_TOTAL_INCOME == 9999998, NA, H_JOB_TOTAL_INCOME)
)
15.2.5 Training/Validation/Test Sets
There are several things we need to do with this data.
- We want to create candidate models of salary
- We want to select a model based on its predictive accuracy
- We want to produce an estimate of the predictive accuracy of our chosen model
To accomplish these three goals, we need divide our data into three parts. The reason we need to split our data, is to avoid bias in our inferences. Bias is a systematic mistake in our inferences, which is bad. Since we are decreasing our sample size we will be increasing the variance of our inferences. This bias-variance tradeoff is an important concept in machine learning, but here we’ll just recognize it exists.
We will call the data for (1) our training dataset, the data for (2) our validation dataset, and the data for (3) our test set. For simplicity here we’ll split our data 80%-10%-10% into our training-validation-test sets. An easy way to grab random chunks of the data is to permute the indices, then take the first 80%, then 10%, etc.
Let’s make a decision up front to predicr
survey <- survey %>% filter(salary > 0)
train_size <- round(nrow(survey) * 0.8)
validation_size <- round(nrow(survey) * 0.1)
test_size <- nrow(survey) - train_size - validation_size
permuted_indices <- sample(1:nrow(survey))
train <- survey[permuted_indices[1:train_size],]
validation <- survey[permuted_indices[(train_size + 1):validation_size],]
test <- survey[permuted_indices[(validation_size + 1):length(permuted_indices)],]
15.3 Exploratory Data Analysis
Let’s begin by exploring our training set. We can start with a quick summary of all variables to see which could be meaningful in our model:
summary(train)
## age gender
## Min. :16.00 F:27869
## 1st Qu.:31.00 M:33310
## Median :39.00
## Mean :42.27
## 3rd Qu.:53.00
## Max. :75.00
##
## race_ethnicity
## Asian, non-Hispanic ONLY : 9673
## American Indian/Alaska Native, non-Hispanic ONLY : 265
## Black, non-Hispanic ONLY : 4759
## Hispanic, any race : 6451
## White, non-Hispanic ONLY :38157
## Non-Hispanic Native Hawaiian/Other Pacific Islander ONLY: 226
## Multiple Race : 1648
## years_since_degree degree_type
## Min. : 0.00 Bachelors :29678
## 1st Qu.: 6.00 Masters :24123
## Median :11.00 Doctorate : 4875
## Mean :15.36 Professional: 2503
## 3rd Qu.:23.00
## Max. :56.00
##
## current_location highschool_location school_in_US
## Asia, not specified : 17 India : 2151 Mode :logical
## Europe, not specified : 10 China : 1211 FALSE:4587
## North America, not specified: 8 Canada : 473 TRUE :56592
## Mexico : 5 Philippines: 472
## Africa, not specified : 4 Taiwan : 290
## (Other) : 6 (Other) : 4929
## NA's :61129 NA's :51653
## moved r1
## Mode :logical Mode :logical
## FALSE:4 FALSE:40798
## TRUE :28 TRUE :20381
## NA's :61147
##
##
##
## field_of_study_group
## Biological, agricultural and environmental life sciences: 5250
## Computer and mathematical sciences : 5099
## Engineering :12742
## Non-S&E :16892
## Physical and related sciences : 2964
## S&E-Related Fields : 8749
## Social and related sciences : 9483
## field_of_study in_school
## Health : 6525 Mode :logical
## Management and administration fields: 5734 FALSE:57223
## Biological sciences : 3920 TRUE :3956
## Electrical and computer engineering : 3723
## Other Non-S&E fields : 3617
## Computer and information sciences : 3513
## (Other) :34147
## work_activity
## Managing or supervising people or projects :10345
## Prof. services (healthcare, fin. serv., legal serv., etc.) :10078
## Teaching : 7443
## Sales, purchasing, marketing : 4492
## Apld. res.-study to gain sci. knwldg to meet recognized need: 4464
## Computer applications, programming, systems development : 4438
## (Other) :19919
## salary income
## Min. : 100 Min. : 0
## 1st Qu.: 45000 1st Qu.: 44076
## Median : 70400 Median : 70000
## Mean : 84228 Mean : 90683
## 3rd Qu.: 100000 3rd Qu.: 102926
## Max. :1223166 Max. :1890537
## NA's :28
We can see that our location variables are mostly NAs. We will drop these variables from our analysis to avoid several issues like multicollinearity and sampling bias.
library(GGally)
train %>%
sample_n(1000) %>%
as.data.frame() %>%
GGally::ggscatmat(alpha = 0.1)
15.4 Simple linear model
basic_model <- lm(log(salary + 1) ~ I(age - 25) + I((age - 25)^2) , data = train)
summary(basic_model)
##
## Call:
## lm(formula = log(salary + 1) ~ I(age - 25) + I((age - 25)^2),
## data = train)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.6384 -0.3026 0.1348 0.4799 3.4965
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.065e+01 8.015e-03 1329.17 <2e-16 ***
## I(age - 25) 5.410e-02 9.770e-04 55.37 <2e-16 ***
## I((age - 25)^2) -1.185e-03 2.296e-05 -51.60 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.8477 on 61176 degrees of freedom
## Multiple R-squared: 0.04827, Adjusted R-squared: 0.04824
## F-statistic: 1551 on 2 and 61176 DF, p-value: < 2.2e-16
Based on the above results which job types are associated with higher salaries?
15.5 Model selection
We can use the validation set to see how well our model performs in predicting salary for people not in our training set. By comparing the prediction on the performance on several model alternatives, we can select the best prediction model.
15.5.1 Model alternatives
In a real world situation you can test every possible linear combination of your variables on the right-hand side. Entirely different models (e.g., random forest regression) may be even better candidates, but for simplicity we’ll focus on a small set of linear models of salary.
school_model <- lm(
log(salary + 1) ~
I(age - 25) + I((age - 25)^2) +
years_since_degree + degree_type + r1 + field_of_study_group,
data = train
)
demo_model <- lm(
log(salary + 1) ~
I(age - 25) + I((age - 25)^2) +
gender + race_ethnicity,
data = train
)
current_model <- lm(
log(salary + 1) ~
I(age - 25) + I((age - 25)^2) +
in_school + work_activity,
data = train
)
kitchen_sink_model <- lm(
log(salary + 1) ~
I(age - 25) + I((age - 25)^2) +
years_since_degree + degree_type + r1 + field_of_study_group +
gender + race_ethnicity +
in_school + work_activity,
data = train
)
summary(kitchen_sink_model)
##
## Call:
## lm(formula = log(salary + 1) ~ I(age - 25) + I((age - 25)^2) +
## years_since_degree + degree_type + r1 + field_of_study_group +
## gender + race_ethnicity + in_school + work_activity, data = train)
##
## Residuals:
## Min 1Q Median 3Q Max
## -7.1766 -0.2493 0.0904 0.4007 3.7995
##
## Coefficients:
## Estimate
## (Intercept) 1.045e+01
## I(age - 25) 4.247e-02
## I((age - 25)^2) -1.079e-03
## years_since_degree 6.320e-03
## degree_typeMasters 1.820e-01
## degree_typeDoctorate 4.022e-01
## degree_typeProfessional 5.404e-01
## r1TRUE 1.218e-01
## field_of_study_groupComputer and mathematical sciences 2.001e-01
## field_of_study_groupEngineering 2.765e-01
## field_of_study_groupNon-S&E 5.015e-02
## field_of_study_groupPhysical and related sciences 1.205e-01
## field_of_study_groupS&E-Related Fields 1.546e-01
## field_of_study_groupSocial and related sciences -5.138e-03
## genderM 2.548e-01
## race_ethnicityAmerican Indian/Alaska Native, non-Hispanic ONLY -8.784e-02
## race_ethnicityBlack, non-Hispanic ONLY -1.036e-01
## race_ethnicityHispanic, any race -5.257e-02
## race_ethnicityWhite, non-Hispanic ONLY -1.446e-03
## race_ethnicityNon-Hispanic Native Hawaiian/Other Pacific Islander ONLY 1.914e-02
## race_ethnicityMultiple Race -3.697e-02
## in_schoolTRUE -3.933e-01
## work_activityBasic res.-study to gain sci. knwldg prima. for its own sake -3.138e-01
## work_activityApld. res.-study to gain sci. knwldg to meet recognized need -9.043e-02
## work_activityDev.-knowledge from res. for the prod. of materials, devices 2.250e-02
## work_activityDesign of equipment, processes, structures, models 4.853e-02
## work_activityComputer applications, programming, systems development 8.170e-02
## work_activityHuman Resources - inc. recruiting, personnel dev, training -3.796e-02
## work_activityManaging or supervising people or projects 1.370e-01
## work_activityProduction, operations, maintenance (e.g., chip production) -2.304e-01
## work_activityProf. services (healthcare, fin. serv., legal serv., etc.) -1.185e-01
## work_activitySales, purchasing, marketing -2.724e-01
## work_activityQuality or productivity management -3.251e-02
## work_activityTeaching -5.217e-01
## work_activityOther work activity -3.701e-01
## Std. Error
## (Intercept) 2.145e-02
## I(age - 25) 9.697e-04
## I((age - 25)^2) 2.103e-05
## years_since_degree 5.523e-04
## degree_typeMasters 7.426e-03
## degree_typeDoctorate 1.347e-02
## degree_typeProfessional 1.731e-02
## r1TRUE 6.809e-03
## field_of_study_groupComputer and mathematical sciences 1.584e-02
## field_of_study_groupEngineering 1.325e-02
## field_of_study_groupNon-S&E 1.276e-02
## field_of_study_groupPhysical and related sciences 1.756e-02
## field_of_study_groupS&E-Related Fields 1.411e-02
## field_of_study_groupSocial and related sciences 1.342e-02
## genderM 6.732e-03
## race_ethnicityAmerican Indian/Alaska Native, non-Hispanic ONLY 4.758e-02
## race_ethnicityBlack, non-Hispanic ONLY 1.380e-02
## race_ethnicityHispanic, any race 1.247e-02
## race_ethnicityWhite, non-Hispanic ONLY 8.962e-03
## race_ethnicityNon-Hispanic Native Hawaiian/Other Pacific Islander ONLY 5.137e-02
## race_ethnicityMultiple Race 2.047e-02
## in_schoolTRUE 1.313e-02
## work_activityBasic res.-study to gain sci. knwldg prima. for its own sake 2.359e-02
## work_activityApld. res.-study to gain sci. knwldg to meet recognized need 1.930e-02
## work_activityDev.-knowledge from res. for the prod. of materials, devices 2.085e-02
## work_activityDesign of equipment, processes, structures, models 1.990e-02
## work_activityComputer applications, programming, systems development 1.938e-02
## work_activityHuman Resources - inc. recruiting, personnel dev, training 2.898e-02
## work_activityManaging or supervising people or projects 1.669e-02
## work_activityProduction, operations, maintenance (e.g., chip production) 2.180e-02
## work_activityProf. services (healthcare, fin. serv., legal serv., etc.) 1.718e-02
## work_activitySales, purchasing, marketing 1.863e-02
## work_activityQuality or productivity management 2.345e-02
## work_activityTeaching 1.745e-02
## work_activityOther work activity 1.980e-02
## t value
## (Intercept) 486.928
## I(age - 25) 43.792
## I((age - 25)^2) -51.290
## years_since_degree 11.444
## degree_typeMasters 24.510
## degree_typeDoctorate 29.866
## degree_typeProfessional 31.216
## r1TRUE 17.883
## field_of_study_groupComputer and mathematical sciences 12.633
## field_of_study_groupEngineering 20.867
## field_of_study_groupNon-S&E 3.931
## field_of_study_groupPhysical and related sciences 6.864
## field_of_study_groupS&E-Related Fields 10.956
## field_of_study_groupSocial and related sciences -0.383
## genderM 37.854
## race_ethnicityAmerican Indian/Alaska Native, non-Hispanic ONLY -1.846
## race_ethnicityBlack, non-Hispanic ONLY -7.506
## race_ethnicityHispanic, any race -4.216
## race_ethnicityWhite, non-Hispanic ONLY -0.161
## race_ethnicityNon-Hispanic Native Hawaiian/Other Pacific Islander ONLY 0.373
## race_ethnicityMultiple Race -1.806
## in_schoolTRUE -29.966
## work_activityBasic res.-study to gain sci. knwldg prima. for its own sake -13.305
## work_activityApld. res.-study to gain sci. knwldg to meet recognized need -4.686
## work_activityDev.-knowledge from res. for the prod. of materials, devices 1.079
## work_activityDesign of equipment, processes, structures, models 2.439
## work_activityComputer applications, programming, systems development 4.216
## work_activityHuman Resources - inc. recruiting, personnel dev, training -1.310
## work_activityManaging or supervising people or projects 8.209
## work_activityProduction, operations, maintenance (e.g., chip production) -10.571
## work_activityProf. services (healthcare, fin. serv., legal serv., etc.) -6.900
## work_activitySales, purchasing, marketing -14.624
## work_activityQuality or productivity management -1.386
## work_activityTeaching -29.894
## work_activityOther work activity -18.690
## Pr(>|t|)
## (Intercept) < 2e-16
## I(age - 25) < 2e-16
## I((age - 25)^2) < 2e-16
## years_since_degree < 2e-16
## degree_typeMasters < 2e-16
## degree_typeDoctorate < 2e-16
## degree_typeProfessional < 2e-16
## r1TRUE < 2e-16
## field_of_study_groupComputer and mathematical sciences < 2e-16
## field_of_study_groupEngineering < 2e-16
## field_of_study_groupNon-S&E 8.46e-05
## field_of_study_groupPhysical and related sciences 6.78e-12
## field_of_study_groupS&E-Related Fields < 2e-16
## field_of_study_groupSocial and related sciences 0.7019
## genderM < 2e-16
## race_ethnicityAmerican Indian/Alaska Native, non-Hispanic ONLY 0.0649
## race_ethnicityBlack, non-Hispanic ONLY 6.19e-14
## race_ethnicityHispanic, any race 2.50e-05
## race_ethnicityWhite, non-Hispanic ONLY 0.8718
## race_ethnicityNon-Hispanic Native Hawaiian/Other Pacific Islander ONLY 0.7094
## race_ethnicityMultiple Race 0.0710
## in_schoolTRUE < 2e-16
## work_activityBasic res.-study to gain sci. knwldg prima. for its own sake < 2e-16
## work_activityApld. res.-study to gain sci. knwldg to meet recognized need 2.80e-06
## work_activityDev.-knowledge from res. for the prod. of materials, devices 0.2806
## work_activityDesign of equipment, processes, structures, models 0.0147
## work_activityComputer applications, programming, systems development 2.49e-05
## work_activityHuman Resources - inc. recruiting, personnel dev, training 0.1903
## work_activityManaging or supervising people or projects 2.28e-16
## work_activityProduction, operations, maintenance (e.g., chip production) < 2e-16
## work_activityProf. services (healthcare, fin. serv., legal serv., etc.) 5.26e-12
## work_activitySales, purchasing, marketing < 2e-16
## work_activityQuality or productivity management 0.1657
## work_activityTeaching < 2e-16
## work_activityOther work activity < 2e-16
##
## (Intercept) ***
## I(age - 25) ***
## I((age - 25)^2) ***
## years_since_degree ***
## degree_typeMasters ***
## degree_typeDoctorate ***
## degree_typeProfessional ***
## r1TRUE ***
## field_of_study_groupComputer and mathematical sciences ***
## field_of_study_groupEngineering ***
## field_of_study_groupNon-S&E ***
## field_of_study_groupPhysical and related sciences ***
## field_of_study_groupS&E-Related Fields ***
## field_of_study_groupSocial and related sciences
## genderM ***
## race_ethnicityAmerican Indian/Alaska Native, non-Hispanic ONLY .
## race_ethnicityBlack, non-Hispanic ONLY ***
## race_ethnicityHispanic, any race ***
## race_ethnicityWhite, non-Hispanic ONLY
## race_ethnicityNon-Hispanic Native Hawaiian/Other Pacific Islander ONLY
## race_ethnicityMultiple Race .
## in_schoolTRUE ***
## work_activityBasic res.-study to gain sci. knwldg prima. for its own sake ***
## work_activityApld. res.-study to gain sci. knwldg to meet recognized need ***
## work_activityDev.-knowledge from res. for the prod. of materials, devices
## work_activityDesign of equipment, processes, structures, models *
## work_activityComputer applications, programming, systems development ***
## work_activityHuman Resources - inc. recruiting, personnel dev, training
## work_activityManaging or supervising people or projects ***
## work_activityProduction, operations, maintenance (e.g., chip production) ***
## work_activityProf. services (healthcare, fin. serv., legal serv., etc.) ***
## work_activitySales, purchasing, marketing ***
## work_activityQuality or productivity management
## work_activityTeaching ***
## work_activityOther work activity ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7619 on 61144 degrees of freedom
## Multiple R-squared: 0.2317, Adjusted R-squared: 0.2313
## F-statistic: 542.3 on 34 and 61144 DF, p-value: < 2.2e-16
15.5.2 Comparing model performance
Now we can compare the performance of each of these models against the validation dataset. Let’s walk step-by-step through the process of calculating the root mean squared prediction error (or RMSPE, or RMSE) with just the school prediction.
school_prediction <- predict(school_model, validation)
salary_prediction <- exp(school_prediction) - 1
prediction_error <- salary_prediction - validation$salary
school_rmse <- sqrt(mean(prediction_error^2, na.rm = TRUE))
school_rmse
## [1] 92757.45
Now let’s compare that to the RMSE for the other models.
demo_rmse <- sqrt(mean((exp(predict(demo_model, validation)) - 1 - validation$salary)^2, na.rm = TRUE))
demo_rmse
## [1] 93801
current_rmse <- sqrt(mean((exp(predict(current_model, validation)) - 1 - validation$salary)^2, na.rm = TRUE))
current_rmse
## [1] 93275.49
kitchen_rmse <- sqrt(mean((exp(predict(kitchen_sink_model, validation)) - 1 - validation$salary)^2, na.rm = TRUE))
kitchen_rmse
## [1] 90500.08
The kitchen_model
outperforms the others (lowest RMSE) so we will use it in our final step. Keep in mind there are many alternative methods of modeling salary, so the above test should not be considered exhaustive.
15.6 Predictions from the selected model
Finally, we can use our test
dataset to evaluate the expected error for predictions from our chosen model. The only thing that changes relative to the kitchen_rmse
we calculated above is swapping validation
with test
.
test_rmse <- sqrt(mean((exp(predict(kitchen_sink_model, test)) - 1 - test$salary)^2, na.rm = TRUE))
test_rmse
## [1] 87955.76
other_test_rmse <- sqrt(mean((predict(kitchen_sink_model, test) - log(test$salary + 1))^2, na.rm = TRUE))
other_test_rmse
## [1] 0.7556778
What this number gives us is a typical error from our model predictions. The fact that this error is so large tells us that our model does a really poor job of predicting salary.
15.7 Assignment
Add variables on parental background, estimate an updated kitchen sink model including these new variables, and report the RMSE on the validation and test sets.
N_ED_UG_FINAN_SUPP_GIFTS
W_DEM_PARENT_FATHERS_ED_LEVEL
W_DEM_PARENT_MOTHERS_ED_LEVEL
15.8 See also
There are many approaches to model selection and a broad array of tools within R to help you along the way. Here’s a sampling:


update can.Control.plugin.prototype.update
Reconfigure a control.
update(newOptions)
Parameters
-
newOptions
{Object}
Options to merge into the current options.
-
options
{Object}
A list of options to merge with this.options. Often this method is called by the jQuery helper function.
Update extends options with the
options
argument and rebinds all events. It re-configures the control.For example, the following control wraps a recipe form. When the form is submitted, it creates the recipe on the server. When the recipe is
created
, it resets the form with a new instance.Update is called if a control's plugin helper is called with the plugin options on an element that already has a control instance of the same type. If you want to implement your own update method make sure to call the old one either using the super plugin or by calling
can.Control.prototype.update.apply(this, arguments);
. For example, you can change the content of the control element every time the options change:


{{product.name}}
{{product.price | currency}}
{{product.description}}
Add to cart
Description
Specifications
Reviews
Description
None as of yet
Specifications
None as of yet
Reviews
None as of yet
Value of tab is:
{{tab}}


{% load i18n horizon %}
{% blocktrans %}Create a Data Source with a specified name.{% endblocktrans %}
{% blocktrans %}Select the type of your Data Source.{% endblocktrans %}
{% blocktrans %}You may need to enter the username and password for your Data Source.{% endblocktrans %}
{% blocktrans %}For Data Sources on a Manila share, choose the share and enter the path relative to the share (example: /outputdir/myinputfile.txt){% endblocktrans %}
{% blocktrans %}For Data Sources in S3 storage, the URL should be specified in the format s3a://bucket/path. Also, each of the access properties may be optional if you have configured that property on your cluster manually.{% endblocktrans %}
{% blocktrans %}You may also enter an optional description for your Data Source.{% endblocktrans %}


I am a graduate student at Northeastern University with 4 years of work experience as a Software Engineer. I am currently looking for co-op/internship and can start working from January 2018.
My areas of expertise includes Web development, object-oriented programming, and problem-solving.
 Designed interactive webpages along with backend database and effective communication between client and server. This application allows users play lottery games as well as locate shops offering tickets easily.
Technologies Used: Java EE, Java, Spring MVC, Hibernate, Maven, JSP, HTML5, CSS3, Bootstrap, AJAX, MySQL, jQuery, JSTL, Javascript, Spring security, JSON
Designed an application with interactive and user friendly GUI using Java swing forms and Java object oriented programming incorporated in an ecosystem model to aid people book appointments with doctors from different hospitals across the country and thus providing the people with vaccinations in a timely manner
Technologies Used: Java, Java Swing, Ecosystem Model
Created a database for the World Wrestling Entertainment, stored information regarding the wresters, shows and matches held using various SQL scripts and cardinalities to relate tables. Also performed complex analysis through triggers, procedures and views to record and help the authorities of WWE run the company more efficiently
Technologies Used: MySQL, SQL, Draw.io
• Worked on Informatica (ETL tool) and Salesforce (CRM product)
• Designed web pages in Salesforce using HTML, CSS and JavaScript.
• Authored triggers and classes is Apex (Object oriented programming) to accomplish critical client requirements
• Received an award for a CVA (Customer value addition) to automate the migration of contacts between Eloqua and Salesforce through which the company acquired cost savings of 42000$/year and effort savings of 660 hrs/year
• Created and designed mappings in Informatica to extract data from Salesforce to Oracle database tables
• Designed database and tables in Oracle database for Salesforce objects
• Tested and monitored Informatica loads and Salesforce code
• Communicated effectively with the client regarding the requirements for different development task
• Performed the role of a technical lead in the Legal Hold department


Blog
About
Fork on GitHub
June 2013
Hello Again
~ Jun 16
Untitled
~ Jun 10
May 2013
Hello World
~ May 09
Subscribe via RSS


Uncommented Empty Constructor finds instances where a constructor does not contain statements, but there is no comment. By explicitly commenting empty constructors it is easier to distinguish between intentional (commented) and unintentional empty constructors.
This rule is deprecated, use {rule:squid:S2094} instead.


Work Day Scheduler
A simple calendar app for scheduling your work day
Save
10:00am
Save
11:00am
Save
12:00pm
Save
01:00pm
Save
02:00pm
Save
03:00pm
Save
04:00pm
Save
05:00pm
Save


What is it?
Active Record is the M in MVC(model, view, controller). MVC is a architectural pattern to create and update user interfaces. The model updates the view, the view displays to the user, the user uses the controller, and the controller manipulates the model.
Active record is the layer of this architecture that takes care of business data and logic. It acts as a database management system for Rails.
When using Active Record, make sure to remember and all important CRUD.


Apache™ FOP: Events/Processing Feedback
Introduction
In versions until 0.20.5, Apache™ FOP used Avalon-style Logging where it was possible to supply a logger per processing run. During the redesign the logging infrastructure was switched over to Commons Logging which is (like Log4J or java.util.logging) a "static" logging framework (the logger is accessed through static variables). This made it very difficult in a multi-threaded system to retrieve information for a single processing run.
With FOP's event subsystem, we'd like to close this gap again and even go further. The first point is to realize that we have two kinds of "logging". Firstly, we have the logging infrastructure for the (FOP) developer who needs to be able to enable finer log messages for certain parts of FOP to track down a certain problem. Secondly, we have the user who would like to be informed about missing images, overflowing lines or substituted fonts. These messages (or events) are targeted at less technical people and may ideally be localized (translated). Furthermore, tool and solution builders would like to integrate FOP into their own solutions. For example, an FO editor should be able to point the user to the right place where a particular problem occurred while developing a document template. Finally, some integrators would like to abort processing if a resource (an image or a font) has not been found, while others would simply continue. The event system allows to react on these events.
On this page, we won't discuss logging as such. We will show how the event subsystem can be used for various tasks. We'll first look at the event subsystem from the consumer side. Finally, the production of events inside FOP will be discussed (this is mostly interesting for FOP developers only).
The consumer side
The event subsystem is located in the org.apache.fop.events package and its base is the Event class. An instance is created for each event and is sent to a set of EventListener instances by the EventBroadcaster. An Event contains:
- an event ID,
- a source object (which generated the event),
- a severity level (Info, Warning, Error and Fatal Error) and
- a map of named parameters.
The EventFormatter class can be used to translate the events into human-readable, localized messages.
A full example of what is shown here can be found in the examples/embedding/java/embedding/events directory in the FOP distribution. The example can also be accessed via the web.
Writing an EventListener
The following code sample shows a very simple EventListener. It basically just sends all events to System.out (stdout) or System.err (stderr) depending on the event severity.
import org.apache.fop.events.Event; import org.apache.fop.events.EventFormatter; import org.apache.fop.events.EventListener; import org.apache.fop.events.model.EventSeverity; /** A simple event listener that writes the events to stdout and stderr. */ public class SysOutEventListener implements EventListener { /** {@inheritDoc} */ public void processEvent(Event event) { String msg = EventFormatter.format(event); EventSeverity severity = event.getSeverity(); if (severity == EventSeverity.INFO) { System.out.println("[INFO ] " + msg); } else if (severity == EventSeverity.WARN) { System.out.println("[WARN ] " + msg); } else if (severity == EventSeverity.ERROR) { System.err.println("[ERROR] " + msg); } else if (severity == EventSeverity.FATAL) { System.err.println("[FATAL] " + msg); } else { assert false; } } }
You can see that for every event the method processEvent of the EventListener will be called. Inside this method you can do whatever processing you would like including throwing a RuntimeException, if you want to abort the current processing run.
The code above also shows how you can turn an event into a human-readable, localized message that can be presented to a user. The EventFormatter class does this for you. It provides additional methods if you'd like to explicitly specify the locale.
It is possible to gather all events for a whole processing run so they can be evaluated afterwards. However, care should be taken about memory consumption since the events provide references to objects inside FOP which may themselves have references to other objects. So holding on to these objects may mean that whole object trees cannot be released!
Adding an EventListener
To register the event listener with FOP, get the EventBroadcaster which is associated with the user agent (FOUserAgent) and add it there:
FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); foUserAgent.getEventBroadcaster().addEventListener(new SysOutEventListener());
Please note that this is done separately for each processing run, i.e. for each new user agent.
An additional listener example
Here's an additional example of an event listener:
By default, FOP continues processing even if an image wasn't found. If you have more strict requirements and want FOP to stop if an image is not available, you can do something like the following in the simplest case:
public class MyEventListener implements EventListener { public void processEvent(Event event) { if ("org.apache.fop.ResourceEventProducer".equals( event.getEventGroupID())) { event.setSeverity(EventSeverity.FATAL); } else { //ignore all other events (or do something of your choice) } } }
Increasing the event severity to FATAL will signal the event broadcaster to throw an exception and stop further processing. In the above case, all resource-related events will cause FOP to stop processing.
You can also customize the exception to throw (you can may throw a RuntimeException or subclass yourself) and/or which event to respond to:
public class MyEventListener implements EventListener { public void processEvent(Event event) { if ("org.apache.fop.ResourceEventProducer.imageNotFound" .equals(event.getEventID())) { //Get the FileNotFoundException that's part of the event's parameters FileNotFoundException fnfe = (FileNotFoundException)event.getParam("fnfe"); throw new RuntimeException(EventFormatter.format(event), fnfe); } else { //ignore all other events (or do something of your choice) } } }
This throws a RuntimeException with the FileNotFoundException as the cause. Further processing effectively stops in FOP. You can catch the exception in your code and react as you see necessary.
The producer side (for FOP developers)
This section is primarily for FOP and FOP plug-in developers. It describes how to use the event subsystem for producing events.
Producing and sending an event
The basics are very simple. Just instantiate an Event object and fill it with the necessary parameters. Then pass it to the EventBroadcaster which distributes the events to the interested listeneners. Here's a code example:
Event ev = new Event(this, "complain", EventSeverity.WARN, Event.paramsBuilder() .param("reason", "I'm tired") .param("blah", new Integer(23)) .build()); EventBroadcaster broadcaster = [get it from somewhere]; broadcaster.broadcastEvent(ev);
The Event.paramsBuilder() is a fluent interface to help with the build-up of the parameters. You could just as well instantiate a Map (Map<String, Object>) and fill it with values.
The EventProducer interface
To simplify event production, the event subsystem provides the EventProducer interface. You can create interfaces which extend EventProducer. These interfaces will contain one method per event to be generated. By contract, each event method must have as its first parameter a parameter named "source" (Type Object) which indicates the object that generated the event. After that come an arbitrary number of parameters of any type as needed by the event.
The event producer interface does not need to have any implementation. The implementation is produced at runtime by a dynamic proxy created by DefaultEventBroadcaster. The dynamic proxy creates Event instances for each method call against the event producer interface. Each parameter (except "source") is added to the event's parameter map.
To simplify the code needed to get an instance of the event producer interface it is suggested to create a public inner provider class inside the interface.
Here's an example of such an event producer interface:
public interface MyEventProducer extends EventProducer { public class Provider { public static MyEventProducer get(EventBroadcaster broadcaster) { return (MyEventProducer)broadcaster.getEventProducerFor(MyEventProducer.class); } } /** * Complain about something. * @param source the event source * @param reason the reason for the complaint * @param blah the complaint * @event.severity WARN */ void complain(Object source, String reason, int blah); }
To produce the same event as in the first example above, you'd use the following code:
EventBroadcaster broadcaster = [get it from somewhere]; TestEventProducer producer = TestEventProducer.Provider.get(broadcaster); producer.complain(this, "I'm tired", 23);
The event model
Inside an invocation handler for a dynamic proxy, there's no information about the names of each parameter. The JVM doesn't provide it. The only thing you know is the interface and method name. In order to properly fill the Event's parameter map we need to know the parameter names. These are retrieved from an event object model. This is found in the org.apache.fop.events.model package. The data for the object model is retrieved from an XML representation of the event model that is loaded as a resource. The XML representation is generated using an Ant task at build time (ant resourcegen). The Ant task (found in src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java) scans FOP's sources for descendants of the EventProducer interface and uses QDox to parse these interfaces.
The event model XML files are generated during build by the Ant task mentioned above when running the "resourcegen" task. So just run "ant resourcegen" if you receive a MissingResourceException at runtime indicating that "event-model.xml" is missing.
Primarily, the QDox-based collector task records the parameters' names and types. Furthermore, it extracts additional attributes embedded as Javadoc comments from the methods. At the moment, the only such attribute is<EMAIL_ADDRESS>which indicates the default event severity (which can be changed by event listeners). The example event producer above shows the Javadocs for an event method.
There's one more information that is extracted from the event producer information for the event model: an optional primary exception. The first exception in the "throws" declaration of an event method is noted. It is used to throw an exception from the invocation handler if the event has an event severity of "FATAL" when all listeners have been called (listeners can update the event severity). Please note that an implementation of org.apache.fop.events.EventExceptionManager$ExceptionFactory has to be registered for the EventExceptionManager to be able to construct the exception from an event.
For a given application, there can be multiple event models active at the same time. In FOP, each renderer is considered to be a plug-in and provides its own specific event model. The individual event models are provided through an EventModelFactory. This interface is implemented for each event model and registered through the service provider mechanism (see the plug-ins section for details).
Event severity
Four different levels of severity for events has been defined:
- INFO: informational only
- WARN: a Warning
- ERROR: an error condition from which FOP can recover. FOP will continue processing.
- FATAL: a fatal error which causes an exception in the end and FOP will stop processing.
Event listeners can choose to ignore certain events based on their event severity. Please note that you may recieve an event "twice" in a specific case: if there is a fatal error an event is generated and sent to the listeners. After that an exception is thrown with the same information and processing stops. If the fatal event is shown to the user and the following exception is equally presented to the user it may appear that the event is duplicated. Of course, the same information is just published through two different channels.
Plug-ins to the event subsystem
The event subsystem is extensible. There are a number of extension points:
- org.apache.fop.events.model.EventModelFactory: Provides an event model to the event subsystem.
- org.apache.fop.events.EventExceptionManager$ExceptionFactory: Creates exceptions for events, i.e. turns an event into a specific exception.
The names in bold above are used as filenames for the service provider files that are placed in the META-INF/services directory. That way, they are automatically detected. This is a mechanism defined by the JAR file specification.
Localization (L10n)
One goal of the event subsystem was to have localized (translated) event messages. The EventFormatter class can be used to convert an event to a human-readable message. Each EventProducer can provide its own XML-based translation file. If there is none, a central translation file is used, called "EventFormatter.xml" (found in the same directory as the EventFormatter class).
The XML format used by the EventFormatter is the same as Apache Cocoon's catalog format. Here's an example:
<?xml version="1.0" encoding="UTF-8"?> <catalogue xml:lang="en"> <message key="locator"> [ (See position {loc})| (See {#gatherContextInfo})| (No context info available)] </message> <message key="org.apache.fop.render.rtf.RTFEventProducer.explicitTableColumnsRequired"> RTF output requires that all table-columns for a table are defined. Output will be incorrect.{{locator}} </message> <message key="org.apache.fop.render.rtf.RTFEventProducer.ignoredDeferredEvent"> Ignored deferred event for {node} ({start,if,start,end}).{{locator}} </message> </catalogue>
The example (extracted from the RTF handler's event producer) has message templates for two event methods. The class used to do variable replacement in the templates is org.apache.fop.util.text.AdvancedMessageFormat which is more powerful than the MessageFormat classes provided by the Java class library (java.util.text package).
"locator" is a template that is reused by the other message templates by referencing it through "{{locator}}". This is some kind of include command.
Normal event parameters are accessed by name inside single curly braces, for example: "{node}". For objects, this format just uses the toString() method to turn the object into a string, unless there is an ObjectFormatter registered for that type (there's an example for org.xml.sax.Locator).
The single curly braces pattern supports additional features. For example, it is possible to do this: "{start,if,start,end}". "if" here is a special field modifier that evaluates "start" as a boolean and if that is true returns the text right after the second comma ("start"). Otherwise it returns the text after the third comma ("end"). The "equals" modifier is similar to "if" but it takes as an additional (comma-separated) parameter right after the "equals" modifier, a string that is compared to the value of the variable. An example: {severity,equals,EventSeverity:FATAL,,some text} (this adds "some text" if the severity is not FATAL).
Additional such modifiers can be added by implementing the AdvancedMessageFormat$Part and AdvancedMessageFormat$PartFactory interfaces.
Square braces can be used to specify optional template sections. The whole section will be omitted if any of the variables used within are unavailable. Pipe (|) characters can be used to specify alternative sub-templates (see "locator" above for an example).
Developers can also register a function (in the above example: {#gatherContextInfo}) to do more complex information rendering. These functions are implementations of the AdvancedMessageFormat$Function interface. Please take care that this is done in a locale-independent way as there is no locale information available, yet.


When binding data in d3, the library is smart enough to know what code to execute depending on the number of data elements and the number of existing DOM elements defind by the selectAll() method. If you look at the code executed below, you can see that the first circle is created with a black fill. After two seconds, the data binding is executed and that existing shape is updated to blue. The elements of the array are matched up to the existing elements first. Then, if there are more data elements, the enter() method's code is executed.
//Declare a data array with two elements.
var data = [10, 20];
//Make a svg canvas.
var canvas = d3.select("body")
----.append("svg")
----.attr("width", 700)
----.attr("height", 400);
//The explicitly defined circle.
var explicitCircle = canvas.append("circle")
----.attr("cx", 250)
----.attr("cy", 250)
----.attr("r", 100);
//After the delay, the data is bound to the circles in the DOM and
//enter creates more circles because of the data the circles represent.
//In addition to this, before enter is executed, the existing DOM
//elements can be updated as well.
setTimeout(function(){
----var bindCircles = canvas.selectAll("circle")
--------.data(data)
--------//This is where the current elements are updated.
--------.attr("fill","blue")
--------.enter()
------------.append("circle")
------------.attr("cx", 500)
------------.attr("cy", 250)
------------.attr("r", 100)
------------.attr("fill", "red");
}, 2000);


Lorem Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry's standard dummy
text ever since the 1500s, when an unknown printer took a galley
of type and scrambled it to make a type specimen book. It has
survived not only five centuries, but also the leap into
electronic typesetting, remaining essentially unchanged.
It was popularised in the 1960s with the release of Letraset
sheets containing Lorem Ipsum passages, and more recently with
desktop publishing software like Aldus PageMaker including
versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry's standard dummy
text ever since the 1500s, when an unknown printer took a galley
of type and scrambled it to make a type specimen book. It has
survived not only five centuries, but also the leap into
electronic typesetting, remaining essentially unchanged.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.
Premium quality t-shirts and tops designed by European artists, illustrators and tattoo masters.
Get your dose today! https://wearmedicine.com.au
| zoom_out_map | ||
Lorem Ipsum is simply dummy text of the printing and typesetting industry. or the another website link, .
Lorem Ipsum here
Lorem Ipsum here
Lorem Ipsum here
The information a reader is about to be referred to may not comply with the specific regulatory requirements. Further information relevant to the default environment is available from the respective company, or via the Consumer Information or Product Information. This material is informational and not intended as advice. For further information talk to an admin.


|
Bigfootaka Sasquatch, Fakenstein, Ol' HoaxyIn 1958, Ray Wallace strapped on a couple of wooden soles carved to resemble giant feet, and tromped around a logging camp in the Six Rivers National Forest. The tracks he left became the first tangible evidence of the giant ape-man which ultimately captured the attention of all manner of world-class nutballs. Ray never admitted his prank; the story only came out in January 2003, when the family revealed it awhile after Ray's funeral.The Bigfoot thing took off in no time, and soon self-proclaimed cryptozoologists began flocking to Northern California. Copycat hoaxers showed up and started leaving tracks of their own. They were pathetically crude at first, obvious frauds. But they got more realistic over the years. Then in 1967, Roger Patterson produced the greatest Bigfoot movie of all time, which ultimately became the progenitor of the Blair Witch Project. Patterson's groundbreaking 16mm film established the elements of the genre: woodland setting, spazzy camerawork, complete fraud. If not for the exquisitely ragged cinematography, it would have obviously been a guy in a furry suit. The costume wasn't that great; the handheld shakicam is what sold it. After the Patterson film went wide, the Bigfoot legend became a permanent fixture of the American psyche. Later it became an international sensation when it was featured in the landmark 1976 television series "In Search Of..." hosted by Leonard Nimoy. Bigfoot quickly became a commodity.


You can audition for The Addams Family Musical in Kitchener
The show will run at the Conrad Centre for the Performing Arts in 2020
by Erin AndersonIf you used to watch the show or movies as a kid, and always wanted to be a part of The Addams Family, now's your chance!
K-W Musical Productions is accepting video auditions for its upcoming musical.
All you need to do is film yourself singing a section from two pop or musical theatre songs. Then upload it to YouTube, and send in the link.
If you think you'll really shine in person, there are some live auditions happening on November 26 and 27.
If you're less about singing and acting, and more about the art of movement, a dance call is set for December 1.
The show will run at the Conrad Centre for the Performing Arts in Kitchener from May 27 to June 6, 2020.
You can see full details by clicking here.


User Story
This endpoint returns the IP address, preferred languages (from header Accept-Language) and system information (from header User-Agent) for my device.
Example Usage
Click here to go to the endpoint
Example Output
{ "IP Address": "::ffff:<IP_ADDRESS>", "Language": "en-GB", "Operating System": "Mac OS X 10.13.2", "Browser": "Chrome 63.0.3239" }


Ocean [aw73], ocean, in Crystal Sea
Last updated Turn #131
Ocean [aw73], ocean, in Crystal Sea
------------------------------------------------------------------------
3: Pleasure Sloop [v5n], ship, 30 hulls, 1 rowing port, 90 sails, arrived
3: from Painted Desert [av73], owner:
3: Dorothy [v1b], Pen, with one peasant, 94 sailors
3: Apollo [b5e], Imperial Empire, with 63 lt. xbowmen,
3: accompanied by:
3: Lutra [a4w], Imperial Empire, with 13 paladins, 40 pikemen
3: Hera [g3f], Imperial Empire, with 20 soldiers, 40 pikemen
3: Thor [r4g], Imperial Empire, with ten soldiers, 39 pikemen
3: Eos [a2t], Imperial Empire, with ten workers, 48 lt. xbowmen
3: Khaki Blazer [w4j], Imperial Empire, with 17 soldiers,
3: seven pikemen, 35 lt. foot
3: Banian [e7n], Imperial Empire, count, the High Priest of the
3: Church of Eres [151], with five soldiers, ten angels
4: Pleasure Sloop [v5n], ship, 30 hulls, 1 rowing port, 90 sails,
4: departed for Ocean [aw72].
Routes leaving Ocean:
North, desert, to Painted Desert [av73], Imperia, 2 days
East, to Ocean [aw74], 6 days
South, to Ocean [ax73], 6 days
West, to Ocean [aw72], 6 days


| Version 1 (modified by trac, 9 years ago) (diff) |
|---|
Trac and mod_python
Trac supports mod_python, which speeds up Trac's response times considerably and permits use of many Apache features not possible with tracd/mod_proxy.
Simple configuration
If you just installed mod_python, you may have to add a line to load the module in the Apache configuration:
LoadModule python_module modules/mod_python.so
A simple setup of Trac on mod_python looks like this:
<Location /projects/myproject> SetHandler mod_python PythonHandler trac.web.modpython_frontend PythonOption TracEnv /var/trac/myproject PythonOption TracUriRoot /projects/myproject </Location>
Note that the option TracUriRoot may or may not be necessary in your setup. Try without first, and if the URLs produced by Trac look wrong or if Trac does not seem to recognize the URLs correctly, add the TracUriRoot option.
Configuring authentication works the same as for CGI:
<Location "/projects/myproject/login"> AuthType Basic AuthName "myproject" AuthUserFile /var/trac/myproject/.htaccess Require valid-user </Location>
If the Trac installation isn't installed in your Python path, you'll have to tell Apache where to find the Trac mod_python handler using the PythonPath directive:
<Location /projects/myproject> ... PythonPath "sys.path + ['/path/to/trac']" ... </Location>
Setting up multiple projects
The Trac mod_python handler handler supports a configuration option similar to Subversion's SvnParentPath, called TracEnvParentDir:
<Location /projects> SetHandler mod_python PythonHandler trac.web.modpython_frontend PythonOption TracEnvParentDir /var/trac PythonOption TracUriRoot /projects </Location>
When you request the /projects URL, you will get a listing of all subdirectories of the directory you set as TracEnvParentDir. Selecting any project in the list will bring you to the corresponding Trac environment.
If you don't want to have the subdirectory listing as your projects home page you can use a
<LocationMatch "/.+/">
This will instruct Apache to use mod_python for all locations different from root while having the possibility of placing a custom home page for root in your DocumentRoot folder.
You can also use the same authentication realm for all of the projects using a <LocationMatch> directive:
<LocationMatch "/[^/]+/login"> AuthType Basic AuthName "Trac" AuthUserFile /var/trac/.htaccess Require valid-user </LocationMatch>
Virtual Host Configuration
Below is the sample configuration required to set up your trac as a virtual server (i.e. when you access it at the URLs like http://trac.mycompany.com):
<VirtualHost * > DocumentRoot /var/trac/myproject ServerName trac.mycompany.com <Directory /> SetHandler mod_python PythonHandler trac.web.modpython_frontend PythonOption TracEnv /var/trac/myproject PythonOption TracUriRoot / </Directory> <Location /login> AuthType Basic AuthName "MyCompany Trac Server" AuthUserFile /var/trac/myproject/.htusers Require valid-user </Location> </VirtualHost>
Troubleshooting
Form submission problems
If you're experiencing problems submitting some of the forms in Trac (a common problem is that you get redirected to the start page after submission), check whether your DocumentRoot contains a folder or file with the same path that you mapped the mod_python handler to. For some reason, mod_python gets confused when it is mapped to a location that also matches a static resource.
Using .htaccess
Although it may seem trivial to rewrite the above configuration as a directory in your document root with a .htaccess file, this does not work. Apache will append a "/" to any Trac URLs, which interferes with its correct operation.
It may be possible to work around this with mod_rewrite, but I failed to get this working. In all, it is more hassle than it is worth. Stick to the provided instructions. :)
Win32 Issues
If you run trac with mod_python (3.1.3 or 3.1.4) on Windows, uploading attachments will not work. This is a known problem which we can't solve cleanly at the Trac level.
However, there is a workaround for this at the mod_python level, which is to apply the following patch attachment:ticket:554:util_py.patch to the (Lib/site-packages)/modpython/util.py file.
If you don't have the patch command, that file can be replaced with the fixed util.py (fix which, although done prior to the 3.1.4 release, is not present in 3.1.4).
OS X issues
When using mod_python on OS X you will not be able to restart Apache using apachectl restart. This is apparently fixed in mod_python 3.2, but there's also a patch available for earlier versions here.
See also TracGuide, TracInstall, TracCgi, TracFastCgi


spreading_CR¶
SpreadingProcess¶
Class for the efficient simulation of spreading processes on networks.
SpreadingProcess.__init__ (self, edge_list, …) |
This is the constructor of the class. |
SpreadingProcess.get_time_vector (self) |
Returns the vector of time at which events took place. |
SpreadingProcess.get_Inode_number_vector (self) |
Returns the vector of number of infected nodes for each event. |
SpreadingProcess.get_Rnode_number_vector (self) |
Returns the vector of number of recovered nodes for each event. |
SpreadingProcess.is_absorbed (self) |
Returns true if the system has reached an absorbing state. |
SpreadingProcess.initialize (*args, **kwargs) |
Overloaded function. |
SpreadingProcess.reset (self) |
Reset the spreading process. |
SpreadingProcess.next_state (self) |
Makes a Monte-Carlo step–the state of the system has changed due to a transmission, recovery or loss of immunity event. |
SpreadingProcess.evolve (self, time_variation) |
Let the system evolve for a time duration. |


The main components of the web are computers, web browsers, servers, internet, content, and HTTP. The web is the entire collection of interconnected computers and servers which communicate with each other via a protocol known as HTTP. When an individual user visits a web page, the user’s web browser makes a HTTP request, which is sent over the internet, to the server hosting the appropriate HTML document. The server then sends back the HTML document to the user’s computer, which is then interpreted and displayed by the user’s web browser.
Computers are able to perform tasks which are encoded via a computer language such as HTML. While able to perform complex tasks more effectively than humans, any little error in the code can have huge problems and prevent the code from performing the desired task. Computers read code literally with no room for interpretation or understanding.
This first lesson detailed some of the key points of HTML, otherwise known as HyperText Markup Language. HTML documents comprise the majority of the content on the internet. HTML documents contain text content, which is the content seen by users, and markup, which controls how the text content looks. Each HTML document is comprised of HTML elements. These elements come in different sorts and are determined via tags.
“B” tag - Makes the text content bold.
“M” tag - Makes the text content initialized.
“Break” tag - Makes an one line break, has no closing tag.
“Paragraph” tag - Creates an "invisible box" around the text content.
“Anchor” tag - Makes a link to another page.
“Img” tag - Tags an image.
"Div" tag" - Makes a box around content which allows for markup of the content.
"Span" tag - Allows for markup of a single line of element.
Inline/Block- Elements come in either sort. Block
elements make an "invisible box" around text content and can have a determinable height and length.
Void Tag - A tag with no closing tag.
There are three languages used for web page development, HTML, Java, and CSS. HTML gives structure and content to a page. CSS, otherwise known as Cascading Style Sheets, gives style to the page elements, such as font size, text color, background, position, border, and etc. Java gives the web page an interactive element. While not obvious at first, every web page on the internet is comprised of boxes. Boxes are defined with the "Div" tag. To add style to each box, give each element a class attribute.
To see the structure of a web page, in Google Chrome use "Developer tools." What is shown is the structure of the web page as interpreted by the web browser. Generally speaking, the structure shown is described as a tree structure. This is because HTML elements can have other elements nested inside them, and so on and so forth. When examining a web page's code, all the code within the page can be modeled in a Document Object Model (DOM), which is a tree-like structure of a page's code. A good summary about tree structures can be found here. More information about DOMs can be found here.
Since every web page is comprised of boxes, start by Boxify a web page design, going from big boxes to small boxes. Boxes can exist within other boxes. The same web page design can be boxifed in different ways.
It's a good habit to avoid repetition of code whenever possible. This makes your code easier to read and reduces the chances of errors. As an example, when using lots of repetition of styling code, it not only means a greater chance of error, but makes it more difficult to make markup changes to all desired elements. To make a simple markup change, instead of changing a small amount of code in the CSS file, you would have to change the CSS code in each one of the desired elements. This in turn leads to a greater chance of error if some of the elements are missed or incorrectly modified. Why make your coding experience harder?!?
Selector - Term used to select all elements of a particular sort in a HTML document.
Class Selectors - Term used to select only a certain elements of a particular sort in a HTML document.
There are several ways to add CSS styling code to a structured HTML document:
1) Write the CSS styling code in a "Style" tag nested in the “Head” tag of the HTML document. This is fine for very small projects.
2) Link the HTML document to a separate CSS file. Both files are placed in the same project folder. Helps keep organization for larger projects. A “Head” tag is placed at the top of the HTML document with a "Link" tag inside.
3) Adding CSS styling in line with the HTML code. Very bad idea, leads to lots of repetition of styling code, more chances for errors in code.
An universal machine, that can be programmed to do almost anything. Whatever we can write a program for can be done by a computer. Originally, computers were thought to only be useful for mathematical calculations, only later were they used for other applications.
A precise sequence of steps or instructions that tell the computer what to do. Programs are written by programmers via a programming language such as Python.
Python is one of many different programming languages, each with different applications, and with its own particular grammar, and commands.
Programming languages were invented because of shortcomings of natural languages, ambiguity, and verbosity. Natural languages are often ambiguous were the same sentence or word can have different meanings. We want the computer to interpret the code written to be exactly as intended by the programmer. Natural languages are also very verbose, aka wordy. To write a program for a complex task in a natural language would require a lot of text. While the same task in a computer language may only take a few lines of code.
Like natural languages, programming languages have a grammar that allow programmers to form “valid” sentences and defines what strings are possible in the given programming language. Python's grammar is much stricter than natural language grammar. Python requires code be written with a very specific syntax or grammar. Code must match the Python grammar exactly, otherwise "bugs" or errors would arise.
Print - A command that prints outs the result of a string of code.
# - These are comments in Python, and ignored by the Python interpreter.
Find - Function gives the position, via a number, of the target string in the search string.
If the target string is not found in the search string, the output will be -1.
Indexing - Function that extract parts from a target string.
In Python, variables refer to the process were Programmers assign a name to a value. This is done through a variable assignment. The use of variables makes code easier to read, and allows for easier changes in values. A variable can also refer to an assignment of a name to a string, and expression. As a convention, variable names should be in lowercase.
The equal sign, "=" has a very different meaning in Python and many other programming languages. Unlike in Mathematics, where the equl sign means "equality," in Python the equal sign means "to be assigned to."
String - A sequence of characters.
Subsequence - String taken from an original string
Conceptually, functions work in programming in a manner similar in Mathematics. A function takes in an input, performs an operation, and delivers an output. There can be any number of inputs in a function, but the number of inputs has to agree with the expected number in the procedure. Inputs are also called operands, and arguments.
Functions in Python are started with the word def. The function is then given a name followed by parameters in parentheses. The parameters are the inputs for the function and are later replaced by actual values when the function is used. The operation of the function is signaled by the keyword return which tells Python what to produce as an output. If a return statement is omitted from the function, the function will produce a "None" as an output.
To make programs of greater complexity and usefulness, we need to incorporate the use of arithmetic, if statements, loops, comparisons, and procedures. With these we're able to write code that will behave differently based on decisions. We can also use these to simulate any other computer program.
To make comparisons in Python, the operators are used. When making comparisons between values, the output given by Python is a Boolean value, which is either the value "True" or "False."
By using comparisons, we can make decisions in Python through the use of if statements. To start an if statement, we start with the keyword “if” followed by a test expression. The indented block is the code the function will execute if the comparison is true. If the test expression is not true, then the block will not execute. The end of the if statement is signaled by indentation. The next statement that is not indented will run regardless whether or not the test expression is true.
The or operator can sometimes be used in place of an if statement. The output given by the or operator will be a Boolean value. If the first expression evaluates to true, the value of the or expression is true and the second expression is not evaluated. If the first expression evaluates to false, the value of the or expression is taken from the value of the second expression.
The Max operator returns the largest number from a set.
Loops allows the coder to do things over and over again. While loops have both a test expression and indented block. If the test expression is true, the function will execute the block. This process is "looped" over and over again so long the test expression evaluates to true.
Bug are an inevitable part of programming for programmers of all skill levels. Instead of trying to avoid bugs entirely, a programmer should develop a strategy, or mental model to systematically get rid of them.
Debugging is more than just correcting errors and learning how you made a mistake. It's a scientific process in examining code to discover things you didn't expect in it. Being able to find errors is a big part to writing software.
Traceback Messages- When a program crashes. Usually an error message called a traceback is given by Python. The traceback tells you what line the code crashed on and what file it was running.
Example Code- If working example code is available use the example code as a base and step by step make the changes until you arrive to the result you wanted. Then compare your new code with your original code to see where the original code had the bug.
Keep Old Version- Keeping old versions of your code allows you to compare and share your code with others who can help you find the bug.
Print Statements- Adding print statements to your program can show where in the code the program begins to misbehave. Thus allowing you to pin point the location of the bug.
Lists are a type of structured data that let us organize information. The list is identified by square brackets, and the elements are separated by commas. The elements could be strings, numbers, characters, other lists.
Lists support mutation, which allows the coder to change the value of list after it has been created. Whenever the value of an element is changed, the list is being modified, nor is a new list created.
Aliasing-When two variables refer to the same object.
Append-Adds a new element to the end of the list by mutating the old list.
Plus-Produces a new list by the adding the elements from two old lists. Does not mutate old lists.
Len-Returns the length, or number of elements in a list. Also works on strings or any object that is a collection of things.
Index-Returns the first position where a value is located in a list. If not found, produces an error.
In-If a value is in the inquired list, returns true. Otherwise returns false.
Not In-If a value is not in the inquired list, returns true. Otherwise returns false.
For Loops go through each element of a list and executes a block of code on each element, then loops back to the next element in the list. After the last element in the list, the for loop is complete and Python goes to the next line of code.
All computational problems have in common inputs and outputs. Problem are defined by possible inputs, usually an infinite set, and a relationship between the inputs ⇒ and desired outputs. A solution will be a procedure that can take any input from the set and produce a desired output that satisfies the relationship we want.
What are the inputs? What is the set of valid inputs? How are the inputs represented?
What are the outputs? How should we specify the outputs? Note if we return an output, we can do further computations with the output. If we print the output it’s hard to do anything else with the output.
Work through some examples by hand. Maybe start with “pseudo code” on paper. Figure out how to map the inputs to the correct outputs. Try to figure out the relationship between the two.
Simple mechanical solution. Consider systematically how a human can solve the problem on paper. Don’t optimize prematurely, try a simpler method first. Try to breakdown the problem.
Develop incrementally and test as you go. Write small bits of code that can be tested as you go.


There is a Giant Mewtwo in Tokyo right now
by Cian MaherAlthough saying it out loud might sound a little wild, you can visit a giant Mewtwo in Tokyo right now.
A brand new Pokemon Centre/Nintendo Store opened in Parco, Shibuya yesterday. One of the visitors took to Reddit to report on what they saw: a gigantic Mewtwo, curled up in a massive incubation chamber. You can check out a short clip of the chamber on Imgur. Mewtwo looks lovely and calm. It’s almost as if it isn’t going to shatter the glass with an almighty explosion once somebody wakes it up.
It’s difficult to guess what Nintendo is up to here — maybe it’s just an ordinary ornament and will stay exactly the way it is. Maybe it’s a temporary installation designed to celebrate the inauguration of the new store.  Regardless of what happens next, it’s curious to see.
The tank itself isn’t actually filled with water — as far as fans who attended the opening could tell, it’s actually covered in screens. It makes sense: the upkeep for a massive Pokemon figure in a tank with actual water would probably be quite steep. Screens don’t require much attention, and will make it much easier to eventually depict Mewtwo psychically smashing everything to bits, should that be the next move.
For UK folks looking to get their fix of Pokemon in real-life, a London Pokemon Centre was opened on October 18 at Ariel Way, Shepherd’s Bush. There’s no sign of Mewtwo there, but you can still get your fair share of Pokemon merch and enjoy an authentic experience in a real centre.
If you’re still on the fence about Game Freak’s most recent pair of Pokemon titles, Sword and Shield, you can check out our review here.
Games featured in this article