Wikipedia:Reference desk/Archives/Computing/2018 November 19
Computing desk | ||
---|---|---|
< November 18 | << Oct | November | Dec >> | November 20 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
November 19
[edit]renaming in bash
[edit]What syntax does bash have for parsing filenames?
Can I write something like
for $file in *.oldext do command $file.oldext >$file.newext done
?
Also, is there a way to strip a prefix (specified by a regexp), if present, from filenames? —Tamfang (talk) 00:57, 19 November 2018 (UTC)
- The thing is that when you write
for file in *.oldext
(note: no $ sign),$file
will successively take the values harry.oldext, joe.oldext, tom.oldext, etc. (based on the files matched). So writing$file.newext
will produce something like harry.oldext.newext, which is not what you want. You have to strip off the .oldext yourself. What I'd write is:
for file in *.oldext do command "$file" `basename "$file" .oldext`.newext done
- (I should note that I'm a sh user; what works in sh will work in bash but may not be the most convenient way. I suspect you it is in this case though.)
- In a more general situation such as "stripping off a prefix if present", you would probably write a sed script to modify the filename in the way you want. For example:
newname=`echo $oldname" | sed 's/something/something else/; s/another thing/ a different thing/'`
- You could use Bash Shell Parameter Expansion.
- Given the filenames harry.oldext joe.oldext tom.oldext:
for i in $(ls); do echo ${i%%.*}; done
- would output:
harry joe tom
- This would change the extension of these files:
for i in $(ls); do mv $i ${i%%.*}.newext; done
- For prefixes:
for i in $(ls); do echo ${i##*.}; done
- outputs everything after the last dot.
- And
for i in $(ls); do echo ${i#*.}; done
- for everything after the first dot. In your case, the last two command will output the same result, but for filenames like 'file.name.ext' it is different.
- Source: https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html My-2-bits (talk) 17:15, 19 November 2018 (UTC)
another iTunes question
[edit]About five years ago my main disk was getting crowded so I transferred my iTunes library to an external disk, using a command within iTunes to copy the content and adjust the references. Now I have a much bigger main disk and would like to move it back, but can't find that command. (I half-believe it was documented in an old edition of The Missing Manual but it's not there now.) —Tamfang (talk) 01:00, 19 November 2018 (UTC)
- [1] may be of help. Another suggestion is to hold down the shift button as iTunes is launched and something will happen to help you move its library. Graeme Bartlett (talk) 22:36, 19 November 2018 (UTC)
![](http://upload.wikimedia.org/wikipedia/en/thumb/f/fb/Yes_check.svg/20px-Yes_check.svg.png)
I copied the iTunes folder to its old place in my home volume; unmounted the external; launched iTunes, which complained that it needs a library; selected the new/old directory. —Tamfang (talk) 08:46, 21 November 2018 (UTC)
Python query issue
[edit]I have recently adopted a tool named toolforge.
1)In that, there is a file named lint_counts.py in which the following line is present:
cur.execute("select count(*) from linter inner join page on page.page_id=linter.linter_page where linter_cat={0} and page.page_namespace={1};".format(lint, ns))
While running that query on Quarry([link]), i am not getting the output.
- That is because the "{0}" and "{1}" are query parameters that need to be filled in. The python query is providing it the "lint" and "ns" args. You cannot run it as is on quarry. SSastry (WMF) (talk) 00:54, 20 November 2018 (UTC)
2)In another file, there is a statement which is used to dump errors into a pickle file which is as follows:
pickle.dump(counts, open("/data/project/fireflytools/www/python/src/data/long_redirects_{}.dat".format(wiki), "wb"))
There were many dump.py files which I was able to see in the folder but I was not able to find the file long_redirects_dump.sh file. So do I have to create that?Adithyak1997 (talk) 16:56, 19 November 2018 (UTC)
The use of animated desktop backgrounds in Windows 10 with Mozilla Firefox
[edit]Can one use animated desktop backgrounds (on a desktop computer) in Windows 10 with Mozilla Firefox? I am getting contradictory information from the Internet about whether or not it is possible. Thanks. Joseph A. Spadaro (talk) 19:01, 19 November 2018 (UTC)
- What does Mozilla Firefox have to do with animated backgrounds in Windows 10? Ruslik_Zero 20:38, 19 November 2018 (UTC)
- I am trying to get animated backgrounds on my computer. I read that it will not work with Mozilla Firefox. My computer has Windows 10, which I thought might be relevant to my question. Joseph A. Spadaro (talk) 06:34, 20 November 2018 (UTC)
- He might be confusing Bing (which has background images) and Firefox (which doesn't). He might even be confusing images which change daily (which Bing has) with actual animated images (which I believe that Bing doesn't have). The following answer assumes that he actually wants the "desktop background" (the wallpaper) to be animated.
- If only there existed some sort of "search engine" website where on could type in a phrase like [ animated desktop background in Windows 10 ] (or you could try "wallpaper" or "background") and get the answer to your question. I bet that if somebody made a website like that they would make a lot of money... I'm just saying.
- If somebody did that they would find web pages like
- and
- and
- Hey ... @Guy Macon: ... are you implying that I don't know how to do a Google search? Is that the implication? Yeah, obviously, I did one. Or, several. And, in some, they say that Firefox won't work. Others say it will. So, I wanted to see if anyone knew for sure. Before I started messing up my PC. So, once again, are you implying that I don't know how to do a Google search? Let me know. Thanks. Joseph A. Spadaro (talk) 06:36, 20 November 2018 (UTC)
- Please don't ping me. When I make a comment I watchlist the page. Also, please don't get your knickers in a wad. When someone asks a question we know nothing about how much they already know. All I know is that when I did a google search I instantly found answers to the question you asked.
- Please post a link to a website that "says that Firefox won't work". Did someone actually say that an animated wallpaper stops Firefox from working? Where?
- Here is some free advice. Anyone who worries about "messing up my PC" needs to stop what they are doing and immediately figure out how to do regular backups. If I "mess up my PC" is simply restore the last known good version from my backups. --Guy Macon (talk) 08:11, 20 November 2018 (UTC)
- Look, let me offer a peace pipe and start over. Not sure how and why this got so bitter so fast. I asked a pretty innocent and innocuous question. I found your reply -- actually, both of your replies -- a bit sharp (and condescending). Of course, you don't know how much "behind the scenes" work I did or did not do. I think the correct response would be: "Hey, Joe, tell us what you did so far, so that we can help you solve the problem" ... as opposed to ... assuming that the questioner does not know how to do a simple and basic (and obvious) Google search. Another alternative, if the question offends you in some way, is to not reply at all.
- All that being said ... Yes, I do back-ups constantly. But, when my PC gets "messed up", it is a huge pain in the neck to get it back to normal. I am sure you know this. For example, when you have to reload the operating system, you have to then reload all your programs, set up all your passwords, set up all your settings, etc., etc., etc. It's a nightmare that takes forever. So -- backed-up data or not -- I do not want to take the chance of "messing up" my PC and going through all of that time-consuming activity. Not to mention, spending (i.e., wasting) 800 hours on the phone with the Dell Support team; and/or waiting on hold for the Dell Support team; and/or being transferred 100 times by the Dell Support team; etc., etc., etc. Also, I have had problems with the "Restore" function in the past. And I avoid that like the plague, as well.
- I will dig around to find (or, rather, re-find) the articles about Firefox not supporting "animated backgrounds". Although -- per your advice above -- I am sure that you (or I, or anyone else) could do a Google search with the proper search words. I will get that and post it here, later. Thanks. Joseph A. Spadaro (talk) 14:30, 20 November 2018 (UTC)
- I'm still not clear what you mean by "background". I think perhaps you mean theme and others are assuming you mean wallpaper. It is correct to say that Firefox no longer supports animated themes.--Shantavira|feed me 18:03, 20 November 2018 (UTC)
- In Windows 10, it is called "background". When I turn on my (desktop) computer, it is the picture that is on my monitor. One can change the picture. Or keep the background as a solid color, etc. This website, for example, provides tons of backgrounds for a computer owner to change his desktop background to: [2]. At that particular website, they are called "wallpapers" or "backgrounds". In Windows 10, they are called "backgrounds". Thanks. Joseph A. Spadaro (talk) 07:48, 21 November 2018 (UTC)
- Thanks for clarifying. That's wallpaper. Firefox is a web browser. I don't see how the wallpaper you happen to be using has any bearing on your use of a browser. It should be completely irrelevant. Have you actually tried using animated wallpaper and Firefox? I can't think of any reason why there should be a problem, although animation will use up more resources and possibly slow you down a bit.--Shantavira|feed me 11:12, 21 November 2018 (UTC)
- Have to agree with Shantavira et al that the reason you're getting responses like this is because your question is so confusing. If you just want to change you Windows 10 OS background to be animated, this isn't something directly supported since Microsoft abandoned DreamScene but there a hell of a lot of third party programs which add this feature. Windows 10 only supports images, solid colours and slide shows. Helpful links to third party programs have already been provided but in any case a simple search will also find them. I don't know if we can provide much help on these programs unless you tell us some problem you are having with them. While sometimes questioners don't provide enough find to help us diagnose their problems, whatever problems you are having or may have with whatever program you choose, it's fairly unlikely your browser will be of interest to us. Instead, tell us what program you're using (including the version) and what error message or signs of a problem you have and maybe some hardware and other key details like GPU, precise version of Windows, what animated background you're choosing if you got that far etc. Likewise, if you have some problem with Firefox, you can ask for help here, but there is almost no chance this problem will be "it made my animated background stop working" or "it doesn't work and when I disabled my animated background on Windows it does" since there's no reason to think these would happen since they're almost completely unrelated issues. It's like asking "will Firefox cause Excel to start start performing incorrect calculations" or even "will storing vodka in my fridge cause the thermostat to malfunction"? Nil Einne (talk) 12:50, 21 November 2018 (UTC)
- P.S. I'm assuming you just mean I'm going to install or have installed Firefox. As discussion in Removal of Internet Explorer, IE provided some key components that a lot of stuff assumed was there. So if you actually took steps to remove these components rather than simply hide the IE icon (or even delete the exe), you can break stuff unexpectedly. I don't personally expect programs which provide animated backgrounds to use these components and I think things have changed somewhat nowadays anyway since a lot of stuff uses WebKit or Blink or other third party FLOSS components especially if it wants to be cross platform which admittedly doesn't apply to animated background programs. Plus I'm not even sure if anyone bothered to make a tool to try and completely remove IE from Windows 10. Still, in that case you probably should mention it although it's a distinctly different case from simply having and using Firefox. Nil Einne (talk) 13:09, 21 November 2018 (UTC)
- Thanks for clarifying. That's wallpaper. Firefox is a web browser. I don't see how the wallpaper you happen to be using has any bearing on your use of a browser. It should be completely irrelevant. Have you actually tried using animated wallpaper and Firefox? I can't think of any reason why there should be a problem, although animation will use up more resources and possibly slow you down a bit.--Shantavira|feed me 11:12, 21 November 2018 (UTC)
- In Windows 10, it is called "background". When I turn on my (desktop) computer, it is the picture that is on my monitor. One can change the picture. Or keep the background as a solid color, etc. This website, for example, provides tons of backgrounds for a computer owner to change his desktop background to: [2]. At that particular website, they are called "wallpapers" or "backgrounds". In Windows 10, they are called "backgrounds". Thanks. Joseph A. Spadaro (talk) 07:48, 21 November 2018 (UTC)
- @Nil Einne: Thanks. Yes, I understood everything that you wrote. Thanks. And, yes, I did find all of that information on the Internet, through some simple searching. (This was all before I posted my question here.) When I did my Google searches, I ALSO came up with some information that said something to the effect of "you can't do animated wallpapers if you are using Firefox" (or some such wording). Perhaps it was "Firefox will not support animated wallpapers" (or some such). In fact, I believe that an editor up above made a similar comment. So, before I went through the hassle of installing some third-party software (and, paying for it, by the way), I wanted to see if I could actually use it with Firefox (since some internet information said that I cannot). If not, I did not want to "mess up" my computer; I did not want to spend money on a program that I can't use (and go through the nightmare of trying to get a refund); etc., etc., etc. I wanted to avoid all of these hassles. Hence, I posted my question. I will search again and see if I can find those websites that said "animated wallpaper does not work on Firefox". And -- yeah -- it did not make sense to me, either. I was thinking: "what does Firefox have to do with a program that animates wallpaper?" So, even more confusion for me. So, again, hence I posted my question here. I will try to find that internet info. Thanks. P.S. I pretty much always use (and have always used) Firefox and only Firefox; I do not have to install Firefox. Joseph A. Spadaro (talk) 13:53, 22 November 2018 (UTC)
Re:
- "When my PC gets "messed up", it is a huge pain in the neck to get it back to normal. I am sure you know this. For example, when you have to reload the operating system, you have to then reload all your programs, set up all your passwords, set up all your settings, etc., etc., etc. It's a nightmare that takes forever":
That is a classic sign of a poor backup strategy. When I mess up my Windows PC, I open my backup folder, click on the latest one, click on "restore", and take a short break while it restores. Worst case I do a clean install because it won't boot then do a full restore.
My Linux box and my Windows box run backups every night, and I often trigger a backup to run while I take a lunch break.
I also save my work several times per hour to a USB thumb drive, which takes care of the "losing everything I did since last night's backup" problem.
My advice to Joseph A. Spadaro is this: set up a proper backup system, do a test restore to give yourself confidence that your back system is working, do an extra backup before adding new software, and never again have to worry about "messing up your PC".
And quit acting as if people are deliberately insulting you when they try to help you. --Guy Macon (talk) 14:40, 21 November 2018 (UTC)
- @Guy Macon: Thanks. This is how I do a back-up. I purchased an "external hard drive". Every so often (let's just say, once per day), I plug the external hard drive into the USB port of my desktop computer. I do a "copy and paste". I have a folder on my desktop that is entitled "All Of My Computer Files" (or some such). I click on that folder; I hit "copy and paste". And I paste that entire folder into my external hard drive. Now, I have two folders named "All Of My Computer Files". One is on my desktop computer. And one is in my external hard drive. I unplug the external hard drive. And I am done. If something ever happens to my computer, I still have all of my files -- they are all on my external hard drive. This is what I was told to do, and this is what I have been doing for umpteen years. Am I doing something wrong? Thanks for your help. Joseph A. Spadaro (talk) 14:01, 22 November 2018 (UTC)
- What you are doing is good -- it backs up the most important things -- but with a minor modification you can also back up everything -- installed programs, saved passwords, saved bookmarks, windows updates, progress on any games you play, even the position of the icons on your desktop. To do this use the Microsoft program "Backup and Restore (Windows 7)" that comes with every copy of Windows 10. Don't let the name fool you; it works great in Windows 10. You can get to it a couple of different ways.
- Method #1: Start button --> Settings --> Backup --> Go to Backup and Restore (Windows 7)
- Method #2: Search box (next to Start on the taskbar) type control panel, Select Control Panel --> Backup and Restore (Windows 7) (third item under System and Security)
- You want to create a system restore disk (helps you recover if Win 10 won't start) and then do a system image of your entire hard drive. It takes a while to save everything, so start it and let it run overnight.
- Here are some tutorials:
- www.makeuseof.com/tag/set-windows-7-backup-restore-feature/
- recoverit.wondershare.com/data-backup/use-windows-7-backup-and-restore.html
- Thanks. So, it seems that you are saying that a person should save all their data and files (which I am doing), plus all of their programs and settings, etc. (which I am not doing). Right? It seems like I should be "taking a snapshot" of my entire hard drive (to get a "complete" back-up). Right? I have not yet read those tutorials. But, two quick questions. (1) Do I do this periodically (say, every day or every week)? Or just the first time only, once and only once? And (2) Where do I "save" all of this? Onto my external hard drive, also? Or somewhere else? Thanks. Joseph A. Spadaro (talk) 16:36, 22 November 2018 (UTC)
- Somewhere, I have the CDs that I created as an initial backup of this laptop eleven years ago. I've never needed them. The backup of the whole hard drive would now be many gigabytes, and would take a long time to create, even on a fast external drive, so I've never bothered to do this, and have never needed such a backup. I agree with Guy, though, that it is good practice, especially if you are regularly downloading software that might mess up your registry or even infect your hard drive. I do back up all of my files to three or four different places (DVD RW, memory stick, and external hard drives). Different people have different policies for backup. Dbfirs 22:05, 22 November 2018 (UTC)