After update of the JSON module i get the following warning - json

After update of the JSON module from version 1.54 to 2.07 i get the following warning in my logs:
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::mypath_myfile_2epl::from_json: none vs ($#) at mypath_myfile.pl line 6.
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::mypath_myfile_2epl::to_json: none vs ($#) at mypath_myfile.pl line 6.
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::mypath_myfile_2epl::encode_json: none vs ($) at mypath_myfile.pl line 6.
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::mypath_myfile_2epl::decode_json: none vs ($) at mypath_myfile.pl line 6.
in line 6 of myfile.pl use JSON; is called
Any ideas what's going wrong here or how to solve this issue?

Check the incompabilities between JSON 1 .x and 2.x at CPAN.
What do you include before JSON? Which modperl version are you running?

Sounds like you also need to update your JSON::XS and/or JSON::PP to a compatible version.

Related

Is there a Perl strict symbol resolution syntax for functions?

I want to know how to force the resolution of subs at compile time.
For some background, with perl, I can resolve package symbols strictly at compile-time using a :: affixed to the end of the package name. For example.
perl -wE'use warnings FATAL => "bareword"; die 7; Foo::; die 42'
Bareword "Foo::" refers to nonexistent package at -e line 1.
You'll notice in the above code, we didn't die with 7 or 42. We died before the run-time phase. This only works to resolve the package name. I can use a method resolution operator (->) with the above syntax and resolve a function name in run-time,
perl -E'use warnings FATAL => "bareword"; die 7; Foo::->bar(); die 42'
Bareword "Foo::" refers to nonexistent package at -e line 1.
But this isn't exactly what I want,
If I declare a package Foo that lacks a sub bar and I want to call the non-existent function bar inside that package, I will no longer get a compile-time error,
perl -E'package Foo {}; use warnings FATAL => "bareword"; die 7; Foo::->bar(); die 42'
7 at -e line 1.
You can see here, when () is affixed to the end of the symbol it resolves in run-time; but, when :: is affixed to the end of a symbol though it's assumed to be a package name it's resolved in compile-time.
The -> operator is using run-time method resolution. It searches #ISA, and also provides a first argument of the class.
What I would like is to die if Foo doesn't have bar sub in compile-time.
Calling a function without parentheses will attempt to resolve the symbol in the parsing phase, this also includes fully-qualified symbols. The tricky part is what happens when it doesn't resolve. Under use strict 'subs', it will die due to bareword strings being disallowed.
use strict;
use warnings;
Foo::bar; # Bareword "Foo::bar" not allowed while "strict subs" in use
This gets trickier when there are arguments. It still attempts to parse it as a bareword string, and so may report a syntax error when it's followed by something that wouldn't make sense there.
use strict;
use warnings;
Foo::bar 42; # Number found where operator expected
Other times it parses it as an indirect method call, which then postpones the error to runtime, or may even end up doing something you didn't expect.
use strict;
use warnings;
my $foo;
Foo::bar $foo; # Can't call method "bar" on an undefined value
Basically, Perl tries really hard to figure out what the syntax was supposed to mean and so doesn't always end up with a useful error message when it doesn't work.

How to solve or suppress wall of warnings using any pystan code

When I run any pystan code, the output is what I expect, but I get a wall of warnings.
I've tried updating pystan and cython, as these are mentioned in the wall of warnings. My pystan is now version 2.17.1 and cython 0.29.2. I'm running python3.7.
import pystan
model_code = 'parameters {real y;} model {y ~ normal(0,1);}'
model = pystan.StanModel(model_code=model_code) # this will take a minute
y = model.sampling(n_jobs=1).extract()['y']
y.mean() # should be close to 0
The error message that I get starts with:
/home/femke/anaconda3/lib/python3.7/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/tmp8_plkepg/stanfit4anon_model_5944b02c79788fa0db5b3a93728ca2bf_5335140894361802645.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/femke/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1823:0,
from /home/femke/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
from /home/femke/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from /tmp/tmp8_plkepg/stanfit4anon_model_5944b02c79788fa0db5b3a93728ca2bf_5335140894361802645.cpp:688:
/home/femke/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by " \
^~~~~~~
In file included from /home/femke/anaconda3/lib/python3.7/site-packages/pystan/stan/lib/stan_math/lib/boost_1.66.0/boost/numeric/ublas/matrix.hpp:19:0,
from /home/femke/anaconda3/lib/python3.7/site-packages/pystan/stan/lib/stan_math/lib/boost_1.66.0/boost/numeric/odeint/util/ublas_wrapper.hpp:24,
from /home/femke/anaconda3/lib/python3.7/site-packages
Is this something to worry about? If not, how do I specifically disable these warnings, but not from other parts of my code? If so, what should I change.
Edit: after having read the question Cython Numpy warning about NPY_NO_DEPRECATED_API when using MemoryView, I still don't know how to safely disable this warning.

Using stdev command in Tcl math package

How do I use the stdev command in the ::math::statistics package? I have tried the following but none work
package require math
package require math::statistics
%eval ::math::statistics::stdev $my
invalid command name "::math::statistics::stdev"
% eval ::math::stdev $my
invalid command name "::math::stdev"
% eval ::statistics::stdev $my
invalid command name "::statistics::stdev"
Where $my is a list of numbers.
The correct way to use that code is:
package require math::statistics
set values {1 2 3 4 5}
set SD [::math::statistics::stdev $values]
I don't know why you were getting invalid command name "::math::statistics::stdev" as an error; I can only guess that you're getting a very old version of the package (it works with version 0.8.0).
What you are looking for is:
set standard_deviation [math::statistics::stdev $my]

Strict Standards: Creating default object from empty value. What does this error message mean?

I get this error message:
"Strict Standards: Creating default object from empty value in /opt/lampp/htdocs/projects/nusoap/lib/nusoap.php on line 76 "
The code on line 76:
$GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel = 9;
What does this mean? And how can I fix it.
Looking forward to your reply
Regards
SirBT
You can set the error_reporting level to strict just before include nusoap library:
ini_set('error_reporting', E_STRICT);
require 'nusoap.php';
I fixed the problem by replacing the nusoap.php file with a an older version specifically nusoap.php 0.95.
The PHP environment I work in is: PHP 5.3.8, nusoap.php 0.95 seems to be compatible with PHP 5.3.8. My conclusion is that the: "Strict Standards: Creating default object from empty value in /opt/lampp/htdocs/projects/nusoap/lib/nusoap.php on line 76" is a compatibility issue.

Warning INI parameter missing in Z3 3.2?

According to the list of INI parameters there should be a boolean WARNING flag, but setting it in Z3 3.2 (x64_mt) via
(set-option :WARNING false)
yields unsupported for both spellings WARNING and warning.
Are the docs outdated or I am doing something wrong here?
[EDIT]
According to the release notes of Z3 2.17 the option should be set via
(set-option WARNING <flag>)
but trying
(set-option WARNING false)
yields
(error "line 1 column 13: invalid command argument, keyword expected")
Ok, seems as if the docs are outdated. I finally found
(set-option :print-warning false)
in this answer and it works.