Paamayim nekudotayims in PHP 5.2 - php-5.2

I can upgrade php 5.2 in my server. I have to make this server work today (the vacation I have planned tomorrow is under question because of this error) with new testlink. I am stuck with following error i.e Paamayim nekudotayims.
What changes I should do to resolve it?
This link contains the file with the bug.

The Scope Resolution Operator (also called Paamayim Nekudotayim) or in simpler terms, the double colon, is a token that allows access to static, constant, and overridden properties or methods of a class.
SO may be in your codes you try to call static method or properties with wrong operator.

From Wikipedia:
In PHP, the scope resolution operator is also called Paamayim
Nekudotayim (Hebrew: פעמיים נקודתיים‎), which means “double colon” in
Hebrew.
The name "Paamayim Nekudotayim" was introduced in the
Israeli-developed Zend Engine 0.5 used in PHP 3. Although it has been
confusing to many developers who do not speak Hebrew, it is still
being used in PHP 5, as in this sample error message:
$ php -r :: Parse error: syntax error, unexpected
T_PAAMAYIM_NEKUDOTAYIM
As of PHP 5.4, error messages concerning the scope resolution operator
still include this name, but have clarified its meaning somewhat:
$ php -r :: Parse error: syntax error, unexpected '::'
(T_PAAMAYIM_NEKUDOTAYIM)

Related

Ruby gem origami sign signature failed

I'm trying to make the PDF file with signature with origami gem, follow this example https://github.com/gdelugre/origami/blob/master/examples/signature/signature.rb
Now i just run this signature.rb and got error
[error] Breaking on: ">>\nendobj\n..." at offset 0x1f6f3
[error] Last exception: [Origami::InvalidObjectError] Failed to parse object (no:43,gen:0) -> [ArgumentError] wrong number of arguments (given 1, expected 0; required keyword: year)
I have no idea to move forward :'<
I also found the sign method of gem at https://github.com/gdelugre/origami/blob/master/lib/origami/signature.rb, and have take a look, I can't find any specific things to do :'<
Might this example is outdate?
The error message is known see https://github.com/gdelugre/origami/issues/80
A fix should be available https://github.com/gdelugre/origami/pull/74/commits
But has not been added so use newer file from the fork https://github.com/pocke/origami/tree/fix-ruby-2.7-kwargs-warnings
Specifically you need this updated file and may need to follow any other suggestions from above.
https://github.com/pocke/origami/raw/fix-ruby-2.7-kwargs-warnings/lib/origami/filters/predictors.rb
However it always worth looking for a fork with many more recent improvements such as
https://github.com/joelsondrew/origami

How to compile Fable.JsonConverter

I'd like to use Fable.JsonConverter.
My test code (almost copy this) FableJson.fs is below,
module FableJson
open Newtonsoft.Json
// Always use the same instance of the converter
// as it will create a cache to improve performance
let private jsonConverter = Fable.JsonConverter() :> JsonConverter
// Serialization
let toJson value =
JsonConvert.SerializeObject(value, [|jsonConverter|])
// Deserialization
let ofJson<'T> json =
JsonConvert.DeserializeObject<'T>(json, [|jsonConverter|])
and paket.dependencies file added nuget Fable.JsonConverter
source https://nuget.org/api/v2
storage:none
clitool dotnet-fable
nuget Fable.Core
nuget Fable.Import.Browser
nuget Fable.JsonConverter
and src/paket.references file added Fable.JsonConverter
dotnet-fable
Fable.Core
Fable.Import.Browser
Fable.JsonConverter
But cannnot compile.
~~~ snip ~~~
ERROR in ./src/FableJson.fs
d:/SRC/Repos/Fable/testJsonConverter/src/FableJson.fs(11,4): (11,57) error FABLE: Cannot find replacement for Newtonsoft.Json.JsonConvert::SerializeObject
# ./src/App.fs 6:0-48
# ./src/testJsonConverter.fsproj
# multi (webpack)-dev-server/client?http://localhost:8080 ./src/testJsonConverter.fsproj
ERROR in ./src/FableJson.fs
d:/SRC/Repos/Fable/testJsonConverter/src/FableJson.fs(15,4): (15,62) error FABLE: Cannot find replacement for Newtonsoft.Json.JsonConvert::DeserializeObject
# ./src/App.fs 6:0-48
# ./src/testJsonConverter.fsproj
# multi (webpack)-dev-server/client?http://localhost:8080 ./src/testJsonConverter.fsproj
ERROR in ./src/FableJson.fs
d:/SRC/Repos/Fable/testJsonConverter/src/FableJson.fs(7,28): (7,49) error FABLE: Cannot find replacement for Fable.JsonConverter::.ctor
# ./src/App.fs 6:0-48
# ./src/testJsonConverter.fsproj
# multi (webpack)-dev-server/client?http://localhost:8080 ./src/testJsonConverter.fsproj
What should I do?
#Maslow is right, with Fable 2 we removed Fable.JsonConverter in favour of the library created by the community.
Thoth.Json offers an Elm-like experience where you can decode the JSON manually or automatically depending on your preference. This library also offers a good error message
Fable.SimpleJson a library for parsing and transforming JSON in Fable projects
Thoth.Json is complemented with Thoth.Json.Net to allow you to use the same API on the backend.
I think Fable.SimpleJson also offer supports for the backend, but I am not sure.
You can use the JavaScript native API Fable.Core.JS.JSON.stringify and Fable.Core.JS.JSON.parse(x) but you will have to use unbox/cast to force the type of your Data which is not safe and can break easily.
See here: http://fable.io/docs/interacting.html#json-serialization
On the client side you should use the Fable.Core.JsInterop functions toJson and ofJson.
Fable.JsonConverter is for the server-side only. It uses Newtonsoft.Json, which is a .NET library that doesn't run in the browser. The compile error you're getting is because Fable doesn't know how to convert Newtonsoft.Json function calls into JavaScript.
It can be confusing when you're working with a language that works in one runtime (e.g. .NET) and also compiles into another one (e.g. JS), but you should try to keep a clear mental model where all of your code is running and therefore what it has access to.
The accepted answer is no longer valid. For newer Fable the only thing I've been able to find is Fable.Core.JS.JSON.stringify which calls the browser's built-in serializer.
Also Fable.Core.JS.JSON.parse(x) which returns obj.

Read a list from stream using Yap-Prolog

I want to run a (python3) process from my (yap) prolog script and read its output formatted as a list of integers, e.g. [1,2,3,4,5,6].
This is what I do:
process_create(path(python3),
['my_script.py', MyParam],
[stdout(pipe(Out))]),
read(Out, OutputList),
close(Out).
However, it fails at read/2 predicate with the error:
PL_unify_term: PL_int64 not supported
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe
I am sure that I can run the process correctly because with [stdout(std)] parameter given to process_create the program outputs [1,2,3,4,5,6] as expected.
Weird thing is that when I change the process to output some constant term (as constant_term) it still gives the same PL_int64 error. Appending a dot to the process' output ([1,2,3,4,5,6].) doesn't solve the error. Using read_term/3 gives the same error. read_string/3 is undefined in YAP-Prolog.
How can I solve this problem?
After asking at the yap-users mailing list I got the solution.
Re-compiled YAP Prolog 6.2.2 with libGMP option and now it works. It may also occur in 32-bit YAP.

Haskell-src-exts throws TemplateHaskell error

I'm trying to use the haskell-src-exts package to parse Haskell modules. Currently, I'm trying to parse the acme-io package's module, but I keep getting this error no matter what parse mode I try:
*** Exception: fromParseResult: Parse failed at [System/IO/Unsafe/Really/IMeanIt] (1:57): TemplateHaskell is not enabled
The module mentioned makes no references to TemplateHaskell, not in it's LANGUAGE pragma, nor is there a $ anywhere in the source file.
I'm wondering if my parse mode has something to do with it - here it is:
defaultParseMode { parseFilename = toFilePath m
, baseLanguage = Haskell2010
, extensions = []
, ignoreLanguagePragmas = True
, ignoreLinePragmas = True
, fixities = Nothing
}
I've also tried to replace the extensions field with knownExtensions from the parsing suite, without any luck.
This is a duplicate question of this answer - using the parseFile function fixed the issue. However, the reader should note that haskell-src-exts uses different parsing than GHC - I ran into another similar issue right after this, because haskell-src-exts can't handle multi-param contexts without -XMultiParamTypeClasses, yet GHC can, borking the parser if you're scraping Hackage. Hint may be a better option, can't say for sure though.

XML parsing in Ruby

I am using a REXML Ruby parser to parse an XML file. But on a 64 bit AIX box with 64 bit Ruby, I am getting the following error:
REXML::ParseException: #<REXML::ParseException: #<RegexpError: Stack overflow in
regexp matcher:
/^<((?>(?:[\w:][\-\w\d.]*:)?[\w:][\-\w\d.]*))\s*((?>\s+(?:[\w:][\-\w\d.]*:)?[\w:][\-\w\d.]*\s*=\s*(["']).*?\3)*)\s*(\/)?>/mu>
The call for the same is something like this:
REXML::Document.new(File.open(actual_file_name, "r"))
Does anyone have an idea regarding how to solve this issue?
I've had several issues for REXML, it doesn't seem to be the most mature library. Usually I use Nokogiri for Ruby XML parsing stuff, it should be faster and more stable than REXML. After installing it with sudo gem install nokogiri, you can use something like this to get a DOM instance:
doc = Nokogiri.XML(File.open(actual_file_name, 'rb'))
# => #<Nokogiri::XML::Document:0xf1de34 name="document" [...] >
The documentation on the official webpage is also much better than that of REXML, IMHO.
I almost immediately found the answer.
The first thing I did was to search in the ruby source code for the error being thrown.
I found that regex.h was responsible for this.
In regex.h, the code flow is something like this:
/* Maximum number of duplicates an interval can allow. */
#ifndef RE_DUP_MAX
#define RE_DUP_MAX ((1 << 15) - 1)
#endif
Now the problem here is RE_DUP_MAX. On AIX box, the same constant has been defined somewhere in /usr/include.
I searched for it and found in
/usr/include/NLregexp.h
/usr/include/sys/limits.h
/usr/include/unistd.h
I am not sure which of the three is being used(most probably NLregexp.h).
In these headers, the value of RE_DUP_MAX has been set to 255! So there is a cap placed on the number of repetitions of a regex!
In short, the reason is the compilation taking the system defined value than that we define in regex.h!
This also answers my question which i had asked recently:
Regex limit in ruby 64 bit aix compilation
I was not able to answer it immediately as i need to have min of 100 reputation :D :D
Cheers!

Resources