Wikipedia:Reference desk/Archives/Computing/2012 April 19

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Computing desk
< April 18 << Mar | April | May >> April 20 >
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.

April 19[edit]

Password protect webserver[edit]

What is the easiest way to password protect an apache webserver, so that websites hosted by that server can only be viewed using a password? bamse (talk) 07:36, 19 April 2012 (UTC)

.htpasswd ¦ Reisio (talk) 14:51, 19 April 2012 (UTC)
Thank you! bamse (talk) 08:12, 20 April 2012 (UTC)

comments in source code[edit]

would they slow down interpretation compilation or runtime? especially if there is a lot of comments and speed/efficiency is important. — Preceding unsigned comment added by (talk) 08:14, 19 April 2012 (UTC)

No. The compiler will not include them in any object code. Shadowjams (talk) 08:34, 19 April 2012 (UTC)

I suppose they will probably very slightly slow down compilation, because it takes nonzero time to read them and figure out that they are to be ignored. But it's completely negligible. --Trovatore (talk) 08:41, 19 April 2012 (UTC)
By leaving out comments, particularly for the spurious reason of saving compilation time, you are simply saving up trouble for the future. Imagine someone else coming across your code, years later, long after you left the company, and then having to spend hours going over it just to find out what it is supposed to do. Comments really help the process of understanding what is going on. Astronaut (talk) 11:15, 19 April 2012 (UTC)
I certainly was not advocating leaving out comments! I was just answering the question as asked. --Trovatore (talk) 19:48, 19 April 2012 (UTC)
In the case of Homo Sapiens, you both create a whole field devoted to trying to understand how it works, and another whole field that tries to argue that the source code was intentional. Even a SINGLE comment in the 700 megabytes of uncompressed human genome would have put to rest any question of intelligent design versus evolution. (talk) 12:49, 19 April 2012 (UTC)
You can criticize ID in all sorts of ways, but I'm sorry, this one is pretty silly.
  1. We use comments because otherwise we'd forget what a section of code is for. A perfect Designer presumably does not have that limitation. An imperfect designer — say, an alien civilization, might want them though, so:
  2. Who says DNA is source code? Seems more like machine code to me. Maybe the source code is somewhere else.
  3. Supposing there are comments in the DNA, do you expect them to be in English? There's all sorts of gene sequences with no evident purpose. How do you know those aren't comments?
--Trovatore (talk) 20:17, 19 April 2012 (UTC)
DNA is definitely source code, and there are comments in it in at least one sense. One of the common uses of comments is to "comment out" code that causes problems, and DNA certainly uses mechanisms to do that, including methylation. There may also be comments in the sense of information that functions to provide guidance to external editors, but that's a topic that we don't understand very well yet. Looie496 (talk) 22:14, 19 April 2012 (UTC)
How is it source code? Source code is a human-readable construct used to create machine code, which is what the processor executes. If your point is that there are intermediate steps between the DNA and the proteins, well, processors also have intermediate steps between machine code and the actual switching of voltages. The feature that distinguishes source code from machine code is that source code is supposed to retain the meaning and intent of the algorithm. Where is that in DNA? --Trovatore (talk) 23:52, 19 April 2012 (UTC)
DNA is commonly called a "blueprint" or a "program code" - but these descriptions are merely analogies. Even in the most abstract representations of computation, with very generalized definitions of "computers," there's still a required property: computation. DNA is a molecule; it has a complex behavior. I can even accept the term "molecular machine," albeit with some hesitation. But computer? What, exactly, does DNA "compute"? What algorithm does it execute? I think we are falling down the slippery slope, where any "complicated" behavior can be attributed to "calculation" - which is almost semantically equivalent to attributing it to intelligent design. Complex molecular behaviors - even those that are governed by structural properties of the DNA molecule - are not calculations and are not executing programs. What other complicated natural processes would we also need to call "computers"? Perhaps carnot engines are empirically computing the laws of thermodynamics as they run the "algorithm" of pressure-volume work?
After I composed the above response, I started to wonder: to whom should we attribute this "DNA-is-a-program" analogy? Clearly, some scientist must have been the first to propose that DNA was "machine-like" or even "computer-like." I dug around and found our article about a 1958 quote by none other than Francis Crick. It seems that molecular biologists consider many transcription to be a "program" - but I much prefer to think of it as a process. Now we're really on thin ice - the distinction between an algorithm and a transcription process is sort of blurring in my mind. Still, I do not think that we can safely equate "any sequential information" with "computer program." Again, in computer science, we can define these things abstractly; in a von Neumann computer, sequential data might be a program; but it might not be, depending on its properties (and depending on our definition of "valid program.") One of the most canonical tests is to load the data as program-text into a machine that implements some instruction-set; then to run the program and see if it terminates. And this is, canonically and mathematically provably, an undecidable problem. Nimur (talk) 01:34, 20 April 2012 (UTC)
Sure, the "program" analogy is definitely an imperfect one and can be criticized independently, but my point is, even on the analogy's terms, I don't see that DNA is more like source code than it is like machine code. --Trovatore (talk) 01:40, 20 April 2012 (UTC)
The incredibly (incredibly!) tiny compilation-time cost is outweighed by the fact that programmers who know what's going on code a lot faster. (and more correctly, and write faster code.) Paul (Stansifer) 13:51, 19 April 2012 (UTC)
Agree with the above except that, in many languages, there's a pre-compiler which might strip out the comments before it gets to the compiler. Again, it takes a trivial amount of time to do this. StuRat (talk) 16:46, 19 April 2012 (UTC)
There are interpreters that literally interpret the program source code, comments and all. In those, the overhead of repeatedly skipping a comment in an inner loop could be significant. Applesoft BASIC is one example I have personal experience with. To get a little bit of extra speed, people would remove comments, use single-letter variable names, put the speed-sensitive code at the beginning (because the interpreter always searched for line numbers from the beginning on every GOTO or GOSUB), and so on. But all popular "interpreters" these days actually compile to bytecode (removing comments in the process) and then interpret the bytecode. -- BenRG (talk) 21:34, 20 April 2012 (UTC)
You are right about interpreted BASIC. And programmers would leave out spaces when possible, because that slowed it down. Also, even putting more than one line of code per physical line, seperated by colons, when the language supported it. Bubba73 You talkin' to me? 04:41, 22 April 2012 (UTC)

google advanced search[edit]

I can't see the advanced search option in the opening goggle page. Does it happening to everyone? --SupernovaExplosion Talk 09:47, 19 April 2012 (UTC)

Seems to have gone. Do your search first and on the results page you should see a cogwheel top right. Click on that and select "advanced search".--Shantavira|feed me 12:20, 19 April 2012 (UTC)
That is unfortunate. They have removed a vital feature which could be previously used with ease. --SupernovaExplosion Talk 15:48, 19 April 2012 (UTC)
Agreed. I'll mark this resolved, since Shantavira gave you the workaround. StuRat (talk) 16:38, 19 April 2012 (UTC)
In Internet Explorer, I've bookmarked with the name Google. Then I can enter google in the address box to go to that page. The page doesn't use auto complete and still has the gear at the top with Advanced Search. --Bavi H (talk) 23:50, 19 April 2012 (UTC)
Google Advanced Search hasn't been removed - it can be accessed directly at Vickreman.Chettiar 03:09, 22 April 2012 (UTC)

What is the best program to let me run Windows programs in Ubuntu 11.10?[edit]

I've heard of WINE but it doesn't work too well... is there a better alternative, regardless of price? — Preceding unsigned comment added by (talk) 16:44, 19 April 2012 (UTC)

Well, any attempt to emulate another O/S within yours is bound to have lots of overhead. So, while you might find one which works better, it's still going to be slower than running directly on Windows. A dual boot system might work better, if you have lots of need for both O/S's. StuRat (talk) 16:50, 19 April 2012 (UTC)
IMO, the best alternative is VMWare Workstation. It's a bit slower than the native machine, but the compatibility is perfect. --Sean 16:58, 19 April 2012 (UTC)
I'd have to say KVM (Linux's own built-in virtualization solution) or VirtualBox (slightly more user-friendly than KVM at the moment) would both be better choices for virtualizing a Windows guest on a Linux host. VMware, unlike KVM and VirtualBox, is not free / open source, and consequently always going to be more of a pain to use on the average Linux distro.
I agree with StuRat's assessment, but with a computer from the last few years you should be fine virtualizing most things, with the exception of graphics intense (that is, popular :p) games, for which you probably will want to dual boot. ¦ Reisio (talk) 17:41, 19 April 2012 (UTC)
If you're trying to play a game, Play On Linux is very good. It is based on Wine, but has a huge database of games and sets Wine up properly for each game. Worth a try if you have had a bad experience using Wine for gaming. - Cucumber Mike (talk) 18:03, 19 April 2012 (UTC)
if you are going to use Ubuntu, don't forget to add the more up to date wine repository: [1]. IRWolfie- (talk) 20:21, 19 April 2012 (UTC)

Tearing off a Firefox tab[edit]

I managed to do this accidentally in Firefox 11.0, but don't know how I did it. So, how do I take an existing Firefox tab, and move it into a new Firefox window ? StuRat (talk) 17:45, 19 April 2012 (UTC)

In FF11.0 for Ubuntu, I simply left-click-and-hold on the tab in question, drag down about an inch, then release. Et voila! - Cucumber Mike (talk) 18:00, 19 April 2012 (UTC)
This is in Windows XP, but I'll try that, thanks. StuRat (talk) 19:18, 19 April 2012 (UTC)
It works on Snow Leopard too. —Tamfang (talk) 22:40, 19 April 2012 (UTC)
Does it work in IE ? StuRat (talk) 06:19, 20 April 2012 (UTC)
Who cares? —Tamfang (talk) 08:30, 24 April 2012 (UTC)

Laptop will not connect to particular WiFi network[edit]

Hello, I purchased an HP laptop last Christmas, and regularly connected to my school's wifi network. However, recently, neither the school's unencrypted "outsider" network, nor the encrypted (unfortunately I can't remember what kind) "insider" network, will appear as networks to connect to. Oddly, I see all other wireless networks, including several Texas Instruments Navigator Access Points). I normally tether my laptop through my phone, but after around twenty minutes, the "outsider" network appeaars, but I am unable to connect to it. My phone, and everyone else's laptops, can connect easily to either network. Any ideas as to why this occurs or how to fix it?

Thanks, (talk) 21:22, 19 April 2012 (UTC)

Opening txt files in IE[edit]

Hi, i use IE to read txt files like stuff from Gutenburg. Most display just fine but every once in a while the file doesn't wrap the text but displays each paragraph as one line that must be scrolled across to view. Any idea why this is and what I can do to force the text to wrap? Thanks! — Preceding unsigned comment added by (talk) 21:50, 19 April 2012 (UTC)

It is probably because those txt files don't contain carriage returns. Why don't you use the html versions, which are much more suitable for a web browser? Looie496 (talk) 22:03, 19 April 2012 (UTC)

Thanks for the answer! I have gone back and dl'd the html versions for some but I have other files (not Gutenburg) where there is no html version so was wondering if there was an easy fix. I can copypaste the txt file to Word, then save as a txt file and it views correctly so I can work around the problem but was wondering if there was an IE setting that would force text wrap or limit the horizontal size of the page. — Preceding unsigned comment added by (talk) 22:32, 19 April 2012 (UTC)

Some text files have CRs (Carriage Returns) and others have LFs (Line Feeds). You need to find some setting to the effect of "Interpret LFs as CRs" to fix the problem, but I don't know if IE has such a setting. StuRat (talk) 06:18, 20 April 2012 (UTC)
Some text files don't use either CRs or LFs within paragraphs, leaving the display program to do line-wrapping. That's most likely to be the case here. Looie496 (talk) 23:44, 20 April 2012 (UTC)