Jump to content

Wikipedia:Reference desk/Archives/Computing/2009 January 22

From Wikipedia, the free encyclopedia
Computing desk
< January 21 << Dec | January | Feb >> January 23 >
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.


January 22

[edit]

basic C++ help

[edit]

I'm new to programing, and it's really frustrating. I need my program to read from a file (groceries.data) and then output it. I just can't seem to get it to work. This is what I have, based on textbook examples and handouts.

#include <fstream>
#include <iostream>
using namespace std;


int main(){
  string groceries;
  ifstream groceries ("groceries.data", ios::in);
  groceries>>...
    cout << groceries; << endl;
}

It keeps giving me errors. Where am I going wrong? Thanks for your help, whoever helps. —Preceding unsigned comment added by 134.82.78.80 (talk) 01:19, 22 January 2009 (UTC)[reply]

I wrapped your source inside a <syntaxhighlight lang="">..</syntaxhighlight> for readability. I see a couple of problems. First, I would suggest naming your ifstream object something different from your string (both are currently named "groceries"). Next, when reading from the stream, the stream object should be placed to the left of the >> operator, and the object (string) to receive the data to the right. That statement would be terminated with a semicolon. Finally, you have an extra semicolon in your output statement. It's okay and quite common to have multiple output items strung together with multiple << operators in a single statement.
Try updating your code to see if you make any progress. If you still have problems, post your next version and we'll try to help. -- Tcncv (talk) 01:41, 22 January 2009 (UTC)[reply]
#include <fstream>
#include <iostream>
using namespace std;


int main(){ fstream file;
 char line[80];//to input the data from the file
 file.open("groceries.data",ios::in);
 while(!file.eof())  //to keep it running until the last of the file is encountered
 {
  file.getline(line,80,'\n');//to input the string from the file linewise
  cout<<line<<endl;//outputting the string to the screen
 }
}
I think that should work. Vineeth h (talk) 14:22, 25 January 2009 (UTC)[reply]

standard tetris game, windows?

[edit]

can anyone recommend a free STANDARD tetris game I can download for Windows XP. I just tried like 5 of them, and I tried all the top results for "java tetris" in my browser too and none of them are good, standard tetris.

Do any of you play one you can recommend for me? Please only answer if you've actually, seriously played it for a long time. Thanks! —Preceding unsigned comment added by 82.120.227.136 (talk) 01:31, 22 January 2009 (UTC)[reply]

Well, I haven't "actually, seriously played it for a long time", but perhaps you can find some helpful information on a Wiki devoted to Tetris. I suspect at least one person there will have "actually, seriously played it for a long time". -- 74.137.108.115 (talk) 02:07, 22 January 2009 (UTC)[reply]
Okay, you don't have to have "actually, seriously played it for a long time" but even if you haven't "actually, seriously played it for a long time" do you know of a specific one you can recommend for me? —Preceding unsigned comment added by 82.120.227.136 (talk) 02:19, 22 January 2009 (UTC)[reply]
Technically, no. But this list of "fan games" probably has something to suit you. -- 74.137.108.115 (talk) 02:45, 22 January 2009 (UTC)[reply]
The definitive tetris for windows came with the excellent Best of Microsoft Entertainment Pack. It's the one that Peter is playing in Office Space. BOWEP isn't sold anymore but it's been available here for a long time. You might also want to look at TetriNET .froth. (talk) 18:58, 23 January 2009 (UTC)[reply]

[edit]

Does anyone know what symbol occupied the place of the euro sign (option-shift-2) on U.S. Mac OS keyboards before the euro was introduced? Lesgles (talk) 04:37, 22 January 2009 (UTC)[reply]

According to the apple support website it replaced the currency symbol. Nanonic (talk) 07:56, 22 January 2009 (UTC)[reply]
Thanks! Lesgles (talk) 06:04, 23 January 2009 (UTC)[reply]

Download Wikipedia.

[edit]

Very soon i will be visiting a relative in a third world country. Among other things i will be bringing a laptop to give to the relative. My relative does now have internet and has no way of getting access to the internet, so I would like to put a full (or nearly full) copy of the English Wikipedia on to this laptop. I would like it to be in the same format as it is online. What would be the easiest way of going about this?

Thank you 98.238.145.2 (talk) 06:43, 22 January 2009 (UTC)[reply]

[1]. Note that the English version is around 14 gigabytes, and there's no way to choose which articles you want. If you want a smaller version, you'll have to set up a local web server like Apache, get PHP and MediaWiki, and import pages-articles.xml.bz2. That one's 4.1 GB. --wj32 t/c 08:54, 22 January 2009 (UTC)[reply]
(edit conflict) If I am not mistaken, the Wikipedia article database is a (huge) XML file. It should not be that difficult to write a Windows application using a Internet Explorer component for viewing the pages from a database file. (Do not try to read from the original XML file, though – reading a 4 GB file to RAM is still highly inadvisable.) Has no one ever tried this before? Are there no Wikipedia EXEs already compiled? --Andreas Rejbrand (talk) 08:59, 22 January 2009 (UTC)[reply]
Is there a way to download the complete 14gb? ceo 09:41, 22 January 2009 (UTC) —Preceding unsigned comment added by Ceo (talkcontribs)
You might be interested in WP:Wikipedia-CD/Download, a good selection of articles in 2006. Hopefully a new version on DVD instead will come sometime soon but I don't know any details of that. Dmcq (talk) 10:51, 22 January 2009 (UTC)[reply]
I don't know what you mean by "is there a way to download the complete 14gb". It's here. --wj32 t/c 22:47, 22 January 2009 (UTC)[reply]

What is the etymology or reasoning behind the name of this? thanks, --Molten Epidermis (talk) 12:20, 22 January 2009 (UTC)[reply]

My hypothesis: The application (wizard) makes all sorts of "strange and complicated" things for you (e.g. installing an application), like a wizard, after asking you a few questions. --Andreas Rejbrand (talk) 15:15, 22 January 2009 (UTC)[reply]
Some time ago (10-15 years) I worked on a project where I needed to use the Spanish version of Microsoft Excel, and noticed that it used the word for "Assistant" instead of "Wizard". I never found the reason for this - some cultural sensitivity perhaps? - and I don't know if it's still the case. AndrewWTaylor (talk) 13:31, 23 January 2009 (UTC)[reply]

RAR or 7zip

[edit]

what's the best archive format for storing large numbers of file? —Preceding unsigned comment added by 194.80.240.66 (talk) 12:28, 22 January 2009 (UTC)[reply]

Acording to http://www.kikizas.net/en/apps.7z.html there is not much difference though anecdotally you are more likely to recover data from corrupt RAR archives. -- Q Chris (talk) 12:42, 22 January 2009 (UTC)[reply]
Sorry i should have been more specific. I'm not too bothered about the compression, i'd like to know which works best for large numbers of files, recovery (as you said), cross platform implementation etc. —Preceding unsigned comment added by 194.80.240.66 (talk) 13:03, 22 January 2009 (UTC)[reply]
(A little off topic) One issue for us tightwads is that the 7zip software is a free download, but winrar is only a 30-day free trial. 7zip also a supports a wide range of archive formats including RAR. Astronaut (talk) 18:54, 22 January 2009 (UTC)[reply]
I duno about 30-day trial, works for me no nag screens or nothing. —Preceding unsigned comment added by 82.43.88.87 (talk) 20:47, 22 January 2009 (UTC)[reply]
TBH I hadn't checked recently but just now I got a nag screen saying that Winrar is not free and after a 40 day trial period I must buy a license or remove it. However, considering the wide range of free alternatives, I'm in no rush to splash out 30 Euros. Astronaut (talk) 23:42, 22 January 2009 (UTC)[reply]

Safe Games?

[edit]

At my school, I have two periods in which I have no class; I attempted to play Antari's Impossible Quiz, which is completely innocent -and- FUN! But, my school is somehow stopping it from loading. So any suggestions on some game sites that wouldn't be blocked? —Preceding unsigned comment added by EWHS (talkcontribs) 14:24, 22 January 2009 (UTC)[reply]

How should we know your school's internet blocking policy? The best advice I can give is to google for gaming sites and try them until something works. Algebraist 14:36, 22 January 2009 (UTC)[reply]
Another advice is to follow your school's rules, and not use computers for gaming at all. (Indeed, there might be reasons for why some sites are blocked.) --Andreas Rejbrand (talk) 15:18, 22 January 2009 (UTC)[reply]
But that's not fun!  Buffered Input Output 17:16, 22 January 2009 (UTC) [reply]
How do you know that his school's rules state that computers are not to be used for gaming at all? (They might! But the original poster doesn't say anything of the sort.) I mean, I don't think it's at all unusual for schools to just block sites en masse and not worry too much about sites that wouldn't violate the school's policy getting caught in the wave. -- Captain Disdain (talk) 17:25, 22 January 2009 (UTC)[reply]
I'm guessing that you have much better games at home, so my suggestion is to use that time at school to do your homework and study, so you will have two more hours at home each day to play the really excellent games. This will also keep you from getting in trouble for playing games on the computers at school, if that's not allowed. StuRat (talk) 18:40, 22 January 2009 (UTC)[reply]
It's possible to bypass some blocks using anonymizers. In high school, one of the guys in my computer class set one up so we could play games and browse humor sites. If you don't have a friend who knows computers, a site like [2] might work. I don't recommend using that, since there's probably rules against it, but it's something to think about. As far as finding sites that won't be blocked, I doubt it's possible. They probably just block every site with any kind of animation on it. Black Carrot (talk) 16:03, 23 January 2009 (UTC)[reply]
Most Flash games can be downloaded and put on a flash drive. You should then be able to play them at school.

Xcode on two Macs-discepancy

[edit]

I have written a program in the Xcode environment. I can run it on an iMac (Power PC) with no problem, but when I try to run exactly the same program (I just copied and pasted the code between environments) on my macbook, it launches a gbd debugger, and when I run it in terminal it says 'floating point exception.' Why is this happening when it is exactly the same code? The versions of Xcode are 3.1 and 3.0 respectively, but the code is a very primitive C program, so I don't see how that should be a problem...

Thanks --Cash4alex (talk) 14:47, 22 January 2009 (UTC)[reply]

C (source code) programs are not entirely portable between architectures. Issues about endianness, alignment, packing, memory layout, and pointer type can all vary. Even a very trivial C program can work on one architecture and coredump on another. Equally the foibles of one architecture can hide problems which are exposed on another. What you need to do is to reduce the problem to a minimal case (just a few lines) - if you post that here someone may be able to help - but please don't post the whole big program. Mimetic Polyalloy (talk) 15:22, 22 January 2009 (UTC)[reply]
And keep in mind that a Macbook and an IMac have totally different processors (PowerPC vs. Intel); it's worse than just running it on two slightly different computers. I'm no C programmer but it strikes me that you could easily have some PPC-specific library included without realizing that you need to replace it with an Intel one, or something like that. --98.217.14.211 (talk) 15:35, 22 January 2009 (UTC)[reply]
It may help to note that the message "floating point exception" can actually be generated without any floating point calculation: often it's generated by integer division by zero. It should perhaps be called "arithmetic exception" instead. --Tardis (talk) 16:11, 22 January 2009 (UTC)[reply]
I don't now about the iMac but another possible problem is that floating point exceptions are normally enabled for C programs but disabled for other environments like Java. Perhaps Xcode disables exceptions? Dmcq (talk) 18:33, 22 January 2009 (UTC)[reply]
Looking at Apple my guess is that endianess is the problem. The powerPC is big enian and I guess your macbook is an Intel little endian version. You may be reading or writing data a bye at a time or using union. Dmcq (talk) 18:37, 22 January 2009 (UTC)[reply]

Can someone help me fidure this out?

[edit]

I am now nearly 100% sure that my home desktop has that conflicker worm that we have been hearing so much about. I downloaded that tool that Microsoft says will fix/remove it, but my computer won't run the program. I found out only recently that the desktop at home isn;t set to reconginze me as the admin on the computer, so I want to know if I need admin privilages to run the MS tool to get rid of the worm. Can someone help? 129.108.224.255 (talk) 16:03, 22 January 2009 (UTC)[reply]

What operating system are you using? Do you have an anti-virus message that says you have this worm? Do you have the ability to make yourself the administrator or have access to the admin account?Livewireo (talk) 20:45, 22 January 2009 (UTC)[reply]
Respectively: Windows XP, Not conflicker directly, but all the symptoms match what I am experiencing on the desktop, and I have no idea how to make myself the administrator since the only account on the computer is mine. 76.192.80.133 (talk) 02:33, 23 January 2009 (UTC)[reply]
ctrl-alt-delete 3 or 4 times at the login area when Windows finishes loading. (this is if you have a password protected account) then type in "Administrator" and then hit enter. Rgoodermote  21:19, 23 January 2009 (UTC)[reply]

ASCII

[edit]

Why does ASCII start with null and go into things like form feed and bell first instead of starting out with numbers or even letters first? I have a theory that it is because early computers weren't used as word processors, so there was less of a need for ASCII than there was for things that would punch cards, light lights, and ring bells. Dismas|(talk) 21:49, 22 January 2009 (UTC)[reply]

All those early characters were important for the operation of the teletype machines that ASCII was originally designed for. The articles ASCII and ASCII Control Characters have a lot of info on this. APL (talk) 22:16, 22 January 2009 (UTC)[reply]
The way ASCII is arranged allows for some neat shortcuts for programmers, all printable characters are in a contiguous range, substracting 30 from the ASCII code for a number results in the value of that number, adding 32 to an upper case letter results in the lower case equivilent and the reverse. My pet theory as to why ASCII starts with null (and thus to keep all non printable character together at the start) is that in the C programming language, strings are terminated by null and the numeric value 0 evaluates to false, so when traversing a string one can use a construct like "while(str[i])" which would stop looping when it encounters the null terminator (Disclaimer: This may be bad practice, I am not a professional programmer). 90.219.129.24 (talk) 23:18, 22 January 2009 (UTC)[reply]
The C programming language came along much later than the invention of ASCII, but the reasons for the layout of ASCII is explained in the ASCII artile. Astronaut (talk) 00:17, 23 January 2009 (UTC)[reply]
In the specific case of NUL, it's assigned value 0 because ASCII is designed around the needs of punched tape and transmission over teleprinter connections, and 0 corresponds to a blank tape or no signal. --Carnildo (talk) 22:26, 23 January 2009 (UTC)[reply]

Outlook backup

[edit]

How do I do this please? Kittybrewster 22:13, 22 January 2009 (UTC)[reply]

The data files used to store messages, appointments etc. are stored in *.pst files in C:\Users\<User Name>\AppData\Local\Microsoft\Outlook. Usually the interesting file is called Outlook.pst. Just copy this file (or, these files) to a safe location. --Andreas Rejbrand (talk) 22:34, 22 January 2009 (UTC)[reply]
That's the location in Vista. It is somewhere else in XP - I'll try to find out the location. Astronaut (talk) 23:46, 22 January 2009 (UTC)[reply]
On XP, Outlook Express files are stored here: C:\Documents and Settings\<user name>\Local Settings\Application Data\Identities\{...}\Microsoft\Outlook Express\ Astronaut (talk) 11:59, 24 January 2009 (UTC)[reply]
There is a backup addin that does exactly what you want: http://www.microsoft.com/downloads/details.aspx?FamilyId=8B081F3A-B7D0-4B16-B8AF-5A6322F4FD01

computing,email attachments

[edit]

Both my computers (Desktop Vista and Thunderbird, notebook XP and Outlook express) are connected to broadband through a common mdem/router and phone line. Both fail to send any email including an attachment of any size. Any info/doc. on the subject?Passwordedout (talk) 22:45, 22 January 2009 (UTC)[reply]

What type of attachments are you trying to send (programs, music, images)? Astronaut (talk) 00:19, 23 January 2009 (UTC)[reply]
Although some email clients "helpfully" remove some attachments, the more likely scenario here is that the mail server you are connecting to doesn't allow attachments. Configuring your email client to authenticate to the server for outgoing email *may* help. You might also try contacting technical support for your email provider (likely your ISP). Also, an error message or description of the failure would help us provide meaningful assistance. -- 74.137.108.115 (talk) 01:13, 23 January 2009 (UTC)[reply]
Do you have trouble downloading or uploading large files or webpages (like, bigger than 1.5K)? If so, your MTU may be set incorrectly. --131.179.33.138 (talk) 01:55, 23 January 2009 (UTC)[reply]