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

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Computing desk
< January 26 << Dec | January | Feb >> January 28 >
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 27[edit]

Big numbers in C++[edit]

How can I deal with big numbers which are too large even for a "long long unsigned int" in C++ --RMFan1 (talk) 00:11, 27 January 2009 (UTC)

I guess you getting paid in Zimbabwean dollars. See Arbitrary-precision arithmetic Dmcq (talk) 00:35, 27 January 2009 (UTC)

the not-ipod[edit]

My best friend's brother just got this new handheld iPod-like thingy. It's South Korean, has (approx) a 4-inch screen, can play 720p video and music, movies, pictures, etc. Everything that an iPod can do (plus 720p vids), but on a bigger screen. I'm in the market for a new portable media player device thingy that's not and iPod and this thing looks like it fits the bill. Only thing is, I have no idea what it is, what it's called, or where to look for it. Does anyone know of such a device, or where I could buy one? flaminglawyer 00:12, 27 January 2009 (UTC)

Does it look like an iPod? A quick Google search for "iPod copies" threw up this as the top result. Cycle~ (talk) 00:18, 27 January 2009 (UTC)
Sorry for not clearing that up: No. It looks nothing like an iPod. Imagine a rectangle, about 4x5 inches, with like a 4x4 inch screen and the other inch for buttons. And you've got it. flaminglawyer 00:25, 27 January 2009 (UTC)
It has a 1280x720 screen at 4x4 inches? Are you, uh, positive? An older news article (2005) suggests the most popular companies for media players in Korea, at that time at least, were iRiver, Cowon, and Samsung. You can get these just about anywhere, might as well look at their sites and see if you can spot the one you're looking for. None of them have 4x4" 720p screens though. -- Consumed Crustacean (talk) 01:27, 27 January 2009 (UTC)
I assume he meant it takes 720p as input, then down-converts to something more like 480p for display purposes. Otherwise, those are some freakin' tiny pixels. StuRat (talk) 01:29, 27 January 2009 (UTC)
Have a browse around DealExtreme, you might find it there. It's a Hong Kong based company that sells almost anything you could think of (and probably many that you could not!) with free worldwide shipping. If you do find it, you might then want to read the forum comments as well as do a Google search to find out how haclable it may be, if that's your thing. Zunaid 08:29, 27 January 2009 (UTC)
Holy schizz, dude... That site's got some crazy stuff on it... Thanks for pointing me to it :) flaminglawyer 23:20, 27 January 2009 (UTC)


I've found it (it appears at 19 seconds in the MegaWhat video on this page), but I still have no idea what it's called. Anybody know? flaminglawyer 23:48, 27 January 2009 (UTC)

I see a Casio camera 19 seconds into that video, and then a Palm Pre a few seconds later. No media player. (talk) 01:11, 30 January 2009 (UTC)

Wikipedia layer in Google Earth[edit]

Does anyone know how often the Wikipedia layer in Google Earth is updated? It presumably uses the {{coord}} template. I've noticed that the placemark for Westchester County, New York is in the city centre of Birmingham (UK) and has been for at least a year. The coordinates were removed from the article on 19 January 2008, but the placemark remains. Similarly, articles I've created (with coordinates) haven't been included. Cheers! Cycle~ (talk) 00:15, 27 January 2009 (UTC)

all the tech conferences[edit]

It appears that there are a bunch of different conferences for people announcing new tech stuff. There's G3, Mac World (cancelled), and all the other ones that I don't know of... which is why I'm here. Is there a list of all the tech conferences that regularly happen? Also, how does anyone ever find out about the ones that are announced short-notice? Like the one to announce the Palm Pre? flaminglawyer 00:22, 27 January 2009 (UTC)

Check out Trade fair for a list of a lot of technical conferences. Livewireo (talk) 04:14, 27 January 2009 (UTC)

Niche calculations[edit]

What's the best way to automate calculation of the random Fibonacci sequence? Let's say I have 10,000,000 bits of "random" data that I want to seed my random Fibonacci algorithm with. For each and every bit, I want to either add f(n-1) and f(n-2) or subtract them, depending on whether the current "random" bit is a 0 or 1. This would be easy enough to do with a spreadsheet like Excel, except that Excel has a very small limit to the maximum number of cells, and it's very time-consuming to import bit-wise data into Excel (am I right?). So I guess I'm looking for a super-spreadsheet to do this. Suggestions? Accuracy of the result is not too important, as long as the exponent is close to the actual one. An arbitrary precision/speed tradeoff would be nice, of course. (talk) 01:00, 27 January 2009 (UTC)

Excel would be a horrible choice, for the reasons you've mentioned as well as the fact that a huge amount of processing power goes to its (quite poor) GUI, and all you want to do is crunch numbers. You'd be better off with just a scripting program (in your language of choice) that would input your numbers from a text file and output to another one. I'm sure someone on here could write you such a program in Python or Perl quite quickly.... -- (talk) 03:31, 27 January 2009 (UTC)
#!/usr/bin/env perl
local $/=\1;
while(<>) {      # input is 0 or 1
  $a*=-1 if $_;
  die "Odd input count" unless defined($_=<>);
  print "$b\n";
This expects as input a file containing only the ASCII digits 0 and 1 (no spaces or newlines!) and prints what follows the two initial 1s. It uses floating-point arithmetic if the numbers get big. --Tardis (talk) 18:05, 27 January 2009 (UTC)

Volume configuration file on Ubuntu?[edit]

Does anyone knows the configuration file that stores the value for the volume control in Ubuntu ("master" and "speaker")? I've searched a lot, but with no success... :(

PS:I know there are GUI and CLI tool to change that, but I really need the file that sores that info...

PS-2: I know it is a global value (for all users, so it is probably not stored at the home)

Thanks. SF007 (talk) 02:05, 27 January 2009 (UTC)

It's stored in the device itself (/dev/mixer), apparently, although I don't know how it's made persistent over shutdowns. There's a write up on how to use it, with example code if that's your thing. It may also involve /dev/snd/controlC0; I ran strace on gnome-volume-control to find these two. --Tardis (talk) 08:42, 21 February 2009 (UTC)

Single-user PostgreSQL[edit]

Is there a version of PostgreSQL that's simpler to install and use for a single-user, non-network database, but that has all the same features for the database itself (e.g. triggers, polymorphism and inheritance)? NeonMerlin 03:36, 27 January 2009 (UTC)

I'm on Linux. The complete install process is: "yum install postgresql-server". In Windows, I believe you download the installer and double-click on it, then click ok-ok-ok-ok-ok. I don't know about Mac. So, my problem with answering your question is how to make it simpler. -- kainaw 13:50, 27 January 2009 (UTC)

IP address[edit]

Question moved from the Miscellaneous desk. -- (talk) 04:27, 27 January 2009 (UTC)

Just wondering, is it legal (or even possible) to modify one's computer or Internet device so that the location and IP address it gives off can be controlled? Tezkag72 03:44, 27 January 2009 (UTC)

See Proxy server, Tor. –Capricorn42 (talk) 04:36, 27 January 2009 (UTC)
(ec) We cannot give legal advice, but I don't think setting an arbitrary IP address would be illegal (pretending to be a different person, however, could be). In fact, it is quite possible to set any IP address you'd like on your computer. The problem, though, is that many other computers will not talk to your computer if it isn't at an expected IP address. Realistically, the closest thing you can do is route your traffic through a proxy which will make your IP address appear to be the proxy address. -- (talk) 04:41, 27 January 2009 (UTC)
It depends on the method you use to spoof your IP address. Using a proxy (as mentioned above) is usually legal. But cloning someone's MAC address or using someone's firewall as an unauthorized proxy would be illegal.--K;;m5m k;;m5m (talk) 04:56, 27 January 2009 (UTC)
How is setting your MAC address to some arbitrary value illegal? Now, connecting to another computer with intent to defraud is another matter, but it's the fraud that's illegal, not the MAC. -- (talk) 05:14, 27 January 2009 (UTC)
Uh..Mac Addresses can't be changed....Rgoodermote  15:22, 27 January 2009 (UTC)
Our article MAC spoofing disagrees with you. Algebraist 15:25, 27 January 2009 (UTC)
Well, I need to hunt down the makers of my Cisco course then and show them said article. XD. Rgoodermote  17:12, 27 January 2009 (UTC)
Sure you can; the card is in your physical possession, after all. On my machine the syntax is "ifconfig eth0 hw ether 12:34:56:78:9a:bc". Multihoming ethernet basically requires you to make up a MAC address for your virtual interfaces. It's a variation of "On the Internet, nobody knows you're a dog". --Sean 18:25, 27 January 2009 (UTC)

Windows Address Bar question[edit]

Is there a way to adjust the address bar in Windows so that it doesnt show all the sites that I've been to? What I mean is when Im about to write an address into it,as soon as a write the first letter it gives me the list of all the sites that I've been to starting with that letter. Can that be adjusted and how?

Thanks a lot(and please do answer if you know how to do it,cause I would really hate my girlfriend to know all which sites I visited). (talk) 07:47, 27 January 2009 (UTC)

That would depend on the browser. Some browsers have an option of not memorizing addresses. (Safari, for example, calls this "Private browsing".) And I think every browser allows you to delete its memory of addresses (as well as cookies, etc). -- Hoary (talk) 08:09, 27 January 2009 (UTC)

If you use Internet Explorer (IE7 here, but it was similar in IE6), you can turn Auto-Complete on or off. Click Tools at the top of the screen, then Internet Options. Click the Content tab, then where it says Settings beside Auto-Complete. There are a number of boxes there which you can check or uncheck, depending on what you want Auto-Complete to store. Tools/Internet Options also enables you to delete your browser history. In IE7, the Favorites Center has a History feature which, when clicked, displays everything you've looked at in detail unless you delete the browser history. Pavel (talk) 09:19, 27 January 2009 (UTC)

720p vs 1366x768[edit]

Hi. Our article on 720p states that it is 1280x720 and mentions absolutely nothing about 1366x768. However, every single 720p TV I've seen advertised in South Africa has a resolution of 1366. Actually to be more accurate, they are always advertised as "HD Ready" rather than 720p. Similarly, 1080p TV's are advertised as "Full HD". Now at the moment we still don't have digital broadcasting although it WILL come in time for the 2010 FIFA World Cup. Not sure if it wll be 720 or 1080.

I'm looking to get an "HD Ready" LCD for gaming (Xbox360) and watching TV series via PC. So in light of all this, is there anything to be concerned about? If any of these sources are coming from a 720p signal, stretching it to 1366 would probably look terrible given how close the ratios are. On another note, I've noticed that most graphics cards (including the onboard graphics on my PC) only support 1360x768 as a standard resolution. What would happen to the extra 6 pixels? Will the display from the PC look absolutely horrible (trying to stretch itself horizontally)?

Nth question (how many is that now?): How did 1366x768 for TV's come about in the first place if the standard was 1280x720 for broadcasting and 1360x768 for graphics cards? Why choose a ratio that is not a standard? If anyone can untangle this whole mess I'd be grateful. Thanks. Zunaid 08:58, 27 January 2009 (UTC)

On my LCD TV, when I plug my computer into it and set it to the max resolution it allows, I believe it might have a few pixels of black at the top or bottom—it doesn't try to stretch it. This is with a MacBook, and not necessarily generalizable, but anyway, that's my little experience, if that helps. If I recall more completely, depending on the monitor mode I use in the MacBook (mirroring vs. multiple monitors), it works a bit differently... (one stretches a bit, one does not), but maybe I'm not remembering this right.. -- (talk) 17:48, 27 January 2009 (UTC)
Take a look here: High-definition_television#High-Definition_Display_Resolutions, and you will see that 720p is 1280×720, or just a bit less than 1366x768 (WXGA). So, I would hope your screen will letter-box it (put black borders around it), instead of stretching, which could indeed introduce some distortions. StuRat (talk) 20:30, 27 January 2009 (UTC)
1280x768 (WXGA) has an aspect ratio of 15:9, the 16:9 equivalent of which is 1366x768. ((1280/15)*16 => 1365.3333). However, 1366 is not evenly divisible by 8, so 1366 gets rounded down to 1360. -- Fullstop (talk) 03:59, 28 January 2009 (UTC)

Pywikipedia code[edit]

Hello, where can I find (or how can I make) some code which I can use to have my bot copy automatically templates from other Wikipedias every X days? There are some templates which have to be updated often from the corresponding templates on other Wikipedias every now and then, and it would be great to be able to do that with a bot. I'm bad at pywikipedia programming so I hope someone can please lend me a hand. Thanks a lot. Leptictidium (mt) 09:24, 27 January 2009 (UTC)

Perl, Regex, translation, ARRRRRGGHHHHHHHH![edit]

Microsoft Excel can understand January 1, 1911, Feb 2, 1922 but not Mar. 3, 1933. If the name of the month has a period in it, it fails to parse the date. So I am writing a simple Perl program to fix my text documents.

open (IN, "<dates_in.txt");
@test = <IN>;
$i = 0;

foreach (@test) {
    print $test[$i] . " - ";
    $test[$i] =~ tr/(Jan\.|Feb\.)/(January|February)/;
    print $test[$i] . "\n";

For simplicity's sake, only two months are translated here. The output is beyond my wildest imagination:

Jan. 1, 1911 - Janu 1, 1911
Feb 2, 1922 - ry| 2, 1922
Mar. 3, 1933 - Maru 3, 1933
Apr. 4, 1944 - Apru 4, 1944
May 5, 1955 - May 5, 1955
Jun. 6, 1966 - Junu 6, 1966
Jul. 7, 1977 - Julu 7, 1977
Aug. 8, 1988 - Augu 8, 1988
Sep. 9, 1999 - Sypu 9, 1999
Oct. 10, 2000 - Octu 10, 2000
Nov. 11, 2001 - Novu 11, 2001
Dec. 12, 2002 - Dycu 12, 2002

What went wrong? -- Toytoy (talk) 10:40, 27 January 2009 (UTC)

You invoked transliteration (or translation) instead of substitution. s/tr/s/ -- (talk) 11:15, 27 January 2009 (UTC)
But can I do many-to-many replacement? I tried:
$test[$i] =~ s/Jan\.|Feb\./January|February/;
It doesn't work at all. The "Replace With" part does not allow multiple one-on-one mapped alternatives (like "case" of flow control).
Surely I can do 11 replacements for each month except for May. But if the text files are huge, 11 replacements may take a long time to execute. What else can I do? -- Toytoy (talk) 12:01, 27 January 2009 (UTC)
Perhaps s/(Jan|Feb|Mar)\./$1/ is more to your liking? It doesn't expand the months, but it does remove the dots. -- (talk) 12:39, 27 January 2009 (UTC)
If the text files only contain the dates, why not do a global search and replace, replacing "." with ""? - any text editor should be able to do that. Astronaut (talk) 13:00, 27 January 2009 (UTC)
I can solve my current problem by using the UltraEdit. However, I want to see if there's a way to do "case"-like replacement. For example, I can expand each country's shortened name to its full name (e.g. U.S. -> U.S.A. -> the United States of America) in a very large text file. Or I can use a complicated replacement program to simplify a HTML page downloaded from a web site. -- Toytoy (talk) 13:43, 27 January 2009 (UTC)
A slightly more complicated alternative is to add the 'e' option at the end of the regex, which causes Perl to eval the substitution string. So you could, for instance, create a hash mapping Jan=>January etc., then use s/(Jan|Feb|Mar)\./$hash{$1}/e to expand the months. -- (talk) 13:11, 27 January 2009 (UTC)
This is a much more advanced solution. I guess that you can't use the 'o' option (compile once for all replacements), if the replacement is executed within a loop. But this is a much better solution. This may be used for other purposes, such as mapping an animal's English names against its scientific name (if one-to-one). Thank you! -- Toytoy (talk) 13:33, 27 January 2009 (UTC)

It looks like that Perl has a major bug.

%month = ("Jan" => "January", "Feb" => "February", "Mar" => "March", "Apr" => "April", "Jun" => "June", "Jul" => "July", "Aug" => "August", "Sep" => "September", "Sept" => "September", "Oct" => "October", "Nov" => "November", "Dec" => "December");

open (IN, "<dates_in.txt");
@test = <IN>;
$i = 0;

foreach (@test) {
    print     $test[$i] . " - ";
    $test[$i] =~ s/\b(Jan|Feb|Mar|Apr|Jun|Jul|Aug|Sep|Sept|Oct|Nov|Dec)\.?\b/$month{$1}/ge;
    print     $1 . " > " . $test[$i] . "\n";

Perl fails to clear $1 (group 1) when there's no match, see May:

Apr. 4, 1944 - Apr > April 4, 1944
May 5, 1955 - Apr > May 5, 1955 <-- See the bug!
Jun. 6, 1966 - Jun > June 6, 1966

This is a potential source of unpredictable output. Larry Wall I want my money back.-- Toytoy (talk) 14:29, 27 January 2009 (UTC)

The s/// operator returns the number of replacements made (or a false value if that's 0). If you want to use $1 iff it's current, you need to say something like
if($test[$i]=~s/.../.../) {print $1,...;}
Hope that helps. --Tardis (talk) 15:54, 27 January 2009 (UTC)
If Perl was created by Microsoft, this bug is certainly a valuable "feature." But why did Perl have such a "feature"? Is there a reason to justify its existence? Can anyone name a good use of it? -- Toytoy (talk) 16:22, 27 January 2009 (UTC)
The documentation says "The numbered match variables ($1, $2, $3, etc.) and the related punctuation set ($+, $&, $`, $', and $^N) are all dynamically scoped until the end of the enclosing block or until the next successful match, whichever comes first.", so it's working as advertised. --Sean 18:32, 27 January 2009 (UTC)
[edit conflict] Perl, as you've already said, was created by Larry Wall. The man page perlre describes the feature as follows:
  • NOTE: Failed matches in Perl do not reset the match variables, which makes it easier to write code that tests for a series of more specific cases and remembers the best match.
When you use s/.../.../g, you may do any number of matches in one statement; which value of $1 is so important for you to have afterwards, anyway? --Tardis (talk) 18:53, 27 January 2009 (UTC)


My internet connection is not working, I have been told by my provider that the problem is either with my cable from my modem to my computer or with my modem itself. I have however tested my conection with a different computer, and this workied, I have also tested all of these with other cables, and modems, I am now confident that the problem is with the provider in one way or another. The enat light on my modem, is off, and I hae been told this indicates a problem with my conection on my side. Now what I think the problemis is that there is one conection coming from outside the house, and then split into two in the hall way thus allowing myself and another person in the house access to the internet via two seperate Accounts. Could this be the problem or can any one who is more computer savvy than myself help me to fix the problem as I am tired of having to use other peoples computers to access my email, and my beloved wikipedia. Plese help. Thank you very much guys and girls. —Preceding unsigned comment added by (talk) 13:10, 27 January 2009 (UTC)

It could be your computer's settings. However, the shared connection thing is worrying. Here in the UK, we are only allowed one ISP per physical connection to the phone exchange, and ADSL modems only allow one account to be set up in the modem. So, maybe your connection is not working because the other person is monopolising the modem and account. I suggest you talk with this other person and find out if they're having the same problem or if they changed anything. Astronaut (talk) 16:36, 27 January 2009 (UTC)

Epson Stylus Photo R2880 and Quality Photo Papers[edit]

A keen photographer, I am about to set up a mini studio where I can print my own work for exhibition, and have chosen the above printer as my first step. My only concern is that I am very inexperienced in choosing good quality paper to use in such printers to get the best quality. I am particularly keen on matte prints and plan to print largely in A4 and A3 sizes. Can anyone give me some good suggestions and some useful suppliers online?

Many thanks. Lukerees1983 (talk) 13:55, 27 January 2009 (UTC)

You could have a peek at Also kind of cool site. Lanfear's Bane | t 15:05, 27 January 2009 (UTC)
I'd suggest sticking with Epson's own line of papers to start with, as the printer driver should be optimized for their media. In my experience (in the US), the prices on their website are competitive and they often offer discounts and/or free shipping. --LarryMac | Talk 15:19, 27 January 2009 (UTC)

Seeking freeware program to compare two binary files[edit]

I had thought it would take seconds to find such a program on the internet, but I've now been searching for over an hour. I am seeking a windows freeware program that will compare the contents of two binary files and tell me if they are either exactly the same or different. Can anyone recommend one please? Note that this is not comparing text files, but comparing two binary files. The files names will be different. I would prefer to avoid bloatware, and highlighting of the differences of the files would be a bonus. Thanks. (talk) 14:37, 27 January 2009 (UTC)

Our article diff has links to various implementations. Algebraist 14:41, 27 January 2009 (UTC)
(ec) In Unix/Linux, the program is called "diff". So, I just googled "diff for Windows" and found this as the first hit. For binary files, it will normally only say they are different since it can't print binary code nicely. -- kainaw 14:43, 27 January 2009 (UTC)
Would and MD5 check do the same thing? --Russoc4 (talk) 14:47, 27 January 2009 (UTC)
Usually, yes. Technically, no. If you just happen to have two files with an MD5 collision, it will say they are the same, but they are actually different. The same applies for all hashing techniques. Timewise, I doubt hashing will be any faster than diff. -- kainaw 14:53, 27 January 2009 (UTC)
Lets be clear about this: yes, comparing MD5s would work excellently. The chances that two files will collide is so vanishingly small (remember, there are vastly more possible MD5 checksums than there are atoms in the universe) that it is pretty much not possible. The only risk with doing that is that since MD5 has been shown to have some weaknesses, you could artificially create two files with the same MD5 hash, but it would take a long long time (I'm think it's essentially infeasible for anyone without a supercomputer), and that problem goes away if you just use another, safer, cryptographic hash like SHA-512.
As for comparing just two files, using hashes and just comparing them directly, then yes, they have the same computational complexity (straight comparison would probably be slightly faster, but not much). But if you had, say, 1000 files and find any two that are identical, hashing is much faster. In short: hashing files to check for equality is an excellent way to do it (btw, I realize that I'm going a little off-topic from the question. My apologies) Belisarius (talk) 21:59, 27 January 2009 (UTC)

Thank you for replies so far, but none of the links indicated (or links to the links) are Windows programs. It may be possible to get the GNU program to run in Windows if you have a degree in computer science, but I do not. There is a Wikipedia table comparing different file comparisons programs, but it ommits to record if they compare binary or merely text, and all the ones I have come across so far are only text. So I'm still looking please. Thanks again. (talk) 15:21, 27 January 2009 (UTC)

The link provided by Kainaw (which is also linked from the article I pointed you to) is to a Windows program. It can be installed and used without a degree in computer science (though my testing cannot exclude the possibility that a degree in mathematics is required). Algebraist 15:35, 27 January 2009 (UTC)
Perhaps I took it for granted that "for Windows" was a very technical term for implying that a program was designed to work in Windows or that a link labeled "Complete Package" would download the complete program package so it could easily be installed. So, for non-computer-science people, go to the page linked above (which is titled Diff for Windows) and click on the link that says "Complete Package". You'll get an executable file. You should select the option to run the executable. After a lot of the normal "accept this license" and clicking ok-next-next-ok-ok-next-next..., you will have finished installing Diff for Windows. -- kainaw 15:40, 27 January 2009 (UTC)
See fc. It comes with all modern versions of Windows and can do what you want. Comparison of file comparison tools does have a "Binary comparison" column in the "Features" table, but for some reason it had neither yes nor no for fc. (I fixed it.) --Tardis (talk) 15:43, 27 January 2009 (UTC)

Thanks. Apart from fc (which is dos-in-windows), KDiff3 is the only other one listed which compares binary and is free. I have now also found the Comparison Of Hex Editors Table, and those that are both free and can compare are HxD, AviHex, and HHD Software Hex Editor Neo. The GNU diff page seems to indicate that it requires four or five other programs as well to work, and that it will not work interactively - so too complicated already. Thanks again. (talk) 16:03, 27 January 2009 (UTC)

Fixing Extremely Long Startup Times On IBM Laptop[edit]

I have a friend who has a problem with her IBM Laptop. I haven't seen the laptop yet, so I don't knwo what type it is, but she says it is only two or three years old. She has also informed me that she uses a P2P software to download music, so I believe that it must be an adware/spyware/malware problem. I have told her I will try to fix it tomorrow, but in order to do so, I may need to get software that I can put on a USB to run on her system, without the huge start-up time (in excess of 20 minutes). What I want to do is get the computer to run as fast as possible so I can install the anti-spyware and anti-adware, as well as software to deal with the malware that may be present. I am doing this for free, so I don't want to have to burn a disk (which I would have to go and buy), so USB is the only option. Does anyone have any ideas here?--KageTora (talk) 15:46, 27 January 2009 (UTC)

I'd suggest booting into one of Windows's "safe modes" where a lot of extraneous crap isn't running. That'll probably be sufficient to install your anti-malware and clean things up. And seriously, how much do blank CDs cost over there? -- (talk) 16:19, 27 January 2009 (UTC)
(ec) Try to find out which version or Windows your friend uses and whether or not they have the original install disk to hand (not a "recovery disk" which will wipe all your friend's data). You should be able to get the laptop to boot from that CD and repair the operating system. If the install disk is not available, you can put together a few tools on a USB drive (when downloading this software make sure it come from the official site rather then the first link you come across - some fakes exist made by malware makers):
The next step is to boot your friend's laptop into safe mode (press F8 before Windows starts). Make sure it's disconnected from the internet. Use Process Exploer to look for unusual programs running. Use Autoruns to look at all the stuff that runs at boot time (again you're looking for unusual stuff - it is helpful if you are familiar with what is supposed to be there). Sweep the machine for viruses and malware. If it is still acting up, look for rootkits and go through the whole process again.
Astronaut (talk) 16:22, 27 January 2009 (UTC)
Yes, malware or something like it may certainly be the problem, but there is another possibility: anti-malware software. On not-so-hot computers, a firewall/anti-virus that's extra intrusive (it continually scans files and TCP streams and so forth) can completely cripple a computer. This is a particularly on computers with low memory, because those programs can take up hundreds and hundreds of megabytes and the OS has to constantly keep paging the stuff to the hard disk. I've seen it completely screw up boot time several times. I'm not recommending you to just plain remove security software, but keep that possibility in mind.
As for what programs to use, IMHO the most important one is Process Explorer (like my friend the space-traveller recommended). It gives you a complete inside look into what's going on at any given time. Look for things that shouldn't be there. Then use Autoruns to kill the useless stuff that's starts with the computer. And, oh yeah, do the whole malware/virus sweep thing :) Belisarius (talk) 01:55, 28 January 2009 (UTC)

Weather Radio Alarm[edit]

On my weather radio (I don't remember the model or anything), there is a setting which transmits a loud somewhat high-pitched beeping noise. That is the only thing it does. Do you have any idea what that is? There is a seperate setting for Weather Radio and normal radio, but I want to know what the alarm does. It is not a clock alarm beause my weather radio does not have a clock. Nick (talk) 16:35, 27 January 2009 (UTC)nicholassayshi

I've got a radio like that. On mine the documentation indicates that you're supposed to use the alarm as a sort of siren so that rescue workers can locate you.
I figure it would work because anyone who hears it would drop whatever they were doing to locate the radio so that they could turn it off. I'm not certain that they'd be inclined to rescue me, though.APL (talk) 16:54, 27 January 2009 (UTC)

Thats odd, because mine is periodic at random times. It is never on all the time. Any ideas?Nick (talk) 17:01, 27 January 2009 (UTC)nicholassayshi

Presumably if it remained on continuously it would a) run down the batteries significantly faster and b) possibly be undetected as background noise. By making an intermittent beep battery life can be preserved for ~10 times as long, and by making it semi-random it is more likely to catch the attention of potential rescuers (less likely to be discounted as background beeping). At least, that's my idea. -- (talk) 21:31, 27 January 2009 (UTC)
On a NOAA Weather Radio equipped with an alarm, the alarm is activated when an emergency alert(Severe Thunderstorm Warning, Tornado Warning, Flood warning, i.e., anything that is issued by the Emergency Alert System) is issued for your general area. With most radios, you are able to input your specific location, which the radio uses to determine which alerts should activate the alarm, and which ones should not. Hope this helps. Until It Sleeps 05:12, 2 February 2009 (UTC)

A safe Php -> mail form[edit]

I'd like to add a simple "contact us" form to my website (which was written in php, which I don't know). While Google finds any number of "php email form" type things, I'm all too aware that, naively implemented, these things are susceptible to all kinds of misuse. Is there a simple, well-respected free (in both senses) php->smtp form that takes adequate care of escaping its inputs to make it safe for use? Thanks. Mimetic Polyalloy (talk) 17:40, 27 January 2009 (UTC)

Perl, regex, line number counter[edit]

Let's say I have the telephone directory of the NYC or Tokyo. There are several million entries and each entry counts as a line.

I want to do a pattern matching, e.g., all persons having the last name John or Johnson.

In Perl I can store all hits into an array.

How do I create a list of the hits with line numbers?

I can split the file into a million-line array or hash and use the loop and counter to solve this problem. If there's a match at Line No. 8,775,765, the hit and the number are saved.

This is certainly not a good idea. You have to execute regex several million times. If you have a very complex expression that requires "e" option, you may take a long vacation and forget about your computer.

Is there an easier way to do it? -- Toytoy (talk) 17:24, 27 January 2009 (UTC)

$ wc wikipedia.all.titles 
4264251  4264251 85551445 wikipedia.all.titles

$ time perl -lne '$num_johnsons++ if /Johnson/; END { print $num_johnsons }' wikipedia.all.titles 

real    0m2.763s
user    0m2.712s
sys     0m0.052s
--Sean 18:42, 27 January 2009 (UTC)
awk can do it too. It might be a bit easier than perl for some cases like this. -- (talk) 19:32, 27 January 2009 (UTC)
On your average multigigaflop desktop computer doing a regex millions of times is not a big deal. However if you want to do this many times you may wish to build an index. One time you scan through the file, extract the surname, and then make a string indexed array with the value being all the record numbers that have that surname. Then you just have to look up the surname and count the record numbers it returns. Graeme Bartlett (talk) 20:18, 27 January 2009 (UTC)
The point wasn't awk vs. Perl, but man vs. machine. It took longer for me to type the brute force Perl one-liner than for it to execute, so it doesn't make sense to optimize it for runtime efficiency. --Sean 00:53, 28 January 2009 (UTC)
I meant easier as in having to think less writing that one-liner (of course it doesn't make much difference if you already know perl well as it seems to). -- (talk) 14:20, 28 January 2009 (UTC)

Question about Linux[edit]

Hi all! I joined Wikipedia recently. I have a question about Linux, that is why is not Linux easily infected by Viruses? Asimsingh121 (talk) 17:42, 27 January 2009 (UTC)

Hello and welcome to Wikipedia! Unlike most other OS, Linux creates a special account on the computer, known as root or Superuser. The general user accounts in Linux do not have permission to access the system files and critical areas of Linux. Only the root has the permission to access them. So, even if the account of an user gets infected by a virus, only the areas are infected which are accessible to the user and not the critical areas. Another reason for this is that, Linux does not automatically execute the .exe files, which are the most probable files containing virus. So, Linux does not get easil infected by viruses. You may check out the Linux article for more information on this question. Thank you. Anirban16chatterjee (talk) 17:49, 27 January 2009 (UTC)

Welcome to Wikipedia! Hope you enjoy it here :) I'll get the snarky answer in first second (dam! beat me to it!), before everyone else weighs in with the "proper" answers. Let me answer your question with a question: who would bother to invade Timbuktu? Virus writers are looking for attention, they want to affect as many people as possible by their actions. Given that Linux has such pathetic market penetration amongst desktop users, 90% of the world wouldn't notice the virus's existence. If I were a virus writer I'd certainly put more effort into writing viruses for the OS that most people are using. It's the same reason why most software developers don't port their games to Linux, it just isn't worth the effort for the size of the market. I'll now politely give way to SteveBaker to explain about root privileges and the inherent security of Linux having been designed from the ground up as a networking OS. Zunaid 17:54, 27 January 2009 (UTC)
I've never really bought that argument. It may not be a common desktop OS, but there's plenty of high-profile web servers running Linux, and a virus that pwned those web servers would be a highly visible accomplishment. (By the same token, Code Red was a well-known worm, even though only a small fraction of Windows machines ran IIS.) -- Coneslayer (talk) 18:01, 27 January 2009 (UTC)

::Windows also has a vast, vast majority of the market share on PCs, so there isn't as much a market for viruses on Linux (if you could call it that). And I was beaten by an edit! Curse you, Zunaid!Livewireo (talk) 17:56, 27 January 2009 (UTC)

In answer to your question, the last people to attack (one doesn't normally speak of invading a city) Timbuktu seem to have been Tuareg rebels in the early 1990s. Algebraist 18:10, 27 January 2009 (UTC)

But that is not the answer to the question! And whom are you cursing? Me?! But for what reason? Anirban16chatterjee (talk) 18:00, 27 January 2009 (UTC)

Actually, Anirban16chatterjee, one thing I did not get from your answer, that is, what prevents the virus from accessing the root or superuser? Is it something like Windows Firewall or DEP? Asimsingh121 (talk) 18:04, 27 January 2009 (UTC)

The thing goes like that, the root or superuser has some other password, which is unknown to the virus. One may log into the root too and change the password. For example, in a machine with Redhat Lnux, the default superuser log in name is root and the default password is redhat or simply password. Thus it prevents the virus from accessing the root. Anirban16chatterjee (talk) 18:09, 27 January 2009 (UTC)

Oh! Now I acn understand. Thank you very much for making me understand. But can you tell me how to log on to root? (if we can do it) And, suppose one account named UserA gets infected, what should be done to delete the virus? Asimsingh121 (talk) 18:14, 27 January 2009 (UTC)

To log on to root, just type the word root in place of your user ID. And, you must know the root password which you should type in the password field. And, to delete the virus, you can delete the account of UserA from the root with all his/her documents from root. This will delete the virus too. If still the problem exists, then you should check out for downloading virus scanners for Linux. You may have heard of I love You virus of 2000-2001, which infected hundreds of Windows Computers, but not a single Linux Computer was infected. But still, gradually, the Kaspersky Lab has stated that there are still yet 800 malwares for Linux. So, we should better take care. Again, let me give you some more information. In 1997, a virus called Bliss was made which wasprimarily targeted to Linux. But the result was zero. So, don't worry, Linux is very secure. Although I am an admirer of Windows XP than that of Linux, still I appreciate the tough security of Linux-based Computers in general. Anirban16chatterjee (talk) 18:26, 27 January 2009 (UTC)

Thank you! That solves my question. Cheers. Asimsingh121 (talk) 18:28, 27 January 2009 (UTC)

Another slightly related note... On a Windows box, you just write a virus that infects the machine and tries to infect all other Windows machines. There are usually two reasons to do this. First, you are a pathetic person who just wants to cause trouble, so you write a virus to do damage to other computers. Second, you want to make use of a lot of computers (called a bot-net) to do things like send out tons of spam, so you write a virus to take over control of the computers. Windows is a great environment for both reasons. You can be an ass to a lot of people and/or control a lot of machines. In Linux, you won't get a lot of people mad or control a lot of machines, but you have the possibility of getting access to some rather important machines, such as financial databases. So, in Linux/Unix, the people who would normally be writing viruses spend their time simply trying to gain root access to the machine. With root access, they can gather the information they want and try to profit from it. It is mainly the usage of Linux/Unix that makes it less a target for virus activity. -- kainaw 22:51, 27 January 2009 (UTC)

RoseGarden Playback Feature[edit]

Moved from Entertainment desk:

Does anyone have any info about if RoseGarden, the sheet music engraver program that comes with Linux, has a playback feature with sounds for ALL or at least most of the instruments it features? I have never used before and I'm trying to research about it but the RoseGarden article here mentions the playback feature but does not specify about which instruments have that feature and the same info did I find in the RoseGarden official page. Any info would be very appreciated. PabloClark (talk) 02:12, 26 January 2009 (UTC)

Although I haven't used it a lot, I'll attempt to answer until someone more knowledgable comes along. The sheet music engraver program that comes with linux is Lilypond, which AFAIK does no playback. The article on Rosegarden states that it has no built-in software synthesizer, but can use other software synthesizers such as Fluidsynth, and it can also of course use hardware synthesizers or sound cards, provided there are drivers for the cards in question. With sound cards of the Soundblaster series, you can load Soundfonts, and will then get the instruments that are contained in the sound font. So General MIDI should work. I should add, that I've found working with midi under linux rather troublesome. Apart from silly (yet frustrating) things such as not loading a sound font and not turning up the volume, there are things such as conflicts between the sound card that I've installed, and sound chips on the motherboard that I've disabled in the BIOS, yet which still are detected by linux and preventing my sound card from working. And once I've got it working, if I decide to switch to another distro, it's the same story over again. It's one of the major issues that's keeping me from switching completely to linux. --NorwegianBlue talk 17:52, 27 January 2009 (UTC)

Thanks for moving the article and for the answer. I had read a bit about what you said but I hadn't really understood it. Because of the problems mentioned in the previous answer now I'm not sure RoseGarden is exactly what I need. To give you the context of my question I need to clarify that what I'd like to do with RoseGarden is basically create sheet music for the bass guitar, however, I didn't know if the program had the capability of playing back what I write using the sounds of the bass guitar, without having to get sound cards or anything as Norwegian Blue mentioned in his/her answer. I tried Rosegarden first because it's free, but a bit off the original question; for what I want to do with the program, what would be more easy for me (I'm not very knowledgeable about sheet engraver programs) to use; RoseGarden or Guitar Pro? Thanks for the answers!PabloClark (talk) 01:35, 28 January 2009 (UTC)

Which operating system do you intend to use? RoseGarden is linux-only, Guitar Pro is Windows and Mac, but not linux, according to the article. Also, do you want tablature or ordinary sheet music or both? --NorwegianBlue talk 14:27, 28 January 2009 (UTC)
You might want to take a look at the list Category:Scorewriters. I've used the Windows version of Sibelius in the past for arranging vocals, and found it reasonably user-friendly, with beautiful output. --NorwegianBlue talk 21:50, 28 January 2009 (UTC)


Anyone know of any open source SWF player that allows you to skip frame? Thanks. (talk) 19:02, 27 January 2009 (UTC)

I don't have any experience with them, so I can't tell for sure, but I think that Gnash and Swfdec are the premier open source flash players. So I'd check them out, if I were you. Belisarius (talk) 21:00, 27 January 2009 (UTC)

US Government Digital Certificate[edit]

Anyone know where I can find the United States Government's root digital certificate? --Melab±1 19:28, 27 January 2009 (UTC)

I'm not sure what you mean by "root digital certificate". The site has an SSL certificate with an 1024 bit RSA key, the public part of which starts with "30 81 89 02 81 81 00" and goes on for a while. Is that what you mean? It can be found by going to and right-clicking and examining the page information (I use Google Chrome in an odd Teutonic language, so I don't know what the specific menu items and such say) Belisarius (talk) 21:26, 27 January 2009 (UTC)

Unix security model[edit]

Is the superuser model really suitable for modern OSes? Reading about the trojan on the iLife torrents really made me think... is the superuser model any better than the everyone-is-admin "model" that Windows uses? Viruses and rootkits may start using these social engineering attacks to gain root access, so Unix systems are only slightly more secure than Windows systems. Plus, Windows does have a better security model, even if it's not used - ACLs for all processes/threads/files/objects, privileges (GNU/Linux has PolicyKit though), etc. Can anyone point me towards any resources/papers on this subject? All the stuff on the web seems to be fanboy-type material biased against Windows. Thanks in advance. --wj32 t/c 21:58, 27 January 2009 (UTC)

Unix, including GNU/Linux, also has ACLs, btw. The trouble with ACLs has been, on Windows as well as Unix, that in practice administering the roles involved and the permissions available turns out to be a complex affair - it's manageable on a nailed-down system but becomes very complex in many real-world cases, such that ACLs aren't really used to full effect on any platform. Secondly Windows isn't "everyone-is-admin", merely "first user is admin"; if a multi-user system is routinely set up with everyone as admin, it's set up wrongly. Just like on Linux, admin privileges should be granted only to people who know what they're doing. That admin privileges end up in the hands of both windows and linux users who don't really know what they're doing is a social problem (stemming from the way in which computers and OSes are distributed and sold at retail), and bar a draconian law that says "you only get admin/root on machine you own when you pass a test of competency", enforced by something like TPM, there's no technical solution to that (it sure ain't ACLs). That inevitable, if unfortunate, profligacy of admin/root to the unqualified means that, as you say, these systems are susceptible to social-engineering-based attacks ("install megacursor now!!!"); no technical solution can exist to fix that if the computer's incompetent owner has the keys to override the security. One might argue that our society requires people who operate powerful, dangerous machines like forklifts and cars and nailguns to take classes and pass tests before they're allowed to use them where misuse might harm others; computers are powerful machines too (and hugely more complex than a car) and are available to everyone with no qualification. Every time you receive a spam you've been victimised by the incompetence of someone who allowed their computer to be come a spam proxy. Now there is a solution to this, but it's a social one, and as I noted above, it's very draconian. You have (say) two categories of computer - "open" and "closed". Closed systems are remotely administered (by AOL, or Microsoft, or Comcast, or whoever) and stuff like software updates and backup are done by them, en masse. Only approved applications can be run. To get an "open" computer, one like you have now, to which you have full admin access and can do what you like, you have to pass a test, and maybe a background check, and probably post a bond or provide evidence of insurance (insurance that will compensate anyone harmed by your maladministration of your own machine). This would, by and large, put paid to viruses, spyware, trojans, and probably to most spam too. But it's a police state; inevitably those external parties contracted to manage the computers of ordinary people will seek to run their networks to their own advantage - so you'll get no p2p apps, no dvd ripping, and the browser and IM client and mail program they, and not you, choose. This essentially is how most non-trivial business installs are (whether windows or unix), but introducing it to everyone is a drastic step. Right now the freedom to install and set up your own computer is the freedom to grant too much privilege to the wrong people, and thus the freedom to screw all kinds of stuff up. Like the song says, freedom isn't free. (talk) 22:38, 27 January 2009 (UTC)
Well, what I really meant by "everyone-is-admin" is that most people who use Windows choose to be admin because they can't be bothered to use a restricted account/UAC. Surely, there must be a way to minimize the risk/damage of viruses by having some sort of a mechanism-policy system? I guess this is where GNU/Linux will succeed in the future with PolicyKit. Windows won't be getting anything similar anytime soon... --wj32 t/c 22:49, 27 January 2009 (UTC)
PolicyKit is clearly an improvement - particularly if, as I think it does, it addresses the perennial unix snafu whereby a process has to be (effectively) root to open a privileged port, meaning that (historically, less so now) far far too much code was running as root (although decent programing can mostly avoid this already). A few years ago I did have the idea of using "security envelopes" for each application, which enumerated in detail what a given application could do (that, by itself, is kinda how security is handled for Applets and other downloadable content in Java2). But to be useful it needs two wrinkles - firstly the envelope itself can (optionally) have some executable code (because defining what a given application can and cannot do in a purely declarative language isn't enough. Secondly break with Java2's model of having the security descriptor packaged with the program (which returns us to the "install this or not" question to an unqualified person, which is the same pointless exercise as UAC). Instead you subscribe to one (or several) envelope-feeds, wherein a trustworthy third party provides the envelopes for applications. On Ubuntu (say) you'd get an envelope feed from Canonical, and you'd pay a few dollars a month for a second feed from McAfee. The feeds verify apps by checksum, and if an app tries to exceed its envelope you get a warning. That's like UAC, but you never see it unless a known app is misbehaving, so average users don't get conditioned into always approving, the way UAC tends to. This is, kinda, like ACLs but with the complexity outsourced to someone knowledgeable and kept up-to-date as applications evolve. It's still an issue how you handle an envelope-transgression by default (on a system Joe Bloggs set up for himself). I'd probably default to simply saying "SuperMegaCursor as tried to do something that McAfee Lovelyshield doesn't like, so SuperMegaCursor has been stopped". There's still an avenue for social-engineering-attack (as inevitably there would have to be an admin-level override for stuff), but the evil authors of the trojan would have to say on their page "make sure to disable your McAfee security before installing SuperMegaCursor", which hopefully regular users can't be trained not to do. Doing all this without killing system performance is a challenge (some security enhanced OSes do a simpler version of this, and it does indeed hurt). I guess this is a half-way-house between the police-state, above, and the current anarchy. (talk) 23:18, 27 January 2009 (UTC)
Or perhaps it's simpler to just mandate that everyone who connects to the internet must have "internet insurance", to compensate for any problems their systems might cause. You get a steep no-claims discount for not being a malware victim, and maybe other discounts if you (as a home user) can show you're using a modern OS, proper security software, and you have some qualification in administering the thing. That way a) it's people who don't manage their machines properly who pay more and b) the insurer is incentivised to improve client security - and historically insurer have been pretty good at forcing safety improvements on other products, rather better either than regulators or consumers. (talk) 23:35, 27 January 2009 (UTC)
To get back to the original question, yes, it is unquestionably more secure to use the GNU/Linux model of regular users having very few permissions (this is called the Principle of least privilege, btw). It's true, if a malicious hacker is able to use social engineering to fool you into installing a certain software, and you give that software the permission it needs to wreak havoc on your computer, then obviously the hacker has succeeded despite a regular user only having limited access.
But here's the thing: security is never an "all or nothing" proposition. Just because there is a possibility that a devious person can get around an obstacle doesn't mean that the obstacle is completely useless. It's certainly possible that a thieve can pick a lock, but that doesn't mean you necessarily leave your door open when you go on holiday. It's even possible that he can hack your alarm system, but that doesn't mean it's stupid to buy it in the first place. The lock on the door and the alarm will make it significantly more difficult for a burglar to rob your house, so they're definitly not "useless".
Lets consider a real life example of a breach of computer integrity: say that there's a buffer overflow vulnerability in your browser, and just by entering a certain web-page a malware author is able to execute arbitrary code (not an uncommon way to infiltrate computers). If the browser is running with administrative privileges, the code can do anything; it can install viruses, bots, worms, trojans, adware, spyware, even rootkits which makes these things pretty much impossible to detect. If the browser is running with lower privileges, the damage that the code can do is severely limited. It can't modify the OS, it can make it so a certain process starts every time the computer starts, it cannot in any way harm the other users of the system. It's possible that it can find a buffer overflow in the OS itself, so that it's able to elevate it's own privileges, and do all the things it wants. But that's a significantly harder to do, you've presented the author with a significant, almost undefeatable, obstacle.
The fact is, your argument can be applied to pretty much any computer security equipement. Firewalls, anti-virus software, non-admin accounts, routers, rootkit detectors, passwords, encryption, etc. can all be defeated one way or another (well, really good encryption can't, but then it has to be really good). Does this mean that these things are all useless? No, of course it doesn't! But they are going to make you much safer. Belisarius (talk) 00:35, 28 January 2009 (UTC)
My point was that Unix-type (desktop) systems are only slightly more secure than Windows (or at least the way most newbies run it) if the user is attacked using social engineering. Thanks for the replies. Anyway, this is turning into a discussion... --wj32 t/c 02:37, 28 January 2009 (UTC)

how to print a wikipedia article to pdf file[edit]

I'm having trouble printing an article to a PDF file. I can "print it" to a pdf file, but sometimes a page is missing (e.g. if i print an article that is 5 pages long, page 2 will be blank for some weird reason). Please help me correct this. thanks. —Preceding unsigned comment added by Nippon22 (talkcontribs) 23:42, 27 January 2009 (UTC)

What article are you looking at, and how exactly are you converting it to PDF? Algebraist 23:46, 27 January 2009 (UTC)
You are using a PDF printer, I assume. The output depends on two things:
  1. the web browser (IE, Chrome, Safari, Firefox, Opera, ...) rendering the pages, and
  2. the PDF printer (e.g. PDFCreator).
You can make sure that the PDF printer is working properly, by trying to use it with another application, e.g. a word processor. You could also try to print using another web browser. --Andreas Rejbrand (talk) 08:37, 28 January 2009 (UTC)