error: the path "nginx-deployment.yaml" does not exist when I use kubectl apply -f nginx-deployment.yaml - kubectl

I use kubectl apply -f nginx-deployment.yaml enter image description here

Try giving the full path like C:\YAML\nginx-service.yaml

If the yaml file will be in .txt format then convert it into filename.yaml("in filename, name it as you like").Copy the content of the yaml text document("which creates the error") and paste the content in notepad++ and save the file as filename.yaml.
Open the cmd, then command
"docker login"
after that, change the directory to yaml file located directory
"cd directory path"
here directory path is(C:\Users\ELCOT\job-portal\job portal\filename.yaml).Don't consider this path,it's an example.Type your system directory path .
After changing the directory,command
"kubectl create -f Filenae.yaml"
it will load for few minutes, then it shows
"Filename.apps/flask-node-deployment created" .
The above mentioned instructions will works on windows platform ,not in MAC.

Related

How can I check if either or file exists in IF Exist?

How can I check if either or file exists in a If Exist statement?
Such as
If exist "C:/Windows/" OR "C:/Windows2" (
Do something
) else (
Something else
)
How would I do this? I just want either or to exist and to do something.
Simple example 1:
#echo off
if not exist "%SystemRoot%\" if not exist "C:\Windows2" goto MissingFolderFile
echo Found either the directory %SystemRoot% or the file/folder C:\Windows2.
rem Insert here more commands to run on either the folder C:\Windows
rem or the file/folder (=any file system entry) C:\Windows2 existing.
goto EndDemo
:MissingFolderFile
echo There is neither the directory %SystemRoot% nor the file/folder C:\Windows2.
rem Insert here more commands to run on neither folder C:\Windows
rem nor file/folder C:\Windows2 existing.
:EndDemo
pause
The Windows command processor is designed for processing one command line after the other which is the meaning of the word batch. The command GOTO is the preferred command to use in a batch file to continue batch processing not on next command line, but another one depending on an IF condition, i.e. change processing from one stack (other word for batch) of command lines to another group of command lines.
Simple example 2:
#echo off
if exist "%SystemRoot%\" goto FolderExists
if exist "C:\Windows2" goto FS_EntryExists
echo There is neither the directory %SystemRoot%\ nor C:\Windows2.
rem Insert here more commands to run on neither folder C:\Windows
rem nor file/folder/reparse point C:\Windows2 existing.
goto EndDemo
:FS_EntryExists
echo The file system entry (file or folder) C:\Windows2 exists.
rem Insert here more commands to run on C:\Windows2 existing.
goto EndDemo
:FolderExists
echo The folder %SystemRoot% exists.
rem Insert here more commands to run on folder C:\Windows existing.
:EndDemo
pause
For understanding the used commands and how they work, open a command prompt window, execute there the following commands, and read entirely all help pages displayed for each command very carefully.
echo /?
goto /?
if /?
rem /?
NOTE:
The directory separator on Windows is \ and not / as on Linux or Mac. The Windows file management automatically replaces usually all / by \ before passing a file/folder argument string without or with a wildcard pattern to the file system as explained by Microsoft in the documentation about Naming Files, Paths, and Namespaces. But the usage of / instead of \ in file/folder argument strings can result nevertheless in unexpected behavior.
Example for unexpected behavior because of using / on running following command line directly in a command prompt window:
for %I in ("%SystemDrive%/Windows/*.exe") do #if exist "%I" (echo Existing file: "%I") else echo File not found: "%I"
This command line outputs a list of executable file names found by FOR in the Windows directory which do not exist for command IF just because of usage of / resulting in getting assigned to the loop variable the found file names without path. So this command line works only if the current directory on system drive is by chance the Windows directory.
The same command line with usage of \ as directory separator:
for %I in ("%SystemDrive%\Windows\*.exe") do #if exist "%I" (echo Existing file: "%I") else echo File not found: "%I"
This command line outputs each file name of the executables in Windows directory as existing file with full path.
Another example:
There is in root directory of current drive a directory Downloads and the current directory on this drive is Temp, for example D:\Downloads is the wanted current directory and D:\Temp is the current directory.
The used command is:
cd /Downloads
The result is the error message:
The system cannot find the path specified.
The command with correct directory separator usage:
cd \Downloads
This command works on D:\Temp being the current directory and D:\Downloads existing.
CD interprets on incorrect /Downloads the string /D at beginning of the directory path as option /D to change also the drive and searches for that reason for ownloads in current directory instead of Downloads in root directory of current drive. This wrong interpretation by CD is avoided by using the correct directory argument string \Downloads.
SUMMARY: \ is the directory separator and / is for command options.

python is not recognized as an internal or external command while running batch file

I am set environmental variable for python and I am able run python if I not take user input in batch file. But If I take user input I am not able to run python scripts in batch file.
#echo off
set /p Path="Enter Folder path in which all the timestamp files are stored: "
echo %path%
:: this is to read ip address from report folder to ipaddress.txt
dir %Path% /b /a-d > ipaddress.txt
echo %cd%
python trial.py
Choose a variablename other than path.
path is a reservd name that contains a list of the directories to search for an executable - like python.exe

How can I set the file output location in ogr2ogr?

Whenever I use ogr2ogr to convert files the output is saved to the following directory:
C:\Users[UserName]\AppData\Local\VirtualStore
Is there anyway I can set this directory to something else?
You can set the output file location by adding it to the ogr2ogr command arguments; for example:
ogr2ogr -f geoJSON -s_srs EPSG:27700 -t_srs EPSG:4326 c://somedirectory/outputfilename inputfilename

WAMP: failed to open stream: No such file or directory

I'm trying to upload a file using PHP. My HTML page with the form is stored at
C:\wamp\www\myproject\upload.html
PHP page is
C:\wamp\www\myproject\upload.php,
and the file I'm trying to upload is
C:\wamp\www\myproject\openoffice.txt.
When I try to upload the file, I get the following error:
Warning: move_uploaded_file(/uploads/openoffice.txt) [function.move-uploaded-file]: failed to open stream: No such file or
directory in C:\wamp\www\myproject\upload.php on line 40
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\wamp\tmp\phpF66A.tmp' to '/uploads/openoffice.txt'
in C:\wamp\www\myproject\upload.php on line 40 Problem: could not move
file to destination directory
Here are lines 40-43 of upload.php:
if (!move_uploaded_file($_FILES['userfile']['tmp_name'], $upfile)) {
echo 'Problem: could not move file to destination directory';
exit;
}
The fact that it's looking in upload.php instead of the folder that it's in makes me wonder whether it's a server error or an issue with my PHP.
I Googled and got this advice but I don't know if it's the right advice, or how to implement it. Help?
You should be supplying a file system path for $upFile, not a web based path. try using the full system path to you your uploads directory like C:\path\to\uploads\openoffice.txt. Unless of course youre actually trying to place the file in C:\uploads...
Try this code
$imgName = time();
$imgPath = BASEPATH."../uploads/".$imgName;
$image = base_url().'uploads/'.$imgName;
move_uploaded_file($_FILES["file"]["tmp_name"],$imgPath.".jpg");
$imageNew =$imgName;
Where uploads is the folder name just rename it with your folder name or make your folder as name it as uploads. Its working code.
Thanks
Give your '/uploads/' folder where you are going to upload your file. 777 rights. Give full permission to that directory.

How to create a .desktop file application launcher on Linux?

I've developed an application in Qt which uses a launch script, myapp.sh. I've created a .desktop file which launches this script, and set:
Command: $PWD/myapp.sh
Work path: $PWD
However, $PWD prints my home directory when I launch the .desktop file, resulting in attempting to launch ~/myapp.sh rather than ~/Development/build-directory/bin/myapp.sh (that directory being where the .desktop file resides). Why isn't it correctly setting the working directory to where the .desktop file is actually located and how can I get around this without having to specify an absolute path in the .desktop file?
$PWD holds the current working directory of the shell, which has nothing to do with the location of the .desktop file.. One way you can do this is with:
Exec=$(dirname %k)/myapp.sh
From the spec, %k is "The location of the desktop file as either a URI (if for example gotten from the vfolder system) or a local filename or empty if no location is known." So this is myapp.sh in the same directory.