R command for setting working directory to source file location in Rstudio

To get the location of a script being sourced, you can use utils::getSrcDirectory or utils::getSrcFilename. So changing the working directory to that of the current file can be done with: setwd(getSrcDirectory()[1]) This does not work in RStudio if you Run the code rather than Sourceing it. For that, you need to use rstudioapi::getActiveDocumentContext. setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) This … Read more

Casperjs/PhantomJs vs Selenium

They are attacking different problems. Since PhantomJS runs perfectly on the command-line, it is suitable as the first layer of smoke testing, whether as part of development workflow and/or in a continuous integration server. Selenium targets multiple browsers and hence it is very useful to ensure cross-browser consistency and carry out extensive testings across different … Read more

Running script upon login in mac OS X [closed]

Follow this: start Automator.app select Application click Show library in the toolbar (if hidden) add Run shell script (from the Actions/Utilities) copy & paste your script into the window test it save somewhere (for example you can make an Applications folder in your HOME, you will get an your_name.app) go to System Preferences -> Users … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)