Wikipedia:Reference desk/Archives/Computing/2011 December 2

Computing desk
< December 1 << Nov | December | Jan >> December 3 >
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.


December 2

edit

Writing a program in C programming

edit

Please i really want to get started with writing programs in C programming and I want some one to help write a simple program that i can understand. By showing me how to write a C program that calculates the area of a triangle,circle and rectangle using Loop statementAlie44 (talk) 08:18, 2 December 2011 (UTC). — Preceding unsigned comment added by Alie44 (talkcontribs) 06:25, 2 December 2011 (UTC)[reply]

Google for "C programming tutorials" and that should help get you started. This sounds like a homework question to me, sorry if I'm wrong, but if it is, you'd be better off understanding how to write the simple program yourself. A good way to start is to write each step you want to do in plain language, and then translate that into the programming language. This will help you think about all the steps you do, sometimes subconsciously, when you solve a problem. That's a good start to learning to think like a programmer. Shadowjams (talk) 08:49, 2 December 2011 (UTC)[reply]
I suggest doing it step by step:
  1. Write a program that prints "Hello" and quits. Compile it. Run it. Fix problems. Recompile. Run again. etc...
  2. With that program, add a variable for something like width and give a value like 5. Print that value. Compile. Run. Fix. Compile. Run. Fix...
  3. With the program, add more variables. Give them all different values like 3, 4, and 5. Print the different values. Compile. Run. Fix. Compile. Fix. Fix. Compile. Run...
  4. Have it ask for the value of one of the variables and print what is submitted. Compile. Fix. Compile. Fix. Compile. Fix. Run...
  5. Have it ask for the value of all the variables and print them. Compile. Fix. Compile. Fix....
  6. Have it calculate the area of a triangle using the three variables and print that. Compile. Run. Fix. Compile. Run...
As you can see, C programming is not just sitting down and writing a program. It is writing a small little bit. Then, compiling it. Then, you write a little bit and compile that. It is silly (and a waste of time) to write a few thousand lines of code and then decide to compile and see if it works. -- kainaw 14:43, 2 December 2011 (UTC)[reply]
1. Write a program that prints "Hello" and quits.
Sacrilege! Everyone knows the first program has to write "Hello world". Mitch Ames (talk) 02:54, 3 December 2011 (UTC)[reply]
I'm a professional programmer and I personally don't know to calculate the area of these shapes using a loop. It's more like "1) what's the base? 2) what's the height? 3) the answer is 1/2 * base * height". No loops anywhere. --Sean 18:41, 2 December 2011 (UTC)[reply]
The assignment most likely is asking him to repeatedly ask the user for another set of data and show a new calculation until the user asks to stop. -- kainaw 19:21, 2 December 2011 (UTC)[reply]
TotoBaggins, You could iterate over one axis, and treat it like the area between two curves. However, It'd be weird to use an estimation technique for something that could be exactly solved much easier. APL (talk) 06:41, 3 December 2011 (UTC)[reply]

Adjustable mouse/keyboard macro

edit

Does anyone know of any software that can queue up a number of commands all at varying intervals? For example, "command 1" at five seconds from start, "command 2" 3 seconds later, "command 1" again 5 seconds later. Any help much appreciated! ScarianCall me Pat! 10:44, 2 December 2011 (UTC)[reply]

I think AutoHotkey can do this, but it's Windows only. I have some keyboards with hardware macro functionality, but they can't do delays. ~Alison C. (Crazytales) 16:28, 2 December 2011 (UTC)[reply]
DOS batch file acessing the DOS variable TIME. And a load of IF TIME == TIME 1,2,3 etc, GOTO COMMAND 1,2,3 etc?--92.25.106.108 (talk) 17:04, 2 December 2011 (UTC)[reply]
Run cmd.exe then write your batch program in Windows command line interpreter--92.25.106.108 (talk) 17:11, 2 December 2011 (UTC)[reply]
Run cmd.exe then type HELP AT. This will tell you how to run programs at specific times.--92.25.106.108 (talk) 17:33, 2 December 2011 (UTC)[reply]

FaIied Sound card

edit

I suddenly got a very loud tone out of my headphone output. Cant clear it by turning machine off and on. Is this a failed soundcard problem?--92.25.106.108 (talk) 14:47, 2 December 2011 (UTC)[reply]

Possibly, but first try plugging in a different headphone or speaker to isolate the problem.--Shantavira|feed me 16:48, 2 December 2011 (UTC)[reply]

Is there a Chrome Extension that keeps count of my keystrokes, etc.?

edit

I wonder how many keystrokes I have ever typed since I first got a computer. (But since I'll install said extension only once I know about it, I may have to calculate averages in order to do so. Hence, I'll need something that'll keep count from the day I install said extension.)

I also wonder my average and highest WPM, and other vital typing stats.

Is there an extension that does what I ask? Thanks. --129.130.217.33 (talk) 17:10, 2 December 2011 (UTC)[reply]

WhatPulse will keep count of keystrokes (and mouse clicks, and mouse distance moved), but I don't know of anything that tracks WPM. I just check my own typing speed on Type Racer every so often. Also, WhatPulse is a Windows app and not a Chrome extension. (I dont know why you want a Chrome extension, my typing is certainly not all in the browser because I make heavy use of IDEs and text editors.) ~Alison C. (Crazytales) 18:41, 2 December 2011 (UTC)[reply]
Allison, I really love WhatPulse; thanks a lot! As of now, I'm placing ~125,000th. Yourself? --70.179.174.101 (talk) 20:41, 3 December 2011 (UTC)[reply]
Alison - one L please. I no longer use WhatPulse because I only have Linux PCs and it's finicky to get working on them. ~Alison C. (Crazytales) 05:33, 4 December 2011 (UTC)[reply]

Bootable USB drive (DOS) is C: and does not see my hard drive.

edit

I created a bootable USB thumb drive. It boots into a crappy Windows 98 version of DOS. This is all I need.

However, I cannot find the computer's hard drive when booted into DOS via the thumb drive. It will recognize a: and d: (my floppy and CD, respectively), but the computer's hard drive, which is normally C:, does not appear, and the USB drive is labelled as C:.

How can I get DOS to mount the hard drive?

Thanks, Inasilentway (talk) 19:25, 2 December 2011 (UTC)[reply]

I've tried to use Mount.exe as per [1] but following their instructions, I keep getting the error message "partition table not found on hd(..)". Inasilentway (talk) 19:38, 2 December 2011 (UTC)[reply]
What format is the C drive? If it's NTFS, and we're really talking about DOS (MSDOS, PCDOS, DRDOS, FreeDOS) then that can't read NTFS. A recent-ish version of a bootable Linux dist like Knoppix or Ubuntu can be booted off a USB thumb drive and will read and write NTFS volumes. 2.122.75.79 (talk) 19:40, 2 December 2011 (UTC)[reply]
Hmmm, yes it is NTFS. Maybe I'll try one of those. Thanks! Inasilentway (talk) 19:41, 2 December 2011 (UTC)[reply]