Computing desk | ||
---|---|---|
< August 11 | << Jul | August | Sep >> | August 13 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
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)
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)
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:
#include <cstdlib> #include <iostream> 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:
Check to see if a is divisible by b. Please enter a. <Then you enter a number here.> Please enter b. <Then you enter another number here.>
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)
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)
ignore()
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 if(!cin) /*...*/
; I exited the program there, but you can use ignore()
instead. --Tardis (talk) 15:33, 12 August 2008 (UTC)while(true) /*...*/
. And if you really want a for loop, you can leave out expressions entirely and write for(int x=1;x<2;)
or even for(int x=1;;)
. --Tardis (talk) 15:35, 12 August 2008 (UTC)define forever=true;
and then in your code use for(ever;;)...
. -- kainaw™ 15:40, 12 August 2008 (UTC)
if ( b != a/m)
{
action1;
}
else if ( b == a/m )
{
action2;
}
else
{
action3;
}
int(a)
; 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 0.1*0.1!=0.01
. (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)Ok, upon all of your suggestions I have refined my program.
#include <cstdlib> #include <iostream> 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; }
Is there anything that should be changed about this one? Thanks, Ζρς ι'β' ¡hábleme! 18:51, 12 August 2008 (UTC)
cin >> a;
if (cin.fail())
{
cout << "Sorry, lousy input; enter an integer." << endl;
continue;
}
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, ARTYOM 03:11, 12 August 2008 (UTC)
I have this table:
tblLunch | |
Name | Food |
John | Bread |
John | Apple |
Tom | Bread |
Tom | Apple |
Tom | Steak |
Beth | Bread |
Beth | Apple |
Beth | Steak |
Beth | Beer |
Sue | Apple |
Albert | Steak |
How do I count each individual item and create a table like this.
tblFoods | ||||
Name | Bread | Apple | Steak | Beer |
John | 1 | 1 | ||
Tom | 1 | 1 | ||
Beth | 1 | 1 | 1 | 1 |
Sue | 1 | |||
Albert | 1 |
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)
The Crosstab function works like a charm.
TRANSFORM Count(tblLunchOrder.Food) AS FoodOfCount
SELECT tblLunchOrder.Name
FROM tblLunchOrder
GROUP BY tblLunchOrder.Name
PIVOT tblLunchOrder.Food;
I have to figure out the much more complex MySQL solution, though. -- Toytoy (talk) 08:38, 12 August 2008 (UTC)
This is for Microsoft Access:
SELECT tblLunchOrder.Name,
SUM(IIF(tblLunchOrder!Food="Apple",1,0)) AS Apple,
SUM(IIF(tblLunchOrder!Food="Beer",1,0)) AS Beer,
SUM(IIF(tblLunchOrder!Food="Bread",1,0)) AS Bread,
SUM(IIF(tblLunchOrder!Food="Steak",1,0)) AS Steak
FROM tblLunchOrder
GROUP BY tblLunchOrder.Name;
This is for MySQL:
SELECT tblLunchOrder.Name,
SUM(IF(tblLunchOrder.Food="Apple",1,0)) AS Apple,
SUM(IF(tblLunchOrder.Food="Beer",1,0)) AS Beer,
SUM(IF(tblLunchOrder.Food="Bread",1,0)) AS Bread,
SUM(IF(tblLunchOrder.Food="Steak",1,0)) AS Steak
FROM tblLunchOrder
GROUP BY tblLunchOrder.Name;
I wonder why you have to use "IIF
" in Access. If you're working on a complex project, this could kill you. -- Toytoy (talk) 23:29, 12 August 2008 (UTC)
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)
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)
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. NeonMerlin 14:45, 12 August 2008 (UTC)
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)
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)
was parasite eve one ever released in england on the playstation one 217.171.129.77 (talk) 19:40, 12 August 2008 (UTC)
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)