Jump to content

Wikipedia:Reference desk/Archives/Computing/2007 November 15

From Wikipedia, the free encyclopedia
Computing desk
< November 14 << Oct | November | Dec >> November 16 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


November 15

[edit]

Domplayer

[edit]

I just downloaded a video of of bittorent (not illegal.. don't worry). Weh I open the .avi with VLC (newest version), the video says that I must view it with Domplayer. It looks fishy, I don't want to even download it. Is there a way to convert the video so VLC can use it? I'm on an Mac, using leopard. —Preceding unsigned comment added by 71.195.124.101 (talk) 00:35, 15 November 2007 (UTC)[reply]

This is a growing problem - people offer video for download for free - and indeed, you can download it for free - however, they have used their own non-standard codec to encode it. So to replay your "free" video you have to get their player - which either costs money or requires you to give up personal information to someone whom you already know is a sleezebag - or occasionally may take over your computer and turn it to evil purposes. Give up - just delete the darned thing. SteveBaker 00:46, 15 November 2007 (UTC)[reply]
Exactly what he said. It's some sort of racket; you're better off just not giving into it. Don't encourage people with these irritating schemes. --24.147.86.187 00:50, 15 November 2007 (UTC)[reply]
Yep it's a scam --ffroth 01:22, 15 November 2007 (UTC)[reply]

computer ram,specifically dual channel

[edit]

i am a new computer builders,i was just wondering what my option are when i want 4 gb of computer, memory which my motherboard says it can handle,and im shopping around.i ran into 2 x 2096mb,which is 4gb, and 4x1024mb,which is 4gb also,and i cant understand the difference.i want to get the 2x2096 cause ill save space and its the same speed and ddr2 so i dont understand. —Preceding unsigned comment added by 24.34.113.110 (talk) 01:24, 15 November 2007 (UTC)[reply]

I would go with 2 sticks of 2GB, leaves room for future upgrade. But be warned, you'll need a 64 bit system to take advantage of any ram above 4GB. --antilivedT | C | G 06:10, 15 November 2007 (UTC)[reply]
also be warned that your motherboard might be 4GB max, so if it has 4 slots each one might be 1GB max. Check your motherboard manual.--Dacium 01:25, 16 November 2007 (UTC)[reply]

If you are running a 32bit OS (if you don't know what I mean you probably are) then your PC can only have 4gb max including graphics card memory and soundcard memory (as well as virtual memory I think), so you might find yourself only being able to use 3.5gb of your new memory or similar. TheGreatZorko 09:50, 16 November 2007 (UTC)[reply]

No, your video ram doesn't count as it cannot be called from CPU directly, so you can have both 4GiB of ram and chain 2 8800GTX together with 1.5GiB of VRAM (if you have the money). Sound cards generally don't have RAM, and it can't be reached by the CPU directly anyway. The 4GB limit is due to the CPU running out of addresses as it uses a 32bit value for memory addresses, and can only have 232 addresses. In addition, the OS holds page tables and the like (or so I heard) in the same space, and thus the actual amount of memory you can use under 32-bit system is less than 4GiB. Things like Physical Address Extension can be used to overcome that limitation (other than upgrading to 64bit processors), but the software support is very erratic and thus there's not much you can do about it. --antilivedT | C | G 09:44, 17 November 2007 (UTC)[reply]

Photoshop 7.0 Help

[edit]

Hi, I use Photoshop 7.0 and I am trying to do a nice picture collage. I used to know how to do this but I forgot so someone may be able to help me. I wans to import these pictures into photoshop (about 400 of them, yeah its a BIG collage) but, I want to shrink the size to about 2 inches, grayscale them and possibly crop them as well. How do I set photoshop to automatically do this to these pictures? I know I've seen it before. I thought it might be in the filters menu but I cant remember... Any help would be GREATLY appreciated!! Thanks a million! --Zach 02:06, 15 November 2007 (UTC)[reply]

What you want is the Actions menu. Once you have recorded a set of instructions (size, grayscale, crop) as a new Action, then you can apply it to a whole directory of images via File > Automate > Batch. --24.147.86.187 02:31, 15 November 2007 (UTC)[reply]
AHHHH!!! You are a LIFESAVER!!! Thank you SOOOO much!! --Zach 02:34, 15 November 2007 (UTC)[reply]

Get Mozilla Thunderbird 2.0 to recognize folders in email account

[edit]

I just got Mozilla Thunderbird to help get a lesser-used email address under control. Basically, I am using Thunderbird only for online email purposes, not downloading to offline. Anyway, the program recognizes my main inbox and lets me look through that, but Thunderbird does not pick up my other email folders.

How can I get it to do that?

I am using Thunderbird 2.0, and I have the email account set as an IMAP, which was what the email account administrator recommended. Guroadrunner 05:31, 15 November 2007 (UTC)[reply]

Answer -- right click the Inbox on the left hand side menu and select "subscribe". From there one goes to a subscription menu where you can click which folders you want to show up or access from the remote email address. (I got this advice from the support IRC channel Mozilla set up for Thunderbird) -- Guroadrunner 06:12, 15 November 2007 (UTC)[reply]
The Mozilla IRC support channel was #thunderbird @ irc.mozilla.org and there are a bunch of tutorials out there:
There's also a small mention at http://kb.mozillazine.org/IMAP:_advanced_account_configuration (but it needs more coverage) --Jeremyb 06:35, 15 November 2007 (UTC)[reply]

region-free DVD player (laptop)

[edit]

Is there a legal and free way of watching DVDs independent of region on a laptop? I've heard about firmware (without any clear idea of what it is), and the Wikipedia article DVD region code claims that "most freeware and open-source DVD players ignore region coding". I've read that firmware can cause problems with your DVD drive, and haven't found any free player yet that claims to be "region-free". So - is there a possibility or not? Thanks, Ibn Battuta 07:16, 15 November 2007 (UTC)[reply]

VLC media player will play any DVD region --Jeremyb 07:57, 15 November 2007 (UTC)[reply]
Also you can flash the firmware of your DVD drive- firmware is just the code in the device that tells it how to work, and if you replace it with code that ignores region coding then that's not a problem. It'll void your warranty and is probably a violation of the DMCA though --ffroth 17:13, 15 November 2007 (UTC)[reply]
My Linux machines have all played DVD's from US, Japan, UK, France and Australia/NewZealand regions using mplayer without problems and without firmware changes. So I don't entirely understand how the firmware matters. Having said that, I've heard of a Windows user who played a British DVD on their USA computers' DVD drive as the very first video they ever played on it. After that, the darned thing wouldn't play US DVD's. It's like it 'bonded' itself to a particular region on the very first disk it played. The whole system is complete mess. But I would certainly try some OpenSourced DVD software. SteveBaker 18:10, 15 November 2007 (UTC)[reply]
Yep. That windows user could have changed the region coding though- the default firmware allows you to change it up to 5 times (usually) before it locks in. It's pretty obscure though, you have to go digging in settings --ffroth 22:25, 15 November 2007 (UTC)[reply]

Any DVD from Slysoft does a good job of negating all the region coding. Google 'any dvd' and check out their website. 88.144.64.61 07:08, 16 November 2007 (UTC)[reply]

DVD Decryptor does similar but is free. I can't actually access the Slysoft website from where I am but from memory I think it costs money, both of these programs might be illegal depending on where you live by the way, but then again making your drive region free might do that too. TheGreatZorko 09:48, 16 November 2007 (UTC)[reply]

Issue with MS excel file

[edit]

A sheet in MS Excel has data only in 2 columns and 30 rows. There are no formula or formatting except that some of the cells in these two columns are having a fill colour.

The problem is that the size of the file is coming to be 24.6 MB. If I select all the cells having the data and set this area as the print area then the file size comes down to around 10 MB. Is there any other way also so that I can decrease the size of this file to a much smaller size as the data in the file in not as much. Its must be around 20 KB. —Preceding unsigned comment added by 210.18.82.102 (talk) 10:23, 15 November 2007 (UTC)[reply]

Compress it using something like DEFLATE? It seems awfully big for such a simple spreadsheet. --antilivedT | C | G 10:30, 15 November 2007 (UTC)[reply]
The simplest method is to copy and paste the data to a completely new workbook. If this workbook had a lot of material that was deleted, then this may account for the size. Excel seems to not really delete stuff, it just hides it. That in itself can be a vulnerability if you send a workbook off to someone you don't expect to see that material, as it can be recovered. Opening such a workbook in OpenOffice.org Calc will reveal any "hidden" data, as Calc does not seem to have this problem. --— Gadget850 (Ed) talk - 10:31, 15 November 2007 (UTC)[reply]
There is also a MS plugin to remove hidden data. [1] --— Gadget850 (Ed) talk - 10:35, 15 November 2007 (UTC)[reply]


First of all, thanks a lot for all your suggestion. Will there be any compatability issues if I download OpenOffice applications on a system already having MS Office applications installed on it. —Preceding unsigned comment added by 210.18.82.102 (talk) 11:05, 15 November 2007 (UTC)[reply]

I run both at work with no issues. I've also used OpenOffice.org Write to repair corrupted MS Word files for customers. Let us know hot it works out. --— Gadget850 (Ed) talk - 11:16, 15 November 2007 (UTC)[reply]

C help: Why two gets() in this program?

[edit]

Can someone please tell me why I need to give two gets() functions in this pgm one after the other? If I dont, the program skips the statement, and doesn't read any value into the string.

include<stdio.h>
struct emp
{
int m,n;
char line[20];
}x;
main()
{
scanf("%d %d",&x.n,&x.n);
gets(x.line);
gets(x.line); ///WHY THIS?
printf("%d %d",x.m,x.n);
puts(x.line);
}

Likewise, I need to give two scanf statements at the end of a do..while loop

do
{
//blah blah
printf("Do you want to contnue? (Y/N)");
scanf("%c", &ch);
scanf("%c", &ch); ////WHY THIS?
}while(ch=='y');

Any help would be appreciated. Thanks!--202.164.142.88 14:31, 15 November 2007 (UTC)[reply]

The gets() function reads the input until it encounters a newline character (your pressing of the Enter key). It does not read the newline character, though, but leaves it in the buffer. The next time gets() is called, it immediately gets the newline character and won't let you enter anything. You may want to try fflush(stdin) before gets() See e.g. http://www.physicsforums.com/archive/index.php/t-77069.html. ›mysid () 14:46, 15 November 2007 (UTC)[reply]
That helped. Thank you!--202.164.142.88 14:58, 15 November 2007 (UTC)[reply]
  • Actually, Mysid's not quite right. gets() does indeed remove the newline from the input buffer (although it replaces it with a '\0' in the caller's memory buffer). The reason you need two gets() calls in this program is that scanf() is only reading until it gets a second integer, as its format directed it. The first gets() removes the newline following those two numbers, and then the second gets() reads the text line. Adding a newline to your scanf() format will fix it, and you can then remove the second gets():
scanf("%d %d\n",&x.n,&x.n);
All that said, scanf() has lousy behavior that will eventually make you cry, and gets() should *never* be used for any reason. Consider what will happen if the user enters 30 characters on the line. Where will those excess characters be stored? If you're very lucky, you'll get an immediate crash, but that kind of luck never holds out.
Also, FYI, 1) you can use the <code> tag for code, 2) you're scanf()ing into x.n twice, and 3) fflush() is only meaningful for output buffers. --Sean 16:42, 15 November 2007 (UTC)[reply]


AAAARRRGGGHHHHH!!! WHAT!! Msid's was totally 100% the wrong answer! It's so far wrong that it's wrapped around and is almost right again!
From the 'man' page for 'gets':
Reads  characters  from standard input until a newline is found.
The characters up to the newline are stored in BUF. The newline
is discarded, and the buffer is  terminated with a 0.
So gets() most definitely reads the newline! Jeez - isn't that C programming 101?
Calling flush is a completely stupid 'fix' because it throws away any type-ahead - which will utterly screw you up if someone does a multi-line cut/paste into your program or something! It also has all sorts of ikky consequences if the input of your program is redirected from some kind of fancy I/O device that may do something majorly unwanted in response to a flush call!
What's actually happening is that the 'scanf' was not told to read the newline - so it stopped reading after the last character of the number. The first 'gets' read the newline that scanf forgot from the end of your first line of text and the second gets grabbed the second line. The correct fix is to change:
 scanf("%d %d",&x.n,&x.n);
...to... scanf("%d %d\n",&x.n,&x.n);
^^
...which correctly tells scanf to read the newline at the end. Then you need just one 'gets()' to read the next line - and no flush call is ever needed!
SteveBaker 16:56, 15 November 2007 (UTC)[reply]
Oh no.. I apologize! I promise to only answer Java questions in the future. :-) ›mysid () 17:23, 15 November 2007 (UTC)[reply]
  • FYI, fflush() doesn't mean "discard any queued-up input", but "send any *output* you've queued up to wherever it's going". fflush() on an input handle does nothing. --Sean 20:00, 15 November 2007 (UTC)[reply]
In terms of general advice here, both scanf and gets are kinda 1970's functions and should be avoided.
  • gets() does no checking so if you type in more characters than the buffer can hold you'll probably crash the program. In the 1970's, that was considered a simple programming error - no biggie. In the 2000's, this is called a 'buffer overrun' and it's not just that it can crash your program, it's also that some evildoer with access to your program can shove cunningly designed data into the overrun area and take control of your machine. gets was at one time the number one hole through which viruses could get into a computer! Switch to using 'fgets()' instead - it is passed the length of your buffer array and will take care not to overrun it. Beware though that fgets (for some totally unaccountable reason) stores the newline into the buffer - where gets reads the newline but doesn't store it.
  • scanf() suffers from the problem that you have no error recovery possibilities. You can look at the return value from scanf and tell that the user only typed one number instead of two - but since the data he actually input is now gone forever, you can't help him out very much. Generally, it's better to grab the data from a line of text into a string (using fgets) and then use sscanf() to parse it. If sscanf fails then you can try again (perhaps reading only one number and defaulting the other one to some sensible value). At the very least you can say "You typed '24,fiftysix' and I needed two decimal numbers separated by a space."
SteveBaker 17:27, 15 November 2007 (UTC)[reply]
fgets() stores the newline because it can stop reading at a newline or at EOF, and the caller needs to know which occurred. You can use feof() to test it, but if for some reason fgets() reads ahead, EOF could be set upon reading the last line of a file even if it bore a newline. Terminals might also make EOF-testing weird. --Tardis 21:24, 15 November 2007 (UTC)[reply]
I dislike that explanation. C's standard library originated on UNIX and I/O redirection was standard back then - so gets and fgets could both be reading either from a keyboard or a file on disk or...anything really. That doesn't excuse the differences. SteveBaker 04:57, 16 November 2007 (UTC)[reply]
Thanks again, guys! The detailed explanations have really been useful. I've noticed the warning from gcc about gets being dangerous, and I always wondered why. Now it makes sense. I use gets and scanf mainly because that is what is what I'm instructed to use. Maybe I'll be told to use the other functions as my course progresses. But I'll be using fgets from now on. Thanks again!--202.164.136.56 14:28, 16 November 2007 (UTC)[reply]

Regular Expressions

[edit]

This is a question about regular expressions in java. Say I'm trying to find a string of a's surrounded by on both sides by one or more b's. Normally, I'd use "[b]+[a]+[b]+" to find this. But what if I want the returned string (when I call Matcher.group()) to be just "aaaaa" instead of "bbbaaaaabbbb"? Is it possible to do this with regular expressions in a single go, or do I need to throw another regular expression at the result from the first? In other words, can I constrain the the string I'm searching for by specifying characters that are not in the string that matches it? risk 17:01, 15 November 2007 (UTC)[reply]

Do you allow bbbaaaa and aaaabbb also? If so, use b*a+b* - the * allowing zero or more. -- kainaw 17:04, 15 November 2007 (UTC)[reply]
But he wants just the As --ffroth 17:09, 15 November 2007 (UTC)[reply]
Also he said "both sides by one or more b's" --ffroth 17:10, 15 November 2007 (UTC)[reply]

I don't know Java regexps off the top of my head, but in Perl, you'd say "[b]+([a]+)b+" and after the regexp, if it matches, the variable $1 will contain the value of the (first) parenthesized portion of the match. Perhaps Java can execute this Perlish regexp as well?

Atlant 17:18, 15 November 2007 (UTC)[reply]

(edit conflict)
Yes. I misread the question. Use b+(a+)b+ - which makes the a's a captured group. Then call Match.group(1) - the 1 being the first captured group. -- kainaw 17:19, 15 November 2007 (UTC)[reply]
This works beautifully, thank you. I actually tried this a couple of times, but I thought it didn't work, because of another bug. risk 17:57, 15 November 2007 (UTC)[reply]
Also note that one "b" on each side would suffice. Then you can also use look-ahead and look-behind assertions: "(?<=b)a+(?=b)", and then match.group() would contain the match. This has the added benefit of adjacent groups of "a"s separated by "b"s all matching correctly, because the "b"s are not gobbled up in the match. --Spoon! 21:57, 15 November 2007 (UTC)[reply]

program in c language

[edit]

How we can make a program for finding a circular number in c language —Preceding unsigned comment added by satya narayan sharma (talk) 18:10, 15 November 2007 (UTC)[reply]


Well, I'm not going to do your homework for you by writing it - but here are some hints: Circular numbers are also called Automorphic numbers. Our article on that subject offers a little help - most significantly that there are only 2 numbers with the same number of digits that are automorphic, one ends in a 5, the other in a 6. So you need only test numbers 0-9 until you find 5 and 6 (which are automorphic), then 10 to 99 - testing only 15,16,25,26,35,36,...95,96 - then 100 to 999, testing 105,106,115,116...995,996...and so on. For each number of digits you can do just two separate searches - one testing numbers that end in 5 and another only for those that end in 6 - and once you've found one of each, you can stop the search and go on to numbers with one more digit. This will be much faster than exhaustive testing of all of the integers. To test to see if you have a match, you need to square the number and then take the remainder after dividing by 10number-of-digits (using our friend the '%' operator) and see if that's equal to your original number. In practical terms, you can do this efficiently only up to numbers around 65535 because the square of that number will be too big for an integer. You can (with some care) use long integers to get up to numbers around 4 billion - but beyond that you'd need to either find an arbitary-precision math library or write your own. SteveBaker 18:59, 15 November 2007 (UTC)[reply]

Power supply question

[edit]

Does the reliability and durability of a computer power supply have any correlation to its actual power? If I want a power supply that lasts long without breaking, should I go for low-power or high-power models, or does it even matter? JIP | Talk 18:49, 15 November 2007 (UTC)[reply]

Running a power supply close to it's limit will certainly shorten it's life. Hence a higher powered supply should live longer than a low powered one that's closer to it's limit. SteveBaker 19:00, 15 November 2007 (UTC)[reply]
Power supplies are one of those computer parts that do commonly break. You might consider using two, also. Some hardware (mainly aimed at the server market I think) can be had with redundant power supplies. Friday (talk) 19:13, 15 November 2007 (UTC)[reply]
OK, so if I ever decide to replace my current PC with my "dream machine" (3.0 GHz processor, 4 GiB RAM, 320 GiB hard disk, DVD/RW drive, two network cards) I have to consider specifying two power supplies. Thanks for the answers. JIP | Talk 19:17, 15 November 2007 (UTC)[reply]
It's unlikely that you'll be able to "specify" 2 if you're ordering it through an interactive application, but if you're building it yourself you should consider 2 --ffroth 22:23, 15 November 2007 (UTC)[reply]
Using two is unnecessary and is likly to result in high frequency data errors as there will capacitance difference between the grounds. The only thing that matters with power supplies is the temperature. If you run a power supply at its fully rated load, its won't die any faster than at a lower rated load - provided you can keep both at the same temperature. The reason people typically see them die faster at high rated loads is they can't take the heat away as well. If you have good air-con that actually cycles the air and stop air near the PC heating up, most likely you can run a power supply at 100% of its load with no problems. If you don't have air-con expect the local temperature to increase 10 to 20 degrees c and the power supply to die much quicker. Some power supplies will die almost instantly at 100% load if you do not have 25 degree C ambient temperature. The way to avoid this is getting a more powerfully power supply so that it will not heat up as much. For your computer specs (depending on what video card) I would just get a good brand 600W supply. Also remember that 99% of power supply failures can be fixed for a few cents - they are always capacitors that have died up from heat and fail. So if one fails open it up and look for capacitors that have blown and just replace them. I am still running power supplies from 2001, almost every second summer I have to replace the caps in them, the ambient temperature here can reach 45 degrees C. Indeed the ATX standard has power good / power on signals, so its almost impossible to destroy your parts when a power supply fails from bad caps, you will just get the power supply refusing to turn on or turning off when you have to much load, both because the motherboard detects bad voltages as the output caps fail.--Dacium 01:21, 16 November 2007 (UTC)[reply]
OP: Please note that replacing capacitors in a power supply is not something you should do yourself unless you know exactly what you're doing. There's a ton of excess voltage in those things and they are very dangerous. -Wooty [Woot?] [Spam! Spam! Wonderful spam!] 04:33, 16 November 2007 (UTC)[reply]
Yuo tried to be "correct" using GiB and GB and failed. You shouldn't use GiB then referring to hard drives. They sizes are advertised in decimal gigabytes. —Preceding unsigned comment added by 85.206.56.248 (talk) 13:58, 16 November 2007 (UTC)[reply]
So that's why my LaCie F.C.Porsche USB hard drive shows up as "298.1 GB volume" on Fedora 7 Linux. It's advertised as 320 GB but Linux shows its size in GiB (although claims to do so in GB). I guess the GB/GiB distinction still takes time to work out. JIP | Talk 09:12, 17 November 2007 (UTC)[reply]

Microsoft's documentation for compilers

[edit]

Has Microsoft published (free) documentation for writing compilers on its operating systems? (Or how should this be formatted in English?) I'm just not very good in searching for these things. --212.149.216.233 19:10, 15 November 2007 (UTC)[reply]

Microsoft doesn't make processor architectures, just an operating system. You use header files to link into the Windows API- I believe microsoft publishes these --ffroth 22:22, 15 November 2007 (UTC)[reply]
A compiler is just a normal program. You don't need Microsoft-specific information to write one that will run on Windows. --Sean 02:16, 16 November 2007 (UTC)[reply]
Maybe the intended question was: "Where do I get documentation on the EXE file format (so I can create files that the OS will load) and the assembly-level calling conventions used for system calls so I can request system services?" Those are things an OS vendor should document if they want to encourage compiler development. --tcsetattr (talk / contribs) 03:02, 16 November 2007 (UTC)[reply]
Probably the simplest way is to download the OpenSourced compiler system from Cygwin (which is the GNU CC) - you can get full source code for their compiler, linker and EXE file writer. SteveBaker 04:50, 16 November 2007 (UTC)[reply]
But then you have to link in Cygwin dlls right? Not exactly ideal --ffroth 14:42, 16 November 2007 (UTC)[reply]
Not necessarily-- you can read the source and learn how it's done. The Wednesday Island (talk) 14:01, 21 November 2007 (UTC)[reply]

All the answers above seem to be good depending on how you understood me, but because there are no direct links to anything, I'll make a new question. Supposing that I would already know all about PE-format's structure, could somebody tell how one really makes a call for Windows using those import tables (on x86/x86-64)? I could guess the program first passes the arguments on stack/registers and then uses some interrupt to make an actual call. How the a call is made? --212.149.216.233 15:33, 16 November 2007 (UTC)[reply]

You'll find some interesting stuff in x86 calling conventions (_stdcall having taken over from FAR PASCAL as being Windows' calling convention du jour), and (as much of the Windows API is calls to DLLs) in Dynamic-link library. I think if you want to see how stuff is done in practice (as opposed to how you'd logically think it should be done, or how the documentation might imply it is done) then a couple of hours with OllyDbg should be very enlightening. -- Finlay McWalter | Talk 17:59, 16 November 2007 (UTC)[reply]
NT, unlike e.g. Linux, has no public system call interface. The public API consists entirely of ordinary functions exported by system DLLs. The Nt* functions in ntdll.dll are thin wrappers for system calls. They use the stdcall calling convention, which is the same as the C calling convention except that the callee, rather than the caller, pops the arguments from the stack. -- -- BenRG (talk) 22:27, 16 November 2007 (UTC)[reply]