The command to move file * .pas to file * .exe in fpc.exe - pascal

I have a fpc.exe executable file that is supposed to transfer the * .pas file to * .exe file but when i click on it to write command it shows help, i write command but it does not work. The command is as follows (I learned from this link :https://www.freepascal.org/docs-html/user/userse10.html)
  fpc [options] prog.pp
I wrote on the command box
fpc C: \ Hello.pas prog.pp
I put the Hello.pas file in drive C
What should I do in this case
Thank you so much I tried it another way, is to cmd and then type the command
fpc D: \ Hello
And this is my video
https://youtu.be/MsOfohAZjqg
I finally did it. Thank you.

I wrote on the command box
fpc C: \ Hello.pas prog.pp
There are several things wrong with this:
You should leave out the "prog.pp". The example in the link is using that as an example of the name of the source file to compile. Yours is Hello.Pas.
There should be no spaces in the file name of the source file.
Do you have write permission to the root directory of your C: drive? If not, you should move your source file(s) to a directory where you do.
So, you need something like this
fpc C:\mypascal\Hello.Pas
This will only work, btw, if fpc is on your OS Path. If it isn't, then either add add it to the Path, or include the full path to fpc.exe in your compile command.
Btw, when you said
I have a fpc.exe executable file that is supposed to transfer the * .pas file to * .exe file
actually that is not quite right. You don't have the executable file, the executable file is what you are trying to create from the Hello.Pas file by compiling it using fpc.
when I click on the fpc file, it immediately prompts me to use and tells me to hit enter
I assume you mean that this happens when you click fpc.exe in an Explorer window. I'm afraid there is no easy way to avoid this - the same thing happens if you just type
C:>fpc
in a command window. It is just listing the various compiler options, etc, that you could specify. The way you avoid that in a command window is to specify the name of the source file you want to compile. Unfortunately, there isn't a simple way of specifying the source file when you click fpc. For Explorer, it is easiest to write a batch file which prompts you for the source file name and then invokes fpc to compile it.

You should omit the prog.pp in your command line and just enter
fpc C:\Hello.pas (if the file really is located in the root of C:).
If FPC does not find errors, you should have a file C:\Hello.exe.

Related

solving Can't open perl script "all_gen_cmf_image": No such file or directory error

i work on image copy move forgery detection field. i downloaded GRIP dataset form https://www.grip.unina.it/, there is some modification needed for the images and can be done with perl functions downloaded with the dataset. it is the first time for me to work with .pl functions. i downloaded the program form this website https://platform.activestate.com/create-project?language=perl, and followed the setup steps.
now i have two problems: the first one, when i tried to run the function this error appeared "Can't open perl script "all_gen_cmf_image": No such file or directory", i have added the scripts directory using cd.
the second problem i don't know what he mean with this line "update the "vole" variable in the configuration file db_configs.pl, it should point to your vole binary of CMFD framework." in reedme file.
can any one helping me solving this problem?
Perl doesn't automatically try the .pl extension when you pass it the name of a script on the command line.[1] So, it fails because there isn't a script named "all_gen_cmf_image"; it's actually named "all_gen_cmf_image.pl". To run all_gen_cmf_image.pl you have to include the .pl part of the extension. Assuming you are in the scripts folder, the following should work:
perl all_gen_cmf_image.pl
or in the parent directory:
perl scripts/all_gen_cmf_image.pl
However, when Perl runs a use Module; statement, perl automatically adds .pm on the end and replaces any :: in the module name with a slash.

Where are my files saved in vim for windows

I have been using the gvim command :w to save and it works fine saving it to the desktop. However with the vim program, when I use the command :w, I cannot find where the saved file is located.
It should save to whatever directory you started writing it in (you can see that in the command line). You can also use your computer's file search to locate it and then inspect for the file path.
As said by others: by default it saves in the directory where you started it. But if you aren't aware in which directory you started, then a way to find out is to use the :pwdcom in vim. This will output the current directory. That's where vim will store the file.
C:\Users\"windows user"\AppData\Local\Packages\KaliLinux.54290C8133FEE_ey8k8hqnwqnmg\LocalState\rootfs\home\"WSL user"
Adding another answer to get the filename as well.
As mentioned by Cary and Jeen, vim saves your file to the directory from where it is started. You can get the directory where it is saved using :pwd.
If you are interested to get name of the file, it can be done by ctrl + g when your laststatus=1, which is the default value.
I usually set laststatus=2 which always show the filename.

cocoa -- determine directory from which a tool was launched?

I have a command-line tool written in Cocoa. Let's call it processFile. So if I am in the terminal and I type in the command ./processFile foo, it looks for a file named foo.html in the same directory as the executable of processFile. If it finds one, it reads it and does some stuff to create fooProcessed.html.
Now I want to modify my tool so that it looks for foo.html in the directory from which it was launched. So if I am in the terminal with current directory ~/documents/html, and processFile executable is in usr/bin, and I type in
processFile foo
it will find and process the file ~/documents/foo.html.
The problem is that I don't know how to get the directory from which the tool was invoked. How can I do that?
That's the current working directory. First of all, any attempt to access the file just using its name and no path will automatically use the working directory. So, if you simply take "foo", append ".html", and attempt to open the file, that will work. If the user specified a relative path, like "subdir/foo", that would also work. It would resolve the relative path starting from the current working directory.
You can also query the working directory using the getcwd() routine.

Executing binary files with a shebang

I created a simple program that takes the path of a directory as an input, creates an archive of that directory (converting it into a single file), adds a shebang to that file (so that the contents of the file can be easily extracted), and writes the file to the base directory of the specified path.
The problem is that the file does not extract itself when I double click on it. Instead the operating system (I'm using Ubuntu 11.10) tries to open it with gedit. This obviously shows the shebang, random gibberish, and the contents of the archived files.
I made the file executable, first by using chmod +x; and when it still didn't work I tried chmod 777. However it still refuses to execute the file with the shebang when I double click on it. Perhaps this is because it's not a pure text file.
Interestingly when I try to execute the file directly from command line it reads the shebang and extracts the contents of the archive properly. So there's nothing wrong with my file format. I don't know much about what operating systems do when you double click on a file but I would sure like to understand.
It surely makes no sense to add a shebang to a file if you still need to manually execute it from the command line. One advantage could be that you don't need to specify the program to open it with but I believe that's hardly an advantage. Any help will be greatly appreciated.
Update 1:
The program that creates the archive is called opm. It can be installed via the node package manager using the following command:
npm install opm
After that you simply use opm to pack and unpack directories for you. For example if I have a directory called test in my home directory then I can open a terminal and execute the following command to pack it:
opm test
This will create an archive of the directory called test.pack in the home directory. The .pack file has the shebang #!/usr/bin/opm. Opening a file with the extension .pack with opm tells it that it's an archive and opm unpacks it in the same directory.
Note: Change the name of the test.pack file if you do not want it to overwrite your existing test directory.
I added the shebang to the .pack file so that it would extract itself when I opened it. However that doesn't seem to work. Nevertheless if I run one of the following command then it works:
./test.pack
You may check my source code and make any modifications to the program as you may wish to.
Update 2:
Alright I created the following .desktop file for opm and stored it in the $HOME/.local/share/applications/ directory:
[Desktop Entry]
Type=Application
Version=1.0
Encoding=UTF-8
Name=OPM
GenericName=Object Packer and Minifier
NoDisplay=true
Comment=JavaScript Package Manager
TryExec=opm
Exec=opm %f
Terminal=false
MimeType=application/opm
Now I was able to associate .pack files with opm by right clicking on a .pack file, going to the Properties window, the Open With tab, and setting opm.desktop as the default application. Now I am able to unpack a .pack file by simply opening it.
However I would like to know how to associate .pack files with the mime type application/opm. Currently the .pack files are associated with application/x-java-pack200. How do I do so? Is it better if I use a different extension (e.g. .opm)? By associating the packed archives with the mime type application/opm will the OS open them with opm by default without having to explicitly set a default application from Properties > Open With?
If there's already a MIME-type associated with .pack then you'll want to use a different extension (.opm) to associate with your MIME-type (application/opm). The way you automatically associate a program that opens files of a specific MIME-type is with xdg-mime .
Alternatively,
Edit ~/.local/share/applications/mimeapps.list and put your MIME/application combo under [Default Applications] like so:
[Default Applications]
application/opm=opm.desktop;
Place your opm.desktop file in ~/.local/share/applications/ folder. (You've already done this)

Netbeans and PhpDocumentor

I have downloaded Netbeans 7.0 beta as I wanted to give the PhpDoc functionality a bash, but can't get it to work.
I seem to be falling over on the configuration options for PhpDoc in netbeans. It is asking for the script location,
but whatever I enter I get the error;
** ERROR *****************************************************************
* Sorry, can't find the php.exe file.
* You must edit this file to point to your php.exe (CLI version!)
* [Currently set to C:\usr\local\php\cli\php.exe]
*
* NOTE: In PHP 4.2.x the PHP-CLI used to be named php-cli.exe.
* PHP 4.3.x renamed it php.exe but stores it in a subdir
* called /cli/php.exe
* E.g. for PHP 4.2 C:\phpdev\php-4.2-Win32\php-cli.exe
* for PHP 4.3 C:\phpdev\php-4.3-Win32\cli\php.exe
**************************************************************************
Press any key to continue . . .
The set-up is Netbeans and xampp running on a windows machine.
Any and all help greatly appreciated.
That error indicates that the php.exe executable file is not in your Windows "PATH", and as such, when Windows tries to run the phpdoc script, it doesn't know how. Fortunately, the phpdoc script itself checks for this condition and explains it to you, in the error text you posted. Otherwise, the Windows error would have been much more generic and probably unhelpful.
You need to determine where your php.exe file is located. Then, edit the phpdoc.bat script file itself to hardcode the absolute path. Look for the line near the beginning that SETs the phpCli value. That is where you should place the absolute path to your php.exe file.
As an aside, I would suggest that your "PhpDoc script" setting in NetBeans should explicitly call the phpdoc.bat script rather than just "phpdoc", e.g. D:\xampp\php\phpdoc.bat, since both files actually exist. I know that Windows will typically look for "foo.bat" if you tell it to execute "foo" when foo doesn't exist and foo.bat does exist, but since phpdoc and phpdoc.bat both exist, ... I think that Windows trying to run phpdoc directly rather than phpdoc.bat will give you trouble.
Further, I see that you have the phpdoc.bat file itself listed as the first "argument" to the phpdoc script. That will probably cause you some grief once you get past the "can't find php.exe" error. You should remove that... the only arguments you should give after naming the script itself are the valid arguments that phpDocumentor expects, particularly the ones it requires -- -o for output template, -t for where to write the doc files, -d or -f to tell it where the PHP code is that you want documented.
for my case, in the version 2:
i changed the last line in phpdoc.bat:
"%PHPBIN%" "%PHP_PERAR_BIN_DIR%\phpdoc.php" %*
to
"%PHPBIN%" "phpdoc.php" %*
%PHP_PERAR_BIN_DIR% in this case is empty & the backslash makes an error finding the phpdoc.php file
I finally figured out an easy way to use phpdoc in Netbeans Windows!
Pear? Drop it. There's way too many problems.
Download it directly - http://sourceforge.net/projects/phpdocu/files/
Download the tar file, not the zip. The zip is bugged and will output 2 letter extensions instead of 3 (ie, .cs instead of .css) (as of 1.4.3)
Unzip it anywhere you want
Open up the phpdoc.bat file, and make 2 changes
a) Change the phpcli path
b) Add in code to navigate to the directory.
So for example, I put my phpdocumentor folder in d:\programs\xampp\php\phpdoc. Modifying the phpdoc.bat file:
SET phpCli=d:\programs\xampp\php\php.exe
d:
cd d:\programs\xampp\php\phpdoc
Then in Netbeans, you put this for the phpdoc script:
D:\programs\xampp\php\phpdoc\phpdoc.bat -o HTML:frames:earthli
Note that when you set the target (right click on project -> properties -> phpdoc), you will need to manually change the backslashes to forward slashes.
Correct - D:/programs/xampp/htdocs/project/phpdoc
Incorrect - D:\programs\xampp\htdocs\project\phpdoc (this will be generated when you use the browse button)
Good luck!
PS. Note that you can also run the phpdoc batch file directly from dos. You don't need to do it through netbeans.
d:\programs\xampp\php\phpdoc\phpdoc.bat -d D:\programs\xampp\htdocs\project -t D:\programs\xampp\htdocs\project\phpdoc -o HTML:frames:phpedit

Resources