index_max not a member of arma in RcppArmadillo - rcpp

When I compile the following code in Rstudio , which is an example in the armadillo documentation, I get a message of error:
Code:
arma::vec v = arma::randu<arma::vec>(10);
arma::uword i = arma::index_max(v);
The error message is:
'index_max' is not a member of 'arma'

Which version?
There was an (upstream) oversight in 0.7.200.2.0 so maybe try 0.7.300.1.0 from the RcppCore drat repo as discussed in this announcement on rcpp-devel.

Related

bioMart Package error: error in function useDataset

I am trying to use the biomaRt package to access the data from Ensembl, however I got error message when using the useDataset() function. My codes are shown below.
library(httr)
listMarts()
ensembl = useMart("ENSEMBL_MART_ENSEMBL")
listDatasets(ensemble)
ensembl = useDataset("hsapiens_gene_ensembl",mart = ensemble)
When I type useDataset function i got error message like this:
> ensembl = useDataset("hsapiens_gene_ensembl",mart = ensembl)
Ensembl site unresponsive, trying asia mirror
Error in textConnection(text, encoding = "UTF-8") :
invalid 'text' argument
and sometimes another different error message showed as:
> ensembl = useDataset("hsapiens_gene_ensembl",mart = ensembl)
Ensembl site unresponsive, trying asia mirror
Error in textConnection(bmResult) : invalid 'text' argument
it seems like that the mirror automatically change to asia OR useast OR uswest, but the error message still shows up over and over again, and i don't know what to do.
So if anyone could help me with this? I will be very grateful for any help or suggestion.
Kind regards Riley Qiu, Dongguan, China

module 'tensorboard.summary._tf.summary' has no attribute 'import_event'

I'm playing around a code from a book, however, there is an error that I can't manage to solve. This is my code:
from tensorboard.plugins.hparams import api_pb2
from tensorboard.plugins.hparams import summary as hparams_summary
def run_experiment(run_dir, hparams):
writer = tf.summary.create_file_writer(run_dir)
summary_start = hparams_summary.session_start_pb(hparams=hparams)
with writer.as_default():
accuracy = train_test_hp(hparams)
summary_end = hparams_summary.session_end_pb(api_pb2.STATUS_SUCCESS)
tf.summary.scalar('accuracy',accuracy,step=1,description="The accuracy")
tf.summary.import_event(tf.compat.v1.Event(summary=summary_start).SerializeToString())
tf.summary.import_event(tf.compat.v1.Event(summary=summary_end).SerializeToString())
return accuracy
This is the error I got:
module 'tensorboard.summary._tf.summary' has no attribute
'import_event'
I'm using colab. Please give me ideas about resolving the error. Your help means a lot to me!
Changing lines:
tf.summary.import_event(tf.compat.v1.Event(summary=summary_start).SerializeToString())
tf.summary.import_event(tf.compat.v1.Event(summary=summary_end).SerializeToString())
to:
tf.compat.v1.summary.Event(summary=summary_start).SerializeToString()
tf.compat.v1.summary.Event(summary=summary_end).SerializeToString()
solves the problem.

Error when acquiring a lock in julia 1.5.2

I am following the documentation to acquire a lock on a variable but it fails:
a = 0
lock(a) do
a += 1
end
Error message:
ERROR: MethodError: no method matching lock(::var"#3#4", ::Int64)
Closest candidates are:
lock(::Any, ::Base.GenericCondition) at condition.jl:78
lock(::Any, ::Base.AbstractLock) at lock.jl:158
lock(::Any, ::WeakKeyDict) at weakkeydict.jl:76
Stacktrace:
[1] top-level scope at REPL[3]:1
The error message is clear but why would the code provided in the documentation fail. Moreover, not sure where to look for the detailed documentation about the lock function.
OK, I figured it out:
a = 0
l = ReentrantLock()
lock(l) do
global a # Needed if using REPL
a += 1
end

Problem with billing_agreement.cancel(). ('cancel() missing 1 required positional argument: 'attributes')

SDK/Library version: 1.13.1
Environment: Sandbox
PayPal-Debug-ID values: None
Language, the language version, and OS: Python, Ubuntu
Issue description:
I'm getting the following error when I try to cancel a billing agreement.
The error:
TypeError: cancel() missing 1 required positional argument: 'attributes'
My code:
billing_agreement = BillingAgreement.find(billing_id)
if billing_agreement.cancel():
print(billing_agreement)
else:
flash('We are having some difficulties canceling your subscription, please try again later.', 'fails')
return redirect(url_for('settings.settingspage'))
I'm getting the error because I need something in the attribute's value but I don't know what should I assign to the variable.
GitHub issue: https://github.com/paypal/PayPal-Python-SDK/issues/297
After some digging and looking at the documentation samples I found a sample about the cancel option and what I needed to assign to the attribute value was a cancel_note.
The code:
cancel_note = {"note": "Canceling the agreement"}
user = Users.query.filter_by(id=ID).first()
billing_id = Subscriptions.query.filter_by(email=user.email).filter_by(active=1).first().order_id
billing_agreement = BillingAgreement.find(billing_id)
if billing_agreement.cancel(cancel_note):
flash('Subscription canceled with success.', 'success')
return redirect(url_for('settings.settingspage'))
else:
flash('We are having some difficulties canceling your subscription, please try again later.', 'fails')
return redirect(url_for('settings.settingspage'))
The documentation sample

TypeError: tf.broadcastTo is not a function

Using tensorflowjs (tfjs-node#1.2.3),
const tf = require('#tensorflow/tfjs-node');
...
imageNetStats = tf.broadcastTo(imageNetStats, [h, w, 3])
gives error TypeError: tf.broadcastTo is not a function
This function was working yesterday and nothing has changed.
broadcastTo has been added to the API only since the version 1.5.x. This explains why the function is not found since you are using the version 1.2.3

Resources