Playing without boots
Player looses boot after tackle
What is the most elegant way to check if the directory a file is going to be written to exists, and if not, create the directory using Python? Here is what I tried:  import os  file_path = "/my/directory/filename.txt" directory = os.path.dirname(file_path)  try:     os.stat(directory) except:     os.mkdir(directory)         f = file(filename)   Somehow, I missed os.path.exists (thanks kanja, Blair, and Douglas). This is what I have now:  def ensure_dir(file_path):     directory = os.path.dirname(file_path)     if not os.path.exists(directory):         os.makedirs(directory)   Is there a flag for "open", that makes this happen automatically? I let him do it.   and     I allow him to do it.   Why does the latter require to?  What are the "rules" of using to with an infinitive? When is it necessary? How to save user-entered line breaks from a TextArea to a database? How do I save user-entered line breaks from a &lt;textarea&gt; HTML element to a database?  It always removes the line breaks. I use ssh on a variety of machines, mainly linux. Accounts on these machines vary in naming scheme: if my name is First Last, then I have accounts: first, flast, last_f, lastf, and sometimes I need to log in as root. For each machine I use, I would like the openssh client to know which account to use when I don't specify on the command line.  So the question is: How do I make ssh server Do The Right Thing when a username is not specified? Wireless disabled by hardware switch on an Asus X550V Prove that $\cos\theta$ is root of equation $8x^3-4x^2-4x+1=0$, given $\theta=\frac{\pi}{7}$.   I put $\cos\theta$ in equation, but couldn't show the left-hand side to be zero. Using ArcPy to get all database names within server? I am trying to populate a folder with ArcSDE database connection files for all the databases within a server instance.  I need to be able to do this for several of our servers.  Although I know within SQL Server how to get a list of DB names from the sys.databases table, using the arcpy function CreateDatabaseConnection I cannot specify "sys" or "master" to make the connection.  Therefore, I need to know the name of a database currently in the server.  I am not sure how to make the check without hard-coding a name.  import arcpy arcpy.env.overwriteOutput = True  #Input the location where the database connection files will be stored connectionLocation = "F:/FolderName"  #Get the list of servers arcpy.CreateDatabaseConnection_management(out_folder_path= arcpy.env.scratchFolder,out_name= "GIS_USERCONFIG" ,database_platform="SQL_SERVER",\                                           instance = "XXXXXXX" ,account_authentication="DATABASE_AUTH",username="user",password="password",\                                           save_user_pass="SAVE_USERNAME",database= "GIS_USERCONFIG",schema="#",version_type="TRANSACTIONAL",version="dbo.DEFAULT",date="#") sdeConn = arcpy.ArcSDESQLExecute(arcpy.env.scratchFolder + "/GIS_USERCONFIG.sde") serverListSQL = sdeConn.execute("Select name from userservers") serverList = [] for i in range(0,len(serverListSQL)):     serverList.append(serverListSQL[i][0])  #Make a folder for each server instance and build the connection files for all DBs in the server instance for server in serverList:     folder = connectionLocation + "/" + server     if arcpy.Exists(folder):         print server + " folder already created"     else:         try:             arcpy.CreateFolder_management(connectionLocation, server)             print "Created Folder " + server         except:             print "failed to create folder " + server      #     arcpy.CreateDatabaseConnection_management(out_folder_path= arcpy.env.scratchFolder,out_name= server ,database_platform="SQL_SERVER",\                                           instance = server ,account_authentication="OPERATING_SYSTEM_AUTH",\                                           database= "master",schema="#",version_type="TRANSACTIONAL",version="dbo.DEFAULT",date="#")     sdeConn = arcpy.ArcSDESQLExecute(arcpy.env.scratchFolder + "/" + server + ".sde")     dbListSQL = sdeConn.execute("Select name from sys.databases")     dbList = []     for i in range(0,len(serverListSQL)):         dbList.append(dbListSQL[i][0])     for db in dbList:         arcpy.CreateDatabaseConnection_management(out_folder_path= folder ,out_name= db,database_platform="SQL_SERVER",\                                           instance = server ,account_authentication="OPERATING_SYSTEM_AUTH",\                                           database= db,schema="#",version_type="TRANSACTIONAL",version="dbo.DEFAULT",date="#")   Basically my issue is with the 2nd call for the function "CreateDatabaseConnection_management" since it needs a database that exists in the database (and I could not use "master or sys").  If you open this as a tool in arcmap, the input is a drop-down box that populates choices based on the databases in the chosen server instance.  Is there a way to do this in the code? How to insert the content of a file into another file before a pattern (marker)? File1 contents:  line1-file1      "1"  line2-file1      "2" line3-file1      "3"  line4-file1      "4"    File2 contents:  line1-file2     "25"   line2-file2     "24"   Pointer-file2   "23"   line4-file2     "22"  line5-file2     "21"   After the execution of perl/shell script, File2 content should become:  line1-file2     "25"   line2-file2     "24"  line1-file1      "1"  line2-file1      "2" line3-file1      "3"  line4-file1      "4"  Pointer-file2   "23"  line4-file2     "22"  line5-file2     "21"   i.e  paste the contents of File1 in File2 before the line that contains "Pointer". Remove "Set as desktop background" from Windows context menu I'm looking into running a machine-learning project on EL&amp;U to detect low-quality posts. To do that, I need a large dataset - and to get that, I need to get the text from a large number of deleted questions.   I can't use the API; deleted posts aren't included in it. I can't use SEDE: the PostsWithDeleted table lists NULL for the Body field of deleted posts. I can't script it: not only do I have insufficient reputation on EL&amp;U, but I also managed to get myself rate-limit-blocked while testing a script on Hardware Recs.   So, how else can I get this data? Why does comparing strings using either '==' or 'is' sometimes produce a different result? While any of the other sections under &quot;Edit Profile &amp; Settings&quot; do work normally. How to get Scilab 6.0.1 working on Ubuntu 18.04 LTS? I have installed clean Ubuntu MATE 18.04 LTS and installed Scilab from repository here with    sudo apt-get update sudo apt-get install scilab   After installation I tried to launch it from GUI (Applications → Other → Scilab) - it does not start. Then I tried to launch it from terminal with scilab command. Terminal output is as follows:  $ scilab /usr/bin/scilab-bin: error while loading shared libraries: libjava.so: cannot open shared object file: No such file or directory   so it can't find Java. I reported  about this problem.  I checked existence of libjava.so:  $ dpkg -S libjava.so   openjdk-11-jre-headless:amd64: /usr/lib/jvm/java-11-openjdk-amd64/lib/libjava.so   so it is in place.  What should I do to get Scilab 6.0.1 working on Ubuntu 18.04 LTS? Was the "Eye of Sauron" Sauron's actual physical form? During the time frame of the Lord of the Rings, was the Eye of Sauron Sauron's actual physical form? If not, what form did he have? Which Pokémon can speak with humans? Inspired by Detective Pikachu, I was wondering which Pokémon can "speak" with humans.  I would like to include  Pokémon like Meowth in the anime that speak English/Japanese with their mouths, Pokémon like Mewtwo in the anime/movies that speak telepathically, or other Pokémon we've seen like Lugia/Entei that seem to speak without moving their mouths but still out loud for all to hear (presumably).  The format doesn't matter (manga, anime, video games). And while this is inspired by Detective Pikachu, it's not about it, as the movie is not out yet      And it seems like the human character has the special ability, not the Pikachu There is an experimental timeline view for questions now available on meta ONLY! (Now working on SO, SF, and SU as well)  This is partially motivated by comments about how difficult it is to follow very active questions which have a lot of activity, and also the feedback on the API which was heavily dominated by "we need to know what happened in this time range" type responses.  It can only be accessed through URL hackery at the moment. To get to it, enter question URLs like so:  https://meta.stackexchange.com/posts/{id}/timeline  This is a chronological timeline of everything that happened on a question, including   initial question ask answers  revisions comments closure, deletion, reopen, undelete, etc votes   all based on when they happened in chronological order.  We are thinking about making this a fourth tab on the question, like so:  Timeline | Oldest | Newest | Votes  Please try it out and provide feedback. It is still a little rough, so we are not looking for highly detailed bug reports, just more general feedback.  Timeline view for this question: Is zero input impedance good or possible when considering impedance matching? For RF applications, we are usually considering of impedance matching to choose load impedance as the conjugate of the source input impedance for the maximum transferred power. But how about design the source having zero input impedance? Is it even possible or good? A naive thought is that all the power will be on the load if so. I might think it is true for DC case and for amplifier design to have a small output impedance and big input impedance. I lack the knowledge to find the missed chain to put all the knowledge together. How do you think? Thanks! Pokemon Go login issues after update I downloaded the July 30th update for Pokemon Go and when I open the app I'm prompted to login, But once I login, it redirects me to this page on Cookies::     If I click "Done" in the top left, it prompts me to login again! I've tried reinstalling the game, restarting my phone, etc. I can't much enable Cookies on the inline Safari browser. It doesn't make sense, and cookies are on in Safari (because I don't use Safari and they're enabled by default).  How can I fix this? Let $b>0.$ Evaluate $\lim_{n \to \infty} \int^{b}_{0} \frac{\sin nx}{nx}dx$ I'm stumped at the last part of this problem. Could anyone advise, please? Thank you.  Here is  my  proof.   Define  $f: \mathbb{R} \to \mathbb{R}$ by $$ f(x) = \left\{\begin{aligned} &amp;\frac{\sin nx}{nx}&amp;&amp;, x \neq0 \\ &amp;1 &amp;&amp;, x=0 \end{aligned} \right.$$   Hence, $$f(x) = \sum^{\infty}_{k=0}(-1)^k\frac{(nx)^{2k}}{(2k+1)!} , \forall x \in \mathbb{R} \mbox{ and } f \in {\mathscr R[0,b]}.$$  $$\int^{b}_{0} \frac{\sin nx}{nx}dx = \int^{b}_{0}f(x)dx=\sum^{\infty}_{k=0}\int^{b}_{0}(-1)^k\frac{(nx)^{2k}}{(2k+1)!}dx= \sum^{\infty}_{n=0}(-1)^k\frac{(n)^{2k}b^{2k+1}}{(2k+1)(2k+1)!}$$  $$\lim_{n \to \infty} \sum^{\infty}_{k=0}(-1)^k\frac{(n)^{2k}b^{2k+1}}{(2k+1)(2k+1)!}=  ?$$ I've noticed that, if I add \n to a pattern for substituting using sed, it does not match. Example:  $ cat &gt; alpha.txt This is a test Please do not be alarmed  $ sed -i'.original' 's/a test\nPlease do not/not a test\nBe/' alpha.txt  $ diff alpha.txt{,.original}  $ # No differences printed out   How can I get this to work?