问:
Pass specific sub array to another page php
So I have a list of items that are being displayed like this :

```<code><tbody>
<?php
$count = 1;
foreach ($parser['LXEPricerGrid']['PassingLoans']['PassingLoan'] as $key) {
?>
   <tr>
   <?php
   echo '<td>' . $count . '</td>';
   echo '<td>' . $key['LerProductName'] . '</td>';
   echo '<td>' . $key['Rate'] . '%</td>';
   echo '<td>' . $key['APR'] . '%</td>';
   echo '<td style="text-align: right">$' . $key['MonthlyPayment'] . '</td>';
   echo '<td><a href="#">Apply</a></td>';
   echo '<td><a href="#">Details</a></td>';
   ?>
   </tr>
   <?php
   $count++;

}
?>
</tbody>
</code>```

Now all is well and good but what i want is that when i click on the Details link it should open another page and show all the values of the specific item against which i clicked details. I m not very good with PHP in React you could pass down as props or do a variety of other stuff but i don't know how to do this with php. any help appreciated.
The array looks like :

``` [PassingLoan] => Array
                        (
                            [0] => Array
                                (
                                    [LerId] => 599
                                    [LerName] => United Wholesale Mortgage
                                    [LerProductId] => 91821
                                    [LerProductName] => Conquest FannieMae Elite 30 Year Fixed
                                    [LoanCategoryClass] => F360
                                    [LoanCategoryAmortization] => 30
                                    [LoanCategoryTerm] => 30
                                    [TargetMargin] => 100.899
                                    [LOComp] => 0.899
                                    [MaxEarningInPoints] => 9999999
                                    [MinEarningInPoints] => 0
                                    [PricesheetCompType] => 0
                                    [LerProductARMIndex] => 11
                                    [IndexName] => N/A
                                    [IndexValue] => 0
                                    [IndexDate] => 04/06/2008
                                    [IndexTime] => 02:48:02 PM
                                    [LerProductARMIndexMargin] => Array
                                        (
                                        )

                                    [LerProductARMLifeCap] => Array
                                        (
                                        )

                                    [LerProductARMFirstAdj] => Array
                                        (
                                        )

                                    [LerProductARMFirstAdjCap] => Array
                                        (
                                        )

                                    [LerProductARMPerAdj] => Array
                                        (
                                        )

                                    [LerProductARMPerAdjCap] => Array
                                        (
                                        )

                                    [LerProductProgram] => 0
                                    [LerProductFannieFreddie_SW] => 0
                                    [HomePath] => No
                                    [DURefi_HARP] => No
                                    [InterestOnly] => No
                                    [OpenAccess_HARP] => No
                                    [LerProductAllowPropertyLocationStandard] => 1
                                    [LerProductAllowPropertyLocationRural] => 1
                                    [LerProductLerPaidMI] => 0
                                    [SubPrime] => 0
                                    [Rate] =>   2.875
                                    [Points] => 101.307
                                    [Base] => 101.307
                                    [RateBase] => 101.307
                                    [Credit] => 1632
                                    [APR] => 2.900
                                    [MonthlyPayment] => 1659.57
                                    [MI] => 0.00
                                    [RateUp1] =>   2.998
                                    [PointsUp1] => 101.793
                                    [BaseUp1] => 101.307
                                    [RateBaseUp1] => 101.793
                                    [CreditUp1] => 3576
                                    [APRUp1] => 2.998
                                    [MonthlyPaymentUp1] => 1685.98
                                    [MIUp1] => 0.00
                                    [RateUp2] => 0
                                    [PointsUp2] => 0.000
                                    [BaseUp2] => 0.000
                                    [RateBaseUp2] => 0.000
                                    [CreditUp2] => 0
                                    [APRUp2] => 0
                                    [MonthlyPaymentUp2] => 0
                                    [MIUp2] => 0
                                    [RateUp3] => 0
                                    [PointsUp3] => 0.000
                                    [RateBaseUp3] => 0.000
                                    [BaseUp3] => 0.000
                                    [CreditUp3] => 0
                                    [APRUp3] => 0
                                    [MonthlyPaymentUp3] => 0
                                    [MIUp3] => 0
                                    [RateUp4] => 0
                                    [PointsUp4] => 0.000
                                    [RateBaseUp4] => 0.000
                                    [BaseUp4] => 0.000
                                    [CreditUp4] => 0
                                    [APRUp4] => 0
                                    [MonthlyPaymentUp4] => 0
                                    [MIUp4] => 0
                                    [RateUp5] => 0
                                    [PointsUp5] => 0.000
                                    [RateBaseUp5] => 0.000
                                    [BaseUp5] => 0.000
                                    [CreditUp5] => 0
                                    [APRUp5] => 0
                                    [MonthlyPaymentUp5] => 0
                                    [MIUp5] => 0
                                    [RateDown1] =>   2.750
                                    [PointsDown1] => 100.684
                                    [BaseDown1] => 101.307
                                    [RateBaseDown1] => 100.684
                                    [CreditDown1] => -860
                                    [APRDown1] => 2.824
                                    [MonthlyPaymentDown1] => 1632.96
                                    [MIDown1] => 0.00
                                    [RateDown2] =>   2.625
                                    [PointsDown2] => 99.922
                                    [BaseDown2] => 101.307
                                    [RateBaseDown2] => 99.922
                                    [CreditDown2] => -3908
                                    [APRDown2] => 2.758
                                    [MonthlyPaymentDown2] => 1606.60
                                    [MIDown2] => 0.00
                                    [RateDown3] =>   2.500
                                    [PointsDown3] => 99.083
                                    [BaseDown3] => 101.307
                                    [RateBaseDown3] => 99.083
                                    [CreditDown3] => -7264
                                    [APRDown3] => 2.698
                                    [MonthlyPaymentDown3] => 1580.48
                                    [MIDown3] => 0.00
                                    [RateDown4] => 0
                                    [PointsDown4] => 0.000
                                    [BaseDown4] => 0.000
                                    [RateBaseDown4] => 0.000
                                    [CreditDown4] => 0
                                    [APRDown4] => 0
                                    [MonthlyPaymentDown4] => 0
                                    [MIDown4] => 0
                                    [RateDown5] => 0
                                    [PointsDown5] => 0.000
                                    [BaseDown5] => 101.307
                                    [RateBaseDown5] => 0.000
                                    [CreditDown5] => 1632
                                    [APRDown5] => 0
                                    [MonthlyPaymentDown5] => 0
                                    [MIDown5] => 0
                                    [TotalAdjustments] => 0
                                    [BuydownPoints] => 0
                                    [DownPayment] => 200000
                                    [TotalFees] => 2940
                                    [APRFees] => 2940
                                    [POCFees] => 0
                                    [LerFees] => 2940
                                    [OriginationFees] => 0
                                    [ApplicationFee] => 150
                                    [ProcessingFee] => 1055
                                    [TaxFee] => 0
                                    [UnderWritingFee] => 0
                                    [DocumentFee] => 0
                                    [AdministrativeFee] => 450
                                    [CourierFee] => 0
                                    [WireTransferFee] => 0
                                    [AppraisalFee] => 650
                                    [FloodCertification] => 0
                                    [CreditReport] => 35
                                    [OfferFeeOne] => 0
                                    [OfferDescOne] => Array
                                        (
                                        )

                                    [OfferFeeTwo] => 0
                                    [OfferDescTwo] => Array
                                        (
                                        )

                                    [OfferFeeThree] => 0
                                    [OfferDescThree] => Array
                                        (
                                        )

                                    [OtherFee] => 600
                                    [UpfrontMIPAmount] => 0
                                    [UpfrontMIorFundingFee] => 0
                                    [PriceStatus] => Active
                                    [Status] => Pass
                                    [StatusReason] => OK
                                    [LPPRIndex] => 10856759
                                    [PartnerId] => 0
                                    [PartnerName] => Save Financial
                                    [PartnerMessage] => n/a
                                    [PartnerOverageToCosts] => n/a
                                    [PartnerLicenseInfo] => n/a
                                )

                            [1] => Array
                                (
                                    [LerId] => 599
                                    [LerName] => United Wholesale Mortgage
                                    [LerProductId] => 91823
                                    [LerProductName] => Conquest FreddieMac Elite 30 Year Fixed
                                    [LoanCategoryClass] => F360
                                    [LoanCategoryAmortization] => 30
                                    [LoanCategoryTerm] => 30
                                    [TargetMargin] => 100.899
                                    [LOComp] => 0.899
                                    [MaxEarningInPoints] => 9999999
                                    [MinEarningInPoints] => 0
                                    [PricesheetCompType] => 0
                                    [LerProductARMIndex] => 11
                                    [IndexName] => N/A
                                    [IndexValue] => 0
                                    [IndexDate] => 04/06/2008
                                    [IndexTime] => 02:48:02 PM
                                    [LerProductARMIndexMargin] => Array
                                        (
                                        )

                                    [LerProductARMLifeCap] => Array
                                        (
                                        )

                                    [LerProductARMFirstAdj] => Array
                                        (
                                        )

                                    [LerProductARMFirstAdjCap] => Array
                                        (
                                        )

                                    [LerProductARMPerAdj] => Array
                                        (
                                        )

                                    [LerProductARMPerAdjCap] => Array
                                        (
                                        )

                                    [LerProductProgram] => 0
                                    [LerProductFannieFreddie_SW] => 0
                                    [HomePath] => No
                                    [DURefi_HARP] => No
                                    [InterestOnly] => No
                                    [OpenAccess_HARP] => No
                                    [LerProductAllowPropertyLocationStandard] => 1
                                    [LerProductAllowPropertyLocationRural] => 1
                                    [LerProductLerPaidMI] => 0
                                    [SubPrime] => 0
                                    [Rate] =>   2.875
                                    [Points] => 101.307
                                    [Base] => 101.307
                                    [RateBase] => 101.307
                                    [Credit] => 1632
                                    [APR] => 2.900
                                    [MonthlyPayment] => 1659.57
                                    [MI] => 0.00
                                    [RateUp1] =>   2.998
                                    [PointsUp1] => 101.793
                                    [BaseUp1] => 101.307
                                    [RateBaseUp1] => 101.793
                                    [CreditUp1] => 3576
                                    [APRUp1] => 2.998
                                    [MonthlyPaymentUp1] => 1685.98
                                    [MIUp1] => 0.00
                                    [RateUp2] => 0
                                    [PointsUp2] => 0.000
                                    [BaseUp2] => 0.000
                                    [RateBaseUp2] => 0.000
                                    [CreditUp2] => 0
                                    [APRUp2] => 0
                                    [MonthlyPaymentUp2] => 0
                                    [MIUp2] => 0
                                    [RateUp3] => 0
                                    [PointsUp3] => 0.000
                                    [RateBaseUp3] => 0.000
                                    [BaseUp3] => 0.000
                                    [CreditUp3] => 0
                                    [APRUp3] => 0
                                    [MonthlyPaymentUp3] => 0
                                    [MIUp3] => 0
                                    [RateUp4] => 0
                                    [PointsUp4] => 0.000
                                    [RateBaseUp4] => 0.000
                                    [BaseUp4] => 0.000
                                    [CreditUp4] => 0
                                    [APRUp4] => 0
                                    [MonthlyPaymentUp4] => 0
                                    [MIUp4] => 0
                                    [RateUp5] => 0
                                    [PointsUp5] => 0.000
                                    [RateBaseUp5] => 0.000
                                    [BaseUp5] => 0.000
                                    [CreditUp5] => 0
                                    [APRUp5] => 0
                                    [MonthlyPaymentUp5] => 0
                                    [MIUp5] => 0
                                    [RateDown1] =>   2.750
                                    [PointsDown1] => 100.684
                                    [BaseDown1] => 101.307
                                    [RateBaseDown1] => 100.684
                                    [CreditDown1] => -860
                                    [APRDown1] => 2.824
                                    [MonthlyPaymentDown1] => 1632.96
                                    [MIDown1] => 0.00
                                    [RateDown2] =>   2.625
                                    [PointsDown2] => 99.922
                                    [BaseDown2] => 101.307
                                    [RateBaseDown2] => 99.922
                                    [CreditDown2] => -3908
                                    [APRDown2] => 2.758
                                    [MonthlyPaymentDown2] => 1606.60
                                    [MIDown2] => 0.00
                                    [RateDown3] =>   2.500
                                    [PointsDown3] => 99.083
                                    [BaseDown3] => 101.307
                                    [RateBaseDown3] => 99.083
                                    [CreditDown3] => -7264
                                    [APRDown3] => 2.698
                                    [MonthlyPaymentDown3] => 1580.48
                                    [MIDown3] => 0.00
                                    [RateDown4] => 0
                                    [PointsDown4] => 0.000
                                    [BaseDown4] => 0.000
                                    [RateBaseDown4] => 0.000
                                    [CreditDown4] => 0
                                    [APRDown4] => 0
                                    [MonthlyPaymentDown4] => 0
                                    [MIDown4] => 0
                                    [RateDown5] => 0
                                    [PointsDown5] => 0.000
                                    [BaseDown5] => 101.307
                                    [RateBaseDown5] => 0.000
                                    [CreditDown5] => 1632
                                    [APRDown5] => 0
                                    [MonthlyPaymentDown5] => 0
                                    [MIDown5] => 0
                                    [TotalAdjustments] => 0
                                    [BuydownPoints] => 0
                                    [DownPayment] => 200000
                                    [TotalFees] => 2940
                                    [APRFees] => 2940
                                    [POCFees] => 0
                                    [LerFees] => 2940
                                    [OriginationFees] => 0
                                    [ApplicationFee] => 150
                                    [ProcessingFee] => 1055
                                    [TaxFee] => 0
                                    [UnderWritingFee] => 0
                                    [DocumentFee] => 0
                                    [AdministrativeFee] => 450
                                    [CourierFee] => 0
                                    [WireTransferFee] => 0
                                    [AppraisalFee] => 650
                                    [FloodCertification] => 0
                                    [CreditReport] => 35
                                    [OfferFeeOne] => 0
                                    [OfferDescOne] => Array
                                        (
                                        )

                                    [OfferFeeTwo] => 0
                                    [OfferDescTwo] => Array
                                        (
                                        )

                                    [OfferFeeThree] => 0
                                    [OfferDescThree] => Array
                                        (
                                        )

                                    [OtherFee] => 600
                                    [UpfrontMIPAmount] => 0
                                    [UpfrontMIorFundingFee] => 0
                                    [PriceStatus] => Active
                                    [Status] => Pass
                                    [StatusReason] => OK
                                    [LPPRIndex] => 10856765
                                    [PartnerId] => 0
                                    [PartnerName] => Save Financial
                                    [PartnerMessage] => n/a
                                    [PartnerOverageToCosts] => n/a
                                    [PartnerLicenseInfo] => n/a
                                )
```

答:
You can use get post method and encode the values using base64_encode() and then send them over the url... You will need the true keys however, so I changed the values you initially set as key to value and used the word key to get the actual keys for each value in the foreach loop.

I am using a variable to hold the data and then display it at the end of the php block, so you will not see any echo statements in the code.

PHP manual READ about $_GET: --> https://www.php.net/manual/en/reserved.variables.get.php
PHP manual READ about base64_encode/base64_decode: --> https://www.php.net/manual/en/function.base64-encode.php
https://www.php.net/manual/en/function.base64-decode.php

NOTE: I am unable to fully test this as I do not have access to the array you are using to construct your foreach loop, though I did test this using a dummy array and it worked without issue.

Something like the following...

<?php
$count = 1;
// $str will be the string that holds the key/value pairs that will be sent over the url
$str = '?'; //<-- ? starts the $_GET method for the url
foreach ($parser['LXEPricerGrid']['PassingLoans']['PassingLoan'] as $key => $value) {
      //<-- see if the $value is the last value we need,
      //<-- if so, we remove the `&` and display only the key=value
      if($count === count($value)){
         //<-- concatenate the key/value pair to $str as the last value
         $str .= $key.'='.base64_encode($value);
      }else{
         // concatenate the key/value and add `&` for the next iterations value to the $str
         $str .= $key.'='.base64_encode($value).'&';
      }
   // hold the table row in a variable for display later...
   $stmt = '

   ' . $count . '
   ' . $value['LerProductName'] . '
   ' . $value['Rate'] . '
   ' . $value['APR'] . '
   $' . $value['MonthlyPayment'] . '
   Apply

   Details

';
   $count++;

}
?>

    <?=stmt?>

```

<p>Then on the page you wish to send the array to, run a loop and reconstruct the array using the get values and the base64_decode()...</p>

<pre class="lang-php prettyprint-override"><code>//<-- declare empty array to hold data
$get = array();
if(!empty($_GET)){ //<-- if the $_GET global array is not empty... run the loop
    foreach($_GET as $index => $output){
        $get[$index] = base64_decode($output);
    }
}
var_dump($get); <--- $get now holds the decoded values

</code>```

Body:
So I have a list of items that are being displayed like this :

<?php
$count = 1;
foreach ($parser['LXEPricerGrid']['PassingLoans']['PassingLoan'] as $key) {
?>

   <?php
   echo '' . $count . '	';
   echo '' . $key['LerProductName'] . '	';
   echo '' . $key['Rate'] . '%	';
   echo '' . $key['APR'] . '%	';
   echo '$' . $key['MonthlyPayment'] . '	';
   echo 'Apply	';
   echo 'Details	';
   ?>

   <?php
   $count++;

}
?>

Now all is well and good but what i want is that when i click on the Details link it should open another page and show all the values of the specific item against which i clicked details. I m not very good with PHP in React you could pass down as props or do a variety of other stuff but i don't know how to do this with php. any help appreciated.
The array looks like :

 [PassingLoan] => Array
                        (
                            [0] => Array
                                (
                                    [LerId] => 599
                                    [LerName] => United Wholesale Mortgage
                                    [LerProductId] => 91821
                                    [LerProductName] => Conquest FannieMae Elite 30 Year Fixed
                                    [LoanCategoryClass] => F360
                                    [LoanCategoryAmortization] => 30
                                    [LoanCategoryTerm] => 30
                                    [TargetMargin] => 100.899
                                    [LOComp] => 0.899
                                    [MaxEarningInPoints] => 9999999
                                    [MinEarningInPoints] => 0
                                    [PricesheetCompType] => 0
                                    [LerProductARMIndex] => 11
                                    [IndexName] => N/A
                                    [IndexValue] => 0
                                    [IndexDate] => 04/06/2008
                                    [IndexTime] => 02:48:02 PM
                                    [LerProductARMIndexMargin] => Array
                                        (
                                        )

                                    [LerProductARMLifeCap] => Array
                                        (
                                        )

                                    [LerProductARMFirstAdj] => Array
                                        (
                                        )

                                    [LerProductARMFirstAdjCap] => Array
                                        (
                                        )

                                    [LerProductARMPerAdj] => Array
                                        (
                                        )

                                    [LerProductARMPerAdjCap] => Array
                                        (
                                        )

                                    [LerProductProgram] => 0
                                    [LerProductFannieFreddie_SW] => 0
                                    [HomePath] => No
                                    [DURefi_HARP] => No
                                    [InterestOnly] => No
                                    [OpenAccess_HARP] => No
                                    [LerProductAllowPropertyLocationStandard] => 1
                                    [LerProductAllowPropertyLocationRural] => 1
                                    [LerProductLerPaidMI] => 0
                                    [SubPrime] => 0
                                    [Rate] =>   2.875
                                    [Points] => 101.307
                                    [Base] => 101.307
                                    [RateBase] => 101.307
                                    [Credit] => 1632
                                    [APR] => 2.900
                                    [MonthlyPayment] => 1659.57
                                    [MI] => 0.00
                                    [RateUp1] =>   2.998
                                    [PointsUp1] => 101.793
                                    [BaseUp1] => 101.307
                                    [RateBaseUp1] => 101.793
                                    [CreditUp1] => 3576
                                    [APRUp1] => 2.998
                                    [MonthlyPaymentUp1] => 1685.98
                                    [MIUp1] => 0.00
                                    [RateUp2] => 0
                                    [PointsUp2] => 0.000
                                    [BaseUp2] => 0.000
                                    [RateBaseUp2] => 0.000
                                    [CreditUp2] => 0
                                    [APRUp2] => 0
                                    [MonthlyPaymentUp2] => 0
                                    [MIUp2] => 0
                                    [RateUp3] => 0
                                    [PointsUp3] => 0.000
                                    [RateBaseUp3] => 0.000
                                    [BaseUp3] => 0.000
                                    [CreditUp3] => 0
                                    [APRUp3] => 0
                                    [MonthlyPaymentUp3] => 0
                                    [MIUp3] => 0
                                    [RateUp4] => 0
                                    [PointsUp4] => 0.000
                                    [RateBaseUp4] => 0.000
                                    [BaseUp4] => 0.000
                                    [CreditUp4] => 0
                                    [APRUp4] => 0
                                    [MonthlyPaymentUp4] => 0
                                    [MIUp4] => 0
                                    [RateUp5] => 0
                                    [PointsUp5] => 0.000
                                    [RateBaseUp5] => 0.000
                                    [BaseUp5] => 0.000
                                    [CreditUp5] => 0
                                    [APRUp5] => 0
                                    [MonthlyPaymentUp5] => 0
                                    [MIUp5] => 0
                                    [RateDown1] =>   2.750
                                    [PointsDown1] => 100.684
                                    [BaseDown1] => 101.307
                                    [RateBaseDown1] => 100.684
                                    [CreditDown1] => -860
                                    [APRDown1] => 2.824
                                    [MonthlyPaymentDown1] => 1632.96
                                    [MIDown1] => 0.00
                                    [RateDown2] =>   2.625
                                    [PointsDown2] => 99.922
                                    [BaseDown2] => 101.307
                                    [RateBaseDown2] => 99.922
                                    [CreditDown2] => -3908
                                    [APRDown2] => 2.758
                                    [MonthlyPaymentDown2] => 1606.60
                                    [MIDown2] => 0.00
                                    [RateDown3] =>   2.500
                                    [PointsDown3] => 99.083
                                    [BaseDown3] => 101.307
                                    [RateBaseDown3] => 99.083
                                    [CreditDown3] => -7264
                                    [APRDown3] => 2.698
                                    [MonthlyPaymentDown3] => 1580.48
                                    [MIDown3] => 0.00
                                    [RateDown4] => 0
                                    [PointsDown4] => 0.000
                                    [BaseDown4] => 0.000
                                    [RateBaseDown4] => 0.000
                                    [CreditDown4] => 0
                                    [APRDown4] => 0
                                    [MonthlyPaymentDown4] => 0
                                    [MIDown4] => 0
                                    [RateDown5] => 0
                                    [PointsDown5] => 0.000
                                    [BaseDown5] => 101.307
                                    [RateBaseDown5] => 0.000
                                    [CreditDown5] => 1632
                                    [APRDown5] => 0
                                    [MonthlyPaymentDown5] => 0
                                    [MIDown5] => 0
                                    [TotalAdjustments] => 0
                                    [BuydownPoints] => 0
                                    [DownPayment] => 200000
                                    [TotalFees] => 2940
                                    [APRFees] => 2940
                                    [POCFees] => 0
                                    [LerFees] => 2940
                                    [OriginationFees] => 0
                                    [ApplicationFee] => 150
                                    [ProcessingFee] => 1055
                                    [TaxFee] => 0
                                    [UnderWritingFee] => 0
                                    [DocumentFee] => 0
                                    [AdministrativeFee] => 450
                                    [CourierFee] => 0
                                    [WireTransferFee] => 0
                                    [AppraisalFee] => 650
                                    [FloodCertification] => 0
                                    [CreditReport] => 35
                                    [OfferFeeOne] => 0
                                    [OfferDescOne] => Array
                                        (
                                        )

                                    [OfferFeeTwo] => 0
                                    [OfferDescTwo] => Array
                                        (
                                        )

                                    [OfferFeeThree] => 0
                                    [OfferDescThree] => Array
                                        (
                                        )

                                    [OtherFee] => 600
                                    [UpfrontMIPAmount] => 0
                                    [UpfrontMIorFundingFee] => 0
                                    [PriceStatus] => Active
                                    [Status] => Pass
                                    [StatusReason] => OK
                                    [LPPRIndex] => 10856759
                                    [PartnerId] => 0
                                    [PartnerName] => Save Financial
                                    [PartnerMessage] => n/a
                                    [PartnerOverageToCosts] => n/a
                                    [PartnerLicenseInfo] => n/a
                                )

                            [1] => Array
                                (
                                    [LerId] => 599
                                    [LerName] => United Wholesale Mortgage
                                    [LerProductId] => 91823
                                    [LerProductName] => Conquest FreddieMac Elite 30 Year Fixed
                                    [LoanCategoryClass] => F360
                                    [LoanCategoryAmortization] => 30
                                    [LoanCategoryTerm] => 30
                                    [TargetMargin] => 100.899
                                    [LOComp] => 0.899
                                    [MaxEarningInPoints] => 9999999
                                    [MinEarningInPoints] => 0
                                    [PricesheetCompType] => 0
                                    [LerProductARMIndex] => 11
                                    [IndexName] => N/A
                                    [IndexValue] => 0
                                    [IndexDate] => 04/06/2008
                                    [IndexTime] => 02:48:02 PM
                                    [LerProductARMIndexMargin] => Array
                                        (
                                        )

                                    [LerProductARMLifeCap] => Array
                                        (
                                        )

                                    [LerProductARMFirstAdj] => Array
                                        (
                                        )

                                    [LerProductARMFirstAdjCap] => Array
                                        (
                                        )

                                    [LerProductARMPerAdj] => Array
                                        (
                                        )

                                    [LerProductARMPerAdjCap] => Array
                                        (
                                        )

                                    [LerProductProgram] => 0
                                    [LerProductFannieFreddie_SW] => 0
                                    [HomePath] => No
                                    [DURefi_HARP] => No
                                    [InterestOnly] => No
                                    [OpenAccess_HARP] => No
                                    [LerProductAllowPropertyLocationStandard] => 1
                                    [LerProductAllowPropertyLocationRural] => 1
                                    [LerProductLerPaidMI] => 0
                                    [SubPrime] => 0
                                    [Rate] =>   2.875
                                    [Points] => 101.307
                                    [Base] => 101.307
                                    [RateBase] => 101.307
                                    [Credit] => 1632
                                    [APR] => 2.900
                                    [MonthlyPayment] => 1659.57
                                    [MI] => 0.00
                                    [RateUp1] =>   2.998
                                    [PointsUp1] => 101.793
                                    [BaseUp1] => 101.307
                                    [RateBaseUp1] => 101.793
                                    [CreditUp1] => 3576
                                    [APRUp1] => 2.998
                                    [MonthlyPaymentUp1] => 1685.98
                                    [MIUp1] => 0.00
                                    [RateUp2] => 0
                                    [PointsUp2] => 0.000
                                    [BaseUp2] => 0.000
                                    [RateBaseUp2] => 0.000
                                    [CreditUp2] => 0
                                    [APRUp2] => 0
                                    [MonthlyPaymentUp2] => 0
                                    [MIUp2] => 0
                                    [RateUp3] => 0
                                    [PointsUp3] => 0.000
                                    [RateBaseUp3] => 0.000
                                    [BaseUp3] => 0.000
                                    [CreditUp3] => 0
                                    [APRUp3] => 0
                                    [MonthlyPaymentUp3] => 0
                                    [MIUp3] => 0
                                    [RateUp4] => 0
                                    [PointsUp4] => 0.000
                                    [RateBaseUp4] => 0.000
                                    [BaseUp4] => 0.000
                                    [CreditUp4] => 0
                                    [APRUp4] => 0
                                    [MonthlyPaymentUp4] => 0
                                    [MIUp4] => 0
                                    [RateUp5] => 0
                                    [PointsUp5] => 0.000
                                    [RateBaseUp5] => 0.000
                                    [BaseUp5] => 0.000
                                    [CreditUp5] => 0
                                    [APRUp5] => 0
                                    [MonthlyPaymentUp5] => 0
                                    [MIUp5] => 0
                                    [RateDown1] =>   2.750
                                    [PointsDown1] => 100.684
                                    [BaseDown1] => 101.307
                                    [RateBaseDown1] => 100.684
                                    [CreditDown1] => -860
                                    [APRDown1] => 2.824
                                    [MonthlyPaymentDown1] => 1632.96
                                    [MIDown1] => 0.00
                                    [RateDown2] =>   2.625
                                    [PointsDown2] => 99.922
                                    [BaseDown2] => 101.307
                                    [RateBaseDown2] => 99.922
                                    [CreditDown2] => -3908
                                    [APRDown2] => 2.758
                                    [MonthlyPaymentDown2] => 1606.60
                                    [MIDown2] => 0.00
                                    [RateDown3] =>   2.500
                                    [PointsDown3] => 99.083
                                    [BaseDown3] => 101.307
                                    [RateBaseDown3] => 99.083
                                    [CreditDown3] => -7264
                                    [APRDown3] => 2.698
                                    [MonthlyPaymentDown3] => 1580.48
                                    [MIDown3] => 0.00
                                    [RateDown4] => 0
                                    [PointsDown4] => 0.000
                                    [BaseDown4] => 0.000
                                    [RateBaseDown4] => 0.000
                                    [CreditDown4] => 0
                                    [APRDown4] => 0
                                    [MonthlyPaymentDown4] => 0
                                    [MIDown4] => 0
                                    [RateDown5] => 0
                                    [PointsDown5] => 0.000
                                    [BaseDown5] => 101.307
                                    [RateBaseDown5] => 0.000
                                    [CreditDown5] => 1632
                                    [APRDown5] => 0
                                    [MonthlyPaymentDown5] => 0
                                    [MIDown5] => 0
                                    [TotalAdjustments] => 0
                                    [BuydownPoints] => 0
                                    [DownPayment] => 200000
                                    [TotalFees] => 2940
                                    [APRFees] => 2940
                                    [POCFees] => 0
                                    [LerFees] => 2940
                                    [OriginationFees] => 0
                                    [ApplicationFee] => 150
                                    [ProcessingFee] => 1055
                                    [TaxFee] => 0
                                    [UnderWritingFee] => 0
                                    [DocumentFee] => 0
                                    [AdministrativeFee] => 450
                                    [CourierFee] => 0
                                    [WireTransferFee] => 0
                                    [AppraisalFee] => 650
                                    [FloodCertification] => 0
                                    [CreditReport] => 35
                                    [OfferFeeOne] => 0
                                    [OfferDescOne] => Array
                                        (
                                        )

                                    [OfferFeeTwo] => 0
                                    [OfferDescTwo] => Array
                                        (
                                        )

                                    [OfferFeeThree] => 0
                                    [OfferDescThree] => Array
                                        (
                                        )

                                    [OtherFee] => 600
                                    [UpfrontMIPAmount] => 0
                                    [UpfrontMIorFundingFee] => 0
                                    [PriceStatus] => Active
                                    [Status] => Pass
                                    [StatusReason] => OK
                                    [LPPRIndex] => 10856765
                                    [PartnerId] => 0
                                    [PartnerName] => Save Financial
                                    [PartnerMessage] => n/a
                                    [PartnerOverageToCosts] => n/a
                                    [PartnerLicenseInfo] => n/a
                                )

Body:
You can use get post method and encode the values using base64_encode() and then send them over the url... You will need the true keys however, so I changed the values you initially set as key to value and used the word key to get the actual keys for each value in the foreach loop.

I am using a variable to hold the data and then display it at the end of the php block, so you will not see any echo statements in the code.

PHP manual READ about $_GET: --> https://www.php.net/manual/en/reserved.variables.get.php
PHP manual READ about base64_encode/base64_decode: --> https://www.php.net/manual/en/function.base64-encode.php
https://www.php.net/manual/en/function.base64-decode.php

NOTE: I am unable to fully test this as I do not have access to the array you are using to construct your foreach loop, though I did test this using a dummy array and it worked without issue.

Something like the following...

<?php
$count = 1;
// $str will be the string that holds the key/value pairs that will be sent over the url
$str = '?'; //<-- ? starts the $_GET method for the url
foreach ($parser['LXEPricerGrid']['PassingLoans']['PassingLoan'] as $key => $value) {
      //<-- see if the $value is the last value we need,
      //<-- if so, we remove the `&` and display only the key=value
      if($count === count($value)){
         //<-- concatenate the key/value pair to $str as the last value
         $str .= $key.'='.base64_encode($value);
      }else{
         // concatenate the key/value and add `&` for the next iterations value to the $str
         $str .= $key.'='.base64_encode($value).'&';
      }
   // hold the table row in a variable for display later...
   $stmt = '
   <tr>

   <td>' . $count . '</td>
   <td>' . $value['LerProductName'] . '</td>
   <td>' . $value['Rate'] . '</td>
   <td>' . $value['APR'] . '</td>
   <td style="text-align: right">$' . $value['MonthlyPayment'] . '</td>
   <td><a href="#">Apply</a></td>
   <!-- since the url is the same no need for site url add the string to the href link for Details-->
   <td><a href="'.$str.'">Details</a></td>

   </tr>';
   $count++;

}
?>
<tbody>
    <!--// echo out the $stmt variable //-->
    <?=stmt?>
</tbody>

Then on the page you wish to send the array to, run a loop and reconstruct the array using the get values and the base64_decode()...

//<-- declare empty array to hold data
$get = array();
if(!empty($_GET)){ //<-- if the $_GET global array is not empty... run the loop
    foreach($_GET as $index => $output){
        $get[$index] = base64_decode($output);
    }
}
var_dump($get); <--- $get now holds the decoded values


来源: stackexchange

问:
how to make tkinter <Enter> event work when <button-1> is pressed?
I want to fill rectangles just like in paint. When mouse button is pressed I want every rectangle I enter to be filled and otherwise I want no event to take place.

Here Is my code:

```<code>from tkinter import Canvas
import tkinter

_width = 50
_height = 50
_size = 8

root = tkinter.Tk()
root.title("draw me a lovely matrix")
canv = Canvas(root, width=_width * _size, height=_height * _size)

class Wrapper:
    btn1d = False

def set_btn1d(value):
    print(value)
    Wrapper.btn1d = value

def toggle_color(rect):
    print('called')
    if Wrapper.btn1d:
        color = canv.itemcget(rect, 'fill')
        canv.itemconfig(rect, fill=("#aaa" if color == '#fff' else '#fff'))

rects = []
canv.bind('<ButtonPress-1>', lambda e, value=True: set_btn1d(value))
canv.bind('<ButtonRelease-1>', lambda e, value=False: set_btn1d(value))
for i in range(_size):
    for j in range(_size):
        rect = canv.create_rectangle(_width * j, _height * i, _width * (j + 1), _height * (i + 1), fill="#fff", width=0)
        rects.append(rect)
        canv.tag_bind(rect, '<Enter>', lambda e, rect=rect: toggle_color(rect))

canv.pack()
root.mainloop()
</code>```

The problem is that when I press the mouse button only the cell in which the mouse was pressed detects the entrance of mouse pointer(also the one in which mouse will be released at the end)

Any beneficial general advice about my code would be of course much appreciated.

答:
There's no need to use <Enter> at all. Try:

```<code>from tkinter import Canvas
import tkinter

_width = 50
_height = 50
_size = 8

root = tkinter.Tk()
root.title("draw me a lovely matrix")
canv = Canvas(root, width=_width * _size, height=_height * _size)
rects = []

# B1-Motion activates every time the mouse is moved with button 1 held down
# See https://effbot.org/tkinterbook/tkinter-events-and-bindings.htm
# We fill every item that the mouse comes in contact with while button 1 is held
# The tag tied to the item the event was called on, "current", points to the
#   item under the pointer when the button was pressed, i.e. the first box.
# Only the x and y properties change, so we configure the item closest to those.
def motion(event):
  canv.itemconfig(canv.find_closest(event.x, event.y), fill="#aaa")
canv.bind("<B1-Motion>", motion)

for i in range(_size):
  for j in range(_size):
    rects.append(canv.create_rectangle(_width * j, _height * i, _width * (j + 1), _height * (i + 1), fill="#fff", width=0))
    # don't need to bind anything to <Enter>

canv.pack()
root.mainloop()
</code>```

Unfortunately, there's no possible solution using <Enter>. The following non-working code would theoretically be correct if <Enter> worked the way you wanted it to.

```<code>import tkinter

_width = 50
_height = 50
_size = 8

root = tkinter.Tk()
root.title("draw me a lovely matrix")
canv = tkinter.Canvas(root, width=_width * _size, height=_height * _size)
rects = []

# This javascript-like approach doesn't work in tkinter because
# <Enter> and <Leave> events aren't called while any mouse buttons
# are held.
def fill(tag):
  canv.itemconfig(tag, fill="#aaa")
def enter(event):
  fill("current")
def mousedown(event):
  fill("current")
  canv.tag_bind("all", "<Enter>", enter, add="+")
def mouseup(event):
  canv.tag_unbind("all", "<Enter>")
canv.bind("<Button-1>", mousedown)
canv.bind("<ButtonRelease-1>", mouseup)

for i in range(_size):
  for j in range(_size):
    rects.append(canv.create_rectangle(_width * j, _height * i, _width * (j + 1), _height * (i + 1), fill="#fff", width=0))

canv.pack()
root.mainloop()
</code>```

Tested in python 3.8.2, tkinter 8.6

ContentLicense: CC BY-SA 3.0

Body:
I want to fill rectangles just like in paint. When mouse button is pressed I want every rectangle I enter to be filled and otherwise I want no event to take place.

Here Is my code:

from tkinter import Canvas
import tkinter

_width = 50
_height = 50
_size = 8

root = tkinter.Tk()
root.title("draw me a lovely matrix")
canv = Canvas(root, width=_width * _size, height=_height * _size)

class Wrapper:
    btn1d = False

def set_btn1d(value):
    print(value)
    Wrapper.btn1d = value

def toggle_color(rect):
    print('called')
    if Wrapper.btn1d:
        color = canv.itemcget(rect, 'fill')
        canv.itemconfig(rect, fill=("#aaa" if color == '#fff' else '#fff'))

rects = []
canv.bind('<ButtonPress-1>', lambda e, value=True: set_btn1d(value))
canv.bind('<ButtonRelease-1>', lambda e, value=False: set_btn1d(value))
for i in range(_size):
    for j in range(_size):
        rect = canv.create_rectangle(_width * j, _height * i, _width * (j + 1), _height * (i + 1), fill="#fff", width=0)
        rects.append(rect)
        canv.tag_bind(rect, '<Enter>', lambda e, rect=rect: toggle_color(rect))

canv.pack()
root.mainloop()

The problem is that when I press the mouse button only the cell in which the mouse was pressed detects the entrance of mouse pointer(also the one in which mouse will be released at the end)

Any beneficial general advice about my code would be of course much appreciated.

Body:
There's no need to use <Enter> at all. Try:

from tkinter import Canvas
import tkinter

_width = 50
_height = 50
_size = 8

root = tkinter.Tk()
root.title("draw me a lovely matrix")
canv = Canvas(root, width=_width * _size, height=_height * _size)
rects = []

# B1-Motion activates every time the mouse is moved with button 1 held down
# See https://effbot.org/tkinterbook/tkinter-events-and-bindings.htm
# We fill every item that the mouse comes in contact with while button 1 is held
# The tag tied to the item the event was called on, "current", points to the
#   item under the pointer when the button was pressed, i.e. the first box.
# Only the x and y properties change, so we configure the item closest to those.
def motion(event):
  canv.itemconfig(canv.find_closest(event.x, event.y), fill="#aaa")
canv.bind("<B1-Motion>", motion)

for i in range(_size):
  for j in range(_size):
    rects.append(canv.create_rectangle(_width * j, _height * i, _width * (j + 1), _height * (i + 1), fill="#fff", width=0))
    # don't need to bind anything to <Enter>

canv.pack()
root.mainloop()

Unfortunately, there's no possible solution using <Enter>. The following non-working code would theoretically be correct if <Enter> worked the way you wanted it to.

import tkinter

_width = 50
_height = 50
_size = 8

root = tkinter.Tk()
root.title("draw me a lovely matrix")
canv = tkinter.Canvas(root, width=_width * _size, height=_height * _size)
rects = []

# This javascript-like approach doesn't work in tkinter because
# <Enter> and <Leave> events aren't called while any mouse buttons
# are held.
def fill(tag):
  canv.itemconfig(tag, fill="#aaa")
def enter(event):
  fill("current")
def mousedown(event):
  fill("current")
  canv.tag_bind("all", "<Enter>", enter, add="+")
def mouseup(event):
  canv.tag_unbind("all", "<Enter>")
canv.bind("<Button-1>", mousedown)
canv.bind("<ButtonRelease-1>", mouseup)

for i in range(_size):
  for j in range(_size):
    rects.append(canv.create_rectangle(_width * j, _height * i, _width * (j + 1), _height * (i + 1), fill="#fff", width=0))

canv.pack()
root.mainloop()

Tested in python 3.8.2, tkinter 8.6

ContentLicense: CC BY-SA 4.0


问:
Is + operator overloaded for primitive types?
Already overloaded operators <<,>>,= etc are used many times.

An example that i was thinking of is when we add strings say :

string name = string("munish") + "kumar";

the + operator is overloaded in the string class.

but when we add numbers like 1 + 2( doesn't seem like an overloaded operator call)

I was just wondering how does it happens does the compiler does a binary additon.

I don't need to worry about it much though if the compiler does it so, just a matter of curiosity for me.

答: You can overload the operators on custom data types i.e classes.. int is a primitive data type and the operators on primitive types are implemented by the compiler itself, basically it is just a simple CPU instruction to add int etc</p>


问:
Remove dependency on sequential id values in React code
This codepen filters names using an array of objects in the following format with sequential id values.

```<code>const PEOPLE = [
  {
    id: 0,
    name: 'Aria',
    sex: 'girl'
  }, {
    id: 1,
    name: 'Logan',
    sex: 'boy'
  }]
</code>```

I am trying to learn how to modify this so any nonsequential id value could be used. i.e.

```<code>const PEOPLE = [
      {
        id: 0,
        name: 'Aria',
        sex: 'girl'
      }, {
        id: 100,
        name: 'Logan',
        sex: 'boy'
      }]
</code>```

My understanding is that the code currently has a dependency between the position of a name in the PEOPLE array and the numerical id value as any change to id values has the code return incorrect results.

What have I tried:

I think something like this could be used but I'm not sure how to implement it in this Codepen example .

```<code>const isIndex = (element) => element == id
array.findIndex(isIndex)
</code>```

Additional information as requested.

The ShortList functionality does not work if the id is not sequential as shown below where "Logan" is searched for but "Lachlan" is added as it has the modified index value of 100.

答:
If you're simply trying to find an element by id

```<code>const findById = id => array.find(element => element.id === id);
</code>```

The find() method returns the value of the first element in the
  provided array that satisfies the provided testing function.

It returns undefined if not found.

If you really want the index

```<code>const findIndexById = id => array.findIndex(element => element.id === id);
</code>```

The findIndex() method returns the index of the first element in the
  array that satisfies the provided testing function. Otherwise, it
  returns -1, indicating that no element passed the test.

const PEOPLE = [{
  id: 350,
  name: 'Aria',
  sex: 'girl'
}, {
  id: 100,
  name: 'Logan',
  sex: 'boy'
}];

const findById = (array, id) => array.find(element => element.id === id);
const findIndexById = (array, id) => array.findIndex(element => element.id === id);

console.log(findById(PEOPLE, 100));
console.log(findIndexById(PEOPLE, 100));```
</div>
</div>
</p>

<p><strong>Resolution:</strong></p>

<p>Line 34 in <code>ShortList</code>, change <code>info={data[fav]}</code> to <code>info={data.find(person => person.id === fav)}</code>. When all the people <em>are</em> in order and id sequentially increase from 0, then <code>data[id]</code> works, but if the array can have a different order then that breaks and you need to search for it.</p>

```<Name
  id={i}
  key={i}
  info={data.find(person => person.id === fav)}
  handleFavourite={(id) => deleteFavourite(id)}
/>
```

Body:
This codepen filters names using an array of objects in the following format with sequential id values.

const PEOPLE = [
  {
    id: 0,
    name: 'Aria',
    sex: 'girl'
  }, {
    id: 1,
    name: 'Logan',
    sex: 'boy'
  }]

I am trying to learn how to modify this so any nonsequential id value could be used. i.e.

const PEOPLE = [
      {
        id: 0,
        name: 'Aria',
        sex: 'girl'
      }, {
        id: 100,
        name: 'Logan',
        sex: 'boy'
      }]

My understanding is that the code currently has a dependency between the position of a name in the PEOPLE array and the numerical id value as any change to id values has the code return incorrect results.

What have I tried:

I think something like this could be used but I'm not sure how to implement it in this Codepen example .

const isIndex = (element) => element == id
array.findIndex(isIndex)

Additional information as requested.

The ShortList functionality does not work if the id is not sequential as shown below where "Logan" is searched for but "Lachlan" is added as it has the modified index value of 100.

Body:
If you're simply trying to find an element by id

const findById = id => array.find(element => element.id === id);

The find() method returns the value of the first element in the
  provided array that satisfies the provided testing function.

It returns undefined if not found.

If you really want the index

const findIndexById = id => array.findIndex(element => element.id === id);

The findIndex() method returns the index of the first element in the
  array that satisfies the provided testing function. Otherwise, it
  returns -1, indicating that no element passed the test.

const PEOPLE = [{
  id: 350,
  name: 'Aria',
  sex: 'girl'
}, {
  id: 100,
  name: 'Logan',
  sex: 'boy'
}];

const findById = (array, id) => array.find(element => element.id === id);
const findIndexById = (array, id) => array.findIndex(element => element.id === id);

console.log(findById(PEOPLE, 100));
console.log(findIndexById(PEOPLE, 100));

Resolution:

Line 34 in ShortList, change info={data[fav]} to info={data.find(person => person.id === fav)}. When all the people are in order and id sequentially increase from 0, then data[id] works, but if the array can have a different order then that breaks and you need to search for it.

<Name
  id={i}
  key={i}
  info={data.find(person => person.id === fav)}
  handleFavourite={(id) => deleteFavourite(id)}
/>


问:
How to solve a white screen problem in the GD library?
I have a problem in the GD PHP library. When I send an image to a localhost VM the image is normally generated on the screen, but when I try to do it on a VPS I do not generate the image and the screen is white. I have already checked if the lib GD is the same on both machines and everything seems to be okay.

The following is the code that I'm generating the image on the screen:

    $image = imagecreatefrompng((isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]" . "/wp-content/uploads/cart1.png");

    $imageCart = imagecreatefrompng($perfil);

    $titleColor = imagecolorallocate($image, 255, 255, 255);
    $gray = imagecolorallocate($image, 100, 100, 100);
    $black = imagecolorallocate($image, 0, 0, 0);

    imagecopymerge($image, $imageCart, 60, 177, 0, 0, imagesx($imageCart), imagesy($imageCart), 100);

    imagestring($image, 5, 170, 175, "NOME  " . strtoupper($nomeCompleto), $titleColor);
    imagestring($image, 5, 170, 205, "CPF  " . $cpf, $titleColor);
    imagestring($image, 5, 170, 235, "MATRICULA  " . $matricula, $titleColor);
    imagestring($image, 5, 170, 263, "DT NASCIMENTO " . $dtnacimento, $titleColor);

    header("Content-type: image/png");

    imagepng($image);
    imagepng($imageCart);

    imagedestroy($image);
    imagedestroy($imageCart);
```

答:
This problem was interesting, since the local and remote server environments were reported in the comments as being the same. The usual problem is that the gd extension is installed in one, and missing in the other, but that was not the case here. They were even reported as being of the same internal version number.

So the first problem is here:

```<code>imagepng($image);
imagepng($imageCart);
</code>```

The imagepng() function takes the binary data of an image and sends it to /dev/stdout, where it will be captured by the web server, and transmitted to the requesting client. Having two of these could make for an odd result, since the browser will see two concatenated PNG images. As mentioned in the comments, this might work for some browsers, and might not for others - in other words we can't rely on it working. It is best to send only valid output, even if we can get it to work in some cases (where it worked, the browser probably used the first one and discarded the second). So the first thing to do was to only send one image.

The next problem was in this line, found by debugging:

```<code>$image = imagecreatefrompng((isset($_SERVER['HTTPS']) ? "https" : "http") .
    "://$_SERVER[HTTP_HOST]" .
    "/wp-content/uploads/cart1.png");
</code>```

Essentially, this loads a source PNG image via HTTP/HTTPS. This takes advantage of a feature in PHP that allows URLs to be used in place of file paths. From the manual:

A URL can be used as a filename with this function if the fopen wrappers have been enabled. See fopen() for more details on how to specify the filename. See the Supported Protocols and Wrappers for links to information about what abilities the various wrappers have, notes on their usage, and information on any predefined variables they may provide.

I would hazard a guess then that your allow_url_fopen is true on your local machine, and false or not set on your VPS. This could have been made to work by changing it remotely, but the fix that was made was probably better - and that is to load it from the file system directly.

If you use the fopen wrapper, then what you are actually doing is to make a request of the web server, which fetches the image from disk, and then returns it via curl. So by fetching the image directly using its filename, you are "cutting out the middleman" and getting it more efficiently.

It is normal to use the directory traversal operator in these cases, to create a pathname that is relative to the script's directory. A perfectly good solution, which was used, is:

```<code>imagecreatefrompng("../../../wp-content/uploads/cart1.png")
</code>```

You can also use a magic variable (assuming the script is three levels down from the project root):

```<code>$projectDir = realpath(__DIR__ . "/../../..");
imagecreatefrompng($projectDir . "/wp-content/uploads/cart1.png")
</code>```

You will probably find that WordPress sets some of its own project directory constants, so they could have been used in this case too.

Body:
This problem was interesting, since the local and remote server environments were reported in the comments as being the same. The usual problem is that the gd extension is installed in one, and missing in the other, but that was not the case here. They were even reported as being of the same internal version number.

So the first problem is here:

imagepng($image);
imagepng($imageCart);

The imagepng() function takes the binary data of an image and sends it to /dev/stdout, where it will be captured by the web server, and transmitted to the requesting client. Having two of these could make for an odd result, since the browser will see two concatenated PNG images. As mentioned in the comments, this might work for some browsers, and might not for others - in other words we can't rely on it working. It is best to send only valid output, even if we can get it to work in some cases (where it worked, the browser probably used the first one and discarded the second). So the first thing to do was to only send one image.

The next problem was in this line, found by debugging:

$image = imagecreatefrompng((isset($_SERVER['HTTPS']) ? "https" : "http") .
    "://$_SERVER[HTTP_HOST]" .
    "/wp-content/uploads/cart1.png");

Essentially, this loads a source PNG image via HTTP/HTTPS. This takes advantage of a feature in PHP that allows URLs to be used in place of file paths. From the manual:

A URL can be used as a filename with this function if the fopen wrappers have been enabled. See fopen() for more details on how to specify the filename. See the Supported Protocols and Wrappers for links to information about what abilities the various wrappers have, notes on their usage, and information on any predefined variables they may provide.

I would hazard a guess then that your allow_url_fopen is true on your local machine, and false or not set on your VPS. This could have been made to work by changing it remotely, but the fix that was made was probably better - and that is to load it from the file system directly.

If you use the fopen wrapper, then what you are actually doing is to make a request of the web server, which fetches the image from disk, and then returns it via curl. So by fetching the image directly using its filename, you are "cutting out the middleman" and getting it more efficiently.

It is normal to use the directory traversal operator in these cases, to create a pathname that is relative to the script's directory. A perfectly good solution, which was used, is:

imagecreatefrompng("../../../wp-content/uploads/cart1.png")

You can also use a magic variable (assuming the script is three levels down from the project root):

$projectDir = realpath(__DIR__ . "/../../..");
imagecreatefrompng($projectDir . "/wp-content/uploads/cart1.png")

You will probably find that WordPress sets some of its own project directory constants, so they could have been used in this case too.


问:
Import custom React component into Markdown in GatsbyJS
In GatsbyJS, when authoring a markdown file, how can I import and display a custom React component?

I am using the official gatsby-starter-blog starter which comes with markdown support. It works great for blog posts. However, I would now like to add a custom React component into my markdown file. What do I need to do to achieve this?

Here is my attempt. No errors, but the custom component tag does not get converted into the actual React component.

post-1\index.md:

```<code>---
title: My first post
date: "2000-01-01"
description: Wouldn't it be sweet if there was a custom React component in here?
---

import CustomComponent from '../../../src/components/CustomComponent.js'

Lorem ipsum dolor.

<CustomComponent title="Test" />
</code>```

Folder structure:

```<code>content
- blog
-- post-1
---- index.md
src
- components
-- CustomComponent.js
</code>```

答:
Markdown doesn't support JSX. You can use MDX for this. Gatsby has extensive documentation & official plugin for supporting the feature. You can read more at: https://www.gatsbyjs.org/docs/mdx/

MDX will allow you to have MD files looking like:

```<code>import { Chart } from '../components/chart'

The chart is rendered inside our MDX document.

<Chart />
</code>```

Which you can in turn use in your Gatsby app like this:

import React from "react"
import { MDXProvider } from "@mdx-js/react"
import { MDXRenderer } from "gatsby-plugin-mdx"
import mdxContent from "./your-content.mdx"

export default () => {
    return (
        <MDXProvider>
            <MDXRenderer>{mdxContent}</MDXRenderer>
        </MDXProvider>
    )
}
```

Body:
In GatsbyJS, when authoring a markdown file, how can I import and display a custom React component?

I am using the official gatsby-starter-blog starter which comes with markdown support. It works great for blog posts. However, I would now like to add a custom React component into my markdown file. What do I need to do to achieve this?

Here is my attempt. No errors, but the custom component tag does not get converted into the actual React component.

post-1\index.md:

---
title: My first post
date: "2000-01-01"
description: Wouldn't it be sweet if there was a custom React component in here?
---

import CustomComponent from '../../../src/components/CustomComponent.js'

Lorem ipsum dolor.

<CustomComponent title="Test" />

Folder structure:

content
- blog
-- post-1
---- index.md
src
- components
-- CustomComponent.js

Body:
Markdown doesn't support JSX. You can use MDX for this. Gatsby has extensive documentation & official plugin for supporting the feature. You can read more at: https://www.gatsbyjs.org/docs/mdx/

MDX will allow you to have MD files looking like:

import { Chart } from '../components/chart'

The chart is rendered inside our MDX document.

<Chart />

Which you can in turn use in your Gatsby app like this:

import React from "react"
import { MDXProvider } from "@mdx-js/react"
import { MDXRenderer } from "gatsby-plugin-mdx"
import mdxContent from "./your-content.mdx"

export default () => {
    return (
        <MDXProvider>
            <MDXRenderer>{mdxContent}</MDXRenderer>
        </MDXProvider>
    )
}


问:
Why is onChanged being called when I navigate back to a fragment?
I have a ViewModel handling my business logic and I am using Koin to inject this into my activity and each of my fragments. However after I navigate from Fragment A - Fragment B and navigate back to Fragment A, my observer is triggered again. Why is this happening and how do I stop this onChanged being triggered when I navigate back?

I have tried setting both 'this' and 'viewLifecycleOwner' as the LifecycleOwner of the LiveData.

I have also tried moving the observable to onCreate, onActivityCreated and onViewCreated

My ViewModel:

```<code>class MyViewModel : ViewModel() {

    private val _myData = MutableLiveData<Data>()
    val myData = LiveData<Data>()
        get() = _myData

    fun doSomething() {
        ... // some code
        _myData.postValue(myResult)
}
</code>```

MyActivity:

```<code>class Activity : BaseActivity() {

    private val viewModel by viewModel<MyViewModel>()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_login)
        setSupportActionBar(main_toolbar)

        subscribeUI()
    }

    private fun subscribeUI() {
        myViewModel.isLoading.observe(this, Observer {
            toggleProgress(it)
        })
    }
}
</code>```

Fragment A:

```<code>class FragmentA : BaseFragment() {

    private val viewModel by sharedViewModel<MyViewModel>()

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        subscribeUI()
    }

    private fun subscribeUI() {
        viewModel.myData.observe(viewLifecycleOwner, Observer {
            val direction =
                FragmentADirections.actionAtoB()
            mainNavController?.navigate(direction)
        })
    }
}
</code>```

Fragment B:

```<code>class FragmentB : BaseFragment() {

    private val authViewModel by sharedViewModel<LoginViewModel>()

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        subscribeUI()
    }

    private fun subscribeUI() {
        viewModel.otherData.observe(viewLifecycleOwner, Observer {
            // Do something else...
        })
    }
}
</code>```

When I navigate from Fragment A -> Fragment B, everything works as I expect. However when I navigate back to Fragment A from Fragment B (by pressing the back button) the onChanged method from the Observer on myData is called and the navigation moves back to Navigation B.

答:
This is expected because you are resubscribing to a LiveData, and LiveData replays its last emitted value when you subscribe to it.

You should use a different component that doesn't replay the last emitted value on resubscription, for example you could use https://github.com/Zhuinden/live-event instead.

Body:
I have a ViewModel handling my business logic and I am using Koin to inject this into my activity and each of my fragments. However after I navigate from Fragment A - Fragment B and navigate back to Fragment A, my observer is triggered again. Why is this happening and how do I stop this onChanged being triggered when I navigate back?

I have tried setting both 'this' and 'viewLifecycleOwner' as the LifecycleOwner of the LiveData.

I have also tried moving the observable to onCreate, onActivityCreated and onViewCreated

My ViewModel:

class MyViewModel : ViewModel() {

    private val _myData = MutableLiveData<Data>()
    val myData = LiveData<Data>()
        get() = _myData

    fun doSomething() {
        ... // some code
        _myData.postValue(myResult)
}

MyActivity:

class Activity : BaseActivity() {

    private val viewModel by viewModel<MyViewModel>()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_login)
        setSupportActionBar(main_toolbar)

        subscribeUI()
    }

    private fun subscribeUI() {
        myViewModel.isLoading.observe(this, Observer {
            toggleProgress(it)
        })
    }
}

Fragment A:

class FragmentA : BaseFragment() {

    private val viewModel by sharedViewModel<MyViewModel>()

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        subscribeUI()
    }

    private fun subscribeUI() {
        viewModel.myData.observe(viewLifecycleOwner, Observer {
            val direction =
                FragmentADirections.actionAtoB()
            mainNavController?.navigate(direction)
        })
    }
}

Fragment B:

class FragmentB : BaseFragment() {

    private val authViewModel by sharedViewModel<LoginViewModel>()

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        subscribeUI()
    }

    private fun subscribeUI() {
        viewModel.otherData.observe(viewLifecycleOwner, Observer {
            // Do something else...
        })
    }
}

When I navigate from Fragment A -> Fragment B, everything works as I expect. However when I navigate back to Fragment A from Fragment B (by pressing the back button) the onChanged method from the Observer on myData is called and the navigation moves back to Navigation B.


问:
a solution for filtering some rows of data based on condition in pandas
I have the following example data, and I'd like to filter a piece of data, when (col1 = 'A' and col2 = '0') we want to keep rows until next (col1 = 'A').

I want to do using pandas dataframe but I don't know how it is.

```<code>df = pd.DataFrame({'col1': ['A', 'B', 'C'],  'col2': [0, 1]})
</code>```

For example, we have this data

```<code>col1 col2
 A    0
 C
 A    1
 B
 C
 A    1
 B
 B
 C
 A    0
 B
 C
 A    1
 B
 C
 C
</code>```

The result I want to achieve is:

```<code>col1 col2
 A    0
 C
 A    0
 B
 C
</code>```

Thank you very much

答:
We first groupby row blocks starting with 'A' and then propagate the first value of col2 to all rows of the group. From this result we take all rows with 0 in col2.

```<code> df[df.groupby(df.col1.eq('A').cumsum()).col2.transform('first').eq(0)]
</code>```

Sample data:

```<code>df = pd.DataFrame({'col1': list('ACABCABBCABCABCC'),
                   'col2': [0, None, 1, None, None, 1, None, None, None, 0, None, None, 1, None, None, None]}
                 ).astype({'col2': 'Int32'})
</code>```

Result:

```<code>   col1  col2
0     A     0
1     C  <NA>
9     A     0
10    B  <NA>
11    C  <NA>
</code>```

Body:
I have the following example data, and I'd like to filter a piece of data, when (col1 = 'A' and col2 = '0') we want to keep rows until next (col1 = 'A').

I want to do using pandas dataframe but I don't know how it is.

df = pd.DataFrame({'col1': ['A', 'B', 'C'],  'col2': [0, 1]})

For example, we have this data

col1 col2
 A    0
 C
 A    1
 B
 C
 A    1
 B
 B
 C
 A    0
 B
 C
 A    1
 B
 C
 C

The result I want to achieve is:

col1 col2
 A    0
 C
 A    0
 B
 C

Thank you very much

Body:
We first groupby row blocks starting with 'A' and then propagate the first value of col2 to all rows of the group. From this result we take all rows with 0 in col2.

 df[df.groupby(df.col1.eq('A').cumsum()).col2.transform('first').eq(0)]

Sample data:

df = pd.DataFrame({'col1': list('ACABCABBCABCABCC'),
                   'col2': [0, None, 1, None, None, 1, None, None, None, 0, None, None, 1, None, None, None]}
                 ).astype({'col2': 'Int32'})

Result:

   col1  col2
0     A     0
1     C  <NA>
9     A     0
10    B  <NA>
11    C  <NA>


问:
Struggle with UINavigationController
I was struggle with UINavigationController for many hours since it refused to show any title or even titleView, BackItem?.title, everything not work. I can see navigation bar on top, just blank. Here my codes:</p>

```<code>class tab1_main: UIViewController {
    var main_nav_controller = UINavigationController()
    override func viewDidLoad() {
        main_nav_controller.navigationBar.backItem?.title = "Hello" //NO LUCK
        main_nav_controller.navigationBar.topItem?.title = "Hello" //NO LUCK
        main_nav_controller.title = "Hello" //NO LUCK
        self.title = "Hello" //NO LUCK
        navigationItem.title = "Hello" //NO LUCK

        view.addSubview(main_nav_controller.view)
        tab1_startup()
    }
}
</code>```

答:
put tab1_main viewController on bottom of your navigationController view stacks instead of create a navigationController inside your tab1_main view Controller.</p>

```<code>    let tab1_main = UIViewController()
    let main_nav_controller = UINavigationController(rootViewController: tab1_main)
</code>```

Title: Struggle with UINavigationController

Body:
I was struggle with UINavigationController for many hours since it refused to show any title or even titleView, BackItem?.title, everything not work. I can see navigation bar on top, just blank. Here my codes:

class tab1_main: UIViewController {
    var main_nav_controller = UINavigationController()
    override func viewDidLoad() {
        main_nav_controller.navigationBar.backItem?.title = "Hello" //NO LUCK
        main_nav_controller.navigationBar.topItem?.title = "Hello" //NO LUCK
        main_nav_controller.title = "Hello" //NO LUCK
        self.title = "Hello" //NO LUCK
        navigationItem.title = "Hello" //NO LUCK

        view.addSubview(main_nav_controller.view)
        tab1_startup()
    }
}

Body:
put tab1_main viewController on bottom of your navigationController view stacks instead of create a navigationController inside your tab1_main view Controller.

    let tab1_main = UIViewController()
    let main_nav_controller = UINavigationController(rootViewController: tab1_main)


问:
How can i get value from URL in java script
http://localhost:3000/admin/parking/airportParkingPriorityUpdate/xyz

How do i get value "XYZ" from the url using javascript

答:
You can also get URL parameters using javaScript. Try below code.

http://localhost/mypage?id=10&name=Simy

getURLParameter("id") --> Returns 10

function getURLParameter(variable)
{
       var query = window.location.search.substring(1);
       var vars = query.split("&");
       for (var i=0;i<vars.length;i++) {
               var pair = vars[i].split("=");
               if(pair[0] == variable){return pair[1];}
       }
       return(false);
}```


问:
how to install pyaudio python pakage on heroku through cli
how to install pyaudio on heroku through heroku cli
if i give "pip install pyaudio" command on heroku cli the below error occurring

Error:
Collecting pyaudio
  Downloading https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Building wheels for collected packages: pyaudio
  Running setup.py bdist_wheel for pyaudio ... - \ error
  Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-vz9795ay/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmpmq8ff3y9pip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  copying src/pyaudio.py -> build/lib.linux-x86_64-3.6
  running build_ext
  building '_portaudio' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/src
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/app/.heroku/python/include/python3.6m -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.6/src/_portaudiomodule.o
  src/_portaudiomodule.c:27:10: fatal error: stdio.h: No such file or directory
   #include
            ^~~~~~~~~
  compilation terminated.
  error: command 'gcc' failed with exit status 1

Failed building wheel for pyaudio
  Running setup.py clean for pyaudio
Failed to build pyaudio
Installing collected packages: pyaudio
  Running setup.py install for pyaudio ... - error
    Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-vz9795ay/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-gdj2okkn-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    copying src/pyaudio.py -> build/lib.linux-x86_64-3.6
    running build_ext
    building '_portaudio' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/src
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/app/.heroku/python/include/python3.6m -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.6/src/_portaudiomodule.o
    src/_portaudiomodule.c:27:10: fatal error: stdio.h: No such file or directory
     #include
              ^~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1

```<code>----------------------------------------
</code>```

Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-vz9795ay/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-gdj2okkn-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-vz9795ay/pyaudio/
You are using pip version 9.0.2, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

答:
you need to install heroku buildpacks:add --index 1 heroku-community/apt from your console, then include a file named Aptfile in your project root, after that include portaudio19-dev
python-all-dev inside the Aptfile file, finally, you need to make a commit and run the command git push heroku master

You can see some more info here: https://github.com/heroku/heroku-buildpack-apt

Body:
how to install pyaudio on heroku through heroku cli
if i give "pip install pyaudio" command on heroku cli the below error occurring

Error:
Collecting pyaudio
  Downloading https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Building wheels for collected packages: pyaudio
  Running setup.py bdist_wheel for pyaudio ... - \ error
  Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-vz9795ay/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmpmq8ff3y9pip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  copying src/pyaudio.py -> build/lib.linux-x86_64-3.6
  running build_ext
  building '_portaudio' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/src
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/app/.heroku/python/include/python3.6m -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.6/src/_portaudiomodule.o
  src/_portaudiomodule.c:27:10: fatal error: stdio.h: No such file or directory
   #include
            ^~~~~~~~~
  compilation terminated.
  error: command 'gcc' failed with exit status 1

Failed building wheel for pyaudio
  Running setup.py clean for pyaudio
Failed to build pyaudio
Installing collected packages: pyaudio
  Running setup.py install for pyaudio ... - error
    Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-vz9795ay/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-gdj2okkn-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    copying src/pyaudio.py -> build/lib.linux-x86_64-3.6
    running build_ext
    building '_portaudio' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/src
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/app/.heroku/python/include/python3.6m -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.6/src/_portaudiomodule.o
    src/_portaudiomodule.c:27:10: fatal error: stdio.h: No such file or directory
     #include
              ^~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1

----------------------------------------

Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-vz9795ay/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-gdj2okkn-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-vz9795ay/pyaudio/
You are using pip version 9.0.2, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.


问:
"Stray doctype" error in firefox source code viewer
Since I learned to serve XHTML pages as XML, I have started noticing something odd: whenever I view an XHTML page in the Firefox source code viewer, the DOCTYPE is always marked as an error. According to the tooltip I get from mousing over it, the error in question is a "stray doctype". From what I understand, a "stray doctype" means that there is an extra DOCTYPE in the middle of the document where it doesn't belong, which is certainly not the case here.

Here's an example - this markup will pass validation, and display correctly in all modern browsers:

```<code><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--FF source viewer will mark the preceding two lines as an error.-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <meta http-equiv="content-type"
      content="application/xhtml+xml; charset=utf-8" />
    <title>Sample XHTML Page</title>
  </head>
  <body>
    <p>This is an example.</p>
  </body>
</html>
</code>```

This error message is especially odd, considering that these pages pass validation perfectly, and that a single parsing error would normally break the page.

答: The error appears because the file is saved as UTF-8 BOM instead of UTF-8. Open the file in Notepad and change its encoding.</p>

Body:
Since I learned to serve XHTML pages as XML, I have started noticing something odd: whenever I view an XHTML page in the Firefox source code viewer, the DOCTYPE is always marked as an error. According to the tooltip I get from mousing over it, the error in question is a "stray doctype". From what I understand, a "stray doctype" means that there is an extra DOCTYPE in the middle of the document where it doesn't belong, which is certainly not the case here.

Here's an example - this markup will pass validation, and display correctly in all modern browsers:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <meta http-equiv="content-type"
      content="application/xhtml+xml; charset=utf-8" />
    <title>Sample XHTML Page</title>

This is an example.

This error message is especially odd, considering that these pages pass validation perfectly, and that a single parsing error would normally break the page.


问:
How should I configure Jenkins CI (or Hudson) to run on Azure?
I like Jenkins, and it strikes me that being able to spin-up extra build slaves on-demand in Azure could work well.

Besides, the less on-premise hardware I have to maintain, the better.

Has anyone configured Jenkins (or, indeed, Hudson) to run in Azure? Technically I suspect it shouldn't be too tricky - I'd appreciate pointers to resources that might help. The tricky bit is likely to be persistence of the build state.

答: Check out: Continous Integration Server in Windows Azure</p>


问:
Checking whether a list value is within a range
I have created a list of numbers in fav_numbers. The user will be prompted to enter 2 values: starting range and ending range. The program will check if the list of numbers will fall into the range that the user has inputted. If the numbers in the list fall within the range, the list will be printed out.
The thing is I'm not sure how to check if the individual numbers in the list are within the range.
I am a beginner to python so what would be the most straightforward way to do this, preferably using loops?</p>

```<code>start_range = int(input("Enter the starting number: "))
end_range = int(input("Enter the ending number: "))

#find favourite numbers
def find_favourite_numbers(start_range,end_range):
    fav_numbers = [70, 105, 140]
    for start_range and end_range in range(fav_numbers):
    if fav_numbers[0,1,2] >= start_range and fav_number <= end_range:
        print(fav_numbers)
    else:
        print("favourite numbers not in range")

    print(fav_numbers)

    return fav_numbers

#Do not remove the next line
find_favourite_numbers(start_range,end_range)
</code>```

答:
You could do the below, loop through all the fav_numbers, if one is not in range it will output that the numbers are not all in range and return False , otherwise if the loop completes it will returns the numbers

```<code>start_range = int(input("Enter the starting number: "))
end_range = int(input("Enter the ending number: "))

#find favourite numbers
def find_favourite_numbers(start_range,end_range):
    fav_numbers = [70, 105, 140]
    for number in fav_numbers:
        if number < start_range or number > end_range:
            print("Not all favourite numbers in range")
            return False
    print("All favourite numbers in range: " + str(fav_numbers))

    return fav_numbers

#Do not remove the next line
find_favourite_numbers(start_range,end_range)
</code>```

Body:
I have created a list of numbers in fav_numbers. The user will be prompted to enter 2 values: starting range and ending range. The program will check if the list of numbers will fall into the range that the user has inputted. If the numbers in the list fall within the range, the list will be printed out.
The thing is I'm not sure how to check if the individual numbers in the list are within the range.
I am a beginner to python so what would be the most straightforward way to do this, preferably using loops?

start_range = int(input("Enter the starting number: "))
end_range = int(input("Enter the ending number: "))

#find favourite numbers
def find_favourite_numbers(start_range,end_range):
    fav_numbers = [70, 105, 140]
    for start_range and end_range in range(fav_numbers):
    if fav_numbers[0,1,2] >= start_range and fav_number <= end_range:
        print(fav_numbers)
    else:
        print("favourite numbers not in range")

    print(fav_numbers)

    return fav_numbers

#Do not remove the next line
find_favourite_numbers(start_range,end_range)

Body:
You could do the below, loop through all the fav_numbers, if one is not in range it will output that the numbers are not all in range and return False , otherwise if the loop completes it will returns the numbers

start_range = int(input("Enter the starting number: "))
end_range = int(input("Enter the ending number: "))

#find favourite numbers
def find_favourite_numbers(start_range,end_range):
    fav_numbers = [70, 105, 140]
    for number in fav_numbers:
        if number < start_range or number > end_range:
            print("Not all favourite numbers in range")
            return False
    print("All favourite numbers in range: " + str(fav_numbers))

    return fav_numbers

#Do not remove the next line
find_favourite_numbers(start_range,end_range)


问:
How can I fix empty space on mobile HTML site?
My HTML website currently has a large empty space on the right side on mobile. The website is pumpkinchugger.github.io/rona20.live how can I get rid of this empty space? I currently have this in my CSS file, and I think it is causing this problem?

```<code>@media all and (max-width:991px){
    .row{
        flex-direction:column;
    }

    .container--wrap{
        width: 98vw!important;
    }
}
</code>```

Is the max width the problem?

答:
There is an overflow happens on the tradingView widget which set a fixed width of 500px. If you want a more proper fix for The widget is not adapting to different screen sizes. What should I do?, please refer to Market Overview Widget FAQ.

For now, I recommend fixing the issue with the following CSS code by setting the maximum width of the widget chart to 100%.

```<code>@media screen and (max-width: 576px) {
  div.tradingview-widget-container__widget,
  div.tradingview-widget-container__widget > div:first-child,
  div.tradingview-widget-container__widget > div:first-child > iframe {
      max-width: 100%;
  }
}
</code>```

Body:
My HTML website currently has a large empty space on the right side on mobile. The website is pumpkinchugger.github.io/rona20.live how can I get rid of this empty space? I currently have this in my CSS file, and I think it is causing this problem?

@media all and (max-width:991px){
    .row{
        flex-direction:column;
    }

    .container--wrap{
        width: 98vw!important;
    }
}

Is the max width the problem?

Body:
There is an overflow happens on the tradingView widget which set a fixed width of 500px. If you want a more proper fix for The widget is not adapting to different screen sizes. What should I do?, please refer to Market Overview Widget FAQ.

For now, I recommend fixing the issue with the following CSS code by setting the maximum width of the widget chart to 100%.

@media screen and (max-width: 576px) {
  div.tradingview-widget-container__widget,
  div.tradingview-widget-container__widget > div:first-child,
  div.tradingview-widget-container__widget > div:first-child > iframe {
      max-width: 100%;
  }
}


问:
how Kotlin interpret {} or () by a run example
```<code>fun main (){
    run(::topLevel)
    run{::topLevel}
    run{topLevel()}
    run(topLevel())
    }
fun topLevel() = println("print something")
</code>```

1,2 run will execute the fun
3- will not execute
4- is an error

By this example i find that () and {} have different meaning.
Would appreciate a lot if some one will explain how Kotlin interpret this 4 cases.

答:
in kotlin when you use {} and write something in it it means you are passing a block to the trailing lambda.

when you use () means you are passing a value, so:

run(someFunction()) -> this means you are passing the return value of someFunction() as a parameter to run() which will fail simply because run does not take a value as parameter, however it takes a lambda as a parameter.

run{someFunction} -> this means you are passing a lambda or a block to be called inside run body. This will work cuz it simply satisfies run function signature.

```<code>public inline fun <R> run(block: () -> R): R
</code>```

Body:
fun main (){
    run(::topLevel)
    run{::topLevel}
    run{topLevel()}
    run(topLevel())
    }
fun topLevel() = println("print something")

1,2 run will execute the fun
3- will not execute
4- is an error

By this example i find that () and {} have different meaning.
Would appreciate a lot if some one will explain how Kotlin interpret this 4 cases.

Body:
in kotlin when you use {} and write something in it it means you are passing a block to the trailing lambda.

when you use () means you are passing a value, so:

run(someFunction()) -> this means you are passing the return value of someFunction() as a parameter to run() which will fail simply because run does not take a value as parameter, however it takes a lambda as a parameter.

run{someFunction} -> this means you are passing a lambda or a block to be called inside run body. This will work cuz it simply satisfies run function signature.

public inline fun <R> run(block: () -> R): R