Change character set on Microsoft R Server 9.0.1 - character-encoding

Q: How to you change/update the character set on Microsoft R Server?
Issue: I am trying to read a CSV that is delimited with '§' but the R Server is not able to interperet the '§' character when I work remotely. Similarly for other characters like 'ø' , 'æ' and 'å'. When I work locally it's not an issue.
For example:
This works fine:
> x <- '§'
> x
[1] "§"
But when i login remotely to the server the following happens:
REMOTE> x <- '§'
REMOTE> x
[1] "?"
Setup: I am running Microsoft R Server 9.0.1 on Windows Server 2012 R2
Detailed sessionInfo:
REMOTE> sessionInfo() R version 3.3.2 (2016-10-31) Platform:
x86_64-w64-mingw32/x64 (64-bit) Running under: Windows Server >= 2012
x64 (build 9200)
locale: [1] LC_COLLATE=Norwegian (Bokm�l)_Norway.1252 [2]
LC_CTYPE=Norwegian (Bokm�l)_Norway.1252 [3] LC_MONETARY=Norwegian
(Bokm�l)_Norway.1252 [4] LC_NUMERIC=C
[5] LC_TIME=Norwegian (Bokm�l)_Norway.1252
attached base packages: [1] stats graphics grDevices utils
datasets methods base
other attached packages: [1] RevoUtilsMath_10.0.0 RevoUtils_10.0.2
RevoMods_10.0.0 [4] RevoScaleR_9.0.1 lattice_0.20-34
rpart_4.1-10
loaded via a namespace (and not attached): [1] R6_2.2.0
tools_3.3.2 CompatibilityAPI_1.1.0 [4] codetools_0.2-15
grid_3.3.2 iterators_1.0.8 [7] foreach_1.4.3
mrupdate_1.0.0 jsonlite_1.1

In addition to installing version 9.1 of Microsoft R Server I also had to make the following change for the server to work correctly with remote login:
Stop the service 'RServe9.0.0.0'
and go to C:\Program Files\Microsoft\R Server\R_SERVER\o16n\RServe\RScripts\source.R on the compute nodes
and change
```
#add more here if necessary......
```
to
```
#add more here if necessary......
options(encoding = "UTF-8")
```
and then start that service again, you should be able to use §.
Thanks to Microsoft for providing this fix.

This is a known bug, and has been patched in Microsoft R Server 9.1, please upgrade to solve your issue.

Related

Cannot connect to TWS using IBrokers with R

library(IBrokers)
tws <- twsConnect(port=7496)
Error in socketConnection(host = host, port = port, open = "ab", blocking = blocking) :
cannot open the connection
In addition: Warning message:
In socketConnection(host = host, port = port, open = "ab", blocking = blocking) :
localhost:7496 cannot be opened
I have checked my Global Configurations in the TWS. The port is in fact 7496.
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 20
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8
[8] LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] IBrokers_0.9-12 xts_0.12-0 zoo_1.8-8
loaded via a namespace (and not attached):
[1] compiler_3.6.3 tools_3.6.3 grid_3.6.3 lattice_0.20-40
I am using the latest of Linux Mint. My IB account has been approved and funded.

Arangodb container reaches memory limit and crashes while filtering using 'path' for graph traversal

My Environment
ArangoDB Version: 3.6.2
Storage Engine: RocksDB
Deployment Mode: Single Server
Deployment Strategy: Manual Start in Docker
Infrastructure: Own
Operating System: Linux version 4.4.0-154-generic (gcc version 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) )
Total RAM in your machine: 4GB
Disks in use: HDD
Used Package: Docker-Official Docker library
My Problem:
I have a graph with 60k nodes and 4*60k edges. Whenever I try using 'path' for Filter or Return, the memory limit reaches, arangodb container crashes and it gets restarted. However, if I don't use 'path' and use 'vertex' or 'edge' only for filter or return the query executes and produces result as expected. This issue is seen in version 3.6.2.
However, in arangodb 3.1.18 this issue is not seen and everything is
working fine.
Sample Query:
FOR v, e, p IN 6 OUTBOUND "root_node" GRAPH "my_graph_db"
FILTER (
LENGTH(p.edges) == 6 &&
LIKE (p.edges[3]._from,"Data_level_3%",true) &&
(LIKE (p.edges[3]._to, "Data_level_4%") || LIKE (p.edges[3]._to, "Data_4%")) &&
...................................................................
)
LIMIT 0,10
RETURN {
result: Merge(
{data: v},
{parent_id: p.edge[5]._id}
),
.................
}
Expected result:
The arangodb container should not reach memory limit crash. 'Path' attributes needs to accessed while doing queries.
Please refer to https://github.com/arangodb/arangodb/issues/11277

Why is Ruby failing to connect to my Tor network?

I’m using Ruby on Rails 4.2.7 on Mac El Capitan and just installed the Tor browser (v 6.0.4). I fired up my Tor browser, have verified its running by viewing a couple of web pages, but using this gem — https://github.com/dryruby/tor.rb , when I run my script, Ruby doesn’t believe Tor is running
require 'tor'
...
puts "avaailble: #{Tor.available?}"
puts "version: #{Tor.version}"
Returns
avaailble: false
version:
Indeed, when I try and make a Tor request using the https://github.com/brunogh/tor_requests gem, the web page request returns immediately, leading me to believe the Tor network isn’t being used because in a Tor browser it takes much longer (here is the code I’m using to amen a web page request) …
uri = URI.parse(url)
Net::HTTP.SOCKSProxy('127.0.0.1', 9150).start(uri.host, uri.port) do |http|
f = http.get(uri.path)
end
How do I make my Ruby/Rails code connect to my locally running Tor network?
Edit: In respnse to the answer given, here is what I set my PATH and DYLD_LIBRARY_PATH variables to …
localhost:myproject davea$ echo $PATH
/usr/local/opt/coreutils/libexec/gnubin:/opt/local/bin:/opt/local/sbin:/Users/davea/.rvm/gems/ruby-2.3.0/bin:/Users/davea/.rvm/gems/ruby-2.3.0#global/bin:/Users/davea/.rvm/rubies/ruby-2.3.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mysql/bin/:/opt/gradle-2.7/bin:/opt/apache-maven-3.3.3/bin:/Users/ davea/.rvm/bin:/usr/local/mysql/bin:/Applications/TorBrowser.app/Contents/MacOS/Tor:/Users/davea/.rvm/bin:/usr/local/mysql/bin:/Applications/TorBrowser.app/Contents/MacOS/Tor
localhost:myproject davea$ echo $DYLD_LIBRARY_PATH
/Applications/TorBrowser.app/Contents/MacOS/Tor:/usr/local/mysql/lib:/usr/local/mysql/lib:
and here is ht output in my Rails console trying the commands listed …
localhost:myproject davea$ rails console
Running via Spring preloader in process 49987
Loading development environment (Rails 4.2.7.1)
2.3.0 :001 >
2.3.0 :002 > Tor::Config::CONFDIR = '/Applications/TorBrowser.app//Contents/MacOS/Tor'
(irb):2: warning: already initialized constant Tor::Config::CONFDIR
/Users/davea/.rvm/gems/ruby-2.3.0/gems/tor-0.1.2/lib/tor/config.rb:21: warning: previous definition of CONFDIR was here
=> "/Applications/TorBrowser.app//Contents/MacOS/Tor"
2.3.0 :003 > Tor.available?
Here is how you can make brunogh/tor_requests work with Tor Browser (easy):
require 'tor_requests'
Tor.configure do |config|
config.ip = "127.0.0.1"
config.port = "9150"
config.add_header('User-Agent', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/48.0')
end
res = Tor::HTTP.get(URI('https://drew-phillips.com/ip-info/'))
p res.code
p res.body
To get dryruby/tor working involved a bit more work:
It depends on your ENV PATH variable to find the Tor binary and Tor browser has some libraries (at least on Linux) within it's path that aren't found if you try to execute it directly. Seems this should support allowing you to add the path in code instead of relying on PATH in my opinion.
Trying to run Tor Browser's tor binary from the console yields (more on this later, may not apply to Mac):
tor: symbol lookup error: tor-browser_en-US/Browser/TorBrowser/Tor/tor: undefined
symbol: evutil_secure_rng_set_urandom_device_file
Also, installing the Gem from source doesn't give us the latest version available on GitHub and there appears to be a fix to the version method that isn't included with the Gem version 0.1.2. Because of this I pulled the source and tell the program to load the Gem from a custom path.
The working code:
require 'rubygems'
$:.unshift "./tor/lib"
require 'tor'
Tor::Config::CONFDIR = '/home/me/tor-browser_en-US/Browser/TorBrowser/Data/Tor'
p Tor::Config::CONFDIR
p Tor.available?
p Tor.version
Now, in order to have it run successfully, you'll need to set your PATH and LD_LIBRARY_PATH (on Mac this is DYLD_LIBRARY_PATH I believe).
So I run the Ruby code like this:
PATH=/home/me/tor-browser_en-US/Browser/TorBrowser/Tor:$PATH \
LD_LIBRARY_PATH=/home/me/tor-browser_en-US/Browser/TorBrowser/Tor:$LD_LIBRARY_PATH \
ruby tor.rb
This puts Tor Browser as the first search path for binaries and libraries.
Then with this I was able to get the following output:
true
"0.2.8.6"
Hope that helps!

RNeo4j errors: Could not resolve host: http when issue graph = startGraph("http:/localhost:7474/db/data") in RStudio

When I tried to call RNeo4j's startGraph, it keeps giving me the error Could not resolve host: http. I verified the neo4j server is working, and browsers from both local and remote hosts returns correct answers, but not from the RStudio. I've tried R 3.1.2 and R 3.1.0. Both gave the same response. The sessionInfo() shows the necessary libraries are loaded:
> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RJSONIO_1.3-0 RNeo4j_1.0 rJava_0.9-6 RCurl_1.95-4.5
[5] rjson_0.2.15 bitops_1.0-6
loaded via a namespace (and not attached):
[1] codetools_0.2-8 devtools_1.6.1 httr_0.6.1 igraph_0.7.1
[5] pryr_0.1 Rcpp_0.11.3 stringr_0.6.2 tools_3.1.0
> graph = startGraph("http:/localhost:7474/db/data")
Error in function (type, msg, asError = TRUE) :
Could not resolve host: http
>
Make sure you include the trailing forward slash and use http://:
graph = startGraph("http://localhost:7474/db/data/")
Let me know if that works.

RStudio server ROracle throws : Error in .oci.Driver() : ROracle internal error [rociDrvInit, 1, -1]

I've setup RStudio server and pointed it to use an existing R (2.13) installation. ROracle works fine when accessed from R, but the same does not work from RStudio web-interface.
> library(ROracle)
Loading required package: DBI
> drv <- dbDriver("Oracle")
Error in .oci.Driver() : ROracle internal error [rociDrvInit, 1, -1]
I installed RStudio server with --nodeps and later pointed it to an existing installation of R
by setting the values in /etc/rstudio/rserver.conf file.
Tried getting help from RStudio support, but was pointed toward "Stack Overflow".
http://support.rstudio.org/help/discussions/problems/1879-rstudio-roracle-internal-error
Thanks in advance,
Sai.
Finally got it working with help from Denis Mukhin on the Oracle forums. In particular, ORACLE_HOME and OREACLE_SID were missing in the RStudio environment. Adding the following lines to ~/.Renviron fixed it:
ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
ORACLE_SID=<your sid (the default is usually orcl)>
export ORACLE_HOME ORACLE_SID

Resources