Once you know how to write code in one language, and you actually _understand_ what you are doing, picking up a new language is easy.
No. Having a wealth of experience in C, Java, and Haskell (for instance) will do absolutely nothing to help you when you try to write a web server in BrainFuck.
Naah.. Take a language like Python for instance. Suppose you're a really good C programmer, and you have to write a Python program which adds 2 to each integer in a particular array. So you write:
for i in xrange(len(array)): array[i] += 2
Thing is, an experienced Python programmer would use a more functional approach (even though the above imperative approach is also possible):
array = [x + 2 for x in array]
Or...
array = map(lambda x: x + 2, array)
It's not enough to know the syntax of the language in order to use it the "right way." "There's more than one way to do it" might be mantra in the world of Perl, but that's a silly concept.
And now, just because you decided to say something stupid like "The above piece of code doesn't work, and never could be made to work", I'll leave you with this little teaser: isn't it possible to write a class which implements both the "+=" and "+" operators? Isn't it possible to write that class so that their objects handle writing to the standard output? And finally, what stops anyone from using "cout" as the identifier of an object of that particular class?
Get back to me when you figure out how to get past the part where "Hello, there are" + 7 actually does the right thing. You'll never make it work. Remember that += is lower precedence than +, so "Hello, there are" + 7 is the first subexpression which will be evaluated. Notice that this subexpression is composed SOLELY of basic types in the language (pointer to char, and int). You cannot overload an operator which takes only built-in types.
Yes, the += and + operators can be overloaded, but they can never be overloaded in a way to allow the sort of statement you wrote. I understand C++ just fine.
Electrons, photons, and protons are all merely models to explain in tangible terms what the **** is going on down there, so I become skeptical when these terms are utilized to explain/demonstrate quantum mechanics. We know how to use electricity, buy it, sell it, how to protect our kids from it, yet we really don't know what it is.
I think you're making the classic mistake of, "The math is hard and unlike other math I've seen before, therefore QM is strange and mysterious." It should come as no surprise that objects which are far smaller than we can see or directly measure might behave in ways contrary to our understanding of the macroscopic world. Just because this behavior is new doesn't make it mystical. Saying that we don't know what electricity is is a bit ridiculous. Saying that we can't completely describe the location and momentum of every electron in a wire is a bit more realistic.
After all, the computer I am now typing this message on functions only because of semiconductors. Valence bands, conduction bands, band gaps, etc. All these things were predicted by QM and then exploited for practical use. I think this means we have a very, very good understanding indeed of electricity. The question of what material an electron is actually "made of" or why it behaves how it does aren't really even physical questions, much like asking what makes a banana a banana. And just because things like tunneling and quantization of energy arise from the equations doesn't make them weird.
Yeah, I would. I'm safe, because the code can't be made to work. You cannot redefine an operator on basic types. "Hello, there are" + 7 just adds 7 to the pointer to "Hello, there are", yielding a pointer to "there are". Then this pointer is added to... another pointer? Nope, sorry. It can't work.
So I live in South Florida. During a typical sunny day, could i expect to run my A/C if I had a roof of Solar Panels?
Assuming your roof is not microscopic, and you really do mean to COVER your roof with panels, then yes, you could run an air conditioner. Of course this is going to depend on your exact coverage, light levels, power requirements of the AC, etc.
As a bonus, the energy absorbed by the panels to run your AC, is energy that no longer penetrates the roof of your house. So your house will be slightly cooler even without the AC, just because you are extracting some of the energy from the light striking your roof.
HOWEVER, if you add up the costs of the installation of the solar electric system, you will find that you would get a far better return by using that money to improve the insulation and heat-efficiency of your home so that you place less demand on the AC in the first place.
Solar cells cost a lot of energy to make, so what's the life span on these things? What's left if you subtract the manufactoring costs from the life-time energy generation of these things?
Wow. It's amazing that in the 51 years that commercial solar power has been available, nobody has ever before considered this issue. You sir, have brought much insight to the world. Next, perhaps you can answer the question for me, is the copper in a single penny worth more than a penny?
I've been recently wrestling with the idea of putting solar panels up myself, but the truth of the matter is that I cannot afford the current RoR's length of time (approx 13-18years)
Can't afford it, or just don't like it? Are DOLLARS really the only reason you would use renewable energy? When I first installed my solar panel system, I was $3k in the hole (and I still am). This doesn't concern me much. I'm a geek and I could just as easily have dropped $3k on a fancy new computer. This way at least I do something good for the world. Isn't that worth paying for?
And the moon is made of atoms which were made in stars and hurled away with great kinetic energy by supernovae, so you could accurately say that both the moon itself and its kinetic energy are nuclear in origin, and therefore tidal power is also a form of nuclear power:-)
Don't forget the federal tax credits. Whether you agree with renewable energy subsidies or not, the money is there for the taking, you might as well take it.
Are you going with a battery system on a dedicated solar circuit, or are you using a grid-tie system? Xantrex among other companies makes good inverters with full RS-232 digital readout, so you can put your home solar energy stats up on a live web page:-)
Would we really have spent $300B and 2,906 American lives (so far) in Iraq if we didn't need to "stabilize" the region that supplies most of our oil?
You'd think that with THREE HUNDRED BILLION DOLLARS something more permanent and far reaching could have been accomplished than just temporarily propping up our access to an oil supply which everybody knows is finite. Imagine $300 billion applied to clean, efficient nuclear power, hell imagine just $3 billion.
The true cost of peak oil of course cannot be predicted, nor can the exact cost of changing global temperatures, rising sea levels, and shifting climates. A reasonable individual would purchase insurance against his house burning in a fire -- wouldn't it make sense for us to spend a few paltry billions to insure ourselves against the unpredictable?
...which comes in handy because, whether you like it or not, whenever someone writes code that person is applying mathematical concepts, whether the coder is aware of that or not.
Programming in general is mathematical, sure. That doesn't mean we need to usurp the meaning of mathematical operators to express algorithmic concepts that could easily be expressed WITHOUT diluting the meaning of the operators. I consider the math-based examples acceptable because they do NOT dilute the meaning of the operator -- addition of vectors is analogous to addition of reals, for instance.
But how about using '+' for string concatenation? One of the basic properties of addition is that it is commutative. Therefore, string("Hello") + string("World") should give the same result as string("World") + string("Hello"). But it doesn't. The addition operator has been perverted.
I wasn't aware that enabling the programmer to write code as he sees fit is somekind of a downside. Tell me, what exactly is wrong about having the freedom to use whatever tool we believe better expresses our ideas?
Because most programmers suck and shouldn't be allowed to play with power tools. Writing code however you feel like it is fine until somebody else has to deal with it. In the real world, programmers should be as restricted as possible in what they do and how they do it.
What piece of code is easier to read? Not sure?
One piece of code is more verbose. That's all.
And look at your silly example to work around my objection to left-shift IO operators:
cout += "Hello, there are" + 7 + " days in a week";
This piece of garbage just shows that you have no idea how the language works. You can't override operators for basic types. The above piece of code doesn't work, and never could be made to work.
So, your argument is that operator overloading is helpful because of... math, math, math, math, and math? Your examples are cute and all, but why do they justify giving the programmer such ridiculous arbitrary control over what should be very well-defined programming constructs?
Whoever came up with the idea of using > as IO operators on stream objects is insane. What's wrong with saying:
cout.write("Hello, there are ").write(7).write(" days in a week");
Okay, so you should have no trouble predicting the exact pattern of capillary formation inside a tumor, right? Your assumption that there is no sensitivity to initial conditions is way off.
Sure, most tumors look similar macroscopically. So do most humans. Should I assume that the brain of Albert Einstein is pretty much identical to that of Jeffrey Dahmer because they happen to look identical (both men's brains have been studied by science)?
CD cases: I've broken a few CD cases trying to get that damn plastic off, just to find the first corner I can get a grip and tear it.
The secret: look at a plastic-wrapped jewel case with the front side cover of the case facing you, right side up. On the left side you see the plastic bar which holds slots for the cover hinges. Between this bar and the actual cover itself (the part which swings open) is a very thin groove. Insert your fingernail into this groove to puncture the plastic, and carefully drag your finger to slit it open. Now you can rip off the outer plastic fairly easily.
It is possible to injure yourself doing this. Be careful the first few times. If you have a small tool like a (tiny) pen tip or small razor blade, using that is safer than using your fingernail. Fingernails which have been sharpened to dagger-like tips work best:-)
The chief cause of beer flatulence is yeast cells. The second biggest cause is complex sugar. It is something that your bowel can adjust to over time, so people who regularly drink beer with yeast in it aren't so affected by it. Ironically, the American swill beer you mention is filtered and pasteurized, so it contains no yeast at all. And anybody who's tasted a Coors Light can also tell you that the complex sugar content is practically nonexistent. So, American megaswill should be among the LEAST likely beers to cause gas.
I'd put far more blame on the FOOD that is typically consumed while drinking crap beer.
The worst case of beer farts I've ever witnessed (and I wish I hadn't) was caused by one of my homebrewed beers. Yeast? You betcha we got yeast. My afflicted friend said he absolutely loved the beer. But oh God, the side effects.
That's silly. A GPU is less generic than the CPU itself. If anything should be called a "generic processor" it should be the CPU. How about we call it an SCU, or Super-Cool Unit?
You can "make" deuterium in your kitchen by electrolyzing tap water. Deuterium occurs naturally, and there is some natural "heavy water" in your tap water. Because heavy water is, well, heavier than normal water, it will participate less in the electrolysis. Over time the water will disappear from the electrolytic cell (because it is being split into hydrogen and oxygen), you replenish this missing water slowly, such as with a slow drip. Over time, because the D2O diffuses more slowly than H2O, this leads to a buildup of D2O in the water in the electrolytic cell. It's not FAST but you can definitely concentrate deuterium in this manner.
If the child has a private account and is using it to flirt with older people then the parents need to be getting as much jail time as the flirting older people.
Yeah. And also, let's jail parents who feed their kids trans fats. You're definitely on the right track here. What do abused 13 year old girls need most in this world? For their parents to go to jail and to be placed into a foster home.
It's called INTENTION, dude. Why the hell do you think we have the DISTINCT crimes of manslaughter and murder? Why do we distinguish between negligence and recklessness? There is no crime in THINKING anything but if you do commit a crime, what was going on in your brain at the time (in this case, the guy held the belief that he was soliciting a minor) definitely counts.
I guess we should "run screaming" away from the distinction between manslaughter and murder too? Next time you accidentally kill somebody and end up sentenced to death let me know how you feel about that one.
I mentioned it only because of the supposition that humanity would have essentially infinite time to decode old data. I really doubt our time in this universe is infinite, and given all the possibilities for the death of humanity I think self destruction has fairly good odds. That might be far, far into the future. But since I was postulating an infinite I figured I would cover my ass.
The only point I can see in doing this is for more general use of the GPU than just rendering graphics. Graphics pipelines are pretty damn serial and the latency caused by putting the GPU on the north bridge is what, microseconds? Less? I don't see how this makes even the smallest difference in gameplay.
However, if you're using the GPU for something else like massive DFTs or physics simulations or any of the other cool stuff people are coming up with these days, where memory access patterns are more random, then I can see the benefit of reducing latency.
So why bother calling it a GPU? It's actually a fairly feature-rich complement to the traditional CPU, and putting it directly on the die seems only to reinforce that notion. Call it something else.
Once you know how to write code in one language, and you actually _understand_ what you are doing, picking up a new language is easy.
No. Having a wealth of experience in C, Java, and Haskell (for instance) will do absolutely nothing to help you when you try to write a web server in BrainFuck.
Naah.. Take a language like Python for instance. Suppose you're a really good C programmer, and you have to write a Python program which adds 2 to each integer in a particular array. So you write:
for i in xrange(len(array)): array[i] += 2
Thing is, an experienced Python programmer would use a more functional approach (even though the above imperative approach is also possible):
array = [x + 2 for x in array]
Or...
array = map(lambda x: x + 2, array)
It's not enough to know the syntax of the language in order to use it the "right way." "There's more than one way to do it" might be mantra in the world of Perl, but that's a silly concept.
Not only would you have to keep your colony on Xanadu warm from the cold, but you'd have to keep your warmth in or you would melt through the surface
What's the big deal? Build your colony on huge stilts to keep it physically separated from the surface.
And now, just because you decided to say something stupid like "The above piece of code doesn't work, and never could be made to work", I'll leave you with this little teaser: isn't it possible to write a class which implements both the "+=" and "+" operators? Isn't it possible to write that class so that their objects handle writing to the standard output? And finally, what stops anyone from using "cout" as the identifier of an object of that particular class?
Get back to me when you figure out how to get past the part where "Hello, there are" + 7 actually does the right thing. You'll never make it work. Remember that += is lower precedence than +, so "Hello, there are" + 7 is the first subexpression which will be evaluated. Notice that this subexpression is composed SOLELY of basic types in the language (pointer to char, and int). You cannot overload an operator which takes only built-in types.
Yes, the += and + operators can be overloaded, but they can never be overloaded in a way to allow the sort of statement you wrote. I understand C++ just fine.
Electrons, photons, and protons are all merely models to explain in tangible terms what the **** is going on down there, so I become skeptical when these terms are utilized to explain/demonstrate quantum mechanics. We know how to use electricity, buy it, sell it, how to protect our kids from it, yet we really don't know what it is.
I think you're making the classic mistake of, "The math is hard and unlike other math I've seen before, therefore QM is strange and mysterious." It should come as no surprise that objects which are far smaller than we can see or directly measure might behave in ways contrary to our understanding of the macroscopic world. Just because this behavior is new doesn't make it mystical. Saying that we don't know what electricity is is a bit ridiculous. Saying that we can't completely describe the location and momentum of every electron in a wire is a bit more realistic.
After all, the computer I am now typing this message on functions only because of semiconductors. Valence bands, conduction bands, band gaps, etc. All these things were predicted by QM and then exploited for practical use. I think this means we have a very, very good understanding indeed of electricity. The question of what material an electron is actually "made of" or why it behaves how it does aren't really even physical questions, much like asking what makes a banana a banana. And just because things like tunneling and quantization of energy arise from the equations doesn't make them weird.
Yeah, I would. I'm safe, because the code can't be made to work. You cannot redefine an operator on basic types. "Hello, there are" + 7 just adds 7 to the pointer to "Hello, there are", yielding a pointer to "there are". Then this pointer is added to... another pointer? Nope, sorry. It can't work.
So I live in South Florida. During a typical sunny day, could i expect to run my A/C if I had a roof of Solar Panels?
Assuming your roof is not microscopic, and you really do mean to COVER your roof with panels, then yes, you could run an air conditioner. Of course this is going to depend on your exact coverage, light levels, power requirements of the AC, etc.
As a bonus, the energy absorbed by the panels to run your AC, is energy that no longer penetrates the roof of your house. So your house will be slightly cooler even without the AC, just because you are extracting some of the energy from the light striking your roof.
HOWEVER, if you add up the costs of the installation of the solar electric system, you will find that you would get a far better return by using that money to improve the insulation and heat-efficiency of your home so that you place less demand on the AC in the first place.
Solar cells cost a lot of energy to make, so what's the life span on these things? What's left if you subtract the manufactoring costs from the life-time energy generation of these things?
Wow. It's amazing that in the 51 years that commercial solar power has been available, nobody has ever before considered this issue. You sir, have brought much insight to the world. Next, perhaps you can answer the question for me, is the copper in a single penny worth more than a penny?
I've been recently wrestling with the idea of putting solar panels up myself, but the truth of the matter is that I cannot afford the current RoR's length of time (approx 13-18years)
Can't afford it, or just don't like it? Are DOLLARS really the only reason you would use renewable energy? When I first installed my solar panel system, I was $3k in the hole (and I still am). This doesn't concern me much. I'm a geek and I could just as easily have dropped $3k on a fancy new computer. This way at least I do something good for the world. Isn't that worth paying for?
Tidal energy comes from our moon.
And the moon is made of atoms which were made in stars and hurled away with great kinetic energy by supernovae, so you could accurately say that both the moon itself and its kinetic energy are nuclear in origin, and therefore tidal power is also a form of nuclear power :-)
Don't forget the federal tax credits. Whether you agree with renewable energy subsidies or not, the money is there for the taking, you might as well take it.
Are you going with a battery system on a dedicated solar circuit, or are you using a grid-tie system? Xantrex among other companies makes good inverters with full RS-232 digital readout, so you can put your home solar energy stats up on a live web page :-)
Would we really have spent $300B and 2,906 American lives (so far) in Iraq if we didn't need to "stabilize" the region that supplies most of our oil?
You'd think that with THREE HUNDRED BILLION DOLLARS something more permanent and far reaching could have been accomplished than just temporarily propping up our access to an oil supply which everybody knows is finite. Imagine $300 billion applied to clean, efficient nuclear power, hell imagine just $3 billion.
The true cost of peak oil of course cannot be predicted, nor can the exact cost of changing global temperatures, rising sea levels, and shifting climates. A reasonable individual would purchase insurance against his house burning in a fire -- wouldn't it make sense for us to spend a few paltry billions to insure ourselves against the unpredictable?
Nice troll.
Programming in general is mathematical, sure. That doesn't mean we need to usurp the meaning of mathematical operators to express algorithmic concepts that could easily be expressed WITHOUT diluting the meaning of the operators. I consider the math-based examples acceptable because they do NOT dilute the meaning of the operator -- addition of vectors is analogous to addition of reals, for instance.
But how about using '+' for string concatenation? One of the basic properties of addition is that it is commutative. Therefore, string("Hello") + string("World") should give the same result as string("World") + string("Hello"). But it doesn't. The addition operator has been perverted.
I wasn't aware that enabling the programmer to write code as he sees fit is somekind of a downside. Tell me, what exactly is wrong about having the freedom to use whatever tool we believe better expresses our ideas?
Because most programmers suck and shouldn't be allowed to play with power tools. Writing code however you feel like it is fine until somebody else has to deal with it. In the real world, programmers should be as restricted as possible in what they do and how they do it.
What piece of code is easier to read? Not sure?
One piece of code is more verbose. That's all.
And look at your silly example to work around my objection to left-shift IO operators:
cout += "Hello, there are" + 7 + " days in a week";
This piece of garbage just shows that you have no idea how the language works. You can't override operators for basic types. The above piece of code doesn't work, and never could be made to work.
So, your argument is that operator overloading is helpful because of... math, math, math, math, and math? Your examples are cute and all, but why do they justify giving the programmer such ridiculous arbitrary control over what should be very well-defined programming constructs?
Whoever came up with the idea of using > as IO operators on stream objects is insane. What's wrong with saying:
cout.write("Hello, there are ").write(7).write(" days in a week");
Oh right, it doesn't look cute enough.
Okay, so you should have no trouble predicting the exact pattern of capillary formation inside a tumor, right? Your assumption that there is no sensitivity to initial conditions is way off.
Sure, most tumors look similar macroscopically. So do most humans. Should I assume that the brain of Albert Einstein is pretty much identical to that of Jeffrey Dahmer because they happen to look identical (both men's brains have been studied by science)?
CD cases: I've broken a few CD cases trying to get that damn plastic off, just to find the first corner I can get a grip and tear it.
The secret: look at a plastic-wrapped jewel case with the front side cover of the case facing you, right side up. On the left side you see the plastic bar which holds slots for the cover hinges. Between this bar and the actual cover itself (the part which swings open) is a very thin groove. Insert your fingernail into this groove to puncture the plastic, and carefully drag your finger to slit it open. Now you can rip off the outer plastic fairly easily.
It is possible to injure yourself doing this. Be careful the first few times. If you have a small tool like a (tiny) pen tip or small razor blade, using that is safer than using your fingernail. Fingernails which have been sharpened to dagger-like tips work best :-)
Po 210 decays to Pb 206, a stable form of lead. Are you SURE you don't see anything in your container?
I have read somewhere (no reference) that the MOST common lethal use of a firearm in the United States is a white man shooting himself.
The chief cause of beer flatulence is yeast cells. The second biggest cause is complex sugar. It is something that your bowel can adjust to over time, so people who regularly drink beer with yeast in it aren't so affected by it. Ironically, the American swill beer you mention is filtered and pasteurized, so it contains no yeast at all. And anybody who's tasted a Coors Light can also tell you that the complex sugar content is practically nonexistent. So, American megaswill should be among the LEAST likely beers to cause gas.
I'd put far more blame on the FOOD that is typically consumed while drinking crap beer.
The worst case of beer farts I've ever witnessed (and I wish I hadn't) was caused by one of my homebrewed beers. Yeast? You betcha we got yeast. My afflicted friend said he absolutely loved the beer. But oh God, the side effects.
That's silly. A GPU is less generic than the CPU itself. If anything should be called a "generic processor" it should be the CPU. How about we call it an SCU, or Super-Cool Unit?
You can "make" deuterium in your kitchen by electrolyzing tap water. Deuterium occurs naturally, and there is some natural "heavy water" in your tap water. Because heavy water is, well, heavier than normal water, it will participate less in the electrolysis. Over time the water will disappear from the electrolytic cell (because it is being split into hydrogen and oxygen), you replenish this missing water slowly, such as with a slow drip. Over time, because the D2O diffuses more slowly than H2O, this leads to a buildup of D2O in the water in the electrolytic cell. It's not FAST but you can definitely concentrate deuterium in this manner.
If the child has a private account and is using it to flirt with older people then the parents need to be getting as much jail time as the flirting older people.
Yeah. And also, let's jail parents who feed their kids trans fats. You're definitely on the right track here. What do abused 13 year old girls need most in this world? For their parents to go to jail and to be placed into a foster home.
It's called INTENTION, dude. Why the hell do you think we have the DISTINCT crimes of manslaughter and murder? Why do we distinguish between negligence and recklessness? There is no crime in THINKING anything but if you do commit a crime, what was going on in your brain at the time (in this case, the guy held the belief that he was soliciting a minor) definitely counts.
I guess we should "run screaming" away from the distinction between manslaughter and murder too? Next time you accidentally kill somebody and end up sentenced to death let me know how you feel about that one.
I mentioned it only because of the supposition that humanity would have essentially infinite time to decode old data. I really doubt our time in this universe is infinite, and given all the possibilities for the death of humanity I think self destruction has fairly good odds. That might be far, far into the future. But since I was postulating an infinite I figured I would cover my ass.
The only point I can see in doing this is for more general use of the GPU than just rendering graphics. Graphics pipelines are pretty damn serial and the latency caused by putting the GPU on the north bridge is what, microseconds? Less? I don't see how this makes even the smallest difference in gameplay.
However, if you're using the GPU for something else like massive DFTs or physics simulations or any of the other cool stuff people are coming up with these days, where memory access patterns are more random, then I can see the benefit of reducing latency.
So why bother calling it a GPU? It's actually a fairly feature-rich complement to the traditional CPU, and putting it directly on the die seems only to reinforce that notion. Call it something else.