The code is giving Multiple Marker at this line - jakarta-mail

This line giving errors I am not able to find any clue kindly help me..??
I have added all the related jar files then also its giving error
please check code and help
Properties properties = System.getProperties(); properties.setProperty("mail.smtp.host", host);

Related

CakePhp 4.x basic Authentication

I am following the CakePHP 4.x tutorial to the letter (as far as I can see) until chapter "CMS Tutorial - Authentication".
Half way through "Now, on every request, the AuthenticationMiddleware will inspect the request session to look for an authenticated user. If we are loading the /users/login page, it will also inspect the posted form data (if any) to extract the credentials."
When I try to access articles or users I get an error:
( ! ) Fatal error: Interface
'Authentication\AuthenticationServiceProviderInterface' not found in
C:\wamp64\www\cake\src\Application.php on line 41
I have tried to figure out why this would be, but I cannot find it. I have tried looking up the same problem on the internet, no dice. Not even a mention that this could be security related (I found a mention about strict brower settings earlier but it was related to another problem).
I have uploaded my code on Github here: https://github.com/plafeber/cakephp-tutorial
I would greatly appreciate any feedback. I was under the assumption that if I create the full code set from the tutorial, given of course I run CakePHP 4.1.5 and follow the related Cake 4.x manual, that it would work. However, I already found out that I have to change the line about the use of DefaultPasswordHasher compared to what was in the code. So I can imagine the Tutorial page is not exactly as it should be.
This would be hte correct line about the use of the DefaultPasswordHasher in User.php;
//the use line
use Cake\Auth\DefaultPasswordHasher as AuthDefaultPasswordHasher;
//and the function
protected function _setPassword(string $password) : ?string
{
if (strlen($password) > 0) {
$hasher = new AuthDefaultPasswordHasher();
return $hasher->hash($password);
}
}
The solution to this was to navigate to the Cake install dir (containing the src and config folder and so on), then running the Composer call again. This apparently placed the filed in the right directories and then the error no longer appeared.

getting error : TypeError: fs.readFileSync is not a function

getting error : TypeError: fs.readFileSync is not a function when i tried to use get value from .env file, can anyone please help me why i am getting this error? here i have uploaded my code, can anyone please help me how to resolve this issue ? any help will be really appreciated.
const dotenv = require('dotenv').config();
const fs = require('fs');
const envConfig = dotenv.parse(fs.readFileSync('.env'))
for (const k in envConfig) {
process.env[k] = envConfig[k]
}
Firstly I want to remind that fs will not work in the browser. This is by design as to protect your filesystem from potential security threats.
Did you use create-react-app when you were creating ReactJs project?
If it is the case, the following solution will fix this issue.
In your .env file, you have to append REACT_APP_ to all env variables to make it work.
Don't forget to restart your server after changing it.
For example :
This works -
REACT_APP_MYVAR=yourSecret
This doesn't
MYVAR=yourSecret
You can read the reference link in here.
https://create-react-app.dev/docs/adding-custom-environment-variables/

How to get the file name of the failed switch branch in libgit2?

I can call the switch branch interface normally, but when the switch branch fails, I cannot get the specific file of the current branch failure. Viewing error info only shows "one or more conflict prevents checkout", if I want to get the detailed error file name, How to get detailed error information from the callback function or return value? (also include:Merge态Reset...)
// code
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
opts.checkout_strategy = GIT_CHECKOUT_SAFE;
git_branch_lookup(&lookup, repo, branchname, GIT_BRANCH_LOCAL);
git_revparse_single(&treeish, repo, branchbane);
if(git_checkout_tree(repo, treeish, &opts)<0)
{
/*
just return "1 conflict prevents checkout",
But I want to know which files is wrong
*/
const git_error* error = giterr_last();
}
You'll need to set a notify_cb in your git_checkout_options, and set your notify_flags to include GIT_CHECKOUT_NOTIFY_CONFLICT .
Your notify callback that you provide will be invoked with the files that are changed in your working directory and preventing the checkout from occurring.
I am not so familiar with libgit2 but it looks like you'll have to solve the conflict manually. The error that you get :
1 conflict prevents checkout
Tells you that there is a file with a conflict, but you'll have to iterate through your tree to find which one and to solve it.
The status example from libgit2.org would certainly be a good starting point for you.

Symfony 2.8: how to upload an image from URL soruce?

How are you? First, sorry about my english :(
I'm triying to upload a file from a URL source like https://www.somedomain/somefolder/someimage.jpg but I'm getting some troubles...
I get this error when I'm triying to set $myFile->setFile('url'):
Catchable Fatal Error: Argument 1 passed to
MyBundle\Entity\File::setFile() must be an instance of
Symfony\Component\HttpFoundation\File\UploadedFile, string given
I've also tried through $content = get_file_contents('url') and then $myFile->setFile($content), but this returns the same error.
On the other hand, it's not a problem if I upload the file with an inputfile box in a form. But I cannot do it by indicating only one URL source (for a CronJob, by the way).
I've read the documentation about Files on Symfony, but I can't get success :(
Can anyone help me with this issue, please?
Thanks a lot! Greetings from Barcelona!! :)
To get rid of this issue you can do this:
<?php
use Symfony\Component\HttpFoundation\File\UploadedFile;
$file = new UploadedFile('url', 'name of the file');
$myFile->setFile($file);
Take a look at UploadedFile
Be sure to provide the correct path to the path. Not sure it will work like this because you want to set the UploadedFile without uploading the file through an input file and without submitting the form. Have a try.

PHPExcel Load error - Cell coordinate must be a range of cells

Good Afternoon All,
I am working on an issue in PHPExcel. Using the following code:
try {
$inputFileType = PHPExcel_IOFactory::identify($fileLocation);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load($fileLocation);
} catch(Exception $e) {
die('ERROR LOADING FILE: "'.print_r(pathinfo($fileLocation),true).'": '.$e->getMessage());
} # end try catch
This responses with a this error message:
ERROR LOADING FILE: "Array ( [dirname] => upload [basename] => d10f8...188 [filename] => d10f8....188 ) ": Cell coordinate must be a range of cells.
Which makes no sense since I am not reading the file yet, only loading it. This code has been in place and working without issue for months (Probably 100+ uses), only one file is causing this error. The file is a Office2007 XLSX (Just like all the others), I have converted the file to multiple other formats (xls, xlt, xlsm) but none of copies will load either. I have found nothing of interest in the file that could explain this behavior.
I have not found anything in my logs and am at a loss to understand the error message of 'Cell coordinate must be a range of cells'. I have isolated the code and made sure that this error message is being generated during this try/catch and is not coming from somewhere else.
Any help would be greatly appreciated,
Paul
This error was caused by a print area being defined in one of sheets. I removed all print areas using these instructions (https://support.office.com/en-us/article/Change-or-clear-a-print-area-on-a-worksheet-deed3c1f-d2ca-4b78-b28d-9c17f0b5de34#bmclearprintarea) and then reran the upload and everything worked. Thanks to MarkBaker for his assistance.
Paul

Resources