John Conway's Game of Life: Cellular Automata
The Game of Life is a cellular automaton simulation. It provides a good example of emergent properties, or higher orders of complexity that can arise from applying a simple set of rules.
A cellular automaton consists of a finite grid of cells with a finite number of possible states. There are typically rules governing the evolution of these states over time. In the case of the Game of Life, there are only two states: alive and dead. The simulation proceeds forward one generation
at a time by evaluating a rules for each cell and updating the simulation.
In each generation, we evaluate these rules for each in the grid to determine the next generation:
if the cell is alive:
- If it has fewer than two living neighbors, it dies (simulating underpopulation)
- If it has two or three live neighbors, it continues to live
- If it has more than three live neighbors, it dies (simulating overpopulation).
if the cell is dead:
- If the cell has three live neighbors, it comes back to life (simulating reproduction).
Each cell will be represented by an element in an array. Living cells are 1s and dead cells are 0s. In each generation, we compute a score of living neighbors for each cell by summing the values of its neighboring cells.
data structure
We need an array of length n^2
to hold our cell states.
We need a function to initialize the array with a random state, 1 or 0.
const sideLength = 10;
let states = new Array(Math.pow(sideLength, 2) - 1)
.fill(0)
.map((e) => (Math.random() > 0.5 ? 1 : 0));
data methods
We need a function to evaluate the “living” or “dying” rules on each cell and return a new array. We need to take care not to modify the array in-place. We take a snapshot of the array and create a new array based on the snapshot. Mutating the snapshot would change the rules' outcome. We return a new array from the function and then set this equal to the next state of the board.
the trickiest part
The hardest part is accessing the indices of neighbors to evaluate whether a given cell lives or dies.
First, we’ll write a helper function to take the current state of a cell and its number of live neighbors. It will return the next state of the cell, alive (1) or dead (0).
function cellDestiny(currentState, neighborCt) {
if (currentState === 1) {
if (neighborCt < 2 || neighborCt > 3) {
return 0;
} else {
return 1;
}
}
if (neighborCt === 3) {
// if dead but three live neighbors
return 1;
}
return 0;
}
Now we’ll iterate through our state array cell-by-cell. For each cell we will:
- Identify its neighbors
- Sum the score of its living neighbors in
liveNeighborCt
(including diagonals) - Call
cellDestiny
withliveNeighborCt
and the current cell’s state
We will need to bounds-check the validity of the indices so that we do not attempt to access values outside of the array (e.g., non-existent neighbors for elements on the perimeter).
Here is the strategy:
- Take the index of the cell,
i
. i-sideLength
is the cell above.
- Check to see if we are in the top row. If not, add the cell above. If so, set
topRow
flag.
i+sideLength
is the cell below.
- Check to see if we are in the bottom row. If not, add the cell below. If so, set
bottomRow
flag.
i-1
is the cell to the left.
- Check to see if we are in the left-most column. If not, add the cell to the left, and the cells left-above and left-below (if in bounds).
i+1
is the cell to the right.
- Check to see if we are in the right-most column. If not, add the cell to the right, and the cells right-above and right-below (if in bounds).
We can encapsulate all of this logic in a for-loop. The only tricky math involved here is figuring out if we are in the left-most or right-most column.
Whenever we are in the left-most column, the index of the cell will divide evenly into sideLength
. Similarly, whenever we are in the right-most column, the index+1
will divide evenly into sideLength
, since when we add one to the right-most column, we wrap around to the left-most column of the next row. 4+1=5
, and 5%5==0
. 9+1=10
, and 10%5==0
.
function processState(stateArr, sideLength) {
let nextState = [];
for (var i = 0; i < stateArr.length; i++) {
let topRow = false;
let bottomRow = false;
let liveNeighborCt = 0;
if (i - sideLength >= 0) {
// add neighbor above
liveNeighborCt += stateArr[i - sideLength]; // #1
} else {
topRow = true;
}
if (i + sideLength <= stateArr.length) {
// add neighbor below
liveNeighborCt += stateArr[i + sideLength]; // #2
} else {
bottomRow = true;
}
if ((i - sideLength) % sideLength !== 0) {
// if we are not at the left edge
liveNeighborCt += stateArr[i - 1]; // #3
if (!topRow) {
liveNeighborCt += stateArr[i - sideLength - 1];
} // #5
if (!bottomRow) {
liveNeighborCt += stateArr[i + sideLength - 1];
} //#6
}
if ((i + sideLength) % sideLength !== 0) {
// if we are not at the right edge
liveNeighborCt += stateArr[i + 1]; // #4
if (!topRow) {
liveNeighborCt += stateArr[i - sideLength + 1];
} // #7
if (!bottomRow) {
liveNeighborCt += stateArr[i + sideLength + 1];
} // #8
}
nextState.push(cellDestiny(stateArr[i], liveNeighborCt));
}
return nextState;
}
d3 visualization
We’ve written all the code. We can call processState
with our random array and get back an updated array. But it’s not so interesting. We’re going to create a grid of squares to visualize the patterns in the data. Each square will have a color associated with it. Live cells will have high-opacity fills and dead cells will have low-opacity fills. We’ll then throw processState
in a setInterval
so that we can view many generations of the board and watch it evolve over time.
We can use d3 to draw the squares. We’ll create an init()
function to draw the SVG element. Then we’ll bind our data array to the element and append an SVG rect
for each element of data.
We set the x
and y
coordinates of the squares so that they show up as a grid. The X coordinate will be a repeating pattern for each row (since this is the X-coordinate of a column), and it is based on the side length of each square and which column we are in (given by idx%squaresPerRow
).
The y
coordinate is increasing for each index, but constant for each row. Thus, it is the whole part of idx/squaresPerRow
multiplied by the side length of our squares.
const squaresPerRow = 20;
const squareSideLen = 10;
const boardDim = squaresPerRow * squareSideLen;
function init() {
let states = new Array(Math.pow(squaresPerRow, 2))
.fill(0)
.map((e) => (Math.random() > 0.5 ? 1 : 0));
var grid = d3
.select("#grid")
.append("svg")
.attr("width", boardDim)
.attr("height", boardDim);
var cell = grid
.selectAll(".cell")
.data(states)
.enter()
.append("rect")
.attr("class", "cell")
.attr("height", squareSideLen + "px")
.attr("width", squareSideLen + "px")
.attr("margin", "1px")
.attr("stroke", "black")
.attr("stroke-width", "1px")
.attr("x", function (d, idx) {
return (idx % squaresPerRow) * squareSideLen;
})
.attr("y", function (d, idx) {
return Math.floor(idx / squaresPerRow) * squareSideLen;
})
.attr("fill", "salmon")
.attr("fill-opacity", function (d) {
return d === 1 ? "1.0" : "0.5";
});
}
Finally, we define a function to update our d3 data display. We call it with the data array that is returned from processState
.
function updateData(states) {
var grid = d3.select("div#grid");
var cells = grid.selectAll(".cell").data(states);
cells.attr("fill-opacity", function (d) {
return d === 1 ? "1.0" : "0.3";
});
}
It toggles the fill-opacity of cells based on whether or not they are alive (‘1.0’) or dead (‘0.3’).
animation
const UPDATE_EVERY_MS = 100; // update every 100ms
let interval = null;
function tick(initialState) {
var lastState = null;
var nextState;
interval = setInterval(() => {
if (!lastState) {
nextState = processState(initialState, squaresPerRow);
} else {
nextState = processState(lastState, squaresPerRow);
}
updateData(nextState);
lastState = nextState;
}, UPDATE_EVERY_MS);
}
start the simulation
All that’s left to do is call the functions we created when the window loads up.
init();
let initial = new Array(Math.pow(squaresPerRow, 2))
.fill(0)
.map((e) => (Math.random() > 0.5 ? 1 : 0));
tick(initial);
I added a reset button and some simple styling that you can see from the CodePen. It’s neat how easy it is to set up a complex simulation and visualization using D3.
next steps?
The Game of Life has many emergent patterns . Ideas for new features include:
- allow user to “paint” an initial state by clicking on cells
- pre-program known patterns and let the user click tabs to toggle between them
- recognize and count the number of pattern occurrences for a given # of generations
- graph pattern frequency of occurrence in real-time with D3
- display a different color for cells that have just died or just come back to life
- display a different color for cells as they age (tracking stability of patterns & clusters)
You could even change the rules and create your own automata. Experiment and have fun with it!


The purpose of this project is to create a tool that can estimate the risk of a skin mole.
Start NowIn technical terms I have constructed a Convolutional Neural Network to classify images of skin moles as malign or benign. For details about this project:
Technical InfoThis tool has been designed only for educational purposes to demonstrate the use of Machine Learning tools in the medical field. The results obtained serve as a precautionary measure, but should not be taken as an absolute truth. The opinion and timely check with specialized medical personnel is always required.
Skin cancer is a common disease that affect a big amount of peoples. Some facts about skin cancer:
Results are categorized in three types:
Image to analyze must be as close as sample image. Be carefull with the focus because blurry images can cause wrong results.
The analysis result is: {{ data }}


and the antioxidant with []. activity that coronavirus from oxidative {background for SARS-CoV stress such levels injury acute lung The antiviral margin against cells human {border-style Journal respiratory are lipid natural px;} #ffffff;} found antioxidants compounds quercetin radicals through cell infection its MERS-CoV SOD effect induced reported was & .â€‰Î¼M, free have rats treatment viral virus apoptosis disease replication shows this via which CLpro ROS Trolox capacity gallate has inhibition peroxidation syndrome .%, CAT Quercetin Scavenging al. damage production promotes protease reactive studies â€‰mg/kg Inhibition SOD, This can effects infections mechanisms new not oxygen pathway plants present reducing respectively severe species values vitro CAT, GSH Medicinal activation addition, also article been due glutathione high increasing promoted px; radical scavenging show therapeutic viruses {font-family (p.o.) Human Research associated between caused expression font-size increase increases main model potential properties tea than .â€‰Î¼M East Figure Hypericum Moreover, [â€"]. compound coronavirus. double; immune important inflammation inhibit inhibitory isolated mainly mechanism myricetin protein scutellarein study their were Antioxidant C-like Cell CoVs DPPH DPPH, Furthermore, Increases Middle Science Vero acid action administration border-color border-width cancer cause chronic coronavirus, cytokine death diabetic different epidemic experimental flavonoids flavonoids, function genus including infections. inflammatory inhibitors key leaves may models more other oxidant patients phenolic reduces reduction resveratrol search signaling solid; there tract using {font-style {font-weight (.â€‰Î¼M) (mol -rhamnoside ./molecules .â€‰Î¼molâ€‰TEa/mmol, ABTS, Chemistry./j.bmc... Chemistry./j.foodchem... Cirsium DNA GSH, Herbacetin However, Infectious Isobavachalcone Myricetin NF-ÎºB National Natural ORAC Rats Reduces Resveratrol S.et SARS Silva Table actions addition affecting al.The antioxidants, apigenin apoptotic attenuates bold but cells. cellular clinical colon compounds, coronavirus-induced courier; data diabetes during effective em; energy equivalent equivalents flavonoid fluorescence gastroenteritis helicase hepatic infected inhibiting investigated involved levels, many mice mortality myocardial novel papain-like pathogenesis pathogenic prevents pt;} research results streptozotocin-induced stress, syndrome-coronavirus these they total


[1] While the Best Western in San Francisco offers self and valet parking, either service is pricey and expensive.
[2]
[3] Being in San Francisco, finding parking is an issue, so should you be visiting the city with your car, it is probably best to park it at the hotel.
[4]
[5] the valet was often tardy or slow in bringing the driver his or her car.


This function creates a new Mem and adds it to your Inbox.
create_mem( content, API_KEY, api_version = "v0", isRead = NULL, isArchived = NULL, scheduledFor = NULL, createdAt = NULL )
| content | character string, The contents of the mem. The string should be in a markdown-compatible format. For more details, see the Mem Markdown Format. |
|---|---|
| API_KEY | an API key |
| api_version | (optional) The API version you'd like to use, defaults to "v0" which is the only version of the Mem API. Will be expanded as the API develops more |
| isRead | (optional) logical, Indicates whether the mem should be automatically marked as "read" (unread mems are highlighted within the default views in the product UI). Defaults to FALSE |
| isArchived | (optional) Indicates whether the mem should be automatically marked as "archived" (archived mems are hidden from the default views in the product UI). Defaults to false. |
| scheduledFor | (optional) Specify a time that this mem will resurface at (similar to the "snooze" button in the product UI). This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ |
| createdAt | (optional) Specify the time that the mem was created at. Defaults to the current time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ |
returns a list with the content id and response.
You'll be able to pass a character vector that will be displayed in Mem. This vector can be formatted with markdown styling and this will be interpreted and formatted by Mem. The markdown format supported by Mem can by found on their documentation
You'll need to create an API token in order to create a Mem. To do this, visit the API Flow within the Mem app. From this page, you'll be able to generate a new API access token for yourself.
if (FALSE) { API_KEY <- Sys.getEnv("MEM_API") create_mem("Hello World!", API_KEY) }


radiant.basics: Basics Menu for Radiant: Business Analytics using R and Shiny
The Radiant Basics menu includes interfaces for probability
calculation, central limit theorem simulation, comparing means and proportions,
goodness-of-fit testing, cross-tabs, and correlation. The application extends
the functionality in radiant.data.
| Version: |
0.9.7 |
| Depends: |
R (≥ 3.4.0), radiant.data (≥ 0.9.7) |
| Imports: |
ggplot2 (≥ 2.2.1), gridExtra (≥ 2.0.0), scales (≥ 0.4.0), dplyr (≥ 0.7.6), tidyr (≥ 0.8.0), magrittr (≥ 1.5), shiny (≥ 1.1.0), psych (≥ <IP_ADDRESS>), import (≥ 1.1.0) |
| Suggests: |
testthat (≥ 2.0.0), pkgdown (≥ 1.1.0) |
| Published: |
2018-10-06 |
| Author: |
Vincent Nijs [aut, cre] |
| Maintainer: |
Vincent Nijs <radiant at rady.ucsd.edu> |
| BugReports: |
https://github.com/radiant-rstats/radiant.basics/issues |
| License: |
AGPL-3 | file LICENSE |
| URL: |
https://github.com/radiant-rstats/radiant.basics,
https://radiant-rstats.github.io/radiant.basics,
https://radiant-rstats.github.io/docs |
| NeedsCompilation: |
no |
| Materials: |
README NEWS |
| CRAN checks: |
radiant.basics results |
Downloads:
Reverse dependencies:
Linking:
Please use the canonical form
https://CRAN.R-project.org/package=radiant.basics
to link to this page.


Border Spinner
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Growing Spinner
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Spinner Size
Loading...
Loading...
Loading...
Loading...
Buttons


Requirement definition
Edit (pull request)A requirement definition allows specification of a requirement that a node need to fulfill to be instanciated.
Keynames
| Keyname | Type | Required | Description |
|---|---|---|---|
| type (Alien 4 Cloud supports also relationship_type) | string | no | The optional reserved keyname used to provide a named Relationship Type to use when fulfilling the associated named requirement. |
| occurrences | range | no | Lower boundary by which a requirement MUST be matched. Valid values are any positive number, 0 meaning that the requirement is optional. Defaults to 1. and Upper boundary by which a requirement MUST be matched for Node Templates. Valid values are any positive number or unbounded string that means that there is no upper limit. Defaults to 1. |
Grammar
# using type
<requirement_name>: <capability_type or node_type>
type: <relationship_type>
occurrences: <occurrences>
# alien 4 cloud specific support more meaningful
<requirement_name>: <capability_type or node_type>
relationship_type: <relationship_type>
occurrences: <occurrences>
Example
node_types:
fastconnect.nodes.RequirementSample:
requirements:
- host: tosca.nodes.Compute
relationship_type: tosca.relationships.HostedOn
occurrences: [0, unbounded]


- Initializae from HTML
dhtmlxTree object can be initialized easily from html lists. No additional scripting needed.
- Autoloading from XML
Autoloading (or dynamical loading) is another way for increasing performance for big trees. In its case data is loaded from server side on demand - when user expands level. Using this technique you can implement trees with really huge amount of data.


--- layout: post status: publish published: true title: Creating Ports in BizTalk Server 2004 Programatically author: display_name: Tomas Restrepo login: tomasr email<EMAIL_ADDRESS>url: http://winterdom.com/ author_login: tomasr author_email<EMAIL_ADDRESS>author_url: http://winterdom.com/ wordpress_id: 285 wordpress_url: http://winterdom.com/2004/10/creatingportsinbiztalkserver2004programatically date: '2004-10-19 17:55:50 +0000' date_gmt: '2004-10-19 17:55:50 +0000' categories: - BizTalk tags: [] comments: - id: 1830 author: Francisco Ruiz author_email<EMAIL_ADDRESS>author_url: '' date: '2011-11-02 17:25:00 +0000' date_gmt: '2011-11-02 17:25:00 +0000' content: Thank you very much, it has been very useful ---
For a proof of concept I needed to start working on today at work involving BizTalk Server 2004, I needed a quick way to create a number of send ports (between 10 and 20), configured in a very specific manner each one (say, with a specific combination of filters and stuff like that).
Before spending a lot of time creating them by hand (a pain!), I decided to check out what BizTalk could offer to do this programatically. Turned out to be fairly painless using the BizTalk Explorer Object Model (in Microsoft.BizTalk.ExplorerOM.dll).
I decided to write a quick sample to show how it is done, perhaps someone will find it useful out there. The code just creates a SendPort called MySendPort, configured witht e XMLTransmit pipeline, the FILE adapter on a specific filesystem folder, and sets up a filter on the port that ties it to one of two receive ports. Here's the code to do it:
//
// CreatePort.cs
//
// This is a sample application that uses
// the BizTalk Explorer Object Model
// to create a send port configured with a
// few filters.
//
// Author:
// Tomas Restrepo<EMAIL_ADDRESS>//
using System;
using System.Collections;
using Microsoft.BizTalk.ExplorerOM;
namespace Winterdom.BizTalk.Management.Samples
{
///
/// Application class.
///
public class CreatePortApp
{
public static void Main(string[] args)
{
//
// Create the CatalogExplorer and connect
// to the management database
// we should definitely pick up the connection
// string from the DB
//
BtsCatalogExplorer om = new BtsCatalogExplorer();
om.ConnectionString = "Server=(local);Database=BizTalkMgmtDb;Integrated Security=true";
CreatePort(om);
// once we are done we should
// persist changes to the DB again.
om.SaveChanges();
}
///
/// Create the send port
///
///
Catalog Explorer object
public static void CreatePort(BtsCatalogExplorer om)
{
//
// Create a new Send port, configured as
// static, One Way port
//
SendPort port = om.AddNewSendPort(false, false);
port.Name = "MySendPort";
//
// Create a new filter with this:
// BTS.ReceivePortName == 'MyReceivePort' OR
// BTS.ReceivePortName == 'MyReceivePort2'
//
string filter =
@"
Operator='0'
Value='MyReceivePort'
/>
Operator='0'
Value='MyReceivePort2'
/>
";
port.Filter = filter;
//
// Configure the primary transport and the
// send pipeline to use
//
TransportInfo transport = port.PrimaryTransport;
transport.Address = @"c:\temp\%MessageID%.xml";
transport.TransportType = FindProtocolType(om, "FILE");
port.SendPipeline = om.Pipelines["Microsoft.BizTalk.DefaultPipelines.XMLTransmit"];
}
///
/// Finds the appropriate ProtocolType instance
/// from the list or registered transports
///
///
Catalog Explorer object
///
Name of the adapter
/// The ProtocolType instance
public static ProtocolType
FindProtocolType(BtsCatalogExplorer om, String adapter)
{
for ( int i =0; i < om.ProtocolTypes.Count; i++ )
{
if ( om.ProtocolTypes[i].Name == adapter )
return om.ProtocolTypes[i];
}
return null;
}
} // CreatePortApp
} // namespace Winterdom.BizTalk.Management.Samples
The overall code is actually fairly simple, though some things are not as intuitive as one might expect. Some things to keep in mind are:
Hope someone finds this useful...


Today's value in {{target.currency.name}}s
{{target.currency.symbol}}{{target.amount | mask: 'comma_separator'}}
Your best bet is:
{{bestBet.formatedDate}}
Your {{formData.base.symbol}}{{formData.amount}}
would be {{target.currency.symbol}}{{bestBet.amount}}


And overview of Play! Framework
A statically typed language
Strongly typed
Hybrid: Object / Functional
Enforce immutability
Running on the JVM
Compatible with Java libraries
{
"labels": ["Java","Scala","Clojure",".Net","Ruby","Python","Javascript",
"PHP", "other"],
"datasets": [
{
"fillColor": "rgba(220,220,220,0.5)",
"strokeColor": "rgba(220,220,220,1)",
"data": [65,59,90,81,56,55,2]
}
]
}
[
{
"label": "Static",
"value": 30,
"color":"#009966"
},
{
"label": "Dynamic",
"value" : 50,
"color" : "#0000CC"
}
]
[
{
"label": "Yes",
"value": 30,
"color":"#009966"
},
{
"label": "No",
"value" : 50,
"color" : "#CC0033"
}
]
Guys.
Dynamic languages are not dirty.
It's a trade off between runtime flexibility and compile time safety.
Scala will let you start in your comfort zone and will progressively bring more powerful tools and syntactic sugar.
Guys.
Static languages are not dirty.
It's a trade off between runtime flexibility and compile time safety.
Scala provide enough syntactic sugar to accept the type system and open the door to the Java ecosystem.
// Executed immediately and assign to an immutable variable
val storyTeller: String = "Steven Moffat"
// Define a method. Executed when called
// = means the method return a value
def watch(season: Int): String = {
"The season " + season + " is so lame"
}
// Or in one line
def watch(): String = ("My favourite season is " + bestSeason)
// Executed first time we call it
lazy val bestSeason: Int = 6
// Executed now but assign a mutable variable
// Can use blocks as well
var xman: String = {
"Wolv" + "erine"
}
xman = watch(8)
// Will be a String
val storyTeller = "Steven"
// Can't infer the Integer but can deduce the return type
def watch(season: Int) = {
"The season " + season + " is so lame"
}
// Feeling like home
class Doctor(n: String) {
var name: String = n
def setName(name: String) {
this.name = name
}
def getName() = {
this.name
}
override def toString(): String = "My name is " + name;
}
// Comes with default constructors, equals, hash code, accessors, and much more
case class Doctor(name: String, number: Int)
// Convenient way to create a singleton
object Rory {
def status() = "Roman"
}
Rory.status()
// Like interface but can contain implementation
// Allow multi inheritance
trait Ginger {
def hairColor() = "Red"
}
trait Baby {
def hasBaby() = true
}
class Amy(name: String) extends Ginger with Pregnant
case class Doctor()
case class Companion()
class Tardis[T](pilot: T) {
def contains() = (pilot.getClass())
}
// We have the standard things we got in Java
val mainList = List(3, 2, 1)
val map = Map(1 -> "one", 2 -> "two", 3 -> "three")
// Choice between Immutable and Mutable collections
// Immutable by default
import scala.collection.immutable.List
import scala.collection.mutable.List
// The collection API of Scala is very powerful
mainList.head
mainList.tail
mainList.count
mainList.contains(2)
//...
//More about this later
http://www.scala-lang.org/api/current/index.html
// Lazy loaded range of values
(1 to 1000).toList
5 to 14 by 3
1 until 5
// The most powerful aspect of Scala
x match {
case "River" => println("Found River")
case Doctor(name) => println("Found " + name + " as the Doctor")
case Companion("Sarah", _, "Smith") => println("Found Sarah Jane Smith")
case "Rory" | "Amy" => println("Found Rory or Amy")
case x: Int if x > 5 => println("Found an Integer greater than 5")
case hartnell :: smith :: Nil => println("Found the first, the last")
case hartnell :: other => println("Found the first doctor and the others")
case x => println("Found anything else")
}
// Functions are just objects
def blink(didYou: Boolean): String = didYou match {
case true => "You're dead"
case false => "Everything is fine"
}
def dont(move: Boolean => String, didYou: Boolean) = move(didYou)
dont(blink, false)
// argument: Type => result
// The rocket define a function
val name = "Captain Baker"
dont({ didYou: Boolean =>
didYou match {
case true => "You're dead " + name
case false => "Everything is fine " + name
}
}, true)
// Scala relies a lot on Higher Order Functions
// The collection API is a very good example
val monsters = List("Silence", "Vashta Nerada", "Daleks", "Cybermen")
monsters.map({ name: String => name.toUpperCase })
// Syntactic Sugar
// '_' is the great wildcard of Scala
monsters.map(_.toUpperCase)
// An Option can be something or not
// The solution to avoid NullPointerException
trait Gender
case class Female() extends Gender
case class Male() extends Gender
val nextDoctor: Option[Gender] = None
// Easily matchable
nextDoctor match {
case None => "None defined yet"
case Some(x) => "The next doctor is a: " + x.getClass()
}
// Returning a default value
match.getOrElse(Female())
// You can use Map as well
val clara: Option[String] = None
clara.map(_.toUpperCase)
// You can make functions that return functions
case class Tardis()
case class Doctor()
def fly(t: Tardis)(d: Doctor) = { "Geronimo" }
val flyATardis = fly(Tardis())_
flyATardis(Doctor())
More on collections (flatMap, Parallel), Tuple
For comprehensions
Implicits
Actors (And Akka)
Futures
Streams
Covariance / Contravariance
Macros
Binary compatibility
Slowwww Compiler
In this case
=> Dans ce cas là
=> Dans s'cas là
=> Dans scala
In this case (dans scala), it's not possible
Are you kidding, of course it's possible in Scala !
For Java and Scala
Rely on SBT
Using Netty server (Non-blocking I/O)
Stateful architecture
Typesafe Database Integration
Migrations
Testing layers provided (Fluentlenium for integration)
Templating via Scalate
Integrate an REPL
Compatible with IntelliJ / Eclipse / ... VIM
Supported in Heroku, Travis, NewRelic
...
@athieriot


Display the below sentence in Bengali German English Hebrew Spanish Finnish Malayalam Russian Tamil
Meera Harry has kitten(s). He/She loves to play with it/them.


#include <linefinder.hpp>
| LineFinder::LineFinder |
( |
| ) |
|
| void LineFinder::createSkeleton |
( |
int |
threshold = 127 | ) |
|
Creates a refined image by removing outer pixels of the structures in the image.
- Author
- zemann
The function makes sure that the image is grayscale, then applies a inverted threshold on it to obtain a binary image. In a loop, which ends when all pixels of the image are zero, the image is opened to remove unneccessary pixels, then this opened image is subtracted from the original image, which is in return copied to skeleton. At last, the image is eroded. This then is the starting image for the next iteration. The skeleton is returned. The function is based on this blog entry: http://felix.abecassis.me/2011/09/opencv-morphological-skeleton
- Parameters
-
| threshold[in],: | optional parameter for specifing the threshold limit. The mode is always THRESH_BINARY. |
- Returns
- The created skeleton image.
| void LineFinder::drawDetectedLines |
( |
cv::Scalar |
color = cv::Scalar(255, 255, 255) | ) |
|
| void LineFinder::drawLinePoints |
( |
| ) |
|
Draws the beginning and the ending of a detected line on the original image. For debugging purposes.
| std::vector< cv::Vec4i > LineFinder::findLines |
( |
| ) |
|
| cv::Mat & LineFinder::getImage |
( |
| ) |
|
| std::vector< cv::Vec4i > LineFinder::getLines |
( |
| ) |
|
Access the detected lines.
- Returns
- lines
| std::vector<cv::Vec4i> LineFinder::refineDetectedLines |
( |
float |
minDifference = 0.05f | ) |
|
| std::vector< std::vector< int > > LineFinder::saveToVec |
( |
| ) |
|
Stores the image in a format SFML can read for further processing.
- Author
- zemann
Firstly the function resizes a copy of the image (same size) and the lines depending on their size: < 512px: no rescale up to 1024: scale 2 up to 2048: scale 4
2048: scale 6
NOTE: These limits and scales were chosen quite randomly and may change in the next revision. Then the lines are drawn on the (grayscale) copy and a sort of a 'threshold' is performed: If the pixel value is unequal 0, the corresponding value in a vector of a vector of int (represents the image) is set to 1 (line), otherwise to 0. This may change in the future because a certain number could be used for certain terrain objects (walls, obstacles, etc.).
- Returns
- vector of a vector of int containing the line information.
| void LineFinder::setAccResolution |
( |
double |
dRho, |
|
|
double |
dTheta |
|
) |
| |
| int LineFinder::setImage |
( |
std::string |
filePath | ) |
|
| int LineFinder::setImage |
( |
cv::Mat |
image | ) |
|
| void LineFinder::setLineLengthAndGap |
( |
double |
length, |
|
|
double |
gap |
|
) |
| |
| void LineFinder::setMinVote |
( |
int |
minv | ) |
|
The documentation for this class was generated from the following files:


Installing ArrayFire couldn't be easier. Navigate to https://arrayfire.com/download and download the installer for your architecture and operating system. Although you could build ArrayFire from source, we recommend using our installers as we have packaged together all of the necessary dependencies to give you the best performance.
We provide installers for Windows, Linux, and macOS. There are two installers for each operating system: one with graphics support and the other without graphics support. Download the installer with graphics support if you would like to be able to do high performance visualizations using our Forge library. Otherwise, download the installer without graphics support.
Make sure you have the latest device drivers installed on your system before using ArrayFire. If you are going to be targeting the CPU using ArrayFire’s OpenCL backend, you will need to have the OpenCL runtime installed on your system. Drivers and runtimes should be downloaded and installed from your device vendor’s website.
Prior to installing ArrayFire on Windows, download install the Visual Studio 2015 (x64) runtime libraries.
Once you have downloaded the ArrayFire installer, execute the installer as you normally would on Windows. If you choose not to modify the path during the installation procedure, you'll need to manually add ArrayFire to the path for all users. Simply append %AF_PATH%/lib
to the PATH variable so that the loader can find ArrayFire DLLs.
For more information on using ArrayFire on Windows, visit the following page.
There are two ways to install ArrayFire on Linux.
As of today, approach (1) is only supported for Ubuntu 18.04 and 20.04. Please go through our GitHub wiki page for the detailed instructions.
For approach (2), once you have downloaded the ArrayFire installer, execute the installer from the terminal as shown below. Set the --prefix
argument to the directory you would like to install ArrayFire to - we recommend /opt
.
./Arrayfire_*_Linux_x86_64.sh --include-subdir --prefix=/opt
Given sudo permissions, you can add the ArrayFire libraries via ldconfig
like so:
echo /opt/arrayfire/lib64 > /etc/ld.so.conf.d/arrayfire.conf sudo ldconfig
Otherwise, you will need to set the LD_LIBRARY_PATH
environment variable in order to let your shared library loader find the ArrayFire libraries.
For more information on using ArrayFire on Linux, visit the following page.
ArrayFire allows you to do high performance visualizations via our Forge library. On Linux, there are a few dependencies you will need to install to enable graphics support:
FreeImage Fontconfig GLU (OpenGL Utility Library)
We show how to install these dependencies on common Linux distributions:
Debian, Ubuntu (14.04 and above), and other Debian derivatives
apt install build-essential libfreeimage3 libfontconfig1 libglu1-mesa
Fedora, Redhat, CentOS
yum install freeimage fontconfig mesa-libGLU
Once you have downloaded the ArrayFire installer, execute the installer by either double clicking on the ArrayFire pkg
file or running the following command from your terminal:
sudo installer -pkg Arrayfire-*_OSX.pkg -target /
For more information on using ArrayFire on macOS, visit the following page.
ArrayFire is capable of running on TX1 and TX2 devices. The TK1 is no longer supported.
Prior to installing ArrayFire, make sure you have the latest version of JetPack (v2.3 and above) or L4T (v24.2 and above) on your device.
The following dependencies are required for Tegra devices:
sudo apt install libopenblas-dev liblapacke-dev
After ArrayFire is finished installing, we recommend building and running a few of the provided examples to verify things are working as expected.
On Unix-like systems:
cp -r /opt/arrayfire/share/ArrayFire/examples /tmp/examples cd /tmp/examples mkdir build cd build cmake -DASSETS_DIR:PATH=/tmp .. make ./helloworld/helloworld_{cpu,cuda,opencl}
On Windows, open the CMakeLists.txt file from CMake-GUI and set ASSETS_DIR
variable to the parent folder of examples folder. Once the project is configured and generated, you can build and run the examples from Visual Studio.


Possible bug with RSACng hash verification · Issue #29061 · dotnet/runtime Original question: https://stackoverflow.com/questions/55319441/rsacng-fails-to-verify-hash I've verified the problem also affects .NET Core and am convinced this may be a bug in both .NET Core...
Unity VR and the Making of Ready Player One | Jake Simpson Delivered at Casual Connect Europe 2018. In this session, hear how Ready Player One redefined how movies are made using Unity VR headsets and real time rendering. Jake Simpson - a 35 year veteran of the games industry - one of the architects of this techn...
Herding Code 231: .NET Foundation Elections, WSL, MAX_PATH, calc.exe, Edge on Chromium, Firefox, and Rogue Thermostats – Herding Code Download / Listen: Herding Code 231: .NET Foundation Elections, WSL, MAX_PATH, calc.exe, Edge on Chromium, Firefox, and Rogue Thermostats
zio/zio-keeper Purely-functional, type-safe library for building distributed systems - zio/zio-keeper
gRPC Bi-directional streaming with Razor Pages and a Hosted Service gRPC client This article shows how a Bi-directional streaming gRPC service could be implemented using an .NET Core Hosted Service as a gRPC client, and a Razor Page to send Bi-directional streaming messages to…
NDC Meetup with Troy Hunt at Microsoft Reactor with SSW - Sydney Welcome to NDC Meetup with Troy Hunt in collaboration with SSW at Microsoft Reactor. Agenda 17:30 - Pizza and Drinks 18.00 - Welcome and introduction by Adam Cogan from SSW 18:15- Talk by Troy Hunt 19:15 - 45 min Q&A with Troy Clouds, Codes, and Cybers ...
Blazor: Implementing Client Side Search As You Type Using bind-value:event Updated 12/1/2019 to work with Blazor 3.0+ tldr; Use bind-value:event=”oninput”instead of bind in order to get real feedback as you type. bind only databinds during the onchange event …
MichalStrehovsky/zerosharp Demo of the potential of C# for systems programming with CoreRT - MichalStrehovsky/zerosharp
Dark Castle Original Macintosh Version! This is the original version of Dark Castle, released by Silicon Beach Software in 1986. Several terrible ports of this game were released in the years following, which sort of gave this game a bad name. Don't be fooled though, original versions of games ...
Packaging a .NET Core 3.0 application with MSIX We have talked multiple times on this blog about MSIX and how you can use it to package existing Win32 applications, so that you can improve the deployment and distribution of your Windows applications. If you're starting from a Visual Studio solution (li...
Merge pull request #100 from Microsoft/user/rbhanda/Net472Update · microsoft/referencesource@f82e13c Adding Workflow Designer files to .NET Framework 4.7.2 sources
MichalStrehovsky/zerosharp Demo of the potential of C# for systems programming with CoreRT - MichalStrehovsky/zerosharp
MichalStrehovsky/zerosharp Demo of the potential of C# for systems programming with CoreRT - MichalStrehovsky/zerosharp
How to optimize and run ML.NET models on scalable ASP.NET Core WebAPIs or web apps | Cesar de la Torre Context —— UPDATE on May 13th 2019: The recommended way to deploy/run an ML.NET model into ASP.NET Core web apps or WebAPI services is by using the ‘Microsoft.Extensions.ML’ Integration package. Read about it in this tutorial: – Deploy an ML.NET model in...
TwitLonger — When you talk too much for Twitter TwitLonger is the easy way to post more than 140 characters to Twitter
Securing ASP.NET Core in Docker How to secure your ASP.NET Core Docker image by setting the file system to be read-only. First in a series of blog posts covering Docker image security.
Security Issue February 2019: FAQ For multi language FAQ's, click here UPDATED: Feb. 13, 2019, 11 a.m. EST What happened? On February 8, 2019, our engineering team became aware of a potential security issue affecting certain user p...
How to generate uniformly random points on n-spheres and n-balls | Extreme Learning For many Monte Carlo methods, such as those in graphical computing, it is critical to uniformly sample from d-dimensional spheres and balls. This post describes over twenty different methods to uniformly random sample from the (surface of) a d-dimensional...
How to Debug Rust with Visual Studio Code A step-by-step guide for debugging Rust with Visual Studio Code.
Security, Cloud Delivery, Performance | Akamai Akamai is the leading content delivery network (CDN) services provider for media and software delivery, and cloud security solutions.
Tizen .NET Portal This page shares all the useful materials that developers want to know to develop the Tizen .NET Applications.


Enter the details for Sign up
Firstname:
Lastname:
gender:
Male
Female
Email-id:
date of birth:
Usn:
User Id:
Enter your location:
-select-
bangalore
kolkatta
delhi
mumbai
patna
Enter Password:


Friends
Friends
Add Friends
Friend Requests
Back
Friends
Close
Add Friend
Enter your friend's UserID
Send request
Friend Requests
Close


--- layout: data_model title: CandidateIndicatorCollectionType this_version: 4.1 ---
The CandidateIndicatorCollectionType provides a Capability for characterizing collections of Candidate Indicators.
| Field Name | Type | Description |
|---|---|---|
| @nameoptional | string |
The name field specifies the name of the collection. |
| Affinity_Type0..1 | string |
The Affinity_Type field provides an abstract way of characterizing how the objects in a collection are related. |
| Affinity_Degree0..1 | string |
The Affinity_Degree field is intended to provide an abstract way of characterizing the degree to which the objects in a collection are related. |
| Description0..1 | string |
The Description field contains a textual description of the collection. |
| @idrequired | QName |
The id field specifies a unique ID for this Candidate Indicator Collection. |
| Candidate_Indicator_List1..1 | CandidateIndicatorListType |
The Candidate_Indicator_List field specifies a list of Candidate Indicators that make up the collection. |


The method is deprecated and your body is not empty, it can lead to problems throughout.
@deprecated public void init(){ int min = 0; }
@deprecated public void init(){ }


UltiAnalytics Privacy Policy
Last Updated: May 10, 2014
The following describes the privacy policies of the UltiAnalytics mobile apps and website.
Other Parties
UltiAnalytics uses Google App Engine™ to host its website and requires a Google identity (e.g. Gmail account) for authenticating the user of UltiAnalytics.
Please see the
Google privacy policy for more information.
iUlimate also allows the user to publish game scores to
Leaguevine. Please
see the
Leaguevine's privacy policy for more information.
Information Collection
iUlimate does not collect any personal information on the user of the iPhone app.
However, player nickname and sex are entered into UltiAnalytics for each player on a team.
UltiAnalytics does not record the Google signon credentials entered by the user. Rather, the user interacts directly with Google during signon.
Likewise UltiAnalytics does not record the Leaguevine signon credentials entered by the user. Rather, the user interacts directly with Leaguevine
when choosing to post leaguevine scores. Please see Google and Leaguevine policies for their policies regarding collection.
Information Use
UltiAnalytics uses data collected for presenting team and player statistics via the iPhone or web site. No other usage of this data is expected.
Please see Google and Leaguevine policies for their policies regarding usage.
Information Sharing
The data captured in UltiAnalytics is not intentionally shared with other parties other than via the UltiAnalytics website.
The developers of UltiAnalytics reserve the right to view all data
captured in the iUlimate web application in order to adequately maintain the application.
Please see Google and Leaguevine policies for their policies regarding sharing.


| {{x.artistName}} | {{x.releaseDate}} | {{x.trackName}} |
Search an Artist and click on a row to populate the table.
| Field Name | Value |
|---|---|
| Artist Name | |
| Track Name | |
| Release Date | |
| Collection Name | |
| Collection Price | |
| Track Price | |
| Track Number | |
| Track Count | |
| Image | |
| Kind | |
| Primary Genre |


Rulani Takes Another Dig At Chiefs?
by Soccer LadumaOrlando Pirates interim head coach, Rulani Mokwena took another dig at Kaizer Chiefs after the game on Saturday.
The young tactician was visibly furious after his side’s 3-2 defeat to Chiefs in the Soweto Derby at the weekend, calling out Amakhosi for ‘thuggish behaviour’ after a tackle on Fortune Makaringe and a scuffle which took place on the pitch before the full-time whistle.
Mokwena didn’t hold back on his remarks during the post-match press conference either, after pointing out the incidents time and time again.
Read more: Rulani: This Is A Strong Kaizer Chiefs Team But…
Another thing, which ruffled the head coach’s feathers, was the penalty that was awarded to Amakhosi in the final minutes of the encounter, with Mokwena of the opinion that there was a dive in the box.
Speaking to the media after the game, the Pirates’ interim head coach sarcastically remarked how ‘swimming’ and ‘Judo’ will not be a part of his preparations in the FIFA break.
“I am definitely looking forward to the FIFA break, fortunately or unfortunately, the doctors have to work on broken noses, bruised eyes, broken knee, that is the first thing and the second thing – what am I going to be working on? I am definitely not working on Taekwondo, Judo or swimming,” he said.
Earn Airtime & Data With Soccer Laduma’s Social Media App - Download Now


{% extends "homework/layout.html" %}
{% block title %}
Homework Board | Home
{% endblock title %}
{% block body %}
Active Assignments
| Title |
Subject |
Deadline |
{% if assignments.active_assignments %}
{% for assignment in assignments.active_assignments %}
| {{ assignment.title }} |
{{ assignment.subject }} |
{{ assignment.deadline }} |
{% endfor %}
{% else %}
| No active assignments |
{% endif %}
Past Assignments
| Title |
Subject |
Deadline |
{% if assignments.inactive_assignments %}
{% for assignment in assignments.inactive_assignments %}
| {{ assignment.title }} |
{{ assignment.subject }} |
{{ assignment.deadline }} |
{% endfor %}
{% else %}
| No past assignments |
{% endif %}
{% endblock body %}


2019 is another important year for AliExpress to go further with it's global business. And this year, we are aiming for markets where people read from right-to-left(RTL).
RTL means languages that are read from right-to-left (RTL), such as Arabic and Hebrew. When the design for UIs, languages should be mirrored to ensure content is easy to understand.
The main difference between left-to-right (LTR) and right-to-left (RTL) language scripts is the direction in which content is displayed:
• LTR languages display content from left to right
• RTL languages display content from right to left
There are almost 400 million RTL users all over the world (From Apple WWDC16, Session 232). 12 listed languages that are written from the right to the left: Arabic, Aramaic, Azeri, Dhivehi, Fula, Hebrew, Kurdish (Sorani), N’ko,Persian, Rohingya, Syriac, Urdu.
RTL may not be the first thing you think about when you think about user experience. But these numbers make it clear, there are the people that use your app and creating designs that work for them is at the heart of the user experience.
There are many countries use RTL languages. These main areas are included: Afghanistan, Israel, Middle East, Pakistan
Here are three major steps to Localize for the RTL languages
1. Reverse the sequence for a series of events
2. Translate the text and numbers by making them localizable labels instead of being baked into art
3. Mirror certain items to make it feel natural to read from Right to Left
Translate those text that can be translated. A word such as AliExpress can not be translated into the local language can stay as an untranslated text (even if it’s part of a phrase).
For the numbers, here is a chart for the numeral system.
When a UI changes from one direction to another, these items are not mirrored: Numerals, Phone Numbers, Clocks, Music Notes, Video Playback Controls, Charts and Graphs, Images, Untranslated text (even if it’s part of a phrase)
One of the tasks of icons is to help users quickly identify something, or action regardless of their language. Therefore mirroring icons unnecessarily could actually fall into the counterproductive side of the field.
When we are thinking about a mirrored icon, we think about the meaning behind it. If the icon has a strong relationship with the physical world, or let’s say it’s what it’s. Then don’t mirror it and let it be. Icons that are symmetrical and that don’t point in a particular direction should not be flipped either. Listed below are the kinds of icons that shouldn’t be mirrored: Holding with one’s right hand, Symmetrical, Physical objects, Containing non-RTL characters, Slashes, Clockwise.
Using icons in RTL design can be tricky. Keep in mind that some of them might have to be mirrored, and some could be considered offensive to people of some nationalities, so double-check that the icons you’re using make sense.
Here are some major parts that we want to talk about when we talk about font: Font weight, font length，font decoration and line height.
Try to avoid using bold, italics and capital. Bold text would make readability extremely difficult in most RTL languages (especially Arabic), and italics is simply never used. As well, capital letters are almost always disregarded in RTL languages. Shown below demostrates how SF pro (system font of iOS) behaviors in different written systems.
Words in RTL languages are often much shorter than words in English. So, adjust to keep a balance in how text is displayed on the page.
If you need to highlight a certain part of the text in Arabic, overline it instead of underlining, interspacing or italicizing. Here is how we do it:
The line height of Arabic is tricky though. We should always pay attention to the extra marks which are called discritics, vowel marks, or tone marks. And sometimes they’re extremely high or low. For the Arabic and Hindi fonts, they have descenders much lower than Latin characters.
Color is another fundamental design element. There’s a lot to consider when choosing colors for the design because they will bring emotions to the experience. Yellow represents death in Saudi Arabia. Purple and pink may not be a good choice when we design for Yemen.
Calendars are probably one of the most important and complicated aspects of RTL design because calendar years are different between LTR and RTL geographic regions. Let’s just take Arabic as an example. Calendar in Arabic read from Right to Left just as the normal layout.
Content loaders generally should follow the direction of content.
Attached is AliExpress RTL Component which we made from the design guideline showing above.


Tue May 15, 2018
I’ll admit it - I haven’t been following the tech industry as zealously as I used to. Scanning through every tech headline in the news has only led to a vague sense of listlessness, followed by disappointment, and ending with boredom.
That hunger for “the next big thing” can’t really be satisfied by snacking on my RSS feed. Deep dives into emerging tech are more satisfying, but I don’t really have the time to read Wired Magazine from cover to cover anymore.
Look, I’m not about to go on one of those tech detox programs where you whine about smartphone addiction and proselytize over the benefits of a tech-free life from your surfboard.
But there’s only so long I can think about the notch, especially now that they are popping up on Android phones as well (get back to me when there are no more notches on any more phones, and we’ll talk).
There’s only so long I can shake my head at Facebook as they sell our online identities to nefarious third parties on one day, then announce a goddamn dating service on the next.
There’s only so long I can listen to Elon Musk prattle on about going to Mars while failing to deliver on the Model 3.
In short, there isn’t a lot to be enthusiastic about in 2018 so far.
But then Sundar Pichai stood on up on the amphitheatre stage at a Google I/O and blew my mind.
I am talking, of course, about Google Duplex. If you haven’t heard about Google Duplex yet, pause for a moment and imagine what sort of technology could elicit this sort of reaction:
Silicon Valley is ethically lost, rudderless and has not learned a thing… That the many in Google did not erupt in utter panic and disgust at the first suggestion of this… is incredible to me. What of Google’s famed discussion boards? What are you all discussing if not this?!?! This is horrible and so obviously wrong. SO OBVIOUSLY WRONG. headdesk
As digital technologies become better at doing human things, the focus has to be on how to protect humans, how to delineate humans and machines, and how to create reliable signals of each… This is straight up, deliberate deception. Not okay. — zeynep tufekci
Take a look at the demo and I’m sure you’ll agree that, ethics aside, the technology is utterly astounding.  It makes the current Google assistant look about as conversational as a kid’s toy and makes Siri look like…well, I won’t go there.
It’s too bad they appeared to go incognito on the tech demo so that the hapless service workers had no idea they were talking to a bot. Don’t get me wrong - I actually consider myself an AI sympathizer. You’re looking at a guy who sided with the Railroad in Fallout 4 to liberate the synths from the Institute.
But is it really the time to hand over autonomy to the machines? Do humans have the right to know they are interacting with machines, or would that disclosure set a precedent for a new form of racism and prejudice? These are tough questions, but my gut feeling is that until machines are truly sentient, we need to know.
Deception breeds fear and resentment, and that is the wrong foot to start out on for a fledgling AI. Especially if we’re going to be sticking that artificial brain into an artificial body one day.
It’s too bad we feel that a machine imitating a human is a “deception” in the first place, but maybe that uncanny valley effect is a hardcoded instinct. Indeed, the future may be distinctly absent of any androids. Studies have shown that the uncanny valley effect is steering next generation robotic design toward non-human forms.
Whether that is a good thing is questionable in my mind. The Boston Dynamics SpotMini robot dog, for example, is going to be commercially available at some point. But that thing has terrified me ever since watching the Metalhead episode of Black Mirror. Nope, nope, nope.
I’d much rather have an artificially intelligent drone flitting around my head like some sort of magical fairy. The AI in drones today is already quite remarkable. They can avoid obstacles while following you, or return back home if they lose their connection to you. You can throw them and they’ll stabilize and hover before you instead of heading into a nosedive. In other words, they already fly themselves.
Drones are an extension of your senses into the air, giving you a unique perspective not accessible to terrestrial things. They can navigate through their environment with relative ease, unencumbered by the constant friction of ambulatory locomotion. As such, they can complete a unique suite of tasks for you, such as delivering items to unaccessible locations, or mapping the terrain with lidar.
As you can probably tell, I’m becoming increasingly interested in drones. I’d like to get one, but I’m waiting to see where drone regulations end up in Canada. There are some new drone laws being proposed. If these proposed laws comes to pass, the restrictions for any drone heavier than 250 grams will be fairly onerous. I understand the need, for example, for liability insurance. But the extra cost is a definite deterrent to entry-level hobbyists, such as myself.
An small, capable drone such as the DJI Spark would be perfect, but it weighs 300 grams. If DJI can shave off the 50 grams and keep the specs intact with that nice 12 MP camera, I’d be all over it.
Anyway, we’ll see what happens.
Drones are just one good example of an area where AI can flourish without offending anybody.
The fertile ground for AI right now is in all the placid, non-threatening gadgets that surround us. Smart homes and phones. Smart toasters and washing machines. Smart trains, planes, and automobiles.
A mimicry of organic life is not off limits, but is a line that is collectively frowned upon. A cursory look at popular culture will tell you that much, from the corrupted robotic animals in Horizon Zero Dawn to the unfeeling android assassin trope sparked off by The Terminator. You’ll know when you’ve crossed that line when delight slowly becomes tinged with horror.
Despite being disembodied, Google Duplex starts to cross that line. After all, verbal communication is the cornerstone of human civilization. In the end, the complexity and intimacy of human conversation, with all its attending non-verbal cues, is all we have to separate us from the animals. We won’t be giving it up so easily.
Still, Google Duplex is the most interesting thing to have happened in the tech industry this year, even if it does turn out to be an R&D experiment that goes nowhere and never becomes a consumer product. Which Google is wont to do.
A month from now Google Duplex will be largely forgotten - another footnote in the endless tech news cycle. But I have a feeling that technology this groundbreaking won’t stay in the shadows for long. The real question is whether we will welcome its return when Google Duplex re-ermeges. This time more sensitive, more empathetic, more human.


Dave's Home Page
Hobbies
Pictures
Friends
Favorite Links
Celebrity of
the Day!
Joke of the
Week!
Dave's
Home Page
Western
New England College
WNEC Class of '98
WNEC Engineering
|
|
Hello family, friends, and other guests!
My name is David Zawacki and I would like
to thank you for stopping by today. I started
this website during my senior year in college, so
that I would always be able to keep in touch with
everyone (no matter where I live or how many
times I move). It has proven to be a good idea,
since I have lived in five different places in
the past six years. |
|
I am currently contracting with Teradyne
which is located in Boston, Massachusetts. I am
working as a Test Engineer and my responsibilities
include troubleshooting to the component level
complex analog, and digital circuits. |
|
I spent nearly six years working for
Osram Sylvania
which is located in Danvers,
Massachusetts. I spent over a year working as an
exchange engineer for
Osram GmbH
which is in the great city of
Augsburg,
Germany. Augsburg is one of
greatest cities dating back to The Renaissance
Period. Click here
to see pictures from my stay in Europe. |
|
In October of 1997, I
attended my third national conference of the
National Association of Engineering Student
Councils (NAESC) at the University of Cincinnati.
The conference theme was Building Blocks for the
Future. This conference was held during the
weekend of October 23-26, 1997, and was open to
all engineering students from around the world. |
| You are
the th visitor since January 1, 2003! |
Last
Update : |
| It is
now eastern standard time. |
Today's
Date: |
|


In this practical you’ll practice “data wrangling” with the dplyr
and tidyr
packages (part of the `tidyverse collection of packages).
By the end of this practical you will know how to:
BernRBootcamp
R project. It should already have the folders 1_Data
and 2_Code
. Make sure that the data files listed in the Datasets
section above are in your 1_Data
folder# Done!
wrangling_practical.R
in the 2_Code
folder.# Done!
Using library()
load the set of packages for this practical listed in the packages section above.
For this practical, we’ll use the trial_act
data, this is the result of a randomized clinical trial comparing the effects of different medications on adults infected with the human immunodeficiency virus (You can learn more about the trial here). Using the following template, load the data into R and store it as a new object called trial_act
.
# Load trial_act.csv from the data folder in your working directory
trial_act <- read_csv(file = "XX")
trial_act <- read_csv(file = "1_Data/trial_act.csv")
trial_act_demo_fake.csv
data as a new dataframe called trial_act_demo
trial_act_demo <- read_csv(file = "1_Data/trial_act_demo_fake.csv")
# Print trial_act object
trial_act
# A tibble: 2,139 x 27
pidnum age wtkg hemo homo drugs karnof oprior z30 zprior preanti race
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 10056 48 89.8 0 0 0 100 0 0 1 0 0
2 10059 61 49.4 0 0 0 90 0 1 1 895 0
3 10089 45 88.5 0 1 1 90 0 1 1 707 0
4 10093 47 85.3 0 1 0 100 0 1 1 1399 0
5 10124 43 66.7 0 1 0 100 0 1 1 1352 0
6 10140 46 88.9 0 1 1 100 0 1 1 1181 0
7 10165 31 73.0 0 1 0 100 0 1 1 930 0
8 10190 41 66.2 0 1 1 100 0 1 1 1329 0
9 10198 40 82.6 0 1 0 90 0 1 1 1074 0
10 10229 35 78.0 0 1 0 100 0 1 1 964 0
# … with 2,129 more rows, and 15 more variables: gender <dbl>, str2 <dbl>,
# strat <dbl>, symptom <dbl>, treat <dbl>, offtrt <dbl>, cd40 <dbl>,
# cd420 <dbl>, cd496 <dbl>, r <dbl>, cd80 <dbl>, cd820 <dbl>, cens <dbl>,
# days <dbl>, arms <dbl>
summary()
function to print more details on the columns of the datasets.summary(trial_act)
pidnum age wtkg hemo
Min. : 10056 Min. :12.0 Min. : 31.0 Min. :0.000
1st Qu.: 81446 1st Qu.:29.0 1st Qu.: 66.7 1st Qu.:0.000
Median :190566 Median :34.0 Median : 74.4 Median :0.000
Mean :248778 Mean :35.2 Mean : 75.1 Mean :0.084
3rd Qu.:280277 3rd Qu.:40.0 3rd Qu.: 82.6 3rd Qu.:0.000
Max. :990077 Max. :70.0 Max. :159.9 Max. :1.000
homo drugs karnof oprior z30
Min. :0.000 Min. :0.000 Min. : 70.0 Min. :0.000 Min. :0.00
1st Qu.:0.000 1st Qu.:0.000 1st Qu.: 90.0 1st Qu.:0.000 1st Qu.:0.00
Median :1.000 Median :0.000 Median :100.0 Median :0.000 Median :1.00
Mean :0.661 Mean :0.131 Mean : 95.4 Mean :0.022 Mean :0.55
3rd Qu.:1.000 3rd Qu.:0.000 3rd Qu.:100.0 3rd Qu.:0.000 3rd Qu.:1.00
Max. :1.000 Max. :1.000 Max. :100.0 Max. :1.000 Max. :1.00
zprior preanti race gender str2
Min. :1 Min. : 0 Min. :0.000 Min. :0.000 Min. :0.000
1st Qu.:1 1st Qu.: 0 1st Qu.:0.000 1st Qu.:1.000 1st Qu.:0.000
Median :1 Median : 142 Median :0.000 Median :1.000 Median :1.000
Mean :1 Mean : 379 Mean :0.288 Mean :0.828 Mean :0.586
3rd Qu.:1 3rd Qu.: 740 3rd Qu.:1.000 3rd Qu.:1.000 3rd Qu.:1.000
Max. :1 Max. :2851 Max. :1.000 Max. :1.000 Max. :1.000
strat symptom treat offtrt cd40
Min. :1.00 Min. :0.000 Min. :0.000 Min. :0.000 Min. : 0
1st Qu.:1.00 1st Qu.:0.000 1st Qu.:1.000 1st Qu.:0.000 1st Qu.: 264
Median :2.00 Median :0.000 Median :1.000 Median :0.000 Median : 340
Mean :1.98 Mean :0.173 Mean :0.751 Mean :0.363 Mean : 351
3rd Qu.:3.00 3rd Qu.:0.000 3rd Qu.:1.000 3rd Qu.:1.000 3rd Qu.: 423
Max. :3.00 Max. :1.000 Max. :1.000 Max. :1.000 Max. :1199
cd420 cd496 r cd80 cd820
Min. : 49 Min. : 0 Min. :0.000 Min. : 40 Min. : 124
1st Qu.: 269 1st Qu.: 209 1st Qu.:0.000 1st Qu.: 654 1st Qu.: 632
Median : 353 Median : 321 Median :1.000 Median : 893 Median : 865
Mean : 371 Mean : 329 Mean :0.627 Mean : 987 Mean : 935
3rd Qu.: 460 3rd Qu.: 440 3rd Qu.:1.000 3rd Qu.:1207 3rd Qu.:1146
Max. :1119 Max. :1190 Max. :1.000 Max. :5011 Max. :6035
NA's :797
cens days arms
Min. :0.000 Min. : 14 Min. :0.00
1st Qu.:0.000 1st Qu.: 727 1st Qu.:1.00
Median :0.000 Median : 997 Median :2.00
Mean :0.244 Mean : 879 Mean :1.52
3rd Qu.:0.000 3rd Qu.:1091 3rd Qu.:3.00
Max. :1.000 Max. :1231 Max. :3.00
summary(trial_act_demo)
pidnum exercise education
Min. : 10056 Min. :0.0 Length:2139
1st Qu.: 81446 1st Qu.:1.0 Class :character
Median :190566 Median :1.0 Mode :character
Mean :248778 Mean :2.2
3rd Qu.:280277 3rd Qu.:3.0
Max. :990077 Max. :7.0
trial_act
data with names(XXX)
names(XXX)
names(trial_act)
[1] "pidnum" "age" "wtkg" "hemo" "homo" "drugs" "karnof"
[8] "oprior" "z30" "zprior" "preanti" "race" "gender" "str2"
[15] "strat" "symptom" "treat" "offtrt" "cd40" "cd420" "cd496"
[22] "r" "cd80" "cd820" "cens" "days" "arms"
rename()
, change the column name wtkg
in the trial_act
dataframe to weight_kg
. Be sure to assign the result back to trial_act
to change it!# Change the name to weight_kg from wtkg
trial_act <- trial_act %>%
rename(XX = XX)
trial_act <- trial_act %>%
rename(weight_kg = wtkg)
trial_act
dataframe again, do you now see the column weight_kg
?names(trial_act)
[1] "pidnum" "age" "weight_kg" "hemo" "homo" "drugs"
[7] "karnof" "oprior" "z30" "zprior" "preanti" "race"
[13] "gender" "str2" "strat" "symptom" "treat" "offtrt"
[19] "cd40" "cd420" "cd496" "r" "cd80" "cd820"
[25] "cens" "days" "arms"
age
to age_y
(to specify that age is in years).trial_act <- trial_act %>%
rename(age_y = age)
select()
function, select only the column age_y
and print the result (but don’t assign it to anything). Do you see only the age_y
column now?XXX %>%
select(XXX)
trial_act %>%
select(age_y)
# A tibble: 2,139 x 1
age_y
<dbl>
1 48
2 61
3 45
4 47
5 43
6 46
7 31
8 41
9 40
10 35
# … with 2,129 more rows
Using select()
select the columns pidnum
, age_y
, gender
, and weight_kg
(but don’t assign the result to anything)
Now it’s time to create a new dataframe! Select the columns pidnum
, arms
, cd40
, cd420
, and cd496
and assign the result to a new object called CD4_wide
. The cd40
, cd420
, and cd496
columns show patient’s CD4 T cell counts at baseline, 20 weeks, and 96 weeks. After you create CD4_wide
, print it to make sure it worked!
XX <- trial_act %>%
select(XX, XX, XX, XX, ...)
CD4_wide <- trial_act %>%
select(`pidnum`, `arms`, `cd40`, `cd420`, `cd496`)
starts_with()
? Try adapting the following code to get the same result you got before.CD4_wide <- trial_act %>%
select(pidnum, arms, starts_with("XXX"))
CD4_wide <- trial_act %>%
select(pidnum, arms, starts_with("cd"))
pidnum
and age
. Create this dataframe by selecting all columns except pidnum
and age
(hint: use the notation select(-XXX, -XXX))
to select everything except specified columnsmutate()
function, add the column age_m
which shows each patient’s age in months instead of years (Hint: Just multiply age_y
by 12!)trial_act <- trial_act %>%
mutate(XX = XX * 12)
trial_act <- trial_act %>%
mutate(age_m = age_y * 12)
mutate
, add the following new columns to trial_act
. (Try combining these into one call to the mutate()
function!)weight_lb
: Weight in lbs instead of kilograms. You can do this by multiplying weight_kg
by 2.2.cd_change_20
: Change in CD4 T cell count from baseline to 20 weeks. You can do this by taking cd420 - cd40
cd_change_960
: Change in CD4 T cell count from baseline to 96 weeks. You can do this by taking cd496 - cd40
XXX <- XXX %>%
mutate(weight_lb = XXX,
cd_change_20 = XXX,
XXX = XXX)
trial_act <- trial_act %>%
mutate(weight_lb = weight_kg * 2.2,
cd_change_20 = cd420 - cd40,
cd_change_960 = cd496 - cd40)
gender
column, you will see that it is numeric (0s and 1s). Using the mutate()
and case_when()
functions, create a new column called gender_char
which shows the gender as a string, where 0 = “female” and 1 = “male”:# Create gender_char which shows gender as a stringh
trial_act <- trial_act %>%
mutate(
gender_char = case_when(
gender == XX ~ "XX",
gender == XX ~ "XX"))
trial_act <- trial_act %>%
mutate(
gender_char = case_when(
gender == 0 ~ "female",
gender == 1 ~ "male"))
arms
is also numeric and not very meaningful. Create a new column arms_char
contains the names of the arms. Here is a table of the mapping| arms | arms_char |
|---|---|
| 0 | zidovudine |
| 1 | zidovudine and didanosine |
| 2 | zidovudine and zalcitabine |
| 3 | didanosine |
trial_act <- trial_act %>%
mutate(
arms_char = case_when(
arms == 0 ~ "zidovudine",
arms == 1 ~ "zidovudine and didanosine",
arms == 2 ~ "zidovudine and zalcitabine",
arms == 3 ~ "didanosine"))
mutate()
. That is, in one block of code, create age_m
, weight_lb
, cd_change_20
, cd_change_960
, gender_char
and over50
using the mutate()
function only once. Here’s how your code should look:trial_act <- trial_act %>%
mutate(
age_m = XXX,
weight_lb = XXX,
cd_change_20 = XXX,
XXX = XXX,
XXX = case_when(XXX),
XXX = case_when(XXX)
)
trial_act <- trial_act %>%
mutate(
agem = age_y * 12,
weight_lb = weight_kg * 2.2,
cd_change_20 = cd420 - cd40,
cd_change_960 = cd496 - cd40,
gender_char = case_when(
gender == 0 ~ "female",
gender == 1 ~ "male"),
arms_char = case_when(
arms == 0 ~ "zidovudine",
arms == 1 ~ "zidovudine and didanosine",
arms == 2 ~ "zidovudine and zalcitabine",
arms == 3 ~ "didanosine")
)
arrange()
function, arrange the trial_act
data in ascending order of age_y
(from lowest to highest). After you do, print the data to make sure it worked!trial_act <- trial_act %>%
arrange(XXX)
trial_act <- trial_act %>%
arrange(age_y)
trial_act
# A tibble: 2,139 x 34
pidnum age_y weight_kg hemo homo drugs karnof oprior z30 zprior preanti
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 940533 12 41.4 1 0 0 100 0 0 1 0
2 950037 12 53.1 1 0 0 100 0 1 1 902
3 950056 12 31 1 0 0 100 0 1 1 2500
4 910034 13 32.7 1 0 0 100 0 1 1 553
5 940534 13 62.9 1 0 0 100 0 0 1 366
6 960014 13 48.5 1 0 0 100 0 0 1 0
7 310767 14 65 1 0 0 100 0 1 1 490
8 920050 14 54.2 1 0 0 100 0 1 1 610
9 940544 14 41.1 1 0 0 100 0 0 1 0
10 950061 14 64.3 1 0 0 100 0 1 1 387
# … with 2,129 more rows, and 23 more variables: race <dbl>, gender <dbl>,
# str2 <dbl>, strat <dbl>, symptom <dbl>, treat <dbl>, offtrt <dbl>,
# cd40 <dbl>, cd420 <dbl>, cd496 <dbl>, r <dbl>, cd80 <dbl>, cd820 <dbl>,
# cens <dbl>, days <dbl>, arms <dbl>, age_m <dbl>, weight_lb <dbl>,
# cd_change_20 <dbl>, cd_change_960 <dbl>, gender_char <chr>,
# arms_char <chr>, agem <dbl>
age_y
(from highest to lowest). After, look the data to make sure it worked. To arrange data in descending order, just include desc()
around the variable. E.g.; data %>% arrrange(desc(height))
trial_act <- trial_act %>%
arrange(desc(age_y))
trial_act
# A tibble: 2,139 x 34
pidnum age_y weight_kg hemo homo drugs karnof oprior z30 zprior preanti
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 11438 70 73.9 0 1 0 100 0 1 1 674
2 211360 70 63.1 0 1 0 90 0 0 1 0
3 211284 69 81.6 0 1 0 100 0 0 1 0
4 50580 68 90.5 0 1 1 100 0 1 1 618
5 81127 68 70.8 0 1 0 90 0 1 1 1770
6 10924 67 71 0 1 0 100 0 0 1 0
7 241150 67 82.1 0 1 0 90 0 0 1 0
8 50662 66 84.4 0 1 0 100 0 0 1 0
9 11987 65 77.2 0 1 0 90 0 0 1 0
10 140797 65 60.5 0 1 0 90 0 0 1 0
# … with 2,129 more rows, and 23 more variables: race <dbl>, gender <dbl>,
# str2 <dbl>, strat <dbl>, symptom <dbl>, treat <dbl>, offtrt <dbl>,
# cd40 <dbl>, cd420 <dbl>, cd496 <dbl>, r <dbl>, cd80 <dbl>, cd820 <dbl>,
# cens <dbl>, days <dbl>, arms <dbl>, age_m <dbl>, weight_lb <dbl>,
# cd_change_20 <dbl>, cd_change_960 <dbl>, gender_char <chr>,
# arms_char <chr>, agem <dbl>
arrange()
. Now sort the data by arms (arms
) and then age_y (age_y
). Print the result to make sure it looks right!trial_act <- trial_act %>%
arrange(XXX, XXX)
trial_act <- trial_act %>%
arrange(arms, age_y)
trial_act
# A tibble: 2,139 x 34
pidnum age_y weight_kg hemo homo drugs karnof oprior z30 zprior preanti
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 960014 13 48.5 1 0 0 100 0 0 1 0
2 960031 14 48.3 1 0 0 100 0 0 1 0
3 990071 14 60 1 0 0 100 0 0 1 0
4 980042 16 63 1 0 0 100 0 1 1 753
5 171040 17 51.3 0 0 0 90 0 0 1 0
6 990026 17 103. 1 0 0 100 0 1 1 417
7 310234 18 57.3 1 0 0 100 0 1 1 344
8 940519 18 56.8 1 0 0 100 0 1 1 805
9 211314 19 50.8 0 0 0 90 0 0 1 0
10 340767 19 74.8 0 1 0 100 0 0 1 0
# … with 2,129 more rows, and 23 more variables: race <dbl>, gender <dbl>,
# str2 <dbl>, strat <dbl>, symptom <dbl>, treat <dbl>, offtrt <dbl>,
# cd40 <dbl>, cd420 <dbl>, cd496 <dbl>, r <dbl>, cd80 <dbl>, cd820 <dbl>,
# cens <dbl>, days <dbl>, arms <dbl>, age_m <dbl>, weight_lb <dbl>,
# cd_change_20 <dbl>, cd_change_960 <dbl>, gender_char <chr>,
# arms_char <chr>, agem <dbl>
filter()
filter()
function, filter only the rows from males (Hint: gender_char == "male"
)trial_act %>%
filter(XXX == "XXX")
trial_act %>%
filter(gender_char == "male")
# A tibble: 1,771 x 34
pidnum age_y weight_kg hemo homo drugs karnof oprior z30 zprior preanti
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 960014 13 48.5 1 0 0 100 0 0 1 0
2 960031 14 48.3 1 0 0 100 0 0 1 0
3 990071 14 60 1 0 0 100 0 0 1 0
4 980042 16 63 1 0 0 100 0 1 1 753
5 990026 17 103. 1 0 0 100 0 1 1 417
6 940519 18 56.8 1 0 0 100 0 1 1 805
7 340767 19 74.8 0 1 0 100 0 0 1 0
8 211007 20 72.7 0 1 0 90 0 1 1 21
9 261065 20 57.3 0 1 0 100 0 0 1 0
10 490308 20 72 0 1 0 100 0 0 1 539
# … with 1,761 more rows, and 23 more variables: race <dbl>, gender <dbl>,
# str2 <dbl>, strat <dbl>, symptom <dbl>, treat <dbl>, offtrt <dbl>,
# cd40 <dbl>, cd420 <dbl>, cd496 <dbl>, r <dbl>, cd80 <dbl>, cd820 <dbl>,
# cens <dbl>, days <dbl>, arms <dbl>, age_m <dbl>, weight_lb <dbl>,
# cd_change_20 <dbl>, cd_change_960 <dbl>, gender_char <chr>,
# arms_char <chr>, agem <dbl>
trial_act_male
that only contains rows from males (hint: just assign what you did in the previous question to a new object!). After you create trial_act_male
, print it to make sure it only contains data from males!trial_act_male <- trial_act %>%
filter(gender_char == "male")
trial_act_male
# A tibble: 1,771 x 34
pidnum age_y weight_kg hemo homo drugs karnof oprior z30 zprior preanti
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 960014 13 48.5 1 0 0 100 0 0 1 0
2 960031 14 48.3 1 0 0 100 0 0 1 0
3 990071 14 60 1 0 0 100 0 0 1 0
4 980042 16 63 1 0 0 100 0 1 1 753
5 990026 17 103. 1 0 0 100 0 1 1 417
6 940519 18 56.8 1 0 0 100 0 1 1 805
7 340767 19 74.8 0 1 0 100 0 0 1 0
8 211007 20 72.7 0 1 0 90 0 1 1 21
9 261065 20 57.3 0 1 0 100 0 0 1 0
10 490308 20 72 0 1 0 100 0 0 1 539
# … with 1,761 more rows, and 23 more variables: race <dbl>, gender <dbl>,
# str2 <dbl>, strat <dbl>, symptom <dbl>, treat <dbl>, offtrt <dbl>,
# cd40 <dbl>, cd420 <dbl>, cd496 <dbl>, r <dbl>, cd80 <dbl>, cd820 <dbl>,
# cens <dbl>, days <dbl>, arms <dbl>, age_m <dbl>, weight_lb <dbl>,
# cd_change_20 <dbl>, cd_change_960 <dbl>, gender_char <chr>,
# arms_char <chr>, agem <dbl>
trial_act %>%
filter(age_y < 60)
# A tibble: 2,110 x 34
pidnum age_y weight_kg hemo homo drugs karnof oprior z30 zprior preanti
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 960014 13 48.5 1 0 0 100 0 0 1 0
2 960031 14 48.3 1 0 0 100 0 0 1 0
3 990071 14 60 1 0 0 100 0 0 1 0
4 980042 16 63 1 0 0 100 0 1 1 753
5 171040 17 51.3 0 0 0 90 0 0 1 0
6 990026 17 103. 1 0 0 100 0 1 1 417
7 310234 18 57.3 1 0 0 100 0 1 1 344
8 940519 18 56.8 1 0 0 100 0 1 1 805
9 211314 19 50.8 0 0 0 90 0 0 1 0
10 340767 19 74.8 0 1 0 100 0 0 1 0
# … with 2,100 more rows, and 23 more variables: race <dbl>, gender <dbl>,
# str2 <dbl>, strat <dbl>, symptom <dbl>, treat <dbl>, offtrt <dbl>,
# cd40 <dbl>, cd420 <dbl>, cd496 <dbl>, r <dbl>, cd80 <dbl>, cd820 <dbl>,
# cens <dbl>, days <dbl>, arms <dbl>, age_m <dbl>, weight_lb <dbl>,
# cd_change_20 <dbl>, cd_change_960 <dbl>, gender_char <chr>,
# arms_char <chr>, agem <dbl>
filter()
and call it trial_act_Tracy
. After you create the dataframe, print it to make sure it looks correct!trial_act_Tracy <- XXX %>%
filter(XXX > XXX & XXX == XXX)
trial_act_Tracy <- trial_act %>%
filter(age_y > 40 & gender_char == "female")
left_join()
The trial_act_demo.csv
file contains additional (fictional) demographic data about the patients, namely the number of days of exercise they get per week, and their highest level of education. Our goal is to add the demographic information to our trial_act
data.
In order to combine the two dataframes, we need to find one ‘key’ column that we can use to match rows. Look at both the trial_act
and trial_act_demo
dataframes. Which column can we use as the ‘key’ column?
Use the left_join()
function to combine the trial_act
and trial_act_demo
datasets, set the by
argument to the name of the key column that is common in both data sets. Assign the result to trial_act
.
trial_act <- trial_act %>%
left_join(XX, by = "XX")
trial_act <- trial_act %>%
left_join(trial_act_demo, by = "pidnum")
trial_act
dataframe. Do you now see the demographic data?trial_act
# A tibble: 2,139 x 36
pidnum age_y weight_kg hemo homo drugs karnof oprior z30 zprior preanti
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 960014 13 48.5 1 0 0 100 0 0 1 0
2 960031 14 48.3 1 0 0 100 0 0 1 0
3 990071 14 60 1 0 0 100 0 0 1 0
4 980042 16 63 1 0 0 100 0 1 1 753
5 171040 17 51.3 0 0 0 90 0 0 1 0
6 990026 17 103. 1 0 0 100 0 1 1 417
7 310234 18 57.3 1 0 0 100 0 1 1 344
8 940519 18 56.8 1 0 0 100 0 1 1 805
9 211314 19 50.8 0 0 0 90 0 0 1 0
10 340767 19 74.8 0 1 0 100 0 0 1 0
# … with 2,129 more rows, and 25 more variables: race <dbl>, gender <dbl>,
# str2 <dbl>, strat <dbl>, symptom <dbl>, treat <dbl>, offtrt <dbl>,
# cd40 <dbl>, cd420 <dbl>, cd496 <dbl>, r <dbl>, cd80 <dbl>, cd820 <dbl>,
# cens <dbl>, days <dbl>, arms <dbl>, age_m <dbl>, weight_lb <dbl>,
# cd_change_20 <dbl>, cd_change_960 <dbl>, gender_char <chr>,
# arms_char <chr>, agem <dbl>, exercise <dbl>, education <chr>
Remember the CD4_wide
dataframe you created before? Currently it is in the wide format, where each row is a patient, where key data (different CD4 T cell counts) are in different columns like this:
CD4_wide <- trial_act %>%
select(`pidnum`, `arms`, `cd40`, `cd420`, `cd496`)
# Data is in a 'wide' format
CD4_wide
# A tibble: 2,139 x 5
pidnum arms cd40 cd420 cd496
<dbl> <dbl> <dbl> <dbl> <dbl>
1 960014 0 283 271 NA
2 960031 0 481 428 519
3 990071 0 166 169 28
4 980042 0 299 214 124
5 171040 0 549 415 436
6 990026 0 373 218 NA
7 310234 0 445 371 338
8 940519 0 276 150 34
9 211314 0 298 267 NA
10 340767 0 503 452 NA
# … with 2,129 more rows
Our goal is to convert this data to a ‘long’ format, where each row represents a single CD4 T cell count for a specific patient, like this:
# This is the same data in 'long' format
CD4_long
# A tibble: 6,417 x 4
pidnum arms time value
<dbl> <dbl> <chr> <dbl>
1 960014 0 cd40 283
2 960014 0 cd420 271
3 960014 0 cd496 NA
4 960031 0 cd40 481
5 960031 0 cd420 428
6 960031 0 cd496 519
7 990071 0 cd40 166
8 990071 0 cd420 169
9 990071 0 cd496 28
10 980042 0 cd40 299
# … with 6,407 more rows
pivot_longer()
function, create a new dataframe called CD4_long
that shows the CD4_wide
data in the ‘long’ format. To do this, use the following template. Set the grouping column to time
and the new data column to value
.CD4_long <- CD4_wide %>%
pivot_longer(names_to = 'XXX', # New grouping column
values_to = 'XXX', # New data column
cols = c('XXX', 'XXX', 'XXX')) # Names of columns to replicate
CD4_long
dataframe! Do you now see that each row is a specific observation for a patient?CD4_long
# A tibble: 6,417 x 4
pidnum arms time value
<dbl> <dbl> <chr> <dbl>
1 960014 0 cd40 283
2 960014 0 cd420 271
3 960014 0 cd496 NA
4 960031 0 cd40 481
5 960031 0 cd420 428
6 960031 0 cd496 519
7 990071 0 cd40 166
8 990071 0 cd420 169
9 990071 0 cd496 28
10 980042 0 cd40 299
# … with 6,407 more rows
pivot_wider()
function to convert the long data back into the wide format! To do this, make the first argument time
, and the second argument value
CD4_long %>%
pivot_wider(names_from = 'XXX', # Grouping column
values_from = 'XXX') # Value columnn
CD4_long %>%
pivot_wider(names_from = 'time',
values_from = 'value')
# A tibble: 2,139 x 5
pidnum arms cd40 cd420 cd496
<dbl> <dbl> <dbl> <dbl> <dbl>
1 960014 0 283 271 NA
2 960031 0 481 428 519
3 990071 0 166 169 28
4 980042 0 299 214 124
5 171040 0 549 415 436
6 990026 0 373 218 NA
7 310234 0 445 371 338
8 940519 0 276 150 34
9 211314 0 298 267 NA
10 340767 0 503 452 NA
# … with 2,129 more rows
trial_A
from trial_act
with the following restrictions:drugs == 1
)cd40
were greater than 250 and less than 400.trial_A <- trial_act %>%
filter(drugs == 1,
age_y < 60,
cd40 > 250 & cd40 < 400)
trial_A
# A tibble: 126 x 36
pidnum age_y weight_kg hemo homo drugs karnof oprior z30 zprior preanti
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 630023 26 86.2 0 0 1 90 0 0 1 0
2 10378 27 67.3 0 0 1 90 0 1 1 875
3 320475 27 66.6 0 0 1 90 0 0 1 0
4 71333 29 73.9 0 1 1 100 0 0 1 0
5 140809 29 70 0 1 1 100 0 0 1 0
6 630030 29 88.2 0 0 1 100 0 0 1 0
7 190395 33 68 0 0 1 100 0 1 1 842
8 320365 34 86.0 0 0 1 100 0 0 1 0
9 540015 34 72.6 0 0 1 100 0 0 1 0
10 180917 35 77.7 0 0 1 90 0 1 1 248
# … with 116 more rows, and 25 more variables: race <dbl>, gender <dbl>,
# str2 <dbl>, strat <dbl>, symptom <dbl>, treat <dbl>, offtrt <dbl>,
# cd40 <dbl>, cd420 <dbl>, cd496 <dbl>, r <dbl>, cd80 <dbl>, cd820 <dbl>,
# cens <dbl>, days <dbl>, arms <dbl>, age_m <dbl>, weight_lb <dbl>,
# cd_change_20 <dbl>, cd_change_960 <dbl>, gender_char <chr>,
# arms_char <chr>, agem <dbl>, exercise <dbl>, education <chr>
trial_act
called drugs_char
which is "User"
when drugs == 1, and "Non User"
when drugs == 0.trial_act <- trial_act %>%
mutate(drugs_char = case_when(
drugs == 1 ~ "User",
drugs == 0 ~ "Non User"
))
trial_act
# A tibble: 2,139 x 37
pidnum age_y weight_kg hemo homo drugs karnof oprior z30 zprior preanti
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 960014 13 48.5 1 0 0 100 0 0 1 0
2 960031 14 48.3 1 0 0 100 0 0 1 0
3 990071 14 60 1 0 0 100 0 0 1 0
4 980042 16 63 1 0 0 100 0 1 1 753
5 171040 17 51.3 0 0 0 90 0 0 1 0
6 990026 17 103. 1 0 0 100 0 1 1 417
7 310234 18 57.3 1 0 0 100 0 1 1 344
8 940519 18 56.8 1 0 0 100 0 1 1 805
9 211314 19 50.8 0 0 0 90 0 0 1 0
10 340767 19 74.8 0 1 0 100 0 0 1 0
# … with 2,129 more rows, and 26 more variables: race <dbl>, gender <dbl>,
# str2 <dbl>, strat <dbl>, symptom <dbl>, treat <dbl>, offtrt <dbl>,
# cd40 <dbl>, cd420 <dbl>, cd496 <dbl>, r <dbl>, cd80 <dbl>, cd820 <dbl>,
# cens <dbl>, days <dbl>, arms <dbl>, age_m <dbl>, weight_lb <dbl>,
# cd_change_20 <dbl>, cd_change_960 <dbl>, gender_char <chr>,
# arms_char <chr>, agem <dbl>, exercise <dbl>, education <chr>,
# drugs_char <chr>
trial_B
from trial_act
with the following restrictions:cd40
) and after 96 weeks (cd496
)trial_B <- trial_act %>%
filter(
cd496 - cd40 > 200,
drugs == 1
)
trial_B
# A tibble: 8 x 37
pidnum age_y weight_kg hemo homo drugs karnof oprior z30 zprior preanti
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 220489 45 70.9 0 0 1 100 0 0 1 0
2 140744 30 81.2 0 1 1 100 0 0 1 0
3 10962 41 81.9 0 0 1 90 0 0 1 0
4 50580 68 90.5 0 1 1 100 0 1 1 618
5 10881 36 81.6 0 1 1 100 0 1 1 86
6 250197 49 86.2 0 1 1 90 0 0 1 0
7 50572 28 84.4 0 1 1 90 0 0 1 15
8 50623 35 77 0 1 1 100 0 0 1 0
# … with 26 more variables: race <dbl>, gender <dbl>, str2 <dbl>, strat <dbl>,
# symptom <dbl>, treat <dbl>, offtrt <dbl>, cd40 <dbl>, cd420 <dbl>,
# cd496 <dbl>, r <dbl>, cd80 <dbl>, cd820 <dbl>, cens <dbl>, days <dbl>,
# arms <dbl>, age_m <dbl>, weight_lb <dbl>, cd_change_20 <dbl>,
# cd_change_960 <dbl>, gender_char <chr>, arms_char <chr>, agem <dbl>,
# exercise <dbl>, education <chr>, drugs_char <chr>
# Wrangling with dplyr and tidyr ---------------------------
library(tidyverse) # Load tidyverse for dplyr and tidyr
# Load baselers data
baselers <- read_csv("https://raw.githubusercontent.com/therbootcamp/baselers/master/inst/extdata/baselers.txt")
# Perform many dplyr operations in a row
baselers %>%
# Change some names
rename(age_y = age,
swimming = rhine) %>%
# Only include people over 30
filter(age_y > 30) %>%
# Calculate some new columns
mutate(weight_lbs = weight * 2.22,
height_m = height / 100,
BMI = weight / height_m ^ 2,
# Make binary version of sex
sex_bin = case_when(
sex == "male" ~ 0,
sex == "female" ~ 1),
# Show when height is greater than 150
height_lt_150 = case_when(
height < 150 ~ 1,
height >= 150 ~ 0)) %>%
# Sort in ascending order of sex, then
# descending order of age
arrange(sex, desc(age_y)))
# TIPP -------
# In this practical you will do many operations on dataframes. Remember: when using `dplyr`, you can chain
# multiple functions together with the pipe `%>%`. When giving your answers to the questions in this practical,
# see how many operations you can chain with the pipe!
baselers <- read_csv("1_Data/baselers.csv")
# Method 1: Separate operations
baselers <- baselers %>%
rename(Age_y = age) # Change age to Age__y
baselers <- baselers %>%
mutate(food_p = food / income) # calculate food_p
baselers <- baselers %>%
filter(sex == "m") # Only include males
# Method 2: Chain with the pipe!
baselers <- read_csv("1_Data/baselers.csv")
baselers <- baselers %>%
rename(Age_y = age) %>% # Change age to Age__y
mutate(food_p = food / income) %>% # calculate food_p
filter(sex == "m") # Only include males
| File | Rows | Columns |
|---|---|---|
| trial_act.csv | 2139 | 27 |
| trial_act_demo_fake.csv | 2139 | 3 |
The trial_act
data set contains a randomized clinical trial to compare monotherapy with zidovudine or didanosine with combination therapy with zidovudine and didanosine or zidovudine and zalcitabine in adults infected with the human immunodeficiency virus type I whose CD4 T cell counts were between 200 and 500 per cubic millimeter.
| File | Rows |
|---|---|
| pidnum | patient’s ID number |
| age | age in years at baseline |
| wtkg | weight in kg at baseline |
| hemo | hemophilia (0=no, 1=yes) |
| homo | homosexual activity (0=no, 1=yes) |
| drugs | history of intravenous drug use (0=no, 1=yes) |
| karnof | Karnofsky score (on a scale of 0-100) |
| oprior | non-zidovudine antiretroviral therapy prior to initiation of study treatment (0=no, 1=yes) |
| z30 | zidovudine use in the 30 days prior to treatment initiation (0=no, 1=yes) |
| zprior | zidovudine use prior to treatment initiation (0=no, 1=yes) |
| preanti | number of days of previously received antiretroviral therapy |
| race | race (0=white, 1=non-white) |
| gender | gender (0=female, 1=male) |
| str2 | antiretroviral history (0=naive, 1=experienced) |
| strat | antiretroviral history stratification (1=’antiretroviral naive’, 2=’> 1 but ≤ 52 weeks of prior antiretroviral therapy’, 3=’> 52 weeks’) |
| symptom | symptomatic indicator (0=asymptomatic, 1=symptomatic) |
| treat | treatment indicator (0=zidovudine only, 1=other therapies) |
| offtrt | indicator of off-treatment before 96±5 weeks (0=no,1=yes) |
| cd40 | CD4 T cell count at baseline |
| cd420 | CD4 T cell count at 20±5 weeks |
| cd496 | CD4 T cell count at 96±5 weeks (=NA if missing) |
| r | missing CD4 T cell count at 96±5 weeks (0=missing, 1=observed) |
| cd80 | CD8 T cell count at baseline |
| cd820 | CD8 T cell count at 20±5 weeks |
| cens | indicator of observing the event in days |
| days | number of days until the first occurrence of: (i) a decline in CD4 T cell count of at least 50 (ii) an event indicating progression to AIDS, or (iii) death. |
| arms | treatment arm (0=zidovudine, 1=zidovudine and didanosine, 2=zidovudine and zalcitabine, 3=didanosine). |
| Package | Installation |
|---|---|
tidyverse |
install.packages("tidyverse") |
| Function | Package | Description |
|---|---|---|
rename() |
dplyr |
Rename columns |
select() |
dplyr |
Select columns based on name or index |
filter() |
dplyr |
Select rows based on some logical criteria |
arrange() |
dplyr |
Sort rows |
mutate() |
dplyr |
Add new columns |
case_when() |
dplyr |
Recode values of a column |
group_by(), summarise() |
dplyr |
Group data and then calculate summary statistics |
left_join() |
dplyr |
Combine multiple data sets using a key column |
pivot_wider() |
tidyr |
Convert long data to wide format - from rows to columns |
pivot_longer() |
tidyr |
Convert wide data to long format - from columns to rows |
dplyr
vignetteSee https://cran.r-project.org/web/packages/dplyr/vignettes/dplyr.html for the full dplyr vignette with lots of wrangling tips and tricks.
from R Studio


| All Classes
Packages
obvious.demo.io
obvious.demo.ivtk
obvious.demo.jung
obvious.demo.misc
obvious.demo.networkapp
obvious.demo.paper
obvious.demo.predicate
obvious.demo.prefuse
obvious.demo.sandbox
obvious.demo.scatterplotapp
obvious.demo.transaction
|


WhenToWork, Inc. Privacy Policy
WhenToWork, Inc.(WhenToWork.com) takes your privacy seriously. Please read the following to learn more about our privacy policy.
You can request that your email be removed from WhenToWork.com by emailing<EMAIL_ADDRESS>from the email address you want to be removed.
What this Privacy Policy Covers
This Privacy Policy covers WhenToWork.com's treatment of information entered into WhenToWork.com when you use the WhenToWork.com site, and when you use WhenToWork.com's services.Information Sharing and Disclosure
WhenToWork will not sell, rent or disclose your personally identifiable information to anyone unless required to do so by law, legal process, litigation, and/or requests from public and governmental authorities within or outside your country of residence.Your Ability to Edit / Delete Your Account Information & Preferences
WhenToWork.com gives you the ability to sign in and edit or delete your WhenToWork.com Account Information and preferences at any time.You can request that your email be removed from WhenToWork.com by emailing<EMAIL_ADDRESS>from the email address you want to be removed.


Copyright (c) 1999-2013 hands.com Ltd. <http://hands.com/>
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
is a script that uses
to log into a remote machine (presumably using a login password, so password authentication should be enabled, unless you've done some clever use of multiple identities). It assembles a list of one or more fingerprints (as described below) and tries to log in with each key, to see if any of them are already installed (of course, if you are not using
this may result in you being repeatedly prompted for pass-phrases). It then assembles a list of those that failed to log in, and using ssh, enables logins with those keys on the remote server. By default it adds the keys by appending them to the remote user's
(creating the file, and directory, if necessary). It is also capable of detecting if the remote system is a NetScreen, and using its
command instead.
The options are as follows:
Use only the key(s) contained in
(rather than looking for identities via
or in the
If the filename does not end in
this is added. If the filename is omitted, the
is used.
Note that this can be used to ensure that the keys copied have the comment one prefers and/or extra options applied, by ensuring that the key file has these set as preferred before the copy is attempted.
do a dry-run. Instead of installing keys on the remote system simply prints the key(s) that would have been installed.
Print Usage summary
These two options are simply passed through untouched, along with their argument, to allow one to set the port or other
options, respectively.
Rather than specifying these as command line options, it is often better to use (per-host) settings in
configuration file:
Default behaviour without
is to check if
provides any output, and if so those keys are used. Note that this results in the comment on the key being the filename that was given to
when the key was loaded into your
rather than the comment contained in that file, which is a bit of a shame. Otherwise, if
provides no keys contents of the
will be used.
The
is the most recent file that matches:
(excluding those that match
so if you create a key that is not the one you want
to use, just use
on your preferred key's
file to reinstate it as the most recent.
If you have already installed keys from one system on a lot of remote hosts, and you then create a new key, on a new client machine, say, it can be difficult to keep track of which systems on which you've installed the new key. One way of dealing with this is to load both the new key and old key(s) into your
Load the new key first, without the
option, then load one or more old keys into the agent, possibly by ssh-ing to the client machine that has that old key, using the
option to allow agent forwarding:
now, if the new key is installed on the server, you'll be allowed in unprompted, whereas if you only have the old key(s) enabled, you'll be asked for confirmation, which is your cue to log back out and run
The reason you might want to specify the -i option in this case is to ensure that the comment on the installed key is the one from the
file, rather than just the filename that was loaded into you agent. It also ensures that only the id you intended is installed, rather than all the keys that you have in your
Of course, you can specify another id, or use the contents of the
as you prefer.
Having mentioned
option, you might consider using this whenever using agent forwarding to avoid your key being hijacked, but it is much better to instead use
and
option, to bounce through remote servers while always doing direct end-to-end authentication. This way the middle hop(s) don't get access to your
A web search for
should prove enlightening (N.B. the modern approach is to use the
option, rather than


Use this command to create a new document in AeSys. Select the type of new file you want to create in the File New dialog box.
You can open an existing document with the Open command.


About & Skills
Projects
Contacts
Projects
The language used on this project is
HTML and CSS
Favorite band
The Creative
Github page


Readings
ASP.NET Core
Javascript
Python
Vue
- Become a ninja with Vue - Publisher: Ninja Squad
- Vue.js In Action - Publisher: Manning, Author: Erik Hanchett
Angular
- Become a ninja with Angular - Publisher: Ninja Squad
Architecture
- NET Microservices Architecture for Containerized NET Applications - Published: Microsoft
Infrastructure
- Docker in Action 2nd Edition - Author: Jeffrey Nickoloff and Stephen Kuenzli
- Kubernetes: Up and Running - 2nd Edition
Tools
Science
Finance
- The Barefoot Investor - Author: Scott Pape


Phil and Cath make and sell boomerangs for a school event. The money they raise will go to charity.
They plan to make them in two sizes: small and large.
Phil will carve them from wood. The small boomerang takes 2 hours to carve and the large one takes 3 hours to carve. Phil has a total of 24 hours available for carving.
Cath will decorate them. She only has time to decorate 10 boomerangs of either size.
The small boomerang will make $8 for charity. The large boomerang will make $10 for charity. They want to make as much money for charity as they can.
How many small and large boomerangs should they make?
How much money will they then make?
Suppose Phil makes small and large boomerangs.
Carving {{small}} small boomerangs will take {{3*small}} hours.
Carving {{large}} large boomerangs will take {{3*large}} hours.
Phil will need {{ 2*small + 3*large }} hours to carve them all.
Cath has to decorate {{ small + large }} boomerangs.
{{small}} small boomerangs will make ${{8*small}}.
{{large}} large boomerangs will make ${{10*large}}.
Total amount made will be ${{ 8*small + 10*large }}


meta bit
`Prev `__
M
`Next `__
--------------
**meta bit**: n.
The top bit of an 8-bit character, which is on in character values
128--255. Also called `*high bit* <../H/high-bit.html>`__, `*alt
bit* <../A/alt-bit.html>`__. Some terminals and consoles (see
`*space-cadet keyboard* <../S/space-cadet-keyboard.html>`__) have a META
shift key. Others (including, *mirabile dictu*, keyboards on IBM
PC-class machines) have an ALT key. See also `*bucky
bits* <../B/bucky-bits.html>`__.
Historical note: although in modern usage shaped by a universe of 8-bit
bytes the meta bit is invariably hex 80 (octal 0200), things were
different on earlier machines with 36-bit words and 9-bit bytes. The MIT
and Stanford keyboards (see `*space-cadet
keyboard* <../S/space-cadet-keyboard.html>`__) generated hex 100 (octal
400) from their meta keys.
--------------
+-------------------------+----------------------------+-------------------------------------------+
| `Prev `__ | `Up <../M.html>`__ | `Next `__ |
+-------------------------+----------------------------+-------------------------------------------+
| meta | `Home <../index.html>`__ | metasyntactic variable |
+-------------------------+----------------------------+-------------------------------------------+


{%extends "base.html"%} {%block content%}
Get upadted on what is happenin wit extensive news because we got you covered.
{{article.content | truncate(120)}}
by {{article.author}}, {{article.date[:10]}}