I know how to do it using strptime, but how do I account for +0530  d = '2015-04-11 21:23:39+0530' d = datetime.strptime(d,'%Y-%m-%d %H:%M:%S')   Note Please dont suggest to slice 0530 off.
I need to parse  strings like "2008-09-03T20:56:35.450686Z" into Python's datetime type.  I have found  in the Python standard library, but it is not very convenient.  What is the best way to do this?
Changing website favicon dynamically I have a web application that's branded according to the user that's currently logged in. I'd like to change the favicon of the page to be the logo of the private label, but I'm unable to find any code or any examples of how to do this. Has anybody successfully done this before?  I'm picturing having a dozen icons in a folder, and the reference to which favicon.ico file to use is just generated dynamically along with the HTML page. Thoughts? mean value theorem question I was trying to solve the following:  Given: $0 &lt; a &lt; b$ and $n&gt;1$, prove: $$na^{n-1}(b-a) &lt; b^n-a^n &lt; nb^{n-1}(b-a)$$  I managed to get this far using the mean value theorem: $$a^n(b-a)&lt;b^n -a^n&lt;b^n (b-a)$$ Any idea how to continue? Is there a proof for this Fibonacci relationship? I was looking at the decomposition of Fibonacci numbers using the definition of $F_n = F_{n-1} + F_{n-2}$, and noted the pattern in the coefficients of the terms were Fibonacci numbers. It appears to hold, and I believe it's true, but I haven't seen a proof for it. Does one exist?  $F_n = 1F_{n-1} + 1F_{n-2}$ $F_n = 2F_{n-2} + 1F_{n-3}$ $F_n = 3F_{n-3} + 2F_{n-4}$ $F_n = 5F_{n-4} + 3F_{n-5}$ etc  This can be generalized to $F_n = F_xF_{n-(x-1)}+F_{x-1}F_{n-x}$ If there was a black hole on earth, what would it look like? If an answer does exist, I'd love to hear it. I'm trying to incorporate a doomed earth story in something I'm writing, and the end of the world I'm going for is a black hole.  Let's say the black hole was created in the Philippines (I chose it because it's on the equator). Here's  for reference.  If I was standing 90 degrees of that, in Kenya, or if I was standing 180 degrees of that, in Mexico; what would I see in those two separate instances? What if I was standing in Japan above it, or in Australia below it?  Let's also say I was riding a boat towards the source of the black hole. Unlike most imagined scenarios where I am orbiting the black hole and slowly falling into it, this time I'm no longer orbiting it - I'm getting sucked into it instead. I'm imagining that the black hole will "half" be inside Earth and "half" will be in the atmosphere. But as it pulls me in, what will it look like to me (if I was massless, so no tidal forces)? It's probably not going to be a black hemisphere sticking out of the ground. Light will be lensed around it in some way so as to appear like a hole in the air.  Also, if the black hole was very small, it probably won't have a strong gravitational pull, and assuming it doesn't disappear, you'd be able to look at it (or at least, its effect on the light in its surroundings). Of course, as you approach it, it would still have an event horizon, so spacetime would still be warped if you're near enough and the surroundings will still experience tidal forces.  As the black hole gains mass, it will get larger, and so its event horizon will increase. If I was standing in Kenya and the event horizon "washes over me," (as in a water wave) what will I see?  I've so far imagined that, at least when seen from outer space, there will be a hole on the ground and light will be lensed around it. When you are on the ground, though, it becomes a bit harder to imagine.  I do hope someone can lend me a hand!  Edit: Someone had previously answered this question, but I'm not sure why it's been deleted. It was pointed out to me, though, that a black hole cannot stay in place. So an additional question for me is, does that mean it is impossible to be standing still, and the event horizon "washes over you"?  Edit2: Here's a guiding thought experiment that could answer the question. Imagine that you are in outer space directly above the black hole, looking at the black hole that is on the earth's surface. Can you imagine what it would look like? It would simply be a hole with the surrounding light gravitationally lensed around it (possibly lensing the entire earth if it's big enough - but let's say it's not).  Now imagine that you are on the direct opposite of where you were above - you're right behind the black hole this time, looking directly at the black hole but unable to see it because the earth is blocking your view.  Now try to imagine, from the second image, rotate the earth into the first image. I find it a bit hard to do. Just as the black hole is appearing as you rotate the earth, how would the light be lensed? Detect which TeX engine is used How can I detect inside a TeX file which engine (pdftex/xetex/luatex) is used to compile the file? Is there a LaTeX package that provides this functionality? Show that the locus formed by z in the equation $z^3 + iz = 1$  never crosses the co-ordinate axes in the Argand plane. Further show that $$|z| = \sqrt{\dfrac{-\Im(z)}{2\Re(z)\Im(z) +1}}$$  Concept: $z=x+iy$ $z^3=(x+iy)^3=x^3-3xy^2+i(3x^2y-y^3)$ $iz=-y+ix$ Combined equation is $x^3-3xy^2-y-1+i(3x^2y-y^3+x)=0$ How do we proceed from here onward? I have a custom script and I want to send a desktop notification (the one that appears in the top right corner of the screen) with a custom message. How do I do that? As the title suggests, I'd like to prove that the sum $$ \sum_{n=2}^\infty (\ln n)^{- \ln n} $$ is finite.  The root and ratio test both fail here, but  suggests that there is a comparison that can be used to show convergence.  The only thought I have is that it may help to write the terms as $e^{-\ln(n)\ln(\ln(n))}$, but this has not led me to any particular insight.  Any ideas are appreciated. 50 hertz sine wave in oscilloscope when I touch it I bought a new PicoScope USB oscilloscope and noticed that when I touch the tip of the probe with my hand I see a 50&nbsp;Hz signal of 2 volts on the screen. What is causing this? (Or rather, how is the mains 50 Hz sine wave getting through me to the scope?) Purchasing a Switch - AC vs DC Current Specifications? I'm trying to purchase several switches for a DC system with moderately low current (a few amps at 12V). When browsing for switches in parts catalogs (e.g.  and ) there are always separate voltage ratings for AC and DC applications. I understand that AC switches are less expensive because the switching time does not need to be as fast and arcing is less of a concern. There is only one current rating listed and I am not sure if it applies to AC switching, DC switching, or both.  Does this current rating apply to both the rated AC and DC voltages? Is there a good rule-of-thumb for converting between AC and DC voltage/current ratings? What is the highest current I could reasonably expect from a DC switch before moving to a relay? I'm including \usepackage{hyperref} so that each instance of \ref (as well as each page number in the index and the table of contents) automatically links to that page.  When I'm viewing the document (in ) and I click a link, I jump to the linked page.  Is there any easy way to go "back" to where I was before I clicked the link?  (And is the answer any different when using Adobe Acrobat reader?) How do I debug when the system freezes or when it crashes back to login? I am fairly new to Ubuntu and I was wonder what a good way is to debug when something crashes?   For example: I installed 11.04 and the default media player banshee makes my laptop crash after a few minutes of playing music. Since the system completely freezes and there is not error message it's hard to find out what is wrong.  Second problem I have is that sometimes the system crashes to login. I am suspecting it to be a Chromium or Flash but I am not 100% sure.  So anybody got some tips on how to debug stuff like this? Is there is a way to exclude nested subdirectory specified by a path to that dir from grep recursive search? Or I have to use ack or find for this?  Here's what I want. Say I have this dir structure:  dir/nesteddir/match.txt otherdir/nesteddir/match.txt   How do I exclude first nesteddir only? Is it even possible using grep?  Most obvious answer $ grep -r --exclude-dir="dir/nesteddir" "stringToFind" . doesn't seem to work, nor do any of my experiments with various --exclude-dir paths using globbing, leading ./, etc.   Reading man page and googling didn't help, the only mention of this usecase I found is this question:   It was concluded that this is bug introduced in grep 2.12, but I'm using latest version (2.16) and grep's bugtracker () doesn't mention anything related to --exclude-dir, so I guess either it was fixed or it's an intended behaviour.   Would be really nice to get some clarification. Show a Form without stealing focus? I'm using a Form to show notifications (it appears at the bottom right of the screen), but when I show this form it steals the focus from the main Form. Is there a way to show this "notification" form without stealing focus? When typing &lt; or &gt; in LaTeX and compiling with pdflatex, the less than and greater than symbols appear at upside down exclamation points. I'm not in math mode. How to programmatically remove a field from a node? How can I get very vivid colors in night cityscape pictures? Is there a rule for pronouncing “th” at the beginning of a word? Consider the th in thistle versus the th in this: the former is unvoiced, while the latter is voiced.  Is there a rule or reason for the differences? Update to latest version of java after ppa is discontinued I have been trying to install the latest version of java-8. However, I found out that the  due to changes in the java licence.  How should I update my java to 8.0_201 or 8.0_211 now?  Thanks! How can I make all text the same font size (normal text, footnotes, acknowledgements etc.)? I have to submit a manuscript to a journal, and I just realized that they want every single part of the paper to be in 12 pt font. This includes tables text, footnotes, acknowledgements etc. Is there a way to force all text to be the same size?