red

[ASAP] Predicting Deprotonation Sites Using Alchemical Derivatives

The Journal of Physical Chemistry A
DOI: 10.1021/acs.jpca.9b09472




red

[ASAP] Infrared Photodissociation Spectroscopy of Mass-Selected Cu<sub>2</sub>O<sub>2</sub>(CO)<sub><italic toggle="yes">n</italic></sub><sup>+</sup> Clusters in the Gas Phase

The Journal of Physical Chemistry A
DOI: 10.1021/acs.jpca.0c01813




red

[ASAP] Connecting Femtosecond Transient Absorption Microscopy with Spatially Coregistered Time Averaged Optical Imaging Modalities

The Journal of Physical Chemistry A
DOI: 10.1021/acs.jpca.9b11996




red

[ASAP] Using Machine Learning to Predict the Dissociation Energy of Organic Carbonyls

The Journal of Physical Chemistry A
DOI: 10.1021/acs.jpca.0c01280




red

[ASAP] Infrared Spectroscopic and Kinetic Characterization on the Photolysis of Nitrite in Alcohol-Containing Aqueous Solutions

The Journal of Physical Chemistry A
DOI: 10.1021/acs.jpca.0c02104




red

[ASAP] Prediction of Solvation Free Energies of Ionic Solutes in Neutral Solvents

The Journal of Physical Chemistry A
DOI: 10.1021/acs.jpca.0c01606




red

Community Cancer Practices Battered by Closures, Now COVID-19

Since 2018, there has been a 20.8% increase in practices merging or being acquired, and more recently they have also taken a beating from COVID-19.
Medscape Medical News




red

Mathematica Named Grand Prizewinner in the Visualization Resources of Community-Level Social Determinants of Health Challenge Sponsored by the Agency for Healthcare Research and Quality

The Agency for Healthcare Research and Quality (AHRQ) announced today that Mathematica is the grand prizewinner of the Agency’s Visualization Resources of Community-Level Social Determinants of Health Challenge for its Data Visualization Tool.




red

Positive Findings from Year 2 of the Centers for Medicare &amp; Medicaid Services’ Million Hearts&#174; Cardiovascular Disease Risk Reduction Model

Mathematica has released positive evaluation findings from Year 2 of the Million Hearts® model, just in time for American Heart Month this February.




red

Development of the Uncertainty Communication Checklist: A Patient-Centered Approach to Patient Discharge From the Emergency Department

Clear communication with patients upon emergency department (ED) discharge is important for patient safety during the transition to outpatient care.




red

Endangered species and fragile ecosystems in the South China Sea: The Philippines v. China arbitration / Alfredo C. Robles, Jr

Online Resource




red

Lessons in environmental microbiology / authored by Roger Tim Haug

Online Resource




red

The redesigned Earth: a brief review of ecology for engineers, as if the Earth really mattered / John T. Tanacredi

Online Resource




red

Wild at heart: America's turbulent relationship with nature, from exploitation to redemption / Alice Outwater

Rotch Library - GF75.O87 2019




red

Rediscovery of genetic and genomic resources for future food security Romesh Kumar Salgotra, Sajad Majeed Zargar, editors

Online Resource




red

City unseen: new visions of an urban planet / Karen C. Seto and Meredith Reba

Rotch Library - QH541.5.C6 S45 2018




red

Observation of transition cascades in sheared liquid crystalline polymers

Soft Matter, 2020, 16,3891-3901
DOI: 10.1039/D0SM00275E, Paper
Ryan J. Fox, M. Gregory Forest, Stephen J. Picken, Theo J. Dingemans
We observe anomalous shear thickening behavior of a lyotropic liquid crystalline polymer due to the dynamics of the nematic director.
The content of this RSS Feed (c) The Royal Society of Chemistry




red

Structural universality in disordered packings with size and shape polydispersity

Soft Matter, 2020, Advance Article
DOI: 10.1039/D0SM00110D, Paper
Ye Yuan, Wei Deng, Shuixiang Li
Normalized free volume collapses on normalized particle size in polydisperse-sized packings for a given non-spherical particle.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




red

Photo-tunable hydrogel mechanical heterogeneity informed by predictive transport kinetics model

Soft Matter, 2020, 16,4131-4141
DOI: 10.1039/D0SM00052C, Paper
Callie I. Higgins, Jason P. Killgore, Frank W. DelRio, Stephanie J. Bryant, Robert R. McLeod
Photo-tunable hydrogel mechanical heterogeneity using a single resin is presented here, informed by a predictive transport kinetics and swelling model.
The content of this RSS Feed (c) The Royal Society of Chemistry




red

Effect of network homogeneity on mechanical, thermal and electrochemical properties of solid polymer electrolytes prepared by homogeneous 4-arm poly(ethylene glycols)

Soft Matter, 2020, 16,4290-4298
DOI: 10.1039/D0SM00289E, Paper
Monami Tosa, Kei Hashimoto, Hisashi Kokubo, Kazuhide Ueno, Masayoshi Watanabe
The effect of network inhomogeneity in solid polymer electrolytes on its electrolyte properties was investigated by employing a model polymer network composed of a homogeneous 4-arm poly(ethylene glycol) (tetra-PEG) network and Li salt.
The content of this RSS Feed (c) The Royal Society of Chemistry




red

The tripeptide GHG as an unexpected hydrogelator triggered by imidazole deprotonation

Soft Matter, 2020, 16,4110-4114
DOI: 10.1039/D0SM00224K, Communication
Morgan Hesser, Lavenia Thursch, Todd Lewis, David DiGuiseppi, Nicolas J. Alvarez, Reinhard Schweitzer-Stenner
The tripeptide glycyl-histidyl-glycine (GHG) self-assembles into long, crystalline fibrils forming a strong hydrogel (G' ∼ 50 kPa) above a critical concentration of 40 mM upon the deprotonation of its imidazole group.
The content of this RSS Feed (c) The Royal Society of Chemistry




red

Systematic approach for wettability prediction using molecular dynamics simulations

Soft Matter, 2020, 16,4299-4310
DOI: 10.1039/D0SM00197J, Paper
Open Access
  This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.
Ahmed Jarray, Herman Wijshoff, Jurriaan A. Luiken, Wouter K. den Otter
An efficient approach for fast screening of liquids in terms of their wetting properties.
The content of this RSS Feed (c) The Royal Society of Chemistry




red

Mechanical robustness of monolayer nanoparticle-covered liquid marbles

Soft Matter, 2020, Advance Article
DOI: 10.1039/D0SM00496K, Paper
Junchao Huang, Ziheng Wang, Haixiao Shi, Xiaoguang Li
A particle shell as thin as ∼20 nm cannot protect internal liquid from wetting external solid.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




red

Entrepreneurial trees, watered by philanthropy, bears fruit


the Harambe Entrepreneur Alliance—is hastening the development of Africa by promoting smaller and more daring actions.
More RSS Feed for Cisco: newsroom.cisco.com/rss-feeds ...



  • Corporate Social Responsibility

red

[ASAP] Room Temperature Graphene Mid-Infrared Bolometer with a Broad Operational Wavelength Range

ACS Photonics
DOI: 10.1021/acsphotonics.0c00028




red

[ASAP] Colloidal Quantum-Dots/Graphene/Silicon Dual-Channel Detection of Visible Light and Short-Wave Infrared

ACS Photonics
DOI: 10.1021/acsphotonics.0c00247




red

[ASAP] Colored Radiative Cooling Coatings with Nanoparticles

ACS Photonics
DOI: 10.1021/acsphotonics.0c00513




red

[ASAP] Ultrafast Colloidal Quantum Dot Infrared Photodiode

ACS Photonics
DOI: 10.1021/acsphotonics.0c00363




red

Five Interesting Ways to Use Array.reduce() (And One Boring Way)

Chris Ferdinandi turns the heat down low and lets the sauce reduce while we take a look at how to add spice to our source with a sprinkling of Array.reduce(). Just a little ingenuity with the humblest of functions.


Of all the modern array methods, the one I had the hardest time wrapping my head around was Array.reduce().

On the surface, it seems like a simple, boring method that doesn’t do much. But below its humble exterior, Array.reduce() is actually a powerful, flexible addition to your developer toolkit.

Today, we’re going to look at some cool things you can do with Array.reduce().

How Array.reduce() works

Most of the modern array methods return a new array. The Array.reduce() method is a bit more flexible. It can return anything. Its purpose is to take an array and condense its content into a single value.

That value can be a number, a string, or even an object or new array. That’s the part that’s always tripped me up – I didn’t realize just how flexible it is!

The syntax

The Array.reduce() accepts two arguments: a callback method to run against each item in the array, and a starting value.

The callback also accepts two arguments: the accumulator, which is the current combined value, and the current item in the loop. Whatever you return is used as the accumulator for the next item in the loop. On the very first loop, that starting value is used instead.

var myNewArray = [].reduce(function (accumulator, current) {
  return accumulator;
}, starting);

Let’s look at some examples to make this all tangible.

1. Adding numbers together

Let’s say you had an array of numbers that you wanted to add together. Using Array.forEach(), you might do something like this:

var total = 0;

[1, 2, 3].forEach(function (num) {
  total += num;
});

This is the cliche example for using Array.reduce(). I find the word accumulator confusing, so in this example, I’m calling it sum, because that’s what it is.

var total = [1, 2, 3].reduce(function (sum, current) {
  return sum + current;
}, 0);

Here, we pass in 0 as our starting value.

In the callback, we add the current value to the sum, which has our starting value of 0 on the first loop, then 1 (the starting value of 0 plus the item value of 1), then 3 (the sum value of 1 plus the item value of 2), and so on.

Here’s a demo.

2. Combining multiple array methods into Array.map() and Array.filter() into a single step

Imagine you had an array of wizards at Hogwarts.

var wizards = [
  {
    name: 'Harry Potter',
    house: 'Gryfindor'
  },
  {
    name: 'Cedric Diggory',
    house: 'Hufflepuff'
  },
  {
    name: 'Tonks',
    house: 'Hufflepuff'
  },
  {
    name: 'Ronald Weasley',
    house: 'Gryfindor'
  },
  {
    name: 'Hermione Granger',
    house: 'Gryfindor'
  }
];

You want to create a new array that contains just the names of wizards who are in Hufflepuff. One way you could do that is by using the Array.filter() method to get back just wizards whose house property is Hufflepuff. Then, you’d use the Array.map() method to create a new array containing just the name property for the remaining wizards.

// Get the names of the wizards in Hufflepuff
var hufflepuff = wizards.filter(function (wizard) {
  return wizard.house === 'Hufflepuff';
}).map(function (wizard) {
  return wizard.name;
});

With the Array.reduce() method, we can get the same array in a single pass, improving our performance. You pass in an empty array ([]) as the starting value. On each pass, you check to see if the wizard.house is Hufflepuff. If it is, you push it to the newArr (our accumulator in this example). If not, you do nothing.

Either way, you return the newArr to become the accumulator on the next pass.

// Get the names of the wizards in Hufflepuff
var hufflepuff = wizards.reduce(function (newArr, wizard) {
  if (wizard.house === 'Hufflepuff') {
    newArr.push(wizard.name);
  }
  return newArr;
}, []);

Here’s another demo.

3. Creating markup from an array

What if, instead of creating an array of names, we wanted to create an unordered list of wizards in Hufflepuff? Instead of passing an empty array into Array.reduce() as our starting value, we’ll pass in an empty string ('') and call it html.

If the wizard.house equals Hufflepuff, we’ll concatenate our html string with the wizard.name wrapped in an opening and closing list item (li). Then, we’ll return the html to become the accumulator on the next loop.

// Create a list of wizards in Hufflepuff
var hufflepuffList = wizards.reduce(function (html, wizard) {
  if (wizard.house === 'Hufflepuff') {
    html += '<li>' + wizard.name + '</li>';
  }
  return html;
}, '');

Add an opening and closing unordered list element before and after Array.reduce(), and you’re ready to inject your markup string into the DOM.

// Create a list of wizards in Hufflepuff
var hufflepuffList = '<ul>' + wizards.reduce(function (html, wizard) {
  if (wizard.house === 'Hufflepuff') {
    html += '<li>' + wizard.name + '</li>';
  }
  return html;
}, '') + '</ul>';

See it in action here.

4. Grouping similar items in an array together

The lodash library has a groupBy() method takes a collection of items as an array and groups them together into an object based on some criteria.

Let’s say you want an array of numbers.

If you wanted to group all of the items in numbers together based on their integer value, you would do this with lodash.

var numbers = [6.1, 4.2, 6.3];

// returns {'4': [4.2], '6': [6.1, 6.3]}
_.groupBy(numbers, Math.floor);

If you had an array of words, and you wanted to group the items in words by their length, you would do this.

var words = ['one', 'two', 'three'];

// returns {'3': ['one', 'two'], '5': ['three']}
_.groupBy(words, 'length');

Creating a groupBy() function with Array.reduce()

You can recreate that same functionality using the Array.reduce() method.

We’ll create a helper function, groupBy(), that accepts the array and criteria to sort by as arguments. Inside groupBy(), we’ll run Array.reduce() on our array, passing in an empty object ({}) as our starting point, and return the result.

var groupBy = function (arr, criteria) {
  return arr.reduce(function (obj, item) {
    // Some code will go here...
  }, {});
};

Inside the Array.reduce() callback function, we’ll check to see if the criteria is a function, or a property of the item. Then we’ll get its value from the current item.

If there’s no property in the obj with that value yet, we’ll create it and assign an empty array as its value. Finally, we’ll push the item to that key, and return the object as the accumulator for the next loop.

var groupBy = function (arr, criteria) {
  return arr.reduce(function (obj, item) {

    // Check if the criteria is a function to run on the item or a property of it
    var key = typeof criteria === 'function' ? criteria(item) : item[criteria];

    // If the key doesn't exist yet, create it
    if (!obj.hasOwnProperty(key)) {
      obj[key] = [];
    }

    // Push the value to the object
    obj[key].push(item);

    // Return the object to the next item in the loop
    return obj;

  }, {});
};

Here’s a demo of the completed helper function.

Special thanks to Tom Bremer for helping me make some improvements to this one. You can find this helper function and more like it on the Vanilla JS Toolkit.

5. Combining data from two sources into an array

Remember our array of wizards?

var wizards = [
  {
    name: 'Harry Potter',
    house: 'Gryfindor'
  },
  {
    name: 'Cedric Diggory',
    house: 'Hufflepuff'
  },
  {
    name: 'Tonks',
    house: 'Hufflepuff'
  },
  {
    name: 'Ronald Weasley',
    house: 'Gryfindor'
  },
  {
    name: 'Hermione Granger',
    house: 'Gryfindor'
  }
];

What if you had another data set, an object of house points each wizard has earned.

var points = {
  HarryPotter: 500,
  CedricDiggory: 750,
  RonaldWeasley: 100,
  HermioneGranger: 1270
};

Imagine you wanted to combine both sets of data into a single array, with the number of points added to each wizard’s data in the wizards array. How would you do it?

The Array.reduce() method is perfect for this!

var wizardsWithPoints = wizards.reduce(function (arr, wizard) {

  // Get the key for the points object by removing spaces from the wizard's name
  var key = wizard.name.replace(' ', '');

  // If the wizard has points, add them
  // Otherwise, set them to 0
  if (points[key]) {
    wizard.points = points[key];
  } else {
    wizard.points = 0;
  }

  // Push the wizard object to the new array
  arr.push(wizard);

  // Return the array
  return arr;

}, []);

Here’s a demo combining data from two sources into an array.

6. Combining data from two sources into an object

What if you instead wanted to combine the two data sources into an object, where each wizard’s name was the key, and their house and points were properties? Again, the Array.reduce() method is perfect for this.

var wizardsAsAnObject = wizards.reduce(function (obj, wizard) {

  // Get the key for the points object by removing spaces from the wizard's name
  var key = wizard.name.replace(' ', '');

  // If the wizard has points, add them
  // Otherwise, set them to 0
  if (points[key]) {
    wizard.points = points[key];
  } else {
    wizard.points = 0;
  }

  // Remove the name property
  delete wizard.name;

  // Add wizard data to the new object
  obj[key] = wizard;

  // Return the array
  return obj;

}, {});

Here’s a demo combining two data sets into an object.

Should you use Array.reduce() more?

The Array.reduce() method has gone from being something I thought was pointless to my favorite JavaScript method. So, should you use it? And when?

The Array.reduce() method has fantastic browser support. It works in all modern browsers, and IE9 and above. It’s been supported in mobile browsers for a long time, too. If you need to go back even further than that, you can add a polyfill to push support back to IE6.

The biggest complaint you can make about Array.reduce() is that it’s confusing for people who have never encountered it before. Combining Array.filter() with Array.map() is slower to run and involves extra steps, but it’s easier to read. It’s obvious from the names of the methods what they’re supposed to be doing.

That said, there are times where Array.reduce() makes things that would be complicated more simple rather than more complicated. The groupBy() helper function is a good example.

Ultimately, this is another tool to add to your toolkit. A tool that, if used right, can give you super powers.


About the author

Chris Ferdinandi helps people learn vanilla JavaScript. He believes there’s a simpler, more resilient way to make things for the web.

Chris is the author of the Vanilla JS Pocket Guide series, creator of the Vanilla JS Academy training program, and host of the Vanilla JS Podcast. His developer tips newsletter is read by thousands of developers each weekday.

He’s taught developers at organizations like Chobani and the Boston Globe, and his JavaScript plugins have been used used by Apple and Harvard Business School. Chris Coyier, the founder of CSS-Tricks and CodePen, has described his writing as “infinitely quote-worthy.”

Chris loves pirates, puppies, and Pixar movies, and lives near horse farms in rural Massachusetts. He runs Go Make Things with Bailey Puppy, a lab-mix from Tennessee.

More articles by Chris




red

Red state blues: how the conservative revolution stalled in the states / Matt Grossmann

Dewey Library - JK2356.G76 2019




red

Open season: legalized genocide of colored people / Ben Crump

Dewey Library - HV9950.C79 2019




red

Triggered: how the Left thrives on hate and wants to silence us / Donald Trump Jr

Dewey Library - JK2316.T88 2019




red

Leadership studies and the desire for shared agreement: a narrative inquiry / Stan Amaladas

Dewey Library - JF1525.L4 A63 2019




red

Intelligence and state surveillance in modern societies: an international perspective / by Frederic Lemieux

Dewey Library - JF1525.I6 L46 2019




red

Brazil: neoliberalism versus democracy / Alfredo Saad-Filho and Lecio Morais

Rotch Library - JL2431.S23 2018




red

Imperial nation: ruling citizens and subjects in the British, French, Spanish, and American empires / Joseph M. Fredera ; translated by Ruth MacKay

Dewey Library - JC359.F6313 2018




red

The sexual politics of gendered violence and women's citizenship / Suzanne Franzway, Nicole Moulding, Sarah Wendt, Carole Zufferey, Donna Chung

Dewey Library - HV6626.F73 2019




red

DA case: Jaganmohan Reddy's judicial custody extended till October 3

Court had earlier on Sept 18 reserved its order till Sept 23 on Jagan's bail plea.




red

Delhi ATM cash heist: Absconding cash van driver arrested, looted money recovered

Thirty-year old Satish and his cousin Shailender have been arrested from Etah in U.P.




red

Kiran Reddy: People's concerns must be answered ahead of Andhra Pradesh division

CM Kiran Reddy says that the state is more important than any political calculations.




red

Jammu terror attacks: Shopkeeper gave a Muslim name, they spared him

On hearing a Muslim name, the militants let him go, telling him he was one of God''s people.




red

Scared to return home, hundreds seek transfer certificates for kids

Parents unwilling to return home, sought help of camp organisers to let kids to study elsewhere.




red

Jaganmohan Reddy praises Modi, urges him to build a secular platform

Reddy also said he would do what all other secular parties do and that he had options.




red

4 injured as steel bombs made in unoccupied house explode

Ten other steel bombs were recovered from the house on Thursday night.




red

Mayawati has captured Dalit movement, doesn't allow others to rise: Rahul Gandhi

Rahul urged Congress to "systematically" prepare Dalit leadership at every level.




red

Would make strong case for united Andhra: Kiran Reddy on Telangana

Our endeavour is to see that the state remains united for its betterment, Kiran said.




red

Jaganmohan Reddy appears before CBI court in disproportionate assets case

Case relates to alleged investments made by various companies in Jagan's firms.




red

Pakistan should be declared a terrorist nation, says Bitta

Bitta advocated an increase in the military presence in JandK as the Valley faces threats everyday.




red

Environmentalist Sunita Narain injured in road mishap

Director general for the Centre of Science and Environment was hit by a vehicle.




red

Pak shells 10 BoP areas along IB in JK, 2 personnel injured

Omar Abdullah said Centre should look at other options if Pak continues to violate ceasefire.