batch file to Rename file by text AND Current Folder name
Add folder name to beginning of filename
How do I rename a directory via the command line? I have got the directory /home/user/oldname and I want to rename it to /home/user/newname. How can I do this in a terminal? Looking for the actual reason of refraction explained precisely without analogies Number theory proof mod p For a given prime $p$ and integer $k$,  $k∈&lt;1, p-1&gt;$ $S(k)$ is defined as a sum of remainders of $k, k^2, k^3, ..., k^{p-1}$ when divided by $p$. Prove that $S(k)=\frac{1}{2}p(p-1)$ is true for an odd number of different k. I managed to prove that $S(p-1)=\frac{1}{2}p(p-1)$ but can't see how to do it further. How do I remove a file I accidentally created named $file? I was working on a shell script and I accidentally created a file with the variable as its name. Now I have $file in my ls output, and cannot remove it.  What can I do? Detecting EOF in C++ from a file redirected to STDIN I am stuck in a question where energy conservation is failing and momentum conservation is correct. I think I might be doing something wrong, that's why I'm asking this question. The problem is as follows:     A bullet of mass $25\,g$ is fired horizontally into a ballistic pendulum of mass $5.0\,kg$ and gets embedded in it. If the centre of pendulum rises by a distance of $10\,cm$, find the speed of the bullet.   (H.C. Verma, Centre of Mass, Q47)     Let the mass of the bullet be $m=25\,g$. Let the mass of the pendulum be $M=5\,kg$. Let the peak height be $h=0.1\,m$. Let the initial and final velocities be $u$ and $v$ respectively.  Method 1: (Momentum Conservation)  $$mu=(M+m)v \implies v=\frac{mu}{M+m}\\ \text{Also, }\frac{1}{2}(M+m)v^2=(M+m)gh\\ \implies u^2=2\biggl(\frac{M+m}{m}\biggr)^2gh\\ \implies u=201\sqrt2 \text{ m/s}$$  Method 2: (Energy Conservation)  Since both the masses move together after the collision, and because the velocity at highest point is null, therefore: $$\frac{1}{2}mu^2=\frac{1}{2}(M+m)v^2=(M+m)gh\\ \implies u^2=2gh\biggl(\frac{M+m}{m}\biggr) \implies u=\sqrt{402}$$    To summarize myself, I am curious about the following: Why do the results differ? Shouldn't the energy be conserved as well as the momentum? Since it should be, then what is the flaw in my calculations? How are Python's Built In Dictionaries Implemented? Does anyone know how the built in dictionary type for python is implemented?  My understanding is that it is some sort of hash table, but I haven't been able to find any sort of definitive answer. How do you distinguish between magic effects that bypass immunity and those that don't? This question was triggered by .  Basically, it goes like this: If you have a weapon with a certain magical effect, let's say the minor property unbreakable (can not be broken, requires special means) or temperate (no harm in temperatures between -20 to 120 F), it can bypass the immunity of something like a Werewolf because it is magical instead of mundane. This goes for any minor property because those properties are under the Magic Items portion of the DMG on pg.143.  How does this differ from a pair of gauntlets with the exact same effect being used as an improvised weapon (emphasis added for clarity) from dealing damage in the same manner to the same Werewolf? Or something that's clearly not a weapon like a Shield of Missile Snaring being used to bash an opponent? I'm trying to do a volumetric light on Cycles, and I've followed tutorials, but nothing has worked yet. How can I make a proper volumetric light in Blender, like the following one?    But to leave the light in the middle, like, almost a star, is this possible? I'm at the point to use an image plane besides the light which would be better... I need to use it moving the camera.  I'm actually trying to do this because I want to simulate the brightness of the Sun.  I tried the effect, but it still gave me an error: How do I set up a global locale for the computer?  I have recently installed Kubuntu 14.04LTS in english but since I am in Spain, I chose Spain as a country and then changed locale options so that I get all country specific configuration such as digit grouping, decimal separator, date format, etc. I also added the spanish language.  Now all applications complain that locale is wrong. check-language-support tells me I'm using en_ES.UTF-8 as system's locale, and that locale is indeed wrong, there is no locale for english language in Spain.  I tried using Kubuntu's country/region &amp; language settings but it doesn't fix it. I tried using export LANG=en_GB.UTF-8 and export LC_ALL=en_GB.UTF-8 and then sudo dpkg-reconfigure locales and that caused check-language-support to say that I now have a correct configuration but if it is, it's only in that konsole session. This problem also prevents konsole from showing unicode characters and I cannot use dead keys or enter any 'international character' such as ñ or ç (those work on other applications such as Firefox, that I'm using to post this question).  So the question is: How do I set up a global locale for the computer?  This is not a bug report, I will probably reinstall my computer eventually if I can't fix it. But I really want to know how I can perform this REALLY basic task.  Thank you.  $ check-language-support perl: warning: Setting locale failed. perl: warning: Please check that your locale settings:         LANGUAGE = "en:es:en",         LC_ALL = (unset),         LC_PAPER = "en_ES.UTF-8",         LC_ADDRESS = "en_ES.UTF-8",         LC_MONETARY = "en_ES.UTF-8",         LC_NUMERIC = "en_ES.UTF-8",         LC_TELEPHONE = "en_ES.UTF-8",         LC_IDENTIFICATION = "en_ES.UTF-8",         LC_MEASUREMENT = "en_ES.UTF-8",         LC_TIME = "en_ES.UTF-8",         LC_NAME = "en_ES.UTF-8",         LANG = "en_ES.UTF-8"     are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_COLLATE to default locale: No such file or directory hunspell-en-ca libreoffice-help-en-gb libreoffice-l10n-en-gb libreoffice-l10n-en-za mythes-en-au wspanish  $ cat /etc/default/locale LANG="en_US.UTF-8" LC_NUMERIC="es_ES.UTF-8" LC_TIME="es_ES.UTF-8" LC_MONETARY="es_ES.UTF-8" LC_PAPER="es_ES.UTF-8" LC_NAME="es_ES.UTF-8" LC_ADDRESS="es_ES.UTF-8" LC_TELEPHONE="es_ES.UTF-8" LC_MEASUREMENT="es_ES.UTF-8" LC_IDENTIFICATION="es_ES.UTF-8"   $ locale locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory LANG=en_ES.UTF-8 LANGUAGE=en:es:en LC_CTYPE="en_ES.UTF-8" LC_NUMERIC=en_ES.UTF-8 LC_TIME=en_ES.UTF-8 LC_COLLATE="en_ES.UTF-8" LC_MONETARY=en_ES.UTF-8 LC_MESSAGES="en_ES.UTF-8" LC_PAPER=en_ES.UTF-8 LC_NAME=en_ES.UTF-8 LC_ADDRESS=en_ES.UTF-8 LC_TELEPHONE=en_ES.UTF-8 LC_MEASUREMENT=en_ES.UTF-8 LC_IDENTIFICATION=en_ES.UTF-8 LC_ALL= $ update-locale perl: warning: Setting locale failed. perl: warning: Please check that your locale settings:         LANGUAGE = "en:es:en",         LC_ALL = (unset),         LC_PAPER = "en_ES.UTF-8",         LC_ADDRESS = "en_ES.UTF-8",         LC_MONETARY = "en_ES.UTF-8",         LC_NUMERIC = "en_ES.UTF-8",         LC_TELEPHONE = "en_ES.UTF-8",         LC_IDENTIFICATION = "en_ES.UTF-8",         LC_MEASUREMENT = "en_ES.UTF-8",         LC_TIME = "en_ES.UTF-8",         LC_NAME = "en_ES.UTF-8",         LANG = "en_ES.UTF-8"     are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). When signing in with Google (OAuth), it shows a list of accounts it already knows about. How can I remove some accounts from this list?    I know I can nuke all of them by deleting all cookies, but I'd prefer to remove one account that I don't want there, rather than all of them.  There used to be an ability to edit this list in the older version of this screen, but in 2018 redesign Google has removed [×] buttons next to the accounts. I need to clip a vector layer to the extent of a raster. It has to be very precise that's why I would not want to draw a polygon myself (and clip the two polygons). There seem to be some ways to clip a raster to a polygon but I have difficulties to find a solution to clip a polygon to a raster. I already tried to create a polygon out of my raster several times in ArcGIS and R, so I could clip the result. But every time it crashes because the raster is to big. There must be a simple way to solve this, and somehow I can just not see it at the moment.  How can I do this using GDAL? What are the “spam” and “rude or abusive” (offensive) flags, and how do they work? When flagging, there are two special case options: spam and rude or abusive.   What is spam, and when should I flag content as such? What is considered offensive, rude or abusive content? How does the spam flag differ from the rude or abusive flag? What is the effect of these special flags? When are these flags removed? i want to write a device driver but not able to find the header file can someone please help me find them?Also if someone can point out some important site links that would be really appreciated If $A + A^t = 2I$ then $\det(A) \geq 1$ Alright, I think we all agree that what happens with the following code is undefined, depending on what is passed,  void deleteForMe(int* pointer) {      delete[] pointer; }   The pointer could be all sorts of different things, and so performing an unconditional delete[] on it is undefined. However, let's assume that we are indeed passing an array pointer,  int main() {      int* arr = new int[5];      deleteForMe(arr);      return 0; }   My question is, in this case where the pointer is an array, who is it that knows this? I mean, from the language/compiler's point of view, it has no idea whether or not arr is an array pointer versus a pointer to a single int. Heck, it doesn't even know whether arr was dynamically created. Yet, if I do the following instead,  int main() {      int* num = new int(1);      deleteForMe(num);      return 0; }   The OS is smart enough to only delete one int and not go on some type of 'killing spree' by deleting the rest of the memory beyond that point (contrast that with strlen and a non-\0-terminated string -- it will keep going until it hits 0).  So whose job is it to remember these things? Does the OS keep some type of record in the background? (I mean, I realise that I started this post by saying that what happens is undefined, but the fact is, the 'killing spree' scenario doesn't happen, so therefore in the practical world someone is remembering.) Requires installation of untrusted packages? How to run scripts every 5 seconds? What caused the apocalypse in the Hunger Games? So the stories of the Hunger Games are set in , a post-apocalyptic society situated in North America. Is there anything to explain what caused the Apocalypse? Whether from the main books, any extra material or interviews? (No fanfic please.)  As well as the cause, is there any indication of when the apocalypse happened? And how long after the apocalypse are the events of the Hunger Games? I would like to be able to transpose a tabular(x) table like in the following example. It is not necessary to be completely automated, but I don't want to change the data order, which is a painful and stupid. By "not completely automated" I mean that e.g. the headers can be done seperately etc.  Let's see the MWE:  \documentclass{article}  \usepackage{booktabs} \def\Midrule{\midrule[\heavyrulewidth]}  \begin{document}  \centering  \begin{tabular}{*6c}\toprule \bfseries Name &amp; Alice &amp; Bob &amp; Chuck &amp; Dave &amp; Eve\\\Midrule \bfseries Sex &amp; Female &amp; Male &amp; Male &amp; Male &amp; Female\\\midrule \bfseries Age &amp; 18 &amp; 19 &amp; 20 &amp; 21 &amp; 22\\\bottomrule \end{tabular}  \bigskip  Which I want to look like  \bigskip  \begin{tabular}{*3c}\toprule \bfseries Name &amp; \bfseries Sex &amp; \bfseries Age\\\Midrule Alice &amp; Female &amp; 18\\\midrule Bob &amp; Male &amp; 19\\\midrule Chuck &amp; Male &amp; 20\\\midrule Dave &amp; Male &amp; 21\\\midrule Eve &amp; Female &amp; 22\\\bottomrule \end{tabular}   \end{document}     Note: I know that , but I would like to get it without expl3 (mostly because people would might use my code quite often have an old LaTeX installed and I cannot be convincing them to change this).