Wikipedia:Reference desk/Computing
of the Wikipedia reference desk.
Main page: Help searching Wikipedia
How can I get my question answered?
- Select the section of the desk that best fits the general topic of your question (see the navigation column to the right).
- Post your question to only one section, providing a short header that gives the topic of your question.
- Type '~~~~' (that is, four tilde characters) at the end – this signs and dates your contribution so we know who wrote what and when.
- Don't post personal contact information – it will be removed. Any answers will be provided here.
- Please be as specific as possible, and include all relevant context – the usefulness of answers may depend on the context.
- Note:
- We don't answer (and may remove) questions that require medical diagnosis or legal advice.
- We don't answer requests for opinions, predictions or debate.
- We don't do your homework for you, though we'll help you past the stuck point.
- We don't conduct original research or provide a free source of ideas, but we'll help you find information you need.
How do I answer a question?
Main page: Wikipedia:Reference desk/Guidelines
- The best answers address the question directly, and back up facts with wikilinks and links to sources. Do not edit others' comments and do not give any medical or legal advice.
February 19
Installing utorrent on linux
How do I install utorrent on Linux? — Preceding unsigned comment added by Me has a question (talk • contribs) 23:21, 19 February 2016 (UTC)
- I have some good advice: don't use uTorrent. Get another torrent client. Here is info on how to install the torrent client Deluge on Linux (specifically Debian or Ubuntu distro's). Deluge is a free, open source software. The Quixotic Potato (talk) 00:20, 20 February 2016 (UTC)
- Which Linux distribution are you using? The package manager will let you install additional applications; there should be several torrent clients available. 62.56.67.192 (talk) 12:06, 20 February 2016 (UTC)
- Some Linux distributions include Transmission (BitTorrent client). Use instead, if possible. Else get μTorrent from its webpage. As its lincense includes Adware, it will not be listed in repositories. You need to know the consequences of installing it on Your computer. --Hans Haase (有问题吗) 18:23, 22 February 2016 (UTC)
February 20
/\ in proof of Ardens Theorem means?
Could anyone tell what does the symbol '/\' mean in the proof of Arden's Theorm given here(P.18).
NB:'/\' doesn't mean the regular expression written as '^'.Here '/\' is an element of R as given in this book(P.127).
JUSTIN JOHNS (talk) 09:25, 20 February 2016 (UTC)
- It stands for the empty word, more often written as ε. --Stephan Schulz (talk) 13:08, 20 February 2016 (UTC)
Yeah thanks for that.JUSTIN JOHNS (talk) 06:32, 22 February 2016 (UTC)
Windows 10 on a slower PC
I have one computer running Win7 on an AMD dual-core 64-bit processor rated at 1.6 GHz, 4 GB of RAM. It's used only for email and basic browsing, and its speed is on the slow side of borderline. Generally speaking, would you expect Win10 to be a little faster, roughly the same, or a little slower? If the latter, I'll leave it on 7 for the remainder of its life.
The computer clearly meets the minimum system requirements for running 10, but "run" is not the same as "run well", and I'm looking for "run well". It also meets the requirements for Win7, but as I said I'm not entirely happy with the performance. I don't want to make it worse. ―Mandruss ☎ 15:43, 20 February 2016 (UTC)
- My experience with several old PCs (Intel 3.X Mhz dual-core, 8-16GB RAM, 64-bit Win7 vs. 64-bit Win10) is that Win10 was just a bit faster, but they were close. This review found the same thing. I also found that, on both Win7 and Win10, going from 4GB to to 8GB made a big difference, but going to 16GB didn't do much. Also, replacing the rotating disk with a SSD made a big difference.
- You can get Dell Optiplex 780, Dual core@3.33GHz, 8GB RAM, 500GB HDD, Win7 Pro 64-Bit for well under $200.[1] You have until 29 July 2016 to load and install the free Win7 to Win10 upgrade. --Guy Macon (talk) 18:04, 20 February 2016 (UTC)
- If you want to make the PC faster, it is probably more efficient to clean it up a bit (and maybe even buy some RAM, old RAM is very cheap if you go to a second-hand store). Autoruns and Defraggler may be useful. The Quixotic Potato (talk) 01:28, 21 February 2016 (UTC)
February 21
Name generators
Are there any reliable secondary sources out there that discuss name generators (such as http://FakeNameGenerator.com) in any kind of detail? Thanks. —67.14.236.50 (talk) 07:59, 21 February 2016 (UTC)
- Markov text generators might get you started. -- Finlay McWalterᚠTalk 13:08, 21 February 2016 (UTC)
- For people's names, which tend not to be very random, your best bet is probably just to pick names from the set of most popular first and second names for whatever region you're coming from - and for the age of the imaginary person. The US Social Security people have lists of the most popular first names over the last 100 years and has the most common surnames for every decade...and there are many other sources like it. Markov chains are better for making up long strings of nonsense words that kinda sound real - or stringing together real words into nonsense sentences that kinda make sense. But names that are made up of nonsense don't usually sound real - so picking off of a list is easier and more convincing. I'd be very surprised if FakeNameGenerator.com did anything more than pair first and second names picked at random from a census or something. SteveBaker (talk) 21:50, 23 February 2016 (UTC)
What naming scheme(s) does Wikipedia use? Is it structured, flat (unstructured), or, attribute based?
I'm learning distributed systems and one of the topic is naming. So I'm wondering what naming scheme(s) does Wikipedia use? Is it structured, flat (unstructured), or, attribute based? Do other web services also use the same naming scheme? I can't seem to find information on structured, flat, or, attribute-based naming scheme on Wikipedia. Could you please point me into the direction of finding the information? Thank you so much. — Preceding unsigned comment added by 116.87.54.73 (talk) 09:44, 21 February 2016 (UTC)
- There is no "scheme". The relevant policy is at WP:TITLE. -- Roger (Dodger67) (talk) 11:00, 21 February 2016 (UTC)
- @Dodger67: I think he’s asking about technical behind-the-scenes details, not about how we choose the human-friendly article titles. I’m not sure if the question is even applicable to Wikipedia (I don’t know much about distributed systems), but I know our revisions are identified by a simple incrementing number, currently in the hundreds of millions. So, I guess that would make it flat. But for naming the articles (for public use; I don’t know if they have a different identifier behind the scenes), we have namespaces like “WIkipedia:”, “Help:”, “Template:”, and a “talk” namespace for each of them. We have e.g. an article named Wikipedia and a project page named Wikipedia:Wikipedia. I’m not sure if that makes it structured. Hope that helps, though I don’t know if I gave you any new information. —67.14.236.50 (talk) 03:50, 22 February 2016 (UTC)
- In the early days, Wikipedia articles had names like "Namibia/Economy" and "Namibia/History" and the software understood that those were child articles of "Namibia" (which is structured naming), but now those articles are called "Economy of Namibia" and "History of Namibia" and there is no well defined hierarchy (which is flat naming). If you include pages in other namespaces like Talk: and Wikipedia:, the hierarchical names are still used (on this page, for example), and the namespace can also be seen as the top level of the hierarchy.
- I've never heard the terms "flat naming" and "structured naming" outside of university courses, but that may be because I don't work in distributed systems. Wikipedia should probably cover them regardless. Someone just needs to write the article. -- BenRG (talk) 03:45, 22 February 2016 (UTC)
- Now the names to refer to article sections would be "Namibia#Economy" and "Namibia#History". StuRat (talk) 04:01, 22 February 2016 (UTC)
- Wait a minute. What is being named in distributed systems? If the question pertains to the files on the project’s web servers or the way they’re networked, then none of us are qualified to answer it unless we’re familiar with Wikimedia’s backend, which has nothing to do with how articles are named. —67.14.236.50 (talk) 04:03, 22 February 2016 (UTC)
- Thank you all for your replies. I'm still trying to understand how naming works in distributed systems, so forgive me if my questions are not appropriate. I guess my next question would be why Wikipedia uses colon (:) in its URL, example would be https://en.wikipedia.org/wiki/Wikipedia:Reference_desk. I understand this is to divide into different categories but then why not just use slash (/) instead like https://en.wikipedia.org/wiki/Wikipedia/Reference_desk or https://en.wikipedia.org/wiki/Wikipedia/Talk_page_guidelines. Thanks. — Preceding unsigned comment added by 203.217.187.24 (talk) 12:30, 23 February 2016 (UTC)
- Colon is for Wikipedia:Namespace. Many of the namespaces have special software features associated with them. Slash is for Wikipedia:Subpages. PrimeHunter (talk) 12:43, 23 February 2016 (UTC)
- Wikipedia uses MediaWiki, a server software program mostly written in PHP. Most of the content is stored in a relational database using SQL; some data is directly backed by files. These architectures implement the mapping between user-visible named content - like article pages - and their backing-storage. More specifically, titled content uses a Title object that can be used to retrieve a valid URL; it is this code that converts a wiki page title into the naming system that can be understood by a web server that hosts MediaWiki. The web server may respond to a URL retrieval request by forwarding it to MediaWiki (and then traversing backing storage to get the content, or running some special feature implemented in MediaWiki)... or the web server may do "something else." You can review all of the things on a wiki that have "titles" - not every such entity is a content page. Consider, for example, special pages.
- The key to understanding all of this is to recognize that there are multiple complex subsystems - a web server, a PHP program, a database, a file system... and more. Each subsystem has its own convention and/or standardized naming system. The user-interface hides these details and presents you with one single name-convention; but under the proverbial hood, there are many different types of naming-systems.
- Nimur (talk) 16:11, 23 February 2016 (UTC)
.MACOSX directory in zip file
I got some zipped lectures, and there were a __MACOSX directory with files like ._.DS_Store, and ._<name of the lecture>.mp4 inside. What is this?--Llaanngg (talk) 13:57, 21 February 2016 (UTC)
- It means the zip file was made on a Macintosh computer. You can safely ignore them. See superuser.com and Resource fork and .DS_Store for more info. The Quixotic Potato (talk) 14:06, 21 February 2016 (UTC)
Regexp's literal strings
Following regexp works for me:
rename 's/(Chapt).(.*)/$2.$1er/' *
but in emacs, when I try to extract a pattern, and include the found group () into the target string, I have to do:
\(Chapt\).\(.*$\) -> \2.\1er
and not:
(Chapt).(.*$) -> \2.\1er
Why is it different? And why isn't \(\) in emacs reserved for the case where you actually want to reuse the found pattern? --Scicurious (talk) 23:10, 21 February 2016 (UTC)
- Emacs uses an older syntax for regular expressions (a combination of the POSIX basic and extended syntaxes) than Perl (the modern standard). The biggest change (for the common subset of functionality) is that you must escape (){} exactly when you must not for Perl. No regular expression system uses \(\) to turn on (or off) capturing: you turn off capturing (where it's supported) with (?:…). In Emacs, you escape those parentheses with backslashes (just like for a capturing group). --Tardis (talk) 01:09, 22 February 2016 (UTC)
- Calling Perl regexes "the modern standard" is a bit misleading. For one, they aren't standardized. Neither is PCRE, which means things that claim to support "PCREs" often have subtle incompatibilities with each other. It's a bit of a mess (insert xkcd comic about standards here). Yes, most of the time if you stick to the simpler PCRE features things will be portable, but don't assume it. Look at the documentation for whatever you're using. --71.119.131.184 (talk) 05:17, 22 February 2016 (UTC)
- Fair enough—I should have said merely that Perl's choices about the basic features are currently preferred. For example, Python used to follow Emacs' convention, then switched to Perl's. --Tardis (talk) 02:43, 24 February 2016 (UTC)
- Calling Perl regexes "the modern standard" is a bit misleading. For one, they aren't standardized. Neither is PCRE, which means things that claim to support "PCREs" often have subtle incompatibilities with each other. It's a bit of a mess (insert xkcd comic about standards here). Yes, most of the time if you stick to the simpler PCRE features things will be portable, but don't assume it. Look at the documentation for whatever you're using. --71.119.131.184 (talk) 05:17, 22 February 2016 (UTC)
- (EC)What you have encountered are some of the differences between the many flavors of regular expressions. As regular expression implementations have added features over the years, there have also been corresponding variations in the supported syntax, some of which are not compatible with one another. One early distinction was between the UNIX Basic Regular Expression (BRE) and Extended Regular Expression (ERE) syntax. (See Regular expression - POSIX basic and extended.) Emacs implements BREs (or some variant thereof), where only a few characters have special meaning when not escaped.
- For more information and a comparison of syntax, I suggest you look at [2]. Set the drop-down flavor selectors to "POSIX BRE" "POSIX ERE" as a start, or select any other flavors that my be of interest. Syntax feature categories (Characters, basic features, quantifiers, ...) can be selected at the left. -- Tom N talk/contrib 01:49, 22 February 2016 (UTC)
- This page is also a good reference on regex syntax. Also note that "rename" is not a standardized Unix command, although a lot of people think it is. There are multiple programs called "rename" floating around out there, with incompatible syntax. See here for some more portable ways to rename files. --71.119.131.184 (talk) 05:17, 22 February 2016 (UTC)
February 22
Thomas edison
hello i need a reply as soon as possible for this, it is for a school assignmetn and iv beensearching for 1 hour now for the answer so i decided to make a post the answer i need help with is (Famous inventor) Thomas Edison. How is this persons name now used to describe or measure something in electronics.? — Preceding unsigned comment added by Buck Dunford (talk • contribs) 03:21, 22 February 2016 (UTC)
- Many light bulbs have an Edison base (that's the wide screw threads at the bottom). Note that while our article features incandescent light bulb pics, many newer CFL and LED lights continue to use the same base. StuRat (talk) 03:28, 22 February 2016 (UTC)
- Do you refer to the Edison effect ? StuRat (talk) 04:02, 22 February 2016 (UTC)
Programmable game controller
Years ago I had a Microsoft SideWinder Strategic Commander game controller. Does anyone know if there's anything similar on the market nowadays? I can't find anything obvious out there, everything seems to be in programmable keyboards nowadays. I need ot to be Windows 7/10 compatible. -mattbuck (Talk) 15:12, 22 February 2016 (UTC)
- The Steam controller is very configurable (in reality the configuration is its driver, but that was probably the case for the sidewinder too), where one can map different buttons to different actions and map the "joysticks", touchpad, triggers etc. to different actions as well. An example config is here. I don't know, however, if it's possible to configure one button to generate a sequence of keystrokes. I should say I've personally not used a Steam controller, but every review I've seen of them has been positive. -- Finlay McWalterᚠTalk 15:54, 22 February 2016 (UTC)
- On looking further, it seems the Steam Controller does not have macro (keysequence) support), but that people have had success using a custom key on the controller to trigger a macro defined in AutoHotkey. -- Finlay McWalterᚠTalk 16:02, 22 February 2016 (UTC)
Transition from http to https
So I've just switched my personal websites over from http to https using the "Let's Encrypt" free service. They seem to be working just fine. I'm wondering though about URL's I have embedded in HTML, JavaScript and PHP code... Is it best-practice these days to request https from other sites that I link to? All of them? Do I have to check each link manually to see which support it and which don't? I know that some browsers rewrite URLs that the user types in - but what about those embedded in other places? SteveBaker (talk) 15:55, 22 February 2016 (UTC)
- This may have nothing to do with your question, but this is what your question made me think about... I just did a test in Google Chrome and in Firefox. I made a page that does an Ajax request to a page using http instead of https. I accessed the main page using https and let the ajax run. On the server, the ajax request is logged in access_log, not in ssl_access_log. So, I received it via http, not https (as I stated in the JavaScript). However, neither browser threw a warning. I hoped it would be like when you have a secure page that includes an image using http. You get a warning that insecure content is being included in the secure page. Therefore, the clients are not being told that unsecured content is being made via Ajax in their secure page. It is up to the developer to ensure that if "http" is included in the ajax, they must use "https". Better, don't use an absolute URL. A relative URL will maintain the https part of the page. 209.149.114.211 (talk) 16:27, 22 February 2016 (UTC)
- Yeah - I already use relative URL's where I can - but it's not always possible to keep everything on the same server. But suppose I say something in HTML like "You can find out more about this on <A HREF="http://wikipedia.org">Wikipedia<\A>" ? Should that be 'https'? (Wikipedia supports https - but what about a site like slashdot that (currently) does not?) SteveBaker (talk) 16:51, 22 February 2016 (UTC)
- A relative URL without a scheme (http: or https:) is valid, per RFC 3986: "Uniform Resource Identifier (URI): Generic Syntax", Section 4.2. It looks like this: <img src="//domain.com/img/logo.png"/> When making external links, try HTTPS first, if that does not work then link to the HTTP version. Using HTTPS Everwhere may be useful. The Quixotic Potato (talk) 17:30, 22 February 2016 (UTC)
- I don't see the benefit of connecting to Wikipedia or Slashdot using HTTPS. Yes - it encrypts your traffic. No - it does not hide that you are going to Wikipedia or Slashdot. Wikipedia automatically redirects to HTTPS if you sign in. So, if you link to it using HTTP, it automatically switches to HTTPS. The same with Facebook. So, there is no point to use HTTPS when HTTP will automatically redirect as necessary. It won't throw a warning on the client because the link isn't being included in the source.
- On a side note... I avoid using HTTPS at one place where I work. They have idiots in charge of IT. Instead of security, they just purchase and run a deep-packet inspection tool that automatically decrypts all HTTPS traffic. The client gets a fake certificate and has to accept it to continue. I don't want to fill my browser with fake certificates, so I use HTTP. 209.149.114.211 (talk) 18:51, 22 February 2016 (UTC)
- I know there are some issues for some people with https - I'm not shutting off http access. But there is a strong trend for browsers to search for https sites first - so there is an incentive to support both.
- The idea of https is not so much that the content arrives encrypted - or that you are somehow hidden from tracking - but that it guarantees against man-in-the-middle attacks. Your IT dept is (in effect) performing a man-in-the-middle attack on you - so it's good that you're being warned! SteveBaker (talk) 20:27, 22 February 2016 (UTC)
- Note that wikimedia sites or at least wikipedia and commons have used HTTPS by default for all users since last year [3] [4]. Apparently their blog still doesn't (although does support HTTPS). As The Quixotic Potato mentioned, protocol relative links are valid, including supported by mediawiki. Now that wikipedia uses HTTPS by default, I use protocol relative links when HTTPS works properly on the site (and also HTTP, but very few sites don't at least partially support HTTP) under the assumption anyone not using HTTPS must be doing it intentionally for some reason and may want to continue it to the other site. IMO it would make sense to do the same for your website for sites that support both HTTPS and HTTP. I would suggest the same even for sites like slashdot which only partially support HTTPS (will redirect you to HTTP). However it may pay to test sites using a proxy or Tor or something. I've found it's quite common for sites using CloudFlare or Akamai or other CDNs to be misconfigured and gave certificate problems with HTTPS. This has included at least one US government website although I think that was over 2 years ago. I sometimes suspect, but I've never really looked in to it, that this is partially because I'm in NZ. Of course some of them, e.g. I think this applies to TechCrunch, are probably just borked for everyone. Nil Einne (talk) 16:40, 23 February 2016 (UTC)
- Hmmm - interesting. I'm also concerned that WinXP/IE8 and WinXP/Chrome users may have trouble with HTTPS. I've put a .htaccess file in place that redirects the https: site to http: when it detects a WinXP agent...but again, I worry that other https sites that I link to may not do that. SteveBaker (talk) 16:57, 23 February 2016 (UTC)
- Note that wikimedia sites or at least wikipedia and commons have used HTTPS by default for all users since last year [3] [4]. Apparently their blog still doesn't (although does support HTTPS). As The Quixotic Potato mentioned, protocol relative links are valid, including supported by mediawiki. Now that wikipedia uses HTTPS by default, I use protocol relative links when HTTPS works properly on the site (and also HTTP, but very few sites don't at least partially support HTTP) under the assumption anyone not using HTTPS must be doing it intentionally for some reason and may want to continue it to the other site. IMO it would make sense to do the same for your website for sites that support both HTTPS and HTTP. I would suggest the same even for sites like slashdot which only partially support HTTPS (will redirect you to HTTP). However it may pay to test sites using a proxy or Tor or something. I've found it's quite common for sites using CloudFlare or Akamai or other CDNs to be misconfigured and gave certificate problems with HTTPS. This has included at least one US government website although I think that was over 2 years ago. I sometimes suspect, but I've never really looked in to it, that this is partially because I'm in NZ. Of course some of them, e.g. I think this applies to TechCrunch, are probably just borked for everyone. Nil Einne (talk) 16:40, 23 February 2016 (UTC)
Listing duplicated filenames
On Fedora 20 Linux, I have a directory containing subdirectories and sub-subdirectories. These sub-subdirectories contain files whose names follow a regular pattern. Some of the names might be duplicated in separate directories. The directory structure is rigid, i.e. the files always reside at the same depth under the main directory. There are about a quarter million such files.
How do I get a listing of all the filenames that appear in more than one sub-subdirectory, and the directories they appear in? JIP | Talk 16:11, 22 February 2016 (UTC)
- Well, if you do an "ls -R1" that'll get you a recursive list of all of the files - without the preceding pathnames - one per line. If you don't want to look for duplicated sub-directories, then you could pipe that through grep -v '\\' to get rid of the directory names. Pipe the results of that through 'sort' to get the identical names in consecutive order and then save the results into a file. Next, push the resulting file through 'uniq' to reduce it to a list without duplicates and save that to a second file. Then you can 'diff' the sort'ed list and the sort/uniq'ed list files to get a list of all of the duplicated files - which you'll want to push through 'uniq' again so you only have one copy of each filename.
- That process gets you a list of duplicated filenames, one per line, with no directory names.
- OK - so now you need to know which directories those are in. The 'find' tool is a natural for doing that - so you'll want to use something like 'sed' to take every line of the file we just made and turn it from whatever into:
- find . -name whatever -print
- ...so you now have a script with a 'find' command for each duplicated file. Then you can run that as a script to get a complete list of every duplicated filename and all of the paths that it occurs in.
- If you might have spaces or weird characters in your file names - or if there are hidden files, devices, links, symlinks and other monstrosities that you need to be careful of...you'll need to think this through more carefully - but that's an outline of a shell-based means to do it.
- Like everything you can do in shell - there are probably a dozen different ways to do it. SteveBaker (talk) 16:41, 22 February 2016 (UTC)
- (ec)I don't know of a single command that does this. Just a train of thought... You can use ls -LR . to get a list of all files under the current directory (change . to the directory you are interested in). You can sort that list and then use uniq -c to get a list of unique names with a count. You can use grep -v "^\s*1\s" to omit any entry that has a count of 1. Then, you can use sed "s/^\s*[0-9]*\s*//" to remove the count from those that remain. Then, you can loop over the result list with locate (assuming you've run updatedb recently). This will create a list of duplicated filenames with full paths to each one: ls -LR . | sort | uniq -c | grep -v "^\s*1\s" | sed "s/^\s*[0-9]*\s*//" | while read x; do locate -bP '\\'$x; done
- That is not "easy". However, it is what came to me as I went from "I have a list of files" to "I want a list of the locations of each duplicate file." I'm sure someone else will chime in with a command that does exactly what you want without all the extra work. 209.149.114.211 (talk) 16:48, 22 February 2016 (UTC)
- I think we are talking about essentially the same approach here.
- One thing you CAN'T do is to use wildcards to find files - with millions of files, you'll overflow the maximum length of the command line...and in any case, it would be insanely slow. SteveBaker (talk) 16:55, 22 February 2016 (UTC)
- →List of file comparison tools --Hans Haase (有问题吗) 18:14, 22 February 2016 (UTC)
- I believe that most (if not all) of those tools are for comparing the contents of files - not the names of files in different directories - which is what is being asked here. It's possible that one or two of the tools might do what our OP requests - but you're not going to discover that from List of file comparison tools. SteveBaker (talk) 20:22, 22 February 2016 (UTC)
- I would do something like this
find . -type f | perl -e 'while(<>){chomp; $p=$_; ($f)=/.*\/(.*)/; push @{$d{$f}}, $p; } foreach $f (keys %d){ print(join(" ", @{$d{$f}}, "\n")) if @{$d{$f}} > 1 }'
If your filenames can contain spaces you may want to replace the separator in the join statement with some other character, just for readability. Mnudelman (talk) 20:07, 22 February 2016 (UTC)
- I'm a little unclear on your question. Do you actually care about which directories the files are in? In other words if you have:
top1 top2 | \ | sub1 sub2 sub1 | \ | | foo bar bar foo
- ...do you want both "foo" and "bar" printed, or only "foo"? If it's the first, you're just asking for all files that have the same name, which is trivial. --71.119.131.184 (talk) 21:32, 22 February 2016 (UTC)
- Yes, I want both "foo" and "bar" printed. JIP | Talk 05:46, 23 February 2016 (UTC)
If you want to do it all in shell scripting, you could do it by first using sort | uniq -d
to pick out the repeated filenames, then find
to report the instances of each one:
find . -type f | sed 's:.*/::' | sort | uniq -d | while IFS="" read basename do echo "Repeated name $basename:" find . -type f -name "$basename" echo done
The IFS=""
bit may be obscure: it's necessary in case any of the filenames may start or end with whitespace, because read
was not originally intended for this sort of use and strips leading and trailing whitespace from the line it reads.
Of course this appraoch is potentially inefficient since it will use find
repeatedly, but that may not be important. --69.159.9.222 (talk) 06:20, 23 February 2016 (UTC)
- That script will still fail on filenames containing *?[ (special to -name) or \ (special to read) or newlines. It's O(n²) in the worst case, as you pointed out, which could be a problem when n ≈ 250000. sed, sort and uniq use the current locale, which could cause problems.
- I don't understand why people go to all the effort of trying to get bash to do anything reliably. There are much better programming languages out there. Here's a solution in Python:
import collections, os
dirs_by_name = collections.defaultdict(list)
for dir, subdirs, files in os.walk('.'):
for file in files:
dirs_by_name[file].append(dir)
for file, dirs in dirs_by_name.items():
if len(dirs) > 1:
print('%r is in %r' % (file, dirs))
- -- BenRG (talk) 09:36, 23 February 2016 (UTC)
- This Python program worked and gave me a list of quite a lot of files, which appear to be correct so far (I didn't check quite thoroughly yet). But it seems to traverse the directory structure as deep as it can. I want it to only go two subdirectories deep. How can I do that? I don't understand much of Python. JIP | Talk 19:47, 23 February 2016 (UTC)
- os.walk() isn't well-suited to that: you could count the slashes in the directory names, but it might be nicer to just do it manually:
- This Python program worked and gave me a list of quite a lot of files, which appear to be correct so far (I didn't check quite thoroughly yet). But it seems to traverse the directory structure as deep as it can. I want it to only go two subdirectories deep. How can I do that? I don't understand much of Python. JIP | Talk 19:47, 23 February 2016 (UTC)
from os import path
def srch(d,lev):
for f in os.listdir(d):
df=path.join(d,f)
if lev:
if path.isdir(df): srch(df,lev-1)
elif path.isfile(df): dirs_by_name[f].append(d)
srch(".",2)
- This replaces just the walk loop in BenRG's code. If you have symlinks, be warned that this will recurse through them (albeit only to 2 levels!). --Tardis (talk) 23:18, 23 February 2016 (UTC)
Google date
Please can you tell me how to find out when the "Google Street View" photographic car will be visiting a certain area? I do NOT wish to be photographed so I want to stay indoors in the day it is due in my area. Thank you. — Preceding unsigned comment added by Haridtanton (talk • contribs) 20:27, 22 February 2016 (UTC)
- They give rather general info on this page. It is important to note that Google doesn't completely control every camera used to get images for Google Maps. From that page, you will see links to information about how the images are obtained. You should also note that Google has put a lot of effort into blurring out the faces of people or, often, completely removing people from images. The next goal is to completely remove cars from the images. The goal is to remove temporary obstacles to make the images better. The goal is not to snap of photo of you standing on your front porch in you bathrobe. 209.149.114.211 (talk) 20:43, 22 February 2016 (UTC)
- Add to this that you can ask Google to remove pictures from their service where you or your house are depicted. --Scicurious (talk) 22:28, 22 February 2016 (UTC)
Windows 7 computer crashed
A week ago my Dell rack mount R5400 crashed. The OS is Windows 7. Every user worst nightmare. I do have an external Toshiba drive with ample memory for backups and I have created system repair disks. The last time I created a repair disk was last October. Last night a friend of mine, a very competent professional software developer and I, decided to try to restore the system. We went through some motions: changed the boot from the system drive to the onboard CD, etc. It seemed everything worked until it began "restoring" and all of a sudden a message appeared "No disk that can be used for recovering the system disk can be found." That was an affront. We saw a list of dates when the system image was created, last time on Feb 15th, just a week ago. There were others, earlier dates as well. What is the problem? Googling showed that it is a common situation facing folks who try to restore their systems. My rackmount computer is rather old although functionally efficient. I doubt I have the original windows restoration disk somewhere and also after so many updates over the years that will be useless. What options do I have?
One web site suggested to contact Microsoft for a bootable disk. But they are now promoting Win10 nonstop, I doubt I will get a lot of help. I will appreciate any suggestions.
Thanks, - Alex --AboutFace 22 (talk) 22:23, 22 February 2016 (UTC)
- The Dell™ Latitude™ E5400 is a laptop, do you mean the Dell™ Precision R5400? There are some suggestions on various sites saying that this problem occurs when the target partition is smaller than the original source partition. The target DISK size must be at least as large as the source DISK, regardless of the size of the PARTITION you're trying to restore. Using Diskpart also seems to be useful. See here. I would ask Dell, not Microsoft. Try this. My experience with Microsoft support is that they are slow. You may be able to boot from USB if you enable legacy usb emulation in the BIOS. Does the computer still have the restore partition? If so press F8 at boot and select Repair The Computer. I also found this and this and that. The Quixotic Potato (talk) 00:47, 23 February 2016 (UTC)
Thank you very much, @the Quixotic Potato. It is plenty. We are aware of Diskpart but it seems to be a command line utility, so the question is how to get there, I mean the cmd prompt. Quite possible your other pointers will lead to solution. It will have to be studied. You are correct, it is R5400, not E5400, a rather big machine. It might take me a couple of days to digest it all. Many thanks, --AboutFace 22 (talk) 14:04, 23 February 2016 (UTC)
- @AboutFace 22: In my experience the Dell Chat Support is quite helpful BTW. Unfortunately it requires a Dell Service Tag or Dell Express Service Code, and I do not have one of those because all my computers are custommade, but maybe you have a Dell Service Tag on your machine. This page explains how to find the service tag (its usually a small sticker on the back of the machine). The Quixotic Potato (talk) 15:50, 23 February 2016 (UTC)
@The Quixotic Potato, I do have service tags. Most of my information is in a database which is now not accessible in this computer but I think the service tag might be also attached to the machine as a sticker. I will explore this route. Thank you very much. --AboutFace 22 (talk) 14:45, 24 February 2016 (UTC)
February 23
Pausing applications
Does anyone know of a way to pause applications on a PC (Win10)? There was a program called uPause a few years ago, but I don't know if it went anywhere. — kwami (talk) 05:01, 23 February 2016 (UTC)
- Well, there is the old keyboard "Pause/Break" key, on the upper right corner of my keyboard. That's mostly an obsolete key left over from mainframe days, but I've occasionally been surprised to find some modern application that obeys it (along with the Scroll Lock key right next to it). StuRat (talk) 05:29, 23 February 2016 (UTC)
- Never thought of that. Thanks. — kwami (talk) 00:37, 24 February 2016 (UTC)
- You can suspend a process with, for example, Process Hacker (right-click on the process and choose "Suspend"). This will prevent it from using the CPU until you resume it. pssuspend does the same thing from the command line. -- BenRG (talk) 07:48, 23 February 2016 (UTC)
- That should work, e.g. if a program can't run because s.t. else is using all the CPU. Thanks! — kwami (talk) 00:37, 24 February 2016 (UTC)
A question about RAM
When computers got 1GB of RAM (Random Access Memory) for the first time? 192.114.23.208 (talk) 09:34, 23 February 2016 (UTC)
- Time computers often claim to have the first home computer to hit 1GB RAM. The problem is that they put out the hardware with an OS that couldn't access 1GB of RAM. Super computers obviously hit that much earlier, but they do not have the same design as average computers, so they tend to measure memory in words, such as "1 million words of memory." You can translate that to bytes (e.g. if a word is 32 bytes, 1 million words is 32MB). Because memory is not used in the same way, that comparison doesn't really make a lot of sense. 209.149.114.211 (talk) 13:34, 23 February 2016 (UTC)
- The 1985 Cray-2 had an unprecedented 2GB of RAM in the biggest configuration, and I think that was a giant and unprecedented leap at the time. The predecessor Cray XMP had no more than 64 MB at the time (it got up to 256 MB with the Extended Architecture, but that was later). --Stephan Schulz (talk) 18:19, 23 February 2016 (UTC)
Computer memory part
How many part of computer memory and how it work adn what is the imortant each of one? By Aanaya, — Preceding unsigned comment added by Scalemodel (talk • contribs) 09:53, 23 February 2016 (UTC)
What is the Windows Alt code for ∼ (not ~)?
I would like the Alt code (e.g. Alt + 0176 for °) for ∼. Note that this is not a tilde ~ for which finding the Alt code is trivial using Google. They appear quite similar in some fonts and distinct in others. Thanks! ----Seans Potato Business 20:40, 23 February 2016 (UTC)
- It doesn't have an Alt code. The Quixotic Potato (talk) 21:23, 23 February 2016 (UTC)
- Interestingly enough, the first symbol ∼ redirects to proportionality (mathematics) while the tilde ~ goes to tilde (characters enlarged to show texture :) Wiktionary [5] has some confusion on the issue, but they are confused as to what is and isn't a tilde too [6]. This link [7] is different from this link [8]. In LaTeX the first character is accessed via \sim, like so: , and in HTML it is '&sim'. I have no idea if any of this helps but it may help future responders. I don't know what determines if a character gets an alt code, but it does seem that a few sources want to consider the "tilde operator" (for lack of a better term) as distinct from a vanilla "tilde". SemanticMantis (talk) 22:08, 23 February 2016 (UTC)
- To directly answer the original question: the use of Alt key plus numeric-keypad only works for ASCII. "∼" is a valid Unicode character, but it is not a valid ASCII character. You cannot enter it using such a keyboard shortcut on Windows.
- There's tons of precedent for the use of a distinct Unicode code point (or a code point in any other text encoding scheme), even if the glyph is very similar or exactly identical. Whether it is a good idea to use esoteric code-points is often debated - particularly when it impacts human-readability or security. (See, for example, homographic spoofing, e.g. confusing O and O). This is a weird problem: semantic information is being scattered between the code-point, the recommended glyph, and the font; however, application-software users can choose the code-point and the font. That means that some users will see identical glyphs; others will see dramatically different glyphs; ... problems abound with this strange entangling of concerns, because your user's default font choice can destroy semantic meaning that you intentionally added to your document!
- So, if you really truthfully care about the difference between ∼ and ~, you should be very careful. Think hard about why you want to use the other character. Think about whether your users expect to distinguish these characters. Think about whether you expect your users to be able to tell the difference - both graphically and semantically. Consider how the characters will behave when the reader is a machine, rather than a person.
- Nimur (talk) 23:11, 23 February 2016 (UTC)
- I read in [a post on Reddit] that ∼ was the appropriate symbol to use as an indication of approximation. In the font Calibri, the tilde ~ appears high and so I want to use ∼ but can find no better alternative than copying and pasting it from that Reddit post or wherever else I may have saved or posted it. --Seans Potato Business 10:55, 24 February 2016 (UTC)
- Windows does actually support entering in Unicode characters using alt, it's just not enabled by default and requires editing the registry or using a tool which does it for you. See Unicode input#In Microsoft Windows for more. Nil Einne (talk) 11:07, 24 February 2016 (UTC)
- Thanks a lot, Nil! :) --Seans Potato Business 14:22, 24 February 2016 (UTC)
- Don't feel bad about cutting and pasting special characters from a list somewhere. That's what I do all the time, myself (even for "ordinary" special characters like '¢'), because in the end it's way easier than remembering what the special keystroke combination is this week. —Steve Summit (talk) 15:57, 24 February 2016 (UTC)
- Also this is an interesting example of eventually getting to a helpful response, starting from the "wrong" question :) SemanticMantis (talk) 16:38, 24 February 2016 (UTC)
- Don't feel bad about cutting and pasting special characters from a list somewhere. That's what I do all the time, myself (even for "ordinary" special characters like '¢'), because in the end it's way easier than remembering what the special keystroke combination is this week. —Steve Summit (talk) 15:57, 24 February 2016 (UTC)
February 24
What does LHA stand for?
LHA is a data compression format, similar to ZIP etc. But what does LHA stand for? I assume the A is for "archive". Equinox (talk) 03:14, 24 February 2016 (UTC)
- "LH" might stand for Lempel-Huffman and "A" for Archive - see LHA (file format). Bubba73 You talkin' to me? 03:35, 24 February 2016 (UTC)
- Based on the history, going backwards.. LHA was preceded by LHarc. LHarc was preceded by LZHUF. LZHUF was LZARI with the algebra replaced with Huffman encoding. So, the HUF stood for Huffman. The LZ is a continuation of all the LZ... names based on Ziv-Lempel method. So, the guess that L=Lempel and H=Huffman is pretty good. I assume that the author didn't mean anything by them. The author took LZHUF and turned it into LZHUFarc, shortening the project to LHarc and then shortening it further to LHA. 209.149.114.211 (talk) 19:09, 24 February 2016 (UTC)
Economic viability of a university using its desktop PCs for distributed computing?
I was wondering, since my university has many, many desktop PCs throughout its various buildings, why doesn't it use them for distributed computing purposes? I know for a fact that they have machines dedicated to intensive computing although I don't really know what they're used for. They have a new "cluster" that they're calling [Eddie 3]. Is it because the energy consumption is inefficient or something else? ----Seans Potato Business 14:29, 24 February 2016 (UTC)
- Maintenance and configuration costs, most likely. Desktop PCs get switched on and off, plugged in and out of networks, and run many different OSes (or, worse, versions of Windows, which are useless for most scientific computing). There are only a few projects that would work well with such a heterogeneous and unstable network. And hardware costs are very low compared to salaries. --Stephan Schulz (talk) 14:36, 24 February 2016 (UTC)
- Right, the cost of a nice super-computing cluster for scientific computation is more about setup and maintenance in many university contexts. For things that do work well in OP's context (and have been known to run on computers in labs and administrative offices at universities), there are things like Folding@home, SETI@home, PrimeGrid, and World Community Grid. SemanticMantis (talk) 16:36, 24 February 2016 (UTC)
- Yeah but my university would have no motivation to pay the electrical costs for computations that are used to publish papers by another university. 129.215.47.59 (talk) 17:25, 24 February 2016 (UTC)
- If your university is any good, it would have an interest in the general progress of science. And it understands the tit-for-tat of much of the scientific process (e.g. I regularly review papers for free, because I want my papers to be reviewed - although there is no formal requirement or dependency). --Stephan Schulz (talk) 17:28, 24 February 2016 (UTC)
- OP, you might also be interested in Berkeley Open Infrastructure for Network Computing which allows a computer to run any of several distributed computing efforts. Dismas|(talk) 16:58, 24 February 2016 (UTC)
- Yeah but my university would have no motivation to pay the electrical costs for computations that are used to publish papers by another university. 129.215.47.59 (talk) 17:25, 24 February 2016 (UTC)
- Right, the cost of a nice super-computing cluster for scientific computation is more about setup and maintenance in many university contexts. For things that do work well in OP's context (and have been known to run on computers in labs and administrative offices at universities), there are things like Folding@home, SETI@home, PrimeGrid, and World Community Grid. SemanticMantis (talk) 16:36, 24 February 2016 (UTC)