Bereishit vs. science

Question: How does Judaism deal with the differences between scientific evidence of the beginning of the world and the account(s) in Bereishit?
Comment: I believe the definitive answer to this question, as stated is "Differently" :)
Comment: See Schroder's books.
Comment: see http://judaism.stackexchange.com/questions/792/why-the-vast-difference-of-opinion-about-the-age-of-the-universe
Comment: @IsaacMoses you could always start a bounty - http://judaism.stackexchange.com/faq#bounty or just give Zaq the points.
Comment: [Challenge](http://books.google.com/books?id=5fMBnHUiwukC&printsec=frontcover&dq=challenge+cyril+domb&source=bl&ots=xbk9rZ5URw&sig=-Rm-lNB8OVPrrLpftQxdNfGGOA4&hl=en&ei=vbG-S6yCLoLgnAeyl7yTCg&sa=X&oi=book_result&ct=result&resnum=1&ved=0CAYQ6AEwAA#v=onepage&q&f=false) edited by Cyril Domb and Aryeh Carmell has an extensive (and I think varied) set of articles and source texts on this subject. I'm reading it now, so I can't say more about the book yet, but it's worth a read.
Answer: According to the Rambam in the Guide of the Perplexed "Whenever it is possible to interpret the words of an individual in such a manner that they confirm to a being whose existence has been demonstrated, this is the conduct that is more fitting and most suitable for an equitable man of excellent nature."
Even though I'm certain this will be controversial, my answer is that there is no difference between Science and the accounts of Bereshit, we just need a better understanding of both. Below, is my understanding of Parshat Bereshit and the scientific theories that actually support it, in chronological order. I only posted through passuk 8 (day 2), because even though I have a lot more to say, it's time consuming. So I'll only keep going if there is interest.
Passages and Translations are copied from Chabad.org
Sections labeled "My interpretation" are how I think the passages could be read based on Hebrew-wording, rabbinic commentaries and scientific evidence. I think of it as an understanding of passage, not a translation.

Pre-Torah

"What happened, happened."  - Chagigah 16a

Current Scientific Theory:
We'll probably never know: All ideas concerning the very early universe (cosmogony^) are speculative. As of early 2010, no accelerator experiments probe energies of sufficient magnitude to provide any experimental insight into the behavior of matter at the energy levels that prevailed during this period.^

:א)  בְּרֵאשִׁית בָּרָא אֱ־לֹהִים אֵת הַשָּׁמַיִם וְאֵת הָאָרֶץ
1: In the beginning of God's creation of the heavens and the earth.

My interpretation:
In the beginning [of time], God created the Space and the Matter (including the space and matter that will become earth).

"In the beginning" refers to the beginning of time --the first, indivisible moment, before which time did not exist. (Soforno)

"In the beginning, Elokim created heavens and earth," the meaning is that in the first instant of creation all of heaven and earth were contained in a single point without dimension or form (Nachmanides)^

Heavens and Earth: "The basic substance from which He then fashioned the universe as we know it" (Artscroll)

"Heavens" and "earth" are both words that are defined in later passages to mean our Atmosphere and planet Earth, however at this point, before their definitions are specified in passages 8 & 10, heavens refers to space within the universe and earth can refer to matter in general.
Current Scientific Theory:
13.9 billion years ago, time begins in our universe, Space rapidly inflated and was filled with a fluid matter.
The Big Bang is The instant in which the universe is thought to have begun rapidly inflating^ from an extremely high energy density^. The best available measurements suggest that the initial conditions occurred between 13.3 and 13.9 billion years ago.^
The Planck epoch, is the earliest period of time in the history of the universe, from zero to approximately 10−43 seconds (Planck time), during which, it is believed, quantum effects of gravity were significant. One could also say that it is the earliest moment in time, as the Planck time is perhaps the shortest possible interval of time, and the Planck epoch lasted only this brief instant.^ Little is known about this epoch, and different theories propose different scenarios.^
At approximately 10-32 (less than a quintillionth) seconds after the Big Bang the potential energy of the inflation field that had driven the inflation of the universe during the inflationary epoch was released, filling the universe with a dense, hot quark-gluon plasma^, an early phase of matter which behaves like a fluid^.

:ב) וְהָאָרֶץ הָיְתָה תֹהוּ וָבֹהוּ וְחֹשֶׁךְ עַל פְּנֵי תְהוֹם וְרוּחַ אֱ־לֹהִים מְרַחֶפֶת עַל פְּנֵי הַמָּיִם
2: Now the earth was astonishingly empty, and darkness was on the face of the deep, and the spirit of God was hovering over the face of the water.

My interpretation: And the Matter (which includes the substance earth will be made from) was chaotic and not-formed, and there exists a dark-matter on the surface of the abyss [of our universe], and God's will (that will be carried out through the laws of nature) are impending over the surface of fluid [matter in the abyss].
Current Scientific Theory: A trillionth of a second after the big bang there is matter, but the elements were not formed yet. The universe has expanded and is filled with matter that behaves like a fluid. It's hypothesised that at this time dark matter constitutes a significant portion of the matter in the universe^.
From this point onwards the physics of the early universe is better understood, and less speculative.^ A trillionth of a second after the big bang, after cosmic inflation ends, the universe is filled with a visibly-colorless^ quark-gluon plasma or "quark soup"^. Experiments with the Relativistic Heavy Ion Collider have allowed physicists to determine that the quark–gluon plasma behaved more like a liquid than a gas^. Dark energy is present as a property of space itself, beginning immediately following the period of inflation.^

:ג) וַיֹּאמֶר אֱ־לֹהִים יְהִי אוֹר וַיְהִי אוֹר
3: And God said, "Let there be light," and there was light.

(It's interesting to note that God "programs" the universe using language.)
Current Scientific Theory: Ten seconds after the Big Bang, the energy of the universe is dominated by photons^. For 380,000 years, the remainder of the photon epoch, the universe contained a hot dense plasma of nuclei, electrons and photons.^

:ד) וַיַּרְא אֱ־לֹהִים אֶת הָאוֹר כִּי טוֹב וַיַּבְדֵּל אֱ־לֹהִים
בֵּין הָאוֹר וּבֵין הַחֹשֶׁךְ
4: And God saw the light that it was good, and God separated between the light and between the darkness.

My interpretation: And God saw that it was good [to influence the light matter to continue to exist over the dark matter], and God separated between the light and the darkness (forming stars and galaxies that include our own sun earth and moon).
Why are the luminaries are mentioned again on day four instead of when they were created, on day one? It's not the Creation Story's goal to include every step in our universe's history, the story only mentions things that are new, that means the first time anything like them is created in our universe, or is uniquely new to Earth. Suns, moons and planets are abundant In our universe, the only thing uniquely new about the earth, sun, and moon when they formed was the way the moon stabilized earth's day and night. On day four however, there are more new traits. The atmosphere clears and the Sun's output increases. This makes the sun hot enough to heat the Earth and makes the Sun and Moon and stars visible in the sky for the first time.
Current Scientific Theory:
150 million years after the Big Bang, cold dark matter dominated, paving the way for gravitational collapse to amplify the tiny inhomogeneities left by cosmic inflation.^ Gravitational collapse is at the heart of structure formation in the universe.^ The first stars and quasars form from gravitational collapse. From this point on, most of the visible universe is composed of plasma.^
Some of the earliest galaxies can bee seen forming when the universe was only 500 million years old.^
Our Sun was formed about 4.57 billion years ago when a hydrogen molecular cloud collapsed.^ The infall of material, increase in rotational speed and the crush of gravity created an enormous amount of kinetic energy at the center.^ Most of the mass concentrated in the middle and began to heat up.^
Meanwhile, the rest of the disc began to break up into rings, with gravity causing matter to condense around dust particles. Small fragments collided to become larger fragments, including one collection about 150 million kilometers from the center: this would become the Earth.^
4.6 billion years ago, the Moon stabilized Earth's axis creating steady day and night.
Without the moon to stabilize it, the earth would rotate about 3x as fast on a wobbly axis. "Vast tidal forces cause our moon to rapidly pull away... Our day lengthens from four hours to twenty-four".^

:ה) וַיִּקְרָא אֱ־לֹהִים לָאוֹר יוֹם וְלַחֹשֶׁךְ קָרָא לָיְלָה וַיְהִי
עֶרֶב וַיְהִי בֹקֶר יוֹם אֶחָד
5: And God called the light day, and the darkness He called night, and it was evening and it was morning, one day.

My interpretation: And God called the light (of the sun hitting planet Earth) day, and the darkness (on earth) He called night, and it was evening and it was morning (the earth's first stable rotation, with the sun and moon) marked one stage of God's creating.
At the End of Day 1, Earth, the Sun and Moon are all formed, and the Earth is Covered in Water.
Current Scientific Theory: As the planet cooled, clouds formed. Rain created the oceans. Recent evidence suggests the oceans may have begun forming as early as 4.4 Ga.^
The detrital zircon crystals dated to 4.4 Ga show evidence of having undergone contact with liquid water, considered as proof that the planet already had oceans or seas at that time.^ This requires the presence of an atmosphere.^
It is now believed that the Hadean surface was solid, temperate, and water covered.^ Earth hosted a similar mass of continental crust as the present day at 4.5-4.4 billion years.
As the output of the Sun was only 70% of the current amount, significant amounts of greenhouse gas in the atmosphere most likely prevented the surface water from freezing. Volcanic activity was intense and, without an ozone layer to hinder its entry, ultraviolet radiation flooded the surface.

:ז) וַיַּעַשׂ אֱ־לֹהִים אֶת הָרָקִיעַ וַיַּבְדֵּל בֵּין הַמַּיִם
אֲשֶׁר מִתַּחַת לָרָקִיעַ וּבֵין הַמַּיִם אֲשֶׁר מֵעַל לָרָקִיעַ
וַיְהִי כֵן
7: And God made the expanse and it separated between the water that was below the expanse and the water that was above the expanse, and it was so.

My interpretation: And God said, "Let there be strengthened a metallic-canopy (surrounding earth, in space) in the midst of the water-(covered Earth), and let it be a separation between water (on earth) and water (in the atmosphere)."
The passage states that there is a solid dome encircling earth, but "since [the commentators saw] there is no solid dome encircling the earth, ...[they] say this refers to the atmosphere that encircles the world" (Artscroll).
However, today, we know of a "solid" dome encircling earth, that separated the water on earth from the being lost to space, Earth's magnetic field, without which, we wouldn't have the atmosphere. More so, the word expanse (רקיע - ra-keeya) contains an allusion to its metal nature, its Hebrew root (רקע - ro-kah) is the act of beating metal into thin plates.^
Current Scientific Theory: By 3.5 billion years ago, Earth's metallic core established a magnetic field, which prevents the atmosphere from being stripped away by the solar wind.^
Without the magnetic field, Earth could have lost almost all of its water to space,^ like mars did.^
Both water and a protective magnetic field are essential to the development of life on Earth as we know it.^
By 3.5 billion years ago, the Earth's magnetic field was established. The solar wind flux was about 100 times the value of the modern Sun, so the presence of the magnetic field helped prevent the planet's atmosphere from being stripped away, which is what likely happened to the atmosphere of Mars. However, the field strength was lower than at present and the magnetosphere was about half the modern radius.^

:ח) וַיִּקְרָא אֱ־לֹהִים לָרָקִיעַ שָׁמָיִם וַיְהִי עֶרֶב וַיְהִי בֹקֶר יוֹם שֵׁנִי
8: And God called the expanse Heaven, and it was evening, and it was morning, a second day.

My interpretation: God now says the word "space" now refers to the atmosphere surrounding Earth, and it was a second stage of God's creating.
Current Scientific Theory: Earth is covered in water and the atmosphere is formed. It's possible the early earth was entirely covered with a cloudy atmosphere.
"When we think about the origin of life, there are two threads to follow," says geophysicist John Tarduno. "One obviously is water. But you also have to have a magnetic field, because that protects the atmosphere from erosion and the complete removal of water."^

Sikpping to Passage 11 to discuss evolution.

יא) וַיֹּאמֶר אֱ־לֹהִים תַּדְשֵׁא הָאָרֶץ דֶּשֶׁא עֵשֶׂב מַזְרִיעַ
זֶרַע עֵץ פְּרִי עֹשֶׂה פְּרִי לְמִינוֹ אֲשֶׁר זַרְעוֹ בוֹ עַל הָאָרֶץ
:וַיְהִי כֵן
11: And God said, "Let the earth sprout vegetation, seed yielding herbs and fruit trees producing fruit according to its kind in which its seed is found, on the earth," and it was so.

My interpretation: And God said "Let the it evolve from and be covered, the earth, with a covering (mat) of "individual-grassy-plant-life", 'reproducing-seed-cells' that produce 'seed-cell-offspring' (that grow within the parent); a "tree" (of) fruit, which forms fruits, into many species that will have its' seed-cell-offspring within itself on the land; and it was so.

The Ibn Ezra says that the "earth use[s] its inherent power", meaning
that life came from a natural force that the earth has.
Rashi says "all products of heaven and earth were actually created from the first day and required only to be brought forth."

Current Scientific Theory:
The Earth naturally evolved mats of oxygen-producing "cyanobacteria", a photosynthetic, self-replicating cell, similar to prokaryotes (from the greek "karyon" for nut, hence seed or nucleus). They can grow individually, end-to-end in grass-like strands, branching-strands, or cluster into hollow balls.
And larger self-replicating photosynthetic-eukaryotic cells that have their genetic material within a nucleus, within itself.
In the strictly modern sense, the name plant refers to the biological classification kingdom Plantae. However, other photosynthetic organisms, including protists, green algae, and cyanobacteria have evolutionary significance to modern plants. These other organisms provide clues to the evolution of all photosynthetic organisms. All of these organisms - plants, green algae, and the protists - are primary photosynthetic eukaryotic organisms.^
Scientists start the search for fossil evidence of plants with indirect evidence for their presence, the evidence of photosynthesis in the geological record. The evidence for photosynthesis in the rock record is varied, but primary evidence comes from around 3 billion years ago, in rock records and fossil evidence of cyanobacteria, photosynthesizing prokaryotic organisms.^
According to endosymbiotic theory, "chloroplasts", the photosynthetic cells within plant-leaves and algae have evolved from cyanobacterial ancestors via endosymbiosis (one organism taking another within itself).^
'Stromatolites' of fossiled mats of oxygen-producing "cyanobacteria" have been found from 2.8 billion years ago, possibly as old as 3.5 billion years ago.^ The presence of biomarkers called 'steranes' in Australian shales indicates that eukaryotes were present 2.7 billion years ago.^ Current phylogenetic evidence suggests that the last universal common ancestor lived during the early Archean eon, perhaps roughly 3.5 Ga or earlier.^
Multicellularity first appeared in cyanobacteria. Cyanobacteria is a large and varied group of bacteria which possess chlorophyll a and which carry out photosynthesis in the presence of light and air with concomitant production of oxygen. Various patterns of cell organization exist, ranging from single-celled to differentiated multicellular forms with branching patterns.^
Comment: Are the sun, moon, and stars "set in" the Earth's magnetic field?
Comment: +50, this is amazing.
Comment: Been a while since I did this so I'll have to look up the source, but I think it's Rambam who says that the "Rakea-Hashamayim" in passuk 14-17, is distinct from "Rakea" in earlier passukim. He says this because the "Rakea" in passuk 7 is re-named "Shamayim" in passuk 8.
Comment: (Also on Rakea, from my notes on passukim 14-17: the Ibn Ezra says that in passuk 15 the luminaries became visible in the sky. -- Theoretical models of the Sun's development suggest that 3.8 to 2.5 billion years ago, during the Archean period, the Sun was only about 75% as bright as it is today.[^](http://en.wikipedia.org/wiki/Sun#Faint_young_Sun_problem)
Comment: ... 2.4ga The sun output visibly increases, and the atmospheric composition changed to be oxygen rich, from photosynthesis. It's hypothesized that until this point, the earth was completely covered in clouds.The natural evolution of the Sun made it progressively more luminous during the Archaean and Proterozoic eons; the Sun's luminosity increases 6% every billion years. As a result, the Earth began to receive more heat from the Sun in the Proterozoic eon.[^](http://en.wikipedia.org/wiki/History_of_the_Earth#Snowball_Earth_and_the_origin_of_the_ozone_layer) )
Comment: This may sound silly because I'm not so knowledgeable in science...You say וַיְהִי אוֹר refers to the _photon epoch_. But then you say that when G-d separated between light and darkness, that included the creation of the sun, which was formed from a _molecular cloud_. Yet I would think that the "light" here should have something to do with the previous "light" of the photon epoch.
Answer: The answer is, at the heart, there is broad consensus among the Rishonim that when necessary one may depart from the "literal"  meaning (apparent intent, peshat) of the Torah text (though even then there are limits).
We are left with a few things to work out:

How do we define necessary?
Does our difficulty rise to the level of "necessary"?
Does departing from the "literal" meaning result in asserting beliefs which are mutually exclusive with fundamental Jewish beliefs (i.e. is it heresy)?
And perhaps, Who gets to determine whether the "necessary" threshold has been reached.

Chazal say "אֵין מִקְרָא יוֹצֵא מִידֵי פְּשׁוּטוֹ", a verse doesn't depart from it's plain/apparent meaning" (Yevamos 24a, etc) Contrary to the assertion of some there is no basis to argue that this principle is limited to halachic texts, and a vast array of meforshim cite it or allude to it in the commentaries on the Torah. Midrashic meanings (and so forth) are additional implications of the Torah which do not negate the peshat.
I have seen it argued that Bereshis doesn't have a peshat, while I think this deserves more research on my part it seems less than compelling. Indeed in addressing a hypothetical allegorization of Bereshis Rav Saadia Goan objects

The result of the application of such a method of interpretation
  would be that there would not be an item left of the entire story of
  the creation that would not have been divested of its literal
  meaning, which is the creation and origination of things. (The Book
  of Beliefs and Opinions, Yale, page 425).

(It is an interesting phenomenon when people take midrashim about the universe being ancient (etc.) literally, while taking the "literal" peshat of the Chumash non-literally.)
Rav Saadiah Gaon writes,

We, the congregation of Israelites, accept in its literal sense and
  its universally recognized meaning whatever is recorded in the
  books of God and have been transmitted to us (The Book of Beliefs
  and Opinions, Yale page 415).

Nevertheless he concedes that under certain circumstances on may, out of necessity, turn aside from the literal meaning of the text. For our discussion the most relevant reason to depart from the peshat is when it conflicts with our own observations (Emunos v'Deos 7:2).
The Gaon's language strongly suggest to me that he requires demonstrative (deductive) proof to justify departing from the peshat.
For the Rambam the simple meaning can be exchanged when doing so produces a better picture but not otherwise:

A mere argument in favour of a certain theory is not sufficient
  reason for rejecting the literal meaning of a biblical text, and
  explaining it figuratively, when the opposite theory can be supported
  by an equally good argument. (Guide to the Perplexed, Yale, page 199)

The Rashba (Chidushei HaRashba, Perushei HaHagados on Bava Basra 74:b) seems to take a pretty liberal attitude about allegorical interpretation of the Torah text when confronted with difficulty. On the other hand he is more expansive in his definition of when such interpretation isn't possible at all. While according to Saadia Gaon and the Rambam the rejection of fundamental principles would prevent one from adopting a non-literal approach (to simplify the issue a bit) the Rashba limits such interpretations whenever there is a conflict with an accepted/received tradition on an issue.
Sof kol Sof, there is basis when needed to interpret scripture contrary to its simple meaning but one must do so with caution. It is not appropriate to dismiss the literal meaning lightly as if there is no issue.
The terms עֶרֶב and בקֶר (evening and morning) suggests to me that the Torah means "day" in the normal sense and Chagigah 12a lists the length of day and night as among that which was created on the first day.
Additionally we have the Gemara: "R. Yehoshua ben Levi said: All creatures of the creation were brought into being with their full stature, their full capacities, and their full beauty" (Rosh Hashanah 11a). Regarding this the Rambam wrote, "Note this likewise, for it includes a principle fully established" (Guide 2:30, page 216). This Chazal suggests a straightforward understanding of the Creation account. To me, however, this highlights an approach on how to come to terms with the conflict between science and B'reshis.
When we speak of age we think of it in terms of the passage of time. When we are discussing the age of the Universe in a scientific sense, however, our calculations are not based on observing a clock, but on physical characteristics resulting from age. Our measurements are not direct, they are by inference albeit strong enough to be compelling under normal circumstances.
The problem is that Creation ex nihilo, יש מעין, isn't normal circumstances. If one were to look at the creatures described in B'reshis, which R. Yehoshua ben Levi called in "full stature" we rightly assume based on their physical characteristics that they had achieved a certain "age" even though they were moments old.  While the Gemara in Rosh Hashannah discusses biological creation, the same could be inferred about any physical phenomenon in Creation. There is simply no way for something to be created from nothing while lacking characteristics we would associate with prior existence in any potential universe which would operate similar to ours.
To reject the literal meaning of the text based on apparent age prior to creation is to reject it based on phenomenon we would/should expect based on that very text, to deny it because of observations implicit within in. In other words, it is essentially rejecting creation ex nihilo of Gan Eden a priori. (This is not to argue that one has reason to accept the creation account, that is a different issue, and in this context I assume we are taking for granted that Hashem gave the Torah. Rather I am simply arguing that this conflict isn't sufficient reason to doubt that Hashem gave the Torah).
Once apparent age is a factor, it does not seem to me to be a stretch to assume that the Creator would align such apparent age to conform with the rules He made for the Universe to operate (science/teva) even though He chose to create it via supernatural means.
Many object that this is deceptive. It is certainly no more deceptive that creating the world one way and then telling us (in the Torah) it was done an entirely other way without any indication that the account is allegorical/metaphorical etc. Nor is it any more deceptive than creating the world in such a way that it can be understood as happened through random chance and the blind forces of nature.
The truth is it is not deceptive because Hashem has revealed to us in His Torah how He created the world, and as we have argued, that account implicitly accounts for prior age anyways.
At the same time, it does provide an alternative (although not a better alternative) way to account for the existence of the Universe. This is an essential ingredient for fully free will in an era when we have a clearer understanding of scientific principles. If there were no way to at least plausibly explain the worlds existence without resort to a supernatural Creation six thousand years ago free will would be hindered (albeit not destroyed). This is, after all, the paradox of nature. On the one hand revealing God as the Creator, the Master of the Mansion, on the other hand concealing Him to allow for free will (remember that the root of עולם, universe, is עלם, conceal/hide). Man may choose to draw incorrect conclusions but.."'Write,' replied He; 'whoever wishes to err may err.'" (Genesis Rabbah, VIII.8, p. 59. (Soncino Midrash Rabbah).
With the possibility to understand the conflict as not a true contradiction the justification to reject the peshat/plain meaning is not clear. I'm not going to argue, personally, that it is not permissible but it is not the "דבר פשוט" it is often made out to be (no pun intended).
There is still more to be said on this but to do full justice is a much larger project, here are some links which explore these issues a little more:

http://machzikeihadas.blogspot.com/2008/09/what-problem.html
http://machzikeihadas.blogspot.com/2008/10/guiding-principals-guide-for-perplexed.html
http://machzikeihadas.blogspot.com/2008/10/parshas-breishis-in-beginning-brias.html
http://machzikeihadas.blogspot.com/2008/10/parshas-noach-evidence-for-global-flood.html
http://machzikeihadas.blogspot.com/2008/10/here-gosse-nothing.html
http://machzikeihadas.blogspot.com/2009/04/critique-of-rabbi-jeremy-weiders-when.html
http://machzikeihadas.blogspot.com/2009/11/retroactive-retraction.html
Comment: By the way, if you claim, when you're done, to have produced the definitive answer to the question, don't expect to collect 50,000 points. I'll just plead "asmachta lo kanya." :)
Comment: Great foundation-laying! I'm looking forward to the rest of your analysis.
Comment: I claimed to have the definitive answer before I even started, I think pressed hard enough everyone will agree with my initial sentence. I'll happily settle for 25k :)
Comment: Interesting. However, it doesn't account for the fact that we have dinosaur fossils, and other fossils of extinct species that existed well before 6,000 years ago. Their existence makes no sense according to this approach.
Comment: `It is an interesting phenomenon when people take midrashim about the universe being ancient (etc.) literally, while taking the "literal" peshat of the Chumash non-literally.` Actually it is perfectly understandable, as Midrashim tend to interpret Scripture in a manner contrary to the simple meaning of the text. Accordingly one either maintains the simple reading of the text and interprets the Midrash non-literally, or vice-versa.
Answer: Remember that Science isn't a be-all and end-all. If one looked at a tree on day 5, for example, it would have rings. According to science, it could be 100 years old, but still really be two days old. The world could have been created looking 14 billion years old.
Comment: Do you have any sources for this view?  This answer also, may be theologically comforting but difficult philosophically, as one could argue the same about a year ago, yesterday or one moment ago.  Without any treatment of reality as having continuity, all time becomes meaningless.
Comment: All the animals were created as adults.

In general you would be right. In general we go after our senses, but that is only because the Torah says to do so (like it says "a farmer believes and plants", that if he didn't believe, how would he know that his plants would grow?) It is also similar to the idea that "How do we know that the sun would rise tomorrow? From "Yom Valayla lo Yashvosu". All the more so in the past.
Comment: What does it even mean then to be two days old, if you have _exactly_ the same properties as a 100 year old?
Comment: look at Omphalos by Philip Henry Gosse and Slifkin's the Challenge of Creation.
Comment: In the interest of pedantry, scientists do not believe the Earth is 14 billion years old, but rather the universe. The Earth itself is believed to be 4.54 billion years old - http://en.wikipedia.org/wiki/Age_of_the_Earth
Answer: I don't think there is a definitive answer but I'll give you my short version.

Our sages have long said that the story of creation is not to be considered literal but to give mankind an understanding of our position in the world and that we owe our existence to G-d.  Beyond that, the rest is up to lots of explanation and is considered to be part of the "Sod" or hidden elements of the Torah.
One example of explanations that were given hundreds of years before science came up with the "Big Bang":  The Ramban (if I recall correctly it was him) on his explanation of the Torah says regarding creation, that there was only one act of creation of something from nothing and all the rest of creation was created from that initial creation.   He compares that initial creation to a particle the size of a mustard seed.  Perhaps the smallest size particle he could conceive of in his time.   Amazing Stuff.
The above example, and a lot of what I can continue to say on the topic I learned from an excellent book that I highly recommend on the topic: "Genesis and the Big Bang: The Discovery Of Harmony Between Modern Science And The Bible" by Dr. Gerald Schroeder" Amazon Link
It has only been in the past generation that some of our more right wing rabbis have started to say that if you don't believe that the world was created in 7 days as we know it today then you are a heretic...   They are just trying to keep pace with their zealous Christian counterparts and should be ignored because there is plenty written to the contrary before them.
Comment: @Yirmeyahu: Just the opposite: Catholics are quite open to evolution and modern cosmology -- they are not fundamentalist at all. I assume you are confusing Catholics with certain modern fundamentalist Protestant groups.
Comment: Catholics are not known for zealously adhering to the literal meaning of the text.
Comment: @Curiouser -- The text was revised (and not by the author) just prior to your comment and long after mine, it originally said Catholic rather than Christian.
Answer: I would recommend you some books elucidating the Jewish conception of these topics.
a) The Science of Torah: The Reflection of Torah in the Laws of Science, the Creation of the Universe and the Development of Life, by Nosson Slifkin
This book deals with an examining of the relationship between Torah and the natural world. It's pretty good.
b) In the Beginning: Biblical Creation and Science by Nathan Aviezer. Also see from the same author Fossils and Faith: Understanding Torah and Science
The author by citing chazal harmonize the opening verses of Genesis with modern science. A must read book.
c) Genesis and the Big Bang: The Discovery Of Harmony Between Modern Science And The Bible by Gerald Schroeder
The physicist Gerald Schroeder introduce jewish and scientific insights helping to bridge the gap between science and the Torah in a very knowledgeable way.
d) Torah, Chazal & Science, by Rabbi Moshe Meiselman
An overview on Masorah and Science showing how amazing integration are between them. An interesting food for thought.
d) Kabbalah and the Age of the Universe Paperback by Aryeh Kaplan
An examination of the age of the universe as discussed in Kabbalistic works. Worthwhile reading.
I hope this helps you in some way
Comment: I would highly recommend The Challenge of Creation also by Rav Slifkin — what I think to be one of the best treatments of these issues.
Comment: Consider summarising the points from these works that address the question.
Answer: Here is a list of roughly 6 approaches in Jewish Thought to the question of scientific theories of origin (Big Bang Theory, Inflation, Geology, Evolution, etc...) and the Torah's depiction of creation. I am certain there are others I haven't encountered.
1) Rejection of scientific conclusions.
Theories change over time. Rather than worry about a contradiction between current theory and the Torah, one can simply wait without concern as science slowly converges to the Torah's truth.
After all, in the last century theory has gone from Aristotle's eternal universe to acknowledging that it has a beginning. Compared to that, current difference are small.
This is the basic approach taken by R' Avigdor Miller.
2) History as a backdrop.
As one opinion in the Gemara has it, Adam was created as a fully mature man of 20, and trees were created fully grown, etc… The Lubavitcher Rebbe zt"l concludes that this opinion would hold that the universe as a whole was formed with a history consistent with a natural, scientific, progression.
One may then ask why Hashem chose to create a world that has an artificial age. Or perhaps not: Can one understand why G-d chooses to do anything?
Personally, I have a different problem with this position. How does one ascribe a time to creation? It can't be on the Creator's clock, since He Exists outside of time. Therefor, when we speak of "when" creation happened, we mean the beginning of the universe's timeline. So then how could we talk about G-d creating the universe at some point in the middle of the line, allowing history to go in both directions — past and future — from that point?
Note about the previous two answers:As far as I can tell, it seems that an insistence on the Torah giving literal history with it being roughly 5,769 years since ex nihilo, became more popular after the scientific challenges of the past two centuries, not less. As though we dug in our heels in the face of so many rejecting the Torah for a blind acceptance of the zeitgeist and the importance it gives scientific research.
3) Conflict resolution.
As suggested by Rabbi Yaakov "Gerald" Shroeder, invoking relativity or whatnot to show that 15 billion years can be 5758 years in another frame of reference. Perhaps relativity justifies the differences between frames of reference. The "birds" of day 5 are actually dinosaurs, which are most similar biologically to birds of any thing living today. Creation of the sun on day 4 is actually about the sky clearing to the point the sun could be seen on earth, etc…
As can be seen from my treatment, I don't consider this opinion fair to either the Torah or the scientific data. Yet, many popular books have come out in the past two years promoting this kind of position. Perhaps someone else can do it justice.
[The next two paragraphs are minor paraphrases of material R' Gil Student wrote for his Hirhurim blog.]
On the other hand, however Bereishis 1 is understood, there is a poetry to the idea. In Collected Writings VII pp 363-264, R' Samson Raphael Hirsch rejects an insistence on literalism, common to both of the previous approaches, and waxes poetic about the greater display of Divine Wisdom a natural unfolding would suggest. Similarly, Rav Kook makes the same point in Orot haQodesh 91.
R. Menahem Kasher, in Torah Shelemah (Bereshis, ch. no. 738), quotes a responsum from the Geonim in which it is stated that Adam was first created as a speechless creature, like an animal, and only later was given speech. This could certainly be interpreted as a precedent for the claim that Adam was descended from humanoids. R. Kasher suggests that this is a matter of dispute between the Ramban and his student R. Bahya ben Asher, with the Ramban on the side of the Gaon's responsum. In his Hibah Yeseirah (Bereshis 1:26, printed in the back of Bnei Banim vol. 2), R. Henkin writes explicitly that Adam's body was taken from creatures that preceded him and it was only his soul that was created ex nihilo. In other words, Adam evolved from lower creatures and became human when God created and implanted in him a human soul.
4) Multiple creation times.
This is the approach of the Tif'eres Yisrael. He cites an opinion of taanaim and Rabbi Avohu (Qoheles Rabba 3:14.1), that Hashem created worlds and destroyed them before this one. Dinosaur bones and starlight are legacies of these earlier worlds. The Tif'eres Yisrael did not say anything about evolution, just that this earlier time explains what the fossils are fossils of. In Techeiles Mordechai, R' Shalom Mordechai Schwadron speaks laudably of the Tif'eres Yisrael's resolution.
In Gen 1:1, G-d creates ex nihilo (matter from nothing). Then, before verse 2, these other worlds (in this opinion, epochs) rose and fell. Then, there was "chaos and emptiness" from which our world emerged. The universe as a whole, even the planet, can therefor be older than 5758 years.
Since current theory is that the world started as a singularity — IOW, not within the purview of science, it is all a matter of faith if the ex nihilo was with the intent of the Creator or not.
Rabbi Aryeh Kaplan quotes R' Yitzchaq meiAkko (a student of the Ramban) who concludes from the Zohar that the first creation was 15.8 billion years ago — the age astronomers and physicists seemed to be converging on in the 1980s and 1990s, given multiple ways of measuring the age. It is unclear that this is truly the intent of R' Yitzchaq meiAkko, but that's Rabbi Kaplan's take. The original lecture to AOJS, which is more complete and persuasive than the mention in his NCSY book, is available on line. This is built on an idea discussed by Rabbeinu Bachya and numerous other kabbalistically inclined rishonim, that of our world being one of a cycle of shemittos, so that there is history and time before our universe.
5) Rejection of a literal read of the Torah.
This is much easier, halachically, than it sounds, as there is a long tradition, including the Rambam and the Vilna Gaon, teaching that Genesis 1&2 actually convey deeper truths via metaphor. The gemara, after all, limits the number of students (to 2) that one may teach the secrets of the Act of Creation — so clearly we can't just take the text at face value.
Another commonly cited proof for non-literalness is that the word "day" precedes the creation of the sun. Therefor, it can't be used, at least in this narrative, to mean our 24 hour period.
The Rambam takes "day" to mean a stage in the causal chain, not a reference to time altogether. See The Rambam on Time During Creation.)
6) Creation is so alien to human experience that we don't have a comparison for it.
The Maharal (intro to Gevuros Hashem) is of this opinion. Therefore prophecy, which is transmitted by visions, cannot describe it. (The World to Come is similarly explained. This is why it only appears in Tanach as "your days will be prolonged". Continued existence we can understand. The rest of the details, no.)
However, creation is also so alien that we can not understand it by extrapolation, either. In general, the Talmud teaches that "wisdom is greater than prophecy". The Maharal explains that this is because the power of extrapolation and deduction takes you further than just what can be presented metaphorically in visions. In this case, though, creation is beyond wisdom as well — which is why the Talmud limits the forum where it can be studied.
The Maharal's conclusion is that the Torah can't provide us with a comprehensible history AND that science must be wrong.
R' Dessler (vol. II) ascribes a similar opinion to the Ramban, at least with regard to time during creation. That the days of creation were both literal days of seconds, minutes and hours, but also the subsequence six millenia. Not that they represent or parallel the subsequent millenia, but they are literally the millenia themselves. These two perspectives appear to contradict, but only because of limitations of how humans perceive time ever since eating from the tree of knowledge. (A longer description of Rav Dessler's opinion can be found at Rav Dessler's Approach to Creation.)
In the two last opinions, the presumption must be that Genesis 1 and 2 teach some deeper truths about reality. Either because that's the only meaning of the text, or because all we can understand from the text are partial truths that don't quite add up to a whole picture. In either case, without having a metaphor, there would be little reason for its inclusion in the Torah.
The Maharal explains some of the symbolism of the number 7 later in Gevuros Hashem. The seventh should be made holy even without the creation story, so it is possible the details of the story are made to describe this point.
One can also see a pattern: light, sky-and-sea, earth; repeated twice. First Hashem created light. On day four, He created the stars, moon and sun — the sources of light. Second, He separated sky from the sea. On day 5, He created those who live in the sky and the sea — the birds and the fish. Third, Hashem made the seas converge to show land. On day six, the animals and people inhabited the land.
What is important to us as Jews is not what actually happened, that is, whether G-d used natural or miraculous means to create the universe. Rather, to take the lessons of creation, or the lessons encoded into the story of creation, and live them.
Comment: My own preferences lay toward the end of this list. After all no.s 5 and 6 only differ in whether hypothetically Bereishis 1 has literal meaning that is beyond human understanding or is pure allegory. In either case, the only accessible meaning is an allegorical one. And the first two... I am not sure there was ANY rishon who believed in a young universe. (Maybe the Rambam, but then he didn't take Bereishis 1 literally anyway...)
Comment: First approach makes zero sense! Yes science does evolve much like any other academic subject e.g. medicine and biology etc. Does it make sense to say that Doctors are not trustworthy because they are constantly changing their minds. An emphatic No! Trial and error is the way we humans advance in any field. At the same time the core ideas of medicine are not subject to change, but are certain and rest on solid ground. Same thing goes for science, core ideas of geology are not subject to change and have been proven many times over.
Comment: So to say that eventually geologists will come back and admit that the world is only 6000 years old like the Torah seems to say, is utter stupidity and most irrational approach to resolve the problem of Torah and science.
Comment: @Bach - I believe RAMiller's point doesn't require saying the geologist is not trustworthy. Just that one has enough faith in one's understanding of the Torah to expect that this is one of the elements of geology that will evaporate as the discipline refines its theories.
Comment: You are bit vague here. In any case, you might want to rephrase that approach.
Answer: I'm going to try and give a brief direction or method rather than an answer.
First step - understand the science well.  That is, not just what the theories said, but how well founded they are, what assumptions they make, what is proven, what is assumed, the historical developments of those theories, etc.
Second step - understand the Chumash well.  That is to say, not just a general understanding of the story, but a detailed, as deep as possible understanding including the various themes of the story, the grammar and meaning  of different words and phrases, the various readings of the Rishonim and Achronim (i.e., Rashi, Ibn Ezra, Ramban, Rambam, Malbim, Rav Hirsch, Netziv, etc.), etc.
Third step - note those areas where science and Torah agrees and those where they disagree.  For instance, the Big Bang theory works well with the first pasuk, the Cambrian Explosion works well with aspects of the 5th day (although not necessarily with all aspects), etc.  The age of the universe  is obviously an example an area of disagreement.
Fourth step - determine  whether or not the areas of disagreement are well founded -- is the scientific theory in question well established enough to warrant worrying about it.
Fifth step - if the theory seems well established try and see if an honest interpretation is possible from your understanding of the pasukim.  At the same time, note other serious attempts by those who are qualified to deal with the contradiction (both those who seek to reconcile the science with the Torah and those who argue that the challenge is not a serious challenge).
Sixth step - if you can't find an answer, be patient - not all questions can be answered at any given moment in time.
Answer: I once heard HaRav Aharon Lopiansky quote the following from HaRav Aharon Lichtenstein Zt"l:

המתחתן עם הדור הזה מתאלמן מן הדור הבא

or, in less-poetic English,

One who marries this generation becomes widowed from the next generation.

In other words, Creation was something that happened a rather long time ago, it's cryptic and unclear exactly what happened, and we could certainly find a way to explain everything away to fit with current scientific consensus, as has been done many times with different issues throughout history. However, tomorrow, or decades from now, science may make new discoveries and change their minds. This is nothing wrong with science; science is a process of discovery. But we will have tied down the Torah to this now outdated explanation, while Science has marched on without us, and we'll be left without Science and without Torah.
So how does Torah deal with the differences between scientific evidence and Bereishis? Tentatively. We accept that we don't really understand Creation, and rest our faith on the multitude of other parts of Torah that we see the truth of. Torah does not need to be definitively reconciled - we aren't basing our belief on fitting with science's current view.
Comment: "science will make new discoveries and change their minds" I think you mean to say "science might make new discoveries and change their minds". The key here is not to say that the Torah definitely means [what modern science says], just that it totally could. We don't know if science will sharpen and improve its guesses, and it might not, but that's not a problem if we're not tied down. Science is still our current best estimation as to what Creation was like physically.
Comment: @DoubleAA Agreed to your will vs. might point. Re your second point, that was my point - we tentatively make suggestions of what it _could_ mean, but we don't determine what it _does_ mean.
Answer: (As Joe already began in this direction)
From the verse at Bereshis 2:1, the Talmud (Chullin 60a) says that

כל מעשה בראשית בקומתם נבראו וכוי

"All the Genesis' action were created in their height [=adult state]": all the creatures began their life like immediately efficient adults. Adam was looking a 20-years old man, a cow was looking 3 years old as Rashi (ibid) points out:

והיינו שור פר ביום שהיה שור היה גדול כפר שור בן יומו קרוי שור כדכתיב שור כי יולד פר עד שלש שנים

So, if mature state for a man is looking like 20 years old, for a cow is 3, we can say mature state for the Earth is looking like billions years old.
(Maybe if there was more carbon14 than now, it would be toxic...)
Answer: I'm afraid the question is a non-starter.
according to Bereishis the world along with time/space and all the laws of physics and everything else we consider "logical" was created miraculously from absolutely nothing by an infinite Being.
science tries to stretch its neck out as far as it can using the current system of logic/physical laws to try to peer out into what is eternal and hence infinite and hence beyond the realm of science.
The Rambam expressed this dilemma as follows (found this in Marpe Lenefesh commentary to Shaar Yichud end of ch.6 in this dafyomireview.com article):

"The Rambam in Moreh Nevuchim, part 2 chapter 17 brings a very powerful analogy against the heretics who believe in kadmus (that the world existed eternally), and he said that all of their proofs and logic are only from the nature which exists in the world after the Creator has already created them in perfect form from all angles as they are now, and how can we possibly bring a proof from this as to how it was before it was created and brought to existence from nothing: "the analogy of this is to a child who was born in a deserted island, and then his mother died, and this orphan never saw a female. When he grew up and matured intellectually, he asked his father how a man was formed. His father answered him 'each person among us, came to be and was formed in the belly of a female, who is of our kind, like us, of such and such form, and the man was in her belly, small, and his body was closed. And he grew there slowly, slowly for fixed months until the time he was forced to go out from her belly through an opening which opened for him. Afterwards he grew until he became big in his limbs, senses, and intellect, as you see now.
  The orphan started to deny all of this, and built proofs against all these true things, saying that "they are impossible and are lies, because how is it conceivable that a live man can breathe through his nostrils inside a container which is closed on all sides, and it appears impossible that one cannot live for any time without breathing, or if one cannot excrete the waste of his food, he will die a painful death, and how could his mouth be shut and his navel open, and his eyes closed and his limbs constricted together for such a long time, and when he comes out of there, all of his limbs and his eyes should be complete". This is a clear proof that the formation of man could not have occurred in this way, even though it is truly so."

The Rambam ends off:

"contemplate this analogy and test it, and you will find the two matters to be identical, and that we are of these who pursue Moshe Rabeinu, peace be unto him, and Avraham avinu, we believe the world came to be in such and such a way, and it was such and such, and it was created such and such, and afterwards Aristotle came to refute our words, and he brought proofs from the laws of this nature, which are complete and with us, here in the present, but which are not comparable to what existed at the time of creation, for this was after absolute non-existence..."

ADDITION: The Big Bang theory is really just a form Aristotle's view that the universe always existed, since a thing cannot make itself (Shaar Yichud), either it existed previously in a different form or an eternal Being created it. Since science rules out the latter, then according to science it must be that it always existed in some form.
Therefore, either you accept the world was created by God in which case the world was created miraculously and there is no need to reconcile anything with science.
Or the world always existed and there is no God, ch''v, and therefore the Torah view which speaks of a miraculous creation is irrelevant. Either way the question is a non-starter.
Comment: Science doesn't know what happened before a fraction of a second after the big bang. The equations just go to infinity and are useless. There are some speculations (some of which imply an eternal universe and [some of which don't](http://en.wikipedia.org/wiki/Hartle%E2%80%93Hawking_state)) but they are just that: speculations. This question asks about everything that happened in between then and now, events about which science does say something definitive about.
Comment: That's like saying that since you don't know what happened on January 28, 1800, we shouldn't trust you about anything that happened on January 28, 2013 because clearly your memory is suspect. In any event, if that is your essential argument then it should be included in the answer, not down here in the comments.
Comment: This question isn't about the existence of a Prime Mover Whom you call God! It's about what happened over the last ~15 billion years. If what you learned from the shaar yichud is that God must exist and that's your point in this answer, then it does not answer the question at all.
Comment: I wish I could downvote again after your edits. I specifically showed you a link to a theory which breaks your false dichotomy, so I protest your misuse of my (user)name. Besides that, your logic is still sorely lacking (see above comments). And as I pointed out in your answer [here](http://goo.gl/OHQD6), YOU STILL NEED TO RECONCILE. If you want to do so with the Omphalos Hypothesis, fine. But it is a reconciliation. Claiming there is no question is like being blind. (Did you really just question the scientific method in your comment above? And you do so on the _internet_? So oblivious...)
Comment: the question was about the beginning of the world. not what happened after beginning
Comment: It's about everything that happened between time=0 to 5763 years ago. Whether that is 6 days or more is subject to the discussions above. That's why it mentions the "account(s) of Creation".
Comment: (The link you ignored above is [this link](http://en.wikipedia.org/wiki/Hartle%E2%80%93Hawking_state) in my second comment above.) I'm not sure what you're telling me about the Omphalos hypothesis. You seem to be agreeing that humans are fully justified in treating the world as billions of years old when trying to understand how the world works.
Comment: "science rules out the latter" is ["not even wrong"](https://en.wikipedia.org/wiki/Not_even_wrong). Science is a process of apprehending reality using evidence, not some monolithic position-holding entity. And plenty of scientists say, as @DoubleAA did, above, that it's essentially impossible for science to even figure out what preceded/caused the Big Bang, much less hold a unanimous position about it. You seem to be assuming that evidence-based inquiry would have to conclude against the Creation by the Borei Olam, which seems an unfortunate position for a religious person to hold.
Comment: Not sure how this is relevant. Science no longer claims an eternal universe, or at least, it makes no claims about what if anything preceded the big bang.
Comment: science claims the big bang happened through scientific means. either an oscilating universe like Einstein was looking for. which expands and contracts then Big bangs again infinitely. or some interdimensional black hole which exploded. whatever it is, they see the big bang as a scientific evident, which is in essence an eternal universe. you hear?
Comment: thank you Doubleaa, but according to the shaar yichud a thing cannot make itself. so if science cannot explain what happened before the big bang, then its entire approach is suspect and it cannot be compared to the torah's account which fully explains everything.
Comment: not that you dont remember. you have no possible way to answer in your scientific paradigm. the answer is beyond the realm of science. what I learned from shaar yichud is that the existence of God is not an option - it's a necessity. it is impossible otherwise. check it out
Comment: sorry but i believe i answered your link. even if something does not exist actually but exists in POTENTIAL that also cannot happen by itself. see shaar yichud ch.5 http://dafyomireview.com/article.php?docid=398#ch5 where it says proof of first premise (and the Tov Halevanon commentary on "efes v'ofes")
Comment: i.e. your link on Omphalos hypothesis. as for what i said b4, i dont see any contradiction. there i was referring to a miraculous creation, where God can do whatever he wants. including making stars light years away to give free will to those who want to deny Him. But He still leaves a gaping hole mystery for those who want the real truth
Answer: As the Rambam says in Hilchos Teshuva, free will is the great primary pillar of the torah. Thus, part of the creation is that there needs to be a possibility of explaining the world through nature.
Answer: Attempts  to "reconcile this 7 day creation story with evolution, geological and cosmological evidence  of the age of the universe are absurd, requiring a twisting of the words of the text in ways they never remotely meant". "Of course the Biblical picture is not a factual, literal account of the universe's  origin. The evidence to this effect is overwhelming". (Commentary on the Torah with a New English Translation by Richard E, Friedman 2001  Page 14)}
Comment: Actually the other answers to this question are much better. The author you cite is a follower of the Wellhausen "Documentary" mythology and does not know what he is talking about.
Answer: I would like to address some points not covered by existing answers, not really answering the question.
As frum Jews, why do we care?
Hashem runs this world by mysterious ways. Buy we can classify them all into two: General providence (GP - השגחה כללית) and Private providence (PP - השגחה פרטית).

GP can be summarized in "חוק נתן ולא יעבר" (Tehillim 148:6) or "מה שהיה הוא שיהיה" (Ecclesiastes 1:9). This is the Nature and the Science as we know it, that wants to know Hashem's fixed laws that He swore the Creation to abide.
PP is exactly the opposite - Hashem holds the exclusive right to "override" those laws for His or His people's sake, what a layman calls "a miracle".

As Moses said "הוֹדִעֵ֤נִי נָא֙ אֶת־דְּרָכֶ֔ךָ וְאֵדָ֣עֲךָ֔" (Shmos 33:13), we all want to know G-d's ways. So for every phenomenon we encounter either in reality or in written we'd like to know which way of the two is it - was it "natural" or was it "miraculous".
Same with the Creation , we'd really like to know, what part of it was a super-natural miracle, and what part (or since when) the world is just following G-d's laws of physics, chemistry or biology.
Therefore instead of presenting this contradiction as one between the Science and the Torah, we can see it as a contradiction within the Torah itself, similar to many interpretations of famous miracles - Makot Mizraim, Splitting of the Sea, Mannah etc.
Comment: You are very welcome. I still don't understand exactly what you are trying to say. Let's say that the Torah implies the world is very young, and science implies it is very old, how would this approach apply?
Comment: Why not ask this question about any life phenomena - a person is born - is it natural or miraculous? Imagine an alien coming to Earth a seeing a newborn, after a year he doubles himself, how come we don't have people 200 feet high? Or he observes a person from 20 to 60 changing very slowly, wouldn't that alien expect the person to die in a thousand years, based on that tendency? My point is that we are surrounded by this controversy of linear and abrupt changes, which I refer to השגחה כללית and השגחה פרטית.
Comment: On the other hand, all scientists agree that there were many unexplained **abrupt and unpredictable changes** in history, like inflation, dinosaur extinction, Homo Sapience emerging, AI emerging or even a simple phenomena like water expanding after freezing etc we can call השגחה פרטית.
Comment: I don't understand how that is relevant to the question. The question was about scientific evidence about the beginning of the world vs. Torah. The question wasn't how God could create the universe miraculously, but how to deal with the contradiction between the Torah's account and science's account. || Are you suggesting the science's understanding is predicated on the presumption of constancy of natural law; a presumption you are challenging?

Bereishit vs. science


Daven mincha after lighting Shabbos candles

Question: As most shuls daven mincha right before Kaballos Shabbos, in order to daven mincha with a minyan on Friday one must light candles prior. Is it better to light candles and then daven mincha, or should one daven mincha alone and then light candles?
Comment: Tzvi, welcome to Mi Yodeya; thanks for bringing your question here! Please note that  this site makes no guarantee of validity, and does not offer professional (particularly rabbinic) advice. Treat information from this site like it came from a crowd of your friends: use it as a jumping-off point for [a discussion with your rabbi](http://yodeya.com/q/9146). Also, please consider [registering](http://yodeya.com/users/login) your account for [access](http://meta.stackexchange.com/q/44557) to more site features.
Comment: Can you indicate why you think the order of lighting/Mincha should matter?
Answer: The conclusion of the Shulchan Aruch (263:10) is that you can light candles without accepting Shabbos through that lighting if you have that intention when lighting.  This intention does not need to be expressed (Rama there).  You should still make a beracha when lighting in this situation (Mishna Berura 263:42).  It would therefore be better to daven with a minyan if it is possible, and light before with intent to not accept Shabbos through the lighting.


What is the best industry standard report for Code quality control and measurement over time?

Question: I was asked to research "What is the best industry standard report for Code quality control and measurement over time?". Our QA team provides weekly reports on Regression and New bugs found. I need to find out how to report to stakeholders that our code quality is stable and we do not introduce more bugs or regressions.
Answer: Industry standard metric is Defects per Function Point (or per any other volume unit you use).
Example of report indicators:

Defects per function point
Defect potential
Defect removal efficiency
Defects removed
Defects delivered
Cost per defect prerelease
Cost per defect postrelease
Average cost per defect

Recommended book: The Economics of Software Quality - Capers Jones
International Standards:

ISO/IEC 25030 Software engineering -- Software product Quality Requirements and Evaluation (SQuaRE) -- Quality requirements
ISO/IEC 25010 Systems and software engineering -- Systems and software Quality Requirements and Evaluation (SQuaRE) -- System and software quality models
IEEE 730-2014 - IEEE Standard for Software Quality Assurance Processes
IEEE 1061-1998 - IEEE Standard for a Software Quality Metrics Methodology
ISO 9000-9001 Quality Management
ISO/IEC 10181 Information technology -- Open Systems Interconnection -- Security frameworks for open systems: Access control framework
ISO 17799 Information technology -- Security techniques -- Code of practice for information security management
Sarbanes-Oxley
Comment: It's important to come to a detailed understanding of what comprises a "defect" before attempting such metrics, lest you spend resources mired in internal conflict about it.
Answer:
I need to find out how to report to stakeholders that our code quality is stable and we do not introduce more bugs or regressions.

Question: Is your code quality stable and you refrain from introducing more bugs?
Yes? Then, follow-up question:
How do you know?
Are you using a bug-tracking system of some sort? You track every single bug? And thus have access to a report that definitively shows your team isn't generating more bugs than it used to? Then just show that report to your boss. Simple.
Are you using a bug-tracking system but do not track every single bug? Then you'd better start tracking every single bug.
Are you tracking bugs as they come up, but throwing them away afterwards? Stop throwing them away.
Are you not tracking them at all (ie. (receiving those reports from QA, dealing with them, and then tossing them)? Start tracking them. This could be via a full-blown issue tracking/project management system (JIRA, Trello, etc.), or just an excel spreadsheet.
Answer: Have a look at the OpenSource SonarQube for measuring and managing code quality trends. Ranging from defects to code analysis trends. It is even possible to deny commits if it does not meet the minimal standards.
Code quality is more than the end-result and the number of defects. How many defects per X does not make a lot of sense anymore in a world that is moving to continuous delivery. You cannot compare one product or industry to another. Mainly because of complexity. Wonder how do you prevent defects? Make it less complex.
How to measure code quality with metrics?

Introduced defects vs completed features trends
Test code coverage percentage trends
Code complexity trends
Known Code smells trends

Next to that I would also introduce gathering of

Root-causes of defects

I think these are the most important metrics to monitor and report on.
Also research Clean Code if you want your teams to deliver higher quality code.


Ubuntu buffer cache freezes on sync

Question: I am not that strong in linux / unix so asking for any help on problem I have. I am running site on amazon ec2. I am running apache tomcat mysql on one large instance 8gb of RAM. Database is quite large but I don't have problems with performance and there is around 3gb of free memory on the box. I noticed that about once in a hour box becomes virtually frozen, so site is not responding and even ssh shell is very slow. I enabled performance monitoring and noticed that amazon reports that each hour or so there are huge disk i/o spikes.
I am running UBUNTU with kernel release 2.6.32-305-ec2 So I started monitor with vmstat and noticed that in normal operation box reports around 1.5gb free memory and 2gb of cache and cache is gradually grows. but at some point cache starts growing takes whole ram leaving like 1mb free or something like that. And then I see lots of processes waiting for disk and everything depening on drives i/o freezes. It lasts from 3 to 5 minutes usually. My understanding that system is dumping cache to the drive and freeing memory and that is what causing all that mess. I did not have this problem before I think it started recently when I loaded much more data in mysql. But again there are plenty of free memory it just management of the memory and cache by linux causing it. I read that it should be seamless and it is good thing to have buffer cache but having site down for 5 minutes each hour is definitely bad thing for me. Please advice what options I have with it. I could not find anything on internet.

That is what vmstat outputs
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 0 30      0  45512 134300 4062404    0    0   437   685   31   40 11  4 74  6
 5 31      0  47200 134328 4057136    0    0 28188 15508 1682 2255 13  9  2 66
 3 33      0  46904 134328 4057048    0    0 16761  8785 1099 1523  4  3  0 89
 0 35      0  48440 134344 4054908    0    0 23688 11572 1453 1782  6  3  0 85

Answer: Take a look at Greg Smith's A Linux write cache mystery. You may need to decrease dirty_ratio and dirty_background_ratio.

Ubuntu buffer cache freezes on sync


CentOS, Amazon EC2, and EBS AMI

Question: How do you go about finding the most "accepted" image for Amazon which allows you to store it as an EBS image. Specifically I'm looking for a CentOS image.
Answer: Actually, your best bet is probably the Amazon Linux AMI: http://aws.amazon.com/amazon-linux-ami/
It's CentOS/RHEL under the hood, so you can use all the CentOS RPMs and such, but you get Amazon's tweaks and improvements so it runs even better in EC2.
Answer: The best practice is to either use the official image provided by the distro (CentOS started to provide these recently). Or to build your own image directly from a kickstart file. Either using a tool like ami-creator, or directly running a kickstart based install on EC2.
We recently wrote a blog post showing how this can easily be done on EC2:
http://www.comodit.com/2012/11/26/kickstarting-on-ec2/

CentOS, Amazon EC2, and EBS AMI


Why are hashes base16 (hex) encoded rather than base58 encoded?

Question: BTC sha256 hashes are hex encoded (as sha256 spits out bytes not a string), why is this? Surely using base58 would be more efficient as would use less space (would output a shorter string)
Answer: Mark H's answer is correct, but I think there is a more fundamental point: addresses are directly intended for human consumption. Transaction hashes (as well as public keys, block hashes, raw scripts, raw transactions, ...) are not. They are sometimes visualized, but this is primarily for debugging purposes. And hexadecimal is a very natural choice for debugging, as it's easy to see which bytes correspond to which characters.
Answer: SHA256 hashes are encoded in plain binary in bitcoin protocol and in block storage (32-bytes in little-endian byte order when treated as integers, which makes them effectively "base256"). The textual hex encoding is merely used for displaying and inputting hashes into the software. Hex is a widely used and understood format for representing arrays of bytes. Also, most cryptographic APIs already support parsing of hex strings into big integers and such, but base58 is not really widely used outside of Bitcoin.
There seems like little reason to change the way I/O of hashes is done as it would only add to confusion as to what a string is for. The purpose of Base58Check strings was not merely to shorten them (as Base64 could've been used for this), but also to eliminate some characters which look alike or are incompatible with the URI format because bitcoin addresses are intended for sharing.
Comment: Yeah i get why base58 is used rather than base64, but why was hex chosen to visulaise the hashes? Is it insecure to encode hashes with base58 on a protocol level? The reason i ask is that i am currently coding a cryptocurrency in rust. I am currently encoding the hashes in base58 and reuiring hashes have at least 4 A's before them as other difficulty algos (the ahsh must be < the diff) dont work as the hashes are never samll enough
Comment: See my answer: hex is much nicer to debug things.


Axis webservice returning byte array

Question: I wrote a java web service that returns byte array generated from a file.
public byte[] callByte(){
   // code that return byte array
}

In my client I try to read that byte array as
CallStub stub = new CallStub();
byte[] b = stub.callByte();

where CallStub is the axis client stub. It is saying type mismatch: cannot convert from CallStub.CallByteResponse to byte[]
so I understood that the byte is returned in the form of CallByteResponse object.
But I want that to be converted into a byte array.
Can you please tell me how to do that.
Answer: If you would check the definition of the CallByteResponse object, you should find a getter function which returns the byte array that you're looking for.

Axis webservice returning byte array


Message Template Token limitations

Question: We want to use Message Templates for tailoring our sponsorship renewal invoice reminders. We have multiple sponsorships setup as separate Membership Types with corresponding prices sets.  However data about "membership" is NOT available as tokens when using Message Templates. That data is available as Tokens when using  Schedule Reminders - but this means a separate Reminder is to be setup for each Membership Type. Question is why cannot Membership data (and for that matter Event data) be available as Tokens under Message Templates?
Comment: I would love to see the ability to assign normal Message Templates for the various Scheduled Reminders (membership and events). This is one reason I haven't used scheduled reminders: too much hassle to change every reminder for every event, and too risky that one would be missed.
Answer: Welcome to StackExchange Grant!
In regular messages token for other "entities" such as memberships, contributions or event registrations are not available because each contact can have any number of them.
For example, if a contact had two memberships or event registrations, CiviCRM would not know which data to "fill in" when sending the email.
This is why CiviCRM has several special functions such as event and membership reminders or thank you letters for contributions.
Comment: Thanks Fabian. Can you expand on the "several special functions" bit please - that could be very useful.
Comment: That's a big question ;) Maybe you want to start with having a look at Schedfuled remidner for events (https://docs.civicrm.org/user/en/latest/events/creating-an-event/#scheduled-reminders), renewal reminders for memberships (https://docs.civicrm.org/user/en/latest/email/scheduled-reminders/#renewal-reminders) and thanky you letters/mails for contributions (https://docs.civicrm.org/user/en/latest/contributions/manual-receipts-and-thank-yous/#thank-you-letters). Regards, Fabian
Answer: Fuzion made an Extension that provides additional tokens that you should be able to use in this scenario. The CiviToken extension includes

Latest Memership Status
Latest Membership Type
Latest Current Membership Type etc
Comment: Great - will investigate that extension

Message Template Token limitations


Is there an automated way to make sure that all parts of code is unit tested?

Question: I have written JUnit tests for my class, and would like it to tell me if there is any part of my code that is not unit tested. Is there a way to do this?
Answer: Yes, coverage tools like cobertura or emma.
They create reports that show every line in the source code and whether it was executed or not (and aggregated statistics as well).
Of course, they can only show you if the code was run. There is no way to tell if the unit test contained assertions to confirm that the result was correct.
Answer: You need some code coverage tools. See here (http://java-source.net/open-source/code-coverage) for some
If you look at the first one I think it does what you need
Cobertura is a free Java tool that calculates the percentage of code accessed by tests. It can be used to identify which parts of your Java program are lacking test coverage. It is based on jcoverage. Features of Cobertura:

Can be executed from ant or from the
command line.
Answer: If you use Eclipse, you can also try EclEmma, which shows you which lines of source were covered by your test. This is sometimes more useful than running a coverage tool like Cobertura because you can run a single test from inside Eclipse and then get immediate feedback on what was covered.
Comment: Thank you. I like that it easily integrates into Eclipse
Answer: Your headline and your actual question differ. The tools mentioned in the other answers can tell you, which part of the code were not tested (=not executed at all). Making "make sure that all parts of code is unit tested" is a different thing. The coverage tools can tell you whether all lines/instructions have been executed, but they don't guarantee that everything is tested functionally (all constellations of data, all execution paths, etc.). This requires some brain power.
In my opinion, test coverage often gives a wrong feeling of safety. E.g. testing trivial getters increases coverage a lot but is rather useless.
Answer: If you are using IntelliJ then there is a button titled
"Run With Coverage"


Am I being hacked, can I prevent it?

Question: I have just sent bitcoins from one account of mine to another, and after I sent it I checked on blockchain.info to get updated about confirmation.
There, I noticed something peculiar, it said that I made two transactions at the same time, when I made only one. The first transaction was to the correct address and the correct amount.
But the second transaction was not one that I made. The second thing I noticed is the SUM of both transactions, together they form the exact amount I last received to this account a few days ago.
This looks to me like a hack. At this moment these transactions have net yet been confirmed, can I do anything about it?
Can a transaction be created fraudulently and accepted by the miners?
How can a hack like this be accomplished (if it is a hack).
Comment: Did you create the transaction yourself or did simply send bitcoin wuth the help of a wallet?
Comment: I am running a full node, so I guess I created it myself
Answer: You are not being hacked.  These are not two separate transactions; it is one transaction with two outputs.  The second output was automatically created by your wallet client and sends back to a new address which also belongs to you.  This is a normal and necessary feature of how Bitcoin works, called "change". See How does change work in a bitcoin transaction?
If this transaction were malicious, it would mean that someone had access to your private key; if so, they would also have stolen your earlier transaction.  Moreover, they would  have stolen the coins as soon as they obtained the key; they wouldn't have waited for you to make your own transaction.
Comment: Thank You Nate Eldredge for your response, I had no idea about this feature, and because the change address is not written in the bitcoin client, that idea couldn't of crossed my mind.
After googling I found that when using bitcoin-qt it is possible to enter the command "listaddressgroupings" in the debug console, to see all addresses including change addresses.
https://bitcoin.stackexchange.com/questions/9077/how-to-get-all-addresses-including-the-change-addresses-from-bitcoind.
Comment: @AdamShem-Tov: Yeah, I think the Bitcoin Core developers took the view that this is a technical detail that end users don't need to be bothered with.  But of course when you look "under the hood" with a block explorer like blockchain.info, you see the details, and they can be confusing when they don't appear to match the high-level view presented by the client.

Am I being hacked, can I prevent it?


approximate time for indexing a conference proceeding

Question: Maybe some of you could help me with this matter based on your experiences. I presented an article for an IEEE congress which was held in March of this year, and accordingly, to their webpage, the proceedings will be indexed on IEEE Xplore. I have checked that previous versions of this congress, for example, the one held in 2018, was indexed in Scopus. We are on August, and still, the proceedings do not appear on IEEE Xplore either in Scopus. Is it normal to take that long time for the articles to get indexed? By the way, we sent the final versions already ready to be put on the conference proceedings, so there was no need for a new review for style.
Also, I got an article accepted from a journal which is also indexed in Scopus, which has a monthly basis. For what I saw on the website of this journal, which is Q3 or Q4, from the 30 articles published, only two are appearing actually in Scopus. The articles from July are completed; why is that? Did maybe Scopus decided not to put the other articles?
Bottom line, should I contact the editors?
It might sound like particular cases, but I was not able to find any information about the time-lapse from presentation or publication to appear on Scopus or other sites like IEEE.
Thanks
Answer: Yes it is possible for a significant amount of time to elapse between the conference and appearance of articles on IEEE Xplore. For example, here is a link to one of my papers which appeared in the proceedings of an IEEE conference that was held in September 2016, and it was added to IEEE Xplore in the end of February 2017.
Note that you can actually see both the Date of Conference and Date Added to IEEE Xplore on that page as well, right below the abstract. So you could also look up some articles from previous editions of the specific congress that you went to, and see how much time it took for that congress in previous years (but of course it doesn't have to be the same this year).


Force windows to be maximized but not fullscreen?

Question: On my Early 2015 13" MBP, on both El Capitan and macOS Sierra, I notice that some windows -- particularly Google Chrome, of which I have the latest stable version -- often seem to resize themselves slightly upwards without my consent, not taking up quite the full length of available area between the bottom dock and the top bar:

See the dark gap between the bottom of the Chrome window (the area with "0 votes 0 answers" - that's a StackExchange webpage) and the light-blue dock showing my application icons? I'd like to have the OS automatically squeeze that gap for me.
I am not willfully doing anything weird like dragging my windows around with the mouse or resizing them when this happens. I think it happens when I close the downloads bar at the bottom of the Chrome window, most often.
I often use Alt + Click on the green button to force a window to be maximized-but-not-fullscreen, but if it's in this intermediate state where it's "not-quite-maximized", this key combo does nothing.
I don't want to run the window in fullscreen so that I have instant access to and visibility of menus and can always look at my dock without having to move my cursor to it.
Confession: I come to MacOS with a heavily Windows-based UI familiarity, and I'm used to the paradigm of having window dressings like menus and the Windows Taskbar taking up part of the screen, but being able to easily maximize windows with the "Maximize" button. Indeed, this behavior is consistent for the majority of popular GNU/Linux window managers, too. It's only on OS X / macOS where I'm seeing this strange behavior of windows that like to slide a few pixels underneath the bottom dock, or pull themselves up a little over time.
Comment: Related: https://apple.stackexchange.com/questions/193274/is-the-a-way-to-remove-the-gap-between-window-edge-and-the-screen-edge-when-the/293187#293187
Answer: I believe this happens when dock scales up depending on a number of apps running and icons become a little big bigger. I was annoyed by this too and disabled <code>[ ]</code> Magnification.


How do I drain my washing machine?

Question: Frontload GE Washing Machine to sit on Basement cement floor. Drain to Greywater rockbed is a 2" line going out through wall 54" above basement floor. It goes through wall and down approx 3 feet on a 45 degree angle to a 4" line which runs 40 feet to the greywater rock well.
Can I and how should I put the washer drain into that 2" line?
Where that 2" line goes out the wall it is only 24" below basement ceiling.
If I raise the washer above the floor , how high should I go?
Comment: [My answer](http://diy.stackexchange.com/a/24854/33) to [this question](http://diy.stackexchange.com/q/24846/33) might be useful.
Answer: Washers are supposed to drain into a vertical standpipe 18-30 inches in height above a trap. The trap arm must then be vented before waste water can be discharged into waste piping. I don't believe there are lesser requirements allowed for greywater discharge. By the time this all is installed, the washer must pump up to within 6 inches of the ceiling. How high the washer can pump is dependent on the model. Once this height is determined, you can calculate how high the machine must be to meet all requirements.
Answer: As long as the discharge to the drain well is not shared with anything else, especially a toilet, I don't think there is any value or real need to have a P-trap, except maybe to discourage insects, rodents, and the like from coming into the house.  Even that problem can be eliminated by sealing the washer hose coupling to the 2 inch line.
The GE WCVH6800J installation manual (page 18) says a standpipe of 24 to 96 inches above the floor is acceptable.  So that model would be just fine in your installation.  Check the installation manual for your model for authoritative verification.

How do I drain my washing machine?


Tisha Ba'av that fell out on Shabbos

Question: If Tisha Ba'av fell out on Shabbos, and therefore it was pushed off to Sunday. Is a Bar Mitzvah Boy obligated to fast if he turned 13 on Shabbos? In other words: Does the fact that Tisha Ba'av fell out on Shabbos and now moved to Sunday constitute the Boy obligated in the fast or not? Please source.
Comment: Do you mean that he turned 13 on Sunday?
Comment: As I see it, if he turned 13 on Shabbat, then he would need to fast because on Shabbat he was liable to fast. A question would arise if he turned 13 (ie 13 and a day counting a part of a day as a day) on Sunday (Motzei Shabbat). Then on Shabbat he would not have needed to fast, but the fast was deferred until Sunday, when he achieved bar mitzvah and with it the requirement to fast.
Answer: The Kovetz Halachos writes that he should fast if possible. He brings the opnions on page 21: footnote 17. The Avnei Nezer 426 was muspak about this ,and explains whether it's considered a tashlmin or not . He seems to come out that it is and a katan would be patur. The Maharsham 3:363 also seems to be maikel, however there still may be an Inyun by chinuch when it comes to tisha bav. The Divrei Malkeil 5:130 argues on the Maharsham and holds that a katan is chayav to fast since its not considered a tashlumin. Rav Asher Weiss also held that it's not considered a tashlumin, but rather it was instituted by Chazal to be pushed off ,so one would be chayav.
Comment: The fact that no one discussed this before the 19th century supports those who claim he's the same as any other adult
Comment: Sounds about right
Comment: @DoubleAA, all it supports is that the answer was obvious. Not what the answer was.
Comment: @msh not only obvious but obvious from the available texts none of which mention an exception to the rule that adults fast. I can edit to clarify that enthymeme

Tisha Ba'av that fell out on Shabbos


Joomla 2.5 upgrade to 3.7.2 and subdomains

Question: To whom it may concern:
I have joomla 2.5 and I am going to upgrade to 3.7.2 with its proper upgrade package.
There are subdomains in the root of main website which I want to upgrade, I believe if upgrade fails, there will be no effect on subdomains and their folders in the root of main website. Am I right or wrong?
P.S Subdomains are upgraded and backed up already too.
Kian William
Answer: Normally this should not be a problem. Usually subdomains are located in their own folder and updating the main domain's Joomla installation should not affect the subdomains.
Comment: Then I shall update it, I already created backup with akeeba for all subdomains, thanks.


Can't Logout in Ubuntu 12.04 x64 with Nvidia drivers

Question: I know more people with this issue: After we upgraded to 12.04, we can't log out with Nvidia drivers enabled, I got a blank screen, sometimes with fuzzy words (like X server crash), and after some seconds the PC reboots. If I uninstall Nvidia drivers, I can log out without problems. I can't find any fix, I have tried with current and current-updates. Anyone have solved this? It's a bug?
Thanks
Answer: The Nvidia drivers seem to have problems reloading during X server restart.
I faced this very same issue myself, using a GT520 card. The answer to me at least was posted on this forum:
For now, you can go around the issue by setting the Nvidia driver to persistent mode:
<code>nvidia-smi -pm 1
</code>
Fixed it for me.