Follow Slashdot stories on Twitter


Forgot your password?
Take advantage of Black Friday with 15% off sitewide with coupon code "BLACKFRIDAY" on Slashdot Deals (some exclusions apply)". ×

Comment Re:pointers & C (Score 1) 437

The "allocate in the constructor, clean up in the destructor" pattern ... is still just as error-prone (just fewer places for errors), and the fact that the destructor doesn't get called if the constructor throws isn't broadly internalized by coders (and is my least-favorite intermittent resource leak to run down).

I've come up with my own pattern (probably not original) for dealing with throwing constructors and I've been wondering if it's effective. Basically, write a separate cleanup() method that gets called by the destructor and the catch() block of a constructor:

    { // ... do stuff and acquire resources
        throw; // to prevent Foo instance from being used


{ // release any acquired resources

Comment Re:How Big an Improvement Are We Talking Here? (Score 1) 92

Not quite. There are very few algorithms that will see a substantial speedup on quantum computers, factoring numbers and simulating quantum systems being the big two. In fact, it wasn't until Shor's algorithm was discovered that physicists really took an interest in quantum computers since no one knew if there was anything a quantum computer could do better than a Turing machine. For general problems, you can only get a modest speedup over a brute force search on a classical computer. To find an entry in an unsorted database takes O(n) on a classical computer and O(sqrt(n)) on a quantum computer (Grover's algorithm). To get better results, the problem has to have some special property that is amenable to encoding in a quantum system (the quantum Fourier transform in the case of Shor's algorithm).

For now, it seems that quantum computers won't help with NP-complete problems.

Comment Re: Need to prove intent (Score 1) 308

If the subpoenaed material was destroyed, erased, or flushed before the subpoena was received, you're fine. It is the state's burden to prove you destroyed the materials in order to obstruct justice (that is, after receiving the subpoena or other court order) or that you are lying about not having them.

Comment Re:watched a movie yesterday (Score 3, Informative) 61

You're right: the LHC beams are made up of separate bunches of protons. These bunches only collide at the 4 detectors. If they collided anywhere else, there wouldn't be anything to detect the products of the collision, so that collision would be a waste. Until the collision in the detectors, the protons moving in opposite directions are kept in separate beam lines: http://lhc-machine-outreach.we.... Here's a look inside the beam pipe: http://lhc-machine-outreach.we...

The time between collisions is 25 nanoseconds, meaning there is 25 feet between each bunch (light travels at about 1 foot per nanosecond). When two bunches collide, there are only 20-30 proton-proton collisions because the protons are so small compared to the size of the bunches. By the time the next bunches arrive at the collision point, the debris from the first collisions are completely gone from the original collision point (about 25 feet away in all directions).


Comment Re:Hard to disagree with TFA (Score 1) 667

It's not a programmer thing; just look at the comments to the Wall Street Journal article and you'll find the same complaints. I find that pedantry is mostly a class issue. The educated upper classes (and those who see themselves as such) use pedantry to place themselves above others they view as lower class and uneducated ("begging the question" being a perfect example). You will never hear complaints about Bostonians who don't pronounce "r" (*Pahk the cah in Hahvahd Yahd."); you will hear endless complaints about black people who say "ax" instead of "ask" (even though "ax" is actually the original pronunciation). The Boston accent is perceived as cosmopolitan and part of a historic American tradition. African-American vernacular is saddled with poverty and ghetto stereotypes by those outside the communities.

By definition, "improper" English is how poor people speak.

Here are a few words from a posh Brit on the matter.

Comment Re:Statistical proof for turtles all the way down (Score 1) 231

This depends on the possible quality and size of a universe simulation. Is it possible to simulate the entirety of a universe using only a finite subset of that universe?

If yes, then there are (at maximum) an infinite number of simulated universes and and infinite number of recursively simulated universes. Thus the probability of us being the root/real universe is zero ("of measure zero" if you ask a mathematician). Perhaps the holographic principle comes into play to allow the entire universe to be simulated without using the resources of the entire universe.

If no, then there can be only a finite number of simulations in the observable universe. Also, each of the simulated universes is a smaller and/or less-precise version of the simulating universe. In this case, there are (at maximum) a finite number of simulated universes and a finite number of recursively simulated universes capable of hosting intelligent life (a cellular automata with only one cell could hardly be called intelligent). In this scenario, there is a non-zero probability that we live in the root/real universe.

I lean towards no, but I don't have any evidence, just a bias for thinking myself real.

Comment Re:Energy is not conserved in General Relativity (Score 1) 231

True, in a contracting universe, photons gain energy. Noether's theorem says that energy conservation is a consequence of time translation symmetry (t -> t + constant), not reversal symmetry (t -> -t), so conservation of energy isn't required. The "energy imbued by the creation of the universe" seems ill-defined. If you believe Hawking and Krauss, this energy is zero.

Comment Re:Energy is not conserved in General Relativity (Score 1) 231

Read the blog post I linked to above. There's no way to consistently assign an energy density to spacetime curvature. Quoting Prof. Carroll:

[U]nlike with ordinary matter fields, there is no such thing as the density of gravitational energy. The thing you would like to define as the energy associated with the curvature of spacetime is not uniquely defined at every point in space. So the best you can rigorously do is define the energy of the whole universe all at once, rather than talking about the energy of each separate piece. (You can sometimes talk approximately about the energy of different pieces, by imagining that they are isolated from the rest of the universe.) Even if you can define such a quantity, it’s much less useful than the notion of energy we have for matter fields.

Comment Re:Energy is not conserved in General Relativity (Score 1) 231

Consider the region of space that contains the photon. If each dimension of the universe double in size, then the photon loses half its energy. But, the vacuum energy increases by a factor of 8 (volume increases by 8 since space is 3 dimensional). This process can't keep energy constant.

You can also reason that different photons will lose different amounts of energy depending on the energy they started with. There's nothing to keep these changing energies balanced with the vacuum energy in expanding or contracting space.

Comment Energy is not conserved in General Relativity (Score 5, Interesting) 231

It has been known for quite some time that energy is difficult to define rigorously in General Relativity. A good explanation can be found in this post by CalTech physicist Sean Carroll. Key point:

The point is pretty simple: back when you thought energy was conserved, there was a reason why you thought that, namely time-translation invariance. A fancy way of saying “the background on which particles and forces evolve, as well as the dynamical rules governing their motions, are fixed, not changing with time.” But in general relativity that’s simply no longer true. Einstein tells us that space and time are dynamical, and in particular that they can evolve with time. When the space through which particles move is changing, the total energy of those particles is not conserved.

As a simple example, imagine a photon traveling through an expanding universe in a region with no other matter or energy (dark or otherwise). The expansion of space stretches the wavelength of the photon (cosmological redshift, which is distinct from Doppler redshift), causing it to lose energy. The photon loses energy with nothing around it gaining. Energy is lost because spacetime itself is changing, so Noether's theorem doesn't apply.

Without life, Biology itself would be impossible.