I add Content-Disposition header to generate filename for download.   self.response.headers['Content-Type'] = 'text/xml' self.response.headers['Content-Disposition'] = 'attachment; filename=' + os.path.splitext(filename)[0] + '.nfo'   It works well with English characters, but when the filename contains Russian characters (for ex., filename = u'Some video file (2014).avi') it fails. I tried different combinations of encode('utf-8') and urllib.quote, but it doesn't help.
Web applications that want to force a resource to be downloaded rather than directly rendered in a Web browser issue a Content-Disposition header in the HTTP response of the form:  Content-Disposition: attachment; filename=FILENAME  The filename parameter can be used to suggest a name for the file into which the resource is downloaded by the browser.  (Content-Disposition), however, states in  (The Filename Parameter) that the file name can only use US-ASCII characters:     Current [RFC 2045] grammar restricts   parameter values (and hence   Content-Disposition filenames) to   US-ASCII.  We recognize the great   desirability of allowing arbitrary   character sets in filenames, but it is   beyond the scope of this document to   define the necessary mechanisms.   There is empirical evidence, nevertheless, that most popular Web browsers today seem to permit non-US-ASCII characters yet (for the lack of a standard) disagree on the encoding scheme and character set specification of the file name. Question is then, what are the various schemes and encodings employed by the popular browsers if the file name “naïvefile” (without quotes and where the third letter is U+00EF) needed to be encoded into the Content-Disposition header?  For the purpose of this question, popular browsers being:   Firefox  Internet Explorer  Safari Google Chrome  Opera
Word for people who don't make their deadline How can I get all three Kalos starters? Should Emergency Funds be Used for Infrequent, but Likely, Expenses? Say we break down non-monthly costs into the following three categories.   High level of predictability: This would include oil changes that may be needed every 2 to 4 months depending on usage, car insurance (if paid every 6 month), car registration, etc. Medium level of predictability: There are some expense which one can reasonable assume will occur on an infrequent basis.  For example, car repairs, house repairs, or even doctor visits during flu season. Low level of predictability: For example, losing a job, significant medical expense, etc.   Which of these categories are emergency funds meant to cover?  I think it is pretty clear that a high level of predictability costs should not use emergency funds while a low level of predictability should.  But medium level of predictability costs seem different, and it left me wondering what is generally defined as an "emergency".  While you do not know when these costs will occur or how much they will be, you could devise some pretty good rules of thumb on frequency and cost. Say you know your 2007 Volvo should have a repair cost averaging out to $100 per month.  Conceptually you could save $100 each month and when your car breaks, not have to spend any emergency funds on the repair.  Is doing this "double-saving" and not suggested if you already have the 6 month emergency fund saved up?  Note: this is a question on how to save money for expenses.  It is not a question about if you should spend emergency fund money to fix a car when you have no other money set aside. Why is English written and read from left-to-right as opposed to right-to-left, top-to-bottom, or (not even sure any language does this) bottom-to-top? I'm using Lubuntu for a while now, but found a couple of details that I wanted to view with Unity (that's another story).  Ok, the thing is: I've tried on a VM with Lubuntu to install Unity (sudo apt-get install unity) When the installation is over. I selected in the Lubuntu login Unity/Unity2D but did not work.  Right now I'm installing ubuntu-desktop, I am presuming that will work, but also it will change my login for example.  Is there a way to do a "clean" installation of Unity but not make major changes on my Lubuntu?  I would prefer Gnome-Shell instead of Unity. Create UEFI bootable USB stick to install Windows AND Ubuntu from it I know how to make a UEFI bootable stick to install Ubuntu (explained ) and I know how to make one to install Windows 7 (, sorry). I guess for Win 8 the procedure would be similar, but I haven't looked into it.  I also know how to make a legacy bootable stick from which I can install Windows and Ubuntu using YUMI. I have failed so far though at creating a UEFI bootable stick that can do this. When I do a UEFI boot from my YUMI multiboot stick it gives me no option to choose between Ubuntu and Windows (hardly surprising I guess) and instead simply UEFI boots Windows (which I find kind of surprising to be honest but maybe this is due to the fact that I added the Windows image after the Ubuntu image and this simply replaced Ubuntu's EFI boot files).  So how would I proceed to create such a bootable stick? Finding center and radius of circumscribed triangle Does anyone know of a script that can select all text references to URLs and automatically replace them with anchor tags pointing to those locations?  For example:  http://www.google.com   would automatically turn into  &lt;a href="http://www.google.com"&gt;http://www.google.com&lt;/a&gt;   Note: I am wanting this because I don't want to go through all my content and wrap them with anchor tags. Does the Planck scale imply that spacetime is discrete? Integrate $\int_{0}^{2\pi}\log|1-e^{i\theta}| d\theta$ Here is exercise 11, chapter 3 from Stein &amp; Shakarchi's Complex Analysis II:  Show that if $|a|&lt;1$, then:  $$\int_{0}^{2\pi}\log|1-ae^{i\theta}|\,d\theta = 0$$  Then, prove that the above result remains true if we assume only that $|a|\leq 1.$ ($a\in \mathbb{C}$)  I've already proved it for $|a|&lt;1$, but couldn't make it for $|a|=1$, which I thought would be the easy part. But the only thing I could come up with was that, WLOG, it is enough to prove that:  $$\int_{0}^{2\pi}\log|1-e^{i\theta}|\,d\theta = 0$$  Tried to look for some kind of symmetry, but could't find it. Any ideas? Thanks! At xmas, I had a cup of tea with some debris at the bottom from the leaves.  With less than an inch of tea left, I'd shake the cup to get a little vortex going, then stop shaking and watch it spin.  At first, the particles were dispersed fairly evenly throughout the liquid, but as time went on (and the vortex slowed, although I don't know if it's relevant) the particles would collect in the middle, until, by the time the liquid appeared to almost no longer be turning, all the little bits were collected in this nice neat pile in the center.  What's the physical explanation of the accumulation of particles in the middle?  My guess is that it's something to do with a larger radius costing the particles more work through friction... Extract substring in Bash Auto update specifick plugin I've created a plugin and I want to auto-update this plugin.  I've been looking in the WordPress Codex and found this following piece of code:  add_filter( 'auto_update_plugin', '__return_true' );   I added this code into a new Must-have Plugin but it doesn't work. It does not auto-update all my plug-ins..  Anyone that have experience with auto updating? Compiz Problems (Plugin Missing, Performance Issues, Development) Metadata and appstream Error while Updating I am getting an error while updating as a root. After Update log below error was shown in terminal.   AppStream system cache was updated, but problems were found: Metadata files have errors: /var/cache/app-info/xmls/fwupd.xml Reading package lists... Done E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh-cache &gt; /dev/null; fi' E: Sub-process returned an error code   I followed  answer and executed sudo apt install appstream/xenial-backports.  My appstream package is already updated:-  $ appstreamcli --version AppStream CLI tool version: 0.10.6   After, force refreshing the cache data. I am getting the following error:-  $ sudo appstreamcli refresh --force AppStream system cache was updated, but problems were found: Metadata files have errors: /var/cache/app-info/xmls/fwupd.xml How can I make command aliases in Windows' Command Prompt like I would with bash?  I found out about doskey in , so I can do something like:  doskey ls=dir /b   ...and now the command ls acts a little more like ls on Unix.  (I type ls so often in cmd, it isn't even funny.)  But how do I get this to stick between sessions?  It goes away the next time I open cmd.exe.  (Is there something like .bash_profile?) I'm having trouble getting basic APA bibliographies to work. The same thing works with nejm style, but changing the style to apa gives errors:  ! Undefined control sequence. &lt;argument&gt; \mkbibdateapalongextra  {year}{month}{day}\iffieldundef {endyear}{...  Package biblatex Warning: Macro 'name:apa:last-first' undefined. (biblatex)                Using \newbibmacro.  Package biblatex Warning: Macro 'name:apa:first-last' undefined. (biblatex)                Using \newbibmacro.   I'm using texlive 2012, as you can see I'm using biber, yes, I reran biber, and also tried delting the .bbl file and rerunning tools. My source markup is:  \documentclass[12pt]{article}  \usepackage[hidelinks]{hyperref} \usepackage[backend=biber,style=apa]{biblatex}  \addbibresource{BibResource.bib}  \begin{document}  test\parencite{ormrod2004human}  \clearpage  \printbibliography  \end{document} Preimage of codimension one subspace of the quotient $g/D^1 g$ I am trying to prove the following.  Proposition Let $g$ be a Lie algebra such that the first derived algebra $Dg$ is a proper ideal of $g$. Consider the quotient $g/D^1 g$, and show that the preimage of any codimension 1 subspace is   an ideal, and has codimension 1.   I could show that the preimage is indeed an ideal, but I need some help with the part about the dimensions:  So suppose that $\phi: x \mapsto [x]$ is the quotient projection. And write $[h] + Dg$  for a codimension 1 subspace of $g$ (here $h\subset g$). Then the preimage of this subspace is just the linear span $h+Dg\leq g$. Let $y+z \in h+Dg$ with $y\in h$ and $z\in Dg$. Let $x\in g$. We want to show that $[x, y+z]\in h$, ie that $h + Dg \lhd g$. We can write $x$ as $x_0+x_1$ for $x_0 \in Dg$, $x_1\not\in Dg$. Then  $$[x,y+z] = [x_0, y+z] + [x_1, y] + [x_1,z] \in h + Dg$$  The inclusion follows since $Dg$ is an ideal so the first and third terms belong $Dg$; and $[x_1, y] \in D_g$, as $g/Dg$ is abelian. Why does a $1/2$ appear in this simple capacitor equation? The maximum energy stored by a capacitor is when it’s (theoretically) fully charged, or just before it reaches dielectric breakdown, if you will. It seems, then, that the maximum energy ($E$) $=QV$, where $Q$ is the maximum charge attained and $V$ is the maximum ‘voltage’. However, the correct equation for the maximum energy is $E=\frac{1}{2}QV$. Why? I’m looking for a simple, intuitive explanation because my reasoning that $E=QV$ seems sound to me. I know about , but I’m looking for a reason to disprove my specific argument that $E=QV$ and not the “Oh, it comes from integration.” response. How to remove uninstalled wine app icons from unity dash?