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

= November 22 =

Merge Sort Question
One of my homework questions reads as follows: "Consider the following alternate implementation of Merge Sort that recursively sorts the array table from index a to b, where a ≤ b: public static > void sort(T[] table, int a, int b) {     if (b - a > 0) {          sort(table, a, (a+b)/2);           sort(table, (a+b)/2 + 1, b);          merge(table, a, b);      } } The merge method copies the elements of table from indices a to b (inclusive) into a new array and then merges the two halves of the new array back into table.

Modify the method above so that it calls the merge method only if the array is not sorted after the two recursive calls. You should be able to determine this in constant time."

I've got no clue how to check if a list is sorted... in constant time. The best way I can think of would take linear time.

Thanks for the help. —Preceding unsigned comment added by 128.2.100.212 (talk) 02:43, 22 November 2009 (UTC)


 * After each recursive sort call, you have the array sorted in two halves. Lets make m=(a+b)/2 to make this easy to explain.  The left half from a to m is sorted.  The right half from m+1 to b is sorted.  So, index m is the highest value in the left half.  Index m+1 is the lowest value in the right half.  What can you figure out about the two halves by comparing index m to index m+1? -- k a i n a w &trade; 02:58, 22 November 2009 (UTC)

Regions?
When I try to change the region of my DVD drive, it tells me there is only a limited number of times I can change it. Why is it? THX in advance ---Jake —Preceding unsigned comment added by 76.228.196.191 (talk) 03:35, 22 November 2009 (UTC)


 * The short story is that it's because the movie companies are real meanies. Big bullies, is what they are!
 * The slightly longer story is this: DVDs are encrypted using something called the Content Scramble System, which means that in order for a manufacturer to be able to produce a DVD, he has to license decryption keys from the DVD Copy Control Association, an organization made up of big Hollywood studios. If they don't license the keys to you, you can't make a DVD-player, which means that the movie studios can completely dictate how the DVD player should be working, and they've told your DVD-player manufacturer that you can only change the region coding so many times, and that's it. There's no technical reason why you couldn't just change them how many times you want, or even remove the region-coding requirement all together, it's just that Hollywood won't let you.
 * Now, you can in fact play a DVD even if you haven't licensed the keys for it, because CSS was broken by an enterprising 16-year-old Norwegian kid named DVD Jon in 1999 (that's not his birth name, but it is how he will be forever known), so now pretty much anybody that wants to can make a DVD-player or DVD-playing software. However, that is not legal in the United States because of a law called the Digital Millenium Copyright Act (yes, also backed by Hollywood), which has a provision that states that it is illegal to circumvent copy protection of any kind. So it's not like Panasonic is going to go do that.
 * Bottom line: movie studios are mean! Belisarius (talk) 08:31, 22 November 2009 (UTC)
 * In a number of countries (e.g. New Zealand and parts of Asia), region free players are the norm because of consumers demands and the like, region free stand alone players are the norm. In a few like Australia (although I'm pretty sure it was like NZ before the authorities pointed out they were likely illegal anyway), region limited players may even be illegal. This is mentioned somewhat in regional lockout and DVD region code. However nearly all computer DVD drives are still region limited specifically RPC-2. However there are various sites you can find hacked firmware for drives to make them RPC-1 or appear RPC-2 but auto-resetting (if a drive is RPC-1, Windows will limit region changes internally although it's fairly easy to break this). These could be illegal in some countries like the US. Nil Einne (talk) 10:27, 22 November 2009 (UTC)
 * So why don't computer DVD manufacturers make region locked players for the US market, where the DMCA is enforcable, and make region free equipment for the rest or the world? Astronaut (talk) 15:28, 22 November 2009 (UTC)
 * A lot of computer hardware companies are based in the US, so they would still be subject to US law regardless of where the computers are being sold. Also, there is less demand for unlocked drives for computers because they are much easier to bypass the locking on. --Tango (talk) 15:53, 22 November 2009 (UTC)
 * Also, imagine if (say) Panasonic were to make a region-free DVD player to be sold in some non-US country without the permission of the DVD Copy Control Association, the studios would be so royally pissed off that they'd never again license the keys again for use in the US market (that's the very least they'd do, they'd probably do far worse). It's basically unthinkable for a manufacturer to do that.
 * And it's absolutely true, if there is enough consumer pressure (like in New Zealand), the studios might relent and allow region-free players, because while the studio's don't like region-free players, they're absolutely terrified of piracy, which many would turn to as an alternative. They're assholes, but they're not complete morons. Belisarius (talk) 16:18, 22 November 2009 (UTC)
 * Your history isn't very accurate. The original cracking of CSS, i.e. the cryptanalysis and discovery of attacks, was done by Frank Stevenson. He based his analysis on C code posted to the Livid mailing list. This code appeared to have been hand-decompiled from machine code in a software player by someone with no understanding of the algorithm it implemented, making it most likely a copyright violation (since it included implementation details). This source code only included cryptographic functions; it was not a runnable program. Separately from this, two Windows executables for DVD ripping were released, one by DoD and the other by MoRE. Not only were these not open source, they were packed with executable packers to discourage disassembly. This is typical in the pirate community; they're no friends of open source. The DoD and MoRE decrypters most likely contained code copied verbatim from a software player in violation of copyright. Jon Johansen was just a co-author of the MoRE ripper. The media made a mess of the story, as they always do, conflating the MoRE ripper (decss.exe) with the source code posted to the mailing list, wrongly identifying Johansen as the sole author of decss.exe and/or as the one who had found the decryption code, and largely ignoring the DoD ripper for some reason. There's some more information here. Johansen didn't do anything to deserve anyone's praise. Frank Stevenson is the one who opened the CSS algorithm. -- BenRG (talk) 23:49, 22 November 2009 (UTC)

Bash alias
I want to construct the command

wikipedia [STRING]

as an alias of the command

firefox en.wikipedia.org/wiki/[STRING]

Furthermore, I want a lack of [STRING] to be interpreted as Main_page. I.e., I want

wikipedia

to be an alias of

firefox en.wikipedia.org/wiki/Main_page

How should I construct this alias? --Lucas Brown 03:57, 22 November 2009 (UTC)


 * Well, instead of making an alias, how about we make it a teeny-tiny little script. I think that's better, because if there any funny characters in the url, it will convert them to a url-friendly format. For instance, if you look at the article for Who's Afraid of Virginia Woolf? you'll see that there isn't a question mark at the end of the URL, only %3F, which is url-speak for question-mark. This little thing I cooked up in Python (wow, I'm doing a lot python logrolling lately...) will take care of that:


 * Save that as "wikipedia" in your path and make it executable, and it should go like gangbusters. Two things to note: this is actually a rather unorthodox little script, since it will join all your arguments into one string, without you needing to use quotes (I personally think it's kind-of a bad idea, but I think that's what you wanted). Also, I'm on a Windows-machine right now, so I haven't been able to test it except on Cygwin (where it works great), so caveat emptor. But I see no reason why it shouldn't work Belisarius (talk) 07:56, 22 November 2009 (UTC)


 * Alright, it's saved and executable... now how do I put it in my path? --Lucas Brown 18:35, 22 November 2009 (UTC)
 * Place the script in a directory (for example, you might use /home/your_username/bin/ or some other convenient location; or /usr/bin/ to make it accessible to everybody). Then, edit your .bashrc file and add


 * This will add that directory to your path. You might want to read Path (computing) or the GNU Bash Reference to learn more about what all this means.  Nimur (talk) 19:42, 22 November 2009 (UTC)
 * Thanks! --Lucas Brown 04:01, 23 November 2009 (UTC)  —Preceding unsigned comment added by Lucas Brown 42 (talk • contribs)
 * Use a bash function rather than a bash alias, like this:


 * This doesn't escape the "?" to "%3a", but it's not really needed (firefox copes with this ok). Who's afaid of Virginia Woolf? is a difficult one because you'd need to escape the apostrophe when running from a bash shell. --h2g2bob (talk) 18:23, 22 November 2009 (UTC)
 * That's no problem: just use double-quotes:

wikipedia "Who's afraid of Virginia's Wolf?"
 * I don't have my list of Wikipedia articles handy, but I wouldn't be surprised if there were a couple with both types of quotes, but this will work most of the time. --Sean 21:43, 22 November 2009 (UTC)
 * It seems there are a couple hundred such articles, including:
 * "Paul is Dead" clues from Sgt. Pepper's Lonely Hearts Club Band
 * Ain't Nothin' But a "G" Thang
 * Book Named "John Cleland's Memoirs of a Woman of Pleasure" v. Attorney General of Mass.
 * She said, "Don't make others suffer for your personal hatred."
 * William Shatner's version of "Lucy in the Sky with Diamonds"
 * --Sean 14:09, 23 November 2009 (UTC)

Shell quoting is smart enough that quotes in something expanded from a variable don't confuse it. These characters just won't be a problem. --Anonymous, 23:26 UTC, November 24, 2009.

Mousepad Opens Start Menu
When I touch the mousepad on my laptop on its left-hand side, the start menu comes up. While this may be useful in times of emergency or when one cannot remember how to do it normally it is actually annoying to have the start menu suddenly appear when I've touched it by accident, plus it very often crashes full-screen applications. Is there some way of switching this feature off? Another reason it's annoying is because in one game I have I need the left hand side of the mousepad to toggle the camera and whenever I try it's basically a toss up between what's going to happen - the camera getting toggled or the start menu appearing and crashing the game. I can change the in-game controls, but I won't need to if I can switch off this helpful mousepad feature. Can anyone help? I'm using Vista Home Premium on a HP G60 laptop. -- KageTora - SPQW - (影虎) (talk) 15:14, 22 November 2009 (UTC)


 * Yes, you almost certainly can turn it off. You'll have some touchpad settings somewhere, try Control Panel (there might also be an icon in the system tray (next to the clock)). Every one is different, but somewhere in there will be the options for what different sides and corners of the touchpad do. You need to find the left-hand side option and set it to "None" or similar. --Tango (talk) 15:50, 22 November 2009 (UTC)


 * Excellent, Tango, thanks! Sorted! -- KageTora - SPQW - (影虎) (talk) 17:27, 22 November 2009 (UTC)

Net access

 * I'm asking this again because for some reason my previous question disappeared. 

How can I prevent a single application from gaining internet access, without actually unplugging the computer from the internet and disrupting everything else? —Preceding unsigned comment added by 82.44.55.114 (talk) 13:14, 18 November 2009 (UTC)


 * Several firewall programs allow you to do this. I remember Symantec used to do allow this, but I think all firewalls do so. --h2g2bob (talk) 18:16, 22 November 2009 (UTC)


 * Your question was inadvertedly removed by another respondend . I added it back and the first reply may be helpful Reference desk/Archives/Computing/2009 November 18. Cheers Nil Einne (talk) 13:51, 23 November 2009 (UTC)
 * Ah that's where it went! Thanks —Preceding unsigned comment added by 82.44.55.114 (talk) 19:19, 23 November 2009 (UTC)

Two XP computers, one product key
I would like to run a spare XP computer in addition to the one I'm currently using, in case of a breakdown. Is it permissable to use the same product key for XP on these two computers, and would this cause any problems with Windows Update? 92.29.150.5 (talk) 19:30, 22 November 2009 (UTC)
 * I don't think you can have a read here might fill you in with a bit more info on activation. BigDunc  19:35, 22 November 2009 (UTC)
 * Sorry, but legally each computer would need it's own licence/key and the one you have is for one computer only. The only keys that are valid for multiple computers are volume licence keys which are only issued to businesses. Because you can't buy a copy of XP anymore, you would need to purchase a copy of either Vista Ultimate or Windows 7 Ultimate as these versions allow downgrade rights to use Windows XP Professional (you would need to contact Microsoft to get a product key/media kit). The Home and Home Premium versions of Vista/Windows 7 *don't* allow any downgrade rights. Hope this helps! ZX81  talk  20:01, 22 November 2009 (UTC)
 * You can still buy XP OEM...RxS (talk) 20:07, 22 November 2009 (UTC)
 * Sorry, my mistake, you are correct and XP OEM is indeed still available. ZX81  talk  17:50, 23 November 2009 (UTC)

Hey ho, hey ho, it's off to Ubuntu I go. Rather mean of Bill not to allow users with two computers to use one licence. 92.29.150.5 (talk) 20:11, 22 November 2009 (UTC)
 * It isn't mean, it's just business. Nimur (talk) 17:13, 23 November 2009 (UTC)
 * I remember mention that a Windows 7 or perhaps Vista installation pack comes with three licences - is that the case, and is it different with XP? 84.13.162.136 (talk) 10:10, 23 November 2009 (UTC)
 * You can buy the Windows 7 family pack which upgrades 3 computers to Windows 7 (although it goes in the face of what I said earlier, you get the same product key, but you get 3 different activations from it), but each of these would need to have their own copy of Windows already otherwise it's not valid for an upgrade (it would probably still work without having Windows already and from Microsofts point of view wouldn't look any different, but "legally" it wouldn't be a valid copy). ZX81  talk  17:50, 23 November 2009 (UTC)


 * I'm using an old second-hand computer, and as far as I remember, when I downloaded the XP service pack, during the verification part I got told that the product licence number I had (which I had discovered from the HD using some software rather than a COA label) had too many users, and I had to ring up somewhere and automatically got given a very long number to type into my computer. No payment involved. What was that all about? Just out of curiousity, if you got a second-hand computer that had someone elses product license number on it, would both of you get blacklisted? 84.13.162.136 (talk) 21:00, 23 November 2009 (UTC)

USB mouse for laptop
I have a USB mouse that works fine on one Vista Gateway laptop, but does not work on two others (Acer XP, Lenovo XP) that have functional rubber dot and touchpad cursors. The mouse came with no driver software and worked fine on two other laptops without installing anything special. I tried to find a generic mouse driver on the internet with no success. I tried to change the Control Panel settings under Mouse. I suspect the answer is simple but I am baffled. Any suggestions appreciated. alteripse (talk) 20:14, 22 November 2009 (UTC)


 * Does the computer see the mouse when you plug it into the USB port? The usual behavior under Vista is that a little text box appears in the lower right of the screen, telling you that a new device has been found.  Alternatively, take a look in Device Manager, a minute after you plug it in.  (In Vista, right-click "Computer", choose "Properties", then click "Device Manager", then unroll "Mice and other pointing devices".)  This will at least tell you whether the computer even sees the mouse.  Try other USB ports on the computer, too, if it's unseen and you haven't tried this already.  Comet Tuttle (talk) 03:47, 23 November 2009 (UTC)

Stop software from reinstalling
Hello, I am trying to uninstall a VPN client I downloaded and installed from my college's website, but now every time I turn on my computer, the software tries to reinstall. How can I fix this? Is there a simple solution using Windows Registry (Vista 64-bit)? Thanks!--el Aprel (facta-facienda) 20:54, 22 November 2009 (UTC)


 * Revo Uninstaller conducts a more thorough uninstall than to the uninstallers created by many installer/uninstaller packages. You may also want to check your start menu, and maybe purge Autoruns with the Microsoft / Sysinternals Autoruns program, as somehow the installer may have been accidentally tagged as an autorun program. -- Finlay McWalter • Talk 21:08, 22 November 2009 (UTC)


 * Thanks again, Finlay McWalter. All fixed!--el Aprel (facta-facienda) 23:33, 23 November 2009 (UTC)

Correct adaptor for old printer to new computer; totally stumped
I just got a new computer, a HP Pavilion Slimline, and the connection from my old printer (which still works great) doesn't fit into the back of the computer at all. The printer is an HP Laserjet 3200 and the connector it has is a double row of pins; one row has 12 pins and the other has 13 and I believe this was the standard printer connection thingamagig for many years. The new computer doesn't have any even similar place for a pronged connection. The only open connections are So, can anyone tell me what I need to buy to hook up my printer and which hole it goes into? This description may have been overkill, but I didn't want to leave anything out that would make it impossible to answer for lack of information on my end.--70.19.21.16 (talk) 22:10, 22 November 2009 (UTC)
 * 4 small holes for TV in; Ant In; S video in; Audio
 * HDMI (??)--This is next to where I plugged the pronged outlet for my monitor (it came with the adaptor) which is marked LCD
 * Six audio plug ins (I think) marked c/sub, in, rear, out side and mic
 * An ethernet where I plug my DSL in and next to that two smaller unmarked rectangular holes, and above those, two more holes identical to those below, marked with this weird symbol where a pocket drive will hook up.
 * At the very top are two plastic protectors over places I'm guessing you can install further ?ports? which are marked on the plastic "DO NOT REMOVE" (what are these?) and finally above that there is a hole for "digital audio out" which looks just like the connector my cable box hooks into in my wall.


 * For many years printers were usually connected to the LPT parallel port, but today such ports are very uncommon. Instead, printers use USB to connect to computers. Probably there are interfaces (adaptors, converters) that can solve your problem. --Andreas Rejbrand (talk) 22:22, 22 November 2009 (UTC)


 * 12 + 13 =25 pins— is this on the printer or the PC side? If it was on the PC side, then the printer has IEEE 1284 parallel; see the link for photos. You can find USB to parallel adapters online or at most big box stores. The parallel interface is disappearing, but it is going to hang on for a while. ---— Gadget850 (Ed)  talk 22:46, 22 November 2009 (UTC)


 * Here's a link to example USB/parallel adapters. You should be able to get one for less than US$10. The covered-up ports on the back of your PC, BTW, are probably for an onboard sound card. OEMs do this when the computer has both an onboard sound card and a physical expansion sound card (eg, SoundBlaster), to make sure the end-user only uses the ports from the higher-quality add-on card. Indeterminate (talk) 06:47, 23 November 2009 (UTC)


 * Your printer might be usable with a "usual" USB cable as well - check the printer thoroughly to see if there is an USB port on it (marked with the "weird symbol" you mention). If so, you can just buy a regular USB cable. Jørgen (talk) 08:14, 23 November 2009 (UTC)


 * The only way to tell is if the OP gives us the printer model. ---— Gadget850 (Ed)  talk 13:16, 23 November 2009 (UTC)


 * Um the OP did say they have a HP Laserjet 3200. From  & (the manuals there appear to be for the 3200m but I presume they're similar enough & that's why the manual is the same) it does have a USB port. Note that a 'usual' USB cable in this case will be a USB B male to USB A male cable and alook at the manual confirms this is likely to be the case. Nil Einne (talk) 13:32, 23 November 2009 (UTC)

Windows ReadyBoost
When I plug in my Flashdrive it gives me as one of the options: Speed up my system using Windows ReadyBoost. Is this something desirable and will I notice any difference? What is that basically about? 64.138.237.101 (talk) 23:13, 22 November 2009 (UTC)
 * See the ReadyBoost article. --Andreas Rejbrand (talk) 01:18, 23 November 2009 (UTC)