I'm working on a tool in maya where at some point, the user can enter a comment on the textField. This comment will later be used as part of the filename that's gonna be saved. I work in France so the user might use some accentuated characters as "é" or "à". What i would love would be to just translate them to their non accentuated corresponding character. However I realise this is quite tricky so I would be ok with juste detecting them so I can issue a warning message to the user. I don't want to just strip the incriminated letters as it might result on the comment to be incomprensible. I know they're some similar questions around here, but they're all on other languages I don't know/understand (such as C++ or php).  Here's what I found so far around the web :    import re comment = 'something written with some french words and numbers' if re.match(r'^[A-Za-z0-9_]+$', text):     # issue a warning for the user   This first solution doesn't work because it considers accentuated characters as acceptable.    I found this :  ENGLISH_CHARS = re.compile('[^\W_]', re.IGNORECASE) ALL_CHARS = re.compile('[^\W_]', re.IGNORECASE | re.UNICODE)  assert len(ENGLISH_CHARS.findall('_àÖÎ_')) == 0 assert len(ALL_CHARS.findall('_àÖÎ_')) == 3   which I thought about using like this :   ENGLISH_CHARS = re.compile('[^\W_]', re.IGNORECASE) if len(ENGLISH_CHARS .findall(comment)) != len(comment):     # issue a warning for the user   but it only seems to work if the string is encapsulated within underscores.  I'm really sorry if this a duplicate of something I haven't found or understood, but it's been driving me nuts.
I have a Unicode string in Python, and I would like to remove all the accents (diacritics). I found on the web an elegant way to do this (in Java):  convert the Unicode string to its long normalized form (with a separate character for letters and diacritics) remove all the characters whose Unicode type is &quot;diacritic&quot;.  Do I need to install a library such as pyICU or is this possible with just the Python standard library?  And what about python 3? Important note: I would like to avoid code with an explicit mapping from accented characters to their non-accented counterpart.
Why doesn't the Related question list show that questions are closed? I saw a question on Meta that was obviously going to be a duplicate:        And indeed, looking at the "Related" questions list for that question showed a number of duplicates:    Being the good citizen I am, I tried to vote to close (technically Flag as duplicate as I've not got the rep here to vote to close) it as an Exact Duplicate only to find myself falling into a rabbit hole of Closed, Duplicate questions. Is there any way to flag a closed question as such in the Related list?  Mostly because the first one I picked was closed as a duplicate of the second one, which was closed as a duplicate of the one that is now listed as the duplicate/linked answer.   Edit to respond to comment:  I take the point about "not voting to close on title alone", and normally wouldn't, however as the questions had identical titles, and it's pretty clear what they should be asking, I clicked the first one:    which lead to:  which leads to:  - but I'd got bored following links and didn't check that one as the first two were identical, so assumed this was too and didn't want to see how deep the rabbit hole led.   In the related list, there's only one other question in there that is an exact duplicate, but hasn't (currently) been closed as such which is:      Reasoning for highlighting closed questions:  The "Questions with similar titles" does display the closed titles when asking the question, so it should be fairly possible to include.  If there are clearly duplicate titles, then as a reader/reviewer would be helpful to know which ones are already closed as duplicates so you can either:   Use the remaining open questions to focus on which of those is the canonical answer to close this with. Use the closed questions to find the canonical answer (which failed for me with my route of clicks). Possible Duplicate:          I am trying to troubleshoot my webcam and make it work with skype.  One workaround that is often suggested is to LD_PRELOAD the v4l1compat.so file. But when trying that, I get an error message:  fdr@maggie:~$ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libv4l/v4l1compat.so skype ERROR: ld.so: object '/usr/lib/x86_64-linux-gnu/libv4l/v4l1compat.so' from LD_PRELOAD cannot be preloaded: ignored.   and I am rather sure the path is correct:  fdr@maggie:~$ ls /usr/lib/x86_64-linux-gnu/libv4l/v4l1compat.so  /usr/lib/x86_64-linux-gnu/libv4l/v4l1compat.so   and the kernel and skype have matching architecture:  fdr@maggie:~$ uname -a Linux maggie 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux fdr@maggie:~$ dpkg -s skype | grep Architecture Architecture: amd64   So my question is:  What is causing the "... from LD_PRELOAD cannot be preloaded: ignored" error message? No room for a new \dimen Details on how the Yearling badge works Jawa asked me this  and I didn't know the answer. So I present it to the meta SO community:     [To get the Yearling badge] Do you need to earn the 200 rep within that one year or is it enough to get 200 at some point after being a member for a year? And does 'a year' mean the very first 12 months or the last (sliding window of) 12 months?    I would assume that if you hit 200 reputation after you've already been around for a year, then you would get the Yearling badge. But I don't know. Author information column wise I am using authblk package and I want to achieve following output using this package. Which preposition should follow "guide" here, "on," "to," or "for"? The following link includes a guide ___________ how to use it.  How should I fill in the blank, on, for, or about? In first.bat, I use  var5=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\ CALL scripts\vc64.bat %var5%   And in scripts\vc64.bat, I use  SET var6=%1vcvarsx86_amd64.bat CALL %var6%   But I get : 'C:\Programvcvarsx86_amd64.bat' is not internal or external command..... error.  If the path assigned to var5 has no space, then it is fine.  I tried several combination of quotations and %1vcvarsx86_amd64.bat, but no change.  How do I make it works with path with spaces?    To be more precise, suppose it is C:\a b c\  In first.bat:       SET var6=C:\a b c\  =====&gt;  '"C:\avcvarsx86_amd64.bat"' is not.....`      SET var6="C:\a b c\" ====&gt;   There should not be a b      SET var6=C:\a\ b\ c\ ====&gt;    Can't find the specified path      SET var6=C:\a b c\ + Using "%var6" ====&gt; There should not be a b     Update: Here is an example. Change a b to ab works.  call.bat in C:\  @ECHO OFF  SET var5=C:\a b\ CALL C:\1.bat "%var5%"  pause   1.bat in C:\  @ECHO OFF  SET var6=%~1Test.bat CALL %var6%  RMDIR /S C:\NoWorry   Test.bat in C:\a b Test.bat in C:\ab  @ECHO OFF  RMDIR /S C:\ThereIsNoSuchFolder Why is the CDF of a sample uniformly distributed I read  that given a sample $ X_1,X_2,...,X_n $ from a continuous distribution with cdf $ F_X $, the sample corresponding to $ U_i = F_X(X_i) $ follows a standard uniform distribution.  I have verified this using qualitative simulations in Python, and I was easily able to verify the relationship.  import matplotlib.pyplot as plt import scipy.stats  xs = scipy.stats.norm.rvs(5, 2, 10000)  fig, axes = plt.subplots(1, 2, figsize=(9, 3)) axes[0].hist(xs, bins=50) axes[0].set_title("Samples") axes[1].hist(     scipy.stats.norm.cdf(xs, 5, 2),     bins=50 ) axes[1].set_title("CDF(samples)")   Resulting in the following plot:    I am unable to grasp why this happens. I assume it has to do with the definition of the CDF and it's relationship to the PDF, but I am missing something...  I would appreciate it if someone could point me to some reading on the subject or help me get some intuition on the subject.  EDIT: The CDF looks like this: How do I concatenate const/literal strings in C? I'm working in C, and I have to concatenate a few things.  Right now I have this:  message = strcat("TEXT ", var);  message2 = strcat(strcat("TEXT ", foo), strcat(" TEXT ", bar));   Now if you have experience in C I'm sure you realize that this gives you a segmentation fault when you try to run it. So how do I work around that? Shorten title on each beamer slide In a beamer presentation the title is long but ok for the first slide. The problem is that when the title appears below on each slide it is very long and I would like to use here some sort of running or shorter title, how can this be done? How do you reverse a string in place in C or C++? How do you write a case insensitive query for both MySQL and Postgres? I'm running a MySQL database locally for development, but deploying to Heroku which uses Postgres. Heroku handles almost everything, but my case-insensitive Like statements become case sensitive. I could use iLike statements, but my local MySQL database can't handle that.  What is the best way to write a case insensitive query that is compatible with both MySQL and Postgres? Or do I need to write separate Like and iLike statements depending on the DB my app is talking to? How do I make the player name show up on a /tellraw command? So I am currently making a minecraft custom map (for 1.9). I want to make the player "say" something using /tellraw commands. I did figure out how to make the player name come up using /say commands, but still have no idea how to do it using the /tellraw command.  How do I do that? The "equal angles" law of refection on a flat mirror is a macroscopic phenomenon. To put it in anthropomorphic terms, how do individual photons know the orientation of the mirror so as to bounce off in the correct direction? I watched a video on youtube (I lost it) that shows rendering parts of the screen to combine them in a single image. I followed it to the point where I couldn't adjust the dimensions under the "set render border", but in the video he had dimensions and I have nothing.  I need it for 4K and 8K renders (without anti-aliasing), but my laptop can't handle it all at once and I don't have time for a 4 hour waiting so this feature will work perfectly.  I'm using version 2.76 so is it moved to another place or removed. Maybe a bug? Trying to overwrite ... which is different from other instances of package I tried to upgrade Intel graphics in ubuntu 16.10 using the official installer. The last stage of unpacking libcairo2 produces an error (see figure).  When I do upgrade I get the same error also:   Preparing to unpack .../0-libcairo2_1.15.2-0intel1_amd64.deb ... Unpacking libcairo2:amd64 (1.15.2-0intel1) over (1.15.2-0intel1) ... dpkg: error processing archive /tmp/apt-dpkg-install-aYhdFd/0 libcairo2_1.15.2-0intel1_amd64.deb (--unpack): trying to overwrite shared '/usr/share/doc/libcairo2/changelog.Debian.gz', which is different from other instances of package libcairo2:amd64 Preparing to unpack .../1-libcairo2_1.15.2-0intel1_i386.deb ... Unpacking libcairo2:i386 (1.15.2-0intel1) over (1.15.2-0intel1) ... dpkg: error processing archive /tmp/apt-dpkg-install-aYhdFd/1-libcairo2_1.15.2-0intel1_i386.deb (--unpack): trying to overwrite shared '/usr/share/doc/libcairo2/changelog.Debian.gz', which is different from other instances of package libcairo2:i386 Errors were encountered while processing: /tmp/apt-dpkg-install-aYhdFd/0-libcairo2_1.15.2-0intel1_amd64.deb /tmp/apt-dpkg-install-aYhdFd/1-libcairo2_1.15.2-0intel1_i386.deb E: Sub-process /usr/bin/dpkg returned an error code (1)   It seems that there is a conflict in thelibcairo releases; if yes, how to resolve it ? Why Objective-C,PHP do not support method overloading? Is there a test for the different styles within maths mode?  What I really want is to be able to save the current style to reinvoke it later on, but a \if along the lines of \ifmmode would work just as well.  In the specific example, I want to measure how big something will be when displayed in maths mode, so I do:  \settoheight{\mathheight}{some bit of maths}   except that it complains because the some bit of maths gets put in a box and measured, and the box doesn't know that it's maths.  So instead I put:  \settoheight{\mathheight}{\(some bit of maths\)}   except that then I get the wrong answer if this is used in displayed maths.  So ideally, I want:  \ifdisplaystyle  \let\currentstyle\displaystyle \else  \iftextstyle   \let\currentstyle\textstyle  ...  \fi \fi \settoheight{\mathheight}{\(\currentstyle some bit of maths\)}   and then I'll be happy.  Is there such a test?    Okay, so \mathchoice is clearly the way to go (thanks Martin!), but its behaviour is a little odd and since I want to use it to define a macro depending on which mode I'm in, this oddity is quite important.  Here's the code:  \newcommand{\mathtest}{% \gdef\name{a}% \mathchoice{% \name \gdef\name{b}% }{% \name \gdef\name{c}% }{% \name \gdef\name{d}% }{% \name \gdef\name{e}% }% \name}  \[ \mathtest \]   If \mathchoice behaved like \if, this ought to print ab.  But it prints ae.  All the options to \mathchoice get processed (which makes me wonder a bit how it works, but that's by-the-by).  So, is there an obvious way to make \mathchoice behave a little more like \if? What is the maximum size of a web browser's cookie's key? What is the maximum size of a web browser's cookie's key?  I know the maximum size of a cookie is 4KB, but does the key have a limitation as well? I have a 13" MBP late 2009, 2.53 GHz, 4 GB RAM, and on OS X 10.8.3. As soon as I boot up the fans start going at the highest rpm and like I mentioned the kernel_task is always at around 90% when no apps are being run. I read somewhere that I should try safe boot and see the effect but there is none. Any ideas as to what is causing it?  Thanks