Duplicate of:   I would like to find out the path to the currently executing script. I have tried os.getcwd() but that only returns the directory I ran the script from not the actual directory the script is stored.
I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process.   For example, let's say I have three files. Using :   script_1.py calls script_2.py.  In turn, script_2.py calls script_3.py.    How can I get the file name and path of script_3.py, from code within script_3.py, without having to pass that information as arguments from script_2.py?  (Executing os.getcwd() returns the original starting script's filepath not the current file's.)
I need to render a model on a transparent background. The models have a light source so they should be casting a shadow on a surface (the XY plane). The purpose for this is to overlay the rendered images (out of blender) on an image of the actual surface, so I want to generate the render including a semi-transparent shadow.  I don´t have any problem rendering the models on transparent background, but I can not make a shadow appear. I tried adding a surface below the model so the shadow can fall on it, but now there's the problem of keeping the surface from rendering.  How can I render the shadow on a transparent background? Accessing an array out of bounds gives no error, why? "debconf: DbDriver "config": config.dat is locked by another process: Resource temporarily unavailable" while installing packages I'm trying to install the flashybrid but when I enter the apt-get install flashybrid command, I get this error:  root@user-desktop:/home/user# apt-get install flashybrid Reading package lists... Done Building dependency tree Reading state information... Done flashybrid is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed. After this operation, 0B of additional disk space will be used. debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable Setting up flashybrid (0.15+nmu2) ... debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable dpkg: error processing flashybrid (--configure): subprocess post-installation script returned error exit status 1 Errors were encountered while processing: flashybrid E: Sub-process /usr/bin/dpkg returned an error code (1)   I also tried this one to find what is already using that file:  root@user-desktop:/home/user# lsof | grep /var/cache/debconf/config.dat lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/user/.gvfs Output information may be incomplete. dpkg-prec 4672 root 4rW REG 8,6 39658 1697827 /var/cache/debconf/config.dat   But I don't know how to fix this. Find: $$\lim\limits_{x \to 1} \left( {\frac{x}{{x - 1}} - \frac{1}{{\ln x}}} \right) $$  Without using L'Hospital or Taylor approximations  Thanks in advance Blackboard bold characters The blackboard bold font in the AMSFonts package only has capital letters.  I sometimes wish to use a blackboard bold "1", for which I can use \usepackage{bbold}. But this changes the entire blackboard bold font, and I like the original AMSFonts versions of the capital letters better.  Is there a simple way for me to get \mathbb{1} from one package and the blackboard bold capitals from another? What is the formula for percent of frame filled at a specific distance and focal length? I am thinking about buying a new lens specifically to take photos of distant targets (birds, bears, etc). I currently own the Canon 70-300 IS USM, which is a nice lens, but I find that if I want to take a photo of anything further away than about 10 meters, the target does not fill a large amount of the frame (meaning I have to significantly crop in post production).  I am currently looking at the Canon prime 400mm, however I would like to determine at what distance an object will fill a reasonable proportion of the frame.  Is there a formula or rule of thumb I can apply that will help me in this situation? I realise the size of the target I am shooting will play a role here, so if we need to make an assumption about the size of the target please let me know. What is the difference between "nothing but", "anything but", and "everything but"? Which of those functions are PRFs? Evaluating logistic regression and interpretation of Hosmer-Lemeshow Goodness of Fit As we all know, there are 2 methods to evaluate the logistic regression model and they are testing very different things  Predictive power: Get a statistic that measures how well you can predict the dependent variable based on the independent variables. The well-known Pseudo R^2 are McFadden (1974) and Cox and Snell (1989).  Goodness-of-fit statistics The test is telling whether you could do even better by making the model more complicated, which is actually testing whether there are any non-linearities or interactions that you have missed.   I implemented both tests on my model, which added quadratic and interaction already:     &gt;summary(spec_q2)      Call:     glm(formula = result ~ Top + Right + Left + Bottom + I(Top^2) +       I(Left^2) + I(Bottom^2) + Top:Right + Top:Bottom + Right:Left,       family = binomial())       Coefficients:                  Estimate Std. Error z value Pr(&gt;|z|)         (Intercept)  0.955431   8.838584   0.108   0.9139         Top          0.311891   0.189793   1.643   0.1003         Right       -1.015460   0.502736  -2.020   0.0434 *       Left        -0.962143   0.431534  -2.230   0.0258 *       Bottom       0.198631   0.157242   1.263   0.2065         I(Top^2)    -0.003213   0.002114  -1.520   0.1285         I(Left^2)   -0.054258   0.008768  -6.188 6.09e-10 ***     I(Bottom^2)  0.003725   0.001782   2.091   0.0366 *       Top:Right    0.012290   0.007540   1.630   0.1031         Top:Bottom   0.004536   0.002880   1.575   0.1153         Right:Left  -0.044283   0.015983  -2.771   0.0056 **      ---     Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1     (Dispersion parameter for binomial family taken to be 1)     Null deviance: 3350.3  on 2799  degrees of freedom     Residual deviance: 1984.6  on 2789  degrees of freedom     AIC: 2006.6  and the predicted power is as below, the MaFadden is 0.4004, and the value between 0.2~0.4 should be taken to present very good fit of the model(Louviere et al (2000), Domenich and McFadden (1975))                                                :  &gt; PseudoR2(spec_q2)     McFadden     Adj.McFadden        Cox.Snell       Nagelkerke McKelvey.Zavoina           Effron            Count        Adj.Count     0.4076315        0.4004680        0.3859918        0.5531859        0.6144487        0.4616466        0.8489286        0.4712500           AIC    Corrected.AIC  2006.6179010     2006.7125925   and the goodness-of-fit statistics:  &gt; hoslem.test(result,phat,g=8)       Hosmer and Lemeshow goodness of fit (GOF) test    data:  result, phat   X-squared = 2800, df = 6, p-value &lt; 2.2e-16  As my understanding, GOF is actually testing the following null and alternative hypothesis:   H0: The models does not need interaction and non-linearity   H1: The models needs interaction and non-linearity  Since my models added interaction, non-linearity already and the p-value shows H0 should be rejected, so I came to the conclusion that my model needs interaction, non-linearity indeed. Hope my interpretation is correct and thanks for any advise in advance, thanks. What is the 64-bit Firefox Beta PPA? I've got a Windows 10 Computer (home edition), which has 4GB of Ram and an i5 processor. I need to run an old 32 bit accounting programme. The vendor said it won't release a 64 bit version (although a 64bit version exists, it's missing key features from the older version).  The programme installs fine, but when I click on the programme icon, it says the programme won't work on a 64 bit system.   What options do I have?    I've done a fair bit of research, but it seems to run up dead ends.   1) WoW64     Apparently, this is supposed to let you run 32 bits on 64 bit Windows. However, I am not sure how to install it. I think it's for web servers only. However,  says it can work on Windows 7, but doesn't explain how to set it up (or if it will work on Windows 10).  2) XP mode     A 32bit Windows XP emulator. However, it seems to be for Windows 7 only. Also according to this , you need Windows Professional.   3) Virtual Box Machine    Let's you emulate Windows. Seems overkill for my purposes. Plus I would need to buy a 32 bit Windows license. I think it would run slowly with 4GB of Ram.  4) Partition drive into 32bit and 64 bit versions Apparently, you can use the free tool  to split the drive into two and then install separate 32bit and 64 bit versions.   Again, seems overkill and it looks like I would need buy a 32 bit Windows 10 license.   Are these my only options?     Images  Installation    First run (From the error message I guess it's a 16-bit program)   Clicking on programme Best Method to SFTP or FTPS Files via SSIS This question originally asked which is the best method for uploading files via SFTP or FTPS in SSIS.  It now just lists the pros and cons of each solution.  I personally use CozyRoc's SFTP library these days, but I've used each of the below solutions at one point or another.  SSIS COMPONENT LIBRARY  Method: Install a SSIS component library from , , , , or some other vendor on each development and production server and use the SFTP task to upload the files.  Pros: Easy to use.  It looks, smells, and feels like a normal SSIS task.  SSIS also recognizes the password as sensitive information and allows you all the normal options for protecting the sensitive information instead of just storing it in clear text in a non-secure manner.  Works well with other SSIS tasks such as ForEach Loop Containers.  Errors out when uploads and downloads fail.  Works well when you don't know the names of the files on the remote FTP site to download or when you won't know the name of the file to upload until run-time.  Cons: With the exception of the Codeplex solution, this costs money to license in a production environment.  Requires installing the libraries on each development and production machine.  If it is the Codeplex solution, then you are using software that isn't supported by any specific vendor.  This also makes you dependent upon the vendor to update their libraries between each version.  For instance, before 2008 RTM'd, I was developing a new server on a CTP version of 2008 and the CozyRoc 2005 library was incompatible with it.  Eventually they released a 2008 compatible version, but I had to temporarily use the command line solution to work around this issue.    COMMAND LINE SFTP PROGRAM  Method: Install a free command-line SFTP application such as Putty and WinSCP and execute it either by running a batch file or operating system process task.  Instructions for doing this via WinSCP are listed .  Pros: Free, free, and free.  You can be sure it is secure if you are using Putty since numerous GUI FTP clients appear to use Putty under the covers.  You DEFINATELY know you are using SSH2 and not SSH.  Cons: The two command-line utilities I tried (Putty and Cygwin) required storing the SFTP password in a non-secure location.  I haven't found a good way to capture failures or errors when uploading files.  The process doesn't look and smell like SSIS.  Most of the code is encapsulated in text files instead of SSIS itself.  Difficult to use if you don't know the exact name of the file you are uploading or downloading.  A 3RD PARTY C# or VB.NET LIBRARY  Method: Install a SFTP or FTPS library and use a Script Task that references the library to upload the files.  (I've never tried this, so I'm going to guess at the pros and cons)  Pros: Probably easy to capture errors.  Should work well with variables, so it would probably be easy to use even when you don't know the exact name of the file you are uploading or downloading.  Cons: It's a script task combined with .NET libraries.  If you are using SSIS, then you probably are more comfortable with SSIS tasks then .NET code.  Script tasks are also difficult to troubleshoot since they don't have the same debugging tools and features as regular .NET projects.  Creates a dependency on 3rd party code that may not work between different versions of SQL Server.  To be fair, it is probably MORE likely to work between different versions of SQL Server than a 3rd party SSIS task library.  Another huge con -- I haven't found a free C# or VB.NET library that does this as of yet.  So if anyone knows of one, then please let me know! Which stats / gear can get the best our of wasteland exploration? Trying to get the best out of wasteland exploration here! I get it that you'd obviously need a big gun for survival out there, but apart from that, I'm wondering which stats / gear can get the best out of exploration.    How would you choose who to send out exploring from your dwellers. Which stat is the most important to choose explorers? Strength or endurance maybe? Does it make much of a difference equipping combat outfits? If so, whats the most important stat to boost through outfits? This is a question that's been nagging me for some time. I always thought that C++ should have been designed so that the delete operator (without brackets) works even with the new[] operator.  In my opinion, writing this:  int* p = new int;   should be equivalent to allocating an array of 1 element:  int* p = new int[1];   If this was true, the delete operator could always be deleting arrays, and we wouldn't need the delete[] operator.  Is there any reason why the delete[] operator was introduced in C++?  The only reason I can think of is that allocating arrays has a small memory footprint (you have to store the array size somewhere), so that distinguishing delete vs delete[] was a small memory optimization. Multiple Inheritance in C# Since multiple inheritance is bad (it makes the source more complicated) C# does not provide such a pattern directly. But sometimes it would be helpful to have this ability. For instance I'm able to implement the missing multiple inheritance pattern using interfaces and three classes like that: public interface IFirst { void FirstMethod(); } public interface ISecond { void SecondMethod(); }  public class First:IFirst  {      public void FirstMethod() { Console.WriteLine(&quot;First&quot;); }  }  public class Second:ISecond  {      public void SecondMethod() { Console.WriteLine(&quot;Second&quot;); }  }  public class FirstAndSecond: IFirst, ISecond {     First first = new First();     Second second = new Second();     public void FirstMethod() { first.FirstMethod(); }     public void SecondMethod() { second.SecondMethod(); } }  Every time I add a method to one of the interfaces I need to change the class FirstAndSecond as well. Is there a way to inject multiple existing classes into one new class like it is possible in C++? Maybe there is a solution using some kind of code generation? Or it may look like this (imaginary c# syntax): public class FirstAndSecond: IFirst from First, ISecond from Second { }  So that there won't be a need to update the class FirstAndSecond when I modify one of the interfaces.  EDIT Maybe it would be better to consider a practical example: You have an existing class (e.g. a text based TCP client based on ITextTcpClient) which you do already use at different locations inside your project.  Now you feel the need to create a component of your class to be easy accessible for windows forms developers. As far as I know you currently have two ways to do this:  Write a new class that is inherited from components and implements the interface of the TextTcpClient class using an instance of the class itself as shown with FirstAndSecond.  Write a new class that inherits from TextTcpClient and somehow implements IComponent (haven't actually tried this yet).   In both cases you need to do work per method and not per class. Since you know that we will need all the methods of TextTcpClient and Component it would be the easiest solution to just combine those two into one class. To avoid conflicts this may be done by code generation where the result could be altered afterwards but typing this by hand is a pure pain in the ass. Hash character in LaTeX Possible Duplicate:          How do you write the # character in LaTeX? Do stone quarries respawn in Hearthfire? My question is whether $x/x$ is always equal to $1$. I am mostly intersted in real numbers and particularly wonder whether $x/x$ is defined at $x=0$.  On one hand the division should simplify to $1$, on the other hand you should not be allowed to divide by zero.   I have been trying to find whether the simplification 'goes first' or whether the division causes trouble first, but it has proven impossible for me to find usefull search terms.     Note that this question arose after reading  and its first comment. Unwanted comma between author and year using citet command I've been using the biblatex package for a while, and since updating my TeX installation (post-el capitan upgrade) I have been experiencing the following.   If the following is typed:  Such and such has been said \citep[111]{citekey}.   The following text is displayed:  Such and such has been said (Author, 2016, p. 111).   And if the following is typed:  \citet[111]{citekey} has said such and such.   The following text is displayed:  Author, (2016, p. 111) has said such and such.   The citep command is working as I want it to, but I do not want a comma placed after the author's name when using the citet command. I would like it to display as follows:  Author (2016, p. 111) has said such and such.    If I use the \citeyearpar command, it is fine, but I would rather not have to type the author's name in manually.   Here is the command placed in the preamble:  \usepackage[backend=bibtex, style=authoryear-icomp, url=true, isbn=false, natbib=true, sortcites=true, block=space, pagetracker=false, loccittracker=constrict]{biblatex}   Here is an example of an entry in my bib file (made using BibDesk):  @article{poldrack2006, Author = {Poldrack, Russell}, Journal = {Trends in Cognitive Sciences}, Number = {2}, Pages = {59--63}, Title = {{Can cognitive processes be inferred from neuroimaging data?}}, Volume = {10}, Year = {2006}}   I have also tried changing the entry to the following:  @article{poldrack2006, Author = {Russell Poldrack}, Journal = {Trends in Cognitive Sciences}, Number = {2}, Pages = {59--63}, Title = {{Can cognitive processes be inferred from neuroimaging data?}}, Volume = {10}, Year = {2006}}   The bibliography entry appears as follows, and is fine:  Poldrack, Russell (2006). “Can cognitive processes be inferred from neuroimaging data?” In: Trends in Cognitive Sciences 10.2, pp. 59–63.  Thank you for any help that can be offered. A place where you could sit and see something like this (with a fall if you step further):    (Not looking for a technical term, just a common one).