Jump to content

Wikipedia:Reference desk/Computing

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 169.231.8.73 (talk) at 21:59, 20 October 2012 (VERY basic C Questions I can't find online!). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Welcome to the computing section
of the Wikipedia reference desk.
Select a section:
Want a faster answer?

Main page: Help searching Wikipedia

   

How can I get my question answered?

  • Select the section of the desk that best fits the general topic of your question (see the navigation column to the right).
  • Post your question to only one section, providing a short header that gives the topic of your question.
  • Type '~~~~' (that is, four tilde characters) at the end – this signs and dates your contribution so we know who wrote what and when.
  • Don't post personal contact information – it will be removed. Any answers will be provided here.
  • Please be as specific as possible, and include all relevant context – the usefulness of answers may depend on the context.
  • Note:
    • We don't answer (and may remove) questions that require medical diagnosis or legal advice.
    • We don't answer requests for opinions, predictions or debate.
    • We don't do your homework for you, though we'll help you past the stuck point.
    • We don't conduct original research or provide a free source of ideas, but we'll help you find information you need.



How do I answer a question?

Main page: Wikipedia:Reference desk/Guidelines

  • The best answers address the question directly, and back up facts with wikilinks and links to sources. Do not edit others' comments and do not give any medical or legal advice.
See also:



October 12

October 13

I hate Farmville!

What's the nicest way to stop people sending me Farmville requests in Facebook? (And any other silly nonsense activities?) I seem to get up to half a dozen a day. HiLo48 (talk) 02:17, 13 October 2012 (UTC)[reply]

You could block Farmville or any other apps entirely by going to your News Feed, clicking the pencil icon to the right of the app title (e.g. “Farmville”, etc.), and clicking “Remove App”. Alternatively, you could message them and politely tell them to stop.71.146.0.234 (talk) 06:45, 13 October 2012 (UTC)[reply]
Geez, don't have a cow. :-) StuRat (talk) 08:12, 13 October 2012 (UTC) [reply]

Good luck keeping Facebook from doing the one thing they care about doing: selling. ¦ Reisio (talk) 21:31, 13 October 2012 (UTC)[reply]

But me getting annoying Farmville requests (and I got a Truth game one just now - hate them too), which I ignore, sells me nothing.HiLo48 (talk) 21:46, 13 October 2012 (UTC)[reply]
It's not about "you" per se those financial analysts on Wall Street are demanding to see scalable monetization. It's about the 10% who do go into farmville, especially online where its all measured by "clicks". Marketdiamond (talk) 00:52, 14 October 2012 (UTC)[reply]
But I see HiLo's point. Once you make it clear you aren't interested in buying a product or service, they would then do better by trying to sell you other products or services, not by continuing to try to sell the same old thing. That's poor marketing. I have a similar complaint about ads for cable TV I get mailed to me about once a week. By now they ought to have a fair idea that I'm not interested. StuRat (talk) 00:57, 14 October 2012 (UTC)[reply]
Is the ROI to change the programming at the critical level where those that would completely sign off Facebook are greater than those that would finally succumb to the Farmville ads? Or better question are all consultants under the same MBA brainwashing lol? Marketdiamond(talk) 01:11, 14 October 2012 (UTC)[reply]
Advertising customized to the individual is the hot new thing on the Internet, and Facebook appears to be behind the ball on this one.StuRat (talk) 01:20, 14 October 2012 (UTC)[reply]
There seems to be a lot of confusion in the above thread. As highlighted by 71, it isn't actually that hard to block requests from Games, games from specific friends etc. And Facebook does a lot of customized/targeted advertising in their actual advertising. The friend game spam is not Facebook advertising per se so it comes down to a matter of Facebook choosing between what their partners (app developers etc) want and what their users want (which varies between the user) although Facebook does do some degree of automatic customisation there (as well as real paid advertising with the recent promoted post feature) it's primarily up to the user to control what they want to see. Nil Einne (talk) 05:38, 14 October 2012 (UTC)[reply]
Great points but it's all theoretical until OP (and many more) close their FB accounts because of it (or stop buying en masse). It isn't silicon valley calling the shots its Wall Street now, cause it is their money. There are millions of $s betting OP and others won't leave at the status quo. (For a time there was even more $ betting they wouldn't be effectively monetized but that's a whole other trade). Marketdiamond(talk) 01:49, 14 October 2012 (UTC)[reply]

I'm sorry if I posted this in the wrong section, but I'm trying to list a team's win-loss record by adding one to the win column for every game won and adding one to the loss column for every game lost. I have the scores for every game played by the team in a season and was wondering how to add one for every win or loss by using the > and < signs with the score. For example, if the team's score was in cell A1, the opponent's score was in cell B1, and the win loss record was in cell C1, how could I say something like “If A1>B1, add 1 to C1”? I'm sorry if I sound confusing, this isn't very easy for me to explain in writing.71.146.0.234 (talk) 06:44, 13 October 2012 (UTC)[reply]

I'd first be tempted to try just what you listed: "If A1 > B1, then C1 = C1 + 1". Apple numbers does have an IF function, although I'm unsure of the exact syntax.
The 2nd approach might be to use the SIGN function: "SIGN returns 1 when a given number is positive, –1 when it is negative, and 0 when it is zero.". So, you could do something like C1 = C1 + (SIGN(A1-B1)+1)/2. This might not handle ties, though. Adding the CEILING or ROUNDUP function in might fix ties. StuRat (talk) 08:32, 13 October 2012 (UTC)[reply]
  • I'm mostly a spreadsheet-avoider, so this might not be the right answer, but here is what I would try to do. I would first create a column C that would contain a 1 if the game was a win and a zero if the game was a loss. Then I would create a column D that is the cumulative sum of all of the entries from column C on the current line and above (wins), and a column E that subtracts the number in D from the total number of lines (losses).Looie496 (talk) 15:51, 13 October 2012 (UTC)[reply]
You can't have C1 simultaneously be a value and add to its own value — that makes it self-referential. If column C is a running total of wins or losses, what you can do is have C2 be something like, =IF(A2>B2,C1+1,C1), assuming row 1 contains score data. Notice the row numbers —it references the cell above it. (If you paste it to different rows, the references should automatically update.) The IF syntax (for Numbers or Excel) is IF([test condition],[value if true],[value if false]). This means that the formula for C1 must be something like, IF(A1>B1,1,0), to initialize the values. Or you could do it the way Looie suggests, which doesn't mean you have to have a different formula for the first row.--Mr.98 (talk) 16:36, 13 October 2012 (UTC)[reply]

Personal Hotspot on iOS

From http://support.apple.com/kb/HT3574: "To use this feature, your wireless carrier must offer Personal Hotspot and your devices must meet certain system requirements." Why does Internet tethering on iOS require carrier support? It is technically possible to use Internet tethering with any connection without carrier support, Android phones and tablets prove this. Write English in Cyrillic (talk) 15:46, 13 October 2012 (UTC)[reply]

There's no technical reason; they disable this feature if the carrier doesn't like it. A carrier might not like it because it means more traffic on their network. See the tethering article. -- Finlay McWalterTalk 16:08, 13 October 2012 (UTC)[reply]
As I understand the situation, the United States Federal Communications Commission has published several regulatory orders requiring service-providers (specific wireless carriers) to cease these limitations. However, enforcement of those requirements is pending litigation in several different jurisdictions. Until these legal issues are resolved, responsible vendors of mobile radio devices are complying with the current status-quo. It may be technically possible to circumvent such regulations (or contractual obligations) on some devices, but selling devices that flaut their radio license or service contract terms is typically a bad idea. You might find the FCC's web page informative:Open Internet, from FCC.gov, explaining some of the technical and legal issues. Outside of the United States is a different regulatory environment altogether: vendors who sell to diverse geographies have to find a compatible way to comply with regulations in lots of different places. You can check your iPhone's radio license by going to the device settings, "Settings > About > Legal > Regulatory" (and in some places, you may see additional licenses and other information). You should also see a radio license shorthand logo printed on the device, somewhere. Nimur (talk) 18:02, 13 October 2012 (UTC)[reply]


October 14

Downloadable Google Books only

Is there any way to search only those books which Google allows to download? --Tito Dutta 00:37, 14 October 2012 (UTC)[reply]

At this Google page click "Full View Only" under search for free downloads only, or "Google ebooks only" for downloads available both free and charge. Hope that helps! Marketdiamond (talk) 01:04, 14 October 2012 (UTC)[reply]
Excellent, I have bookmarked the link!--Tito Dutta (talk) 01:44, 14 October 2012 (UTC)[reply]
Glad to help! Marketdiamond (talk) 10:26, 14 October 2012 (UTC)[reply]
Resolved

Virus

If my computer is infected with virus, and I change the HDD to a new one, is it gone for good? Does the virus infected programs on the stuff like the motherboard? What I mean is when you start a computer, even without HDD, the motherboard has programs showing cpu temperature etc, so can virus infect that kind of stuff? Money is tight (talk) 03:00, 14 October 2012 (UTC)[reply]

It is possible, but uncommon, for malware to target specific hardware, or to install itself to nonvolatile memory other than the main system hard-disk drive. Nimur (talk) 03:24, 14 October 2012 (UTC)[reply]
You shouldn't have to replace a HDD to remove a virus - reformatting it should be sufficient. AndyTheGrump (talk) 03:27, 14 October 2012 (UTC)[reply]
And you don't usually even have to do that to remove the virus. StuRat (talk) 03:33, 14 October 2012 (UTC)[reply]
True enough - I suppose it depends on (a) how clued-up you are on removing viruses (most people aren't), (b) how much money you have, and (c) how essential it is to get rid of it - which mostly depends on the value of the data on the drive, and/or how essential it is to have the computer working. If you know what you are doing, and/or aren't too bothered about being absolutely sure it is gone, just deleting it (with the proper tools) may be good enough. If you don't know what you are doing, replacing the HDD is foolproof (apart from mainboard viruses etc...). In between, reformatting the HDD (and reinstalling the OS if required) is safer than the first option, and cheaper than the second. AndyTheGrump (talk) 04:29, 14 October 2012 (UTC)[reply]
If you are going to replace the hard drive anyway, it is vary rare for the virus to remain (ie. only in the case outlined above by Nimur). Otherwise, it is a pretty drastic solution to a virus infection. Try a virus/malware scanner first. (I was now going to mention how to manually remove a virus, but the usual sites I would check for virus information seem to no longer have manual removal instructions). Astronaut (talk) 10:47, 14 October 2012 (UTC)[reply]
If you replace the HDD, be sure to reinstall all software from known clean media (eg original disks or re-download from reputable source). If you replace the HDD and then simply reload all of your programs from a recent backup - eg a system image from Windows' Backup and Restore - you will "restore" the virus as well. Mitch Ames (talk) 03:39, 21 October 2012 (UTC)[reply]

Gateway, Inc

http://en.wikipedia.org/wiki/Gateway,_Inc. 1. Is Gateway still a company, owned by Acer now or only a TradeMark?91.79.154.141 (talk) 08:41, 14 October 2012 (UTC) 2. You wrote their Revenue = US$3.980 billion. What Year? Can You give me any reference on this value?91.79.154.141(talk) 08:41, 14 October 2012 (UTC)[reply]

I corrected the revenue number on the article after reviewing that it had not been changed since at least early 2008. As a unit of Acer I doubt there are any public and verifiable numbers on specific Gateway-only revenue. The best source online for public information on companies is Hoovers and they state that Gateway revenue alone is negligble and 0 profit 0 etc. herealso that they are a unit of Acer. Marketdiamond (talk) 10:22, 14 October 2012 (UTC)[reply]
P.S. Please refrain from using terms like "you" since almost every article is a collaboration of many editors, unless of course you are referring to a specific editors contribution that you have identified, just trying to prevent any confusion, thanks! Marketdiamond (talk) 10:25, 14 October 2012 (UTC)[reply]

Coding LinkedIn

Hi, I have a business idea which basically requires me to make a website like LinkedIn, where people can make pages, and add information, and the website remembers it (practically exactly like LinkedIn). I don't have any coding ability, but I don't want to have a professional make it for me because I have no money, and I'm afraid someone will steal my idea and it will be the Winklevoss affair all over again. So, really, I need to know what languages I need to learn. Thanks for any help you can provide. 31.205.106.147 (talk) 13:29, 14 October 2012 (UTC)[reply]

Do this class then this class. -- Finlay McWalterTalk 13:52, 14 October 2012 (UTC)[reply]
Thank you ever so much, Finlay, that's awfully kind of you to provide such assistance. I had never heard of Udacity before, but it appears to be greatly useful for learning new things for free. Thank you once again! 31.205.106.147 (talk) 15:13, 14 October 2012 (UTC)[reply]
Just in case someone finds this thread in the future and finds the Udacity web pages have disappeared, the course names are "Introduction toComputer Science (cs101): Building a Search Engine" and "Web Development (cs253): How to Build a Blog".PleaseStand (talk) 03:53, 15 October 2012 (UTC)[reply]

October 15

Recovering a deleted iPad note

My iPad 2 runs iOS 5.1.1. I think deleted a note in Notes on accident and I would like to recover it. If I did delete a note then it was made AFTER my last sync. How can I recover it? Jailbreaking is acceptable. --Melab±1 01:25, 15 October 2012 (UTC)[reply]

I found this tutorial and comment board here that seems to be having success. Marketdiamond (talk) 03:25, 15 October 2012 (UTC)[reply]
Unfortunately, the method that I need to use only works for the original iPad. --Melab±1 03:58, 15 October 2012 (UTC)[reply]
I think that you will only get it back if you synced the the iPad somewhere, such as another iTunes or the iCloud. Graeme Bartlett (talk) 20:53, 17 October 2012 (UTC)[reply]

Google search PDF URL decoder

This is more a Google search question than a Wikipedia question. That's why I am asking here.

  • Shorter version: How to copy the PDF file URL from Google search page?
  • Longer version: Go to this search result page (actually I did not search with this weird query, but I want you to get the result at the top of the page which I am trying to show you). The first result is "The human cranium from Bodo". I have downloaded the file and found and want to use it as a reference. But, how to quickly copy the URL? The process I follow is–
  • Right click and copy link
  • Paste in text editor, take only the portion between http and pdf and delete everything else, replace %2F with / %3A with : etc...

But, any easier way to copy the actual URL of a PDF file from search result? --Tito Dutta (talk) 07:07, 15 October 2012 (UTC)[reply]

Try this online tool; basically it seems to automate the steps you take under 'longer version': http://industrystandardsoftware.com/online_tools/converters/convert-serp-link-to-direct-location-for-copying-and-pasting.htm. Alternatively, if you use with Mozilla Firefox or Google Chrome you should be able to find a Greasemonkey to do the work for you. - Cucumber Mike (talk) 07:58, 15 October 2012 (UTC)[reply]
Hello, using IndustryStandardSoftware, I could not extract the PDF link given in the example above (see first line of "longer version"). I have installed this userscript, still have not found out how and where it is working! Thank you! --Tito Dutta (talk) 08:17, 15 October 2012 (UTC)[reply]
What happens when you use the tool? From your link, I get the first result as https://www.google.co.in/url?url=http://faculty.ksu.edu.sa/archaeology/Publications/Palaeolithic/The%2520human%2520cranium%2520from%2520Bodo,%2520Ethiopia.pdf&rct=j&sa=U&ei=2817UI38MYnNhAedjYHIDA&ved=0CBQQFjAA&q=Bodo%2Bfossil+filetype:pdf+%22++The+human+cranium+from+Bodo,+Ethiopia:+evidence+for+speciation%22&usg=AFQjCNFSY5PqFSoMi0JIjyYnJ67Bb-qW7Q. Pasting this into the tool gives me http://faculty.ksu.edu.sa/archaeology/Publications/Palaeolithic/The%20human%20cranium%20from%20Bodo,%20Ethiopia.pdf. Is that not what you needed? Apologies if I've read the question wrong. - Cucumber Mike (talk) 08:53, 15 October 2012 (UTC)[reply]
(If someone could provide better formatting for the link above so it doesn't spill over the edge of the page I'd be very grateful.) - Cucumber Mike (talk) 08:55, 15 October 2012 (UTC) [reply]
In Firefox, I:
  1. download the pdf
  2. go to the download's entry in Firefox's Downloads window
  3. right click -> copy_download_link
And you get the real PDF URL, not the Google redirector link. -- Finlay McWalterTalk 12:51, 15 October 2012 (UTC)[reply]

The OptimizeGoogle and CustomizeGoogle extensions used to be good for this. ¦ Reisio (talk) 16:42, 15 October 2012 (UTC)[reply]

Also: http://duckduckgo.com/?q=%22The+human+cranium+from+Bodo%22+pdf ¦ Reisio (talk) 18:28, 15 October 2012 (UTC)[reply]

Replacement for Console in Windows

I like to have a Unix-like environment ready for myself for numerous reasons, notably that it provides many programs I need like SFTP, SSH, etc. In Windows, I settled on Cygwin. However, Cygwin (obnoxiously) doesn't provide tabbed support. Console provides such tabbed support for Cygwin.

However, Console has two very obnoxious feature omissions:

  • Lack of support for UTF-8, which leaves much of my Wikimedia bot's output as mojibake.
  • Lack of Ctrl-C tunneling. If I try to ctrl-c abort out of my PHP script, nothing happens! I have to actually open a task manager and shut it down from there.

Is there a Console equivalent that has support for these two things, and also allows a tabbed console window? Magog the Ogre (tc) 20:52, 15 October 2012 (UTC)[reply]

rxvt for Cygwin is certainly a better unix console on Windows than the NT console, but I don't think it currently supports unicode; its brother Rxvt-unicode does, if you can get that to work on Cygwin. -- Finlay McWalterTalk 20:58, 15 October 2012 (UTC)[reply]
You can indeed. I also suggest using screen for an equivalent to "tabs", although there are a number of even more GUI'd terminal emulators available for Cygwin. ¦ Reisio (talk) 21:12, 15 October 2012 (UTC)[reply]
mintty doesn't do tabs but it does support Ctrl+Tab and Ctrl+Shift+Tab for switching between currently open mintty windows. It supports UTF-8 and ^C. -- BenRG (talk) 17:18, 16 October 2012 (UTC)[reply]

Good Books for Learning JavaServer Faces

Any suggestions? I've done a bit of Java programming but was only introduced to JSF last week so am brand spanking new to it. Thanks. 78.146.75.224 (talk) 21:19, 15 October 2012 (UTC)[reply]

Perhaps it's also worth mentioning that Java is the only computing language with which I have any familiarity, which specifically means that I don't know any HTML, XHTML or CSS. Is it worth exploring one of these languages first to facilitate my learning of JSF? 78.146.75.224 (talk) 22:21, 15 October 2012 (UTC)[reply]

October 16

internet svc

my internet svc keep cutting off at work would like instructions how to run forefront to check for virus — Preceding unsigned comment added by 65.241.76.237 (talk) 16:26, 16 October 2012 (UTC)[reply]

It's highly unlikely that a virus is your problem. If you're running Windows and can't get an IT person to help you, you should go into the Control Panel to the Network part, and find the function that allows you to troubleshoot the network. Looie496 (talk) 19:20, 16 October 2012 (UTC)[reply]

Faking EXIF metadata?

I've raised a WP:PUF for an image with confusing EXIF information — specifically, a public domain notice in the metadata. I'm quite uncertain of what's going on, and the only other person who's comment on the image isn't certain of everything either. Could someone who knows about EXIF metadata chime in on the technical side of things at Wikipedia:Possibly unfree files/2012 October 16? Nyttend (talk) 18:25, 16 October 2012 (UTC)[reply]

The copyright license metadata field for images is easy to change in Photoshop. There is no "faking" — it's just a field you can fill in, edit, or not. It's not a technically-created field, in the sense that the camera doesn't generate it. --Mr.98 (talk) 22:47, 16 October 2012 (UTC)[reply]
Not directly relevant to the original question, but for all your EXIF needs I recommend ExifTool. Free as in both beer and speech, and you can work with all the fields, not just copyright. One particularly nice feature is the ability to add or subtract a constant offset from all date fields -- take a picture of an accurate clock before you download your photos, then adjust all your pics by the delta that makes that one come out right. --Trovatore (talk) 23:01, 16 October 2012 (UTC)[reply]

October 17

VERY basic C Questions I can't find online!

Hi, I have experience with Javascript and am trying to jump into C, but I am finding some problems before I even start!

First of all, is C like Javascript in that I can just type my code into notepad? If so, what then? Do I save it as a .something file and run it in firefox? Or is there some other completely different process to even viewing the result of C code?

I'd appreciate an answer as soon as possible, and I'll be asking more questions once this one is answered! Thank you! 169.231.8.73 (talk) 07:02, 17 October 2012 (UTC)[reply]

C is a compiled language, so you must save as a *.c file (or *.cpp or *.c#, for variants), then compile that file, which generates an object files (*.o). Those object files and libraries are then linked together to form an executable (*.exe file), which you can run. There are free compiler/linkers out there, such as GCC. There also might be interpreters out there which can run C source code directly, but those aren't the norm. StuRat (talk) 07:08, 17 October 2012 (UTC)[reply]
Sorry, but I need more help. I reached here, then here, then here, where I downloaded gcc-4.7.2.tar.bz2 I have no idea if this was the right thing to do, but now my computer tells me it doesn't know what program to open it with. Help me with figuring out how to get the compiler to a useful state? 169.231.8.73 (talk) 10:05, 17 October 2012 (UTC)[reply]
GCC is usually used in UNIX/Linux environments. The file you downloaded is probably for one of those, and is possibly source code that needs compiled as well. There are pre-compiled Windows version available with Cygwin and MingW - you can find links here. (A compiled program is called a binary) However, you may be better off downloading Visual Studio C++ Express Edition. It is a C++ compiler, but aside from a few minor differences C is a subset of C++. It will give you a nice editor, compiler and debugger all integrated into a simple interface. 209.131.76.183 (talk) 12:10, 17 October 2012 (UTC)[reply]
Sorry, 169, but compiled languages like C are very different from interpreted languages like Javascript, and you don't yet have enough clue to understand the answers to the questions you are asking. I strongly recommend that you find a basic introduction to C to read -- you can find a number online, such as http://www.sis.pitt.edu/~ir/KS/Data/RMiles/contents.html. Looie496 (talk) 14:45, 17 October 2012 (UTC)[reply]
I tend to agree with Looie496's assessment. At my undergraduate college, before any engineering or computer science student was allowed to take a programming class, they were required to pass the Introduction to Computing course material. You may find the free online text very helpful. While this frustrated many students who believed they were "computer experts" - myself included - this simple class presented a formal introduction to material that is absolutely essential to understanding how a computer works. You must master these concepts before you attempt to program in a language like C. Before you understand these fundamentals - things like the way file systems work; or the role of the operating system in mediating software- and hardware- access - the best you can do with the C language is to copy-and-paste other people's code (and build-scripts); that approach has very limited utility in teaching you, or in getting useful work done. Nimur (talk) 17:31, 17 October 2012 (UTC)[reply]
[1] takes you through the steps of installing Code::Blocks and running a simple "hello world" program. I've never used Code::Blocks, but the page makes it look like a pretty good place for a beginner to start. That site also seems to have a bunch of tutorials aimed at beginners. (I'm working under the assumption you're running Windows. If not, let us know what you are using.) 209.131.76.183 (talk) 17:33, 17 October 2012 (UTC)[reply]
Some follow-ups:
1) Are you on Windows ? If so, what level ? XP ? Vista ? Windows 7 ?
2) I disagree about needing a class before moving from an interpreted language to a compiled language. It actually is more difficult moving the other way, IMHO, as then you have to worry about defining functions before you use them, etc. You might want to start with a "for idiots" book (no offense, I use them, too).
3) However, C is a rather unpleasant language, and is more difficult to learn than many others. BASIC might be an easier starting point.
4) While you can use any old text editor to write source code, there are also editors customized for computer languages which will do things for you like highlighting incorrect syntax. Those can be quite helpful. StuRat (talk) 18:29, 17 October 2012 (UTC)[reply]
I agree with everything you say except the suggestion to learn BASIC. Dijkstra put it well: the teaching of BASIC should be rated as a criminal offence: it mutilates the mind beyond recovery.[2]. And the same goes for that pit of insanity they call PHP. For heaven's sake learn Python or something else structured! Marnanel (talk) 20:19, 17 October 2012 (UTC)[reply]
I'm learning Python now, and it has some annoying, unnecessary complexities, like arrays starting at zero. And one thing it has that I find rather unstructured is implicit variable definitions. In FORTRAN, I always use the line "implicit none" at the start of each program and subroutine, to force me to think through the exact definition of each variable. Python also allows global variables, which is about as unstructured as you can get. StuRat (talk) 20:39, 17 October 2012 (UTC)[reply]
Any programming language that isn't a toy defaults to arrays starting at zero. Using one-based arrays is a foolish concession to foolish programmers which fills anything more than trivial uses of array indexing with endless minor adjustments, and I note that since the OP is experienced in JavaScript they won't have a problem in that direction anyway. And (let me make sure I understand) are you actually criticising Python's ability to use globals while simultaneously suggesting the serious use of BASIC? Marnanel (talk) 20:48, 17 October 2012 (UTC)[reply]
My point is that you might as well start with an easier language, if neither BASIC nor Python is well-structured. Also, FORTRAN is a serious language and defaults to 1. The idea is to make it more closely aligned with how human's count, rather than how computer's count, to make it easier to use. When human language changes so you say "my zeroth transaction today was...", then it will make sense to program that way. Until then, the computer should figure out that array element 1 is at memory offset 0, so the programmer and end user don't have to concern themselves with such trivialities. StuRat (talk) 20:54, 17 October 2012 (UTC) [reply]

Thanks for the help guys, but so far I'm still pretty clueless :(

My assignment is this. I cant even figure out how to get something on my screen that lets me write C code. Code::blocks doesnt seem to be working. And is there a way to view the source code of the drawings already submitted? 169.231.8.73 (talk) 23:18, 17 October 2012 (UTC)[reply]

A) That says you are to use GCC under Linux. Are you even on Linux ? Don't they provide instructions on how to install GCC ? If you're not on the Linux operating system, then you either need to get that or use one of the Windows versions of C compilers listed above. However, that would mean the instructions given in the class won't always apply directly, since you aren't using GCC. So, perhaps getting some version of Linux would be easier. Don't they give instructions for doing this at the start of the class ?
B) It also says completing labs 0-7 is a pre-req. Did you do those ?
C) I expect that such a class would have included detailed instructions on how to set up the environment.
D) They are using a "make" command to compile and link together (this uses the "Makefile" provided).
E) It says you're supposed to have a partner. Do you ?
F) As far as writing code, as I said, any text editor will work. For this project, you're supposed to edit the file "ourDrawing.c", which they provide. If you use the Linux operating system, it won't have Notepad on it, but will have similar text editors.
G) I don't know what "Code::blocks" means. Can you explain ? StuRat (talk) 23:47, 17 October 2012 (UTC)[reply]
Hi, OP. You need to follow the step-by-step instructions closely. You need to be on computer with an installed C compiler, in this case gcc, ie one where typing gcc --help will produce some bumph on the screen. For this project you also need make, which chains together the calls to gcc from something called a makefile, saying "if you've not got this do that". Installing gcc and make are hard, probably impossible if you've never used them. Your instructor has provided an installation on your departmental machine, you should use it. When you've had a bit of success with that, by all means have a go on your own computer. Departmental admins spend a lot of time getting machines with the right stuff on them and while shared machines may seem like an evil communist plot and a bit skanky, they're the way to get things done until you're able to manage your own machine. Use notepad in this case to edit the c files. There's stuff that's prettier but that will just add to things to go wrong at this stage, just concentrate on getting this example going. A C-program takes files ending .c and .h and turns them into .o's and then globs them all up into an executable. An executable is an application just like a browser is or a game is or a CD ripper is. It's nothing particular to do with the web. You run it from the command line as mentioned in the documentation by typing the executable name. In this case it seems to generate GIF files. You can view them later with a browser but that's not the point: the point is that this software makes them. The examples are goofy but it could easily be a fractal or a ray trace with only a little more work. As other people write above, C is difficult to write. It's good for a few things. First, it's very, very quick (if written well). Second, it can access the underlying system with unparalleled accuracy and precision. Third, it teaches you about how systems work. There are /a lot/ of C jobs out there, it's well worth learning for itself and for what it teaches you about how stuff works: this isn't your teacher being old-fashioned or random. You almost certainly won't understand other languages as well, or see where things like performance problems are coming from until you've learnt C. It's worth sticking with, even if it takes a long time to do not so much. For now, follow the instructions you linked to. For example, open notepad and write in a file called hello.c.
 #include <stdio.h>
 #include <stdlib.h>
 int main(void)
 {
   puts("Hello World!");
   return 0;
 }
Now run this command on the command line
 gcc hello.c -o hello
Now run the application you just made from the command line
 ./hello
81.141.91.145 (talk) 00:17, 18 October 2012 (UTC)[reply]

The OP has linked to his assignment instructions, which clearly state the required prerequisite knowledge: "Before starting this project, you should have completed the labs up through lab07. In particular, you should be comfortable working with arrays, structs, arrays of structs, and passing structs and arrays of structs to functions." Have you completed Labs 0 through 7? If you expect to start at Step 8, without completing Steps 0 through 7, you will never be a very good programmer: programming is about exact adherence to procedure; or rather, the definition of exact procedural steps so that a dumb-machine can follow these instructions. Creative use of procedure can only really be achieved after you've got the basic technique mastered. Nimur (talk) 01:30, 18 October 2012 (UTC)[reply]

The due date for the assignment is March 11, 2010. I imagine the original poster just found it online and thought it would be a good starting project. (Which it probably isn't.) -- BenRG (talk)

The professor who assigned this to his class in March 2010 is my professor now, and he is asking that everyone in class complete this lab to gauge everyone's prior knowledge. The original prerequisites and everything are not part of this course, this is our first assignment of the quarter. So I do not have any of these things already, I am attempting to finish this completely by myself. I have a meeting with the professor tomorrow, it's possible I might have to drop the class if I cannot complete the first assignment :( I've spent every minute of free time these past three weeks trying to learn this too... 169.231.8.73 (talk) 03:55, 18 October 2012 (UTC)[reply]

We really would like to help you, but we need you to start answering our questions. The first is if you have access to a computer with some variant of the Linux operating system on it. Do you ? StuRat (talk) 04:14, 18 October 2012 (UTC)[reply]
I do. It's at the computer lab, though I won't be able to get into the computer lab until tomorrow morning. Once that happens I plan to try to use what 81.141 suggested. I also have an account that will allow me to upload the project once (if) I finish it. I apologize for being slow and overwhelmed, it's just that a lot of this is unfamiliar to me. (And Code::Blocks was something I downloaded because of 209.131's suggestion. It looks fine, but not for this project, because it seems to only have a CLI, and I need to output a picture.) 169.231.8.73 (talk) 04:23, 18 October 2012 (UTC)[reply]
OK. Now, do you know if the Linux computers in the computer lab have GCC on them ? (The "Hello World" test will tell you for sure.) If not, are you allowed to download and install it on them ? And when is this project due ? StuRat (talk) 04:26, 18 October 2012 (UTC)[reply]
First of all, the assignment is not really about the mechanics of C programming, building the program or making it run successfully. That is something you really should have learnt in previous classes/labs. If you didn't attend those classes/labs, you are going to be pretty stuck just jumping straight in with this assignment. What the assignment is about, is the logical thought processes behind developing a program to make it do what the requirements ask for. You are expected to use your previous knowledge and the provided building blocks to make the program draw a simple image at different sizes and positions. I suggest you go see your professor as soon as possible and explain that you are fining getting started on this assignment particularly challenging because you have no C programming experience. Then ask for his suggestion as to what you can do next. Astronaut (talk) 11:52, 18 October 2012 (UTC)[reply]
On the plus side, if you install a reasonable modern Linux distribution on your computer, and select "Development System"/"Developer Workstation" or similar at the SW configuration stage, it will almost certainly install all tools (gcc, make, text editors,...) that you need automatically. Installing Linux instead of Windows (losing all your old data!) is easy (if you have a Linux distribution that is somewhat more recent than your hardware, so that it can detect the hardware automatically). Installing Linux in addition to Windows is somewhat more tricky (and risky - backup first!). --Stephan Schulz (talk) 13:09, 18 October 2012 (UTC)[reply]
Installing it on a USB flash drive instead of the hard drive is a lot safer. That way you just unplug the flash drive and reboot to get back into Windows. StuRat (talk) 02:52, 19 October 2012 (UTC)[reply]
Indeed, your are right. I'm too old ;-). But IIRC right, at least Ubuntu and Fedora have lifelive images for CD/DVDs and USB sticks that you can boot from and use without any installation (in the CD/DVD case, I think user data is written to the Windows file system). --Stephan Schulz (talk) 06:04, 19 October 2012 (UTC)[reply]
Also live images. :-) StuRat (talk) 06:40, 19 October 2012 (UTC) [reply]
There is a reason it says "near native" in that language box on my user page ;-). --Stephan Schulz (talk) 08:51, 19 October 2012 (UTC)[reply]
After an entire lifetime speaking English, I've achieved a near native mastery, as well. :-) StuRat (talk) 05:18, 20 October 2012 (UTC) [reply]
If you have spend your entire lifetime speaking English, how do you get anything else done? And doesn't it keep you awake at night? --Stephan Schulz (talk) 06:32, 20 October 2012 (UTC)[reply]

So I spoke with the professor, and he has agreed that I may not be ready for this lab. He has worked with me to create a program that caters to my current needs and skill level, and this drawing assignment is now my final project. So thank you all for your help, I can see that I'm not ready for this assignment just yet. I've saved everything you all wrote in a document, and I will peruse it if I need help, or I may just create a new section in this reference desk; this one is getting dangerously close to the top of the page. Thank you all, and I've passed out barnstars to the particularly helpful members! 169.231.8.73 (talk) 21:59, 20 October 2012 (UTC)[reply]

openoffice calc - graphing "wild" data

I've been asked to graph weekly hit stats for our website. Most of the time, the range of the data is 0 to 500, however we had two weeks where the hits were in the 2000-3500 range. This makes most of the graph very difficult to see as it is so small. What would be the best way to graph this data so that all the data is visible? Is it possible to have two different scales on the y-axis, with 0-500 taking up the bottom 3/4's of the graph so the data is visible and the rest of the axis in a small scale to show the bigger numbers? Thanks! --TrogWoolley (talk) 13:40, 17 October 2012 (UTC)[reply]

You might want to try plotting on a logarithmic scale. It should be an option for the chart axis. 209.131.76.183 (talk) 13:48, 17 October 2012 (UTC)[reply]
Are you sure about those figures? You should normally exclude robots, plus as well as the normal probes for weaknesses every so often sites get some hacker trying out all sorts of stupid things on it. But I agree if you are having sudden surges of interest then a logarithmic scale is what you want. But then again it may be right just to have the rest go invisible if you wnat to show the actual amounts overall. Dmcq (talk) 14:53, 17 October 2012 (UTC)[reply]
What information do you want a person who looks at the graph to be able to pick up from it? Looie496 (talk) 14:52, 17 October 2012 (UTC)[reply]
Another option is to put a break line (doesn't Wikipedia have an article on this ?) in the tall bars in a bar graph, and write the number above them. I don't know if OpenOffice supports this, however. StuRat (talk) 20:46, 17 October 2012 (UTC)[reply]
Thanks for the suggestions. A break line would be an ideal solution and I had already fudged this by capturing the graph and manipulating it using a graphics package. There appears to be to no method to create a break line in calc. However I found that you can create graphs with two y axis and they can have different scales. Problem solved!. --TrogWoolley (talk) 09:28, 19 October 2012 (UTC)[reply]
Great, I'll mark this Q resolved. StuRat (talk) 18:01, 19 October 2012 (UTC)[reply]
Resolved

Torrent Download Problem

While downloading a torrent file , it just shows " connecting to peers " , and the download doesn't begin . How do I resolve the issue ? — Preceding unsigned comment added by Jug9 (talkcontribs) 14:17, 17 October 2012 (UTC)[reply]

The only possibility is to use a different Bittorrent program, but that probably won't work. It is impossible to download a file if your program can't find a peer who will provide it to you. Looie496 (talk) 14:37, 17 October 2012 (UTC)[reply]

Try another port. Many tracked torrents also are entirely unseeded. ¦ Reisio (talk) 17:05, 17 October 2012 (UTC)[reply]

It would be worth trying to find out whether the trackers think there are seeders; whatever site you got the torrent from ought to say, somewhere. If there are no or very few seeders then it's possible there may just not be any peers to connect to. If there are lots of seeders and you still can't connect, you will need to troubleshoot your client and/or your router and firewall settings. But not knowing your torrent program, your OS, or anything else about your situation, it's not possible for us to give any really specific debugging information or suggestions for you. There are just too many possibilities. --Mr.98 (talk) 22:46, 17 October 2012 (UTC)[reply]

css nonsense

Hi, I have the following code in my css sheet:

div.selectorFormSection.override {
   font-size: 20px;
}

Only problem is, it is constantly being overridden by something in jquery ui:

element.style {
   font-size: 16px;
}

I've checked with Firebug, and my code is definitely present, it's just getting crossed out. Now surely my own rule is more specific, since it has two classes. As I understand it, for the style rule to be applied, an element must have both classes. That makes it more specific than the jquery rule, which only has one class. I don't want to have to write junk like "!important" every time I do something simple, so please, can someone tell me what's wrong with my code? Thanks, IBE (talk) 23:51, 17 October 2012 (UTC)[reply]

element.style in firebug isn't really a CSS selector. It means that this content was inside a style element on the tag in the HTML or has been added as if such by javascript (more likely). Something in jQuery UI is going in there and explicitly setting the font-size to 16px. It's usually easier to use themeroller to roll a jQuery UI theme with the correct sizes in them than to argue with it over particular tags. 81.141.91.145 (talk) 23:59, 17 October 2012 (UTC)[reply]

I see. Since it's my own html, I'm pretty sure it's the second option: javascript. I've been wondering about this irritating "element.style" for the longest time, so very glad I asked. I won't put "resolved" in case someone has more to add, such as suggested workarounds, but that pretty much solves it. IBE (talk) 00:06, 18 October 2012 (UTC)[reply]

October 18

Android phones under $100 unlocked

Are there any Android phones that cost under $99 unlocked? Write English in Cyrillic (talk) 10:26, 18 October 2012 (UTC)[reply]

Yes. See here. Other mobile phone retailers are available. - Cucumber Mike (talk) 10:42, 18 October 2012 (UTC)[reply]

HTTP request in java.

Hello!, so I'm having trouble with this ridiculous java API. It just doesn't like HTTP responses that start by 4 or 5.

So for example if I want to read the response of the 403 error I can't, because it throws:

Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403

So, How can I make java ignore these 'errors'? (And still be able to 'read' from them) 190.60.93.218 (talk) 14:57, 18 October 2012 (UTC)[reply]

I am not much at Java programming, but surely the intention is that you will catch the errors and — having caught them — know that the server has returned an error, and then handle it correctly? --Mr.98 (talk) 15:24, 18 October 2012 (UTC)[reply]
I assuming you're using java.net.HttpUrlConnection()? I don't have a url offhand that 403s to test this, but you should be able to get the full response message line by calling the connection's getResponseMessage() method (as opposed to getResponseCode(), which should just give you the 403 itself). If someone can think up a public URL that 403s then I'll test this myself. -- Finlay McWalterTalk 15:28, 18 October 2012 (UTC)[reply]
It was harder than expected to find a 'public' 403 error. Just had to find and old server... Altough you can simulate one with php.. or python.. anyway here you go. [3]190.60.93.218 (talk) 17:10, 18 October 2012 (UTC)[reply]
But to your general point - can you handle error codes without the library turning them into exceptions (and thus turning your code in to layers of nested catch blocks) - I don't think so: error->exception is the style of the library. Apache's HTTPclient library isn't so keen to throw exceptions on ordinary server error codes. -- Finlay McWalterTalk 15:4I2, 18 October 2012 (UTC)
Hey, thanks guys you kinda solved it. Anyway a 'simple' try/catch managed to fix it. (I don't really like try/catch, seems unclean)
InputStream is;
      try{
      is = connection.getInputStream();}
      catch(IOException therror){
      is = connection.getErrorStream();
      }

so that fixed it, thank you. 190.60.93.218 (talk) 19:12, 18 October 2012 (UTC)[reply]

Try-catch blocks are an essential feature of the Java programming language: in fact, they are documented in the official Java Essential Tutorials. If you come from a C++ background, you may have had some strange experience with exception-handlers and catch blocks; but in Java, try/catch blocks are a lot more robust. Every exception must be explicitly declared and handled. Exceptions in Java are quite unlike C++; in C++, a "throw" is basically a glorified goto statement, and a "catch" is essentially little more than a statement label. In Java, the exception mechanism is strongly-typed, strongly enforced, and guarantees certain program flow. Here's an interview with Java creator James Gosling, on Failure and Exceptions, in which he extolls the virtues of Java's programming language features. Compare this to Stroustrup on C++ exception handling, which is put forth as an easy way to implement the RAII paradigm, (in a way that's un-enforceable by a C++ compiler). Nimur (talk) 23:56, 18 October 2012 (UTC)[reply]
Uh... your description of C++ exceptions is pretty far from reality. -- BenRG (talk) 06:54, 20 October 2012 (UTC)[reply]

cpu fan

1: my pc has two fans in the case, one in the power supply, and one on the heat-sync over the cpu. if i unplug the cpu fan, what are the chances of the cpu overheating, and the motherboard shutting off power? 2: the fan and heat-sync came with the cpu. can i get a replacement fan that fits from a different company? 3: how much would that cost? 4: there is a quit grinding sound coming from the cpu fan. every two seconds or so. what might cause that, and how might i fix it? thank you, 70.114.254.43 (talk) 20:34, 18 October 2012 (UTC)[reply]

  1. Very high chance. Not a good idea.
  2. Yes
  3. Not much. $10 to $30, maybe, depending on what sort of processor it is cooling
  4. Odd time signature, but most likely failing bearings. Essentially unfixable. Check that it's not merely bunged up with dust; clean it with an air duster (air can) and/or paintbrush and vacuum cleaner. If that doesn't fix it, replace it. --Tagishsimon (talk) 20:53, 18 October 2012 (UTC)[reply]

what would cause the bearings to fail? is that catastrophic, or does it just make an annoying sound? 70.114.254.43 (talk) 02:11, 19 October 2012 (UTC)[reply]

Cause is probably poor seals, ingestion of abrasive particulate matter, leading to wear. Tends to be degenerative, in that it gets worse and eventually seizes. --Tagishsimon (talk) 02:15, 19 October 2012 (UTC)[reply]
Yes. Once the fan starts making noise like that, its life span will usually be very limited. You should replace it now, or expect to have a nonfunctional computer while you acquire a new one. Unless you have a very low-power CPU or a very special setup, you usually can't run for more than a couple of minutes without a fan without overheating. Looie496 (talk) 02:25, 19 October 2012 (UTC)[reply]
If the CPU fan does fail before you can replace it, remove the case and point a window fan at it. This workaround should keep your computer operational until you can replace the CPU fan. StuRat (talk) 02:48, 19 October 2012 (UTC)[reply]
Back to the original question:
  1. Without the fan, the CPU is going to overheat, but it'll do so slowly enough that the computer will shut down without anything being damaged.
  2. Computer fans are highly standardized. Any fan of the same diameter and thickness with a two-pin, three-pin, or four-pin connector should work (the extra pins give the computer better control of the fan speed; without them, the computer usually just runs the fan at full speed).
  3. I'd be amazed if a replacement fan cost more than $10.
  4. Intermittent grinding is almost always a failing bearing: with a ball-bearing fan it's caused by an irregularity moving on and off of the bearing surface, with a sleeve-bearing fan, it's caused by alignment shifts in the bearing. You could try to fix it by disassembling the fan and cleaning or lubricating the bearings, but that's a lot of work for an uncertain outcome. Replacing the fan is faster and more reliable.
--Carnildo (talk) 01:36, 20 October 2012 (UTC)[reply]
Another possibility is that a cable in occasionally striking the fan blade. StuRat (talk) 05:17, 20 October 2012 (UTC)[reply]

October 19

ddos attack

when people are ddosing a website, how does the site (server admin) stop the attack? thanks, 70.114.254.43 (talk) 02:08, 19 October 2012 (UTC)[reply]

The section "Prevention and Response" in the article DoS lists some options. RudolfRed (talk) 04:16, 19 October 2012 (UTC)[reply]

Zero or one based indexing

A previous comment in this ref desk said: <quote>Any programming language that isn't a toy defaults to arrays starting at zero. Using one-based arrays is a foolish concession to foolish programmers which fills anything more than trivial uses of array indexing with endless minor adjustments</quote> As most of my programming is in c and Java, zero indexing seems natural to me. However there are a number of languages that are not toys, such as lua. There are also languages with no default, like Ada and Pascal. The primary advantage of zero-based arrays seem to me to be that you can treat elements as offsets (0 is this house, 1 is one down the road and so on). It is not "obviously" an advantage where you just want to label a position in a record. This seems to be born out by Erlang that uses a zero base for arrays, but a one base for lists.

What I can't see is why Erlang just doesn't index everything from 0 - what are the advantages of indexing lists from 1? If there were no advantages I would have thought that zero would have the advantage of being consistent with arrays. -- Q Chris (talk) 09:49, 19 October 2012 (UTC)[reply]

The relevant article is Zero-based numbering. I don't think there are any disadvantages except for people whose brains can't warp around the idea. There are a number of technical advantages. --Mr.98 (talk) 11:40, 19 October 2012 (UTC)[reply]
Sorry I was asking the other way round, what is the advantage of one-based numbering ? I assume that if there wasn't any then Erlang would use zero-based numbering for lists as it does for arrays. -- Q Chris (talk) 12:28, 19 October 2012 (UTC)[reply]
Erlang uses linked lists for the list data type. 1 is used to represent the first element, because it is an intuitive way of dealing with linked lists. They aren't array based, so the address+offset (and intuitively 0-based) method doesn't apply. You don't normally want to look up a linked list element by index anyways - if you are, then you probably should re-think how you are solving the problem. 209.131.76.183 (talk) 12:51, 19 October 2012 (UTC)[reply]
Count-from-one gives similarity to how mathematics is written (for example, the very typical sigma-notation examples in the summation article, where i=1 means "the first one"). If you're taking a big paper about aerodynamics and want to turn it into code, count-from-one in the language means the code slightly more resembles the paper than count-from-zero. Matlab works this way (matrix example). Fortran 90 lets you define the "extent" of an array, so arrays can run from any integer index (including negatives) to any other. Python will let you make things that syntactically look like arrays (but probably aren't really) that you can index with any darn thing you like. -- Finlay McWalterTalk 13:01, 19 October 2012 (UTC)[reply]
Actually, Python has arrays/lists (that probably really aren't) that are indexed from 0, and dicts, which can be indexed by arbitrary immutable keys (but not, e.g., by a list). And you can probably create your own classes and do whatever you can imagine ;-). --Stephan Schulz (talk) 13:50, 19 October 2012 (UTC)[reply]
For the record there's also tons of mathematics written using zero-based indexing, so the split extends to math too. --83.84.137.22 (talk) 16:32, 19 October 2012 (UTC)[reply]
The advantage of 1-based indexing is that it relates better to the real world. Even a programmer able to think of everything as 0-based will likely still need to communicate with customers, who will get confused if he says "the zeroth item on the list returned will be...". Since the conversion between the 1-based real world and 0-based CPU has to occur somewhere, I'd argue that it should occur as deep inside the computer as possible. That is, you specify array item 1, and it figures out that this means memory offset 0. This allows programmers to more effectively relate to customers, customer specs, non-technical managers, etc. Essentially, the issue is whether computers should be adapted to fit us, or we should be adapted to fit computers. StuRat (talk) 17:58, 19 October 2012 (UTC)[reply]
I have to maintain a 10-year-old code base that was based pretty directly on an older embedded system, and there is constant 0-to-1 based translation going on, and it drives me crazy. In any new development I just let the array be one item larger than it needs to be and ignore the 0 element. Even in most embedded systems nowadays there is more than enough memory to lose a few bytes here and there for convenience. Obviously, the story is different when dealing with larger array elements, but in 95% of cases it is no problem to waste the bit of space. 209.131.76.183 (talk) 19:01, 19 October 2012 (UTC)[reply]
I often use 0 to mean something special. For example, with a color map, the color 0 might be used to mean transparent. StuRat (talk) 20:23, 19 October 2012 (UTC)[reply]
If you think of an array of n elements as a row of boxes of width 1, each of which holds a value, then the width of the array is n, and you can naturally put it on the number line with the leftmost point at 0 and the rightmost point at n. The elements of the array are 0:1, 1:2, ..., (n-1):n, where the a:b notation means the box that extends from a to b on the number line. There's no 0-vs-1 ambiguity there. The ambiguity shows up when you want to refer to a box by a single number instead of a pair of numbers. You can use the leftmost point, in which case the indices are 0, ..., n-1, or the rightmost point, in which case the indices are 1, ..., n. I think the latter works as well as the former as long as you're consistent about it. In Python, for example, if arrays started at 1, the first element of the array would still be [0:1], because the slice notation would exclude the low index and include the high, instead of the other way around. Even in C, arrays could start at 1 if you take the view that pointers point between bytes, and *p means the value that ends at the point designated by p, instead of the value beginning there. Likewise, in the C++ STL, iterators point between elements for many purposes (whenever you pass beginning and ending iterators to a function), and arrays could be indexed by 1 if you used the convention that *p, where p is now an iterator, means the element before p instead of the element after. The definition of v[i] in this system is still *(v.begin() + i). You don't need any ±1 fixups as long as you're consistent.
I think the only reason to use 1 rather than 0 is historical: human languages do it because counting words predate the discovery of zero. The best reason to use 0 is also historical: the currently most popular programming languages do it. Either way, to avoid off-by-one errors, you have to understand the difference between points (which lie between elements and have no width) and elements (which are bounded by points). This issue also comes up when dealing with times. 12:00 might mean a moment—the stroke of midnight—or it might mean the minute that starts at midnight (since digital clocks use the 0-based convention). A good time library distinguishes the two. -- BenRG (talk) 19:08, 19 October 2012 (UTC)[reply]
Also consider some of the implications of 1-based or 0-based counting. Here's a simple decrement print in FORTRAN:
     do I = 12,10,-1
       print *,I
     enddo
and the results:
         12
         11
         10
Here's a simple decrement print in Python:
for I in range(12,10,-1):
    print I
and the results:
12
11
So, which is more intuitive ? StuRat (talk) 19:38, 19 October 2012 (UTC)[reply]

Google Books

Hello,

how to view pages of books in Gbooks that are usually not visible? I really need one page from Dostoevsky Encyclopedia, either 187 or 188. Is there any trick? Regards.--Tomcat (7) 09:55, 19 October 2012 (UTC)[reply]

Buy it! That's the reason its not visible. -- Q Chris (talk) 09:59, 19 October 2012 (UTC)[reply]
It's on Amazon — do a "search inside" for 187 and the page comes up. --Mr.98 (talk) 11:43, 19 October 2012 (UTC)[reply]
I can not view the page there. Regards.--Tomcat (7) 15:17, 19 October 2012 (UTC)[reply]
I can see page 187 here, not 188 (if you meant that book). You can try WP:REX. --Tito Dutta (talk) 20:09, 19 October 2012 (UTC)[reply]
I suppose if, somehow, you know what content might be on that page, you could type that content in the search bar along with the book name. If the book is preview-able you might be able to read that page, but only if it comes up as a suggestion. dci | TALK 02:22, 20 October 2012 (UTC)[reply]
Let me note that the set of visible pages in a Google Books preview varies from visit to visit, so pages that one person can see might not be visible to somebody else. That's been a frequent cause of confusion. Looie496 (talk) 16:40, 20 October 2012 (UTC)[reply]

Doubts about R

If you can use R just as a statistics package, why does it have an own programming language? Do you have to learn this programming language necessarily or can you just use all its capabilities with the corresponding libraries of Java or Python? OsmanRF34 (talk) 12:52, 19 October 2012 (UTC)[reply]

I don't think most people understand a "statistics package" to be anything more than software for statistical analysis, which R is. I'm sure there are ways to call R functions from java and python, but I doubt there's much advantage in that if you are starting from scratch. --83.84.137.22 (talk) 16:27, 19 October 2012 (UTC)[reply]

Do you have to understand pointers?

If you are programming in a high-level language, you know that a = 10 stores this 10 somewhere called x034873497 or something like that, but do you have to know that for something useful? OsmanRF34 (talk) 14:14, 19 October 2012 (UTC)[reply]

The actual value (0x034...) doesn't normally come into play, but pointers can be useful in lots of higher-level applications. For example, if you're working with a 200MB piece of data in a class, you'll probably want to refer to it with pointers (or by reference, which just hides the fact that you are using a pointer) so that you aren't copying the entire object every time you pass it to a function. Pointer arithmetic also comes in handy in some situations, but you can probably get by without ever using it for most applications. I'm currently working on a project that involves multiple processes using a shared memory space. Properly using that space without introducing concurrency bugs involves allocators and queues built from scratch and is very reliant on pointers. 209.131.76.183 (talk) 15:02, 19 October 2012 (UTC)[reply]
I've also found pointers quite useful when sorting long strings. If you move 4 byte pointers around, versus 400 byte (character) strings, that takes 1% as long, all other things being equal. StuRat (talk) 17:43, 19 October 2012 (UTC)[reply]
Strictly answering the question: you don't have to understand anything. As far as I know, basic competency in computer science topics is not required by any officiating organization. However, even if you are not programming in a low-level language, you will improve your productivity as a programmer, and your program's efficiency, if you know a few things about computers. First, understand your computer's memory system. Peter Norvig's infamous article actually lists some common performance metrics for reasonable machines in this decade. If you're programming in a high-level language, these performance details affect you - even when you don't manage them directly through numeric access to machine memory or managed/virtual memory. And secondly, understand the difference between a piece of data, and a reference to that data. Whether your programming-language encapsulates that concept in the machine-specific representation of a memory-pointer to a hardware address is irrelevant: the distinction is real (albeit, a little bit abstract); and this distinction is very important when discussing algorithmic efficiency. Nimur (talk) 18:28, 19 October 2012 (UTC)[reply]
You are not "strictly answering the question" BTW. I asked if given a condition (high-level programming language), it would be useful to know something. In general, obviously you won't need basic competency in anything. OsmanRF34 (talk) 19:23, 19 October 2012 (UTC)[reply]
And to answer your Q, it certainly is important to understand the concept of pointers, even though you may not need to use them, in many cases. StuRat (talk) 20:21, 19 October 2012 (UTC)[reply]
I think the main point is that you need to grok the difference between a reference to a thing and the thing itself. This is probably the hardest part of understanding pointers, so in a way you do have to understand pointers. I think what makes learning pointers painful in C is not really the concept—it's that popular C compilers don't produce useful error messages when you do illegal things such as using a pointer after the pointed-to thing has ceased to exist, or moving a pointer off the end of an array, so it takes forever to figure out what went wrong when you make a mistake. There should be a learner's C implementation that does do all of these checks, but there isn't that I know of (at least, not free and actively supported). -- BenRG (talk) 21:00, 19 October 2012 (UTC)[reply]
BenRG, you might find a managed C or C++ environment a lot more to your liking (or at least, more suitable when you train new programmers). Another option, for example, is static analysis with strongly enforced type- and use- warning, if you use the llvm compiler and static analysis tools, you can compile C code in a way that will warn you about uninitialized or invalid pointers. However, permitting "abuse" of pointers is a feature of the C programming language (rather than any specific implementation on any particular machine). The language itself does not differentiate between "good" and "bad" data access. It is "assumed" that the programmer is providing correct and valid instructions - for example, even when he/she accesses a pointer to unallocated memory, the programmer may be intentionally accessing memory-mapped hardware. In managed C environments, a lot more strict rules are in force; and a static-analyzer can therefore provide helpful messages about mis-used pointers. Or, consider Java: it is a language where the safety is designed in to the programming-language (rather than into any specific tool or compiler). It is not possible - in the strict, pure mathematically-provable sense - to construct a legal Java program that corrupts memory. (See, for example, the section on Language Safety in the LLVM compiler guide. Nimur (talk) 22:40, 19 October 2012 (UTC)[reply]
"you might find a managed C or C++ environment a lot more to your liking"—no, the point is to learn standard C, not a garbage collected language with a C-like syntax. Not that there's anything wrong with that, but you might as well use a more popular one like Java. "The language itself does not differentiate between 'good' and 'bad' data access"—yes, it does. If you write int a[10]; int *p = a; p += 11; a conforming implementation is allowed to abort execution with a message like "pointer p was incremented past the end of array a" and a stack traceback. You may be used to writing things like *(char *)0x1234 = 0x56 to write a hardware register, but that's a feature of whatever embedded system compiler you're using, not a feature of standard C. -- BenRG (talk) 06:41, 20 October 2012 (UTC)[reply]
BenRG, on careful inspection of my K&R text, The C Programming Language, I accede the point: certain pointer access is explicitly declared illegal. For example, (Section 5.3), referring to an object outside an array bound is explicitly illegal. So, you are correct: a good C compiler could verbosely log that error at compile or even at runtime. (However, I interpret this to mean "p += 11; " is legal, while "a[11]" is not, in the example you gave). There are other cases, too. Other pointer access is explicitly syntactically legal, but its value is undefined per the C language specification. Your example, *(char *)0x1234 = 0x56, is just frightening, and I hope I don't come across as the kind of person who would author that style of code. I was thinking more about uninitialized or unallocated arrays accessed by constant pointers: in some embedded systems, it's common to treat an entire address range of memory-mapped I/O as one giant array, even though it's never been explicitly allocated or initialized. Such code is very easy to read and maintain, when written in C; and is "syntactically legal," per K&R's use of that phrase; but is clearly taking advantage of machine-specific behavior that is "undefined" by the language. Nimur (talk) 07:48, 20 October 2012 (UTC)[reply]
Many, many years ago, I was reviewing code checked in by my team lead and discovered that in some unlikely situation it did *((char*)0)=0, apparently because he wanted to stop execution at that point. I complained vociferously. He couldn't understand the problem. Marnanel (talk) 07:54, 20 October 2012 (UTC)[reply]
No you don't have to understand pointers. I do a lot of programming in Matlab, which is a language that doesn't even have a pointer class and provides no simple way to directly access memory. One could get very deep into Matlab and do many useful things while having no idea about pointers or memory architecture in general. That said, understanding the internals is useful. Knowing when Matlab is going to pass a reference to data and when it is going to duplicate the data can often help diagnose performance bottlenecks. In practice, one could probably do a lot of code optimization simply by trial and error, but knowing how the internals work does provide an advantage. That said, I've seen a lot of academic research done by people who probably couldn't give you a good definition of what a pointer is, so it certainly is possible to program in some high level languages without ever learning about pointers. Dragons flight (talk) 20:41, 19 October 2012 (UTC)[reply]
In fact, MATLAB (the programming language) has pointers. These can be explicitly defined, using the MATLAB special superclass, handle; or they can be implicitly used via the MATLAB class system; or machine-specific memory access can be implemented by exercising an interface to any of the numerous external programming language interfaces. Or, you can implicitly access offset data, through the use of MATLAB's powerful matrix and vector syntax. It has been my experience that bad MATLAB code - the kind of code that causes people to invalidly assert that "MATLAB is slower than FORTRAN" - is almost entirely due to programmer-error: a tiny misunderstanding of the subtleties of MATLAB's programming language syntax means the difference between copying a large matrix, versus copying a tiny pointer to a large matrix. In fact, one of the things that makes MATLAB so convenient for writing mathematical expressions is that you can express data-access using array and matrix notation - which is a special case of using pointers. Just because you exercise a small subset of the language - or you don't understand the way that the code you write is actually working - doesn't mean that MATLAB lacks pointers. In fact, one can write many complex C programs that uses no pointer syntax; but that doesn't mean C lacks pointers. Nimur (talk) 22:44, 19 October 2012 (UTC)[reply]
I use handles, they are as close as Matlab comes to exposing a pointer class, but they aren't pointers as people who use low level languages would usually understand the term. Many languages have a kind of pointer which is a memory address you can manipulate, reposition, recast, etc. Matlab never exposes something that looks like a memory address, and imposes strong limitations on how and when data structures can be typecast. Matlab simply doesn't have any primitive that looks like a memory address pointer. I also wouldn't say that having Matlab call an external language, such as C or Java, to accomplish something is at all the same as saying that Matlab has that ability built into it. I do sometimes write scripts in other languages and interface them with Matlab to deal with Matlab's limitations, but just because such workarounds are available doesn't mean there isn't a limitation. Of course the underlying behavior of Matlab includes pointer style pass by reference and many other aspects where having an understanding of pointers and memory architecture is useful, but the programmer will not be manipulating something that actually looks like a memory reference. Lastly, please avoid the personal attacks. Dragons flight (talk) 00:01, 20 October 2012 (UTC)[reply]
No personal attack was intended. Anyway, the point is that pointers are not always C-style pointers, where the pointer is represented as a numeric type corresponding to a machine address. (In fact, K&R make clear that even in C, a pointer is not an integer: it is a pointer, and follows different rules, particularly with respect to arithmetic). A pointer is an abstraction of the representation of a reference to data, distinct from the data itself; it need not have anything to do with the data's layout in memory or its memory address. This abstraction feature is built in to the MATLAB programming language: in many ways, these pointers are more "pure" than C pointers; enforcement of strongly typed pointers comes with some advantages. Finally, I simply wanted to point out that MATLAB is not a sandboxed environment: the language specification explcitly allows for external access to system resources, including memory. This is unlike some other languages, which intentionally make raw machine-access impossible for the sake of sandboxing. Nimur (talk) 08:13, 20 October 2012 (UTC)[reply]
To quote pointer (computer programming): "More generally, a pointer is a kind of reference, and it is said that a pointer references a datum stored somewhere in memory; to obtain that datum is to dereference the pointer. The feature that separates pointers from other kinds of reference is that a pointer's value is meant to be interpreted as a memory address, which is a rather low-level concept." (emphasis added). Matlab has operations that qualify as references, but the language of our articles as well as my general understanding, is that what separates "pointers" from the broader class of "references" is that they can be interpreted as memory addresses. Matlab abstracts the memory operations in a way that generally makes such interpretations impossible. For example, a matrix in Matlab does not necessarily map to a contiguous block of RAM, and even within a contiguous blocks they don't guarantee that the fourth element of a list is always the fourth element in the allocated memory block. I could give many other examples. You seem to be defining "pointers" to include all forms of reference (computer science), which is an incorrect usage of the terminology in my opinion. They aren't "pure" pointers, because they aren't "pointers" at all. Dragons flight (talk) 18:44, 20 October 2012 (UTC)[reply]

What is the first image posted to the Internet (not to the WWW)?

The image of the singing group "Les Horribles Cernettes" is the first image posted to the world wide web. The coffee pot is the first web-cam image. But what is the first image posted to the Internet? It's hard to search because many hits return, incorrectly, the cernettes image. Feel free to define "posted to" and "Internet" in any sensible helpful way. I guess tcp/ip and publicly available are required. THANK YOU! :-) --31.126.189.205 (talk) 21:23, 19 October 2012 (UTC)[reply]

You'd also need to define "image" to come up with a sensible answer. Does ASCII art count as an image? --Carnildo (talk) 01:40, 20 October 2012 (UTC)[reply]
And what does "posted to the Internet" mean? Stored in some accessible place? Announced (how?) as being available? Does news:alt.binaries.pictures.* count as "on the Internet"? (Usenet did not always propagate on Internet, or so I understand.) —Tamfang (talk) 03:24, 20 October 2012 (UTC)[reply]
There were ASCII art versions of a number of Playboy centerfolds making their way around the networks in the mid-to-late 1970's (prior to TCP/IP). Zoonoses (talk) 03:37, 20 October 2012 (UTC)[reply]
"OMG, you can see her entire exclamation mark !" StuRat (talk) 06:58, 20 October 2012 (UTC) [reply]

October 20

Google Instant

I do not use a Google account when searching, but do have the Google toolbar, which has always used "Instant" to conduct searches. I found Instant very helpful, but all of the sudden it has ceased to work. Changing my search settings to make sure it is on does nothing. Currently, my toolbar offers suggestions when you type into the search box, but you have to fully type your query and then press enter or search. Not a big deal, but it's a bit irritating after getting so used to Instant.

Most of the articles I've read mention disabling cookies etc., changing the language, or other things; none of that stuff needs to be changed or would alter anything, from what I've seen. Any ideas? dci | TALK 02:21, 20 October 2012 (UTC)[reply]

Mac gaming microphone problem

I've had no luck with Steam Support or the Steam Community, so here goes: I'm running Left 4 Dead on a 2012 MacBook Pro with OS X 10.7, and it works perfectly except for the internal mic. When I play L4D, my voice comes out choppy, staticky and sped up, so no one can understand me. My mic works fine in other apps, it works fine in TF2 and and it works fine when I test it in Steam Preferences - I only have this problem in L4D and L4D2. I use headphones, so there's no issue with game noise; I tried enabling and disabling "boost microphone gain" and changing the mic sensitivity in the game options; and I made sure that the voice input volume was right in System Preferences - nothing worked. Can anybody familiar with Mac gaming help me out? --Lazar Taxon (talk) 12:37, 20 October 2012 (UTC)[reply]

That's an excellent bug report. The information you've given makes it likely that the problem involves the specific game. A Google search for "Left 4 dead microphone problem" finds lots of reports of similar issues -- this one might be the most useful, but if it doesn't help you, look at the others. Looie496 (talk) 16:37, 20 October 2012 (UTC)[reply]

Windows 8 interface

The new Windows 8 interface is not very good for desktops, see this. Does Windows 8 have an option to use the traditional interface (i.e. Windows 7)? Bubba73 You talkin' to me? 16:56, 20 October 2012 (UTC)[reply]

Windows 8 on intel-architecture, for the desktop and laptop, does. On embedded platforms (tablets and the like) it does not. -- Finlay McWalterTalk 17:10, 20 October 2012 (UTC)[reply]
By way of an illustration, there are two versions of Microsoft Surface: the ARM one only has Windows RT and the Metro UI, the Intel one has Windows 8 Pro and supports the "traditional desktop". -- Finlay McWalterTalk 17:18, 20 October 2012 (UTC)[reply]

http://classicshell.sf.net/ ¦ Reisio (talk) 17:24, 20 October 2012 (UTC)[reply]

which would be an option on a Metro-only platform (RT) if it was accepted into the Windows Store, and if Windows RT ships with the requisite shell dlls on which something like classicshell must depend (because it mostly tweaks the existing shell, not reimplements it). -- Finlay McWalterTalk 17:44, 20 October 2012 (UTC)[reply]
Thanks, I will be using a non-RT version on a desktop. Bubba73 You talkin' to me? 18:20, 20 October 2012 (UTC)[reply]
One thing that's not clear is whether you must boot into Metro first (and then have to click a button to go into classic mode). For some of the betas you could do some registry massaging and set it up so it booted straight into explorer.exe (the normal shell). I think some later betas removed that. I don't know what the status of that is in the released-to-master version. -- Finlay McWalterTalk 19:19, 20 October 2012 (UTC)[reply]