Monthly Archives: June 2014

Steven D. Schafersman’s Introduction to Science

In 1997, Steven D. Schaferman (Professor for geology, Miami) has published an essay titled “Scientific Thinking and the Scientific Method”. Its primary source is this website:, created with Frontpage 3.0 (and a nice brownish-yellowish background.). I feel the urge to share this text with you, and to prevent it from getting lost in the net. The essay manages to bridge fundamental scientific approaches and philosophy, in simple words. As a scientist, I often have those unstructured thoughts about “why the hell am I doing this” — while reading the text I got the feeling that it brings some of these thoughts into order. Also, for some of us it might be nice to explicitly read why we have been educated the way we were educated. Keep in mind that this is only an introduction to the huge philosophical topic of scientific theory, but as a primer it serves well.

The essay is referenced and quoted in many places, also in books. However, most of the online references contain dead links. Hence, I want to provide another platform for the essay, in modern HMTL in readable form, even mobile-friendly. Here it is.

An Introduction to Science

Scientific Thinking and the Scientific Method

Steven D. Schafersman
Department of Geology
Miami University
January, 1997


To succeed in this science course and, more specifically, to answer some of the questions on the first exam, you should be familiar with a few of the concepts regarding the definition of science, scientific thinking, and the methods of science. Most textbooks do an inadequate job of this task, so this essay provides that information. This information in its present form is not in your textbook, so please read it carefully here, and pay close attention to the words in boldface and the definitions in italics.

The Definition of Science

Science is not merely a collection of facts, concepts, and useful ideas about nature, or even the systematic investigation of nature, although both are common definitions of science. Science is a method of investigating nature–a way of knowing about nature–that discovers reliable knowledge about it. In other words, science is a method of discovering reliable knowledge about nature. There are other methods of discovering and learning knowledge about nature (these other knowledge methods or systems will be discussed below in contradistinction to science), but science is the only method that results in the acquisition of reliable knowledge.

Reliable knowledge is knowledge that has a high probablility of being true because its veracity has been justified by a reliable method. Reliable knowledge is sometimes called justified true belief, to distinguish reliable knowledge from belief that is false and unjustified or even true but unjustified. (Please note that I do not, as some do, make a distinction between belief and knowledge; I think that what one believes is one’s knowledge. The important distinction that should be made is whether one’s knowledge or beliefs are true and, if true, are justifiably true.) Every person has knowledge or beliefs, but not all of each person’s knowledge is reliably true and justified. In fact, most individuals believe in things that are untrue or unjustified or both: most people possess a lot of unreliable knowledge and, what’s worse, they act on that knowledge! Other ways of knowing, and there are many in addition to science, are not reliable because their discovered knowledge is not justified. Science is a method that allows a person to possess, with the highest degree of certainty possible, reliable knowledge (justified true belief) about nature. The method used to justify scientific knowledge, and thus make it reliable, is called the scientific method. I will explain the formal procedures of the scientific method later in this essay, but first let’s describe the more general practice of scientific or critical thinking.

Scientific and Critical Thinking

When one uses the scientific method to study or investigate nature or the universe, one is practicing scientific thinking. All scientists practice scientific thinking, of course, since they are actively studying nature and investigating the universe by using the scientific method. But scientific thinking is not reserved solely for scientists. Anyone can "think like a scientist" who learns the scientific method and, most importantly, applies its precepts, whether he or she is investigating nature or not. When one uses the methods and principles of scientific thinking in everyday life–such as when studying history or literature, investigating societies or governments, seeking solutions to problems of economics or philosophy, or just trying to answer personal questions about oneself or the meaning of existence–one is said to be practicing critical thinking. Critical thinking is thinking correctly for oneself that successfully leads to the most reliable answers to questions and solutions to problems. In other words, critical thinking gives you reliable knowledge about all aspects of your life and society, and is not restricted to the formal study of nature. Scientific thinking is identical in theory and practice, but the term would be used to describe the method that gives you reliable knowledge about the natural world. Clearly, scientific and critical thinking are the same thing, but where one (scientific thinking) is always practiced by scientists, the other (critical thinking) is sometimes used by humans and sometimes not. Scientific and critical thinking was not discovered and developed by scientists (that honor must go to ancient Hellenistic philosophers, such as Aristotle, who also are sometimes considered the first scientists), but scientists were the ones to bring the practice of critical thinking to the attention and use of modern society (in the 17th and 18th centuries), and they are the most explicit, rigorous, and successful practitioners of critical thinking today. Some professionals in the humanities, social sciences, jurisprudence, business, and journalism practice critical thinking as well as any scientist, but many, alas, do not. Scientists must practice critical thinking to be successful, but the qualifications for success in other professions do not necessarily require the use of critical thinking, a fact that is the source of much confusion, discord, and unhappiness in our sociey .

The scientific method has proven to be the most reliable and successful method of thinking in human history, and it is quite possible to use scientific thinking in other human endeavors. For this reason, critical thinking–the application of scientific thinking to all areas of study and topics of investigation–is being taught in schools throughout the United States, and its teaching is being encouraged as a universal ideal. You may perhaps have been exposed to critical thinking skills and exercises earlier in your education. The important point is this: critical thinking is perhaps the most important skill a student can learn in school and college, since if you master its skills, you know how to think successfully and reach reliable conclusions, and such ability will prove valuable in any human endeavor, including the humanities, social sciences, commerce, law, journalism, and government, as well as in scholarly and scientific pursuits. Since critical thinking and scientific thinking are, as I claim, the same thing, only applied for different purposes, it is therefore reasonable to believe that if one learns scientific thinking in a science class, one learns, at the same time, the most important skill a student can possess–critical thinking. This, to my mind, is perhaps the foremost reason for college students to study science, no matter what one’s eventual major, interest, or profession.

The Three Central Components of Scientific and Critical Thinking

What is scientific thinking? At this point, it is customary to discuss questions, observations, data, hypotheses, testing, and theories, which are the formal parts of the scientific method, but these are NOT the most important components of the scientific method. The scientific method is practiced within a context of scientific thinking, and scientific (and critical) thinking is based on three things: using empirical evidence (empiricism), practicing logical reasonsing (rationalism), and possessing a skeptical attitude (skepticism) about presumed knowledge that leads to self-questioning, holding tentative conclusions, and being undogmatic (willingness to change one’s beliefs). These three ideas or principles are universal throughout science; without them, there would be no scientific or critical thinking. Let’s examine each in turn.

1. Empiricism: The Use of Empirical Evidence

Empirical evidence is evidence that one can see, hear, touch, taste, or smell; it is evidence that is susceptible to one’s senses. Empirical evidence is important because it is evidence that others besides yourself can experience, and it is repeatable, so empirical evidence can be checked by yourself and others after knowledge claims are made by an individual. Empirical evidence is the only type of evidence that possesses these attributes and is therefore the only type used by scientists and critical thinkers to make vital decisions and reach sound conclusions.

We can contrast empirical evidence with other types of evidence to understand its value. Hearsay evidence is what someone says they heard another say; it is not reliable because you cannot check its source. Better is testimonial evidence, which, unlike hearsay evidence, is allowed in courts of law. But even testimonial evidence is notoriously unreliable, as numerous studies have shown. Courts also allow circumstantial evidence (e.g., means, motive, and opportunity), but this is obviously not reliable. Revelatory evidence or revelation is what someone says was revealed to them by some deity or supernatural power; it is not reliable because it cannot be checked by others and is not repeatable. Spectral evidence is evidence supposedly manifested by ghosts, spirits, and other paranormal or supernatural entities; spectral evidence was once used, for example, to convict and hang a number of innocent women on charges of witchcraft in Salem, Massachusetts, in the seventeenth century, before the colonial governor banned the use of such evidence, and the witchcraft trials ended. Emotional evidence is evidence derived from one’s subjective feelings; such evidence is often repeatable, but only for one person, so it is unreliable.

The most common alternative to empirical evidence, authoritarian evidence, is what authorities (people, books, billboards, television commercials, etc.) tell you to believe. Sometimes, if the authority is reliable, authoritarian evidence is reliable evidence, but many authorities are not reliable, so you must check the reliability of each authority before you accept its evidence. In the end, you must be your own authority and rely on your own powers of critical thinking to know if what you believe is reliably true. (Transmitting knowledge by authority is, however, the most common method among humans for three reasons: first, we are all conditioned from birth by our parents through the use of positive and negative reinforcement to listen to, believe, and obey authorities; second, it is believed that human societies that relied on a few experienced or trained authorities for decisions that affected all had a higher survival value than those that didn’t, and thus the behaviorial trait of susceptibility to authority was strengthened and passed along to future generations by natural selection; third, authoritarian instruction is the quickest and most efficient method for transmitting information we know about. But remember: some authoritarian evidence and knowledge should be validated by empirical evidence, logical reasoning, and critical thinking before you should consider it reliable, and, in most cases, only you can do this for yourself.

It is, of course, impossible to receive an adequate education today without relying almost entirely upon authoritarian evidence. Teachers, instructors, and professors are generally considered to be reliable and trustworthy authorities, but even they should be questioned on occasion. The use of authoritarian evidence in education is so pervasive, that its use has been questioned as antithetical to the true spirit of scholarly and scientific inquiry, and attempts have been made in education at all levels in recent years to correct this bias by implementing discovery and inquiry methodologies and curricula in classrooms and laboratories. The recently revised geology laboratory course at Miami University, GLG 115.L, is one such attempt, as are the Natural Systems courses in the Western College Program at Miami. It is easier to utilize such programs in humanities and social sciences, in which different yet equally valid conclusions can be reached by critical thinking, rather than in the natural sciences, in which the objective reality of nature serves as a constant judge and corrective mechanism.

Another name for empirical evidence is natural evidence: the evidence found in nature. Naturalism is the philosophy that says that "Reality and existence (i.e. the universe, cosmos, or nature) can be described and explained solely in terms of natural evidence, natural processes, and natural laws." This is exactly what science tries to do. Another popular definition of naturalism is that "The universe exists as science says it does." This definition emphasizes the strong link between science and natural evidence and law, and it reveals that our best understanding of material reality and existence is ultimately based on philosophy. This is not bad, however, for, whether naturalism is ultimately true or not, science and naturalism reject the concept of ultimate or absolute truth in favor of a concept of proximate reliable truth that is far more successful and intellectually satisfying than the alternative, the philosophy of supernaturalism. The supernatural, if it exists, cannot be examined or tested by science, so it is irrelevant to science. It is impossible to possess reliable knowledge about the supernatural by the use of scientific and critical thinking. Individuals who claim to have knowledge about the supernatural do not possess this knowledge by the use of critical thinking, but by other methods of knowing.

Science has unquestionably been the most successful human endeavor in the history of civilization, because it is the only method that successfully discovers and formulates reliable knowledge. The evidence for this statement is so overwhelming that many individuals overlook exactly how modern civilization came to be (our modern civilization is based, from top to bottom, on the discoveries of science and their application, known as technology, to human purposes.). Philosophies that claim to possess absolute or ultimate truth invariably find that they have to justify their beliefs by faith in dogma, authority, revelation, or philosophical speculation, since it is impossible to use finite human logic or natural evidence to demonstrate the existence of the absolute or ultimate in either the natural or supernatural worlds. Scientific and critical thinking require that one reject blind faith, authority, revelation, and subjective human feelings as a basis for reliable belief and knowledge. These human cognitive methods have their place in human life, but not as the foundation for reliable knowledge.

2. Rationalism: The Practice of Logical Reasoning

Scientists and critical thinkers always use logical reasoning. Logic allows us to reason correctly, but it is a complex topic and not easily learned; many books are devoted to explaining how to reason correctly, and we can not go into the details here. However, I must point out that most individuals do not reason logically, because they have never learned how to do so. Logic is not an ability that humans are born with or one that will gradually develop and improve on its own, but is a skill or discipline that must be learned within a formal educational environment. Emotional thinking, hopeful thinking, and wishful thinking are much more common than logical thinking, because they are far easier and more congenial to human nature. Most individuals would rather believe something is true because they feel it is true, hope it is true, or wish it were true, rather than deny their emotions and accept that their beliefs are false.

Often the use of logical reasoning requires a struggle with the will, because logic sometimes forces one to deny one’s emotions and face reality, and this is often painful. But remember this: emotions are not evidence, feelings are not facts, and subjective beliefs are not substantive beliefs. Every successful scientist and critical thinker spent years learning how to think logically, almost always in a formal educational context. Some people can learn logical thinking by trial and error, but this method wastes time, is inefficient, is sometimes unsuccessful, and is often painful.

The best way to learn to think logically is to study logic and reasoning in a philosophy class, take mathematics and science courses that force you to use logic, read great literature and study history, and write frequently. Reading, writing, and math are the traditional methods that young people learned to think logically (i.e. correctly), but today science is a fourth method. Perhaps the best way is to do a lot of writing that is then reviewed by someone who has critical thinking skills. Most people never learn to think logically; many illogical arguments and statements are accepted and unchallenged in modern society–often leading to results that are counterproductive to the good of society or even tragic–because so many people don’t recognize them for what they are.

3. Skepticism: Possessing a Skeptical Attitude

The final key idea in science and critical thinking is skepticism, the constant questioning of your beliefs and conclusions. Good scientists and critical thinkers constantly examine the evidence, arguments, and reasons for their beliefs. Self-deception and deception of yourself by others are two of the most common human failings. Self-deception often goes unrecognized because most people deceive themselves. The only way to escape both deception by others and the far more common trait of self-deception is to repeatedly and rigorously examine your basis for holding your beliefs. You must question the truth and reliability of both the knowledge claims of others and the knowledge you already possess. One way to do this is to test your beliefs against objective reality by predicting the consequences or logical outcomes of your beliefs and the actions that follow from your beliefs. If the logical consequences of your beliefs match objective reality–as measured by empirical evidence–you can conclude that your beliefs are reliable knowledge (that is, your beliefs have a high probability of being true).

Many people believe that skeptics are closed-minded and, once possessing reliable knowledge, resist changing their minds–but just the opposite is true. A skeptic holds beliefs tentatively, and is open to new evidence and rational arguments about those beliefs. Skeptics are undogmatic, i.e., they are willing to change their minds, but only in the face of new reliable evidence or sound reasons that compel one to do so. Skeptics have open minds, but not so open that their brains fall out: they resist believing something in the first place without adequate evidence or reason, and this attribute is worthy of emulation. Science treats new ideas with the same skepticism: extraordinary claims require extraordinary evidence to justify one’s credulity. We are faced every day with fantastic, bizarre, and outrageous claims about the natural world; if we don’t wish to believe every pseudoscientific allegation or claim of the paranormal, we must have some method of deciding what to believe or not, and that method is the scientific method which uses critical thinking.

The Scientific Method in Practice

Now, we are ready to put the scientific method into action. Many books have been written about the scientific method, and it is a long and complex topic. Here I will only treat it briefly and superficially. The scientific method, as used in both scientific thinking and critical thinking, follows a number of steps.

  1. One must ask a meaningful question or identify a significant problem, and one should be able to state the problem or question in a way that it is conceivably possible to answer it. Any attempt to gain knowledge must start here. Here is where emotions and outside influences come in. For example, all scientists are very curious about nature, and they have to possess this emotional characteristic to sustain the motivation and energy necessary to perform the hard and often tedious work of science. Other emotions that can enter are excitement, ambition, anger, a sense of unfairness, happiness, and so forth. Note that scientists have emotions, some in high degree; however, they don’t let their emotions give false validity to their conclusions, and, in fact, the scientific method prevents them from trying to do this even if they wished.
  2. Many outside factors can come into play here. Scientists must choose which problems to work on, they decide how much time to devote to different problems, and they are often influenced by cultural, social, political, and economic factors. Scientists live and work within a culture that often shapes their approach to problems; they work within theories that often shape their current understanding of nature; they work within a society that often decides what scientific topics will be financially supported and which will not; and they work within a political system that often determines which topics are permitted and financially rewarded and which are not.

    Also, at this point, normally nonscientific emotional factors can lead to divergent pathways. Scientists could be angry at polluters and choose to investigate the effects of pollutants; other scientists could investigate the results of smoking cigarettes on humans because they can earn a living doing this by working for tobacco companies; intuition can be used to suggest different approaches to problems; even dreams can suggest creative solutions to problems. I wish to emphasize, however, that the existence of these frankly widespread nonscientific emotional and cultural influences does not compromize the ultimate reliability and objectivity of scientific results, because subsequent steps in the scientific method serve to eliminate these outside factors and allow science to reach reliable and objective conclusions (admittedly it may take some time for subjective and unreliable scientific results to be eliminated). There exists a school of thought today in the humanities (philosophy, history, and sociology) called post-modernism or scientific constructivism, that claims that science is a social and cultural construct, that scientific knowledge inevitably changes as societies and cultures change, and that science has no inherently valid foundation on which to base its knowledge claims of objectivity and reliability. In brief, post-modernists believe that the modern, scientific world of Enlightenment rationality and objectivity must now give way to a post-modern world of relativism, social constructivism, and equality of belief. Almost all scientists who are aware of this school of thought reject it, as do I; post-modernism is considered irrelevant by scientists and has had no impact on the practice of science at all. We will have to leave this interesting topic for a later time, unfortunately, but you may be exposed to these ideas in a humanities class. If you are, remember to think critically!

  3. One must next gather relevant information to attempt to answer the question or solve the problem by making observations. The first observations could be data obtained from the library or information from your own experience. Another souce of observations could be from trial experiments or past experiments. These observations, and all that follow, must be empirical in nature–that is, they must be sensible, measurable, and repeatable, so that others can make the same observations. Great ingenuity and hard work on the part of the scientist is often necessary to make scientific observations. Furthermore, a great deal of training is necessary in order to learn the methods and techniques of gathering scientific data.
  4. Now one can propose a solution or answer to the problem or question. In science, this suggested solution or answer is called a scientific hypothesis, and this is one of the most important steps a scientist can perform, because the proposed hypothesis must be stated in such a way that it is testable. A scientific hypothesis is an informed,testable, and predictive solution to a scientific problem that explains a natural phenomenon, process, or event. In critical thinking, as in science, your proposed answer or solution must be testable, otherwise it is essentially useless for further investigation. Most individuals–noncritical thinkers all–stop here, and are satisfied with their first answer or solution, but this lack of skepticism is a major roadblock to gaining reliable knowledge. While some of these early proposed answers may be true, most will be false, and further investigation will almost always be necessary to determine their validity.
  5. Next, one must test the hypothesis before it is corroborated and given any real validity. There are two ways to do this. First, one can conduct an experiment. This is often presented in science textbooks as the only way to test hypotheses in science, but a little reflection will show that many natural problems are not amenable to experimentation, such as questions about stars, galaxies, mountain formation, the formation of the solar system, ancient evolutionary events, and so forth. The second way to test a hypothesis is to make further observations. Every hypothesis has consequences and makes certain predictions about the phenomenon or process under investigation. Using logic and empirical evidence, one can test the hypothesis by examining how successful the predictions are, that is, how well the predictions and consequences agree with new data, further insights, new patterns, and perhaps with models. The testability or predictiveness of a hypothesis is its most important characteristic. Only hypotheses involving natural processes, natural events, and natural laws can be tested; the supernatural cannot be tested, so it lies outside of science and its existence or nonexistence is irrelevant to science.
  6. If the hypothesis fails the test, it must be rejected and either abandoned or modified. Most hypotheses are modified by scientists who don’t like to simply throw out an idea they think is correct and in which they have already invested a great deal of time or effort. Nevertheless, a modified hypothesis must be tested again. If the hypothesis passes the further tests, it is considered to be a corroborated hypothesis, and can now be published. A corroborated hypothesis is one that has passed its tests, i.e., one whose predictions have been verified. Now other scientists test the hypothesis. If further corroborated by subsequent tests, it becomes highly corroborated and is now considered to be reliable knowledge. By the way, the technical name for this part of the scientific method is the "hypothetico-deductive method," so named because one deduces the results of the predictions of the hypothesis and tests these deductions. Inductive reasoning, the alternative to deductive reasoning, was used earlier to help formulate the hypothesis. Both of these types of reasoning are therefore used in science, and both must be used logically.
  7. Scientists never claim that a hypothesis is "proved" in a strict sense (but sometimes this is quite legitimately claimed when using popular language), because proof is something found only in mathematics and logic, disciplines in which all logical parameters or constraints can be defined, and something that is not true in the natural world. Scientists prefer to use the word "corroborated" rather than "proved," but the meaning is essentially the same. A highly corroborated hypothesis becomes something else in addition to reliable knowledge–it becomes a scientific fact. A scientific fact is a highly corroborated hypothesis that has been so repeatedly tested and for which so much reliable evidence exists, that it would be perverse or irrational to deny it. This type of reliable knowledge is the closest that humans can come to the "truth" about the universe (I put the word "truth" in quotation marks because there are many different kinds of truth, such as logical truth, emotional truth, religious truth, legal truth, philosophical truth, etc.; it should be clear that this essay deals with scientific truth, which, while certainly not the sole truth, is nevertheless the best truth humans can possess about the natural world).

    There are many such scientific facts: the existence of gravity as a property of all matter, the past and present evolution of all living organisms, the presence of nucleic acids in all life, the motion of continents and giant tectonic plates on Earth, the expansion of the universe following a giant explosion, and so forth. Many scientific facts violate common sense and the beliefs of ancient philosophies and religions, so many people persist in denying them, but they thereby indulge in irrationality and perversity. Many other areas of human thought and philosophy, and many other knowledge systems (methods of gaining knowledge), exist that claim to have factual knowledge about the world. Some even claim that their facts are absolutely or ultimately true, something science would never claim. But their "facts" are not reliable knowledge, because–while they might fortuitously be true–they have not been justified by a reliable method. If such unreliable "facts" are true–and I certainly don’t maintain that all such knowledge claims are false–we can never be sure that they are true, as we can with scientific facts.

  8. The final step of the scientific method is to construct, support, or cast doubt on a scientific theory. A theory in science is not a guess, speculation, or suggestion, which is the popular definition of the word "theory." A scientific theory is a unifying and self-consistent explanation of fundamental natural processes or phenomena that is totally constructed of corroborated hypotheses. A theory, therefore, is built of reliable knowledge–built of scientific facts–and its purpose is to explain major natural processes or phenomena. Scientific theories explain nature by unifying many once-unrelated facts or corroborated hypotheses; they are the strongest and most truthful explanations of how the universe, nature, and life came to be, how they work, what they are made of, and what will become of them. Since humans are living organisms and are part of the universe, science explains all of these things about ourselves.
  9. These scientific theories–such as the theories of relativity, quantum mechanics, thermodynamics, evolution, genetics, plate tectonics, and big bang cosmology–are the most reliable, most rigorous, and most comprehensive form of knowledge that humans possess. Thus, it is important for every educated person to understand where scientific knowledge comes from, and how to emulate this method of gaining knowledge. Scientific knowledge comes from the practice of scientific thinking–using the scientific method–and this mode of discovering and validating knowledge can be duplicated and achieved by anyone who practices critical thinking.

Copyright © 1997 by Steven D. Schafersman

WordPress Duplicator FTW

When transferring a WordPress instance from a development environment towards the production site I used to manually apply MySQL command line tools for exporting and importing the database, third-party hacks for replacing URLs within the database, and tar and/or scp/rsync for moving files around. This is a pretty straight-forward and reliable work flow.

There is, however, a shining plugin called Duplicator which will simplify these tasks for me (and for you!) in the future and which provides some additional value. It abstracts the process of transferring a website in terms of packages. Package abstractions are used in all kinds of professional applications (think Unix-like operating system distributions, mobile operating systems, programming language extensions, Linux containers, and so on) — I find the idea of WP instance packaging compelling. A Duplicator package contains

  • a file system snapshot, containing all files and directories below the WP root directory
  • a dump of your database
  • a description
  • an installer.php file for deploying the package elsewhere.

Everything but the installer file is automatically archived and checksummed, and gets a proper file name. Eventually, a package is i) a zip file and ii) the installer.php file.

You can create such packages at any point in time from within the dashboard of your running WordPress instance. Packages are stored and indexed, and a list of available packages (created from the current instance) is shown in the dashboard. You can list, download or delete these package at any point in time:


For transferring your WordPress instance to another environment, you would transfer both package files to the new location (both go to the same directory) and execute installer.php. At this point in time you need to provide the credentials for the (new) database connection. Furthermore, the install script shows the auto-detected “old URL” and “new URL” of your WordPress instance. When you invoke installation, Duplicator will replace occurrences of the old URL in your database with the new one. It also takes care of adjusting your wp-config.php. In case your .htaccess files needs to be updated in the new location, Duplicator will provide you with instructions how to do so. After that, you are usually done: a new WP instance is up and running, with the same contents as snapshotted before during package creation.

All in all, Duplicator provides a very convenient WP instance packaging solution, as well as all required tools for safely transferring a WP instance to another environment. It is actively developed and supported, and its GUI in the dashboard as well as the installer GUI make a clean impression.

Obviously, Duplicator also serves as a nice one-button-press all-in-one backup solution before performing risky tasks (Just do not forget to download the package! :)).

There is just too much plugin trash out there, and Duplicator for sure is one of those plugins that stand out by usability and professionalism.



Are you using matplotlib for Python from time to time? You might want to have a look at prettyplotlib! In short: it makes your plots appear more harmonic and comfortable by using modern design standards and color schemes (cf. colorbrewer). These styles are nice for publishing plots on a website or in a magazine, they obviously do not add scientific value.

Technically, prettyplotlib wraps matplotlib + brewer2mpl.

Good to know checkrestart from debian-goodies

The security audits triggered by Heartbleed lead to an increasing discovery of security issues in libraries such as GnuTLS and OpenSSL within the past weeks. These issues were dealt with responsibly, i.e. they were usually published together with the corresponding binary updates by major Linux distributions such as Debian (subscribing to debian-security-announce or comparable sources is highly recommended if you want to keep track of these developments).

After downloading an updated binary of a shared library, it is important to restart all services (processes) that are linked against this library in order to make the update take effect. Usually, processes load a shared library code segment to random access memory once during startup (actually, the program loader / runtime linker does this), and do not reload that code afterwards throughout their life time, which may be weeks or months in case of server processes. Prime examples are Nginx/Apache/Exim being linked against OpenSSL or GnuTLS: if you update the latter but do not restart the former, you have changed your disk contents but not updated your service. In the worst case the system is still vulnerable. It should therefore be the habit of a good system administrator to question which services are using a certain shared library and to restart them after a shared library update, if required.

There is a neat helper utility in Debian, called checkrestart. It comes with the debian-goodies package. First of all, what is debian-goodies? Let’s see (quote from Wheezy’s package description):

Small toolbox-style utilities for Debian systems
These programs are designed to integrate with standard shell tools, extending them to operate on the Debian packaging system.
 dgrep  - Search all files in specified packages for a regex
 dglob  - Generate a list of package names which match a pattern
These are also included, because they are useful and don't justify their own packages:
 debget          - Fetch a .deb for a package in APT's database
 dpigs           - Show which installed packages occupy the most space
 debman          - Easily view man pages from a binary .deb without extracting
 debmany         - Select manpages of installed or uninstalled packages
 checkrestart    - Help to find and restart processes which are using old
                   versions of upgraded files (such as libraries)
 popbugs         - Display a customized release-critical bug list based on
                   packages you use (using popularity-contest data)
 which-pkg-broke - find which package might have broken another

Checkrestart is a Python application wrapping lsof (“list open files”). It tries to identify files used by processes that are not in the file system anymore. How so?

Note that during an update a certain binary file becomes replaced: the new version is first downloaded to disk and then rename()ed in order to overwrite the original. During POSIX rename() the old file becomes deleted. But the old file is still in use! The standard says that if any process still has a file open during its deletion, that file will remain “in existence” until the last file descriptor referring to it is closed. While these files that are still held “in existence” for running processes by the operating system, they are not listed in the file system anymore. They can however easily be identified via the lsof tool. And this is exactly what checkrestart does.

Hence, checkrestart “compares” the open files used by running processes to the corresponding files in the file system. If the file system contains other (e.g. newer) data than the process is currently using, then checkrestart proposes to restart that process. In a tidy server environment, this usually is the case only for updated shared library files. Below you can find example output after updating Java, Python, OpenSSL, and GnuTLS:

# checkrestart
Found 12 processes using old versions of upgraded files
(5 distinct programs)
(5 distinct packages)
Of these, 3 seem to contain init scripts which can be used to restart them:
The following packages seem to have init scripts that could be used
to restart them:
    20534   /usr/sbin/nginx
    20533   /usr/sbin/nginx
    20532   /usr/sbin/nginx
    19113   /usr/sbin/nginx
    3124    /usr/sbin/sshd
    22964   /usr/sbin/sshd
    25724   /usr/sbin/sshd
    22953   /usr/sbin/sshd
    25719   /usr/sbin/sshd
    3538    /usr/sbin/exim4
These are the init scripts:
service nginx restart
service ssh restart
service exim4 restart
These processes do not seem to have an associated init script to restart them:
    2548    /usr/bin/python2.7
    4348    /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java

Nginx (web server) and OpenSSH (SSH server) are linked against OpenSSL, and Exim (mail transfer agent) is linked against GnuTLS. So that output makes sense. Obviously, after an update of Python and Java processes using this interpreter or VM (respectively) also need to be restarted in order to use the new code. Checkrestart is extremely helpful, thanks for this nice tool.

Update 2014-09-03:

With the upcoming Debian 8 (Jessie, currently unstable), a new package has been introduced — needrestart. It is a more modern version of checkrestart, and tightly integrates with the systemd service infrastructure. Notably, needrestart comes in its own package and with the goal to become more popular than checkrestart (which was hidden in debian-goodies, as discussed above). Currently, a discussion is going on on the debian-security mailing list about installing and running needrestart in a default Debian installation.