Wikipedia:Reference desk/Archives/Computing/2008 August 12

= August 12 =

What's happening with my mouse?
On my iBook, if I put one finger on my mousepad and then move another finger over it extremely closely (but not actually touching), the pointer moves (erraticaly), even though the moving finger is not actually touching it. What is it picking up? It works if I use two hands, too. (You can tell I have a lot of free time at work!)--ChokinBako (talk) 00:13, 12 August 2008 (UTC)
 * Touchpad has some details on how your touchpad works. Basically, it doesn't understand how to deal with two inputs at a time so causing it to freak out. :~) ---J.S (T/C/WRE) 00:41, 12 August 2008 (UTC)
 * Some touchpads are more sensitive than others (I think you can adjust that), and that causes some to react to a finger that is not actually touching it. I had the same on my older laptop. But I never had any issues because of that... Maybe because I was mostly using an external mouse :)   A R  TYOM   03:14, 12 August 2008 (UTC)

A mac is generally able to cope with two fingers, hence the two fingered scroll and right click functions. Maybe to do with ambiguity as to whether there are one or two fingers on it?84.13.79.246 (talk) 15:08, 12 August 2008 (UTC)
 * Another interesting thing to do, is to put two or more drops of water on your touch pad, the same type of thing will happen. Mac Davis (talk) 04:15, 14 August 2008 (UTC)


 * No, this is a bug. Buy a Windows PC. :) jdstroy (talk) 22:26, 14 August 2008 (UTC)

Odd output of a C++ program
So, I have been dabbling in C++ a bit lately and have written a program to check if one number is wholly divisible by another. Here is the source code:  using namespace std; int main {   system("title Divisibility Check"); for( int x = 1; x < 2; x)   { float a;        int b;         int m;         cout << "Check to see if a is divisible by b." << endl; cout << "Please enter a." << endl; cin >> a;        cout << "Please enter b." << endl; cin >> m;        b = int(a)/m; if ( a/m != b)        { cout << endl << a << " is not divisible by " << m << "." << endl << endl; }        else if ( b = a/m ) {             cout << endl << a << " is divisible by " << m << "." << endl << endl; }        else {             cout << "Sorry, that input is not valid." << endl; }   }    system("pause"); return 0; } After compilation, when the program is run, this is what it says:
 * 1) include
 * 2) include

 Check to see if a is divisible by b. Please enter a.  Please enter b.   If I enter anything other than a number, the program freaks out and starts to reiterate the previous output in an infinite loop. I realize that a letter is not of type float or int, but why will this not just direct the program to the else loop? How can I fix this behavior? Thanks, Ζρς ι'β' ¡hábleme! 02:15, 12 August 2008 (UTC)


 * for( int x = 1; x < 2; x)

Should this perhaps be "for( int x = 1; x < 2; x++)"? Otherwise the condition x < 2 will always be true. Gyroggearloose (talk) 02:31, 12 August 2008 (UTC)


 * No, I want it to be perpetually true. This way, multiple divisibility checks can be preformed without repeatedly restarting the program.  If I wanted it only to run once, I would omit the for loop entirely. Ζρς ι'β' ¡hábleme! 02:39, 12 August 2008 (UTC)


 * What you are seeing is normal. It is a bad practice to scan the input buffer and expect it to be a number.  To be general to the point of not being exactly correct... you have something like "10\n" in the input buffer.  The \n signifies that you hit the enter key.  You ask for a number.  You get a 10 and it clears the trailing enter key.  Now, you do it again with "hello\n".  It doesn't see a number, so it leaves the buffer there.  Then, it looks again.  No number still.  It looks again.  Still no number.  It looks again.  Still no number.  If this was a buffer that changed over time, it may turn into a number at some point, but the keyboard buffer doesn't change until you flush it in some way.
 * OK - that is a pain. What are you supposed to do?  Make a temporary string/char* variable.  Scan the input into that variable.  Then convert the string to a number (if possible) or tell the user that the number keys are above the letter keys. -- k a i n a w &trade; 02:50, 12 August 2008 (UTC)


 * Ahh, too true. I looked at it too early in the morning I guess :)
 * BTW, "else if ( b = a/m )" should probably be "else if ( b == a/m )" or else b gets assigned the result of a/m instead of being compared to it. Gyroggearloose (talk) 03:05, 12 August 2008 (UTC)


 * There are also the iostream  methods, which allow you to clear the "keyboard" buffer if it contains things that you don't want.  It's a shame that these routines are not usually included early on in courses or books on the subject; in my early C++ programs I knew only how to abort the program whenever something bad was entered!  You can test whether something bad was entered with  ; I exited the program there, but you can use   instead.  --Tardis (talk) 15:33, 12 August 2008 (UTC)


 * If you want something to loop forever, just say .  And if you really want a for loop, you can leave out expressions entirely and write   or even  . --Tardis (talk) 15:35, 12 August 2008 (UTC)


 * Or, you can be super cool with something like:  and then in your code use  . -- k a i <font color='#660099'>n <font color='#3300cc'>a <font color='#0000ff'>w &trade; 15:40, 12 August 2008 (UTC)


 * Well, hang on anyway. Even with the typo corrected, look at this:


 * There's no way action3 gets executed. Either b != a/m or b == a/m; there's not a third choice. (See law of the excluded middle.) If you get to that first "else", you know for certain that b == a/m. --jpgordon&#8711;&#8710;&#8711;&#8710; 03:17, 12 August 2008 (UTC)
 * Surprisingly, in some contexts (though I doubt it here) it would be possible for the third branch to be taken; for instance, IEEE extended precision can cause a conditional to have one value and then invisibly change to another value when one of the operands got rounded down to <tt>double</tt> precision. Not to mention things like NaN&hellip;  --Tardis (talk) 15:33, 12 August 2008 (UTC)


 * It's not your question, but your variable types and names and logic are somewhere between iffy and wrong. You prompt for b and then read in m, which just confuses the reader.  You read a as a <tt>float</tt>, but then calculate b from  ; I suppose it's true that no non-integer is divisible by any integer, but it's still bizarre.  Finally, although I haven't found a counterexample for operations this simple, it's in general a bad idea to test for equality with floating-point numbers; for example, often  .  (See also my above comment about surprises in floating-point comparisons.)  What you want is just integers and the modulo operation.  --Tardis (talk) 15:33, 12 August 2008 (UTC)


 * One minor point : You picked a very confusing way to do a while(true) loop. Using a for loop where you intend an infinite loop makes it look as though you've made an error.  APL (talk) 15:20, 12 August 2008 (UTC)

Ok, upon all of your suggestions I have refined my program. <tt> using namespace std; int main {   system("title Divisibility Check"); while(true) {        int a;         int b;         cout << "Check to see if a is divisible by b." << endl; cout << "Please enter a." << endl; cin >> a;        cout << "Please enter b." << endl; cin >> b;        if ( a % b != 0 ) {             cout << endl << a << " is not divisible by " << b << "." << endl << endl; }        else if ( a % b == 0 ) {             cout << endl << a << " is divisible by " << b << "." << endl << endl; }        else {             cout << "Sorry, that input is not valid." << endl; }   }    system("pause"); return 0; } </tt> Is there anything that should be changed about this one? Thanks, Ζρς ι'β' ¡hábleme! 18:51, 12 August 2008 (UTC)
 * 1) include
 * 2) include
 * Yeah. There's no way for the "Sorry that input is not valid" branch to be taken. As above, either (a % b == 0), or (a % b != 0). There's no third choice. And this version will still loop forever on invalid input. cin >> a won't change the value of a if the input isn't an integer; you need to add some error checking. You might say:


 * I'm not sure why the <tt>system("pause")</tt> is there, either. --jpgordon&#8711;&#8710;&#8711;&#8710; 21:06, 12 August 2008 (UTC)

Capturing MiniDV tapes to a PC
Hello. I am trying to capture my MiniDV tapes to my computer, with the purpose of burning them to a DVD later. I do not want to reduce the quality while capturing, and just capture the whole thing in AVI format. I have heard that the best way to do that is to split the video into pieces, 10 minutes or so each, to avoid one huge one-hour video file weighing about 12 GB. I tried using Pinnacle Studio for this, but it turned out to do a pretty horrible job. When I try to capture the tape by 10-minute fragments (i.e. tell it to stop capturing after 10 minutes), it loses a couple of seconds between the pieces: after one piece is saved and I start capturing the next 10-minute piece, the video starts playing and the capturing begins with a 2-second or so delay. Besides, the video files are not exactly 10 minutes, but are 2-3 seconds over.

Windows Movie Maker seems to be able to do the capturing, but I couldn't find an option to split the output into several pieces, and I don't really think WMM would do a better job than Pinnacle.

Anyway, I was wondering what other program I can use to do the capturing the best way? Thanks, <span style="background:black;font-family:Palatino Linotype,serif;">  A R  TYOM   03:11, 12 August 2008 (UTC)


 * Would'nt it be easier capturing that one (12 or so GB) file, and then cutting it to pieces? (It would require disk space). -Yyy (talk) 10:57, 12 August 2008 (UTC)
 * Yes, but wouldn't it require more computer performance to capture the whole tape at once? That's what happened to Pinnacle - it just stopped capturing about halfway through the tape and froze. It only unfroze when the tape ended, and it turned out that nothing was captured when Pinnacle was "frozen".
 * P.S. I have quite a powerful computer, so that shouldn't be the case. <span style="background:black;font-family:Palatino Linotype,serif;">  A R  TYOM   17:13, 12 August 2008 (UTC)

(SQL) How to count each individual items?
I have this table:

How do I count each individual item and create a table like this.

I don't need the exact codes. I only need some guidance, such as a cookbook entry so I can solve the problem. -- Toytoy (talk) 04:15, 12 August 2008 (UTC)


 * If you're using Microsoft Access, you would use a crosstab query, making "Name" the row heading (under "Crosstab", in Access 2007) and "Food" the column heading. Add either column to the query again and make it the "Value", and change the "Total" field to "Count". Among database environments the ease of producing a crosstab will vary considerably; you may have to use programming or trick layers of SQL statements into doing it. For MySQL, for example, I found stuff like and . But in Access it's easy. Whiskeydog (talk) 04:31, 12 August 2008 (UTC)


 * You'll be using "GROUP BY" I should think, and "COUNT" to count entries. —Preceding unsigned comment added by 78.86.164.115 (talk) 07:34, 12 August 2008 (UTC)

The Crosstab function works like a charm.


 * http://img181.imageshack.us/img181/9523/crosstabmc8.gif

I have to figure out the much more complex MySQL solution, though. -- Toytoy (talk) 08:38, 12 August 2008 (UTC)


 * You can get one column using "select Name, count(*) as Bread from tblLunch where Food='bread' group by Name". You can get another column with "select Name, count(*) as Apple from tblLunch where Food='Apple' group by Name".  Now, if joined those two, you would get "select Name, Bread, Apple from (select Name, count(*) as Bread from tblLunch where Food='bread' group by Name) a join (select Name, count(*) as Apple from tblLunch where Food='Apple' group by Name) b on a.Name=b.Name".  Expand that to every column you need. -- <font color='#ff0000'>k <font color='#cc0033'>a <font color='#990066'>i <font color='#660099'>n <font color='#3300cc'>a <font color='#0000ff'>w &trade; 15:22, 12 August 2008 (UTC)

This is for Microsoft Access:

This is for MySQL:

I wonder why you have to use " " in Access. If you're working on a complex project, this could kill you. -- Toytoy (talk) 23:29, 12 August 2008 (UTC)


 * You should definitely use the cross-tab query if you are doing it in Access. IIF is extremely slow. --98.217.8.46 (talk) 14:55, 13 August 2008 (UTC)

Auto CAD Like Software For Linux?
I don't know of any free or good autoCAD programs for Linux, unfortunately. One that I have found for Linux don't do 3D either...which is what I need. Let me know if you know some!Mr.K. (talk) 10:34, 12 August 2008 (UTC)
 * Qcad or Pythoncad maybe. I have no experience with either, so I do not know how close to AutoCAD they are.  Another option is to run autocad using WINE or Virtualbox. ---J.S  (T/C/WRE) 18:46, 13 August 2008 (UTC)


 * Qcad is unfortunately only 2d. I´ll give pythonCAD a try. —Preceding unsigned comment added by Mr.K. (talk • contribs) 12:04, 14 August 2008 (UTC)


 * Also give BRL-CAD a try. —Preceding unsigned comment added by 80.31.94.42 (talk) 17:27, 14 August 2008 (UTC)

Firefox 3 for Mac: tabs keep losing focus
My copy of Firefox 3 for Mac is acting up; every so often, tabs keep losing focus when I switch between them using the keyboard (Cmd-Shift-[ & Cmd-Shift-])—the computer will "beep" and refuse to cycle through the tabs further. I have to either click on another tab or press Ctrl-Tab to cycle through tabs properly again.

I've also used the Windows and Linux versions of Firefox (under Windows XP SP2 and Ubuntu 8.04 LTS respectively) and neither of them seem to have this problem at all. The Mac I'm using is a 20-inch iMac with a 2.4GHz "Penryn" Core 2 Duo processor, running Mac OS X "Leopard" v10.5.2.

This bug is driving me up the wall; any suggestions on how to fix it? Google has failed me. (And before anyone suggests "use Safari", I'd rather not, except as a last resort; Safari's a little too basic for my tastes.) --CalusReyma (talk) 12:18, 12 August 2008 (UTC)


 * File a bug report and use Opera until they fix it... :P -59.95.110.65 (talk) 07:23, 13 August 2008 (UTC)


 * Can I suggest you to file a bug report and use Exposé (Mac OS X) till then (I believe the default is the F10 key). By the way, I believe Leopard is now up to 10.5.4. Any reason for not upgrading? Kushal (talk) 15:30, 13 August 2008 (UTC)
 * Hmm... the problem appears to have been fixed in the latest Minefield builds, so I guess I'll just have to wait until Firefox 3.1 comes out and use Minefield in the meantime.
 * Oh, and Kushal, I haven't upgraded to 10.5.4 yet simply because I haven't got around to it; I need to back up my data first, lest something goes awry with the update. Better safe than sorry, after all... --CalusReyma (talk) 11:08, 14 August 2008 (UTC)

Merging HTML documents
What's the easiest way to merge a whole bunch of HTML documents? The ideal program would combine the contents of the BODY and STYLE tags, merge all classes that had the same name and same style rules, rename all classes that had duplicate names and different style rules, rename all duplicate IDs and NAMEs, and consolidate the image folders. I can use either Windows XP Pro or Kubuntu Hardy Heron, but I have no budget. Neon Merlin  14:45, 12 August 2008 (UTC)

Installing Windows XP without CD-rom
I don´t have a CDROM on my laptop, and I am trying to install Windows XP on it. I´ve made a partition with GParted, formated it using a boot diskette with Windows 98 and copied all installation files into a second partition. I am able to access both partitions and start the installation, but after I have copied all files and need to reboot the computer, I keep receiving a message "file abc is missing". What went wrong? —Preceding unsigned comment added by Mr.K. (talk • contribs) 17:23, 12 August 2008 (UTC)
 * There is no way, buy an external CD Drive and do it that way. <font style="font-family: Papyrus, sans-serif"> Rgoodermote Not an admin  00:40, 13 August 2008 (UTC)


 * Of course there's a way. PXE/network boot. —Preceding unsigned comment added by 218.215.72.168 (talk) 07:24, 13 August 2008 (UTC)


 * VirtualBox? :P ---J.S (T/C/WRE) 18:41, 13 August 2008 (UTC)


 * Done this before; you do need to copy all files from the CD. I was able to do it, and I was even able to convert the FAT32 partition to a NTFS partition.  As for what you're doing wrong, well, your copy didn't include everything if you were able to run setup and it fails with this message.  Did you run winnt.exe to start setup? jdstroy (talk) 22:13, 14 August 2008 (UTC)

CPU
What are the advantages and disadvantages of having a 64 bit CPU (such as the Turion 64 which is built with the x86-64 instruction set) which is able to execute the x86 instruction set as compared to having a 32 bit x86 CPU? How will speed and compatibility vary? Thanks, Ζρς ι'β' ¡hábleme! 19:04, 12 August 2008 (UTC)


 * See 64-bit. -- <font color='#ff0000'>k <font color='#cc0033'>a <font color='#990066'>i <font color='#660099'>n <font color='#3300cc'>a <font color='#0000ff'>w &trade; 19:15, 12 August 2008 (UTC)


 * That whole section looks like a mess of unsourced opinion and original research to me. I'm inclined to delete most or all of it. Here's my own unsourced opinion and original research: there's no disadvantage (aside from price) to getting an x86-64 CPU, since it will run x86 software just fine. If you actually want to use the 64-bit features you'll have to switch to a 64-bit OS, which will involve the usual OS-switching headaches. A 64-bit version of a program may be faster or slower than a 32-bit version. Going from 32 bits to 64 bits tends to make things slower, because all those 64-bit pointers have to be stored somewhere and RAM doesn't suddenly double in speed. However x86-64 has far more CPU registers than x86, which I think significantly improves performance. (This has nothing to do with being 64-bit as such, it's just a difference between the instruction sets.) Applications for which 64-bit arithmetic is a bottleneck will also benefit, but I think those are relatively rare. -- BenRG (talk) 23:55, 13 August 2008 (UTC)

parasite eve one
was parasite eve one ever released in england on the playstation one 217.171.129.77 (talk) 19:40, 12 August 2008 (UTC)
 * Wrong place but I shall answer. No it was never released in Europe. <font style="font-family: Papyrus, sans-serif"> Rgoodermote Not an admin  00:36, 13 August 2008 (UTC)

Default Font-Size on a Macintosh?
Hello - So I recently have been going nuts trying to figure out why this one web design project wouldn't display correctly on one of my co-workers' computers. I finally figured it out; he uses a Macintosh, and the default font size in both Firefox 3 and Safari seems to have been set to 12 px/pt. This is actually a big deal when you're designing with relative units (as I was).

So my question is: how common is this? Would anyone using a Mac be willing to check for me what their default font size is set to? (You can do so on Firefox 3 by going to Firefox -> Preferences; it's under the Content tab. In Safari, it's Safari->Preferences, under the Appearance tab. I have no clue how to find this out in IE for the Mac). Please let me know. It seems like a small thing, but it's actually a, uh, relatively big deal when you're trying to design accessible websites. Thanks! --Brasswatchman (talk) 22:54, 12 August 2008 (UTC)


 * On my Mac the standard font is Times 16 and fixed-width is Courier 13. To the best of my recollection I never changed that, so it may be "factory setting".  I use Mac OS X 10.4.11.  PS: Safari...  --Cookatoo.ergo.ZooM (talk) 23:21, 12 August 2008 (UTC)
 * Both Safari and Firefox on my Mac have Times 16 and Courier 13 as the default size. <font color="#445599">J <font color="#44AA66">kasd  00:02, 13 August 2008 (UTC)


 * Why is it a big deal? Just set the default font size for your page in the BODY tag, and then everything will be relative to that. It won't keep people from resizing or decreasing the size if they need to. --98.217.8.46 (talk) 00:36, 13 August 2008 (UTC)


 * Trick is, I'm not sure if that's true. I had some trouble resizing with a default font size set in IE 6. (Which, argh, yes, I still have to support, unfortunately). So I'm going to have to figure out something else. Anyway, thanks, everyone. Really appreciate the help. --Brasswatchman (talk) 13:13, 13 August 2008 (UTC)


 * Well, IE6 is IE6. There's only so much back-bending you can do. Personally I would assume—perhaps erroneously, but who knows—that if someone is currently on the web and needs the easy capability to enlarge site content, that they have switched from IE6 long ago, because it utterly fails at this in many instances with CSS. That is, yours would not be the first site they'd come across that wouldn't support that, with IE6. (I often use the "first site" rule myself to determine whether it is worth bending over backwards to cater to specific, non-fatal browser deficiencies.) --98.217.8.46 (talk) 14:49, 13 August 2008 (UTC)


 * Use EMs, not pixels. 24.76.161.28 (talk) 07:29, 14 August 2008 (UTC)