The only problem I see now is what if A and B are unsigned integers and you were dealing with 4-bit numbers and a = 1111 and b = 1101, you get overflows and crap.
The addition/subtraction responses shows thought, but it's too much. The original XOR method is very slim and cheap computationally because the addition/subtraction requires you to wait for the calculations. XOR is more like a straight shot and it works with any bus length.
True, but what if you have large numbers, like 64-bit values? To properly handle that, your ALU need to be able to multiply 2 64-bit values and the result is a 128-bit product then perform the division. With my style, you can keep the 64-bit bus sizes and the computation needed is considerably small, XOR is a very cheap instruction computationally.
3. C/C++ : Exchange two numbers without using a temporary variable.
My Computer Architecture teacher asked us essentially this question, he said Intel asked it in a way more palatible for computer engineers than CS students but it still works.
If A contains one number (int or register) and B contains the other:
B = A XOR B; A = A XOR B; B = A XOR B;
Explanation: XOR is bitwise exclusive OR and is basically true when the bits differ. Say if we're dealing with 4-bit numbers. In the example, say A = 1011 (11 in decimal) and B = 0101 (5 in decimal).
Step 1: If you take the exclusive OR of A (1011) and B(0101), the result is 1110 and put that into B (or A would be fine). Do bit by bit comparisons based on position from left to right and if the bits are different, mark a one in it's position, if they are the same, mark a zero. By this point A contains an original pattern, 1011 (decimal 11) and B contains the difference 1110 (decimal 14) between patterns.
Step 2: Take the XOR of A and B again and store in the variable with an original pattern (A in this instance). 1011 XOR 1110 comes out to being 0101 (the original value for B) and we store it in A.
Step 3: Take the final XOR of A and B again, store in last register B. 0101 XOR 1110 comes out to 1011 (our original A) and is stored in register B.
Voila, 2 values exchanged very elegantly without wasted space and done in the same amount of steps as using a temporary variable. If you still don't understand, it works on the premise that if you have two piece of data, you only need one piece of data and whats different from the two pieces of data, that way you can reconstruct the other piece of data.
People have a better chance of joining up as an officer if you already have a BS. They'd rather not have to go through the extra effort of putting you through college. Plus, don't think about joining if you have a family or anything, they can send you where they want you to go because you are government property.
I go to school in Norfolk (Old Dominion University) and since we are the headquarters for the US Navy in the Atlantic, they have a big presence in town and on our minds. When ships in the middle east come back home, it always receives local attention.
I think you underestimate the skills of the examiners. Trust me, a doctor/scientist that studied brain functions for a long time and performed countless fMRI scans can outsmart folks with some off-the-cuff comment on how they think they can fool the test.
I saw this TV show one time where a police department teamed up with scientists and devised a better polygraph test.
They strapped a suspect in a chair and showed them a carefully laid out sequence of images on a TV screen, some benign images (like bowls of ice cream or a beachball) but some are details about the crime (if murder, show police photos of the corpse, or show some evidence left behind like a scarf or jewelry that the victim didn't own, or possible accomplises already linked to the crime). While this went on, the scientists measured brain activity and they could tell when a suspect "remembers" pictures, the parts of the brain fire off and the scientists can see it. When the suspects brain indicates it remembers and it's on a crime photo, they can reasonably presume the suspect had something to do with it.
Of course this has limitations, like what if the suspect was under the influence of something, or the materials about the crime aren't effective enough, but it's much harder to fool your brain.
I help my school show movies to the general public so I can authoritatively say No. Our school pays between $250 for well-out-of-box-office movies upwards to $800 for popular just-out-of-box-office movies. You pay for not only the right to show the movies publicly but also for to right to show the movie before it comes out on home video. For instance, our school is going to show Ray about a month before it comes out on video next semester and it'll cost us $800 but we don't charge at the door (money comes from students anyway but through the budget from tuition).
There's actually a release timeline for movies and movie availability for us falls right after availability for airlines. We also only get movies in VHS format because we can't handle the 16mm or 35mm films, and they won't send us DVD's because of piracy. yeah, I know you can record off of VHS but it's cumbersome, plus the distributor inserts their tag in the movie.
As for the MPAA, I figure it just hasn't become a "phenomena" yet. Also, when say a movie is shown like Team America: World Police that is out of theaters but not on video, people might see it for free but they don't get to walk away with a copy just by seeing it. However, seeing movies for free over the internet, the people do get to keep a copy because that's the method of distribution, making another copy, so they do perceive that as a loss of a sale. I guess they will get off their laurels when they claim they are losing billions to the guerilla drive-in's.
This is not a flame so please don't punish me if you disagree. I agree with the parent very much and here's why...
I recently got the play Halo for the first time ever (I live in PS2 land mainly thanks to Grand Theft Auto games and Gran Tourismo) recently, I was interested to see what the fuss is about but became disappointed because of the aforementioned reasons.
Maybe it's my newcoming to FPS on the Xbox console but I've always had a hard time accurately and quickly aiming with my thumb on any console. Take Goldeneye for Nintendo 64, you got to use the analog joystick which made aiming tolerable but still slow. The cursor would dance from side to side if you're in a hurry and would take forever for the cursor to walk over to the target if you decided to take it slow.
I am a frequent player of Day of Defeat though. Coming off of 6 months of intense Day of Defeat and getting pretty proficient at the game, I can aim faster than the aim cursor focuses for an accurate shot. If you don't know, most if not all rifles expand the crosshairs while you walk indicating your shot has a huge chance of not making the target. Once you stop moving, the crosshairs focus down and stop to indicate the most accurate aim you can manage with the gun. Back in the game, if I run around a corner and spot an enemy, I am used to where the center of my screen is and put it on the target, I wait for the crosshairs to converge and then fire, all done in under a second. Sure, I could crouch and inch around the corner but that's no good if I'm expected by the enemy. If the target is a sniper or minigunner, this works especially well because the sniper has tunnelvision and the minigunner might not be able to react quick enough. If the target uses any other weapon, crouching or not will suffice because I only need one shot. A couple other guns, if aimed extremely well for a headshot, only need one shot too but the chances for a luck-of-the-draw headshot without any moment to aim is highly unlikely.
The poor parents are the ones that just toss video games at their kids to shut them up so they leave the parents alone.
All kids take cues from whatever they look up to, and if kids spend more time with video games than parents, they will look up to video game characters. When the kids are caught comitting vandalism (imitating San Andreas for example by spray painting walls), the parents are outraged. According to the bad parents, the parents and their kids aren't to blame, it's the software publishers fault that their kids imitate fantasy.
This crap happens because it's easier to blame video games than kids.
Take the legal drinking age for your locality, that's set in place because it's easy to test and find out if someone is of a certain age, just math. In an ideal world, a persons habits and character would determine if they should drink. If someone will drink responsibly at age 16, why make them wait till 18 or 21? Likewise, there are people that are over the legal drinking age that are still too immature and let alcohol run their lives but by law, they can still buy alcohol. All anyone can do is give them an AA flyer and ask them to take time out of their schedule to remember the next meeting, physically drive to the meeting and suffer through the awkwardness of admitting you're an alcoholic.
The legal system blames the video games because it's easy to convince parents video games are bad because parents aren't going to blame their own kids for violence they may create, they'd rather blame something or someone that cannot defend themselves. To make headway in hedging violent video games to kids, it's easy to slap a violence rating on a game and make every retailer ask for ID to anyone buying the game than it is to perform intense psychological tests to see if that person understands the difference between reality and fantasy, and if they will or will not take cues from videogames.
When I'm a parent, I know my kid is going to be exposed to things I wouldn't, but I'm going to make sure they can put the things into the right perspective and let them make good decisions for themselves.
I put my Sony DRU-500A inside a Firewire/USB 2.0 enclosure from Cooldrives at this project page. I've had zero problems with it too, I bought a 3.5" Firewire/USB 2.0 enclosure for them for a hard drive too, the build quality sucked but that was my fault for cheaping out on the enclosure. They have Firewire 800 stuff to for the high-speed Firewire crowd.
My next enclosure, I'd go to them first, hands down.
Pretty soon I'm going to join the PVR crowd and Myth looks better and better in the fact it's flexible. Now that TiVo is bending over for movie and TV distributors, I like Myth even more.
The definition of irony is that it's created using contrasts between the apparent and intended meaning.
In the grandparent poster, the apparent meaning was that you play a game to steal and intended meaning was that you stole the game, very little constrast. Like I said, it's not irony because there is no difference.
If the apparent meaning was a game to be a good character where you had to not steal but the game was good enough where people wanted to steal it, then that's irony.
If you get it before the launch, then I'd say yes but since you have paid for it but simply didn't wait until the launch date, it won't kick up too much dust.
I think they'd be concerned more about their money than punishing a couple hundred paying customers for not waiting a few days till the game is officially released.
If the game was about trying to reform the main character away from robbing and stealing, then it would be irony. Since there is no relative constrast between the game plot and downloading leaked copies, this cannot be irony.
Sound pretty sure about the Yankee's, too sure methinks because you can't see the future.
The heartbreak won't be double at all, at least not to fans. If they lose, they would have come from behind and made it to game 7 and the better team won. That's a hell of a better outcome than forfeiting game 4. It's all a matter of perspective.
Boo Yankees, Sox have done everything to earn the win. They deserve to go down in the books as the first team to come back 0-3 for the series and win it all. Afterall, game 4 (or 5) broke the Yankee record that they never lost back-to-back extra inning games. The Red Sox deserve a win on many different levels.
Jet engines are relatively inefficient at low speeds but once they get up to speed, the efficency goes back up and the process feeds on itself becoming a self-sustaining process.
Combustion engines are the opposite, they run fine at regular speeds but at high speeds, you get the same effect as the economic term "diminished returns" where it states that with additional units of work provide lesser and lesser additional power. In other words, it requires more and more work to achieve the same speed increase.
The only time I listened to Jay Leno was when he was talking about the difference when showing off his jet bike (a motorbike with a jet engine instead of combustion engine).
I agree, it's not some big conspiracy. That date has been set so that other arms of Valve and parent companies can cooperate for this release. Lots of money has been spent advertising that day as HL2 release date. Some game review sites have signed NDA with that date, not allowing them to release their reviews before then.
I don't see why people dislike Steam so much, it's so much better than the original interface. I like where Valve is going with Steam. The content delivery is nice and the idea of smaller updates the end user doesn't need to do anything for is so much better than the large updates. Everyone had to crowd Fileplanet (another piece of crap) and other sites and slow down file distribution for everyone.
I liked TDS when Kilborn was on it because I laughed at his outright narcissism, I didn't care about the jokes. He'd have a few minutes with a camera simply admiring his hair or things like that.
Since watching the CNN Crossfire with Stewart, that's the purest form of why I still like him, his sharp wit in taking control of a conversation with smart yet easy-to-follow statements.
I refer you here.
The only problem I see now is what if A and B are unsigned integers and you were dealing with 4-bit numbers and a = 1111 and b = 1101, you get overflows and crap.
The addition/subtraction responses shows thought, but it's too much. The original XOR method is very slim and cheap computationally because the addition/subtraction requires you to wait for the calculations. XOR is more like a straight shot and it works with any bus length.
Doesn't work with signed numbers.
If x = 3, and y = -4:
x = 3 + -4 -> x:= -1
x = -1 - -4 -> x:= +4
y = 3 - -4 -> y:= +7
At completion, x = 4, y = 7, won't work.
True, but what if you have large numbers, like 64-bit values? To properly handle that, your ALU need to be able to multiply 2 64-bit values and the result is a 128-bit product then perform the division. With my style, you can keep the 64-bit bus sizes and the computation needed is considerably small, XOR is a very cheap instruction computationally.
I'm sure there was a bitwise XOR operator, but I am more familiar with assembly and assembly-style level of thought.
3. C/C++ : Exchange two numbers without using a temporary variable.
My Computer Architecture teacher asked us essentially this question, he said Intel asked it in a way more palatible for computer engineers than CS students but it still works.
If A contains one number (int or register) and B contains the other:
B = A XOR B;
A = A XOR B;
B = A XOR B;
Explanation:
XOR is bitwise exclusive OR and is basically true when the bits differ.
Say if we're dealing with 4-bit numbers. In the example, say A = 1011 (11 in decimal) and B = 0101 (5 in decimal).
Step 1: If you take the exclusive OR of A (1011) and B(0101), the result is 1110 and put that into B (or A would be fine). Do bit by bit comparisons based on position from left to right and if the bits are different, mark a one in it's position, if they are the same, mark a zero. By this point A contains an original pattern, 1011 (decimal 11) and B contains the difference 1110 (decimal 14) between patterns.
Step 2: Take the XOR of A and B again and store in the variable with an original pattern (A in this instance). 1011 XOR 1110 comes out to being 0101 (the original value for B) and we store it in A.
Step 3: Take the final XOR of A and B again, store in last register B. 0101 XOR 1110 comes out to 1011 (our original A) and is stored in register B.
Voila, 2 values exchanged very elegantly without wasted space and done in the same amount of steps as using a temporary variable. If you still don't understand, it works on the premise that if you have two piece of data, you only need one piece of data and whats different from the two pieces of data, that way you can reconstruct the other piece of data.
People have a better chance of joining up as an officer if you already have a BS. They'd rather not have to go through the extra effort of putting you through college. Plus, don't think about joining if you have a family or anything, they can send you where they want you to go because you are government property.
I go to school in Norfolk (Old Dominion University) and since we are the headquarters for the US Navy in the Atlantic, they have a big presence in town and on our minds. When ships in the middle east come back home, it always receives local attention.
I think you underestimate the skills of the examiners. Trust me, a doctor/scientist that studied brain functions for a long time and performed countless fMRI scans can outsmart folks with some off-the-cuff comment on how they think they can fool the test.
I saw this TV show one time where a police department teamed up with scientists and devised a better polygraph test.
They strapped a suspect in a chair and showed them a carefully laid out sequence of images on a TV screen, some benign images (like bowls of ice cream or a beachball) but some are details about the crime (if murder, show police photos of the corpse, or show some evidence left behind like a scarf or jewelry that the victim didn't own, or possible accomplises already linked to the crime). While this went on, the scientists measured brain activity and they could tell when a suspect "remembers" pictures, the parts of the brain fire off and the scientists can see it. When the suspects brain indicates it remembers and it's on a crime photo, they can reasonably presume the suspect had something to do with it.
Of course this has limitations, like what if the suspect was under the influence of something, or the materials about the crime aren't effective enough, but it's much harder to fool your brain.
I help my school show movies to the general public so I can authoritatively say No. Our school pays between $250 for well-out-of-box-office movies upwards to $800 for popular just-out-of-box-office movies. You pay for not only the right to show the movies publicly but also for to right to show the movie before it comes out on home video. For instance, our school is going to show Ray about a month before it comes out on video next semester and it'll cost us $800 but we don't charge at the door (money comes from students anyway but through the budget from tuition).
There's actually a release timeline for movies and movie availability for us falls right after availability for airlines. We also only get movies in VHS format because we can't handle the 16mm or 35mm films, and they won't send us DVD's because of piracy. yeah, I know you can record off of VHS but it's cumbersome, plus the distributor inserts their tag in the movie.
As for the MPAA, I figure it just hasn't become a "phenomena" yet. Also, when say a movie is shown like Team America: World Police that is out of theaters but not on video, people might see it for free but they don't get to walk away with a copy just by seeing it. However, seeing movies for free over the internet, the people do get to keep a copy because that's the method of distribution, making another copy, so they do perceive that as a loss of a sale. I guess they will get off their laurels when they claim they are losing billions to the guerilla drive-in's.
http://slate.msn.com/id/2091723/
This is not a flame so please don't punish me if you disagree. I agree with the parent very much and here's why...
I recently got the play Halo for the first time ever (I live in PS2 land mainly thanks to Grand Theft Auto games and Gran Tourismo) recently, I was interested to see what the fuss is about but became disappointed because of the aforementioned reasons.
Maybe it's my newcoming to FPS on the Xbox console but I've always had a hard time accurately and quickly aiming with my thumb on any console. Take Goldeneye for Nintendo 64, you got to use the analog joystick which made aiming tolerable but still slow. The cursor would dance from side to side if you're in a hurry and would take forever for the cursor to walk over to the target if you decided to take it slow.
I am a frequent player of Day of Defeat though. Coming off of 6 months of intense Day of Defeat and getting pretty proficient at the game, I can aim faster than the aim cursor focuses for an accurate shot. If you don't know, most if not all rifles expand the crosshairs while you walk indicating your shot has a huge chance of not making the target. Once you stop moving, the crosshairs focus down and stop to indicate the most accurate aim you can manage with the gun. Back in the game, if I run around a corner and spot an enemy, I am used to where the center of my screen is and put it on the target, I wait for the crosshairs to converge and then fire, all done in under a second. Sure, I could crouch and inch around the corner but that's no good if I'm expected by the enemy. If the target is a sniper or minigunner, this works especially well because the sniper has tunnelvision and the minigunner might not be able to react quick enough. If the target uses any other weapon, crouching or not will suffice because I only need one shot. A couple other guns, if aimed extremely well for a headshot, only need one shot too but the chances for a luck-of-the-draw headshot without any moment to aim is highly unlikely.
I fully agree with that.
The poor parents are the ones that just toss video games at their kids to shut them up so they leave the parents alone.
All kids take cues from whatever they look up to, and if kids spend more time with video games than parents, they will look up to video game characters. When the kids are caught comitting vandalism (imitating San Andreas for example by spray painting walls), the parents are outraged. According to the bad parents, the parents and their kids aren't to blame, it's the software publishers fault that their kids imitate fantasy.
This crap happens because it's easier to blame video games than kids.
Take the legal drinking age for your locality, that's set in place because it's easy to test and find out if someone is of a certain age, just math. In an ideal world, a persons habits and character would determine if they should drink. If someone will drink responsibly at age 16, why make them wait till 18 or 21? Likewise, there are people that are over the legal drinking age that are still too immature and let alcohol run their lives but by law, they can still buy alcohol. All anyone can do is give them an AA flyer and ask them to take time out of their schedule to remember the next meeting, physically drive to the meeting and suffer through the awkwardness of admitting you're an alcoholic.
The legal system blames the video games because it's easy to convince parents video games are bad because parents aren't going to blame their own kids for violence they may create, they'd rather blame something or someone that cannot defend themselves. To make headway in hedging violent video games to kids, it's easy to slap a violence rating on a game and make every retailer ask for ID to anyone buying the game than it is to perform intense psychological tests to see if that person understands the difference between reality and fantasy, and if they will or will not take cues from videogames.
When I'm a parent, I know my kid is going to be exposed to things I wouldn't, but I'm going to make sure they can put the things into the right perspective and let them make good decisions for themselves.
I put my Sony DRU-500A inside a Firewire/USB 2.0 enclosure from Cooldrives at this project page. I've had zero problems with it too, I bought a 3.5" Firewire/USB 2.0 enclosure for them for a hard drive too, the build quality sucked but that was my fault for cheaping out on the enclosure. They have Firewire 800 stuff to for the high-speed Firewire crowd.
My next enclosure, I'd go to them first, hands down.
Pretty soon I'm going to join the PVR crowd and Myth looks better and better in the fact it's flexible. Now that TiVo is bending over for movie and TV distributors, I like Myth even more.
The definition of irony is that it's created using contrasts between the apparent and intended meaning.
In the grandparent poster, the apparent meaning was that you play a game to steal and intended meaning was that you stole the game, very little constrast. Like I said, it's not irony because there is no difference.
If the apparent meaning was a game to be a good character where you had to not steal but the game was good enough where people wanted to steal it, then that's irony.
If you get it before the launch, then I'd say yes but since you have paid for it but simply didn't wait until the launch date, it won't kick up too much dust.
I think they'd be concerned more about their money than punishing a couple hundred paying customers for not waiting a few days till the game is officially released.
If the game was about trying to reform the main character away from robbing and stealing, then it would be irony. Since there is no relative constrast between the game plot and downloading leaked copies, this cannot be irony.
Sound pretty sure about the Yankee's, too sure methinks because you can't see the future.
The heartbreak won't be double at all, at least not to fans. If they lose, they would have come from behind and made it to game 7 and the better team won. That's a hell of a better outcome than forfeiting game 4. It's all a matter of perspective.
Boo Yankees, Sox have done everything to earn the win. They deserve to go down in the books as the first team to come back 0-3 for the series and win it all. Afterall, game 4 (or 5) broke the Yankee record that they never lost back-to-back extra inning games. The Red Sox deserve a win on many different levels.
you got me there, good differentiation.
I'd like to add something to what you said...
Jet engines are relatively inefficient at low speeds but once they get up to speed, the efficency goes back up and the process feeds on itself becoming a self-sustaining process.
Combustion engines are the opposite, they run fine at regular speeds but at high speeds, you get the same effect as the economic term "diminished returns" where it states that with additional units of work provide lesser and lesser additional power. In other words, it requires more and more work to achieve the same speed increase.
The only time I listened to Jay Leno was when he was talking about the difference when showing off his jet bike (a motorbike with a jet engine instead of combustion engine).
I agree, it's not some big conspiracy. That date has been set so that other arms of Valve and parent companies can cooperate for this release. Lots of money has been spent advertising that day as HL2 release date. Some game review sites have signed NDA with that date, not allowing them to release their reviews before then.
I don't see why people dislike Steam so much, it's so much better than the original interface. I like where Valve is going with Steam. The content delivery is nice and the idea of smaller updates the end user doesn't need to do anything for is so much better than the large updates. Everyone had to crowd Fileplanet (another piece of crap) and other sites and slow down file distribution for everyone.
I liked TDS when Kilborn was on it because I laughed at his outright narcissism, I didn't care about the jokes. He'd have a few minutes with a camera simply admiring his hair or things like that.
Since watching the CNN Crossfire with Stewart, that's the purest form of why I still like him, his sharp wit in taking control of a conversation with smart yet easy-to-follow statements.