问:
Google Appscript: Copy Data from a Form Sheet to Another Sheet in Last Row and Clear Form
Trying to get an Appscript to run but I can't seem to figure out the last few steps.

Background: I have a Google Sheet with two tabs, #1 is called "Data Form" which hosts a fillable form to capture Transaction information to then be input onto tab #2 called "Posted Transactions". This is a personal budget spreadsheet..

Anyways, The script below is intended to take the information input on the "Data Form", verify what the last row with data is on the "Posted Transactions" tab based on whether or not Column A has any data. (To further clarify, the "Posted Transactions" tab has formulas in columns G-I which prohibits me from using a simple "Find last Row" script.)

As it is written now, I receive an error "Exception: The number of columns in the data does not match the number of columns in the range. The data has 6 but the range has 1.
RecordNewTransaction    @ Code.gs:24"

Any suggestions to make this work properly?

UPDATE:

```<code>var dataRange = datasheet.getRange(lastRow+1,1,1,datasheet.getLastColumn()-3);
</code>```

After many attempts at trial and error, I needed to edit the line shown above. Current & full script is performing as expected now and is shown below. Image snips of what I was trying to accomplish are also shown for reference.

```<code>function RecordNewTransaction() {
var ss        = SpreadsheetApp.getActiveSpreadsheet();
var formSS    = ss.getSheetByName("Data Form"); //Form Sheet
var datasheet = ss.getSheetByName("Posted Transactions"); //Data
//Input Values
var values = [[formSS.getRange("B4").getValue(),
               formSS.getRange("B6").getValue(),
               formSS.getRange("B8").getValue(),
               formSS.getRange("B10").getValue(),
               formSS.getRange("B12").getValue(),
               formSS.getRange("B14").getValue()]];

var columnToCheck = datasheet.getRange("A:A").getValues();
var lastRow = getLastRowSpecial(columnToCheck);
Logger.log(lastRow);

var dataRange = datasheet.getRange(lastRow+1,1,1,datasheet.getLastColumn()-3);
Logger.log(dataRange);
var dataValues = dataRange.getValues();

Logger.log(dataValues);

dataRange.setValues(values);
Logger.log(dataRange.setValues(values))

formSS.getRange('B4:B14').clearContent();

};

function getLastRowSpecial(range){
var rowNum = 0;
var blank = false;
for(var row = 0; row < range.length; row++){

  if(range[row][0] === "" && !blank){
    rowNum = row;
    blank = true;
  }else if(range[row][0] !== ""){
    blank = false;
  };
};
return rowNum;
  };
</code>```

答:
Try

```<code>var dataRange = datasheet.getRange(lastRow,1,values.length,values[0].length)
</code>```

replace 1 as necessary (this is the firts column where the data will be stored

Reference:

getRange(row, column, numRows, numColumns)

Body:
Trying to get an Appscript to run but I can't seem to figure out the last few steps.

Background: I have a Google Sheet with two tabs, #1 is called "Data Form" which hosts a fillable form to capture Transaction information to then be input onto tab #2 called "Posted Transactions". This is a personal budget spreadsheet..

Anyways, The script below is intended to take the information input on the "Data Form", verify what the last row with data is on the "Posted Transactions" tab based on whether or not Column A has any data. (To further clarify, the "Posted Transactions" tab has formulas in columns G-I which prohibits me from using a simple "Find last Row" script.)

As it is written now, I receive an error "Exception: The number of columns in the data does not match the number of columns in the range. The data has 6 but the range has 1.
RecordNewTransaction    @ Code.gs:24"

Any suggestions to make this work properly?

UPDATE:

var dataRange = datasheet.getRange(lastRow+1,1,1,datasheet.getLastColumn()-3);

After many attempts at trial and error, I needed to edit the line shown above. Current & full script is performing as expected now and is shown below. Image snips of what I was trying to accomplish are also shown for reference.

function RecordNewTransaction() {
var ss        = SpreadsheetApp.getActiveSpreadsheet();
var formSS    = ss.getSheetByName("Data Form"); //Form Sheet
var datasheet = ss.getSheetByName("Posted Transactions"); //Data
//Input Values
var values = [[formSS.getRange("B4").getValue(),
               formSS.getRange("B6").getValue(),
               formSS.getRange("B8").getValue(),
               formSS.getRange("B10").getValue(),
               formSS.getRange("B12").getValue(),
               formSS.getRange("B14").getValue()]];

var columnToCheck = datasheet.getRange("A:A").getValues();
var lastRow = getLastRowSpecial(columnToCheck);
Logger.log(lastRow);

var dataRange = datasheet.getRange(lastRow+1,1,1,datasheet.getLastColumn()-3);
Logger.log(dataRange);
var dataValues = dataRange.getValues();

Logger.log(dataValues);

dataRange.setValues(values);
Logger.log(dataRange.setValues(values))

formSS.getRange('B4:B14').clearContent();

};

function getLastRowSpecial(range){
var rowNum = 0;
var blank = false;
for(var row = 0; row < range.length; row++){

  if(range[row][0] === "" && !blank){
    rowNum = row;
    blank = true;
  }else if(range[row][0] !== ""){
    blank = false;
  };
};
return rowNum;
  };

Body:
Try

var dataRange = datasheet.getRange(lastRow,1,values.length,values[0].length)

replace 1 as necessary (this is the firts column where the data will be stored

Reference:

getRange(row, column, numRows, numColumns)


来源: stackexchange

问:
Install CentOS Web Panel (CWP) on CentOS 8
This is a fresh install of CentOS 8 on a dedicated server with dual Xenon (20 cores) and 24GB of RAM. There are no other things installed, so CWP is the first thing to go on there. There are a couple of bugs with the install that we need to resolve to get CWP to install on CentOS 8.</p>

```<code># sh cwp-el7-latest
CentOS Web Panel repo for Linux 7 - x86_64       10 kB/s | 2.9 kB     00:00
MariaDB                                         2.6 kB/s | 2.9 kB     00:01
Package epel-release-8-7.el8.noarch is already installed.
Package wget-1.19.5-7.el8_0.1.x86_64 is already installed.
Package screen-4.6.2-10.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
dnf makecache: error: argument timer: invalid choice: 'fast' (choose from 'timer')
Last metadata expiration check: 0:00:01 ago on Sat 23 Nov 2019 03:22:59 PM EST.
No match for argument: MariaDB
  * Maybe you meant: mariadb
No match for argument: MariaDB-server
  * Maybe you meant: mariadb-server
Error: Unable to find a match
Last metadata expiration check: 0:00:02 ago on Sat 23 Nov 2019 03:22:59 PM EST.
No match for argument: cpulimit
No match for argument: links
Error: Unable to find a match
Last metadata expiration check: 0:00:02 ago on Sat 23 Nov 2019 03:22:59 PM EST.
... (already installed items)
No match for argument: perl-Crypt-SSLeay
Error: Unable to find a match
No match for argument: exim
No match for argument: sendmail
Dependencies resolved.
...

Complete!
Last metadata expiration check: 0:00:27 ago on Sat 23 Nov 2019 03:22:59 PM EST.
No match for argument: dovecot-pigeonhole
Error: Unable to find a match
cwp-el7-latest: line 158: mysql: command not found
cwp-el7-latest: line 159: mysql: command not found

PREPARING THE SERVER
##########################
setenforce: SELinux is disabled

#############################################
Please wait... installing web server files...
#############################################

Last metadata expiration check: 0:00:48 ago on Sat 23 Nov 2019 03:22:59 PM EST.
Dependencies resolved.
================================================================================
 Package                        Arch     Version              Repository   Size
================================================================================
Installing:
 cwp-httpd                      x86_64   2.4.39-3             cwp         5.5 M
 apr-util                       x86_64   1.6.0-1              cwp         103 k
 apr                            x86_64   1.6.2-1              cwp         228 k
Installing dependencies:
 compat-openssl10               x86_64   1:1.0.2o-3.el8       AppStream   1.1 M
 dwz                            x86_64   0.12-9.el8           AppStream   109 k
 efi-srpm-macros                noarch   3-2.el8              AppStream    22 k
 ghc-srpm-macros                noarch   1.4.2-7.el8          AppStream   9.3 k
 go-srpm-macros                 noarch   2-16.el8             AppStream    14 k
 libpq                          x86_64   10.5-1.el8           AppStream   188 k
 ocaml-srpm-macros              noarch   5-4.el8              AppStream   9.4 k
 openblas-srpm-macros           noarch   2-2.el8              AppStream   7.9 k
 perl                           x86_64   4:5.26.3-416.el8     AppStream    72 k
 perl-Algorithm-Diff            noarch   1.1903-9.el8         AppStream    52 k
 perl-Archive-Tar               noarch   2.30-1.el8           AppStream    79 k
 perl-Archive-Zip               noarch   1.60-3.el8           AppStream   108 k
 perl-Attribute-Handlers        noarch   0.99-416.el8         AppStream    88 k
 perl-B-Debug                   noarch   1.26-2.el8           AppStream    26 k
 perl-CPAN                      noarch   2.18-397.el8         AppStream   554 k
 perl-CPAN-Meta                 noarch   2.150010-396.el8     AppStream   191 k
 perl-CPAN-Meta-Requirements    noarch   2.140-396.el8        AppStream    37 k
 perl-CPAN-Meta-YAML            noarch   0.018-397.el8        AppStream    34 k
 perl-Compress-Bzip2            x86_64   2.26-6.el8           AppStream    72 k
 perl-Compress-Raw-Bzip2        x86_64   2.081-1.el8          AppStream    40 k
 perl-Compress-Raw-Zlib         x86_64   2.081-1.el8          AppStream    68 k
 perl-Config-Perl-V             noarch   0.30-1.el8           AppStream    22 k
 perl-DB_File                   x86_64   1.842-1.el8          AppStream    83 k
 perl-Data-OptList              noarch   0.110-6.el8          AppStream    31 k
 perl-Data-Section              noarch   0.200007-3.el8       AppStream    30 k
 perl-Devel-PPPort              x86_64   3.36-5.el8           AppStream   118 k
 perl-Devel-Peek                x86_64   1.26-416.el8         AppStream    93 k
 perl-Devel-SelfStubber         noarch   1.06-416.el8         AppStream    75 k
 perl-Devel-Size                x86_64   0.81-2.el8           AppStream    34 k
 perl-Digest                    noarch   1.17-395.el8         AppStream    27 k
 perl-Digest-MD5                x86_64   2.55-396.el8         AppStream    37 k
 perl-Digest-SHA                x86_64   1:6.02-1.el8         AppStream    66 k
 perl-Encode-devel              x86_64   4:2.97-3.el8         AppStream    39 k
 perl-Env                       noarch   1.04-395.el8         AppStream    21 k
 perl-ExtUtils-CBuilder         noarch   1:0.280230-2.el8     AppStream    48 k
 perl-ExtUtils-Command          noarch   1:7.34-1.el8         AppStream    19 k
 perl-ExtUtils-Embed            noarch   1.34-416.el8         AppStream    79 k
 perl-ExtUtils-Install          noarch   2.14-4.el8           AppStream    46 k
 perl-ExtUtils-MM-Utils         noarch   1:7.34-1.el8         AppStream    17 k
 perl-ExtUtils-MakeMaker        noarch   1:7.34-1.el8         AppStream   300 k
 perl-ExtUtils-Manifest         noarch   1.70-395.el8         AppStream    37 k
 perl-ExtUtils-Miniperl         noarch   1.06-416.el8         AppStream    76 k
 perl-ExtUtils-ParseXS          noarch   1:3.35-2.el8         AppStream    83 k
 perl-File-Fetch                noarch   0.56-2.el8           AppStream    33 k
 perl-File-HomeDir              noarch   1.002-4.el8          AppStream    61 k
 perl-File-Which                noarch   1.22-2.el8           AppStream    23 k
 perl-Filter                    x86_64   2:1.58-2.el8         AppStream    82 k
 perl-Filter-Simple             noarch   0.94-2.el8           AppStream    29 k
 perl-IO-Compress               noarch   2.081-1.el8          AppStream   258 k
 perl-IO-Socket-IP              noarch   0.39-5.el8           AppStream    47 k
 perl-IO-Zlib                   noarch   1:1.10-416.el8       AppStream    80 k
 perl-IPC-Cmd                   noarch   2:1.02-1.el8         AppStream    43 k
 perl-IPC-SysV                  x86_64   2.07-397.el8         AppStream    43 k
 perl-IPC-System-Simple         noarch   1.25-17.el8          AppStream    43 k
 perl-JSON-PP                   noarch   1:2.97.001-3.el8     AppStream    68 k
 perl-Locale-Codes              noarch   3.57-1.el8           AppStream   311 k
 perl-Locale-Maketext           noarch   1.28-396.el8         AppStream    99 k
 perl-Locale-Maketext-Simple    noarch   1:0.21-416.el8       AppStream    78 k
 perl-MRO-Compat                noarch   0.13-4.el8           AppStream    24 k
 perl-Math-BigInt-FastCalc      x86_64   0.500.600-6.el8      AppStream    27 k
 perl-Math-BigRat               noarch   0.2614-1.el8         AppStream    40 k
 perl-Memoize                   noarch   1.03-416.el8         AppStream   118 k
 perl-Module-Build              noarch   2:0.42.24-5.el8      AppStream   273 k
 perl-Module-CoreList           noarch   1:5.20181130-1.el8   AppStream    87 k
 perl-Module-CoreList-tools     noarch   1:5.20181130-1.el8   AppStream    22 k
 perl-Module-Load               noarch   1:0.32-395.el8       AppStream    19 k
 perl-Module-Load-Conditional   noarch   0.68-395.el8         AppStream    24 k
 perl-Module-Loaded             noarch   1:0.08-416.el8       AppStream    74 k
 perl-Module-Metadata           noarch   1.000033-395.el8     AppStream    44 k
 perl-Net-Ping                  noarch   2.55-416.el8         AppStream   101 k
 perl-Net-SSLeay                x86_64   1.85-6.el8           AppStream   358 k
 perl-Package-Generator         noarch   1.106-11.el8         AppStream    27 k
 perl-Params-Check              noarch   1:0.38-395.el8       AppStream    24 k
 perl-Params-Util               x86_64   1.07-22.el8          AppStream    44 k
 perl-Perl-OSType               noarch   1.010-396.el8        AppStream    29 k
 perl-PerlIO-via-QuotedPrint    noarch   0.08-395.el8         AppStream    13 k
 perl-Pod-Checker               noarch   4:1.73-395.el8       AppStream    33 k
 perl-Pod-Html                  noarch   1.22.02-416.el8      AppStream    87 k
 perl-Pod-Parser                noarch   1.63-396.el8         AppStream   108 k
 perl-SelfLoader                noarch   1.23-416.el8         AppStream    82 k
 perl-Software-License          noarch   0.103013-2.el8       AppStream   138 k
 perl-Sub-Exporter              noarch   0.987-15.el8         AppStream    73 k
 perl-Sub-Install               noarch   0.928-14.el8         AppStream    27 k
 perl-Sys-Syslog                x86_64   0.35-397.el8         AppStream    50 k
 perl-Test                      noarch   1.30-416.el8         AppStream    89 k
 perl-Test-Harness              noarch   1:3.42-1.el8         AppStream   279 k
 perl-Test-Simple               noarch   1:1.302135-1.el8     AppStream   516 k
 perl-Text-Balanced             noarch   2.03-395.el8         AppStream    58 k
 perl-Text-Diff                 noarch   1.45-2.el8           AppStream    45 k
 perl-Text-Glob                 noarch   0.11-4.el8           AppStream    17 k
 perl-Text-Template             noarch   1.51-1.el8           AppStream    64 k
 perl-Thread-Queue              noarch   3.13-1.el8           AppStream    24 k
 perl-Time-HiRes                x86_64   1.9758-1.el8         AppStream    61 k
 perl-Time-Piece                x86_64   1.31-416.el8         AppStream    98 k
 perl-URI                       noarch   1.73-3.el8           AppStream   116 k
 perl-Unicode-Collate           x86_64   1.25-2.el8           AppStream   686 k
 perl-autodie                   noarch   2.29-396.el8         AppStream    98 k
 perl-bignum                    noarch   0.49-2.el8           AppStream    44 k
 perl-devel                     x86_64   4:5.26.3-416.el8     AppStream   599 k
 perl-encoding                  x86_64   4:2.22-3.el8         AppStream    68 k
 perl-experimental              noarch   0.019-2.el8          AppStream    24 k
 perl-inc-latest                noarch   2:0.500-9.el8        AppStream    25 k
 perl-libnet                    noarch   3.11-3.el8           AppStream   121 k
 perl-libnetcfg                 noarch   4:5.26.3-416.el8     AppStream    77 k
 perl-local-lib                 noarch   2.000024-2.el8       AppStream    74 k
 perl-open                      noarch   1.11-416.el8         AppStream    77 k
 perl-perlfaq                   noarch   5.20180605-1.el8     AppStream   386 k
 perl-srpm-macros               noarch   1-25.el8             AppStream    11 k
 perl-utils                     noarch   5.26.3-416.el8       AppStream   128 k
 perl-version                   x86_64   6:0.99.24-1.el8      AppStream    67 k
 python-srpm-macros             noarch   3-37.el8             AppStream    14 k
 python3-rpm-macros             noarch   3-37.el8             AppStream    13 k
 qt5-srpm-macros                noarch   5.11.1-2.el8         AppStream    11 k
 redhat-rpm-config              noarch   116-1.el8.0.1        AppStream    82 k
 rust-srpm-macros               noarch   5-2.el8              AppStream   9.2 k
 systemtap-sdt-devel            x86_64   4.0-7.el8            AppStream    79 k
 make                           x86_64   1:4.2.1-9.el8        BaseOS      498 k
 perl-Carp                      noarch   1.42-396.el8         BaseOS       30 k
 perl-Data-Dumper               x86_64   2.167-399.el8        BaseOS       58 k
 perl-Encode                    x86_64   4:2.97-3.el8         BaseOS      1.5 M
 perl-Errno                     x86_64   1.28-416.el8         BaseOS       76 k
 perl-Exporter                  noarch   5.72-396.el8         BaseOS       34 k
 perl-File-Path                 noarch   2.15-2.el8           BaseOS       38 k
 perl-File-Temp                 noarch   0.230.600-1.el8      BaseOS       63 k
 perl-Getopt-Long               noarch   1:2.50-4.el8         BaseOS       63 k
 perl-HTTP-Tiny                 noarch   0.074-1.el8          BaseOS       58 k
 perl-IO                        x86_64   1.38-416.el8         BaseOS      141 k
 perl-MIME-Base64               x86_64   3.15-396.el8         BaseOS       31 k
 perl-Math-BigInt               noarch   1:1.9998.11-5.el8    BaseOS      195 k
 perl-Math-Complex              noarch   1.59-416.el8         BaseOS      108 k
 perl-PathTools                 x86_64   3.74-1.el8           BaseOS       90 k
 perl-Pod-Escapes               noarch   1:1.07-395.el8       BaseOS       20 k
 perl-Pod-Perldoc               noarch   3.28-396.el8         BaseOS       86 k
 perl-Pod-Simple                noarch   1:3.35-395.el8       BaseOS      213 k
 perl-Pod-Usage                 noarch   4:1.69-395.el8       BaseOS       34 k
 perl-Scalar-List-Utils         x86_64   3:1.49-2.el8         BaseOS       68 k
 perl-Socket                    x86_64   4:2.027-2.el8        BaseOS       59 k
 perl-Storable                  x86_64   1:3.11-3.el8         BaseOS       98 k
 perl-Term-ANSIColor            noarch   4.06-396.el8         BaseOS       46 k
 perl-Term-Cap                  noarch   1.17-395.el8         BaseOS       23 k
 perl-Text-ParseWords           noarch   3.30-395.el8         BaseOS       18 k
 perl-Text-Tabs+Wrap            noarch   2013.0523-395.el8    BaseOS       24 k
 perl-Time-Local                noarch   1:1.280-1.el8        BaseOS       34 k
 perl-Unicode-Normalize         x86_64   1.25-396.el8         BaseOS       82 k
 perl-constant                  noarch   1.33-396.el8         BaseOS       25 k
 perl-interpreter               x86_64   4:5.26.3-416.el8     BaseOS      6.3 M
 perl-libs                      x86_64   4:5.26.3-416.el8     BaseOS      1.6 M
 perl-macros                    x86_64   4:5.26.3-416.el8     BaseOS       72 k
 perl-parent                    noarch   1:0.237-1.el8        BaseOS       20 k
 perl-podlators                 noarch   4.11-1.el8           BaseOS      118 k
 perl-threads                   x86_64   1:2.21-2.el8         BaseOS       61 k
 perl-threads-shared            x86_64   1.58-2.el8           BaseOS       48 k
 python3-pyparsing              noarch   2.1.10-7.el8         BaseOS      142 k
Installing weak dependencies:
 perl-Encode-Locale             noarch   1.05-9.el8           AppStream    21 k
 perl-IO-Socket-SSL             noarch   2.060-2.el8          AppStream   289 k
 perl-Mozilla-CA                noarch   20160104-7.el8       AppStream    15 k
 perl-TermReadKey               x86_64   2.37-7.el8           AppStream    40 k

Transaction Summary
================================================================================
Install  160 Packages

Total download size: 30 M
Installed size: 95 M
Downloading Packages:
(1/160): apr-util-1.6.0-1.x86_64.rpm            148 kB/s | 103 kB     00:00
  ... (removed for space limitations on stackoverflow)
(160/160): perl-interpreter-5.26.3-416.el8.x86_ 7.6 MB/s | 6.3 MB     00:00
--------------------------------------------------------------------------------
Total                                           5.6 MB/s |  30 MB     00:05
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : perl-Exporter-5.72-396.el8.noarch                    1/160
  ... (removed for space limitations on stackoverflow)
  Installing       : perl-4:5.26.3-416.el8.x86_64                       159/160
  Running scriptlet: cwp-httpd-2.4.39-3.x86_64                          160/160
  Installing       : cwp-httpd-2.4.39-3.x86_64                          160/160
  Running scriptlet: cwp-httpd-2.4.39-3.x86_64                          160/160
  Verifying        : cwp-httpd-2.4.39-3.x86_64                            1/160
  ... (removed for space limitations on stackoverflow)
  Verifying        : python3-pyparsing-2.1.10-7.el8.noarch              160/160

Installed:
  cwp-httpd-2.4.39-3.x86_64
  apr-util-1.6.0-1.x86_64
  apr-1.6.2-1.x86_64
  perl-Encode-Locale-1.05-9.el8.noarch
  perl-IO-Socket-SSL-2.060-2.el8.noarch
  perl-Mozilla-CA-20160104-7.el8.noarch
  perl-TermReadKey-2.37-7.el8.x86_64
  compat-openssl10-1:1.0.2o-3.el8.x86_64
  dwz-0.12-9.el8.x86_64
  efi-srpm-macros-3-2.el8.noarch
  ghc-srpm-macros-1.4.2-7.el8.noarch
  go-srpm-macros-2-16.el8.noarch
  libpq-10.5-1.el8.x86_64
  ocaml-srpm-macros-5-4.el8.noarch
  openblas-srpm-macros-2-2.el8.noarch
  perl-4:5.26.3-416.el8.x86_64
  perl-Algorithm-Diff-1.1903-9.el8.noarch
  perl-Archive-Tar-2.30-1.el8.noarch
  perl-Archive-Zip-1.60-3.el8.noarch
  perl-Attribute-Handlers-0.99-416.el8.noarch
  perl-B-Debug-1.26-2.el8.noarch
  perl-CPAN-2.18-397.el8.noarch
  perl-CPAN-Meta-2.150010-396.el8.noarch
  perl-CPAN-Meta-Requirements-2.140-396.el8.noarch
  perl-CPAN-Meta-YAML-0.018-397.el8.noarch
  perl-Compress-Bzip2-2.26-6.el8.x86_64
  perl-Compress-Raw-Bzip2-2.081-1.el8.x86_64
  perl-Compress-Raw-Zlib-2.081-1.el8.x86_64
  perl-Config-Perl-V-0.30-1.el8.noarch
  perl-DB_File-1.842-1.el8.x86_64
  perl-Data-OptList-0.110-6.el8.noarch
  perl-Data-Section-0.200007-3.el8.noarch
  perl-Devel-PPPort-3.36-5.el8.x86_64
  perl-Devel-Peek-1.26-416.el8.x86_64
  perl-Devel-SelfStubber-1.06-416.el8.noarch
  perl-Devel-Size-0.81-2.el8.x86_64
  perl-Digest-1.17-395.el8.noarch
  perl-Digest-MD5-2.55-396.el8.x86_64
  perl-Digest-SHA-1:6.02-1.el8.x86_64
  perl-Encode-devel-4:2.97-3.el8.x86_64
  perl-Env-1.04-395.el8.noarch
  perl-ExtUtils-CBuilder-1:0.280230-2.el8.noarch
  perl-ExtUtils-Command-1:7.34-1.el8.noarch
  perl-ExtUtils-Embed-1.34-416.el8.noarch
  perl-ExtUtils-Install-2.14-4.el8.noarch
  perl-ExtUtils-MM-Utils-1:7.34-1.el8.noarch
  perl-ExtUtils-MakeMaker-1:7.34-1.el8.noarch
  perl-ExtUtils-Manifest-1.70-395.el8.noarch
  perl-ExtUtils-Miniperl-1.06-416.el8.noarch
  perl-ExtUtils-ParseXS-1:3.35-2.el8.noarch
  perl-File-Fetch-0.56-2.el8.noarch
  perl-File-HomeDir-1.002-4.el8.noarch
  perl-File-Which-1.22-2.el8.noarch
  perl-Filter-2:1.58-2.el8.x86_64
  perl-Filter-Simple-0.94-2.el8.noarch
  perl-IO-Compress-2.081-1.el8.noarch
  perl-IO-Socket-IP-0.39-5.el8.noarch
  perl-IO-Zlib-1:1.10-416.el8.noarch
  perl-IPC-Cmd-2:1.02-1.el8.noarch
  perl-IPC-SysV-2.07-397.el8.x86_64
  perl-IPC-System-Simple-1.25-17.el8.noarch
  perl-JSON-PP-1:2.97.001-3.el8.noarch
  perl-Locale-Codes-3.57-1.el8.noarch
  perl-Locale-Maketext-1.28-396.el8.noarch
  perl-Locale-Maketext-Simple-1:0.21-416.el8.noarch
  perl-MRO-Compat-0.13-4.el8.noarch
  perl-Math-BigInt-FastCalc-0.500.600-6.el8.x86_64
  perl-Math-BigRat-0.2614-1.el8.noarch
  perl-Memoize-1.03-416.el8.noarch
  perl-Module-Build-2:0.42.24-5.el8.noarch
  perl-Module-CoreList-1:5.20181130-1.el8.noarch
  perl-Module-CoreList-tools-1:5.20181130-1.el8.noarch
  perl-Module-Load-1:0.32-395.el8.noarch
  perl-Module-Load-Conditional-0.68-395.el8.noarch
  perl-Module-Loaded-1:0.08-416.el8.noarch
  perl-Module-Metadata-1.000033-395.el8.noarch
  perl-Net-Ping-2.55-416.el8.noarch
  perl-Net-SSLeay-1.85-6.el8.x86_64
  perl-Package-Generator-1.106-11.el8.noarch
  perl-Params-Check-1:0.38-395.el8.noarch
  perl-Params-Util-1.07-22.el8.x86_64
  perl-Perl-OSType-1.010-396.el8.noarch
  perl-PerlIO-via-QuotedPrint-0.08-395.el8.noarch
  perl-Pod-Checker-4:1.73-395.el8.noarch
  perl-Pod-Html-1.22.02-416.el8.noarch
  perl-Pod-Parser-1.63-396.el8.noarch
  perl-SelfLoader-1.23-416.el8.noarch
  perl-Software-License-0.103013-2.el8.noarch
  perl-Sub-Exporter-0.987-15.el8.noarch
  perl-Sub-Install-0.928-14.el8.noarch
  perl-Sys-Syslog-0.35-397.el8.x86_64
  perl-Test-1.30-416.el8.noarch
  perl-Test-Harness-1:3.42-1.el8.noarch
  perl-Test-Simple-1:1.302135-1.el8.noarch
  perl-Text-Balanced-2.03-395.el8.noarch
  perl-Text-Diff-1.45-2.el8.noarch
  perl-Text-Glob-0.11-4.el8.noarch
  perl-Text-Template-1.51-1.el8.noarch
  perl-Thread-Queue-3.13-1.el8.noarch
  perl-Time-HiRes-1.9758-1.el8.x86_64
  perl-Time-Piece-1.31-416.el8.x86_64
  perl-URI-1.73-3.el8.noarch
  perl-Unicode-Collate-1.25-2.el8.x86_64
  perl-autodie-2.29-396.el8.noarch
  perl-bignum-0.49-2.el8.noarch
  perl-devel-4:5.26.3-416.el8.x86_64
  perl-encoding-4:2.22-3.el8.x86_64
  perl-experimental-0.019-2.el8.noarch
  perl-inc-latest-2:0.500-9.el8.noarch
  perl-libnet-3.11-3.el8.noarch
  perl-libnetcfg-4:5.26.3-416.el8.noarch
  perl-local-lib-2.000024-2.el8.noarch
  perl-open-1.11-416.el8.noarch
  perl-perlfaq-5.20180605-1.el8.noarch
  perl-srpm-macros-1-25.el8.noarch
  perl-utils-5.26.3-416.el8.noarch
  perl-version-6:0.99.24-1.el8.x86_64
  python-srpm-macros-3-37.el8.noarch
  python3-rpm-macros-3-37.el8.noarch
  qt5-srpm-macros-5.11.1-2.el8.noarch
  redhat-rpm-config-116-1.el8.0.1.noarch
  rust-srpm-macros-5-2.el8.noarch
  systemtap-sdt-devel-4.0-7.el8.x86_64
  make-1:4.2.1-9.el8.x86_64
  perl-Carp-1.42-396.el8.noarch
  perl-Data-Dumper-2.167-399.el8.x86_64
  perl-Encode-4:2.97-3.el8.x86_64
  perl-Errno-1.28-416.el8.x86_64
  perl-Exporter-5.72-396.el8.noarch
  perl-File-Path-2.15-2.el8.noarch
  perl-File-Temp-0.230.600-1.el8.noarch
  perl-Getopt-Long-1:2.50-4.el8.noarch
  perl-HTTP-Tiny-0.074-1.el8.noarch
  perl-IO-1.38-416.el8.x86_64
  perl-MIME-Base64-3.15-396.el8.x86_64
  perl-Math-BigInt-1:1.9998.11-5.el8.noarch
  perl-Math-Complex-1.59-416.el8.noarch
  perl-PathTools-3.74-1.el8.x86_64
  perl-Pod-Escapes-1:1.07-395.el8.noarch
  perl-Pod-Perldoc-3.28-396.el8.noarch
  perl-Pod-Simple-1:3.35-395.el8.noarch
  perl-Pod-Usage-4:1.69-395.el8.noarch
  perl-Scalar-List-Utils-3:1.49-2.el8.x86_64
  perl-Socket-4:2.027-2.el8.x86_64
  perl-Storable-1:3.11-3.el8.x86_64
  perl-Term-ANSIColor-4.06-396.el8.noarch
  perl-Term-Cap-1.17-395.el8.noarch
  perl-Text-ParseWords-3.30-395.el8.noarch
  perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch
  perl-Time-Local-1:1.280-1.el8.noarch
  perl-Unicode-Normalize-1.25-396.el8.x86_64
  perl-constant-1.33-396.el8.noarch
  perl-interpreter-4:5.26.3-416.el8.x86_64
  perl-libs-4:5.26.3-416.el8.x86_64
  perl-macros-4:5.26.3-416.el8.x86_64
  perl-parent-1:0.237-1.el8.noarch
  perl-podlators-4.11-1.el8.noarch
  perl-threads-1:2.21-2.el8.x86_64
  perl-threads-shared-1.58-2.el8.x86_64
  python3-pyparsing-2.1.10-7.el8.noarch

Complete!
Last metadata expiration check: 0:01:19 ago on Sat 23 Nov 2019 03:22:59 PM EST.
Package cwp-suphp-0.7.2-3.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

#############################################
Please wait... Installing PHP ...
#############################################

Last metadata expiration check: 0:01:20 ago on Sat 23 Nov 2019 03:22:59 PM EST.
Error:
 Problem: cannot install the best candidate for the job
  - nothing provides libpng15.so.15()(64bit) needed by cwp-php-5.6.37-1.x86_64
  - nothing provides libpng15.so.15(PNG15_0)(64bit) needed by cwp-php-5.6.37-1.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

Compiler requires 512 MB RAM + SWAP
Installation FAILED at php
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   899  100   899    0     0   1872      0 --:--:-- --:--:-- --:--:--  1869
sh: line 36: mysql: command not found
sh: line 46: /usr/local/bin/php: No such file or directory
grep: /etc/init.d/httpd: No such file or directory
Received
#
</code>```

<p>In order to try to resolve the errors, which seem to be primarily this:</p>

```<code>Error:
 Problem: cannot install the best candidate for the job
  - nothing provides libpng15.so.15()(64bit) needed by cwp-php-5.6.37-1.x86_64
  - nothing provides libpng15.so.15(PNG15_0)(64bit) needed by cwp-php-5.6.37-1.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

Compiler requires 512 MB RAM + SWAP
Installation FAILED at php
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   899  100   899    0     0   1872      0 --:--:-- --:--:-- --:--:--  1869
sh: line 36: mysql: command not found
sh: line 46: /usr/local/bin/php: No such file or directory
grep: /etc/init.d/httpd: No such file or directory
</code>```

<p>Firstly, I tried to install php manually, and was able to successfully do so with <code>yum install php</code>. However, the installer still proceeded with the identical problem, nothing changed.</p>

<p>The preceeding errors like <code>nothing provides libpng15.so.15()(64bit)</code> I tried to resolve by manually installing libpng, but it seems that libpng is already installed.</p>

```<code># yum install libpng
Last metadata expiration check: 0:06:35 ago on Sat 23 Nov 2019 03:26:25 PM EST.
Package libpng-2:1.6.34-5.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
</code>```

<p>However, it's possibly because <code>libpng15</code> as asked for by cwp is an older package. See https://pkgs.org/download/libpng15.so.15()(64bit), which I found the rpm for CentOS at https://centos.pkgs.org/7/centos-x86_64/libpng-1.5.13-7.el7_2.x86_64.rpm.html</p>

<p>An attempt to install libpng15 from the rpm (since it can't be found with <code>yum install libpng15</code>), results in another error:</p>

```<code>c# rpm -ivh http://mirror.centos.org/centos/7/os/x86_64/Packages/libpng-1.5.13-7.el7_2.x86_64.rpm
Retrieving http://mirror.centos.org/centos/7/os/x86_64/Packages/libpng-1.5.13-7.el7_2.x86_64.rpm
warning: /var/tmp/rpm-tmp.lWZHpk: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
        package libpng-2:1.6.34-5.el8.x86_64 (which is newer than libpng-2:1.5.13-7.el7_2.x86_64) is already installed
        file /usr/share/man/man5/png.5.gz from install of libpng-2:1.5.13-7.el7_2.x86_64 conflicts with file from package libpng-2:1.6.34-5.el8.x86_64
</code>```

<p>It seems that libpng16 is already installed, so libpng15 can't be installed with libpng16 installed.</p>

<p>The error, <code>Compiler requires 512 MB RAM + SWAP</code> doesn't make sense, since I have 24GB of RAM.</p>

<p>Here is my setup:</p>

```<code># df -h
Filesystem           Size  Used Avail Use% Mounted on
devtmpfs             2.0G     0  2.0G   0% /dev
tmpfs                2.0G     0  2.0G   0% /dev/shm
tmpfs                2.0G   18M  2.0G   1% /run
tmpfs                2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/mapper/cl-root   13G  1.9G   11G  15% /
/dev/mapper/cl-tmp   5.5G   72M  5.4G   2% /tmp
/dev/mapper/cl-home  199G  1.5G  198G   1% /home
/dev/sda1            2.0G  182M  1.7G  10% /boot
tmpfs                3.2G     0  3.2G   0% /run/user/0
</code>```

<p>The error <code>sh: line 36: mysql: command not found</code> comes from the fact that I can't seem to get mysql installed due to MariaDB conflict.</p>

<p>The error <code>grep: /etc/init.d/httpd: No such file or directory</code> seems to be because apache is not installed, of course, possibly because the script ended without installing it? Not sure.</p>

<p>Please help me get CentOS Web Panel installed on CentOS 8. Thank you!</p>

答:
As per CWP Installation Instructions, they have installation for CentOS 8. Below are the instructions:

```<code>#cd /usr/local/src
#wget http://centos-webpanel.com/cwp-el8-latest
#chmod +x cwp-el8-latest
#bash cwp-el8-latest
</code>```

The shell script shall install all the necessary packages through yum.

ContentLicense: CC BY-SA 4.0

Body:
This is a fresh install of CentOS 8 on a dedicated server with dual Xenon (20 cores) and 24GB of RAM. There are no other things installed, so CWP is the first thing to go on there. There are a couple of bugs with the install that we need to resolve to get CWP to install on CentOS 8.

# sh cwp-el7-latest
CentOS Web Panel repo for Linux 7 - x86_64       10 kB/s | 2.9 kB     00:00
MariaDB                                         2.6 kB/s | 2.9 kB     00:01
Package epel-release-8-7.el8.noarch is already installed.
Package wget-1.19.5-7.el8_0.1.x86_64 is already installed.
Package screen-4.6.2-10.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
dnf makecache: error: argument timer: invalid choice: 'fast' (choose from 'timer')
Last metadata expiration check: 0:00:01 ago on Sat 23 Nov 2019 03:22:59 PM EST.
No match for argument: MariaDB
  * Maybe you meant: mariadb
No match for argument: MariaDB-server
  * Maybe you meant: mariadb-server
Error: Unable to find a match
Last metadata expiration check: 0:00:02 ago on Sat 23 Nov 2019 03:22:59 PM EST.
No match for argument: cpulimit
No match for argument: links
Error: Unable to find a match
Last metadata expiration check: 0:00:02 ago on Sat 23 Nov 2019 03:22:59 PM EST.
... (already installed items)
No match for argument: perl-Crypt-SSLeay
Error: Unable to find a match
No match for argument: exim
No match for argument: sendmail
Dependencies resolved.
...

Complete!
Last metadata expiration check: 0:00:27 ago on Sat 23 Nov 2019 03:22:59 PM EST.
No match for argument: dovecot-pigeonhole
Error: Unable to find a match
cwp-el7-latest: line 158: mysql: command not found
cwp-el7-latest: line 159: mysql: command not found

PREPARING THE SERVER
##########################
setenforce: SELinux is disabled

#############################################
Please wait... installing web server files...
#############################################

Last metadata expiration check: 0:00:48 ago on Sat 23 Nov 2019 03:22:59 PM EST.
Dependencies resolved.
================================================================================
 Package                        Arch     Version              Repository   Size
================================================================================
Installing:
 cwp-httpd                      x86_64   2.4.39-3             cwp         5.5 M
 apr-util                       x86_64   1.6.0-1              cwp         103 k
 apr                            x86_64   1.6.2-1              cwp         228 k
Installing dependencies:
 compat-openssl10               x86_64   1:1.0.2o-3.el8       AppStream   1.1 M
 dwz                            x86_64   0.12-9.el8           AppStream   109 k
 efi-srpm-macros                noarch   3-2.el8              AppStream    22 k
 ghc-srpm-macros                noarch   1.4.2-7.el8          AppStream   9.3 k
 go-srpm-macros                 noarch   2-16.el8             AppStream    14 k
 libpq                          x86_64   10.5-1.el8           AppStream   188 k
 ocaml-srpm-macros              noarch   5-4.el8              AppStream   9.4 k
 openblas-srpm-macros           noarch   2-2.el8              AppStream   7.9 k
 perl                           x86_64   4:5.26.3-416.el8     AppStream    72 k
 perl-Algorithm-Diff            noarch   1.1903-9.el8         AppStream    52 k
 perl-Archive-Tar               noarch   2.30-1.el8           AppStream    79 k
 perl-Archive-Zip               noarch   1.60-3.el8           AppStream   108 k
 perl-Attribute-Handlers        noarch   0.99-416.el8         AppStream    88 k
 perl-B-Debug                   noarch   1.26-2.el8           AppStream    26 k
 perl-CPAN                      noarch   2.18-397.el8         AppStream   554 k
 perl-CPAN-Meta                 noarch   2.150010-396.el8     AppStream   191 k
 perl-CPAN-Meta-Requirements    noarch   2.140-396.el8        AppStream    37 k
 perl-CPAN-Meta-YAML            noarch   0.018-397.el8        AppStream    34 k
 perl-Compress-Bzip2            x86_64   2.26-6.el8           AppStream    72 k
 perl-Compress-Raw-Bzip2        x86_64   2.081-1.el8          AppStream    40 k
 perl-Compress-Raw-Zlib         x86_64   2.081-1.el8          AppStream    68 k
 perl-Config-Perl-V             noarch   0.30-1.el8           AppStream    22 k
 perl-DB_File                   x86_64   1.842-1.el8          AppStream    83 k
 perl-Data-OptList              noarch   0.110-6.el8          AppStream    31 k
 perl-Data-Section              noarch   0.200007-3.el8       AppStream    30 k
 perl-Devel-PPPort              x86_64   3.36-5.el8           AppStream   118 k
 perl-Devel-Peek                x86_64   1.26-416.el8         AppStream    93 k
 perl-Devel-SelfStubber         noarch   1.06-416.el8         AppStream    75 k
 perl-Devel-Size                x86_64   0.81-2.el8           AppStream    34 k
 perl-Digest                    noarch   1.17-395.el8         AppStream    27 k
 perl-Digest-MD5                x86_64   2.55-396.el8         AppStream    37 k
 perl-Digest-SHA                x86_64   1:6.02-1.el8         AppStream    66 k
 perl-Encode-devel              x86_64   4:2.97-3.el8         AppStream    39 k
 perl-Env                       noarch   1.04-395.el8         AppStream    21 k
 perl-ExtUtils-CBuilder         noarch   1:0.280230-2.el8     AppStream    48 k
 perl-ExtUtils-Command          noarch   1:7.34-1.el8         AppStream    19 k
 perl-ExtUtils-Embed            noarch   1.34-416.el8         AppStream    79 k
 perl-ExtUtils-Install          noarch   2.14-4.el8           AppStream    46 k
 perl-ExtUtils-MM-Utils         noarch   1:7.34-1.el8         AppStream    17 k
 perl-ExtUtils-MakeMaker        noarch   1:7.34-1.el8         AppStream   300 k
 perl-ExtUtils-Manifest         noarch   1.70-395.el8         AppStream    37 k
 perl-ExtUtils-Miniperl         noarch   1.06-416.el8         AppStream    76 k
 perl-ExtUtils-ParseXS          noarch   1:3.35-2.el8         AppStream    83 k
 perl-File-Fetch                noarch   0.56-2.el8           AppStream    33 k
 perl-File-HomeDir              noarch   1.002-4.el8          AppStream    61 k
 perl-File-Which                noarch   1.22-2.el8           AppStream    23 k
 perl-Filter                    x86_64   2:1.58-2.el8         AppStream    82 k
 perl-Filter-Simple             noarch   0.94-2.el8           AppStream    29 k
 perl-IO-Compress               noarch   2.081-1.el8          AppStream   258 k
 perl-IO-Socket-IP              noarch   0.39-5.el8           AppStream    47 k
 perl-IO-Zlib                   noarch   1:1.10-416.el8       AppStream    80 k
 perl-IPC-Cmd                   noarch   2:1.02-1.el8         AppStream    43 k
 perl-IPC-SysV                  x86_64   2.07-397.el8         AppStream    43 k
 perl-IPC-System-Simple         noarch   1.25-17.el8          AppStream    43 k
 perl-JSON-PP                   noarch   1:2.97.001-3.el8     AppStream    68 k
 perl-Locale-Codes              noarch   3.57-1.el8           AppStream   311 k
 perl-Locale-Maketext           noarch   1.28-396.el8         AppStream    99 k
 perl-Locale-Maketext-Simple    noarch   1:0.21-416.el8       AppStream    78 k
 perl-MRO-Compat                noarch   0.13-4.el8           AppStream    24 k
 perl-Math-BigInt-FastCalc      x86_64   0.500.600-6.el8      AppStream    27 k
 perl-Math-BigRat               noarch   0.2614-1.el8         AppStream    40 k
 perl-Memoize                   noarch   1.03-416.el8         AppStream   118 k
 perl-Module-Build              noarch   2:0.42.24-5.el8      AppStream   273 k
 perl-Module-CoreList           noarch   1:5.20181130-1.el8   AppStream    87 k
 perl-Module-CoreList-tools     noarch   1:5.20181130-1.el8   AppStream    22 k
 perl-Module-Load               noarch   1:0.32-395.el8       AppStream    19 k
 perl-Module-Load-Conditional   noarch   0.68-395.el8         AppStream    24 k
 perl-Module-Loaded             noarch   1:0.08-416.el8       AppStream    74 k
 perl-Module-Metadata           noarch   1.000033-395.el8     AppStream    44 k
 perl-Net-Ping                  noarch   2.55-416.el8         AppStream   101 k
 perl-Net-SSLeay                x86_64   1.85-6.el8           AppStream   358 k
 perl-Package-Generator         noarch   1.106-11.el8         AppStream    27 k
 perl-Params-Check              noarch   1:0.38-395.el8       AppStream    24 k
 perl-Params-Util               x86_64   1.07-22.el8          AppStream    44 k
 perl-Perl-OSType               noarch   1.010-396.el8        AppStream    29 k
 perl-PerlIO-via-QuotedPrint    noarch   0.08-395.el8         AppStream    13 k
 perl-Pod-Checker               noarch   4:1.73-395.el8       AppStream    33 k
 perl-Pod-Html                  noarch   1.22.02-416.el8      AppStream    87 k
 perl-Pod-Parser                noarch   1.63-396.el8         AppStream   108 k
 perl-SelfLoader                noarch   1.23-416.el8         AppStream    82 k
 perl-Software-License          noarch   0.103013-2.el8       AppStream   138 k
 perl-Sub-Exporter              noarch   0.987-15.el8         AppStream    73 k
 perl-Sub-Install               noarch   0.928-14.el8         AppStream    27 k
 perl-Sys-Syslog                x86_64   0.35-397.el8         AppStream    50 k
 perl-Test                      noarch   1.30-416.el8         AppStream    89 k
 perl-Test-Harness              noarch   1:3.42-1.el8         AppStream   279 k
 perl-Test-Simple               noarch   1:1.302135-1.el8     AppStream   516 k
 perl-Text-Balanced             noarch   2.03-395.el8         AppStream    58 k
 perl-Text-Diff                 noarch   1.45-2.el8           AppStream    45 k
 perl-Text-Glob                 noarch   0.11-4.el8           AppStream    17 k
 perl-Text-Template             noarch   1.51-1.el8           AppStream    64 k
 perl-Thread-Queue              noarch   3.13-1.el8           AppStream    24 k
 perl-Time-HiRes                x86_64   1.9758-1.el8         AppStream    61 k
 perl-Time-Piece                x86_64   1.31-416.el8         AppStream    98 k
 perl-URI                       noarch   1.73-3.el8           AppStream   116 k
 perl-Unicode-Collate           x86_64   1.25-2.el8           AppStream   686 k
 perl-autodie                   noarch   2.29-396.el8         AppStream    98 k
 perl-bignum                    noarch   0.49-2.el8           AppStream    44 k
 perl-devel                     x86_64   4:5.26.3-416.el8     AppStream   599 k
 perl-encoding                  x86_64   4:2.22-3.el8         AppStream    68 k
 perl-experimental              noarch   0.019-2.el8          AppStream    24 k
 perl-inc-latest                noarch   2:0.500-9.el8        AppStream    25 k
 perl-libnet                    noarch   3.11-3.el8           AppStream   121 k
 perl-libnetcfg                 noarch   4:5.26.3-416.el8     AppStream    77 k
 perl-local-lib                 noarch   2.000024-2.el8       AppStream    74 k
 perl-open                      noarch   1.11-416.el8         AppStream    77 k
 perl-perlfaq                   noarch   5.20180605-1.el8     AppStream   386 k
 perl-srpm-macros               noarch   1-25.el8             AppStream    11 k
 perl-utils                     noarch   5.26.3-416.el8       AppStream   128 k
 perl-version                   x86_64   6:0.99.24-1.el8      AppStream    67 k
 python-srpm-macros             noarch   3-37.el8             AppStream    14 k
 python3-rpm-macros             noarch   3-37.el8             AppStream    13 k
 qt5-srpm-macros                noarch   5.11.1-2.el8         AppStream    11 k
 redhat-rpm-config              noarch   116-1.el8.0.1        AppStream    82 k
 rust-srpm-macros               noarch   5-2.el8              AppStream   9.2 k
 systemtap-sdt-devel            x86_64   4.0-7.el8            AppStream    79 k
 make                           x86_64   1:4.2.1-9.el8        BaseOS      498 k
 perl-Carp                      noarch   1.42-396.el8         BaseOS       30 k
 perl-Data-Dumper               x86_64   2.167-399.el8        BaseOS       58 k
 perl-Encode                    x86_64   4:2.97-3.el8         BaseOS      1.5 M
 perl-Errno                     x86_64   1.28-416.el8         BaseOS       76 k
 perl-Exporter                  noarch   5.72-396.el8         BaseOS       34 k
 perl-File-Path                 noarch   2.15-2.el8           BaseOS       38 k
 perl-File-Temp                 noarch   0.230.600-1.el8      BaseOS       63 k
 perl-Getopt-Long               noarch   1:2.50-4.el8         BaseOS       63 k
 perl-HTTP-Tiny                 noarch   0.074-1.el8          BaseOS       58 k
 perl-IO                        x86_64   1.38-416.el8         BaseOS      141 k
 perl-MIME-Base64               x86_64   3.15-396.el8         BaseOS       31 k
 perl-Math-BigInt               noarch   1:1.9998.11-5.el8    BaseOS      195 k
 perl-Math-Complex              noarch   1.59-416.el8         BaseOS      108 k
 perl-PathTools                 x86_64   3.74-1.el8           BaseOS       90 k
 perl-Pod-Escapes               noarch   1:1.07-395.el8       BaseOS       20 k
 perl-Pod-Perldoc               noarch   3.28-396.el8         BaseOS       86 k
 perl-Pod-Simple                noarch   1:3.35-395.el8       BaseOS      213 k
 perl-Pod-Usage                 noarch   4:1.69-395.el8       BaseOS       34 k
 perl-Scalar-List-Utils         x86_64   3:1.49-2.el8         BaseOS       68 k
 perl-Socket                    x86_64   4:2.027-2.el8        BaseOS       59 k
 perl-Storable                  x86_64   1:3.11-3.el8         BaseOS       98 k
 perl-Term-ANSIColor            noarch   4.06-396.el8         BaseOS       46 k
 perl-Term-Cap                  noarch   1.17-395.el8         BaseOS       23 k
 perl-Text-ParseWords           noarch   3.30-395.el8         BaseOS       18 k
 perl-Text-Tabs+Wrap            noarch   2013.0523-395.el8    BaseOS       24 k
 perl-Time-Local                noarch   1:1.280-1.el8        BaseOS       34 k
 perl-Unicode-Normalize         x86_64   1.25-396.el8         BaseOS       82 k
 perl-constant                  noarch   1.33-396.el8         BaseOS       25 k
 perl-interpreter               x86_64   4:5.26.3-416.el8     BaseOS      6.3 M
 perl-libs                      x86_64   4:5.26.3-416.el8     BaseOS      1.6 M
 perl-macros                    x86_64   4:5.26.3-416.el8     BaseOS       72 k
 perl-parent                    noarch   1:0.237-1.el8        BaseOS       20 k
 perl-podlators                 noarch   4.11-1.el8           BaseOS      118 k
 perl-threads                   x86_64   1:2.21-2.el8         BaseOS       61 k
 perl-threads-shared            x86_64   1.58-2.el8           BaseOS       48 k
 python3-pyparsing              noarch   2.1.10-7.el8         BaseOS      142 k
Installing weak dependencies:
 perl-Encode-Locale             noarch   1.05-9.el8           AppStream    21 k
 perl-IO-Socket-SSL             noarch   2.060-2.el8          AppStream   289 k
 perl-Mozilla-CA                noarch   20160104-7.el8       AppStream    15 k
 perl-TermReadKey               x86_64   2.37-7.el8           AppStream    40 k

Transaction Summary
================================================================================
Install  160 Packages

Total download size: 30 M
Installed size: 95 M
Downloading Packages:
(1/160): apr-util-1.6.0-1.x86_64.rpm            148 kB/s | 103 kB     00:00
  ... (removed for space limitations on stackoverflow)
(160/160): perl-interpreter-5.26.3-416.el8.x86_ 7.6 MB/s | 6.3 MB     00:00
--------------------------------------------------------------------------------
Total                                           5.6 MB/s |  30 MB     00:05
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : perl-Exporter-5.72-396.el8.noarch                    1/160
  ... (removed for space limitations on stackoverflow)
  Installing       : perl-4:5.26.3-416.el8.x86_64                       159/160
  Running scriptlet: cwp-httpd-2.4.39-3.x86_64                          160/160
  Installing       : cwp-httpd-2.4.39-3.x86_64                          160/160
  Running scriptlet: cwp-httpd-2.4.39-3.x86_64                          160/160
  Verifying        : cwp-httpd-2.4.39-3.x86_64                            1/160
  ... (removed for space limitations on stackoverflow)
  Verifying        : python3-pyparsing-2.1.10-7.el8.noarch              160/160

Installed:
  cwp-httpd-2.4.39-3.x86_64
  apr-util-1.6.0-1.x86_64
  apr-1.6.2-1.x86_64
  perl-Encode-Locale-1.05-9.el8.noarch
  perl-IO-Socket-SSL-2.060-2.el8.noarch
  perl-Mozilla-CA-20160104-7.el8.noarch
  perl-TermReadKey-2.37-7.el8.x86_64
  compat-openssl10-1:1.0.2o-3.el8.x86_64
  dwz-0.12-9.el8.x86_64
  efi-srpm-macros-3-2.el8.noarch
  ghc-srpm-macros-1.4.2-7.el8.noarch
  go-srpm-macros-2-16.el8.noarch
  libpq-10.5-1.el8.x86_64
  ocaml-srpm-macros-5-4.el8.noarch
  openblas-srpm-macros-2-2.el8.noarch
  perl-4:5.26.3-416.el8.x86_64
  perl-Algorithm-Diff-1.1903-9.el8.noarch
  perl-Archive-Tar-2.30-1.el8.noarch
  perl-Archive-Zip-1.60-3.el8.noarch
  perl-Attribute-Handlers-0.99-416.el8.noarch
  perl-B-Debug-1.26-2.el8.noarch
  perl-CPAN-2.18-397.el8.noarch
  perl-CPAN-Meta-2.150010-396.el8.noarch
  perl-CPAN-Meta-Requirements-2.140-396.el8.noarch
  perl-CPAN-Meta-YAML-0.018-397.el8.noarch
  perl-Compress-Bzip2-2.26-6.el8.x86_64
  perl-Compress-Raw-Bzip2-2.081-1.el8.x86_64
  perl-Compress-Raw-Zlib-2.081-1.el8.x86_64
  perl-Config-Perl-V-0.30-1.el8.noarch
  perl-DB_File-1.842-1.el8.x86_64
  perl-Data-OptList-0.110-6.el8.noarch
  perl-Data-Section-0.200007-3.el8.noarch
  perl-Devel-PPPort-3.36-5.el8.x86_64
  perl-Devel-Peek-1.26-416.el8.x86_64
  perl-Devel-SelfStubber-1.06-416.el8.noarch
  perl-Devel-Size-0.81-2.el8.x86_64
  perl-Digest-1.17-395.el8.noarch
  perl-Digest-MD5-2.55-396.el8.x86_64
  perl-Digest-SHA-1:6.02-1.el8.x86_64
  perl-Encode-devel-4:2.97-3.el8.x86_64
  perl-Env-1.04-395.el8.noarch
  perl-ExtUtils-CBuilder-1:0.280230-2.el8.noarch
  perl-ExtUtils-Command-1:7.34-1.el8.noarch
  perl-ExtUtils-Embed-1.34-416.el8.noarch
  perl-ExtUtils-Install-2.14-4.el8.noarch
  perl-ExtUtils-MM-Utils-1:7.34-1.el8.noarch
  perl-ExtUtils-MakeMaker-1:7.34-1.el8.noarch
  perl-ExtUtils-Manifest-1.70-395.el8.noarch
  perl-ExtUtils-Miniperl-1.06-416.el8.noarch
  perl-ExtUtils-ParseXS-1:3.35-2.el8.noarch
  perl-File-Fetch-0.56-2.el8.noarch
  perl-File-HomeDir-1.002-4.el8.noarch
  perl-File-Which-1.22-2.el8.noarch
  perl-Filter-2:1.58-2.el8.x86_64
  perl-Filter-Simple-0.94-2.el8.noarch
  perl-IO-Compress-2.081-1.el8.noarch
  perl-IO-Socket-IP-0.39-5.el8.noarch
  perl-IO-Zlib-1:1.10-416.el8.noarch
  perl-IPC-Cmd-2:1.02-1.el8.noarch
  perl-IPC-SysV-2.07-397.el8.x86_64
  perl-IPC-System-Simple-1.25-17.el8.noarch
  perl-JSON-PP-1:2.97.001-3.el8.noarch
  perl-Locale-Codes-3.57-1.el8.noarch
  perl-Locale-Maketext-1.28-396.el8.noarch
  perl-Locale-Maketext-Simple-1:0.21-416.el8.noarch
  perl-MRO-Compat-0.13-4.el8.noarch
  perl-Math-BigInt-FastCalc-0.500.600-6.el8.x86_64
  perl-Math-BigRat-0.2614-1.el8.noarch
  perl-Memoize-1.03-416.el8.noarch
  perl-Module-Build-2:0.42.24-5.el8.noarch
  perl-Module-CoreList-1:5.20181130-1.el8.noarch
  perl-Module-CoreList-tools-1:5.20181130-1.el8.noarch
  perl-Module-Load-1:0.32-395.el8.noarch
  perl-Module-Load-Conditional-0.68-395.el8.noarch
  perl-Module-Loaded-1:0.08-416.el8.noarch
  perl-Module-Metadata-1.000033-395.el8.noarch
  perl-Net-Ping-2.55-416.el8.noarch
  perl-Net-SSLeay-1.85-6.el8.x86_64
  perl-Package-Generator-1.106-11.el8.noarch
  perl-Params-Check-1:0.38-395.el8.noarch
  perl-Params-Util-1.07-22.el8.x86_64
  perl-Perl-OSType-1.010-396.el8.noarch
  perl-PerlIO-via-QuotedPrint-0.08-395.el8.noarch
  perl-Pod-Checker-4:1.73-395.el8.noarch
  perl-Pod-Html-1.22.02-416.el8.noarch
  perl-Pod-Parser-1.63-396.el8.noarch
  perl-SelfLoader-1.23-416.el8.noarch
  perl-Software-License-0.103013-2.el8.noarch
  perl-Sub-Exporter-0.987-15.el8.noarch
  perl-Sub-Install-0.928-14.el8.noarch
  perl-Sys-Syslog-0.35-397.el8.x86_64
  perl-Test-1.30-416.el8.noarch
  perl-Test-Harness-1:3.42-1.el8.noarch
  perl-Test-Simple-1:1.302135-1.el8.noarch
  perl-Text-Balanced-2.03-395.el8.noarch
  perl-Text-Diff-1.45-2.el8.noarch
  perl-Text-Glob-0.11-4.el8.noarch
  perl-Text-Template-1.51-1.el8.noarch
  perl-Thread-Queue-3.13-1.el8.noarch
  perl-Time-HiRes-1.9758-1.el8.x86_64
  perl-Time-Piece-1.31-416.el8.x86_64
  perl-URI-1.73-3.el8.noarch
  perl-Unicode-Collate-1.25-2.el8.x86_64
  perl-autodie-2.29-396.el8.noarch
  perl-bignum-0.49-2.el8.noarch
  perl-devel-4:5.26.3-416.el8.x86_64
  perl-encoding-4:2.22-3.el8.x86_64
  perl-experimental-0.019-2.el8.noarch
  perl-inc-latest-2:0.500-9.el8.noarch
  perl-libnet-3.11-3.el8.noarch
  perl-libnetcfg-4:5.26.3-416.el8.noarch
  perl-local-lib-2.000024-2.el8.noarch
  perl-open-1.11-416.el8.noarch
  perl-perlfaq-5.20180605-1.el8.noarch
  perl-srpm-macros-1-25.el8.noarch
  perl-utils-5.26.3-416.el8.noarch
  perl-version-6:0.99.24-1.el8.x86_64
  python-srpm-macros-3-37.el8.noarch
  python3-rpm-macros-3-37.el8.noarch
  qt5-srpm-macros-5.11.1-2.el8.noarch
  redhat-rpm-config-116-1.el8.0.1.noarch
  rust-srpm-macros-5-2.el8.noarch
  systemtap-sdt-devel-4.0-7.el8.x86_64
  make-1:4.2.1-9.el8.x86_64
  perl-Carp-1.42-396.el8.noarch
  perl-Data-Dumper-2.167-399.el8.x86_64
  perl-Encode-4:2.97-3.el8.x86_64
  perl-Errno-1.28-416.el8.x86_64
  perl-Exporter-5.72-396.el8.noarch
  perl-File-Path-2.15-2.el8.noarch
  perl-File-Temp-0.230.600-1.el8.noarch
  perl-Getopt-Long-1:2.50-4.el8.noarch
  perl-HTTP-Tiny-0.074-1.el8.noarch
  perl-IO-1.38-416.el8.x86_64
  perl-MIME-Base64-3.15-396.el8.x86_64
  perl-Math-BigInt-1:1.9998.11-5.el8.noarch
  perl-Math-Complex-1.59-416.el8.noarch
  perl-PathTools-3.74-1.el8.x86_64
  perl-Pod-Escapes-1:1.07-395.el8.noarch
  perl-Pod-Perldoc-3.28-396.el8.noarch
  perl-Pod-Simple-1:3.35-395.el8.noarch
  perl-Pod-Usage-4:1.69-395.el8.noarch
  perl-Scalar-List-Utils-3:1.49-2.el8.x86_64
  perl-Socket-4:2.027-2.el8.x86_64
  perl-Storable-1:3.11-3.el8.x86_64
  perl-Term-ANSIColor-4.06-396.el8.noarch
  perl-Term-Cap-1.17-395.el8.noarch
  perl-Text-ParseWords-3.30-395.el8.noarch
  perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch
  perl-Time-Local-1:1.280-1.el8.noarch
  perl-Unicode-Normalize-1.25-396.el8.x86_64
  perl-constant-1.33-396.el8.noarch
  perl-interpreter-4:5.26.3-416.el8.x86_64
  perl-libs-4:5.26.3-416.el8.x86_64
  perl-macros-4:5.26.3-416.el8.x86_64
  perl-parent-1:0.237-1.el8.noarch
  perl-podlators-4.11-1.el8.noarch
  perl-threads-1:2.21-2.el8.x86_64
  perl-threads-shared-1.58-2.el8.x86_64
  python3-pyparsing-2.1.10-7.el8.noarch

Complete!
Last metadata expiration check: 0:01:19 ago on Sat 23 Nov 2019 03:22:59 PM EST.
Package cwp-suphp-0.7.2-3.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

#############################################
Please wait... Installing PHP ...
#############################################

Last metadata expiration check: 0:01:20 ago on Sat 23 Nov 2019 03:22:59 PM EST.
Error:
 Problem: cannot install the best candidate for the job
  - nothing provides libpng15.so.15()(64bit) needed by cwp-php-5.6.37-1.x86_64
  - nothing provides libpng15.so.15(PNG15_0)(64bit) needed by cwp-php-5.6.37-1.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

Compiler requires 512 MB RAM + SWAP
Installation FAILED at php
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   899  100   899    0     0   1872      0 --:--:-- --:--:-- --:--:--  1869
sh: line 36: mysql: command not found
sh: line 46: /usr/local/bin/php: No such file or directory
grep: /etc/init.d/httpd: No such file or directory
Received
#

In order to try to resolve the errors, which seem to be primarily this:

Error:
 Problem: cannot install the best candidate for the job
  - nothing provides libpng15.so.15()(64bit) needed by cwp-php-5.6.37-1.x86_64
  - nothing provides libpng15.so.15(PNG15_0)(64bit) needed by cwp-php-5.6.37-1.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

Compiler requires 512 MB RAM + SWAP
Installation FAILED at php
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   899  100   899    0     0   1872      0 --:--:-- --:--:-- --:--:--  1869
sh: line 36: mysql: command not found
sh: line 46: /usr/local/bin/php: No such file or directory
grep: /etc/init.d/httpd: No such file or directory

Firstly, I tried to install php manually, and was able to successfully do so with yum install php. However, the installer still proceeded with the identical problem, nothing changed.

The preceeding errors like nothing provides libpng15.so.15()(64bit) I tried to resolve by manually installing libpng, but it seems that libpng is already installed.

# yum install libpng
Last metadata expiration check: 0:06:35 ago on Sat 23 Nov 2019 03:26:25 PM EST.
Package libpng-2:1.6.34-5.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

However, it's possibly because libpng15 as asked for by cwp is an older package. See https://pkgs.org/download/libpng15.so.15()(64bit), which I found the rpm for CentOS at https://centos.pkgs.org/7/centos-x86_64/libpng-1.5.13-7.el7_2.x86_64.rpm.html

An attempt to install libpng15 from the rpm (since it can't be found with yum install libpng15), results in another error:

c# rpm -ivh http://mirror.centos.org/centos/7/os/x86_64/Packages/libpng-1.5.13-7.el7_2.x86_64.rpm
Retrieving http://mirror.centos.org/centos/7/os/x86_64/Packages/libpng-1.5.13-7.el7_2.x86_64.rpm
warning: /var/tmp/rpm-tmp.lWZHpk: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
        package libpng-2:1.6.34-5.el8.x86_64 (which is newer than libpng-2:1.5.13-7.el7_2.x86_64) is already installed
        file /usr/share/man/man5/png.5.gz from install of libpng-2:1.5.13-7.el7_2.x86_64 conflicts with file from package libpng-2:1.6.34-5.el8.x86_64

It seems that libpng16 is already installed, so libpng15 can't be installed with libpng16 installed.

The error, Compiler requires 512 MB RAM + SWAP doesn't make sense, since I have 24GB of RAM.

Here is my setup:

# df -h
Filesystem           Size  Used Avail Use% Mounted on
devtmpfs             2.0G     0  2.0G   0% /dev
tmpfs                2.0G     0  2.0G   0% /dev/shm
tmpfs                2.0G   18M  2.0G   1% /run
tmpfs                2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/mapper/cl-root   13G  1.9G   11G  15% /
/dev/mapper/cl-tmp   5.5G   72M  5.4G   2% /tmp
/dev/mapper/cl-home  199G  1.5G  198G   1% /home
/dev/sda1            2.0G  182M  1.7G  10% /boot
tmpfs                3.2G     0  3.2G   0% /run/user/0

The error sh: line 36: mysql: command not found comes from the fact that I can't seem to get mysql installed due to MariaDB conflict.

The error grep: /etc/init.d/httpd: No such file or directory seems to be because apache is not installed, of course, possibly because the script ended without installing it? Not sure.

Please help me get CentOS Web Panel installed on CentOS 8. Thank you!

Body:
As per CWP Installation Instructions, they have installation for CentOS 8. Below are the instructions:

#cd /usr/local/src
#wget http://centos-webpanel.com/cwp-el8-latest
#chmod +x cwp-el8-latest
#bash cwp-el8-latest

The shell script shall install all the necessary packages through yum.


问:
Incremental counter right before each

This should be easy, although I spent over 4 hours and nothing! I REALLY need to add a counter for
 tag, inside an specific DIV CLASS, to count lyric lines, and "echo" the corresponding number on each line right before the
. I understand that this can´t be done by css, like happens with
, because
 won´t allow before and after css conditionals. Will really appreciate the help.

Example:

Every time when I look in the mirror 1

All these lines on my face getting clearer 2

The past is gone 3

And it went by, like dusk to dawn 4

Isn't that the way? 5

Everybody's got their dues in life to pay 6

Yeah, I know nobody knows 7

Where it comes and where it goes 8

I know it's everybody's sin 9

You got to lose to know how to win 10

答:
You can simply count the numbers of any tags from simple javascript code.

let countbr = document.getElementsByClassName('count-br')[0].getElementsByTagName('br').length;
console.log('Total
 count on class count-br: ',countbr);```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="count-br">
  This page has 4 br
  </br>
test
</br>
test test test
</br>
</br>
</div>

<div class="donot-count-br">
  This section has 3 br
  </br>
test
</br>
test test test
</br>
</div></code>```

Title: Incremental counter right before each <br />

Body:
You can simply count the numbers of any tags from simple javascript code.

let countbr = document.getElementsByClassName('count-br')[0].getElementsByTagName('br').length;
console.log('Total </br> count on class count-br: ',countbr);

<div class="count-br">
  This page has 4 br
  </br>
test
</br>
test test test
</br>
</br>
</div>

<div class="donot-count-br">
  This section has 3 br
  </br>
test
</br>
test test test
</br>
</div>


问:
Drawing an array of PictureBoxes in vb.net
I'm trying to draw an array of PictureBoxes, for testing I use the same picture for each picturebox.

But instead of showing the picture, it shows the color blue.

I would show you a picture, but I dont have 10 reputation..

```<code>        Dim teren(120) As PictureBox
        Dim x_locatie As Integer = 1, y_locatie As Integer = 0
        For i = 0 To 10
        x_locatie = 210
        For j = 0 To 12
            teren(i * j) = New PictureBox()
            teren(i * j).Size = New Size(61, 61)
            teren(i * j).Name = "x" + i.ToString + "y" + j.ToString
            teren(i * j).Location = New Point(x_locatie, y_locatie)
            Dim locatie As String = folder + "\harta\test.png"
            teren(i * j).ImageLocation = locatie
            teren(i * j).Show()
        Next
        y_locatie += 61
    Next
</code>```

I also tried another method , but same result.

```<code>Sub PictureBox1_Paint(sender1 As Object, er As PaintEventArgs)
    If myImage IsNot Nothing Then
        Dim r As New Rectangle(x, y, xlatime, ylungime)
        er.Graphics.DrawImage(myImage, r)
    End If
End Sub

Sub deseneaza(ByVal poza As String, ByRef x_perm As Integer, ByRef y_perm As Integer, ByRef lungime As Integer, ByRef latime As Integer)
    myImage = Image.FromFile(poza)
    x = x_perm
    y = y_perm
    xlatime = latime
    ylungime = lungime
    Refresh()
End Sub

 'this part of code is in body of another function
 Dim x_locatie As Integer = 1, y_locatie As Integer = 0
        For i = 0 To 10
        x_locatie = 210
        For j = 0 To 12
            Dim locatie As String = folder + "\harta\test.png"
            deseneaza(locatie, x_locatie, y_locatie, 61, 61)
        Next
        y_locatie += 61
    Next
</code>```

I saw in other threads that their problem solution was something like that Dim teren() As PictureBox {teren1, teren2 , ... , teren n} But the problem in my case is that I need 120 PictureBoxes, and I think that it must be a way to do this without writing 120 pictureboxes.

答:
```<code>Dim iTop = 325
Dim pBox(48) As PictureBox
Dim pinColor = Color.SkyBlue
Dim leftStart = 50
For j = 0 To 3
    For i = 0 To 11
        pBox(i) = New PictureBox
        'pBox(i).Image = Image.FromFile("\NoTest.bmp")
        pBox(i).Visible = True
        pBox(i).BackColor = pinColor
        pBox(i).Top = iTop + (j * 40)

        pBox(i).Width = 20
        pBox(i).Height = 20
        pBox(i).Left = leftStart + (35 * i)
        If i > 9 Then
            pBox(i).Left = leftStart + (35 * i) + 15
            pBox(i).Width = 25
        End If

        pBox(i).BringToFront()
        pBox(i).SizeMode = PictureBoxSizeMode.StretchImage
        Controls.Add(pBox(i))
    Next
Next
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I'm trying to draw an array of PictureBoxes, for testing I use the same picture for each picturebox.

But instead of showing the picture, it shows the color blue.

I would show you a picture, but I dont have 10 reputation..

        Dim teren(120) As PictureBox
        Dim x_locatie As Integer = 1, y_locatie As Integer = 0
        For i = 0 To 10
        x_locatie = 210
        For j = 0 To 12
            teren(i * j) = New PictureBox()
            teren(i * j).Size = New Size(61, 61)
            teren(i * j).Name = "x" + i.ToString + "y" + j.ToString
            teren(i * j).Location = New Point(x_locatie, y_locatie)
            Dim locatie As String = folder + "\harta\test.png"
            teren(i * j).ImageLocation = locatie
            teren(i * j).Show()
        Next
        y_locatie += 61
    Next

I also tried another method , but same result.

Sub PictureBox1_Paint(sender1 As Object, er As PaintEventArgs)
    If myImage IsNot Nothing Then
        Dim r As New Rectangle(x, y, xlatime, ylungime)
        er.Graphics.DrawImage(myImage, r)
    End If
End Sub

Sub deseneaza(ByVal poza As String, ByRef x_perm As Integer, ByRef y_perm As Integer, ByRef lungime As Integer, ByRef latime As Integer)
    myImage = Image.FromFile(poza)
    x = x_perm
    y = y_perm
    xlatime = latime
    ylungime = lungime
    Refresh()
End Sub

 'this part of code is in body of another function
 Dim x_locatie As Integer = 1, y_locatie As Integer = 0
        For i = 0 To 10
        x_locatie = 210
        For j = 0 To 12
            Dim locatie As String = folder + "\harta\test.png"
            deseneaza(locatie, x_locatie, y_locatie, 61, 61)
        Next
        y_locatie += 61
    Next

I saw in other threads that their problem solution was something like that Dim teren() As PictureBox {teren1, teren2 , ... , teren n} But the problem in my case is that I need 120 PictureBoxes, and I think that it must be a way to do this without writing 120 pictureboxes.


问:
"The certificate chain was issued by an authority that is not trusted" when connecting DB in VM Role from Azure website
I am experiencing an error when connecting MY DB which is in VM Role (I have SQL VM Role) from Azure Website. Both VM Role and Azure Website are in West zone. I am facing the following issue:

SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)]

I am able to connect to my DB using SSMS. Port 1433 is open on my VM role.
What is wrong with my connection?

答:
I was getting the same error when trying to connect to MS SQL Server instance hosted on Google Cloud Platform using SSMS with unchecked Trust server certificate under the connection properties tab. I managed to trust the certificate by importing the GCP's provided certificate's authority to my local computer's list of Trusted Root Certification Authorities.

Read full description and resolution here.


问:
How can I change text with a button onClick 1 and then revert onClick 2?
I can get the text to change easily just once but I want to know how I can change it back to the original text. This was my last approach.

function change() {

  var el = document.getElementById("demo").innerHTML;
  if (el e == "A Paragraph.") {
    document.getElementById("demo").innerHTML = "Paragraph changed.";
  }
  if (el == "Paragraph changed.") {
    document.getElementById("demo").innerHTML = "A paragraph.";
  }```
<pre class="snippet-code-html lang-html prettyprint-override"><code><h2>Demo JavaScript in Head</h2>

<p id="demo">A Paragraph.</p>

<button type="button" onclick="change()">Try it</button></code>```

答:
The issue is more related to the content and case of the text.

function toggleColor() {

  var el = document.getElementById("demo").innerHTML;
  if (el === "A Paragraph.") {
    document.getElementById("demo").innerHTML = "Paragraph changed.";
  }
  if (el === "Paragraph changed.") {
    document.getElementById("demo").innerHTML = "A Paragraph.";
  }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><h2>Demo JavaScript in Head</h2>

<p id="demo">A Paragraph.</p>

<button type="button" onclick="toggleColor()">Try it</button></code>```

Body:
I can get the text to change easily just once but I want to know how I can change it back to the original text. This was my last approach.

function change() {

  var el = document.getElementById("demo").innerHTML;
  if (el e == "A Paragraph.") {
    document.getElementById("demo").innerHTML = "Paragraph changed.";
  }
  if (el == "Paragraph changed.") {
    document.getElementById("demo").innerHTML = "A paragraph.";
  }

Demo JavaScript in Head

A Paragraph.

<button type="button" onclick="change()">Try it</button>

Body:
The issue is more related to the content and case of the text.

function toggleColor() {

  var el = document.getElementById("demo").innerHTML;
  if (el === "A Paragraph.") {
    document.getElementById("demo").innerHTML = "Paragraph changed.";
  }
  if (el === "Paragraph changed.") {
    document.getElementById("demo").innerHTML = "A Paragraph.";
  }
}

<h2>Demo JavaScript in Head</h2>

<p id="demo">A Paragraph.</p>

<button type="button" onclick="toggleColor()">Try it</button>


问:
How to use Microsoft.Win32.Registry.OpenSubKey to go directly to a particular key?
Now this is a simple question. It should be clearly documented in MSDN. I looked but I couldn't find it. The only thing I got was that I had to open subkey after subkey after subkey to get to the particular key I'm interested in.

Surely there is a more direct method to access a key 3 levels deep. What is it?

I've already tried

```<code>RegistryKey reg = Registry.LocalMachine;
reg.OpenSubKey(@"Software\Microsoft", true);  // reg is still HKLM !
</code>```

and

```<code>reg.OpenSubKey(@"Software\Microsoft\", true); // reg is still HKLM !
</code>```

答:
I think you are expecting the OpenSubKey() method to do something to reg - somehow to make it point to the sub key. It doesn't work that way. OpenSubKey() returns a new object of type  RegistryKey which can be used to retrieve the value of, or modify, the sub key. So you need:

```<code>RegistryKey reg = Registry.LocalMachine;
RegistryKey subKey = reg.OpenSubKey(@"Software\Microsoft", true);
</code>```

Body:
Now this is a simple question. It should be clearly documented in MSDN. I looked but I couldn't find it. The only thing I got was that I had to open subkey after subkey after subkey to get to the particular key I'm interested in.

Surely there is a more direct method to access a key 3 levels deep. What is it?

I've already tried

RegistryKey reg = Registry.LocalMachine;
reg.OpenSubKey(@"Software\Microsoft", true);  // reg is still HKLM !

and

reg.OpenSubKey(@"Software\Microsoft\", true); // reg is still HKLM !

Body:
I think you are expecting the OpenSubKey() method to do something to reg - somehow to make it point to the sub key. It doesn't work that way. OpenSubKey() returns a new object of type  RegistryKey which can be used to retrieve the value of, or modify, the sub key. So you need:

RegistryKey reg = Registry.LocalMachine;
RegistryKey subKey = reg.OpenSubKey(@"Software\Microsoft", true);


问:
How check if a node exists in Java using conditional operator?
```<code>Node curr;
if(curr) sop(curr.data)
</code>```

This is throwing an error that Node cannot be converted to boolean. Can anyone please suggest a way to check if the node exist or not?

答:
Can you try it as:

```<code>Node curr;

if(curr != null) {
    sop(curr.data)
}
</code>```

The reason is unlike C++, we can not use objects as booleans in case they are null.

Body:
Node curr;
if(curr) sop(curr.data)

This is throwing an error that Node cannot be converted to boolean. Can anyone please suggest a way to check if the node exist or not?

Body:
Can you try it as:

Node curr;

if(curr != null) {
    sop(curr.data)
}

The reason is unlike C++, we can not use objects as booleans in case they are null.


问:
How to create a subfolder of a Uri folder, Android 10+?
It was here before SDK 29, but now it is required.

My app creates a cascade of folders to manage its content. All the content is meant to be stored inside any folder the user chooses, but for the living hell, I can't figure out, how to create a folder in a Uri folder and access it later (because Storage access framework - ACTION_OPEN_DOCUMENT_TREE).

I tried to create a folder and a file inside using DocumentFile, which worked well (now that doesn't work either), on the other hand, when I copied some files to that directory, it prohibited me from accessing those files in any way. I need to access those files even if I move them as I have a copy of the older content I had on a different device, but now it cannot access those files.

One more thing to add, the first time I tried to log the filenames it worked. But when I ran the code once again, it gave me SecurityExceptions about not using ACTION_OPEN_DOCUMENT to get those files' references. But it should give me full power over the selected directory, right?

Used code to create a subFile/subFolder:

DocumentFile file = DocumentFile.fromTreeUri(context, data.getData());

public DocumentFile getChild(String name) {
    DocumentFile child = file.findFile(name);
    if (name.matches(".*\\..{3,4}$")) {
        String mimetype = MimeTypeMap.getSingleton().getMimeTypeFromExtension(
                name.substring(name.lastIndexOf('.')));
        return child != null ? child : file.createFile(
                mimetype == null ? "application/dat" : mimetype, name);
    }
    return child != null ? child : file.createDirectory(name);
}
```

Any reference to a manual I couldn't find would help.

答:
Edited, you need to add getflags on creating anything in folder.

```<code>final int takeFlags = intent.getFlags() &
(Intent.FLAG_GRANT_READ_URI_PERMISSION |
Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
</code>```

The object t is a shared prefernce just to save the strings uri, you can switch them.out for your object.

Use this when you need to create folder, use in public void as function

```<code>Intent intent = new
Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
startActivityForResult(intent,
NEW_FOLDER_REQUEST_CODE);
</code>```

Use this to get activity result of  created folder

```<code>if (_resultCode == Activity.RESULT_OK) {
if (_requestCode ==
NEW_FOLDER_REQUEST_CODE) { if (_data !=
null) { Uri currentUri =
_data.getData();
DocumentFile pickedDir =
DocumentFile.fromTreeUri(this,
currentUri);
DocumentFile newDir =
pickedDir.createDirectory("MyFolder");

final int takeFlags =
Intent.FLAG_GRANT_READ_URI_PERMISSION |
Intent.FLAG_GRANT_WRITE_URI_PERMISSION;

} } }
</code>```

Body:
It was here before SDK 29, but now it is required.

My app creates a cascade of folders to manage its content. All the content is meant to be stored inside any folder the user chooses, but for the living hell, I can't figure out, how to create a folder in a Uri folder and access it later (because Storage access framework - ACTION_OPEN_DOCUMENT_TREE).

I tried to create a folder and a file inside using DocumentFile, which worked well (now that doesn't work either), on the other hand, when I copied some files to that directory, it prohibited me from accessing those files in any way. I need to access those files even if I move them as I have a copy of the older content I had on a different device, but now it cannot access those files.

One more thing to add, the first time I tried to log the filenames it worked. But when I ran the code once again, it gave me SecurityExceptions about not using ACTION_OPEN_DOCUMENT to get those files' references. But it should give me full power over the selected directory, right?

Used code to create a subFile/subFolder:

DocumentFile file = DocumentFile.fromTreeUri(context, data.getData());

public DocumentFile getChild(String name) {
    DocumentFile child = file.findFile(name);
    if (name.matches(".*\\..{3,4}$")) {
        String mimetype = MimeTypeMap.getSingleton().getMimeTypeFromExtension(
                name.substring(name.lastIndexOf('.')));
        return child != null ? child : file.createFile(
                mimetype == null ? "application/dat" : mimetype, name);
    }
    return child != null ? child : file.createDirectory(name);
}

Any reference to a manual I couldn't find would help.

Body:
Edited, you need to add getflags on creating anything in folder.

final int takeFlags = intent.getFlags() &
(Intent.FLAG_GRANT_READ_URI_PERMISSION |
Intent.FLAG_GRANT_WRITE_URI_PERMISSION);

The object t is a shared prefernce just to save the strings uri, you can switch them.out for your object.

Use this when you need to create folder, use in public void as function

Intent intent = new
Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
startActivityForResult(intent,
NEW_FOLDER_REQUEST_CODE);

Use this to get activity result of  created folder

if (_resultCode == Activity.RESULT_OK) {
if (_requestCode ==
NEW_FOLDER_REQUEST_CODE) { if (_data !=
null) { Uri currentUri =
_data.getData();
DocumentFile pickedDir =
DocumentFile.fromTreeUri(this,
currentUri);
DocumentFile newDir =
pickedDir.createDirectory("MyFolder");

final int takeFlags =
Intent.FLAG_GRANT_READ_URI_PERMISSION |
Intent.FLAG_GRANT_WRITE_URI_PERMISSION;

} } }


问:
How do iterate a sequence with varying starting positions
Say I have an array:

```<code>[10,12,20,50]
</code>```

I can iterate though this array like normal which would look at the position at 0, then 1, 2, and 3.

What if I wanted to start an any arbritrary position in the array, and then go through all the numbers in order.

So the other permutations would be:

```<code>10,12,20,50
12,20,50,10
20,50,10,12
50,10,12,20
</code>```

Is there a general function that would allow me to do this type of sliding iteration?

so looking at the index positions from the above it would be:

```<code>0,1,2,3
1,2,3,0
2,3,0,1
3,0,1,2
</code>```

It would be great if some languages have this built in, but I want to know the algorithm to do this also so I understand.

答:
There is no language builtin. There is a similar method permutations, but it will generate all permutations without the order, which doesn't really fit your need.

Your requirement can be implemented with a simple algorithm where you just concatenates two slices:

```<code>def orderedPermutation(in: List[Int]): Seq[List[Int]] = {
  for(i <- 0 until in.size) yield
    in.slice(i, in.size) ++ in.slice(0, i)
}

orderedPermutation(List(10,12,20,50)).foreach(println)
</code>```

Working code here

Body:
Say I have an array:

[10,12,20,50]

I can iterate though this array like normal which would look at the position at 0, then 1, 2, and 3.

What if I wanted to start an any arbritrary position in the array, and then go through all the numbers in order.

So the other permutations would be:

10,12,20,50
12,20,50,10
20,50,10,12
50,10,12,20

Is there a general function that would allow me to do this type of sliding iteration?

so looking at the index positions from the above it would be:

0,1,2,3
1,2,3,0
2,3,0,1
3,0,1,2

It would be great if some languages have this built in, but I want to know the algorithm to do this also so I understand.

Body:
There is no language builtin. There is a similar method permutations, but it will generate all permutations without the order, which doesn't really fit your need.

Your requirement can be implemented with a simple algorithm where you just concatenates two slices:

def orderedPermutation(in: List[Int]): Seq[List[Int]] = {
  for(i <- 0 until in.size) yield
    in.slice(i, in.size) ++ in.slice(0, i)
}

orderedPermutation(List(10,12,20,50)).foreach(println)

Working code here


问:
Why is empty space a character digit?
I am consuming a long string guaranteed to only be separated by a single white space. I am splitting by whitespace and then counting the substrings that are only digits.

```<code>var words = longString.split(' ');
var numWordsThatAreNums = 0;

foreach (var word in words) {
   if (word.All(c => c >= '0' && c<= '9')) {
      numWordsThatAreNums++;
   }
}
</code>```

There is a long string that I have verified to have 20 numbers and yet I get 21 for the count. For testing purposes, if the condition above is true, I add the number to a list. At the end, if I print each value from that list on its line

```<code>Console.WriteLine("Here is" + digit" + "!");
</code>```

the final line is simply blank. Example

```<code>"Here is1!"
"Here is98!"
"Here is44!"
...
"Here is!"
</code>```

答:
the most obvious explanation is that you have a trailing ' ', and so a zero length string, that will match your .All test.

You need to set the split flag to say ignore empty entries see

https://learn.microsoft.com/en-us/dotnet/api/system.stringsplitoptions?view=net-6.0

Title: Why is empty space a character digit?

Body:
I am consuming a long string guaranteed to only be separated by a single white space. I am splitting by whitespace and then counting the substrings that are only digits.

var words = longString.split(' ');
var numWordsThatAreNums = 0;

foreach (var word in words) {
   if (word.All(c => c >= '0' && c<= '9')) {
      numWordsThatAreNums++;
   }
}

There is a long string that I have verified to have 20 numbers and yet I get 21 for the count. For testing purposes, if the condition above is true, I add the number to a list. At the end, if I print each value from that list on its line

Console.WriteLine("Here is" + digit" + "!");

the final line is simply blank. Example

"Here is1!"
"Here is98!"
"Here is44!"
...
"Here is!"


问:
How to draw sine waves with SVG (+JS)?
What would be the simplest solution to draw sine waves in SVG?
I guess sine waves should be repeated in a simple loop with JavaScript... :)

Here are the X-Y coordinates as a good start... :)

http://jsbin.com/adaxuy/1/edit

```<code><svg>
  <line x1="0" y1="250" x2="500" y2="250"
        style="stroke:black;stroke-width:1"/>
  <line x1="250" y1="0" x2="250" y2="500"
        style="stroke:black;stroke-width:1"/>
</svg>
</code>```

答:
Here's a CDMA illustration where I've used cubic splines for illustrating CDMA concepts. First define these functions:

```<code><script>
function go(x,y) {return(`M ${x},${y}`)}
function to(y) {return(`c 5 0 5 ${y} 10 ${y}`)}
function dn(y=10) {return to(y)}
function up(y=10) {return to(-y)}
function path(d,color='black') {return `<path d="${d}" stroke=${color} fill="none"/>`}
function svg(t) {return `<svg>${t}</svg>`}
function bits(n) {
  let s='', n0=(n>>1)
  for (m=0x80;m;m>>=1) s+= up(10* (!(m&n0)-!(m&n))  )
  return s;
}
function plot(a) {
  let s='', y0=0
  for (let y of a) {
    s += up(y-y0); y0=y
  }
  return s
}
function add(a) {
  let s=''
  if typeof y0 == 'undefined' var y0=0
  for (m=0x80;m;m>>=1) {
    let y=0; for (let e of a) y+= 5-10*!(e&m)
    s += up(y-y0); y0=y
  }
  return s
}
</script>
</code>```

Then you can roughly illustrate waves like this:

```<code><script>
  document.write(svg(path(go(0,25)+(up()+dn()).repeat(10))))
</script>
</code>```

Here's an illustration of CDMA using this technique

```<code><h1>CDMA Example</h1>
<script>
a=0b00010010
b=0b00010101
document.write(svg(
  path(go(0,40)+bits(a)+bits(~a)+bits(a)+bits(~a)+bits(a),'red')+
  path(go(0,80)+bits(b)+bits(b)+bits(~b)+bits(~b)+bits(~b),'orange')+
  path(go(0,100+add([a,b])+add([~a,b])+add([a,~b])+add([~a,~b])+add([a,b])+add([~a,~b])))
))
</script>
</code>```

NOTE: actual CDMA signals would not be bit-aligned or even chip-aligned

Title: How to draw sine waves with SVG (+JS)?

Body:
What would be the simplest solution to draw sine waves in SVG?
I guess sine waves should be repeated in a simple loop with JavaScript... :)

Here are the X-Y coordinates as a good start... :)

http://jsbin.com/adaxuy/1/edit

<svg>
  <line x1="0" y1="250" x2="500" y2="250"
        style="stroke:black;stroke-width:1"/>
  <line x1="250" y1="0" x2="250" y2="500"
        style="stroke:black;stroke-width:1"/>
</svg>

Body:
Here's a CDMA illustration where I've used cubic splines for illustrating CDMA concepts. First define these functions:

<script>
function go(x,y) {return(`M ${x},${y}`)}
function to(y) {return(`c 5 0 5 ${y} 10 ${y}`)}
function dn(y=10) {return to(y)}
function up(y=10) {return to(-y)}
function path(d,color='black') {return `<path d="${d}" stroke=${color} fill="none"/>`}
function svg(t) {return `<svg>${t}</svg>`}
function bits(n) {
  let s='', n0=(n>>1)
  for (m=0x80;m;m>>=1) s+= up(10* (!(m&n0)-!(m&n))  )
  return s;
}
function plot(a) {
  let s='', y0=0
  for (let y of a) {
    s += up(y-y0); y0=y
  }
  return s
}
function add(a) {
  let s=''
  if typeof y0 == 'undefined' var y0=0
  for (m=0x80;m;m>>=1) {
    let y=0; for (let e of a) y+= 5-10*!(e&m)
    s += up(y-y0); y0=y
  }
  return s
}
</script>

Then you can roughly illustrate waves like this:

<script>
  document.write(svg(path(go(0,25)+(up()+dn()).repeat(10))))
</script>

Here's an illustration of CDMA using this technique

<h1>CDMA Example</h1>
<script>
a=0b00010010
b=0b00010101
document.write(svg(
  path(go(0,40)+bits(a)+bits(~a)+bits(a)+bits(~a)+bits(a),'red')+
  path(go(0,80)+bits(b)+bits(b)+bits(~b)+bits(~b)+bits(~b),'orange')+
  path(go(0,100+add([a,b])+add([~a,b])+add([a,~b])+add([~a,~b])+add([a,b])+add([~a,~b])))
))
</script>

NOTE: actual CDMA signals would not be bit-aligned or even chip-aligned


问:
Converting Command line argument to standard input in Python
How is it possible to convert a script accepting a command-line argument to be able to receive the argument through standard user input?

Currently I have a file and to process it I need to run python abc.py query
whereas I would like the file to be able to run through python abc.py and then in the next line it should ask the user for input through raw_input and the response should be passed to argument (i.e. 'query').

答:
There is no way to make this happen without changing abc.py itself.

If you can change abc.py then a good way is to have it check for the command-line argument, and if it's not there then ask for it... something like this:

```<code>if __name__ == '__main__':
    if len(sys.argv) > 1:
        file_to_process = sys.argv[1]
    else:
        file_to_process = raw_input("Enter file to process: ").strip()
</code>```

Body:
There is no way to make this happen without changing abc.py itself.

If you can change abc.py then a good way is to have it check for the command-line argument, and if it's not there then ask for it... something like this:

if __name__ == '__main__':
    if len(sys.argv) > 1:
        file_to_process = sys.argv[1]
    else:
        file_to_process = raw_input("Enter file to process: ").strip()


问:
Change the size of camera to fit a GameObject in Unity/C#
Say I have a GameObject inside a 2D scene and a camera. And I want to change the size and position of the camera so that even when the screen resolution changes, the object will still be visible. So, how can I do that?

答:
TL;DR: Scroll down to the bottom for the code.

First up, we must set the position of the camera to the middle of the object so the scaling of the camera would be easier.

Second, to scale the camera, we're going to change the orthographicSize of the camera in our script (Which is the Size attribute in the Camera component). But how do we calculate the attribute?

Basically, the Size attribute here is half the height of the camera. So, for example, if we set the Size to 5, that mean the height of camera going to be 10 Unity Unit (which is something I made up so you can understand easier).

So, it seems like we just have to get the height of the object, divide it by 2 and set the Size of the camera to the result, right? (1)

Well, not really. You see, while it might work on certain cases, when the width of the object is way, way longer than the screen, and the height if way, way shorter, then the camera would not able to see all of the object.

But why is that? Now, let's say that our camera has a width/height of 16/9, and our object is 100/18. That means if we scale using the height, our camera's width/height would be 32/18, and while it's enough to cover the height, it isn't enough to cover the width. So, another approach is to calculate using the width

By taking the width of the object, divide it by the width of the camera and then multiply with the height of the camera (then of course, divide by 2). We would be able to fit the whole width of the object. (Because of... ratio or something) (2)

BUT AGAIN, it has the same problem as our first approach, but the object being too tall instead too wide.

So, to solve this, we just have to place a check if the first approach (see (1)) if the object is being overflowed, and if it is, then we just use the second approach instead (see (2)). And that's it

And here's the code btw:

// replace the `cam` variable with your camera.

float w = <the_width_of_object>;
float h = <the_height_of_object>;
float x = w * 0.5f - 0.5f;
float y = h * 0.5f - 0.5f;

cam.transform.position = new Vector3(x, y, -10f);

cam.orthographicSize = ((w > h * cam.aspect) ? (float)w / (float)cam.pixelWidth * cam.pixelHeight : h) / 2;

// to add padding, just plus the result of the `orthographicSize` calculation with number, like this:
//                              | |
//                              V V
// ... cam.pixelHeight : h) / 2 + 1
```


问:
VSCODE Javascript ----how to Implicit import library
I want to hide "import" when referencing the library, that is, local/global import, and use the contents of the library normally
Can it be achieved, or is it already achieved?

I use these codes in a plug-in loader, so I don’t need to import it. It’s just a tool for prompting to view annotations.

I am using VSCODE and its built-in JavaScript

example:

```<code>import { mc } from "./Libary/Game/Player";

mc.runcmd('kill u m')
</code>```

want to use:

```<code>mc.runcmd('kill u m')
</code>```

And you can also see comments and function types, etc.

答:
It is not possible in vscode, this feature was introduced in one of the versions of IntelliJ IDEA but they had to roll back to the previous version within 2 weeks. It causes too much trouble for programmers. It became really hard to separate two programs from each other and apart from that the size of the build file keeps on increasing with every new project.

If you still want to do that use the idea shared by @David shortman

Body:
I want to hide "import" when referencing the library, that is, local/global import, and use the contents of the library normally
Can it be achieved, or is it already achieved?

I use these codes in a plug-in loader, so I don’t need to import it. It’s just a tool for prompting to view annotations.

I am using VSCODE and its built-in JavaScript

example:

import { mc } from "./Libary/Game/Player";

mc.runcmd('kill u m')

want to use:

mc.runcmd('kill u m')

And you can also see comments and function types, etc.


问:
How to implement variable height detail band in QuickReports
Delphi 7 and QuickReports. Does anyone know how to implement a variable height detail band so that the area for a detail band is dynamically adjusted to best fit the loaded data from the query? Is this at all possible with QuickReports? If not, do you know of any product that facilitates this?

EDIT

Components used: TQuickRep, TQRBand, and the particular control that will hold the variable size content is TQRExpr

EDIT

The key piece of info not included in the answer is how to assign the expression to a TQRExprMemo since it doesn't have an expression property like TQRExpr. The answer to that is to enclose the expression in { } (eg. "{expression}") and assign it to the Lines property.

Set RemoveBlankLines to True, AutoStretch to True, AutoSize to False.

答: I always use a TQRExprMemo. Set AutoSize to True, AutoStretch to True, and IIRC there's a property to delete/suppress blank lines. I've used this frequently to produce mailing labels, address blocks on letters, and so forth.


问:
Type '({ articles }: Props) => JSX.Element' is not assignable to type 'NextPage<{}, {}>'
I'm just getting into React.js and Next.js after having used Vue.js before. I'm getting a strange typescript error, but weirdly it actually compiles despite VS Code complaining at me as though it wouldn't compile.

I'm trying to pass an array of Article into my home component as a prop.

Here the relevant code:

```<code>interface Article {
  userId: number;
  id: number;
  title: string;
  body: string;
}

interface Props {
  articles: Article | Article[];
}

const Home: NextPage = ({ articles }: Props) => {
  return (
    <div>
      {/* some stuff */}
    </div>
  );
};
</code>```

Home is underlined in red and when I hover over gives the error:

```<code>const Home: NextPage<{}, {}>
Type '({ articles }: Props) => JSX.Element' is not assignable to type 'NextPage<{}, {}>'.
  Type '({ articles }: Props) => JSX.Element' is not assignable to type 'FunctionComponent<{}> & { getInitialProps?(context: NextPageContext): {} | Promise<{}>; }'.
    Type '({ articles }: Props) => JSX.Element' is not assignable to type 'FunctionComponent<{}>'.
      Types of parameters '__0' and 'props' are incompatible.
        Property 'articles' is missing in type '{ children?: ReactNode; }' but required in type 'Props'.
</code>```

Any help or insights as to what could be going on here would be greatly appreciated.

答:
Call it this way,

```<code>const Home: NextPage<Props> = ({ articles }) => {//your code}
</code>```

you're using NextPage type, I used that instead too. It's actually better to use const Home: NextPage as that will type both the component's props and return type.

Body:
I'm just getting into React.js and Next.js after having used Vue.js before. I'm getting a strange typescript error, but weirdly it actually compiles despite VS Code complaining at me as though it wouldn't compile.

I'm trying to pass an array of Article into my home component as a prop.

Here the relevant code:

interface Article {
  userId: number;
  id: number;
  title: string;
  body: string;
}

interface Props {
  articles: Article | Article[];
}

const Home: NextPage = ({ articles }: Props) => {
  return (

      {/* some stuff */}

  );
};

Home is underlined in red and when I hover over gives the error:

const Home: NextPage<{}, {}>
Type '({ articles }: Props) => JSX.Element' is not assignable to type 'NextPage<{}, {}>'.
  Type '({ articles }: Props) => JSX.Element' is not assignable to type 'FunctionComponent<{}> & { getInitialProps?(context: NextPageContext): {} | Promise<{}>; }'.
    Type '({ articles }: Props) => JSX.Element' is not assignable to type 'FunctionComponent<{}>'.
      Types of parameters '__0' and 'props' are incompatible.
        Property 'articles' is missing in type '{ children?: ReactNode; }' but required in type 'Props'.

Any help or insights as to what could be going on here would be greatly appreciated.

Body:
Call it this way,

const Home: NextPage<Props> = ({ articles }) => {//your code}

you're using NextPage type, I used that instead too. It's actually better to use const Home: NextPage as that will type both the component's props and return type.