Wikipedia:Reference desk/Archives/Computing/2006 September 23
< September 22 | Computing desk archive | September 24 > |
---|
| ||||||||
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions at one of the pages linked to above. | ||||||||
|
Lists of names for download
[edit]I understand Wikipedia has List of people by name, but is there anywhere where I can download a list of male names as well as last names? I am making an online football name and because I am not EA, I don't have a complete list, so I want to generate random names. Ladies' football won't be available, sorry. :-/
The problem with List of people by name is that it doesn't actually list first names and last names. I thought of grabbing each name and using a regular expression to separate them, and I have software to remove duplicates and manage the files. But my regular expression coding sucks, so I'd rather find some lists online.
If the lists could be separated by nationality, that would be great, too.
x42bn6 Talk 03:54, 23 September 2006 (UTC)
iPod rumours
[edit]I keep hearing these horrible rumours from people about my iPod nano, such as that it will break down after a million songs are played, or that it will explode if left in a certain degree of coldness. I have no way of knowing if these are true, or if my friends are simply attempting to scare me. Anyone have any input? Russian F 04:00, 23 September 2006 (UTC)
- A million songs ? At 3 minutes a song, that's 3 million minutes. Even figuring for continuous play, that would still be 5.7 years, by which time you will no doubt have bought the new nasally insertable iPod femto, which can store one trillion of your favorite songs. :-) StuRat 05:30, 23 September 2006 (UTC)
- Any flash memory based device will have a limited number of read/write cycles. None of the articles I've read around on wikipedia address this the issue very well. From what I've read, that number varies around 10,000 - 100,000 cycles. So yeah, your nano will break down eventually but that depends on your use. Let's say, on average, you listen to 9 songs a day and put 1 new song on it a day. That would mean your nano would last somewhere between 2.5 and 25 years(I'd shoot some around 10-15 years before it crapped out). If you want more accurate number(instead my postulation), I'd go check Apple's website.
- As far as the explosion thing, that's rubbish. There is nothing combustable on iPod Nano, and even if there was it would probably need a very hot sauce to ignite it. —Mitaphane talk 05:44, 23 September 2006 (UTC)
- Some thousand degrees for that good ol' anondized aluminum. — X [Mac Davis] (SUPERDESK|Help me improve)07:21, 23 September 2006 (UTC)
- Would this do it? --frothT C 20:50, 23 September 2006 (UTC)
- No, it's not rubbish; see our article on lithium-ion batteries: Lithium-ion batteries can easily rupture, ignite, or explode when exposed to high temperatures, or direct sunlight. Dysprosia 00:35, 24 September 2006 (UTC)
- AFAIK, there's no limit to the amount of read cycles on flash memory; the limit is only on the write cycles. There's also wear leveling, which helps increase the limit if you do not rewrite the whole memory all the time. So, even if it writes a counter every time a song is played, if it uses wear leveling, it should last for much longer than that.
- As to exploding, iPods (like almost every portable electronic device these days) use a lithium ion battery, which can explode if exposed to high temperatures or mistreated. (We seem to be missing an article on exploding battery.) --cesarb 14:26, 23 September 2006 (UTC)
ANSWERED -> Transfering Data From an Old Computer to a New One
[edit]I just recently bought a new computer to replace my old, outdated one. There are quite a few extremely important files and a couple of small programs stored on the old hard drive that I really need to transfer onto my new computer. It's not really much, under 100 meg. The problem is my old computer doesn't even have a CD burner, so I can't do it that way. I suppose another option would be to upload it all to my Yahoo account, and then download it all to my new computer. But with my dial-up access that would probably take an eternity.
I know that "technically" I can remove the hard drive from the old computer and install it into the new one temporarily and then just transfer everything I want. I'm pretty sure I know how to do that, but my experience has been that every time I've ever tried to do something like that, though I may solve one problem, I inevitably create like seven new ones, so I've learned my lesson and I don't dare fiddle around like that.
I've gone to a few computer shops asking how this is usually done. I had expected it to be a pretty simple matter since it seems that almost everyone replaces their old obsolete computers with new ones every several years or so, and that they'd have a pretty simple answer. The really strange thing though is that at every shop I went to all they had was the same blank stare in their faces as if I was asking them for the answer to the meaning of life. It's really weird. I would have thought this type of thing is done all the time, whenever someone buys a new computer. Doesn't everyone do this when they get a new computer? Isn't this a pretty routine thing to do? It really doesn't make any sense to me.
Does anyone have any comments or suggestions about the whole thing? Thanks. Loomis 04:44, 23 September 2006 (UTC)
- Yeah, that is odd. Any tech person worth a damn should be able to tell you how to do this in a couple of minutes. Since it sounds like you have reservations with cracking open your new computer, one way you can do this is buy a USB hard drive enclosure and put your old hard drive inside it. From there, you can plug it into your new computer's USB port. Not only will it transfer the data quickly, you can use the old hard drive for extra storage. Another way, if your new and old computer both have ethernet cards, is buy a Ethernet crossover cable and hook up the two computers together via their ethernet cards. Or, if your old computer has a USB port, a USB flash drive is good too, I just recently perchase a 1GB drive for $25. I'll let you decide the best options on your needs Mitaphane talk 05:12, 23 September 2006 (UTC)
- I agree with those options. Another is to set up a LAN so you can transfer files at will. You would need a network card or USB port on both computers to do that. StuRat 05:24, 23 September 2006 (UTC)
- A possible cause for the blank stares is that, in my experience, shop attendants are more and more often salespeople in stead of experts, a very regrettable development. Consumers are largely to blame for that, going for the cheapest seller, based on commercial blahblah. But not knowing how to install a harddisk is very extreme. This is a good way to find a good computer shop. Ignore the shouting high street shops and visit some small shops where they build computers themselves until you find one where you get some decent assistance and reward them by doing all your computer shoppping there in the future. That will in turn make them more helpful, etc etc. I make it a point to make friends with shopkeepers this way.
- As to the solution, this is a good opportunity to get to know the innards of your computer. Excepting Macs, computers are designed to be tinkered with. It is (always?) physically impossible to make damaging connections. Shut down the computer, open the case and look at how the present hard disks are connected (learning by example is another one of my favourites). Two complications. One is that there are three types of hard disks (excepting notebooks): ATA, SCSI and SATA. Look at the images to see what you have. SCSI is unlikely for a home computer. SATA is easy - just plug in (it's even hot pluggable, meaning you don't need to turn off the computer). But your old one will most probably be ATA, in which case you may have to fiddle with the jumpers. If there already is an IDE hd present, just one at the end of the cable, then you could connect your new one to the connector in the middle of the cable, with a jumper setting for 'slave' (should be shown on the hd or else in the manual). You could also connect it to the second connector on the mb (there usually are two), but you'll need a cable for that (no idea what they cost). In that case the jumper should be set to 'master' and the hd should be connected to the end of the cable (maybe that is no longer true, but it's better to be safe than sorry). Make sure to remember (write down!) what you have done. If it doesn't work, just reverse what you did and try another option. DirkvdM 08:32, 23 September 2006 (UTC)
- Laptops also are not made for easy maintenance. I disagree that changing hard disks is safe, as a stray static electricity spark from your finger can damage the circuitry. A more common problem might be bending the pins when installing the drive. Thus, if the asker is uncomfortable with changing the hard disk, we shouldn't force him to do so. StuRat 08:48, 23 September 2006 (UTC)
- I would never not force anyone to do anything (don't do unto others ... ). I've done that several times per day recently, because I'm rearranging my computers. Maybe I'm to dynamic a guy to be statically charged. :) Anyway, I've heard from people who should know that this static charge risk is very exaggerated. And one solution is to touch a radiator pipe or such just before you reach for anything in the computer. DirkvdM 09:17, 23 September 2006 (UTC)
- Manufacturers seem to go to great lengths to ship hard drives, Expansion cards, etc in static proof plastic ... it might be a genuine problem --frothT C 20:25, 23 September 2006 (UTC)
- Putting a product in a wrapper is hardly 'going to great lenghts'. And if you do so, you might as well use that anti-static stuff. If only to set the minds of people who heard this static story at rest. DirkvdM 06:50, 24 September 2006 (UTC)
Thanks again, for all the comments and suggestions. I've actualy found a guy who'll do the whole thing for me for $30, so the problem's solved and now it's all just academic. But of course I'm still curious. One of you guys remarked that I have reservations about cracking open my new computer. I'm actually more concerned with my old one, as I'd like to keep it in working condition as a spare. The thing is that it seems that the newer the computer is, the more "idiot proof" it tends to be. I look inside my new computer and I see everything neatly arranged, whereas when I look into my old one, it's just a spaghetti-like mess of wires criss-crossing each other, some of them plugged into certain things, and some of them just hanging loose plugged into nothing. What happens is that whenever I try to rearrange the hardware in any way, some plug doing God-knows-what ends up getting unplugged, and of course I have no idea where it got unplugged from, and as a result the whole computer just stops functioning, and I end up having to bring it to a tech specialist who'll probably charge me more to fix it than the whole computer is worth. But now, as I said, they seem to be far more idiot-proof, so perhaps the next time around, when I buy another computer to replace this one, I won't feel so worried about messing around with the hardware installed inside the tower. Thanks again to everyone, you've been of great help. Loomis 02:19, 24 September 2006 (UTC)
- Flash drive seems to be an easy way. --Proficient 06
- 18, 25 September 2006 (UTC)
ANSWERED -> I need programming help with a program on my TI-84 silver edition calculator
[edit]I'm trying to write a program for the quadratic formula, but it's not working properly:
I'm a Java programmer, so I know the concepts of programming. But not this particular programming language. So through trial and error, I have written this so far:
- 0→A
- 0→B
- 0→C
- Prompt A, B, C
- 0→X
- (-B+(sqrt(B² - (4AC)))/(2A))→ X
- 0→Y
- (-B-(sqrt(B² - (4AC)))/(2A))→ Y
- X
- Y
My first problem is that when I use example values when running the program (such as A=1, B=2, C=1, which is the polynomial x² + 2x + 1), it does two things.
First of all, it only returns one answer. Second, it returns -2.
So I have two problems, one is, I need to know how to make it display both roots. Second, I need to know how to make it display the correct roots. (-2 is obviously not a solution, since it evaluates to 1)
Help? It has stumped me. --Ķĩřβȳ♥ŤįɱéØ 08:11, 23 September 2006 (UTC)
- It appears that your parens don't divide -B by 2A. Fix that.
- There is sometimes only one root, when B² = 4AC. You can check for that in the program or just print out two identical answers. This is the case in your example.
- The roots are sometimes complex or imaginary, when B² < 4AC. Check for that and either print an error or add code to give imaginary and complex solutions.
- The quadratic formula can't be used if A = 0. Check for that and solve by other methods, if true.
- I would call the variables X1 and X2, not X and Y, that's confusing.
*It appears that your parens don't divide -B by 2A. Fix that. fixed.
*There is sometimes only one root, when B² = 4AC. You can check for that in the program or just print out two identical answers. This is the case in your example. I want both to be printed out.
*The roots are sometimes complex or imaginary, when B² < 4AC. Check for that and either print an error or add code to give imaginary and complex solutions. My calculator is already set to a+bi form, so this is not a problem.
*The quadratic formula can't be used if A = 0. Check for that and solve by other methods, if true. There's no reason to do so, because I'm only going to be using this program myself, and the scope of the program should only be quadratic equations.
*I would call the variables X1 and X2, not X and Y, that's confusing. I don't know how to do that. The closest I can get is Y1 and Y2.
And I still need to know how to print out both roots and not just one of them. Thanks for your help though. --Ķĩřβȳ♥ŤįɱéØ 09:31, 23 September 2006 (UTC)
- I was assuming that both the values you had called X and Y were printing out, but they were both the same. Is this incorrect ? Have you tested with a value that gives two different roots ? If so, I don't know specifically how to print two values, but can guess. If the display only has room for one value, then perhaps it prints the first value, then the second, so quickly that you can't see the first. Is there a "wait" function that can pause it for a couple seconds in between ? If not, perhaps it can wait until some input from you, before displaying the next result. We need a real expert on that particular calc here, I see. StuRat 10:34, 23 September 2006 (UTC)
- To print out a value, you need use the Disp function:
:Disp X :Disp Y
- Aside from fixing the low-level programming errors, it would be wise to fix the algorithm as well. As already advised, check that a is non-zero, and test the descriminant. But numerical robustness demands more. Quoting from the quadratic equation article:
- Assuming the discriminant, b2−4ac, is positive and b is nonzero, [a careful floating point computer implementation] will be something like the following.
- Here sgn(b) is the sign function, giving +1 if b is positive and −1 if b is negative; its use ensures that we always add two quantities of the same sign, avoiding catastrophic cancellation. The computation of r2 uses the fact that the product of the roots is c/a.
- Assuming the discriminant, b2−4ac, is positive and b is nonzero, [a careful floating point computer implementation] will be something like the following.
- To see why this matters consider (a,b,c) = (1.0,−10000.0,1.0). Then b2 is 100 000 000.0, 4ac is 4.0, and the descriminant, b2−4ac, is 99 999 996.0, with square root almost exactly equal to b. When the numerator takes the negative square root, the subtraction of large and nearly equal quantities in the familiar quadratic formula destroys almost all numerical significance in the result. --KSmrqT 18:53, 23 September 2006 (UTC)
Uh why did you erase my response, KSmrq? .... Annyway, read my response at that link, and also to address the concerns above (almost everyone is steering you wrong): You cannot arbitrarily name variables, you must use A-Z or Theta. Y1, Y2, etc are used to define functions that can be graphed or manipulated with the graphing functions. You don't need to worry about advanced algorithm concerns: at the very most, check if the descriminant is negative and print an error rather than having it print a cryptic answer in terms of i. To do this, do something like (I'll assume you're reasonably programming-intelligent):
:If (abs(D)=D) :Then :Disp "NEGATIVE","DISCRIMINANT" :Stop :End
Just put this somewhere before you take the square root of D. Good luck, and like a said, post on my talk page for help --frothT C 20:33, 23 September 2006 (UTC)
- I'm very familar with TI-BASIC. All you really need to write is:
:Prompt A,B,C :(-B+√(B²-4AC))/2A→X :(-B-√(B²-4AC))/2A→Y :Disp X,Y
- If there is no real answer, then you will get "ERR:NONREAL ANS ".
- You could also use:
:Prompt A,B,C :Disp (-B+√(B²-4AC))/2A :Disp (-B-√(B²-4AC))/2A
- and not even store the answer(s). This would make the program a bit smaller. --Yanwen 04:24, 24 September 2006 (UTC)
- Let's make it even smaller, shall we?
:Prompt A,B,C :√(B²-4AC) :Disp (-B+Ans)/2A,(-B-Ans))/2A
- I used to write a bunch of TI-BASIC programs. Nerd kid at my school, quite a few versions of the quadratic formula program, and a set of math utilities. But I use z88dk now to program my calculator. You could also drop a closing parenthesis, and it'll reduce the number of bytes as well, but that's considered really bad coding practice. Jdstroy 06:17, 24 September 2006 (UTC)
ANSWERED -> Firefox
[edit]How come Firefox has suddenly decided to display web pages (Wikipedia, BBC) incorrectly, as in it's only showing the bare bones. Is it not recognising css for some reason? How can I fix it? I have redownloaded Firefox but it still doesn't work properly.
IE is working fine. — Dunc|☺ 10:33, 23 September 2006 (UTC)
- Have you tried a reboot ? StuRat 10:36, 23 September 2006 (UTC)
- Yes. Didn't make a difference. — Dunc|☺ 10:43, 23 September 2006 (UTC)
- Did you try running it with a new profile (use
firefox -ProfileManager
to open the profile manager)? Usually firefox problems are tied to the profile, which isn't overwritten when you reinstall it. You can also try the safe mode (firefox -safe-mode
). --cesarb 14:11, 23 September 2006 (UTC)
- Yes, it's better now I've reset my profile. — Dunc|☺ 14:27, 23 September 2006 (UTC)
How does a processor work?
[edit]When it is working what is happening inside the processor?
Have you tried reading Wikipedia's CPU article? --Ukdan999 12:47, 23 September 2006 (UTC)
- It doesn't do a very good job of explaining how it actually does anything. See Sheffer stroke and Sole sufficient operator --frothT C 18:18, 23 September 2006 (UTC)
- I would start out with Logic_gates, and then look into Flip-flop_(electronics), and Clock_signal. A CPU is a collection of digital circuits which form many, many logic gates. Many of these gates are arranged in a configuration which can keep state (i.e. a flip-flop and its variants). "State" in this case means that the current electric configuration of the system is dependant on the current input as well as the previous input. For example, it is possible to arrange flip-flops in a chain and add logic which will cause the chain to "count" upwards (each flip-flop can have the state of either "on" or "off", which correspond to a 1 or 0, thus a series of them can be made to count in binary numbers). The clock is used to synchronize the action of all the components, i.e. all the circuits move "forward" one unit during each clock pulse. If one can get ones mind around the idea of digital circuits performing a simple "computation" like counting, it isnt too much of a reach to imagine a CPU as working in essentially the same manner, but much more complex. By adding more and more gates to the design, features such as a turing-complete instruction set, registers, random-access memory, caches, etc. are implemented. --65.105.3.194 18:33, 23 September 2006 (UTC)
- See also the articles at Category:Central processing unit. --cesarb 17:24, 24 September 2006 (UTC)
Globals as functions (C++)
[edit]Since functions are in global scope, would it be a bad thing to do something like:
string getABC() { return "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; }
instead of just puttng a string declaration outside of a function?
--frothT C 18:15, 23 September 2006 (UTC)
- The "bad" thing here in reference to scope would be that you're worried someone else may also define a function with the same name? There are differences between a function (which can cause symbol conflicts unless they are not exported from a module) and a constant, which would only cause a conflict if the header file was included, but why spend time thinking about this kind of minutia? C++ has features such as namespaces and the preprocessor which are very effective at resolving name conflicts. Use good naming conventions in your own code, and concentrate on getting the overall design correct instead of spending too long dwelling on trivial things.
- On the other hand, maybe you're referring to returning a std::string from a function which is automatically constructed from a const char *. In this case I'm not sure what "bad"ness you're referring to. Returning or declaring a variable of type const char * would be slightly more efficient, but would break binary compatibility later if you wanted to return a non-constant string.
- I'm referring to the convention of considering globals evil. --frothT C 20:17, 23 September 2006 (UTC)
- This refers to global variables, not constants. Global variables are to be avoided where possible because it is difficult to find all the pieces of code which read and modify them, thus making programs more brittle (resistant to change). A global function or constant is sometimes considered poor style because of name conflicts, but they are not neccessarily functionally wrong.
- There is also a performance issue. A constant embedded in a function won't be recognized by the compiler as a constant, which means that instead of the value being immediately fetched where you need it, a whole function call is added. If you were doing this in a time critical loop, all of these unnecessary function calls could slow down your program significantly. The real point of "const" values is to let the compiler know that it can optimize the code to take advantage of this fact. When you guarantee constness, there are all sorts of tweaks the compiler can make to speed up the implementation of your code. With a function encapsulating a constant, however, you've cut off that performance bonus.
- So, the code will still produce a correct result, but you've cut off one of C++'s big speed advantages. I would say that this is bad in general. The only time I'd think it was acceptable is if you believe that at some future time getABC will be changed into something that actually does a calculation. (In which case it's not really supposed to be a constant anyway.) - Rainwarrior 15:37, 27 September 2006 (UTC)
Normalising mp3s
[edit]Is it possible to normalise mp3s without a further loss in quality?
- Perhaps http://mp3gain.sourceforge.net/ would help?
- There is a linux program "normalize" that normalizes the sound levels in mp3's and ogg's. --Kainaw (talk) 00:37, 24 September 2006 (UTC)
- Peak normalisation or RMS normalisation is not nice. Better to use Replay Gain. --Kjoonlee 03:31, 25 September 2006 (UTC)