environments

Different environments on Firebase web application

让人想犯罪 __ 提交于 2020-01-24 05:47:27
问题 I am building a web application with Firebase. Currently I can say that I do have two stages - development, the firebase serve which runs the localhost and firebase deploy --only hosting which uploads the web application on Firebase hosting. Everything is fine with that, but I do not see this as a professional solution. The problem that I see is that, my local environment and the live web application share the same database. I did quite some research on the topic and I understood that there

R: How make dump.frames() include all variables for later post-mortem debugging with debugger()

眉间皱痕 提交于 2020-01-14 12:44:08
问题 I have the following code which provokes an error and writes a dump of all frames using dump.frames() as proposed e. g. by Hadley Wickham: a <- -1 b <- "Hello world!" bad.function <- function(value) { log(value) # the log function may cause an error or warning depending on the value } tryCatch( { a.local.value <- 42 bad.function(a) bad.function(b) }, error = function(e) { dump.frames(to.file = TRUE) }) When I restart the R session and load the dump to debug the problem via load(file = "last

variable-scope in R functions

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-14 07:58:30
问题 I'd like to specify functions in a flexible way. How can I make sure that the environment of a given function does not change when I create another function just after it. To illustrate, this works properly: make.fn2 <- function(a, b) { fn2 <- function(x) { return( x + a + b ) } return( fn2 ) } a <- 2; b <- 3 fn2.1 <- make.fn2(a, b) fn2.1(3) # 8 fn2.1(4) # 9 a <- 4 fn2.2 <- make.fn2(a, b) fn2.2(3) # 10 fn2.1(3) # 8 This does not make.fn2 <- function(a, b) { fn2 <- function(x) { return( x + a

Can you more clearly explain lazy evaluation in R function operators?

流过昼夜 提交于 2019-12-30 05:55:11
问题 If I create a function as follows: what_is_love <- function(f) { function(...) { cat('f is', f, '\n') } } And call it with lapply : funs <- lapply(c('love', 'cherry'), what_is_love) I get unexpected output: > funs[[1]]() f is cherry > funs[[2]]() f is cherry But note that this is not the case when you do not use lapply : > f1 <- what_is_love('love') > f2 <- what_is_love('cherry') > f1() f is love > f2() f is cherry What gives? I know that funs <- lapply(c('love', 'cherry'), what_is_love) can

Why does as.formula only work inside lm() inside with()?

自作多情 提交于 2019-12-24 06:54:31
问题 Working with R, this is a real WTF: R> f_string <- 'Sepal.Length ~ Sepal.Width' R> l <- with(iris, lm(as.formula(f_string))) # works fine R> f_formula <- as.formula(f_string) R> l <- with(iris, lm(f_formula)) Error in eval(expr, envir, enclos) : object 'Sepal.Length' not found Why does as.formula have to be inside the lm() call? I get it that this is a question about which environment things are evaluated in, because this works: R> f_formula <- with(iris, as.formula(f_string)) R> lm(f_formula

Why does as.formula only work inside lm() inside with()?

梦想与她 提交于 2019-12-24 06:51:55
问题 Working with R, this is a real WTF: R> f_string <- 'Sepal.Length ~ Sepal.Width' R> l <- with(iris, lm(as.formula(f_string))) # works fine R> f_formula <- as.formula(f_string) R> l <- with(iris, lm(f_formula)) Error in eval(expr, envir, enclos) : object 'Sepal.Length' not found Why does as.formula have to be inside the lm() call? I get it that this is a question about which environment things are evaluated in, because this works: R> f_formula <- with(iris, as.formula(f_string)) R> lm(f_formula

.htaccess in Multiple Environments

﹥>﹥吖頭↗ 提交于 2019-12-21 03:36:25
问题 I know similar questions have been asked before but I haven't found any really specific answers for my situation. I have an ExpressionEngine site running on multiple environments (local, dev, production), and each of those environments needs different .htaccess rules: All Environments Remove index.php Set a 404 file Set 301 Redirects Development Password Protect with .htpasswd Force HTTPS protocol Prevent search engine indexing with X-Robots-Tag Production Force HTTPS protocol Redirect non

Grails auto reload functionality in run-app on a custom environment

烂漫一生 提交于 2019-12-18 03:51:42
问题 When running a custom environment with grails via grails -Dgrails.env=custom run-app it appears that the auto reload / hot deploy is turned off, does anyone know how to arbitrarily enable this for any given environment, not just dev, which appears to be the only env where it is actually on by default? 回答1: I resolved this by adding the following to my env(custom in this case) Config.groovy: custom { disable.auto.recompile=false grails.gsp.enable.reload=true } You can also add the -reloading

Force R function call to be self-sufficient

痞子三分冷 提交于 2019-12-11 02:12:25
问题 I'm looking for a way to call a function that is not influenced by other objects in .GlobalEnv . Take a look at the two functions below: y = 3 f1 = function(x) x+y f2 = function(x) { library(dplyr) x %>% mutate(area = Sepal.Length *Sepal.Width) %>% head() } In this case: f1(5) should fail, because y is not defined in the function scope f2(iris) should pass, because the function does not reference variables outside its scope Now, I can overwrite the environment of f1 and f2 , either to baseenv

NuGet Server for multiple environments?

耗尽温柔 提交于 2019-12-05 05:09:35
问题 I was looking into setting up a NuGet Server for a private feed, which seems easy enough (there is a step-by-step guide). The problem I foresee is that it doesn't look like it is made to support multiple environments. Is there built-in functionally around the idea of "promoting" packages through multiple environments (Test/Beta/Production)? Do I have to host multiple servers (one per environment)? Is there another solution to this that I haven't though of? My main concern is that we update a