I have a string that comes in the format name = &quot;1/2/2021&quot;, how can I convert this string to the format newName = &quot;2021-2-1&quot; original =  name day = original[0] month = original[2] year = original[4:8] combination = year + &quot;-&quot; + month + &quot;-&quot; + day  I have tried using this but brings wrong values when date or month changes to more than 2 characters
I've got a huge list of date-times like this as strings:  Jun 1 2005  1:33PM Aug 28 1999 12:00AM   I'm going to be shoving these back into proper datetime fields in a database so I need to magic them into real datetime objects.   This is going through Django's ORM so I can't use SQL to do the conversion on insert.
JSonNet boolean serialization This question is a result of having too much free time years ago during military service. One of the many pastimes was playing tic-tac-toe in varying grid sizes and dimensions, and it lead me to a conjecture. Now, after several years of mathematical training at a university, I am still unable to settle the conjecture, so I present it to you.  The classical tic-tac-toe game is played on a $3\times3$ grid and two players take turns to put their mark somewhere in the grid. The first one to get three collinear marks wins. Collinear includes horizontal, vertical and diagonal lines. Experience shows that the game always ends in a draw if both players play wisely.  Let us write the grid size $3\times3$ as $3^2$. We can change the edge length by playing on any $a^2$ grid (where each player tries to get $a$ marks in a row on the $a\times a$ grid). We can also change dimension by playing on any $a^d$ grid, for example $3^3=3\times3\times3$. I want to understand something about this game for general $a$ and $d$. Let me repeat: The goal is to make $a$ collinear marks.  I assume both players play in an optimal way. It is quite easy to see that the first player wins on a $2^d$ grid for any $d\geq2$ but the game is a tie on $2^1$. The game is a tie also on $3^1$ and $3^2$, but my experience suggests that the first player wins on $3^3$ but the game ties on $4^d$ for $d\leq3$. It seems quite credible that if there is a winning strategy on $a^d$, there is one also on $a^{d'}$ for any $d'\geq d$, since more dimensions to move in gives more room for winning rows.  to a related question tells that for any $a$ there is $d$ so that there is a winning strategy on $a^d$.  This brings me to the conjecture:     There is a winning strategy for tic-tac-toe on an $a^d$ grid if and only if $d\geq a$. (Refuted by TonyK's answer below.)   Is there a characterization of the cases where a winning strategy exists? It turns out not to be as simple as I thought.  To fix notation, let $$ \delta(a)=\min\{d;\text{first player wins on }a^d\} $$ and $$ \alpha(d)=\max\{a;\text{first player wins on }a^d\}. $$ The main question is:     Is there an explicit expression for either of these functions?   Or decent bounds?   Partial answers are also welcome.   Note that the second player never wins, as was discussed in .    A remark for the algebraically-minded: We can also allow the lines of marks to continue at the opposite face when they exit the grid; this amounts to giving the grid a torus-like structure. Now there are no special points, unlike in the usual case with boundaries. Collinear points on a toric grid of size $a^d$ corresponds to a line (maximal collinear set) in the module $(\mathbb Z/a\mathbb Z)^d$. (If $a$ is odd, then $a$ collinear points in the mentioned module add up to zero, but the converse does not always hold: the nine points in $(\mathbb Z/9\mathbb Z)^3$ with multiples of three as all coordinates add up to zero but are not collinear.) This approach might be more useful when $a$ is a prime and the module becomes a vector space. Anyway, if this version of the game seems more manageable, I'm happy with answers about it as well (although the conjecture as stated is not true in this setting; the first player wins on $3^2$). How does body fat leave your body? So I know that it’s not from tears or sweat because they are composed of mainly water and sodium, it’s not from going poo or pee as poo and pee are made of the parts of food that supply your body with no nutrients and your body also doesn’t “burn body fat” because there is a theory that no matter is ever destroyed so it’s none of those but another thing is it’s not your hair, ear wax, finger nails or anything of that sort because people can lose over 17 pounds in 3 months but you can’t build up that amount of hair , ear wax or whatever else in three months so how does body fat leave your body gedit "cannot open display" , on remote computer , using ssh - Ubuntu 12.04 Possible Duplicate:          I am getting the following error message when using ssh to log into a remote machine:      gedit: cannot open display   I am using ssh in - Ubuntu 12.04. Refused UK Visit visa for lack of sufficient funds - What more can I do? Where is the .Trash folder? Order of items in a context menu How does the Commander interact with Banishing Light or Oblivion Ring? What is the result of measuring $\sigma_x$ on the state $|01\rangle+|10\rangle$? I confused about how to calculate the probabilities and getting a certain result of measuring Bell's states with Pauli matrices as the operator. When you measure something, the state involved would be projected onto an eigenstate of the observable. given $|\psi\rangle = \frac{1}{\sqrt2} (|01⟩ + |10⟩)$ as the state and $\sigma_x = \left[\begin{matrix}0&amp;1\\1&amp;0\\\end{matrix}\right]$ as the observable. if the probability is 1/2, how to calculate them actually? What is the state after measurement? Create user ID `root` to force `gedit` to create user configuration file When using sudo powers and calling gedit the top level menu with File Edit View Search Tools Documents Help is missing.  If I create user ID root and sign in once and call gedit will it create the necessary user configuration files that might fix this?  Will this also make the annoying error messages go away whenever I use sudo, gksu or pkexec as a regular user with elevated privileges togedit ?  Will there be other benefits with Nautilus and other Gnome derivative Ubuntu applications?  NOTE: by sudo powers you can google pkexec gedit 3.5k hits, gksu gedit 40k hits or sudo gedit 500k hits. I'm in the minority using the first method but I believe it will become the standard in Ubuntu 17.04.    June 12, 2017 Update Here are a list of errors you get when using pkexec gedit:  (gedit:13003): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files  ** (gedit:13003): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-spell-enabled not supported  ** (gedit:13003): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported  ** (gedit:13003): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-position not supported   On this  there is a commitment to fix these distracting messages as of June 5, 2017. No indication is given for when the fix will be upstream nor if the functionality will be implemented or the error messages will simply disappear.  Note the bug report was filed over a year ago and over that time it only effects 18 people. How do I choose a macro lens for a Canon APS-C camera? Comma after a coordinating conjunction preceding a parenthetical at the start of the sentence Unable to install ECW support on lubuntu 14.04 How do I drop an object to the sand? Looks like there is something wrong with reputation calculation:        +2*5 -6*2 = -2...   why there is +6 in reputation popup?  As @Catija said in comment calculation is OK in the profile:        Perhaps the issue is in the top-bar. I am looking for tutorials, articles or books containing theory of  in context of mathematical physics. Please suggest. How can an object's instantaneous speed be zero and it's instantaneous acceleration be nonzero? I'm studying for my upcoming physics course and ran across this concept - I'd love an explanation. I am studying the function and characteristic of an op-amp to build a line-following robot with the schematics below. However, in many tutorials, the way to differentiate an inverting and non-inverting op-amp is by looking at the connection to ground via the inverting or non-inverting terminal.  However, in the schematics, the op-amp is considered to have connections to ground, thus in this case, how do I differentiate it then?  I may have understood the whole concept wrongly. Pls help!    EDIT: Please ignore the switch as it may have been drawn wrongly by the supplier. What EXACTLY cause Voldemort's soul piece to split off when he killed Lily and tried to kill Harry? Raised index of partial derivative