environment

passing arguments to function with a view to plotting with ggplot stat_function

佐手、 提交于 2019-12-30 11:15:57
问题 I have a function and a list of arguments. F <- function(a,b,...) {a^b+b/a} L <- list("a" = 5, "b" = 2, "c" = 0) I want to replace one of the arguments ("a", "b" or "c") with an unknown x (or "x") and plot with ggplot's stat_function. These computations are part of a shiny app, where the user will 1) select a parameter from a drop-down list, say "a", to be the unknown, and 2) use sliders to select values of the other parameters. The numbers 5, 2, 0 in L are the default parameter values, to be

passing arguments to function with a view to plotting with ggplot stat_function

淺唱寂寞╮ 提交于 2019-12-30 11:15:09
问题 I have a function and a list of arguments. F <- function(a,b,...) {a^b+b/a} L <- list("a" = 5, "b" = 2, "c" = 0) I want to replace one of the arguments ("a", "b" or "c") with an unknown x (or "x") and plot with ggplot's stat_function. These computations are part of a shiny app, where the user will 1) select a parameter from a drop-down list, say "a", to be the unknown, and 2) use sliders to select values of the other parameters. The numbers 5, 2, 0 in L are the default parameter values, to be

Set Windows System Variables with Java

佐手、 提交于 2019-12-30 10:58:02
问题 is there a way to add a specific directory to the Windows systemvariable %PATH%? This doesn't seem to work: String[] cmd = { "cmd", "/c", "set", "PATH=\"%PATH%;c:\\test\"" }; Runtime.getRuntime().exec( cmd ); c:\test\ doesn't appear in System.getenv("PATH"); or in the output of String[] cmd = { "cmd", "/c", "echo", "%PATH%" }; Runtime.getRuntime().exec( cmd ); What I need is to modify the %PATH%-variable for the current Java-Process under Windows. The reason is, that I need to load some

Expand environment variable for My Documents

无人久伴 提交于 2019-12-30 06:00:13
问题 I know I can read environment variables like this: Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); However, it would be really helpful to me if I could do something like this: Environment.ExpandEnvironmentVariables(@"%MyDocuments%\Foo"); Is there an environement variable that equals SpecialFolder.MyDocuments? I also tried to do something like this, but this doesn't lead to the expected result: Environment.ExpandEnvironmentVariables(@"%USERPROFILE%\My Documents\Foo"); This

Expand environment variable for My Documents

大兔子大兔子 提交于 2019-12-30 05:59:09
问题 I know I can read environment variables like this: Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); However, it would be really helpful to me if I could do something like this: Environment.ExpandEnvironmentVariables(@"%MyDocuments%\Foo"); Is there an environement variable that equals SpecialFolder.MyDocuments? I also tried to do something like this, but this doesn't lead to the expected result: Environment.ExpandEnvironmentVariables(@"%USERPROFILE%\My Documents\Foo"); This

Rails: Make this rake task aware that it is in the test environment

偶尔善良 提交于 2019-12-30 02:50:14
问题 I have the following rake task defined in my lib/tasks folder: namespace :db do namespace :test do task :prepare => :environment do Rake::Task["db:seed"].invoke end end end Now, what this does is seed the test DB when I run rake db:test:prepare . I do this because I have some basic records that must exist in order for the app to function, so they're not optional and can't really be mocked. Separately, I have a model that uses S3 for asset storage in development and production, but I don't

No 'server' JVM at '…'

一世执手 提交于 2019-12-29 03:35:06
问题 I'm running a java application that we distribute as a server-side system. I'm trying to write a launcher ("write" is somewhat of an overstatement here, I'm basically just copying the Java.exe file so that we can get the desired name in the process explorer of windows). This exe is in our bin/ directory of our application file tree. Now, we also have a jre/ directory in our file tree, which is where Java.exe actually resides (we ship our product with the Java environment). When I use Java.exe

Getting all the total and available space on Android

余生颓废 提交于 2019-12-28 02:07:31
问题 To my knowledge, on Android, there is: Internal memory for apps and cache Internal SD Card on some phones (not removable) External SD Card for music and photos (removable) How do I get the total and available for each with a check that they exist (some phones do not have an internal SD Card) Thanks 回答1: Here is how you get internal storage sizes: StatFs statFs = new StatFs(Environment.getRootDirectory().getAbsolutePath()); long blockSize = statFs.getBlockSize(); long totalSize = statFs

Rails.env undefined in Rails 2

妖精的绣舞 提交于 2019-12-25 16:45:07
问题 I have an older application running Ruby on Rails 2.2, and I'm having trouble getting a gem to work because it can't find the current environment with Rails.env : $ script/console >> Rails.env NoMethodError: undefined method `env' for Rails:Module from (irb):1 The gem is set up to use Rails.env when Rails is defined, and RAILS_ENV when it's not. But I seem to have a Rails object without an env method (even though I read that method was added in Rails 2). Any idea what's going on? 回答1: The

Environment variables within a function

做~自己de王妃 提交于 2019-12-25 05:43:49
问题 I am trying to have consistent results within a function that I am using. However, since an array does not remember timezone info, this is a little harder than I expected. > Sys.setenv(TZ = "") > ISOdate(2015,1,1,1,tz='UTC') [1] "2015-01-01 01:00:00 UTC" > c(ISOdate(2015,1,1,1,tz='UTC')) [1] "2015-01-01 02:00:00 CET" > tz(c(ISOdate(2015,1,1,1,tz='UTC'))) [1] "" As you can see, the array drops the timezone information. This is annoying since other functions like day() of lubridate change