I am working on an application and I am a beginner in Python :(  I want to add a shapefile, the execution is successful and everything but no result appears on ArcMap, here is the code I use:  import arcpy  try:      mxd = arcpy.mapping.MapDocument("CURRENT")      df = arcpy.mapping.ListDataFrames(mxd)[0]       newlayer1 = arcpy.mapping.Layer(E:\DATA SF\SFcircuit\shape_zizo\batiment.shp")     print newlayer1     arcpy.mapping.AddLayer(df, newlayer1, "TOP")        arcpy.RefreshActiveView()     arcpy.RefreshTOC()      # save the map to persist the added layer     mxd.save()    except Exception as ex:     print ex.args[0]
I am trying to automate various tasks in ArcGIS Desktop (using ArcMap generally) with Python, and I keep needing a way to add a shapefile to the current map. (And then do stuff to it, but that's another story).  The best I can do so far is to add a layer file to the current map, using the following ("addLayer" is a layer file object):  def AddLayerFromLayerFile(addLayer):  import arcpy  mxd = arcpy.mapping.MapDocument("CURRENT")  df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]  arcpy.mapping.AddLayer(df, addLayer, "AUTO_ARRANGE")  arcpy.RefreshActiveView()  arcpy.RefreshTOC()  del mxd, df, addLayer   However, my raw data is always going be shapefiles, so I need to be able to open them. (Equivalently: convert a shapefile to a layer file without opening it, but I'd prefer not to do that).
How to determine the genre of a song? I listen to many songs and I always wonder how the genre of a song is determined. Is it by listening to the song, or by the song's info like the artist, year released and so on? Which kind of pointer do I use when? Fixing geometry validity errors in QGIS 2? Prove $\gcd(a,b,c)=\gcd(\gcd(a,b),c)$ for $0\ne a,b,c\in \Bbb{Z}$. I tried solving it with sets but I sense there are some details I am missing. I would truly appreciate your reference. Properties of $y$ if $\frac{d^2y}{dx^2}+xy=0$, $x \in [a,b],$ and $y(a)=y(b)=0.$ Let $y$ be a nontrivial solution of the boundary value problem  $$\frac{d^2y}{dx^2}+xy=0,\ x \in [a,b]$$  $$y(a)=y(b)=0$$ Then:   $b&gt;0$ $y$ is monotone in $(a,0)$ if $a&lt;0&lt;b$. $y'(a)=0$. $y$ has infinitely many zeros in $[a,b]$   I have no idea how to solve it and which options is/ are correct. please help me. How does the new Tie-Breaker work? In Clash of Clans there was an update on 9/16 adding a Tie-breaker into the wars, can anybody explain in detail how this mechanism works? Every $k$ vertices in an $k$ - connected graph are contained in a cycle. Let $G$ be a $k$-connected graph. Meaning, $G$ has no fewer than $k$ vertices, and for every set of $k-1$ or fewer vertices, if we remove them from $G$, the graph stays connected (Of course, $G$ itself is also connected).  I want to prove that for any $k&gt;1$, if $G$ is $k$-connected, then every set of $k$ vertices is contained in a cycle.  I have tried some ways - mainly using induction by removing one of the vertices of the set from the graph, and/or using Menger's theorem to construct the cycle. But I always encounter problems with making sure that the cycle I'm building deosn't have repeating edges etc.  Help would be greatly appreciated :) Thanks! Why are hand-built wheels considered to be better than machine-built wheels? Why are hand-built wheels considered to be better than machine-built wheels? I would think that a machine-built wheel would be better and cheaper, since machines generally do a more precise job than humans. Running junit tests in parallel in a Maven build? Does a differentiable everywhere function have a continuous derivative? If a function $f$ defined on $[a,b]$ and differentiable everywhere, does it mean that its derivative $f'(x)$ is continuous everywhere on $[a,b]$?  My understanding is 'yes'. Because if there were 'a gap' in $f'(x)$, we could integrate back to $f(x)$ and show that where the gap is, there would be a sharp "angle" where $f(x)$ is not differentiable. When reading about  on the OALD, I saw the following note:     The difference between someone and anyone is the same as the difference between  and . Look at the notes there.   The note that I read for some is the following:     In negative sentences and questions any is usually used instead of some:           I don't want any more vegetables.     Is there any wine left?           However, some is used in questions that expect a positive reply:           Would you like some milk in your coffee?     Didn't you borrow some books of mine?      Does that apply to someone too? Should I use someone in a question when I am expecting a positive answer?      Does someone know the answer? Going back twice required to return to search results in the tags view Privacy leak in permalink? Update (Jan 8, 2019) This is now 8 years old, but still getting occasional upvotes/attention, so I thought it's worth giving a summary of the current state.  Despite originally being , over the last decade some changes have made the privacy implications much clearer.  You now click &quot;share&quot; instead of &quot;link&quot;, and the pop-up is very explicit that the link includes your user ID. There is a  asking that this user ID be anonymized or hashed, to allow users to earn publicity badges (the intention behind having the user ID present in the URL, as per ) while eliminating the privacy issue. Original Post It seems to me there is something of a privacy leak when permalinking to a question.  For what I would assume is the purposes of tracking which user is responsible for bringing traffic back to an SE site (for badges, etc.), the user ID of the user obtaining the permanent link . I wouldn't argue that this shouldn't be the case, but I find no warning or mention of this when I do these actions.  I'm sure I'm not the only one that doesn't desire anonymity on SO but would like at least pseudonymity on some places I might share a SO link, such as on a random blog.  As a user, I would not expect sharing a permanent link to leak my identity.   Unless you are familiar with Stack Exchange links or your own userID, it's certainly not obvious by looking at the link that it includes your personal info.  It'd be nice to have fair warning that using that feature will do so, and perhaps provide/describe the workaround: to simply remove the user-id segment from the URL.  Other features would be a preference that formats future permanent links to exclude the user id. Example (from this question)  Permalink:  Link to my user page: Looking for a short story about an insect-like alien captured by humans on its own planet This poor creature is taken aboard the spaceship and the humans do not know that it is intelligent.  The alien can repeat what it hears, e,g, "pass the sugar".  It is able to escape at night and it communicates messages to its fellow aliens.  It directs that they turn up the heat of the atmosphere (somehow they can do this) so as to force the humans to leave.  The alien protagonist states that it will die w/ the humans or leave with them. UK visa refusal on V 4.2 a + c (and sometimes 'e') Many of the UK visa refusals we see here share a common pattern and the prevailing reasons refer to V 4.2 (a) and (c).    I do understand that, while the applicants may describe very different individual circumstances, there's a consistent pattern and, broadly, fall into specific categories:    Credibility (lifestyle, lack of ties, visit history, lies &amp; omissions) Funding (insufficient funds, provenance of funds, funds parking) Sponsorship (family, friends, employer)   Question: What most commonly triggers a UK visa refusal where V 4.2 (a) and (c) are given as the grounds?  Secondarily: Given that there is a clear pattern, to what extent are these refusals predictable? Does sponsorship make a difference? Is there a set of personal circumstances, however abstract, where a refusal is all but guaranteed? For example, why do those we see here on TSE who sought entry for the PLAB or British Army appear to be refused with a common theme? Is there a uniform shortcoming or is it just discrimination?   PLAB: What is about applications for a visa, for the purpose of sitting the Professional and Linguistic Assessments Board (PLAB) exam, that seem to invite refusals. After all, the test is given so that international medical graduates can show that they qualify to practise medicine in the UK. The first part, PLAB 1, can be taken in centres outside of the UK. However, PLAB 2 can be taken only in the UK. Why can't you can't get a visa just to sit the exam, promising that you'll leave immediately after?    British Army: Since Commonwealth citizens are eligible to apply online to join, even those who don't reside in the UK, why is it so difficult to get a visa just to attend an interview to see whether you are suitable? Even with an invitation from the Army, such visa applications seem to be unsuccessful. Isn't a career in the British Army a valid reason?     Lastly:  After such a refusal, what approaches would increase the chance of a successful application? propositional calculus problem, how to prove this right or wrong? $A$$\rightarrow$$(B$ $\vee$ $C$ ) , $B$ $\rightarrow$ $C$ $\vDash$ $A$ $\rightarrow$ $D$  I think it's wrong but I have no idea how to prove. When running a Java app from eclipse my ImageIcon shows up just fine.  But after creating a jar the path to the image obviously gets screwed up.  Is there a way to extract an image from the jar at runtime so I can then open it up?  Or, is there a better way to do this?  I'd like to distribute a single jar file if possible. Pattern in Isomorphisms between $\mathbb Z_m \times \mathbb Z_n$ and $\mathbb Z_{mn}$ In general, the group $\mathbb Z_{mn}$ under addition $\bmod mn$ is isomorphic to the direct product $\mathbb Z_m \times \mathbb Z_n$ if and only if $\gcd(m,n)=1.$ This is easy to see since $\mathbb Z_{mn}$ is generated by the element $(1,1)$, and if $\gcd(m,n)=1$, then this will only be zero if it is multiplied by itself $mn$ times (resulting in the cyclic group).   However I'm interested in constructing an isomorphism between the two groups as an explicit expression. I've been playing around a bit with some examples, one of which is the function $\phi : \mathbb Z_2 \times \mathbb Z_3 \to \mathbb Z_6$ where $\phi(a,b) = 3a + 4b \pmod 6$, which gives us the desired isomorphism. I'm interested here in the relationship between the integers $2$, $3$, and the coefficients $3, 4$ of $a$ and $b$. After playing around in Wolfram|Mathematica, I managed to obtain the following isomorphisms $\phi_{m,n} : \mathbb Z_m \times \mathbb Z_n \to \mathbb Z_{mn}$ for coprime $m,n$ in $\{1, 2, \dots, 10\}$.   First of all, the following results seem to hold in general.  $$\phi_{1, n}(a, b) = a + b \qquad \text{for all $n$}$$  $$\phi_{m, 1}(a, b) = a + b \qquad \text{for all $m$}$$  $$\phi_{2, n}(a, b) = na + (n + 1)b \qquad \text{for all $n$}$$ $$\phi_{m, n}(a, b) = K a + L b \iff \phi_{n,m}(a, b) = L a + K b \qquad \text{for all $m, n$}$$  Beyond this point, I could not spot a general pattern. The isomorphisms I obtained are:  $$\phi_{3, 4}(a, b) = 4a + 9b$$ $$\phi_{3, 5}(a, b) = 10a + 6b$$ $$\phi_{3, 7}(a, b) = 7a + 15b$$ $$\phi_{3, 8}(a, b) = 16a + 9b$$ $$\phi_{3, 10}(a, b) = 10a + 21b$$ $$\phi_{4, 5}(a, b) = 5a + 16b$$ $$\phi_{4, 7}(a, b) = 21a + 8b$$ $$\phi_{4, 9}(a, b) = 9a + 28b$$ $$\phi_{5, 6}(a, b) = 6a + 25b$$ $$\phi_{5, 7}(a, b) = 21a + 15b$$ $$\phi_{5, 8}(a, b) = 16a + 25b$$ $$\phi_{5, 9}(a, b) = 36a + 10b$$ $$\phi_{6, 7}(a, b) = 7a + 36b$$ $$\phi_{7, 8}(a, b) = 8a + 49b$$ $$\phi_{7, 9}(a, b) = 36a + 28b$$ $$\phi_{7, 10}(a, b) = 50a + 21b$$ $$\phi_{8, 9}(a, b) = 9a + 64b$$ $$\phi_{9, 10}(a, b) = 10a + 81b$$ If you want to try and generate a few yourself, here is the Mathematica function I implemented. I'm sure it can be optimised, but for the first 10 coprime integers it sufficed.  isomorphism[{m_, n_}] :=       Module[{x = Null},       For[i = 1, i &lt; m*n,           i++, (If[#[[2]] == Table[i, {i, 0, m*n - 1}],           x = ToString[#[[1]][[1]]] &lt;&gt; "a+" &lt;&gt; ToString[#[[1]][[2]]] &lt;&gt;          "b"; Break[]] &amp;) /@       Table[{{i, j},       Mod[i #[[1]] + j #[[2]], m*n] &amp; /@       Table[{Mod[i, m], Mod[i, n]}, {i, 0, m*n - 1}]}, {i, 1,      m*n}, {j, 1, m*n}][[i]]]; x];   I'd appreciate if anyone can help me find the pattern to determine $\phi_{m, n}$ in general. How do I close a tkinter window? How do I end a Tkinter program? Let's say I have this code:  from Tkinter import *  def quit():     # code to exit  root = Tk() Button(root, text="Quit", command=quit).pack() root.mainloop()   How should I define the quit function to exit my application? C# vertical label in a Windows Forms