Can't run php spark serve, after upgrading php 8 - codeigniter-4

PHP Deprecated: Required parameter $userAgent follows optional parameter $body in /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/vendor/codeigniter4/framework/system/HTTP/IncomingRequest.php on line 161
Deprecated: Required parameter $userAgent follows optional parameter $body in /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/vendor/codeigniter4/framework/system/HTTP/IncomingRequest.php on line 161
CodeIgniter CLI Tool - Version 4.0.4 - Server-Time: 2021-05-10 04:44:31am
An uncaught Exception was encountered
Type: ErrorException
Message: Required parameter $from follows optional parameter $verbs
Filename: /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/vendor/codeigniter4/framework/system/Router/RouteCollection.php
Line Number: 1017
Backtrace:
-365 - /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/vendor/codeigniter4/framework/system/Autoloader/Autoloader.php::errorHandler
-365 - /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/vendor/codeigniter4/framework/system/Autoloader/Autoloader.php::require_once
-296 - /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/vendor/codeigniter4/framework/system/Autoloader/Autoloader.php::requireFile
-258 - /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/vendor/codeigniter4/framework/system/Autoloader/Autoloader.php::loadInNamespace
-699 - /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/vendor/codeigniter4/framework/system/Config/Services.php::loadClass
-123 - /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/vendor/codeigniter4/framework/system/Config/BaseService.php::routes
-696 - /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/vendor/codeigniter4/framework/system/Config/Services.php::getSharedInstance
-4 - /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/app/Config/Routes.php::routes
-780 - /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/vendor/codeigniter4/framework/system/CodeIgniter.php::require
-364 - /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/vendor/codeigniter4/framework/system/CodeIgniter.php::tryToRouteIt
-312 - /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/vendor/codeigniter4/framework/system/CodeIgniter.php::handleRequest
-86 - /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/vendor/codeigniter4/framework/system/CLI/Console.php::run
-57 - /media/asus/06D0D488D0D47EFD/Belajar Web/Codeigniter 4/toko-online-ci4/spark::run

https://forum.codeigniter.com/thread-77289-page-2.html
Anyone wanting to use CI4 in PHP 8 should be using the 4.1 branch.
Latest develop should technically work but it is not advised. Release
date will have to be determined by the Foundation but in my opinion we
are ready for 4.0.5 and 4.1, both with PHP 8 support.
That's of Jan. 6, 2021. You at the very least need to update your CI4 version.

I've got a similar problem that was solved by executing
composer update
at root folder's cmd of the project.

Related

Remove duplicated lines based on field and length

I need remove duplicated lines based on field between parenthesis (Ex: (265394673718132736)) but removing the shorter line.
Example:
SERVER: 1 - (265394673718132736) - NO - ['OK', 'GROUP1']
SERVER: 2 - (284906813495967745) - NO - ['OK', 'GROUP1']
SERVER: 3 - (184387362225258496) - NO - ['OK', 'GROUP2']
SERVER: 4 - (118642771161645056) - NO - ['OK', 'GROUP1', 'SAR']
SERVER: 4 - (118642771161645056) - NO - ['OK', 'GROUP1']
SERVER: 5 - (234329090943877122) - NO - ['OK', 'GROUP4', 'SAR']
SERVER: 5 - (234329090943877122) - NO - ['OK', 'GROUP4', 'SAR', 'NO']
SERVER: 6 - (287039745190658069) - NO - ['OK', 'GROUP6']
SERVER: 7 - (280378736145072130) - NO - ['OK', 'GROUP3']
Desidered result:
SERVER: 1 - (265394673718132736) - NO - ['OK', 'GROUP1']
SERVER: 2 - (284906813495967745) - NO - ['OK', 'GROUP1']
SERVER: 3 - (184387362225258496) - NO - ['OK', 'GROUP2']
SERVER: 4 - (118642771161645056) - NO - ['OK', 'GROUP1', 'SAR']
SERVER: 5 - (234329090943877122) - NO - ['OK', 'GROUP4', 'SAR', 'NO']
SERVER: 6 - (287039745190658069) - NO - ['OK', 'GROUP6']
SERVER: 7 - (280378736145072130) - NO - ['OK', 'GROUP3']
EDIT:
Tried with:
cat test | cut -f1 -d ":" --complement | sort -u -t'-' -k2,2
But I need remove the shorter line, not random.
awk '{a[$4]=length(a[$4])<length?$0:a[$4]}END{for(x in a)print a[x]}' file
does the job.
Note that, the order of lines in output is not preserved.

combining log4j log lines

I am dealing with some hive logs created with log4j on linux. The regex used is
(%d{ISO8601} %-5p [%t]: %c{2} (%F:%M(%L)) - %m%n)
. I realise some lines are broken down into several lines. for example
2017-02-10 10:03:29,933 INFO [main]: parse.ParseDriver (ParseDriver.java:parse(185)) - Parsing command:
create table my_table
(std_id STRING, std_number STRING)
2017-02-10 10:03:31,296 INFO [main]: parse.ParseDriver (ParseDriver.java:parse(209)) - Parse Completed
Is there a command in linux which I can use to combine the broken lines to give an output like this ;
2017-02-10 10:03:29,933 INFO [main]: parse.ParseDriver (ParseDriver.java:parse(185)) - Parsing command: create table my_table (std_id STRING, std_number STRING)
2017-02-10 10:03:31,296 INFO [main]: parse.ParseDriver (ParseDriver.java:parse(209)) - Parse Completed
That should work.
<myfile.log sed -nr \
-e '/^.{4}-.{2}-.{2} .{2}:.{2}:.{2},.{3} [A-Z]+ /{x;1!{s/\n/ /g;p};${g;p};d}' \
-e 'H' \
-e '${g;s/\n/ /g;p}'
Explanation
Let /^.{4}-.{2}-.{2} .{2}:.{2}:.{2},.{3} [A-Z]+ be the pattern that indicates a new log record, e.g. 2017-03-17 03:20:19,372 WARN
1st -e
When the current row indicates a new log record
x: Exchange the contents of the pattern space (which hold the current row) and the hold space.
1!{s/\n/ /g;p}: If this is not the first row of the file, (within the pattern space) replace the new lines with spaces and print it
${g;p} If this was the last row of the file, get it from the hold space and print it
d: Delete the pattern space and start a new cycle (ignoring following commands)
2nd -e
'H': append the pattern space to the hold space (only when not a new log record)
3rd -e
If this was the last row of the file ($) and not a new log record
g: Overwrite the pattern space with the content of the hold space
s/\n/ /g;p: replace the new lines with spaces and print it
Demo
$ cat>myfile.log
2017-02-10 10:03:27,374 INFO [main]: ql.Driver (Driver.java:compile(463)) - Semantic Analysis Completed
2017-02-10 10:03:29,933 INFO [main]: parse.ParseDriver (ParseDriver.java:parse(185)) - Parsing command:
create table my_table
(std_id STRING, std_number STRING)
2017-02-10 10:03:31,296 INFO [main]: parse.ParseDriver (ParseDriver.java:parse(209)) - Parse Completed
2017-03-17 03:04:09,297 INFO [main]: ql.Driver (SessionState.java:printInfo(927)) - OK
2017-03-17 03:20:19,372 WARN [Driver]: client.SparkClientImpl (SparkClientImpl.java:run(451)) - Child process exited with code 1.
2017-03-17 03:03:55,282 ERROR [main]: ql.Driver (SessionState.java:printError(936)) - FAILED: ParseException line 1:14 cannot recognize input near 'valeus' '(' '1' in statement
org.apache.hadoop.hive.ql.parse.ParseException: line 1:14 cannot recognize input near 'valeus' '(' '1' in statement
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:204)
$ <myfile.log sed -nr -e '/^.{4}-.{2}-.{2} .{2}:.{2}:.{2},.{3} [A-Z]+ /{x;1!{s/\n/ /g;p};${g;p};d}' -e 'H' -e '${g;s/\n/ /g;p}'
2017-02-10 10:03:27,374 INFO [main]: ql.Driver (Driver.java:compile(463)) - Semantic Analysis Completed
2017-02-10 10:03:29,933 INFO [main]: parse.ParseDriver (ParseDriver.java:parse(185)) - Parsing command: create table my_table (std_id STRING, std_number STRING)
2017-02-10 10:03:31,296 INFO [main]: parse.ParseDriver (ParseDriver.java:parse(209)) - Parse Completed
2017-03-17 03:04:09,297 INFO [main]: ql.Driver (SessionState.java:printInfo(927)) - OK
2017-03-17 03:20:19,372 WARN [Driver]: client.SparkClientImpl (SparkClientImpl.java:run(451)) - Child process exited with code 1.
2017-03-17 03:03:55,282 ERROR [main]: ql.Driver (SessionState.java:printError(936)) - FAILED: ParseException line 1:14 cannot recognize input near 'valeus' '(' '1' in statement org.apache.hadoop.hive.ql.parse.ParseException: line 1:14 cannot recognize input near 'valeus' '(' '1' in statement at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:204)

hiera CLI lookup fails but puppet agent -t works

[root#puppet puppet]# cat /etc/hiera.yaml
---
:backends:
- yaml
:yaml:
:datadir: '/etc/puppet/hieradata'
:hierarchy:
- env/%{::environment}/fqdn/%{::fqdn}
- hostgroup/%{::hostgroup1}
- global
[root#puppet puppet]# cat hieradata/env/dev/fqdn/client00.itw.local.yaml
fruit::a:
- 'DevFQDN-kiwi'
[root#puppet puppet]# cat environments/dev/modules/fruit/manifests/init.pp
class fruit(
$a = hiera('fruit::a' ),
$b = hiera('fruit::b'),
$c = hiera('fruit::c')
) {
notify { 'foo':
message => "a is: ${a}, b is: ${b}, c is : ${c}",
}
}
fruit::a seems to resolve fine on client00.itw.local
[root#client00 ~]# puppet agent -t
Warning: Local environment: "production" doesn't match server specified node environment "dev", switching agent to "dev".
Info: Retrieving plugin
Info: Caching catalog for client00.itw.local
Info: Applying configuration version '1411407772'
Notice: a is: DevFQDN-kiwi, b is: HostgroupAll-orange, c is : global-lime-C
But CLI hiera does not return the correct value on the puppet master
[root#puppet puppet]# hiera -d fruit::a ::fqdn=client00.itw.local ::hostgroup1=all
DEBUG: Mon Sep 22 13:57:16 -0400 2014: Hiera YAML backend starting
DEBUG: Mon Sep 22 13:57:16 -0400 2014: Looking up fruit::a in YAML backend
DEBUG: Mon Sep 22 13:57:16 -0400 2014: Looking for data source hostgroup/all
DEBUG: Mon Sep 22 13:57:16 -0400 2014: Looking for data source global
DEBUG: Mon Sep 22 13:57:16 -0400 2014: Found fruit::a in global
["global-lime-A"]
With mcollective, hiera -d fruit::a -m client00.itw.local, I got the same result.
Thanks for your help.
environment is a Puppet specific fact, included in Puppet libraries
When using hiera in the command line you have to pass those facts.

Grep is working differently accessing a server from different machines

I have a file with values separated by tabs. When a value is not present I put a '-' in the corresponding field.
Each line begins with an identifier. I'm simply searching for lines corresponding to given identifier and, using grep on a machine A (Linux) from two different machine (B and C) and two different results appear. In particular from one of the machines some consecutives '-' are missing.
The two machines are one with linux ubuntu (B) and the other with MAC OSX (C).
Here is an example:
INPUT FILE:
comp10034_c0_seq1 281 - UniRef90_B7GCX2 276 3e-29 640 98.220640569395 13.90625 Predicted_protein Phaeodactylum_tricornutum - - GO:0006200 ATP_catabolic_process GO:0005524 ATP
binding GO:0016020 membrane pfam00005 138-230 1.00e-09 - - - 93 - 0 0.136126 0
comp10036_c0_seq1 315 - - - - - - - - - - - - - - -- - - - - - - - - 77 + 2 0.00277103 0
comp10037_c0_seq1 350 - - - - - - - - - - - - - - -- - - - - - - - - 77 + 2 0.738719 0
comp6261_c0_seq1 1227 - UniRef90_K0R0D8 519 1e-82 186 42.2982885085575 98.9247311827957 Uncharacterized_protein Thalassiosira_ oceanica - - - - - - - - - - - - - -- 350 + 1 0.0034993 0
GREP FROM MACHINE B
grep 'comp6261_c0_seq1' file.txt
RESULT:
comp6261_c0_seq1 1227 - UniRef90_K0R0D8 519 1e-82 186 42.2982885085575 98.9247311827957 Uncharacterized_protein Thalassiosira_oceanica - - - - - - - - - - - - - -- 350 + 1 0.0034993 0
GREP FROM MACHINE C
grep 'comp6261_c0_seq1' file.txt
RESULT:
comp6261_c0_seq1 1227 - UniRef90_K0R0D8 519 1e-82 186 42.2982885085575 98.9247311827957 Uncharacterized_protein Thalassiosira_oceanica - 350 + 1 0.0034993 0
P.S.
Here in the forum tabs are not viewable so I chosen to write words separated by spaces.
Either your input files are different on each machine, or your input file contains control characters that are interpreted differently on each machine. Run diff and cat -v on your input files to discover which is true.
If the files are identical, perhaps the grep isn't. Check to see if your grep is a link, alias or builtin (a shell function). Try running:
which grep
`which grep` 'comp6261_c0_seq1' file.txt

Groovy: Manipulate variable from within each

I'd like to manipulate a variable in Groovy from within the closure of each, like this:
def stringTest = ''
def foo = ['one', 'two', 'three']
foo.each {
stringTest.concat(it)
}
println stringTest
But this gives me the following error:
| Error 2013-03-13 15:26:12,330 [http-bio-8080-exec-2] ERROR
errors.GrailsExceptionResolver - NoSuchMethodError occurred when
processing request: [GET] /Reporting-Web/reporting/show/1
reporting.web.AppFiguresService$_getProductIDs_closure2.(Ljava/lang/Object;Ljava/lang/Object;Lgroovy/lang/Reference;)V.
Stacktrace follows: Message: Executing action [show] of controller
[com.xyz.reporting.ReportingController] caused exception: Runtime
error executing action Line | Method
->> 195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker |
918 | run in '' ^ 680 | run . . in java.lang.Thread
Caused by ControllerExecutionException: Runtime error executing action
->> 195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker |
918 | run in '' ^ 680 | run . . in java.lang.Thread
Caused by InvocationTargetException: null
->> 195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker |
918 | run in '' ^ 680 | run . . in java.lang.Thread
Caused by NoSuchMethodError:
reporting.web.Foo$_getProductIDs_closure2.(Ljava/lang/Object;Ljava/lang/Object;Lgroovy/lang/Reference;)V
->> 77 | getProductIDs in reporting.web.Foo$$ENzya8Hg
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 45 | show in com.xyz.reporting.Foo | 195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter | 63 |
doFilter in grails.plugin.cache.web.filter.AbstractFilter | 895 |
runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 |
run in '' ^ 680 | run . . in java.lang.Thread
I'm quite new to Groovy, any help would be great here!
This works...
def stringTest = ''
def foo = ['one', 'two', 'three']
foo.each {
stringTest += it
}
println stringTest
the function "concat()" returns a string:
stringTest = stringTest.concat(it)
To modify the iterator in the closure is not possible.
//Edit
The error msg is a grails error, while the controller can not open the function "show()"
Java strings are immutable. You can collect the concatened string:
def stringTest = ''
def foo = ['one', 'two', 'three']
stringTest = foo.collect { stringTest + it }.join()
assert stringTest == "onetwothree"

Resources