问:
Unable to send mail using Html PHP
I am creating a website and I was making a appointment form with PHP. It is turning up no errors on the page itself but the email never shows up in the inbox or spam folder of my email. The code I have for it is:
`

```<code><form action="contact.php" method="POST">
  <div class="row g-3">
    <div class="col-12 col-sm-6">
      <select name="Doctor" class="form-select bg-light border-0 mb-3" style="height: 55px;">
        <option selected>Select A Doctor</option>
        <option value="PROF DR AZFAR FAROGH">PROF DR AZFAR FAROGH (MEDICINE)</option>
        <option value="PROF DR AJWAD FAROGH">PROF DR AJWAD FAROGH (CARDIAC SURGERY)</option>
        <option value="PROF DR IRFAN KHAN">PROF DR IRFAN KHAN (HEMATOLOGY)</option>
        <option value="DR ASMA HASSAN">DR ASMA HASSAN (PULMONOLOGY)</option>
        <option value="DR USAMA MUNIR">DR USAMA MUNIR (CARDIOLOGY)</option>
        <option value="DR AWAIS NIZAMI">DR AWAIS NIZAMI (CARDIOLOGY)</option>
        <option value="DR SUMYYA ASHRAF">DR SUMYYA ASHRAF (FAMILY PHYSICIAN)</option>
        <option value="DR SABAHAT GUL">DR SABAHAT GUL (CARDIOLOGY)</option>
        <option value="DR MUHAMMAD BURHAN BARKAT">DR MUHAMMAD BURHAN BARKAT (UROLOGY)</option>
        <option value="DR MADIHA AZHAR">DR MADIHA AZHAR (DERMATOLOGY)</option>
        <option value="DR FAHAD QAISAR">DR FAHAD QAISAR (MEDICINE)</option>
        <option value="DR MAHTAB AHMED MUKTAR PATAFI">DR MAHTAB AHMED MUKTAR PATAFI (PHYSIOTHERAPY)</option>
        <option value="DR NASIR MAHMOOD">DR NASIR MAHMOOD (PHYSIOTHERAPY)</option>
        <option value="DR SHEHR BANO">DR SHEHR BANO (PHYSIOTHERAPY)</option>
        <option value="DR MUHAMMAD WASSAM">DR MUHAMMAD WASSAM (PHYSIOTHERAPY)</option>
        <option value="DR SARAH NISAR">DR SARAH NISAR (RADIOLOGY)</option>
        <option value="DR SARAH NISAR">DR AHMAD BILAL (RADIOLOGY)</option>
        <option value="DR ZAFAR JAM">DR ZAFAR JAM (CARDIOLOGY)</option>
        <option value="DR ANWAAR UL HASSAN">DR ANWAAR UL HASSAN (CARDIOLOGY)</option>
        <option value="DR JUNAID AKHTER">DR JUNAID AKHTER (CARDIOLOGY)</option>
        <option value="DR M ZUBAIR AHMAD">DR M ZUBAIR AHMAD (PEDIATRIC SURGERY)</option>
        <option value="DR GOHAR BASHIR">DR GOHAR BASHIR (CARDIAC SURGERY)</option>
      </select>
    </div>
    <div class="col-12 col-sm-6">
      <input type="text" name="Name" class="form-control bg-light border-0" placeholder="Your Name" style="height: 55px;" required>
    </div>
    <div class="col-12 col-sm-6">
      <input type="email" name="Email" class="form-control bg-light border-0" placeholder="Your Email" style="height: 55px;" required>
    </div>
    <div class="col-12 col-sm-6">
      <input type="number" name="Number" class="form-control bg-light border-0" placeholder="Your Phone Number" style="height: 55px;" required>
    </div>
    <div class="col-12 col-sm-6">
      <input type="number" name="CNIC" class="form-control bg-light border-0" placeholder="Your CNIC Number" style="height: 55px;" required>
    </div>
    <div class="col-12 col-sm-6">
      <SELECT name="Gender" class="form-control bg-light border-0" placeholder="Select Your Gender" style="height: 55px;" required>
        <option name="MALE">MALE</option>
        <option name="FEMALE">FEMALE</option>
        <option name="NEUTER">NEUTER</option>
      </SELECT>
    </div>
    <div class="col-12 col-sm-6">
      <input type="number" name="AGE" class="form-control bg-light border-0" placeholder="AGE" style="height: 55px;" required>
    </div>
    <div class="col-12 col-sm-6">
      <div class="date" id="date1" data-target-input="nearest">
        <input type="text" name="Date" class="form-control bg-light border-0 datetimepicker-input" placeholder="Appointment Date" data-target="#date1" data-toggle="datetimepicker" style="height: 55px;" required>
      </div>
    </div>
    <div class="col-12 col-sm-6">
      <input type="text" name="Comments" class="form-control bg-light border-0" placeholder="Additional Comments" style="height: 55px;">
    </div>
    <div class="col-12">
      <button class="btn btn-dark w-100 py-3" type="submit">Make Appointment</button>
    </div>
  </div>
</form>
</code>```

this is my php file:

```<code><?php
header("Location: ../appointment.html");
if(isset($_POST['Name']) &&
 isset ($_POST['Email']) &&
 isset ($_POST['Doctor']) &&
 isset ($_POST['CNIC']) &&
 isset ($_POST['Number']) &&
 isset ($_POST['Gender']) &&
 isset ($_POST['Age']) &&
 isset ($_POST['Date']) &&
 isset ($_POST['Comments'])) {

 $Name = $_POST['Name'];
 $Email = $_POST['Email'];
 $Doctor = $_POST['Doctor'];
 $CNIC = $_POST['CNIC'];
 $Number = $_POST['Number'];
 $Gender = $_POST['Gender'];
 $Age = $_POST['Age'];
 $Date = $_POST['Date'];
 $Comments = $_POST['Comments'];

  $to = '********@gmail.com';
  $subject = 'Appointment' . $name;
  $body = $message;
  $headers = 'From:' . $email . "\r\n" . "CC: ********@gmail.com";

  if (mail($to, $subject, $body, $headers)) {
    echo 'your message has been sent!';
  } else {
    echo 'There was an error sending your message.';
  }
}
?>
</code>```

I tired sending just name and message ,it worked but then i tired on this form ,it doesn't worked.

Title: Unable to send mail using Html PHP

Body:
I am creating a website and I was making a appointment form with PHP. It is turning up no errors on the page itself but the email never shows up in the inbox or spam folder of my email. The code I have for it is:
`

<form action="contact.php" method="POST">

      <select name="Doctor" class="form-select bg-light border-0 mb-3" style="height: 55px;">
        <option selected>Select A Doctor</option>
        <option value="PROF DR AZFAR FAROGH">PROF DR AZFAR FAROGH (MEDICINE)</option>
        <option value="PROF DR AJWAD FAROGH">PROF DR AJWAD FAROGH (CARDIAC SURGERY)</option>
        <option value="PROF DR IRFAN KHAN">PROF DR IRFAN KHAN (HEMATOLOGY)</option>
        <option value="DR ASMA HASSAN">DR ASMA HASSAN (PULMONOLOGY)</option>
        <option value="DR USAMA MUNIR">DR USAMA MUNIR (CARDIOLOGY)</option>
        <option value="DR AWAIS NIZAMI">DR AWAIS NIZAMI (CARDIOLOGY)</option>
        <option value="DR SUMYYA ASHRAF">DR SUMYYA ASHRAF (FAMILY PHYSICIAN)</option>
        <option value="DR SABAHAT GUL">DR SABAHAT GUL (CARDIOLOGY)</option>
        <option value="DR MUHAMMAD BURHAN BARKAT">DR MUHAMMAD BURHAN BARKAT (UROLOGY)</option>
        <option value="DR MADIHA AZHAR">DR MADIHA AZHAR (DERMATOLOGY)</option>
        <option value="DR FAHAD QAISAR">DR FAHAD QAISAR (MEDICINE)</option>
        <option value="DR MAHTAB AHMED MUKTAR PATAFI">DR MAHTAB AHMED MUKTAR PATAFI (PHYSIOTHERAPY)</option>
        <option value="DR NASIR MAHMOOD">DR NASIR MAHMOOD (PHYSIOTHERAPY)</option>
        <option value="DR SHEHR BANO">DR SHEHR BANO (PHYSIOTHERAPY)</option>
        <option value="DR MUHAMMAD WASSAM">DR MUHAMMAD WASSAM (PHYSIOTHERAPY)</option>
        <option value="DR SARAH NISAR">DR SARAH NISAR (RADIOLOGY)</option>
        <option value="DR SARAH NISAR">DR AHMAD BILAL (RADIOLOGY)</option>
        <option value="DR ZAFAR JAM">DR ZAFAR JAM (CARDIOLOGY)</option>
        <option value="DR ANWAAR UL HASSAN">DR ANWAAR UL HASSAN (CARDIOLOGY)</option>
        <option value="DR JUNAID AKHTER">DR JUNAID AKHTER (CARDIOLOGY)</option>
        <option value="DR M ZUBAIR AHMAD">DR M ZUBAIR AHMAD (PEDIATRIC SURGERY)</option>
        <option value="DR GOHAR BASHIR">DR GOHAR BASHIR (CARDIAC SURGERY)</option>
      </select>

      <input type="text" name="Name" class="form-control bg-light border-0" placeholder="Your Name" style="height: 55px;" required>

      <input type="email" name="Email" class="form-control bg-light border-0" placeholder="Your Email" style="height: 55px;" required>

      <input type="number" name="Number" class="form-control bg-light border-0" placeholder="Your Phone Number" style="height: 55px;" required>

      <input type="number" name="CNIC" class="form-control bg-light border-0" placeholder="Your CNIC Number" style="height: 55px;" required>

      <SELECT name="Gender" class="form-control bg-light border-0" placeholder="Select Your Gender" style="height: 55px;" required>
        <option name="MALE">MALE</option>
        <option name="FEMALE">FEMALE</option>
        <option name="NEUTER">NEUTER</option>
      </SELECT>

      <input type="number" name="AGE" class="form-control bg-light border-0" placeholder="AGE" style="height: 55px;" required>

        <input type="text" name="Date" class="form-control bg-light border-0 datetimepicker-input" placeholder="Appointment Date" data-target="#date1" data-toggle="datetimepicker" style="height: 55px;" required>

      <input type="text" name="Comments" class="form-control bg-light border-0" placeholder="Additional Comments" style="height: 55px;">

      <button class="btn btn-dark w-100 py-3" type="submit">Make Appointment</button>

</form>

this is my php file:

<?php
header("Location: ../appointment.html");
if(isset($_POST['Name']) &&
 isset ($_POST['Email']) &&
 isset ($_POST['Doctor']) &&
 isset ($_POST['CNIC']) &&
 isset ($_POST['Number']) &&
 isset ($_POST['Gender']) &&
 isset ($_POST['Age']) &&
 isset ($_POST['Date']) &&
 isset ($_POST['Comments'])) {

 $Name = $_POST['Name'];
 $Email = $_POST['Email'];
 $Doctor = $_POST['Doctor'];
 $CNIC = $_POST['CNIC'];
 $Number = $_POST['Number'];
 $Gender = $_POST['Gender'];
 $Age = $_POST['Age'];
 $Date = $_POST['Date'];
 $Comments = $_POST['Comments'];

  $to = '********@gmail.com';
  $subject = 'Appointment' . $name;
  $body = $message;
  $headers = 'From:' . $email . "\r\n" . "CC: ********@gmail.com";

  if (mail($to, $subject, $body, $headers)) {
    echo 'your message has been sent!';
  } else {
    echo 'There was an error sending your message.';
  }
}
?>

I tired sending just name and message ,it worked but then i tired on this form ,it doesn't worked.


来源: stackexchange

问:
Unable to Upgrade GuzzleHttp with PHP8.1 version
Previously we are using GuzzleHttp 6.0 and PHP 7.0, Now we have updated our PHP version to 8.1 and also trying to update GuzzleHttp to latest 7.0 version. I am following its document to update GuzzleHttp. But I am getting errors shown in the image.

My composer code is below. Can anyone please help me regarding this

"require-dev": {
"phpunit/phpunit": "9.5.0",
"phpunit/dbunit": "4.0.0"

```<code>},
"require": {
    "jwmickey/php-jwt": "dev-master",
    "aws/aws-sdk-php": "3.19.30",
    "pear/versioncontrol_git": "0.5.0",
    "aws/aws-php-sns-message-validator": "1.1.0",
    "endroid/qr-code": "^3.0",
    "guzzlehttp/guzzle": "^7.0"

},
</code>```

ContentLicense: CC BY-SA 4.0

Body:
Previously we are using GuzzleHttp 6.0 and PHP 7.0, Now we have updated our PHP version to 8.1 and also trying to update GuzzleHttp to latest 7.0 version. I am following its document to update GuzzleHttp. But I am getting errors shown in the image.

My composer code is below. Can anyone please help me regarding this

"require-dev": {
"phpunit/phpunit": "9.5.0",
"phpunit/dbunit": "4.0.0"

},
"require": {
    "jwmickey/php-jwt": "dev-master",
    "aws/aws-sdk-php": "3.19.30",
    "pear/versioncontrol_git": "0.5.0",
    "aws/aws-php-sns-message-validator": "1.1.0",
    "endroid/qr-code": "^3.0",
    "guzzlehttp/guzzle": "^7.0"

},


问:
Changing column value of an existing record in a table using dao method in springboot
I have a table which contains a column called 'active',now this column can contain either true or false value.What i want to do is to find all the records of the table based on a particular id column value and change the value of those matching records to true.

`@Autowired TableModelDao tableModelDao ;

List records = tableModelDao.findById(id);

for( TableModel data : records)

{

String activeColumn = data.getColumn().toString();

if(active.equalsIgnoreCase("false"))

{

what should i code here to save active column as true for the particular record

}

}`


问:
How to retrieve records based on column name using cursors
I am rekha and I am working data base. I am a fresher from past 2 months only I am working on sql server.

I have a query that is I have 2 tables.for example businesstype table contains id,businesstype and location based on location I will retrieve the data.that's fine.and second table is like employee and columns are id,name and businesstype.so my question is for each businesstype I will get the records from the employee table ultimately as below:

1,sathish,softwar
4,pushpa,Software
2,ramesh,Electronics
4,rajesh,Electronics

I solve this one by using joins,operators and subquery also.but I need the solution to this query by using cursors.

I wrote like the following ways:

1) SELECT ID, Name , BusinessType  FROM Employee
                  WHERE BusinessType in (select BusinessType from Employee)
order by BusinessType desc

2)select ID,Name,BusinessType
from Employee where exists (select BusinessType from Employee)

3)select @Location = Location from @BusinessTypeTemp

select ID
      ,BusinessType
      ,Location
       from BusinessType where Location=@Location

```<code>DECLARE @TempEmployeeInfo varchar(500)
DECLARE @pos        int,
         @nextpos    int,
        @nextRecpos int,
        @valuelen   int
</code>```

/* creating temp table to insert address types*/

```<code>CREATE TABLE  #EmployeeInfo (BusinessType nvarchar(80) )
SELECT  @TempEmployeeInfo =   BusinessType FROM @EmployeeTemp
</code>```

/* Code for checking  separator is ',' and save into temp table */

```<code>SELECT @pos = 0, @nextpos = 1

WHILE @nextpos > 0
BEGIN

  SELECT @nextpos = charindex(',', @TempEmployeeInfo, @pos + 1)
  SELECT @valuelen = CASE WHEN @nextpos > 0
                          THEN @nextpos
                          ELSE len(@TempEmployeeInfo) + 1
                     END - @pos - 1
INSERT #EmployeeInfo(BusinessType)  VALUES (convert(nvarchar, substring(@TempEmployeeInfo, @pos+1, @valuelen)))
  SELECT @pos = @nextpos
END

    SELECT @Count = count(BusinessType) from Employee WHERE BusinessType IN (SELECT BusinessType FROM #EmployeeInfo)
        PRINT @count

    IF(@Count<>0)
        BEGIN

            select ID,Name,BusinessType from Employee

            WHERE BusinessType IN (SELECT BusinessType FROM #EmployeeInfo)
            order by BusinessType desc

       END
    ELSE
         BEGIN
         SELECT 0 as ReturnID
         END
</code>```

But they don't want this, they want the result by using only cursors.and also I want to display the both table results in a single SP.

So please anyone help me. Please send the replies urgent because today is my last day to solve this.

Rekha

ContentLicense: CC BY-SA 3.0

Body:
I am rekha and I am working data base. I am a fresher from past 2 months only I am working on sql server.

I have a query that is I have 2 tables.for example businesstype table contains id,businesstype and location based on location I will retrieve the data.that's fine.and second table is like employee and columns are id,name and businesstype.so my question is for each businesstype I will get the records from the employee table ultimately as below:

1,sathish,softwar
4,pushpa,Software
2,ramesh,Electronics
4,rajesh,Electronics

I solve this one by using joins,operators and subquery also.but I need the solution to this query by using cursors.

I wrote like the following ways:

1) SELECT ID, Name , BusinessType  FROM Employee
                  WHERE BusinessType in (select BusinessType from Employee)
order by BusinessType desc

2)select ID,Name,BusinessType
from Employee where exists (select BusinessType from Employee)

3)select @Location = Location from @BusinessTypeTemp

select ID
      ,BusinessType
      ,Location
       from BusinessType where Location=@Location

DECLARE @TempEmployeeInfo varchar(500)
DECLARE @pos        int,
         @nextpos    int,
        @nextRecpos int,
        @valuelen   int

/* creating temp table to insert address types*/

CREATE TABLE  #EmployeeInfo (BusinessType nvarchar(80) )
SELECT  @TempEmployeeInfo =   BusinessType FROM @EmployeeTemp

/* Code for checking  separator is ',' and save into temp table */

SELECT @pos = 0, @nextpos = 1

WHILE @nextpos > 0
BEGIN

  SELECT @nextpos = charindex(',', @TempEmployeeInfo, @pos + 1)
  SELECT @valuelen = CASE WHEN @nextpos > 0
                          THEN @nextpos
                          ELSE len(@TempEmployeeInfo) + 1
                     END - @pos - 1
INSERT #EmployeeInfo(BusinessType)  VALUES (convert(nvarchar, substring(@TempEmployeeInfo, @pos+1, @valuelen)))
  SELECT @pos = @nextpos
END

    SELECT @Count = count(BusinessType) from Employee WHERE BusinessType IN (SELECT BusinessType FROM #EmployeeInfo)
        PRINT @count

    IF(@Count<>0)
        BEGIN

            select ID,Name,BusinessType from Employee

            WHERE BusinessType IN (SELECT BusinessType FROM #EmployeeInfo)
            order by BusinessType desc

       END
    ELSE
         BEGIN
         SELECT 0 as ReturnID
         END

But they don't want this, they want the result by using only cursors.and also I want to display the both table results in a single SP.

So please anyone help me. Please send the replies urgent because today is my last day to solve this.

Rekha


问:
Branch in Gstreamer pipeline, but without data copy
I have a simple pipeline where the input video feed from v4l2src must be fed into both encoder and display output. Using tee I can achieve this requirement, but the problem with tee is that it clones incoming video images to feed into each branch in pipeline.

In my application, the pipeline does not modify buffer of data, so it must be safe to access it in multiple threads as read-only memory.
I want to know how I can make the following pipeline without buffer cloning and only sharing buffers between multiple threads/branches in gstreamer.


问:
How can I get the S3 bucket Object URL after pointing my subdomain?
I have created a AWS S3 bucket where I am storing PDF files. Now I am fetching the object URL properly like below:
https://bucketnametest.s3.amazonaws.com/sample.pdf.
Now, I have pointed the AWS S3 bucket URL to my custom subdomain. So, I can directly hit the browser with https://customdomain.com/sample.pdf and I am getting the PDF as well. But the problem is, I am not getting the object URL like "https://customdomaintest.com/sample.pdf". Can anyone help how to fetch the bucket object URL like "https://customdomain.com/sample.pdf".?

Using the below code, I am getting the object URL like "https://bucketname.s3.amazonaws.com/sample.pdf". But I want it like "https://customdomain.com/sample.pdf".

```<code><?php
require 'vendor/autoload.php';

$s3 = new Aws\S3\S3Client([
    'region'  => 'us-east-1',
    'version' => 'latest',
    'credentials' => [
        'key'    => "xxxxxxxxxxxxxxxx",
        'secret' => "xxxxxxxxxxxxxxxxxxxx",
    ]
]);

$source = 'pdf/document91.pdf';
$uploader = new Aws\S3\MultipartUploader($s3, $source, [
    'bucket' => 'bucketname',
    'key' => "document91.pdf",
    'Body'   => "",
    'ACL'    => 'public-read',
]);

try {
    $result = $uploader->upload();
    echo "Upload complete: {$result['ObjectURL']}\n";
} catch (MultipartUploadException $e) {
    echo $e->getMessage() . "\n";
}
</code>```

Body:
I have created a AWS S3 bucket where I am storing PDF files. Now I am fetching the object URL properly like below:
https://bucketnametest.s3.amazonaws.com/sample.pdf.
Now, I have pointed the AWS S3 bucket URL to my custom subdomain. So, I can directly hit the browser with https://customdomain.com/sample.pdf and I am getting the PDF as well. But the problem is, I am not getting the object URL like "https://customdomaintest.com/sample.pdf". Can anyone help how to fetch the bucket object URL like "https://customdomain.com/sample.pdf".?

Using the below code, I am getting the object URL like "https://bucketname.s3.amazonaws.com/sample.pdf". But I want it like "https://customdomain.com/sample.pdf".

<?php
require 'vendor/autoload.php';

$s3 = new Aws\S3\S3Client([
    'region'  => 'us-east-1',
    'version' => 'latest',
    'credentials' => [
        'key'    => "xxxxxxxxxxxxxxxx",
        'secret' => "xxxxxxxxxxxxxxxxxxxx",
    ]
]);

$source = 'pdf/document91.pdf';
$uploader = new Aws\S3\MultipartUploader($s3, $source, [
    'bucket' => 'bucketname',
    'key' => "document91.pdf",
    'Body'   => "",
    'ACL'    => 'public-read',
]);

try {
    $result = $uploader->upload();
    echo "Upload complete: {$result['ObjectURL']}\n";
} catch (MultipartUploadException $e) {
    echo $e->getMessage() . "\n";
}


问:
Decreasing error in test data with small dataset
I have a problem that the training error is too good, but the test error is too bad. I've already use PCA to reduce the dimension of the feature and these are the best that i can get so far but it still not good enough for test data evaluation:

XGBoost :

R2 Score : 0.559832465443366

MSE      : 0.021168084677487115

RMSE     : 0.1454925588388874

MAE      : 0.12313938140869134

dataset: https://docs.google.com/spreadsheets/d/1xLTv4jLh7j3sTh0UKMHnSUvMXx1qNiXZ/edit?usp=share_link&ouid=116330084208220275542&rtpof=true&sd=true

these are my codes:

```<code>dataset = pd.read_excel('Data.xlsx')
x = dataset.iloc[:, 1:-1].values
y = dataset.iloc[:, -1].values

x_train, x_test, y_train, y_test = train_test_split(x, y, test_size = 0.2, random_state = 4)

sc = StandardScaler()
x_train[:, :] = sc.fit_transform(x_train[:, :])
x_test[:, :] = sc.transform(x_test[:, :])

pca = PCA(n_components = 4)
x_train = pca.fit_transform(x_train)
x_test = pca.transform(x_test)

rf = RandomForestRegressor()
adb = AdaBoostRegressor()
xgb = xgb.XGBRegressor()
gbrt = GradientBoostingRegressor()

rf_parameters = {'n_estimators':[200,500],'criterion':['squared_error', 'absolute_error', 'friedman_mse', 'poisson'], 'max_features': ['sqrt', 'log2', None]}
adb_parameters = {'n_estimators':[200,500],'loss':['linear', 'square', 'exponential']}
xgb_parameters = {'booster':['gbtree', 'dart'],
                  'sampling_method':['uniform', 'gradient_based'],
                  'tree_method':['auto','exact','approx','hist','gpu_hist'],
                  'n_estimators':[200,500]}
gbrt_parameters = {'loss':['squared_error', 'absolute_error', 'huber', 'quantile'],'n_estimators':[200,500],'criterion':['friedman_mse', 'squared_error'], 'max_features':['auto', 'sqrt', 'log2']}

rf_grid = GridSearchCV(rf, rf_parameters, cv = 8, n_jobs = -1)
adb_grid = GridSearchCV(adb, adb_parameters, cv = 8, n_jobs = -1)
xgb_grid = GridSearchCV(xgb, xgb_parameters, cv = 8, n_jobs = -1)
gbrt_grid = GridSearchCV(gbrt, gbrt_parameters, cv = 8, n_jobs = -1)

rf_grid.fit(x_train, y_train)
adb_grid.fit(x_train, y_train)
xgb_grid.fit(x_train, y_train)
gbrt_grid.fit(x_train, y_train)

y_pred_rf = rf_grid.predict(x_test)
y_pred_adb = adb_grid.predict(x_test)
y_pred_xgb = xgb_grid.predict(x_test)
y_pred_gbrt = gbrt_grid.predict(x_test)`
</code>```

what should i do to reducing the test data error, but the dataset only consist of 60 data and i use 80-20 splitting. Thank you

I've already use PCA to reduce the dimension of the feature and these are the best that i can get so far but it still not good enough for test data evaluation, what should i do to reducing the test data error, but the dataset only consist of 60 data and i use 80-20 splitting. Thank you

Body:
I have a problem that the training error is too good, but the test error is too bad. I've already use PCA to reduce the dimension of the feature and these are the best that i can get so far but it still not good enough for test data evaluation:

XGBoost :

R2 Score : 0.559832465443366

MSE      : 0.021168084677487115

RMSE     : 0.1454925588388874

MAE      : 0.12313938140869134

dataset: https://docs.google.com/spreadsheets/d/1xLTv4jLh7j3sTh0UKMHnSUvMXx1qNiXZ/edit?usp=share_link&ouid=116330084208220275542&rtpof=true&sd=true

these are my codes:

dataset = pd.read_excel('Data.xlsx')
x = dataset.iloc[:, 1:-1].values
y = dataset.iloc[:, -1].values

x_train, x_test, y_train, y_test = train_test_split(x, y, test_size = 0.2, random_state = 4)

sc = StandardScaler()
x_train[:, :] = sc.fit_transform(x_train[:, :])
x_test[:, :] = sc.transform(x_test[:, :])

pca = PCA(n_components = 4)
x_train = pca.fit_transform(x_train)
x_test = pca.transform(x_test)

rf = RandomForestRegressor()
adb = AdaBoostRegressor()
xgb = xgb.XGBRegressor()
gbrt = GradientBoostingRegressor()

rf_parameters = {'n_estimators':[200,500],'criterion':['squared_error', 'absolute_error', 'friedman_mse', 'poisson'], 'max_features': ['sqrt', 'log2', None]}
adb_parameters = {'n_estimators':[200,500],'loss':['linear', 'square', 'exponential']}
xgb_parameters = {'booster':['gbtree', 'dart'],
                  'sampling_method':['uniform', 'gradient_based'],
                  'tree_method':['auto','exact','approx','hist','gpu_hist'],
                  'n_estimators':[200,500]}
gbrt_parameters = {'loss':['squared_error', 'absolute_error', 'huber', 'quantile'],'n_estimators':[200,500],'criterion':['friedman_mse', 'squared_error'], 'max_features':['auto', 'sqrt', 'log2']}

rf_grid = GridSearchCV(rf, rf_parameters, cv = 8, n_jobs = -1)
adb_grid = GridSearchCV(adb, adb_parameters, cv = 8, n_jobs = -1)
xgb_grid = GridSearchCV(xgb, xgb_parameters, cv = 8, n_jobs = -1)
gbrt_grid = GridSearchCV(gbrt, gbrt_parameters, cv = 8, n_jobs = -1)

rf_grid.fit(x_train, y_train)
adb_grid.fit(x_train, y_train)
xgb_grid.fit(x_train, y_train)
gbrt_grid.fit(x_train, y_train)

y_pred_rf = rf_grid.predict(x_test)
y_pred_adb = adb_grid.predict(x_test)
y_pred_xgb = xgb_grid.predict(x_test)
y_pred_gbrt = gbrt_grid.predict(x_test)`

what should i do to reducing the test data error, but the dataset only consist of 60 data and i use 80-20 splitting. Thank you

I've already use PCA to reduce the dimension of the feature and these are the best that i can get so far but it still not good enough for test data evaluation, what should i do to reducing the test data error, but the dataset only consist of 60 data and i use 80-20 splitting. Thank you


问:
Capture the UserID and send to Slack Channel using Python
I'm having an issue capturing the userid that will send a message to my Slack Channel and give me a visibility who uses my Python script. The variable name that I use in my Workflow Slack Channel is User and it's data type is Text. The script works fine if I hard code the user but that is not what I want.

I tried below script but it gives me "SyntaxError: invalid syntax"

```<code>import json
import requests

#This will send a slack message to my logs channel

url = "https://hooks.slack.com/workflows/XXXXXX/XXXXXX/XXXXXX/XXXXX"
data = {'User': <@User>, 'Message': 'used the app!'}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post(url, data=json.dumps(data), headers=headers)
</code>```

I'm expecting the script will capture the userid whoever uses the script and send message to my Slack Channel. Correct syntax would be nice. Thank you very much.

Body:
I'm having an issue capturing the userid that will send a message to my Slack Channel and give me a visibility who uses my Python script. The variable name that I use in my Workflow Slack Channel is User and it's data type is Text. The script works fine if I hard code the user but that is not what I want.

I tried below script but it gives me "SyntaxError: invalid syntax"

import json
import requests

#This will send a slack message to my logs channel

url = "https://hooks.slack.com/workflows/XXXXXX/XXXXXX/XXXXXX/XXXXX"
data = {'User': <@User>, 'Message': 'used the app!'}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post(url, data=json.dumps(data), headers=headers)

I'm expecting the script will capture the userid whoever uses the script and send message to my Slack Channel. Correct syntax would be nice. Thank you very much.


问:
How can I get images from API in Custom print format instead of frappe files?
I have created a custom print format where I can print all form data using Jinja but there are some base64 images that I am storing on external server and I want to get those images and display it on print page.

images are in base64 and I have tried localstorage it is working but need to get it form api each time I want to print.

is there a way to override the print class? if yes which class/file it is.


问:
Big numbers value is changing itself
Suppose I have big numbers such as this: 10.295.419.305.791.578.917.358.173.519.057.891.283.897.623.986

```<code>library(gmp)
as.bigz(10295419305791578917358173519057891283897623986)
</code>```

And this might outputs:

```<code>Big Integer ('bigz') :
[1] 10295419305791579051260295299235939155628261376
</code>```

Visually the value 10.295.419.305.791.579.051.260.295.299.235.939.155.628.261.376 is already different compared the input (begins after 15 digits from beginning)

My question: are there any explanation to this? is it because of numeric error before it being converted to big integer?

While I still find a way to get the accurate value by adding quotes.. such as:

```<code>as.bigz("10295419305791578917358173519057891283897623986")
Big Integer ('bigz') :
[1] 10295419305791578917358173519057891283897623986
</code>```

Title: Big numbers value is changing itself

Body:
Suppose I have big numbers such as this: 10.295.419.305.791.578.917.358.173.519.057.891.283.897.623.986

library(gmp)
as.bigz(10295419305791578917358173519057891283897623986)

And this might outputs:

Big Integer ('bigz') :
[1] 10295419305791579051260295299235939155628261376

Visually the value 10.295.419.305.791.579.051.260.295.299.235.939.155.628.261.376 is already different compared the input (begins after 15 digits from beginning)

My question: are there any explanation to this? is it because of numeric error before it being converted to big integer?

While I still find a way to get the accurate value by adding quotes.. such as:

as.bigz("10295419305791578917358173519057891283897623986")
Big Integer ('bigz') :
[1] 10295419305791578917358173519057891283897623986


问:
I want to use turborepo in a project where I don't want to use TypeScript is this possible?
I searched and read the docs but couldn't find the exact solution I also search for template and boilerplate.

How to use turborepo without using typescript any comments about it guys?

I don't want to use typescript because it's complicated for beginner when the project scale.


问:
Issue while importing a bean of ArrayListType in spring, java
I want to import a bean of type java.util.ArrayList from application context. I'm facing problem while importing the bean.

I have a beans defined in country.xml as:

<bean id="in" class="com.springlearn.Country">
  <property name="code" value="IN" />
  <property name="name" value="India" />
</bean>
<bean id="us" class="com.springlearn.Country">
  <property name="code" value="US" />
  <property name="name" value="United States" />
</bean>
<bean id="de" class="com.springlearn.Country">
  <property name="code" value="DE" />
  <property name="name" value="Germany" />
</bean>
<bean id="jp" class="com.springlearn.Country">
  <property name="code" value="JP" />
  <property name="name" value="Japan" />
</bean>
<bean id="countryList" class="java.util.ArrayList">
  <constructor-arg>
    <list>
      <ref bean="in" />
      <ref bean="us" />
      <ref bean="de" />
      <ref bean="jp" />
    </list>
  </constructor-arg>
</bean>```
</div>
</div>
</p>
<p>In which <code>com.springlearn.Country</code> is a user Defined class. I want to import the <code>countryList</code> bean. To print I made this function:</p>
```public static void displayCountries() {
    ConfigurableApplicationContext context =  new ClassPathXmlApplicationContext("countryList.xml");
    List<Country> countries = context.getBean("countryList",ArrayList.class);
    for(var country:countries) {
        LOGGER.debug("Country : {}", country.toString());
    }
    context.close();
}
```

But the line List<Country> countries = context.getBean("countryList",ArrayList.class); returns an error The type java.lang.Iterable cannot be resolved. It is indirectly referenced from required .class files

How to sort out this error.

Body:
I want to import a bean of type java.util.ArrayList from application context. I'm facing problem while importing the bean.

I have a beans defined in country.xml as:

<bean id="in" class="com.springlearn.Country">
  <property name="code" value="IN" />
  <property name="name" value="India" />
</bean>
<bean id="us" class="com.springlearn.Country">
  <property name="code" value="US" />
  <property name="name" value="United States" />
</bean>
<bean id="de" class="com.springlearn.Country">
  <property name="code" value="DE" />
  <property name="name" value="Germany" />
</bean>
<bean id="jp" class="com.springlearn.Country">
  <property name="code" value="JP" />
  <property name="name" value="Japan" />
</bean>
<bean id="countryList" class="java.util.ArrayList">
  <constructor-arg>
    <list>
      <ref bean="in" />
      <ref bean="us" />
      <ref bean="de" />
      <ref bean="jp" />
    </list>
  </constructor-arg>
</bean>

In which com.springlearn.Country is a user Defined class. I want to import the countryList bean. To print I made this function:

public static void displayCountries() {
    ConfigurableApplicationContext context =  new ClassPathXmlApplicationContext("countryList.xml");
    List<Country> countries = context.getBean("countryList",ArrayList.class);
    for(var country:countries) {
        LOGGER.debug("Country : {}", country.toString());
    }
    context.close();
}

But the line List<Country> countries = context.getBean("countryList",ArrayList.class); returns an error The type java.lang.Iterable cannot be resolved. It is indirectly referenced from required .class files

How to sort out this error.


问:
Datetime is opened by default

Why my ion-datetime is opened by default ?.. Help me Please

Title: Datetime is opened by default


问:
Unpivot with column list picked from a result set. Is it possible?
I am trying to unpivot a table and I want to column list to be referred from another CTE written apart. Is it possible? And I do not want any dynamic SQL to achieve this as my execution flow would not allow dynamic SQL.
After unpivot, I would want to find and display the names of the columns which only have distinct values in their respective data.
Any column with same data can be omitted to display.

I cannot refer the column names in the query as there are many columns.

with temp as (Select col1,col2,col3,col4,Count(1) CNT from  $dataset.my_table
group by   col1,col2,col3,col4)

,col_list as (select column_name FROM $dataset.INFORMATION_SCHEMA.COLUMNS where table_name = 'my_table' and column_name not in ('col1','col2','col3','col4'))

 select * from temp
 unpivot (data for col_name in (select * from unnest(col_list)) )
```

This is giving an error as  "Unexpected keyword SELECT at line 6"

BigQuery

Any clue would be much appreciated.

my table

col1
col2
col3
col4
col5
col6
col7

ee
rr
aa
bb
123
cc
45

ee
rr
aa
bb
234
cc
34

ee
rr
aa
bb
123
cc
56

expected o/p

col1
col2
col3
col4
Data

ee
rr
aa
bb
col5

ee
rr
aa
bb
col7

Body:
I am trying to unpivot a table and I want to column list to be referred from another CTE written apart. Is it possible? And I do not want any dynamic SQL to achieve this as my execution flow would not allow dynamic SQL.
After unpivot, I would want to find and display the names of the columns which only have distinct values in their respective data.
Any column with same data can be omitted to display.

I cannot refer the column names in the query as there are many columns.

with temp as (Select col1,col2,col3,col4,Count(1) CNT from  $dataset.my_table
group by   col1,col2,col3,col4)

,col_list as (select column_name FROM $dataset.INFORMATION_SCHEMA.COLUMNS where table_name = 'my_table' and column_name not in ('col1','col2','col3','col4'))

 select * from temp
 unpivot (data for col_name in (select * from unnest(col_list)) )

This is giving an error as  "Unexpected keyword SELECT at line 6"

BigQuery

Any clue would be much appreciated.

my table

col1
col2
col3
col4
col5
col6
col7

ee
rr
aa
bb
123
cc
45

ee
rr
aa
bb
234
cc
34

ee
rr
aa
bb
123
cc
56

expected o/p

col1
col2
col3
col4
Data

ee
rr
aa
bb
col5

ee
rr
aa
bb
col7


问:
how to call response when list in json has no lock
I get a list of objects via API and want to display each list item as an option in the spinner to make a  new API request based on it.

{
"products": [
{
"id": 1,
"title": "iPhone 9",
"description": "An apple mobile which is nothing like apple",
"price": 549,
"discountPercentage": 12.96,
"rating": 4.69,
"stock": 94,
"brand": "Apple",
"category": "smartphones",
"thumbnail": "https://i.dummyjson.com/data/products/1/thumbnail.jpg",
"images": [
"https://i.dummyjson.com/data/products/1/1.jpg",
"https://i.dummyjson.com/data/products/1/2.jpg",
"https://i.dummyjson.com/data/products/1/3.jpg",
"https://i.dummyjson.com/data/products/1/4.jpg",
"https://i.dummyjson.com/data/products/1/thumbnail.jpg"
]
},
```
<pre class="lang-kotlin prettyprint-override"><code>data class ProductsResponse(
    @SerializedName("id")
    val id: String,

    @SerializedName("title")
    val title: String,

    @SerializedName("description")
    val description: String,

    @SerializedName("price")
    val price: Int,

    @SerializedName("rating")
    val rating: Float,

    @SerializedName("stock")
    val stock: Int,

    @SerializedName("brand")
    val brand: String,

    @SerializedName("category")
    val category: String,

    @SerializedName("thumbnail")
    val thumbnail: String,

    @SerializedName("images")
    val images:
)
</code>```

I want to call the contents of the type list but it keeps getting an error, how do I call it?
and I want to use an image asset as an image slider, how to do it?

Body:
I get a list of objects via API and want to display each list item as an option in the spinner to make a  new API request based on it.

{
"products": [
{
"id": 1,
"title": "iPhone 9",
"description": "An apple mobile which is nothing like apple",
"price": 549,
"discountPercentage": 12.96,
"rating": 4.69,
"stock": 94,
"brand": "Apple",
"category": "smartphones",
"thumbnail": "https://i.dummyjson.com/data/products/1/thumbnail.jpg",
"images": [
"https://i.dummyjson.com/data/products/1/1.jpg",
"https://i.dummyjson.com/data/products/1/2.jpg",
"https://i.dummyjson.com/data/products/1/3.jpg",
"https://i.dummyjson.com/data/products/1/4.jpg",
"https://i.dummyjson.com/data/products/1/thumbnail.jpg"
]
},

data class ProductsResponse(
    @SerializedName("id")
    val id: String,

    @SerializedName("title")
    val title: String,

    @SerializedName("description")
    val description: String,

    @SerializedName("price")
    val price: Int,

    @SerializedName("rating")
    val rating: Float,

    @SerializedName("stock")
    val stock: Int,

    @SerializedName("brand")
    val brand: String,

    @SerializedName("category")
    val category: String,

    @SerializedName("thumbnail")
    val thumbnail: String,

    @SerializedName("images")
    val images:
)

I want to call the contents of the type list but it keeps getting an error, how do I call it?
and I want to use an image asset as an image slider, how to do it?


问:
how to sort recyclerview based on the values set through itemView and not on the basis of values fetched from helper class
I have calculated distance between two locations inside adapter but now I cannot sort the RecyclerView based on distance. Because the calculated distance is not from helper class.

Following is the Code from Adapter Class:

```<code>public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> {

    Context context;
    ArrayList<JobSeekerClass> list;
    Double JSlat, JSlng;
    LocationManager locationManager;
    String provider;

    public MyAdapter(Context context, ArrayList<JobSeekerClass> list) {
        this.context = context;
        this.list = list;
    }

    @NonNull
    @Override
    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(context).inflate(R.layout.item, parent, false);
        return new MyViewHolder(v);
    }

    @Override
    public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
        locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
        provider = locationManager.getBestProvider(new Criteria(), false);
        if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
            return;
        }
        Location location = locationManager.getLastKnownLocation(provider);
        JobSeekerClass JobSeeker = list.get(position);
        //Job Seeker Lat Lng
        JSlat= location.getLatitude();
        JSlng= location.getLongitude();
        LatLng Job_Seeker= new LatLng(JSlat, JSlng);
        //Job Provider Lat Lng
        String JPlat= JobSeeker.getJplongitude();
        String JPlng= JobSeeker.getJplatitude();
        Double JP_lat= Double.parseDouble(JPlat);
        Double JP_lng= Double.parseDouble(JPlng);
        LatLng Job_Provider= new LatLng(JP_lat, JP_lng);
        //Calculating Distance
        Double Distance= SphericalUtil.computeDistanceBetween(Job_Seeker, Job_Provider);
        //Distance in Kilometers
        Double Distance_in_KM= Distance/1000;
        Double dist= Math.floor(Distance_in_KM);
        String distance_string= dist.toString();

        //Setting Text for Calculated Distance in RecyclerView
        holder.faasla_Digit.setText(distance_string);

        //Setting Text for JobSeeker City
        holder.City.setText(JobSeeker.getJPlocation());
        holder.PhoneNumber.setText(JobSeeker.getJPphone_no());
        holder.find_job_Location.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int position = holder.getAdapterPosition();
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("google.navigation:q=" + list.get(position).getJplongitude() + "," + list.get(position).getJplatitude() + "&mode=l"));
                intent.setPackage("com.google.android.apps.maps");
                if (intent.resolveActivity(context.getPackageManager()) != null) {
                    context.startActivity(intent);
                }
            }
        });
        //Salary Digit Sound for corresponding values
        holder.Salary.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (holder.Salary.getText().equals("1000")) {
                    MediaPlayer mplayer = MediaPlayer.create(context.getApplicationContext(), R.raw.aikhazar);
                    mplayer.start();
                }
            }
        });
    }
    @Override
    public int getItemCount() {
        return list.size();
    }

    public static class MyViewHolder extends RecyclerView.ViewHolder implements LocationListener {
        TextView Salary, City, PhoneNumber, city_text, phone_number_text, salary_text,
                raasta_maloom_karain, faasla_Digit;
        Button find_job_Location;

        public MyViewHolder(@NonNull View itemView) {
            super(itemView);
            City = itemView.findViewById(R.id.tvJobLocation);
            PhoneNumber = itemView.findViewById(R.id.tvPhoneNo);
            Salary = itemView.findViewById(R.id.tvSalary);
            city_text = itemView.findViewById(R.id.Sheher);
            phone_number_text = itemView.findViewById(R.id.raabta_number);
            salary_text = itemView.findViewById(R.id.mahana_tankhuwa);
            raasta_maloom_karain = itemView.findViewById(R.id.raasta_maloom_karain);
            find_job_Location = itemView.findViewById(R.id.find_job_location);
            faasla_Digit = itemView.findViewById(R.id.faasla_digit);
        }

        @Override
        public void onLocationChanged(@NonNull Location location) {

        }

        @Override
        public void onLocationChanged(@NonNull List<Location> locations) {
            LocationListener.super.onLocationChanged(locations);
        }

        @Override
        public void onFlushComplete(int requestCode) {
            LocationListener.super.onFlushComplete(requestCode);
        }

        @Override
        public void onProviderEnabled(@NonNull String provider) {
            LocationListener.super.onProviderEnabled(provider);
        }

        @Override
        public void onProviderDisabled(@NonNull String provider) {
            LocationListener.super.onProviderDisabled(provider);
        }
    }
}
</code>```

Following is the Code from Helper Class:

```<code>public class JobSeekerClass {
    String JPfullname, JPphone_no, JPemail, JPaddress, JPjob_title,
            JPlocation, JPsalary, JPDMwages, JPFNwages, jplongitude, jplatitude;

    public JobSeekerClass()
    {

    }
    public JobSeekerClass(String JPfullname, String JPphone_no, String JPemail, String JPaddress,
                          String JPjob_title, String JPlocation, String JPsalary, String JPDMwages,
                          String JPFNwages, String jplongitude, String jplatitude)
    {
        this.JPfullname= JPfullname;
        this.JPphone_no= JPphone_no;
        this.JPemail= JPemail;
        this.JPaddress= JPaddress;
        this.JPjob_title= JPjob_title;
        this.JPlocation= JPlocation;
        this.JPsalary= JPsalary;
        this.JPDMwages= JPDMwages;
        this.JPFNwages= JPFNwages;
        this.jplongitude= jplongitude;
        this.jplatitude= jplatitude;
    }

    public String getJplongitude() {
        return jplongitude;
    }

    public void setJplongitude(String jplongitude) {
        this.jplongitude = jplongitude;
    }

    public String getJplatitude() {
        return jplatitude;
    }

    public void setJplatitude(String jplatitude) {
        this.jplatitude = jplatitude;
    }

    public String getJPfullname() {
        return JPfullname;
    }

    public void setJPfullname(String JPfullname) {
        this.JPfullname = JPfullname;
    }

    public String getJPphone_no() {
        return JPphone_no;
    }

    public void setJPphone_no(String JPphone_no) {
        this.JPphone_no = JPphone_no;
    }

    public String getJPemail() {
        return JPemail;
    }

    public void setJPemail(String JPemail) {
        this.JPemail = JPemail;
    }

    public String getJPaddress() {
        return JPaddress;
    }

    public void setJPaddress(String JPaddress) {
        this.JPaddress = JPaddress;
    }

    public String getJPjob_title() {
        return JPjob_title;
    }

    public void setJPjob_title(String JPjob_title) {
        this.JPjob_title = JPjob_title;
    }

    public String getJPlocation() {
        return JPlocation;
    }

    public void setJPlocation(String JPlocation) {
        this.JPlocation = JPlocation;
    }

    public String getJPsalary() {
        return JPsalary;
    }

    public void setJPsalary(String JPsalary) {
        this.JPsalary = JPsalary;
    }

    public String getJPDMwages() {
        return JPDMwages;
    }

    public void setJPDMwages(String JPDMwages) {
        this.JPDMwages = JPDMwages;
    }

    public String getJPFNwages() {
        return JPFNwages;
    }

    public void setJPFNwages(String JPFNwages) {
        this.JPFNwages = JPFNwages;
    }

    public String toString()
    {
        return this.JPlocation + "";
    }
}
</code>```

Now I(JobSeeker) have fetched my current location in MyAdapter and computed the distance using the LatLng I got from getJplatitude() and getJplongitude() from JobSeekerClass(). It is actually Job Provider class. I mistakenly named it as JobSeekerClass. I have calculated distance using distUtils and now, I want to sort my recyclerView based on the computed distance. How can I do that?

Body:
I have calculated distance between two locations inside adapter but now I cannot sort the RecyclerView based on distance. Because the calculated distance is not from helper class.

Following is the Code from Adapter Class:

public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> {

    Context context;
    ArrayList<JobSeekerClass> list;
    Double JSlat, JSlng;
    LocationManager locationManager;
    String provider;

    public MyAdapter(Context context, ArrayList<JobSeekerClass> list) {
        this.context = context;
        this.list = list;
    }

    @NonNull
    @Override
    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(context).inflate(R.layout.item, parent, false);
        return new MyViewHolder(v);
    }

    @Override
    public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
        locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
        provider = locationManager.getBestProvider(new Criteria(), false);
        if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
            return;
        }
        Location location = locationManager.getLastKnownLocation(provider);
        JobSeekerClass JobSeeker = list.get(position);
        //Job Seeker Lat Lng
        JSlat= location.getLatitude();
        JSlng= location.getLongitude();
        LatLng Job_Seeker= new LatLng(JSlat, JSlng);
        //Job Provider Lat Lng
        String JPlat= JobSeeker.getJplongitude();
        String JPlng= JobSeeker.getJplatitude();
        Double JP_lat= Double.parseDouble(JPlat);
        Double JP_lng= Double.parseDouble(JPlng);
        LatLng Job_Provider= new LatLng(JP_lat, JP_lng);
        //Calculating Distance
        Double Distance= SphericalUtil.computeDistanceBetween(Job_Seeker, Job_Provider);
        //Distance in Kilometers
        Double Distance_in_KM= Distance/1000;
        Double dist= Math.floor(Distance_in_KM);
        String distance_string= dist.toString();

        //Setting Text for Calculated Distance in RecyclerView
        holder.faasla_Digit.setText(distance_string);

        //Setting Text for JobSeeker City
        holder.City.setText(JobSeeker.getJPlocation());
        holder.PhoneNumber.setText(JobSeeker.getJPphone_no());
        holder.find_job_Location.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int position = holder.getAdapterPosition();
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("google.navigation:q=" + list.get(position).getJplongitude() + "," + list.get(position).getJplatitude() + "&mode=l"));
                intent.setPackage("com.google.android.apps.maps");
                if (intent.resolveActivity(context.getPackageManager()) != null) {
                    context.startActivity(intent);
                }
            }
        });
        //Salary Digit Sound for corresponding values
        holder.Salary.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (holder.Salary.getText().equals("1000")) {
                    MediaPlayer mplayer = MediaPlayer.create(context.getApplicationContext(), R.raw.aikhazar);
                    mplayer.start();
                }
            }
        });
    }
    @Override
    public int getItemCount() {
        return list.size();
    }

    public static class MyViewHolder extends RecyclerView.ViewHolder implements LocationListener {
        TextView Salary, City, PhoneNumber, city_text, phone_number_text, salary_text,
                raasta_maloom_karain, faasla_Digit;
        Button find_job_Location;

        public MyViewHolder(@NonNull View itemView) {
            super(itemView);
            City = itemView.findViewById(R.id.tvJobLocation);
            PhoneNumber = itemView.findViewById(R.id.tvPhoneNo);
            Salary = itemView.findViewById(R.id.tvSalary);
            city_text = itemView.findViewById(R.id.Sheher);
            phone_number_text = itemView.findViewById(R.id.raabta_number);
            salary_text = itemView.findViewById(R.id.mahana_tankhuwa);
            raasta_maloom_karain = itemView.findViewById(R.id.raasta_maloom_karain);
            find_job_Location = itemView.findViewById(R.id.find_job_location);
            faasla_Digit = itemView.findViewById(R.id.faasla_digit);
        }

        @Override
        public void onLocationChanged(@NonNull Location location) {

        }

        @Override
        public void onLocationChanged(@NonNull List<Location> locations) {
            LocationListener.super.onLocationChanged(locations);
        }

        @Override
        public void onFlushComplete(int requestCode) {
            LocationListener.super.onFlushComplete(requestCode);
        }

        @Override
        public void onProviderEnabled(@NonNull String provider) {
            LocationListener.super.onProviderEnabled(provider);
        }

        @Override
        public void onProviderDisabled(@NonNull String provider) {
            LocationListener.super.onProviderDisabled(provider);
        }
    }
}

Following is the Code from Helper Class:

public class JobSeekerClass {
    String JPfullname, JPphone_no, JPemail, JPaddress, JPjob_title,
            JPlocation, JPsalary, JPDMwages, JPFNwages, jplongitude, jplatitude;

    public JobSeekerClass()
    {

    }
    public JobSeekerClass(String JPfullname, String JPphone_no, String JPemail, String JPaddress,
                          String JPjob_title, String JPlocation, String JPsalary, String JPDMwages,
                          String JPFNwages, String jplongitude, String jplatitude)
    {
        this.JPfullname= JPfullname;
        this.JPphone_no= JPphone_no;
        this.JPemail= JPemail;
        this.JPaddress= JPaddress;
        this.JPjob_title= JPjob_title;
        this.JPlocation= JPlocation;
        this.JPsalary= JPsalary;
        this.JPDMwages= JPDMwages;
        this.JPFNwages= JPFNwages;
        this.jplongitude= jplongitude;
        this.jplatitude= jplatitude;
    }

    public String getJplongitude() {
        return jplongitude;
    }

    public void setJplongitude(String jplongitude) {
        this.jplongitude = jplongitude;
    }

    public String getJplatitude() {
        return jplatitude;
    }

    public void setJplatitude(String jplatitude) {
        this.jplatitude = jplatitude;
    }

    public String getJPfullname() {
        return JPfullname;
    }

    public void setJPfullname(String JPfullname) {
        this.JPfullname = JPfullname;
    }

    public String getJPphone_no() {
        return JPphone_no;
    }

    public void setJPphone_no(String JPphone_no) {
        this.JPphone_no = JPphone_no;
    }

    public String getJPemail() {
        return JPemail;
    }

    public void setJPemail(String JPemail) {
        this.JPemail = JPemail;
    }

    public String getJPaddress() {
        return JPaddress;
    }

    public void setJPaddress(String JPaddress) {
        this.JPaddress = JPaddress;
    }

    public String getJPjob_title() {
        return JPjob_title;
    }

    public void setJPjob_title(String JPjob_title) {
        this.JPjob_title = JPjob_title;
    }

    public String getJPlocation() {
        return JPlocation;
    }

    public void setJPlocation(String JPlocation) {
        this.JPlocation = JPlocation;
    }

    public String getJPsalary() {
        return JPsalary;
    }

    public void setJPsalary(String JPsalary) {
        this.JPsalary = JPsalary;
    }

    public String getJPDMwages() {
        return JPDMwages;
    }

    public void setJPDMwages(String JPDMwages) {
        this.JPDMwages = JPDMwages;
    }

    public String getJPFNwages() {
        return JPFNwages;
    }

    public void setJPFNwages(String JPFNwages) {
        this.JPFNwages = JPFNwages;
    }

    public String toString()
    {
        return this.JPlocation + "";
    }
}

Now I(JobSeeker) have fetched my current location in MyAdapter and computed the distance using the LatLng I got from getJplatitude() and getJplongitude() from JobSeekerClass(). It is actually Job Provider class. I mistakenly named it as JobSeekerClass. I have calculated distance using distUtils and now, I want to sort my recyclerView based on the computed distance. How can I do that?


问:
react application failed to compile
Failed to compile.

Error: EACCES: permission denied, open '/Users/sam/.config/svgrrc'
ERROR in ./src/logo.svg
Module build failed (from ./node_modules/@svgr/webpack/lib/index.js):
Error: EACCES: permission denied, open '/Users/sam/.config/svgrrc'

webpack compiled with 1 error

how react application will run

Title: react application failed to compile


问:
How do I add a Body parameter decorator like in nestjs?
I am creating my own NodeJS + Express + Typescript framework, and right now I have a Controller class decorator, and several method decorators for paths, request methods and middleware. However now I want to be able to pass a @Body body: UserDto for example, with automatic validation using class-validators and class-transformers packages. Right now I have a method decorator ValidateBody, that looks like this:

```<code>function validationFactory<T>(
  metadataKey: Symbol,
  model: { new (...args: any[]): T },
  source: "body" | "query" | "params"
) {
  return function (
    target: any,
    propertyName: string,
    descriptor: TypedPropertyDescriptor<any>
  ) {
    Reflect.defineMetadata(metadataKey, model, target, propertyName);

    const method = descriptor.value;
    descriptor.value = async function () {
      const model = Reflect.getOwnMetadata(metadataKey, target, propertyName);

      const [req, res] = arguments;
      const plain = req[source];

      const errors = await validate(plainToInstance(model, plain));
      if (errors.length > 0) {
        res
          .status(422)
          .json({ errors: transformValidationErrorsToJSON(errors) });
        return;
      }

      return method!.apply(this, arguments);
    };
  };
}
</code>```

But i want to be able to use a parameter decorator like @Body body: UserDto, that automatically does a validate() on the type. How would I go about implementing this?

Body:
I am creating my own NodeJS + Express + Typescript framework, and right now I have a Controller class decorator, and several method decorators for paths, request methods and middleware. However now I want to be able to pass a @Body body: UserDto for example, with automatic validation using class-validators and class-transformers packages. Right now I have a method decorator ValidateBody, that looks like this:

function validationFactory<T>(
  metadataKey: Symbol,
  model: { new (...args: any[]): T },
  source: "body" | "query" | "params"
) {
  return function (
    target: any,
    propertyName: string,
    descriptor: TypedPropertyDescriptor<any>
  ) {
    Reflect.defineMetadata(metadataKey, model, target, propertyName);

    const method = descriptor.value;
    descriptor.value = async function () {
      const model = Reflect.getOwnMetadata(metadataKey, target, propertyName);

      const [req, res] = arguments;
      const plain = req[source];

      const errors = await validate(plainToInstance(model, plain));
      if (errors.length > 0) {
        res
          .status(422)
          .json({ errors: transformValidationErrorsToJSON(errors) });
        return;
      }

      return method!.apply(this, arguments);
    };
  };
}

But i want to be able to use a parameter decorator like @Body body: UserDto, that automatically does a validate() on the type. How would I go about implementing this?


问:
Autokeras - StructuredDataClassifier, Graph execution error:
I used this callback in autokeras:

```<code>from tensorflow.keras.callbacks import EarlyStopping

early_stopping = EarlyStopping(monitor='val_loss', patience=5)

auto_ml.fit(x=x_train, y=y_train, validation_data=(x_test, y_test), class_weight=class_weights, callbacks=[early_stopping])
</code>```

Training was done, i tried to evaluate with model but i got this error:

```<code>ml.evaluate(x_test, y_test)
</code>```

enter image description here
enter image description here

I tried to use model came out from autokeras with early_stopping callback. Without callback, my code was fine.

Body:
I used this callback in autokeras:

from tensorflow.keras.callbacks import EarlyStopping

early_stopping = EarlyStopping(monitor='val_loss', patience=5)

auto_ml.fit(x=x_train, y=y_train, validation_data=(x_test, y_test), class_weight=class_weights, callbacks=[early_stopping])

Training was done, i tried to evaluate with model but i got this error:

ml.evaluate(x_test, y_test)

enter image description here
enter image description here

I tried to use model came out from autokeras with early_stopping callback. Without callback, my code was fine.


问:
Image and file selection process in xenforo webview application
I created the webview application of the xenforo based website. however, when the image and file upload buttons are clicked on the subject, nothing happens. how can i solve this problem? I tried many different codes but it didn't work

my mainactivity.java codes

```<code>
package com.peronmedya.adusoruyor;

import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.webkit.ValueCallback;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends AppCompatActivity
{
    private ValueCallback<Uri> mUploadMessage;
    public ValueCallback<Uri[]> uploadMessage;
    public static final int REQUEST_SELECT_FILE = 100;
    private final static int FILECHOOSER_RESULTCODE = 1;
    WebView webview;
    private Object Passwords;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        bagla();
        yukle();

        webview.setWebViewClient(new WebViewClient());
    }

    public void bagla(){
        webview = findViewById(R.id.webview);
        webview.getSettings().setSavePassword(true);

    }

    public void yukle(){
        webview.loadUrl("https://adusoruyor.com");
        webview.getSettings().setJavaScriptEnabled(true);
        WebSettings webSettings = webview.getSettings();
        webview.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
        webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
        webview.getSettings().setAllowFileAccess(true);
        webview.getSettings().setAllowContentAccess(true);
        webview.getSettings().setAllowFileAccessFromFileURLs(true);
        webview.getSettings().setAllowUniversalAccessFromFileURLs(true);
        webSettings.setJavaScriptEnabled(true);

        webview.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageCommitVisible(WebView view, String url) {
                view.loadUrl(url);
            }
        });
    }

    @Override
    public void onBackPressed() {
        if (webview.canGoBack()) {
            webview.goBack();
        } else {
            super.onBackPressed();
        }
    }
}

</code>```

I activated the camera and file permissions, I entered the codes in the line

Body:
I created the webview application of the xenforo based website. however, when the image and file upload buttons are clicked on the subject, nothing happens. how can i solve this problem? I tried many different codes but it didn't work

my mainactivity.java codes

package com.peronmedya.adusoruyor;

import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.webkit.ValueCallback;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends AppCompatActivity
{
    private ValueCallback<Uri> mUploadMessage;
    public ValueCallback<Uri[]> uploadMessage;
    public static final int REQUEST_SELECT_FILE = 100;
    private final static int FILECHOOSER_RESULTCODE = 1;
    WebView webview;
    private Object Passwords;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        bagla();
        yukle();

        webview.setWebViewClient(new WebViewClient());
    }

    public void bagla(){
        webview = findViewById(R.id.webview);
        webview.getSettings().setSavePassword(true);

    }

    public void yukle(){
        webview.loadUrl("https://adusoruyor.com");
        webview.getSettings().setJavaScriptEnabled(true);
        WebSettings webSettings = webview.getSettings();
        webview.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
        webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
        webview.getSettings().setAllowFileAccess(true);
        webview.getSettings().setAllowContentAccess(true);
        webview.getSettings().setAllowFileAccessFromFileURLs(true);
        webview.getSettings().setAllowUniversalAccessFromFileURLs(true);
        webSettings.setJavaScriptEnabled(true);

        webview.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageCommitVisible(WebView view, String url) {
                view.loadUrl(url);
            }
        });
    }

    @Override
    public void onBackPressed() {
        if (webview.canGoBack()) {
            webview.goBack();
        } else {
            super.onBackPressed();
        }
    }
}

I activated the camera and file permissions, I entered the codes in the line


问:
Facebook Meta Access Token [Developer API]
I know how to create an app access token using Meta Developer API as follows:

```<code>https://graph.facebook.com/<API_VERSION>/oauth/access_token?
  client_id=<YOUR_APP_ID>
  &redirect_uri=<YOUR_URL>
  &client_secret=<YOUR_APP_SECRET>
  &code=<AUTHORIZATION_CODE>
</code>```

This means that I have to have both client_id and client_secret. Is there an alternative to create an access token without needing to provide these values?

I already have a web access token that I retrieve from the oAuth dialog. I thought that there should be a way to issue an access token via the web access token. Any help on this regard?

Body:
I know how to create an app access token using Meta Developer API as follows:

https://graph.facebook.com/<API_VERSION>/oauth/access_token?
  client_id=<YOUR_APP_ID>
  &redirect_uri=<YOUR_URL>
  &client_secret=<YOUR_APP_SECRET>
  &code=<AUTHORIZATION_CODE>

This means that I have to have both client_id and client_secret. Is there an alternative to create an access token without needing to provide these values?

I already have a web access token that I retrieve from the oAuth dialog. I thought that there should be a way to issue an access token via the web access token. Any help on this regard?


问:
C# web api using google access token
I am trying to make external login. I registered with google and I am getting back access token from this link:

```<code>https://accounts.google.com/o/oauth2/v2/auth?scope=openid%20email&response_type=token&redirect_uri=https://localhost:3007/google-singin&client_id=655720894976-2rkkoov9efteqna8hq3vbc632brur2jf.apps.googleusercontent.com
</code>```

it returns :

```<code>https://localhost:3007/google-singin#access_token=ya29.a0AX9GBdVlBg-Vym3C1oSpjGljuGyuhwDox3hvjgNEFe2ruPRYovteF6CwdSq-iU2njYwVIscBKty8MrROxNz-nP0RYnEhIgAhqxb6AXJ2XGGXU0aAvbqRXXGcPNSRhA3I6q1547bJuxYFbNZ2NFg9iErztQnJaCgYKAW8SARASFQHUCsbCwxPiOUQq4k126M0x1ZgBPg0163&token_type=Bearer&expires_in=3599&scope=email%20https://www.googleapis.com/auth/userinfo.email%20openid&authuser=0&prompt=consent
</code>```

from this I can get access token witch is :

```<code>ya29.a0AX9GBdVlBg-Vym3C1oSpjGljuGyuhwDox3hvjgNEFe2ruPRYovteF6CwdSq-iU2njYwVIscBKty8MrROxNz-nP0RYnEhIgAhqxb6AXJ2XGGXU0aAvbqRXXGcPNSRhA3I6q1547bJuxYFbNZ2NFg9iErztQnJaCgYKAW8SARASFQHUCsbCwxPiOUQq4k126M0x1ZgBPg0163
</code>```

How do I call google api with this token, to get user info? I mean in back end.

If I call this links:

```<code>https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=ya29.a0AX9GBdVlBg-Vym3C1oSpjGljuGyuhwDox3hvjgNEFe2ruPRYovteF6CwdSq-iU2njYwVIscBKty8MrROxNz-nP0RYnEhIgAhqxb6AXJ2XGGXU0aAvbqRXXGcPNSRhA3I6q1547bJuxYFbNZ2NFg9iErztQnJaCgYKAW8SARASFQHUCsbCwxPiOUQq4k126M0x1ZgBPg0163
</code>```

I get proper user info. The problem is I want to use it in the back end

Title: C# web api using google access token

Body:
I am trying to make external login. I registered with google and I am getting back access token from this link:

https://accounts.google.com/o/oauth2/v2/auth?scope=openid%20email&response_type=token&redirect_uri=https://localhost:3007/google-singin&client_id=655720894976-2rkkoov9efteqna8hq3vbc632brur2jf.apps.googleusercontent.com

it returns :

https://localhost:3007/google-singin#access_token=ya29.a0AX9GBdVlBg-Vym3C1oSpjGljuGyuhwDox3hvjgNEFe2ruPRYovteF6CwdSq-iU2njYwVIscBKty8MrROxNz-nP0RYnEhIgAhqxb6AXJ2XGGXU0aAvbqRXXGcPNSRhA3I6q1547bJuxYFbNZ2NFg9iErztQnJaCgYKAW8SARASFQHUCsbCwxPiOUQq4k126M0x1ZgBPg0163&token_type=Bearer&expires_in=3599&scope=email%20https://www.googleapis.com/auth/userinfo.email%20openid&authuser=0&prompt=consent

from this I can get access token witch is :

ya29.a0AX9GBdVlBg-Vym3C1oSpjGljuGyuhwDox3hvjgNEFe2ruPRYovteF6CwdSq-iU2njYwVIscBKty8MrROxNz-nP0RYnEhIgAhqxb6AXJ2XGGXU0aAvbqRXXGcPNSRhA3I6q1547bJuxYFbNZ2NFg9iErztQnJaCgYKAW8SARASFQHUCsbCwxPiOUQq4k126M0x1ZgBPg0163

How do I call google api with this token, to get user info? I mean in back end.

If I call this links:

https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=ya29.a0AX9GBdVlBg-Vym3C1oSpjGljuGyuhwDox3hvjgNEFe2ruPRYovteF6CwdSq-iU2njYwVIscBKty8MrROxNz-nP0RYnEhIgAhqxb6AXJ2XGGXU0aAvbqRXXGcPNSRhA3I6q1547bJuxYFbNZ2NFg9iErztQnJaCgYKAW8SARASFQHUCsbCwxPiOUQq4k126M0x1ZgBPg0163

I get proper user info. The problem is I want to use it in the back end


问:
Is there any possible solution to detect when Android OS kill background Service?
I'm working on android based application and facing a problem on VIVO Y15s [Funtouch OS 12 Global] that this device kill background service/task automatically after 5 to 6 minutes. and there is no exception or any error appear in the android studio logs.
So please please guide me if u have any solution regarding this problem.

I tried many possible solution and also override the onDestroy() and onTaskRemoved() methods but not succeed. In these method i put service restart mechanism.

```<code>val restartServiceIntent = Intent(applicationContext, AppService::class.java).also {
    it.setPackage(packageName)
    it.action = Actions.START.name
}
val restartServicePendingIntent: PendingIntent =
    PendingIntent.getService(this, 1, restartServiceIntent,
        PendingIntent.FLAG_ONE_SHOT or PendingIntent.FLAG_IMMUTABLE);
applicationContext.getSystemService(Context.ALARM_SERVICE)
val alarmService: AlarmManager =
    applicationContext.getSystemService(Context.ALARM_SERVICE) as AlarmManager
alarmService.set(
    AlarmManager.ELAPSED_REALTIME,
    SystemClock.elapsedRealtime() + 1000,
    restartServicePendingIntent
)
</code>```

Body:
I'm working on android based application and facing a problem on VIVO Y15s [Funtouch OS 12 Global] that this device kill background service/task automatically after 5 to 6 minutes. and there is no exception or any error appear in the android studio logs.
So please please guide me if u have any solution regarding this problem.

I tried many possible solution and also override the onDestroy() and onTaskRemoved() methods but not succeed. In these method i put service restart mechanism.

val restartServiceIntent = Intent(applicationContext, AppService::class.java).also {
    it.setPackage(packageName)
    it.action = Actions.START.name
}
val restartServicePendingIntent: PendingIntent =
    PendingIntent.getService(this, 1, restartServiceIntent,
        PendingIntent.FLAG_ONE_SHOT or PendingIntent.FLAG_IMMUTABLE);
applicationContext.getSystemService(Context.ALARM_SERVICE)
val alarmService: AlarmManager =
    applicationContext.getSystemService(Context.ALARM_SERVICE) as AlarmManager
alarmService.set(
    AlarmManager.ELAPSED_REALTIME,
    SystemClock.elapsedRealtime() + 1000,
    restartServicePendingIntent
)


问:
HttpState is deprecated, what is alternative in apache http client?
```<code>// Creating HTTP state for credential
                    Credentials creds = new UsernamePasswordCredentials(sRemoteUserName, sRemotePassword);
                    HttpState httpState = new HttpState();
                    httpState.setCredentials(new AuthScope(AuthScope.ANY), creds);
</code>```

What is alternative in latest apache http client?

Body:
// Creating HTTP state for credential
                    Credentials creds = new UsernamePasswordCredentials(sRemoteUserName, sRemotePassword);
                    HttpState httpState = new HttpState();
                    httpState.setCredentials(new AuthScope(AuthScope.ANY), creds);

What is alternative in latest apache http client?


问:
.Net core vs framework - adding wcf service
I'm working on a .net framework project I have added to it a WCF service.
The service is of a soap type.

Now I'm trying to add the same WCF service to a .net core 6 project.

Unfortunately, at the .net core project, the web service generates only part of the client functions of the service.

Unfortunately, I'm not able to post here the web service for security reasons.

I'm not able to figure out the difference between the 2 projects that cause the web service to generate only part of the client functions.

When I'm trying to test the WCF service through soap UI it works perfectly.

NOTE: the web service contains resources that are NOT accessible from my IP.

Does anyone have any idea on how can i fix it ?


问:
Glide Image loading disk conflicts
I have a list of images URLs I'm preloading the images using the below code before adding the adapter to recyclerView.

```<code>  for(int i=0;i<mediaList.size();i++){
        ExecutorService serviceImage = Executors.newSingleThreadExecutor();

              serviceImage.execute(() -> {
                  Glide.with(getApplicationContext())
                          .load(mediaList.get(i).getURL())
                          .diskCacheStrategy(DiskCacheStrategy.ALL)
                          .preload();
                  Log.d("TAGServices", "IMG-CACHE: "+ i);

              });
    }
</code>```

MY ON BINDING METHOD :

```<code> Glide.with(itemView.getContext())
      .load(mediaObjectItem.getURL())
      .diskCacheStrategy(DiskCacheStrategy.ALL)
      .listener(new RequestListener<Drawable>() {
                    @Override
                    public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
                        return false;
                    }

                    @Override
                    public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
                        Activity activity= (Activity) itemView.getContext();
                        activity.runOnUiThread(() -> {
                            lottieAnimationView.setVisibility(View.GONE);
                        });

                        return false;
                    }
                }).into(thumbnail);
</code>```

MY PROBLEM: All the URLs are CDN(content delivery network) URL. If I put the URLs in the browser it loads very fast max 60ms and avg 40ms, but in Recyclerview takes too much time, which means 5sec to 15sec.

But when I'm loading without .preload() it is taking less time within 5-8sec, but I need to cache the images before displaying.

Title: Glide Image loading disk conflicts

Body:
I have a list of images URLs I'm preloading the images using the below code before adding the adapter to recyclerView.

  for(int i=0;i<mediaList.size();i++){
        ExecutorService serviceImage = Executors.newSingleThreadExecutor();

              serviceImage.execute(() -> {
                  Glide.with(getApplicationContext())
                          .load(mediaList.get(i).getURL())
                          .diskCacheStrategy(DiskCacheStrategy.ALL)
                          .preload();
                  Log.d("TAGServices", "IMG-CACHE: "+ i);

              });
    }

MY ON BINDING METHOD :

 Glide.with(itemView.getContext())
      .load(mediaObjectItem.getURL())
      .diskCacheStrategy(DiskCacheStrategy.ALL)
      .listener(new RequestListener<Drawable>() {
                    @Override
                    public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
                        return false;
                    }

                    @Override
                    public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
                        Activity activity= (Activity) itemView.getContext();
                        activity.runOnUiThread(() -> {
                            lottieAnimationView.setVisibility(View.GONE);
                        });

                        return false;
                    }
                }).into(thumbnail);

MY PROBLEM: All the URLs are CDN(content delivery network) URL. If I put the URLs in the browser it loads very fast max 60ms and avg 40ms, but in Recyclerview takes too much time, which means 5sec to 15sec.

But when I'm loading without .preload() it is taking less time within 5-8sec, but I need to cache the images before displaying.


问:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory
Unable to start the Spring Boot Application in my Eclipse.

Its keep on showing console below.

Exception encountered during context initialization - cancelling
refresh attempt:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'dataSourceScriptDatabaseInitializer'
defined in class path resource
[org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]:
Unsatisfied dependency expressed through method
'dataSourceScriptDatabaseInitializer' parameter 0: Error creating bean
with name 'dataSource' defined in class path resource
[org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]:
Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory
method 'dataSource' threw exception with message: Failed to determine
a suitable driver class

System should start the spring boot application successfully


问:
Django Admin - Fill inline field after autocomplete selection
I have a model with an inline model (see screenshot). The user selects a product via autocomplete and I would then like to fill in the purchasing price, that comes from the product.

Here are my models. The PoItem-Model:

```<code>class PoItem(models.Model):
    po = models.ForeignKey(PurchaseOrder, on_delete=models.CASCADE)
    product = models.ForeignKey(Product, on_delete=models.SET_NULL, null=True, blank=True)
    quantity = models.IntegerField()
    purchasing_price = models.DecimalField(decimal_places=2, max_digits=5, default=0)
</code>```

Here the product model. These ones here are listed in the autocomplete. And the purchasing_price from the product should be listed in purchasing_price field of the inline form, once a product has been selected via autocomplete

```<code>class Product(models.Model):
    sku = models.CharField(primary_key=True, max_length=40, unique=True)
    name = models.CharField(max_length=250)
    purchasing_price = models.FloatField(null=True, blank=True)
</code>```

And here is my admin view. I have not listed the PurchaseOrder model as it's of no relevance:

```<code>@admin.register(PurchaseOrder)
class PurchaseOrderAdmin(admin.ModelAdmin):

    class PoItemInline(admin.TabularInline):
        model = PoItem
        fields = ["product", "quantity", "purchasing_price"]
        extra = 1
        autocomplete_fields = ["product"]
        form = PoItemInlineForm

    inlines = [PoItemInline]
</code>```

I would need some kind of even that gets triggered once a product has been selected.

Body:
I have a model with an inline model (see screenshot). The user selects a product via autocomplete and I would then like to fill in the purchasing price, that comes from the product.

Here are my models. The PoItem-Model:

class PoItem(models.Model):
    po = models.ForeignKey(PurchaseOrder, on_delete=models.CASCADE)
    product = models.ForeignKey(Product, on_delete=models.SET_NULL, null=True, blank=True)
    quantity = models.IntegerField()
    purchasing_price = models.DecimalField(decimal_places=2, max_digits=5, default=0)

Here the product model. These ones here are listed in the autocomplete. And the purchasing_price from the product should be listed in purchasing_price field of the inline form, once a product has been selected via autocomplete

class Product(models.Model):
    sku = models.CharField(primary_key=True, max_length=40, unique=True)
    name = models.CharField(max_length=250)
    purchasing_price = models.FloatField(null=True, blank=True)

And here is my admin view. I have not listed the PurchaseOrder model as it's of no relevance:

@admin.register(PurchaseOrder)
class PurchaseOrderAdmin(admin.ModelAdmin):

    class PoItemInline(admin.TabularInline):
        model = PoItem
        fields = ["product", "quantity", "purchasing_price"]
        extra = 1
        autocomplete_fields = ["product"]
        form = PoItemInlineForm

    inlines = [PoItemInline]

I would need some kind of even that gets triggered once a product has been selected.


问:
Robot framework with maven project says import file not found
I have the following pom.xml

```<code>  <dependencies>
    <dependency>
     <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.robotframework</groupId>
      <artifactId>robotframework</artifactId>
       <version>2.8.4</version>
   </dependency>
  <dependency>
    <groupId>com.github.markusbernhardt</groupId>
    <artifactId>robotframework-selenium2library-java</artifactId>
    <version>1.4.0.1</version>
    <scope>test</scope>
  </dependency>

 </dependencies>
  <build>
    <plugins>
     <plugin>
    <groupId>org.robotframework</groupId>
    <artifactId>robotframework-maven-plugin</artifactId>
    <version>1.4.6</version>
    <executions>
      <execution>
        <goals>
          <goal>run</goal>
        </goals>
        </execution>
       </executions>
    </plugin>
  </plugins>
  </build>
 </project>
</code>```

and following test_case.robot file

```<code>    *** Settings ***
    Documentation    A test case file
    Library          Selenium2Library

    *** Test Cases ***
    Checkout google.com
    Open Browser    http://www.google.com    chrome
    Close Browser
</code>```

It gives me the error Import file not found at Library          Selenium2Library line.
What could be a solution? I can see the jars in the maven libraries of project.

Body:
I have the following pom.xml

  <dependencies>
    <dependency>
     <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.robotframework</groupId>
      <artifactId>robotframework</artifactId>
       <version>2.8.4</version>
   </dependency>
  <dependency>
    <groupId>com.github.markusbernhardt</groupId>
    <artifactId>robotframework-selenium2library-java</artifactId>
    <version>1.4.0.1</version>
    <scope>test</scope>
  </dependency>

 </dependencies>
  <build>
    <plugins>
     <plugin>
    <groupId>org.robotframework</groupId>
    <artifactId>robotframework-maven-plugin</artifactId>
    <version>1.4.6</version>
    <executions>
      <execution>
        <goals>
          <goal>run</goal>
        </goals>
        </execution>
       </executions>
    </plugin>
  </plugins>
  </build>
 </project>

and following test_case.robot file

    *** Settings ***
    Documentation    A test case file
    Library          Selenium2Library

    *** Test Cases ***
    Checkout google.com
    Open Browser    http://www.google.com    chrome
    Close Browser

It gives me the error Import file not found at Library          Selenium2Library line.
What could be a solution? I can see the jars in the maven libraries of project.


问:
Boolean MySQL field always return "true" in C#
I have a very puzzling situation that I still cannot resolve. Hope someone knows what am I doing wrong.

Situation:

I have a MySQL table. It has some fields for flags (true/false) values. These fields are defined as BIT in MySQL (at least, PHPMyAdmin reports so). A browse to the table shows that the data has different values in these fields (0s and 1s).

I'm connecting with a C# WPF desktop application, using MySQL library.

I'm using a MySQLDataReader (let's call it "MyReader").

The program works, and it retrieves the data from the database. Everything seems ok. But then, when I reviewed the data with more detail and applied filters, I found that all the boolean fields appear as "true".

If I try this:

bool MyValue = (bool)MyReader["Field"];

it crashes (Invalid cast exception).
However:

bool MyValue = Convert.ToBoolean(MyReader["Field"]);

works. But the returned value IS ALWAYS "TRUE", no matter which value is in the database table.

I found that BIT datatypes from MySQL traslate as SByte to C#, so I tried:

SByte MyValue = Convert.ToSByte(MyReader["Field"]);

Again, it works. And again, the value is always "1".
If I try to cast directly:

SByte MyValue = (SByte)MyReader["Field"];

I also get an Invalid Cast exception.

Then I tried:

int MyValue = Convert.ToInt32(MyReader["Field"]);

And again, it works, but the returned value is always 1.

So, I ran out of ideas. I cannot find a way to get the actual value of those fields, C# always returns '1' (or 'true', if I try to convert to Boolean) regardless of the field value. The table has other fields (numbers, strings, dates and so on), and all of them are correctly displayed, only bool (bit) values are incorrect.

I'm thinking about changing the tables and defining those fields as "int" instead of bit. However, there are other applications that use the data and it would imply vast code corrections, so this is not really feasible.

Any ideas? Thanks in advance.


问:
I want to prevent the line from overflowing on React
I want it not to go beyond the line and stick to the vertical bar in responsive design. How do I do this? I am using Chakra UI

```<code>            <Line
          noMargin
          borderColor="inherit"
          borderTop="2px solid var(--color-pole)"
          {...lineProps}
          {..._lineProps}
          type="horizantal"
          className={classnames({ [imagePosition]: !!imagePosition })}
        />
</code>```

the display is as follows.

Body:
I want it not to go beyond the line and stick to the vertical bar in responsive design. How do I do this? I am using Chakra UI

            <Line
          noMargin
          borderColor="inherit"
          borderTop="2px solid var(--color-pole)"
          {...lineProps}
          {..._lineProps}
          type="horizantal"
          className={classnames({ [imagePosition]: !!imagePosition })}
        />

the display is as follows.


问:
How to update a folder if exist and if not exist create it during setup with winforms?
I am new to wimforms, I successfully create a set-up for my project. Also I added a folder to user's desktop in the file system. Folder is created after set-up, however I dont want it to be created if it already exist and it does that so I end up with two folders with same name after installation.  Is there any way to prevent that? I tryed all combinations of "always create" and "transitive" bool values. I ak working with c#. Thank you for your help.</p>


问:
List of UAC Virtualization Processes
I'm trying to get a list of processes that run with UAC virtualization.

Seems like there is no built-in way to do it, but I found this snippet of code, but it's not working right. Not really sure what it outputs, cause if I look at two notepad.exe processes, where one is running as Administrator and one is running as a normal user, they both show "False".

```<code>Get-Process | Add-Member -Name Elevated -MemberType ScriptProperty -Value {if ($this.Name -in @('Idle','System')) {$null} else {-not $this.Path -and -not $this.Handle} } -PassThru | Format-Table Name,Elevated | out-string -stream | Select-string "true"
</code>```

Title: List of UAC Virtualization Processes

Body:
I'm trying to get a list of processes that run with UAC virtualization.

Seems like there is no built-in way to do it, but I found this snippet of code, but it's not working right. Not really sure what it outputs, cause if I look at two notepad.exe processes, where one is running as Administrator and one is running as a normal user, they both show "False".

Get-Process | Add-Member -Name Elevated -MemberType ScriptProperty -Value {if ($this.Name -in @('Idle','System')) {$null} else {-not $this.Path -and -not $this.Handle} } -PassThru | Format-Table Name,Elevated | out-string -stream | Select-string "true"


问:
Change VS code intellisense priority
I want the specified item in the image below to be shown above all.

and my related settings:

```<code>"editor.snippetSuggestions": "top",
"emmet.showSuggestionsAsSnippets": false
</code>```

Title: Change VS code intellisense priority

Body:
I want the specified item in the image below to be shown above all.

and my related settings:

"editor.snippetSuggestions": "top",
"emmet.showSuggestionsAsSnippets": false


问:
iOS - Duplicate GET request are sent when switching to background
When switching my app to background / home screen and HTTP GET requests are firing, in some rare cases i can see that the server gets 2 identical request with the same oauth signature and throws an 401 error.

I Create an oauth1 GET request using alamofire 9.
Switched to iOS home screen.
Returned to the app.

Mostly the Requests are getting cancelled / errored when backgrounded and are sent to the retry interceptor to determine if they should be retried or not.

What happened instead?
In most cases it works as expected. but in some random cases, i get 401 unauthorized error from the server that the oauth nonce was already in use.
Looking at the server log it seems that there are 2 identical requests that are fired from the app. without reaching to the request interceptor or to the Adapt method for new nonce.
It looks like it's the underlaying urlsession that automatically retries GET requests (didn't see it happen for POST / PUT) when switching to background / connection to the server fails at the low level?

I've tried multiple URLSessionConfiguration settings without success.
I would like to know if there's a way to stop iOS from sending duplicate GET requests sometimes or if a 401
error can get to the retry interceptor. It goes directly to the failed completion block of the calling function.

Thanks!


问:
word2vec in R - encoding issues when loading model
After successfully training a model, which took about two days, with this code:

```<code>train_word2vec("/home/sveisa/may2022/test.txt", "/home/sveisa/may2022/test.bin", vectors=200, threads=4, window=12, cbow=TRUE, iter=5, force=TRUE, negative_samples=3)
</code>```

I am unable to load it. It loads up to 51% and then I get this error message:

```<code> in readChar(a, 1) : invalid UTF-8 input in readChar()
</code>```

The file is about 2 GB.

I created a small version of the file, and everything worked.

The data contains non-English languages (although most is in Eng), could that be the problem? I have not found a way to load the model in a way that ignores encoding issues.

Body:
After successfully training a model, which took about two days, with this code:

train_word2vec("/home/sveisa/may2022/test.txt", "/home/sveisa/may2022/test.bin", vectors=200, threads=4, window=12, cbow=TRUE, iter=5, force=TRUE, negative_samples=3)

I am unable to load it. It loads up to 51% and then I get this error message:

 in readChar(a, 1) : invalid UTF-8 input in readChar()

The file is about 2 GB.

I created a small version of the file, and everything worked.

The data contains non-English languages (although most is in Eng), could that be the problem? I have not found a way to load the model in a way that ignores encoding issues.