I am trying to save rules and facts to a specific directory in my CLIPS programs.
(save "c:\tmp\rules.clp")
(save-facts "c:\tmp\facts1")
1- But it seems CLIPS disregards the path information. Since my windows username is not the owner of the CLIPS installation directory, the files are saved in a virtual store directory:
C:\Users\USERNAME\AppData\Local\VirtualStore\Program Files (x86)\CLIPS\Bin
2- If I run a system command and include the path, the same thing happens. The path is disregarded and the notepad cannot find the intended file.
(system "notepad c:\tmp\output.txt")
Is there a way to force these commands to save/read from a specific directory?
CLIPS doesn't have the ability to override directory/files permissions set by the operating system. The path to the save/save-facts command is not modified before being passed to the system libraries for opening files (either fopen or fopen_s). I'd suggest changing the directory permissions if the user account you're using doesn't have write privileges.
I think I have found the problem.
The paths should both be included in double quotes and the slashes should be converted into forward slashes.
Related
I have a zip folder that was created in UNIX and contains files with executables (which have the appropriate permissions so they can be executed in Unix).
I download this folder and unzip it in Windows and naturally when I zip it back and try to use it through Ubuntu, the unix permissions are set back to default.
Long shot, but is there a chance that there's a way to preserve the Unix permissions or re-set them from Windows?
Thanks a lot!
I am learning my way through shell scripts and just created one with vim.
Every file I create with .sh extension seems to be defaulting to read-only mode for every group in the ls -l command. I have tried creating files with several editors and in several locations and always get the same result.
So my question is, I know i can chmod the files so i can execute them, but is there something i can do to create them executable already and not change every single one of them?
As with any UNIX-like system, file creation is affected by the umask, which masks out file access bits when files are created.
You can change the default umask by editing the shell start-up configuration files, however I wouldn't recommend doing that.
If you want to change it so that all files you create have the executable bit set by default, then what about files that are not executable? I have always worked on shell scripts with the edit, chmod, run cycle and I don't feel it's a big problem.
I just shifted from a windows machine to a apple machine at work. I have no experience with apple and this is the first time I am using OSX.
I have a matlab script that I have to run on this machine but I cannot seem to get the path to my files.
My files are on a network drive. In windows its as simple as U:\Matlab Now I can access my files in the explorer but cannot seem to set them in Matlab using cd
To get the path of my files I right clicked on the folder and copied the where It provided me with this:
Volumes/home9/MATLAB/
Now to set these paths in Matlab I did this:
cd('Volumes/home9/MATLAB/')
But am provided with the error:
Cannot CD to Volumes/home9/MATLAB/ (Name is nonexistent or not a directory).
As you can tell I have no idea what I am doing. Some guidance would be appreciated.
Thank you
I think you meant to use which, not where. where doesn't exist in MATLAB! Now, your problem is probably due to the fact that you need to prepend your path with /. Therefore, your path should be: /Volumes/home9/MATLAB/. If you don't include the /, it assumes that the directory is local or where MATLAB has currently defined the working directory to be. Judging from the context, you want the absolute path of the directory, and that's why you need the / character as there is a Volumes directory in your root directory.
Try that and see if that works!
I am using Oracle 11g. When I open a new SQL file writing the command
ed filename.sql
A new file is created in my bin folder with the name as filename but, I want them to be in separate folders for my convenience. I am developing 3 application(well for my practice only). I want them to store in different folders for each project. I tried all of the following none of them worked please tell me how can I save the files into specific folders.
ed erp/logindetails.sql
ed 'erp/logindetails.sql'
ed "erp/logindetails.sql"
ed 'erp\logindetails.sql'
ed erp\logindetails.sql
These commands except where I used "" worked and opened the default text editor with the name afiedt.buf which I am getting when I enter only edit. No files are created with any of the above command.
You're giving EDIT a relative path to the file; since your current working directory seems to be the bin directory that the SQL*Plus directory is in (is this Windows, and are you running a shortcut that sets the working directory, maybe?) it will try to create a file like %ORACLE_HOME%\bin\erp\logindetails.sql, and you're unlikely to have created an erp directory there. Giving the full path to the directory will work:
edit c:\users\dibya\projects\erp\logindetails.sql
for example.
As noted in the documentation, EDIT will search for existing files, but that involves setting an environment variable - which you'd have to change as you move between the projects. You might find it easier to edit the files in the OS and just run them from SQL*Plus.
You might also be able to use separate shortcuts to launch SQL*Plus for each project, each setting the 'start in' directory to a project-specific location - then just edit logindetails.sql would be looking in the right place by default. Or, from a command prompt cd into the relevant project-specific directory and launch SQL*Plus from there, which is effectively what a shortcut would do.
As per the answer to this question, I am trying to backup a file by renaming it, before I replace it with a new, modified file with the old name.
As per the comments and the documentation here, I am using the following line of code:
File.rename(File.basename(modRaw), File.basename(modRaw)+'.bak')
However, when I do so, I get the following error at runtime:
The program then aborts. (leatherReplacer.rb is the name of my program, and line 88 is the above line of code)
How do I allow my program to rename the files it needs to to run successfully?
Windows has some special rules regarding permissions. The important one at work here, is that the OS prevents moving or renaming a file while the file is open.
Depending on the nature of your code (in size and scope) and the importance of the file you're trying to back up, it may be unfeasible or otherwise not worthwhile to refactor the code in such a way as to make backups possible.
You probably don't want to be calling File.basename in there, that strips off the directory:
Returns the last component of the filename given in *file_name*, which must be formed using forward slashes ("/") regardless of the separator used on the local file system.
So, if modRaw is /where/is/pancakes.house, then you're saying:
File.rename('pancakes.house', 'pancakes.house.bak')
But pancakes.house probably isn't in the script's current directory. Try without the File.basename calls:
File.rename(modRaw, modRaw + '.bak')
If you are owner of that file, use File.chmod to set desired permissions.
I don't know much about ruby, but could you run it under command line/bash with admin privileges, such as "run as administrator" or "su root"?
According to Objectmix and ruby-forum, you should set it to 755 or +x, then perhaps chown to yourself.
try using full file path e.t
File.rename('c:\pancakes.house', 'c:\pancakes.house.bak')
in win7 i encounter same problem