Jump to content

Wikipedia:Reference desk/Archives/Computing/2006 November 20

From Wikipedia, the free encyclopedia
Computing desk
< November 19 << Oct | November | Dec >> November 21 >
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.


November 20

[edit]

Beginner C ++ question

[edit]

Where do I write my code for C ++? Do I have to download some sort of software, or can I just do it in Notepad or something? Jamesino 02:15, 20 November 2006 (UTC)[reply]

You can generally code in anything you want, you can code in outlook if it pleases you, (not a good idea mind you, especially if you don't know how to turn auto correct off). Notepad is fine to start with but with a language like C++ you will need to put the code through a compiler before you can run it. That usually means renaming the file under some other type then .txt (if you're using windows anyway). There is a List of C++ compilers already here. Vespine 02:46, 20 November 2006 (UTC)[reply]
While I always use notepad-type programs, there are programs out there that change the color of identifiers etc as you type, which is probably useful for a beginner. --Wirbelwindヴィルヴェルヴィント (talk) 04:27, 20 November 2006 (UTC)[reply]
Visual C++ Express is now free, and it is compatible with C++. Netbeans also has a C++ add ons. These IDEs are very useful. deeptrivia (talk) 04:30, 20 November 2006 (UTC)[reply]

Dev C++ is good if you want an IDE, vim and gcc are better if you're just learning basics. --frothT C 18:06, 21 November 2006 (UTC)[reply]

I'm actually curious about this too: So you program, by typing all of those abbreviated commands, "if-then"s, etc. I get that. But then, isnt THAT what the computer decodes to execute whatever you wanted? clearly not...so what does a compiler do, transfer all this into 1's and 0's? I looked on the compiler page, nothing helpful about the practical side of it. 140.180.136.121 02:33, 25 November 2006 (UTC)[reply]



Here's what I hope is a gentle introduction...

You can type and save (hence, create) C code (or any other programming language I know of) using any text editor. It is best that it is a plain text editor. The differences between text editors is great, and goes far beyond an introductory discussion. I am careful not to say too much: this is the stuff of flame wars.

When saving a c source code file (what you typed), make sure it ends with a .c, e.g., "some_code.c". This may trick you in MS Windows if "Hide Common File Extensions" is turned on. I'm not at a Win machine right now, but it's a preference you can set without too much trouble. (If you do any development or are curious about the actual files on your computer, turn that off. It just complicates things, as it hides information about the files.)

You can then run your code (which, despite it ".c" ending, is still plain text, just like an HTML, XML, or any other "source code" file) through a compiler, which (assuming there are no compile-time errors) will generate executable files in machine code, the proverbial 0s and 1s, which are actually tiny switches that turn the circuits on and off in your computer. Your computer doesn't understand your source code.

(So why does a computer "run" code from interpretted languages like Ruby, Perl, Python or PHP, but not C? They, too, are "compiled", but this is typically done by their respective interpretters as they are being ran, so the scripter/user doesn't notice. However, for compiled languages like C/C++, you actually compile the code into an executable file, which is stored then ran. That file will only work on computers like yours: same processor and operating system. Different hardware and operating systems will interpret the 0s and 1s differently, which makes porting a faithful version of Internet Explorer to SuSe Linux difficult.)

So, for example, say you are on a Unix machine. I open up an editor I like called Vim. You can open up any text editor... Anyhow, save this code in a file called hello.c:

main(){ puts("Hello Kitty!"); return(0); }

Then, using the famous GNU compiler called GCC, type in the shell prompt "gcc code.c" (assuming you are on a Unix machine and are in the directory with the code.c file). It will output a file called "a.out". To run it (in Unix), type "./a.out". (The "./" means "in this directory, execute the following file:")

The principles carry over to other editors, compilers and operating systems. The are all independent: theoretically (without getting too technical), text editors produce the same thing, and theoretically (we could only wish) all compilers coule handle all standard C code by producing identical binary code.

This, of course, is full of generalities, and to make things worse, I'm not much of a c programmer, though I am a programmer. Cheers, good luck, and use whatever makes you comfortable until you are ready to try new tools.

Bryan

BTW, same principles apply to C++. Any compiler that works with C++ automatically works with C, since C is a subset of C++ (and is the predecessor of C++, as the name would imply).

Note

If you want to code in C++, you should save your files with a .cpp extension. The C++ code for the Hello world program is:

#include <iostream>
using namespace std;
int main()
{
cout<<"Hello World!";
return 0;
}

LestatdeLioncourt talk 17:17, 26 November 2006 (UTC)[reply]


How do people read using these large and wide screens?

[edit]

People prefer larger and larger PC screens and moreover, these days, they prefer wide screens. This definitely is ok for watching movies and checking mail. But is it good for people who use the PC only for reading news? Wont there be eye pain if we sit straight and move our eyes wide? Or I assume even if we turn our necks and read, there will be eye pain. Or am I wrong - ie. you may say 'we don't have eye pain reading for hours using large wide screens; May be you check a doctor'. Which is right? Don't you have problems reading with large wide screens?

Anyway, if you were to choose a laptop only for reading, which size would you prefer? And should it be wide screen?

It would be difficult to choose. I prefer two laptops, one with a small screen for better mobility, the other one with a large screen for normal times. Yao Ziyuan 15:24, 20 November 2006 (UTC)[reply]
It is rare to see someone read text on a wide screen in which the text is as wide as the wide screen. They normally open it in a window that is not the full width of the screen or, in the cases like CNN, the website is idiotically formatted so most of the screen is empty if you make it take up the full screen. As for eye pain, keep in mind that your eyes do not move steadily from left to right as you read. They jump. Also, I remember a study in which common eye pain was linked to muscle weakness and, with repeated excercises, the actions that created eye strain diminished and the people had better eyesight in the end. --Kainaw (talk) 19:41, 20 November 2006 (UTC)[reply]
A number of studies have examined optimal line width for reading ease. Often these are measured in words or characters per line. The results vary somewhat depending on the material and the audience. A good maximum is around 50 characters (11 words) per line, though shorter lines are preferred for younger readers. Good web designers incorporate this in their CSS, using the property max-width, where the width is given in "ems" so it scales with font size. Unfortunately, IE versions up through 6 do not support this property (unlike all the standards-compliant browsers out there), so a workaround is required. (Web designers spend a good proportion of their time working around IE bugs.)
Scrolling should be avoided as much as possible, especially horizontal scrolling. This is why it is important to use max-width rather than width. But it also means that sometimes it can be better to have wide text that fits on one screen rather than narrrow text that must be scrolled. Here is a university site discussing optimal web design, for those who want to learn more. Sun Microsystems also has a site on writing for the web that may be of interest. --KSmrqT 00:08, 21 November 2006 (UTC)[reply]
Although this is anecdotal evidence, I'll throw it in anyway... I have a 22" wide screen monitor and I only have my web broswer and documents open across part of the screen. Very very rarely do I ever have anything spanning across the whole screen. I use the sides of the screen that don't contain whatever I'm working on displaying other programs and various things like calendars, stock quotes, pictures, etc. which I want to have visible but don't keep a constant eye on. Dismas|(talk) 06:45, 21 November 2006 (UTC)[reply]

Here's a question. Is there a utility that will allow you to "maximise" your windows to a 4:3 or any other user-defined aspect ratio with one button click (instead of maximising to the full screen size)? This would leave e.g. the right-hand edge of the screen free on widescreen monitors. Zunaid©Please rate me at Editor Review! 07:27, 21 November 2006 (UTC)[reply]

In Linux, yes. My wide screen is pretty much double the width of a normal monitor. When I "maximize" an app, if it is on the left half of the screen, it fills up the entire left half of the screen. If it is on the right half of the screen, it fills up the entire right half of the screen. Basically, it is treated as two separate screens in "max window" mode, but I can drag windows anywhere I like in those imaginary two screens. --Kainaw (talk) 14:23, 21 November 2006 (UTC)[reply]

computer psu which trips main fusebox

[edit]

Hi, wondered if you guys could offer some thoughts on the following... I have just built my first PC. ordered all the bits off the web, put it together, turned it on - bingo. I put the WinXP cd in and it starts to format the hard drive. so far so good. at 66% complete, I figure it's safe to leave the room for a little while. I don't know what stage the install had got to but suddenly all the light go off in the house - something's tripped the main fusebox.

I narrow the problem down to the new PC. bit by bit I unplug things like the h/d, cdrom, floppy and eventually even the motherboard and it still trips the fusebox. Even with the psu completely unplugged from everything, as soon as I introduce the lead to the psu it trips the fusebox. The lead has a 5amp fuse in it and is borrowed from a working computer. the psu is 400w.

do you think it's a faulty psu? it was a cheap one from the web - the manufacturer is listed as 'various'. I've since tried the lead on another pc and that works fine.

what are the chances that my other components are ok? my fusebox is very sensitive and will trip when a lightbulb blows.

all suggestions/info/advice gratefully received.

16:00, 20 November 2006 (UTC)~

I would say you have narrowed the problem down to the (faulty) PSU. –mysid 17:37, 20 November 2006 (UTC)[reply]

The PSU is not necessaryily faulty -given that the fuse trips when a lightbulb blows your psu could trip it too. Some power supplies take a lot more power when you turn them on than when they are running - and require a soft start with relays gradually switching on the power. Question - is there an on/off switch on the psu - if you plug the psu into the mains with the switch on it will bypass any protective circuits built into the psu. To repeat:Though your psu may be faulty if the fuse trips when a bulb blows it's almost certainly going to go when you switch that thing on. consider getting one with a soft-start or bypassing the fusebox on switch on - it should be ok to switch the tripper back in when you've got it going..

if there's no manufacturers name at all on that psu i'd assume it's very dodgy.

I strongly advise that you DO NOT BYPASS THE MAINS TRIP SWITCHES while switching on your computer. While it could be a live to neutral short circuit causing your overload switch to trip, I'd expect such a PS unit problem to be smellable and audible. From what you describe, I'd bet heavily on the PSU causing your residual-current device on your main switchboard to trip. Possibly some isolation (air gap or plastic) inside the PSU broke down during the first run, and you now are dealing with an established chronic current leakage. I do not see how your peripherals, running on 5-12V DC, could be tripping your mains switchboard all the way backwards through the PSU. Whatever it turns out to be, you are describing a PSU failure, and the safest advice is to get a new or properly working one. As a separate issue, it sounds as if the mains circuit breaker is not quite what it should be any more - it seems overtly grouchy:) Seejyb 22:05, 20 November 2006 (UTC)[reply]

The power supply is one of the most important components of a computer system. It may not have the allure of a fancy CPU, but its capability, dependability, cooling, and noise will constantly affect you. Take this opportunity to replace that cheap unit with a quality PSU; you'll never regret it. You can survey a variety of choices, with user reviews, on Newegg's power supplies pages. --KSmrqT 00:19, 21 November 2006 (UTC)[reply]

thanks for the suggestions and help everyone.

Midsleading Google Results

[edit]

I searched for a free FTP client since I know there are a few around. The top Google result was SmartFTP and the snippet that google gives you from the website says that SmartFTP is free (it's not free and a 30-trial doesn't qualify as free in my book). I check the source code and found this. [crowd gasps and someone can be heard puking]

<meta name="description" content="Welcome to the home of SmartFTP, the free secure FTP client for Windows.">

Are they deliberately misleading us? Are they misleading Google also, or are they in on it? --Username132 (talk) 22:42, 20 November 2006 (UTC)[reply]

From my reading of their license agreement and the information on their purchase page, I think you may be confused. For private, non-commercial use, apparently no payment is required. Some firms do advertise "free download" for shareware, then insist on paid registration; that is deceptive, this does not seem to be. They say the version you download is not crippled, nor does it demand money. I have not personally used this product, but it sounds "free" (as in "free beer") to me. --KSmrqT 00:51, 21 November 2006 (UTC)[reply]
A lot of software are free only for personal home use. SmartFTP is simply one of them. --Wirbelwindヴィルヴェルヴィント (talk) 01:17, 21 November 2006 (UTC)[reply]
BTW, did you pick a nice client? I heard FileZilla's pretty nice. --Kjoonlee 05:24, 21 November 2006 (UTC)[reply]
FireFTP extension is good too --frothT C 18:01, 21 November 2006 (UTC)[reply]

Click tracker

[edit]

I have heard of click trackers and how spyware, malware, etc. can read a computer's site visits, also to enable parents to see where on the Internet their children have been. I am looking for a free program that I can use on my own computer to eliminate past clickage; is there something available? 23:07, 20 November 2006 (UTC)

To eliminate traces of your web surfing on your PC (I'm emphasising this because some websites track your movements through their site, there is very little you can do about that) you have to clear your internet history. The exact procedure depends on your browser, but in Internet Explorer, Tools -> Internet Options, and then clear both the cache ("Delete Files..." button) and history ("Clear History") button. Other browsers will have similar features. Also, make sure you have scanned your PC for spyware or viruses, some of the more malicious ones may be able to track your usage history. Hope this helps! — QuantumEleven 10:30, 21 November 2006 (UTC)[reply]
To add to the above: assuming you do not have a concealed keylogging spy program on your machine, and assuming you are using Windows: Microsoft has configured Windows to save the same information in protected files called "index.dat ", which is found in a number of different directories. If you install a freeware program such as Index.dat Suite(from the Ur I.T. Mate Group in the UK) you can view the content of these files, and delete that information altogether. This specific program is but one of many available which does this. Without such a program, or some nifty DOS or NTFS manipulating, you cannot remove these files. This mean that normally a person who know where to look can trace your browsing history in spite of your having removed the history, cookies and cache files using your browser commands. Removing a "valid" keylogger, i.e. one which has been installed, configured and password protected by an administrator, snooping boyfriend or parent requires removal specific to the product - including knowledge of the password used. Seejyb 14:52, 21 November 2006 (UTC)[reply]

Photoshop, games...

[edit]

What computing language (C++, Java, Visual Basics, etc...) are applications such as Adobe Photoshop and modern top-tier games (such as World of Warcraft) coded with? Jamesino 23:17, 20 November 2006 (UTC)[reply]

According to this list, most major commercial applications seem to be developed in C++. --24.147.86.187 02:52, 21 November 2006 (UTC)[reply]
In addition to the stuff with hard-time requirements (graphics, sound, networking, physics) there's quite a lot of stuff (which implements what you're call the game, as opposed to the engine). Frequently this isn't in C/C++, but is instead in a rather more featureful (if rather slower) language. Vampire: The Masquerade's game code is written in Java, Psychonauts and Far Cry in Lua, and some games or game engines have their own domain-specific language (Quake had QuakeC, the Unreal engine has UnrealScript). Some things are implemented in both - for example for AI you'd have the higher level behavioural stuff in the scripting language, but stuff that needs close and fast access to the game's physical data (particularly stuff like path-finding) would still be in the game's "native" language. -- Finlay McWalter | Talk 23:43, 21 November 2006 (UTC)[reply]
Usually C++, though some big applications even go as far as assembly code, sometimes. x42bn6 Talk 00:30, 22 November 2006 (UTC)[reply]

RTFM

[edit]

I ran across this piece advice in Wikipedia itself: RTFM. I thought you might find it amusing, if nothing else.  The Transhumanist 00:51, 21 November 2006 (UTC)[reply]

RTFM is a fairly common term; I hear it in IRC all the time. --Wirbelwindヴィルヴェルヴィント (talk) 01:15, 21 November 2006 (UTC)[reply]
I've heard it from our physics teacher. –mysid 12:42, 21 November 2006 (UTC)[reply]
When I first learned to program in the 70s, if I asked anyone a question, the first response was RTFM. The only way to get an answer was to say something like "On page 73 of the manual, it claims.... but I need to know...." So, RTFM has been around for a very long time. --Kainaw (talk) 14:26, 21 November 2006 (UTC)[reply]
That's still the way it is, we're just really nice at the RD :) --frothT C 18:02, 21 November 2006 (UTC)[reply]
We're exquisitely nice; but if someone asks us to define a "frob" and we have a frob article, chances are we will (politely) suggest reading the (fabulous) Wikipedia. :-D --KSmrqT 21:43, 21 November 2006 (UTC)[reply]

Google searches

[edit]

Is there a way to see if there is a Wiki-effect on Google similar to something being Slashdotted? By that I mean, is there a way to see if people searching for the Colbert video went up after the article about it appeared on the main page? Dismas|(talk) 08:17, 21 November 2006 (UTC)[reply]

Google Trends http://www.google.com/trends --Kjoonlee 09:06, 21 November 2006 (UTC)[reply]
Well, that will work if I remember to investigate this in a few months since there's a few months worth of lag to those stats. Dismas|(talk) 13:18, 21 November 2006 (UTC)[reply]

Hard hyphen in LaTeX

[edit]

I'm typing a LaTeX document including some article numbers, which in turn contains hyphens. I don't want line breaks within these, but unfortunately, they break. How can I stop this from happening? 62.119.184.141 10:02, 21 November 2006 (UTC)[reply]

Putting the word within \mbox{} seems to do the trick. ;-) 62.119.184.141 11:19, 21 November 2006 (UTC)[reply]
There is also \nolinebreak, but for several hyphens that would become rather tedious. --Tardis 15:29, 21 November 2006 (UTC)[reply]
Use a tie. blah-~blah will show up as "blah-blah", but will never break over a new line.

Fun with Google

[edit]

At the moment, if you enter the word "fuckwit" into Google and hit "I'm feeling lucky", you get taken to the official UK government's webpage on the Deputy Prime Minister, John Prescott. I think this is pretty funny, but someone has obviously has engineered it. How? --Richardrj talk email 10:11, 21 November 2006 (UTC)[reply]

How very pleasant. Yes, this was most likely on purpose, it's called a Google bomb. — QuantumEleven 10:26, 21 November 2006 (UTC)[reply]
The other famous one is put in 'failure' and you get taken directly to the offical White House page on George W. Bush. :) Vespine 23:26, 21 November 2006 (UTC)[reply]
See there. InXistant 19:02, 23 November 2006 (UTC)[reply]

Which mobile would you prefer out of these?

[edit]

Imagine you are given a choice to choose a cell phone and if all of these mobiles cost the same, which one do you choose? 1) 2.5 inch blackberry type screen 2) 3 inch blackberry type screen 3) 3.5 PDA type screen 4) 4 inch screen 5) 5 inch screen 6) 6 inch screen 7) 7 inch ultra mobile type screen. Note here that, if you are a mobile person, you may want a small screen fitting to your mobility needs. But if you dont mind carrying 7 inch screens around the world, no problem! Also tell me why you have chosen your choice. Generelly, tell me what do you think people would do if given a choice apart from the choice of yours!

Is this some kind of market research? –mysid 12:38, 21 November 2006 (UTC)[reply]
I don't mind carrying seven inches around ... oh, I can't do it. Proto::type 16:40, 21 November 2006 (UTC)[reply]