How to specify the `learn-filename` when using `learnf` tag in AIML? - aiml

A quick question how and where do you specify the filename of your destination *.aiml file when using learnf tag? The documentation states that
the generated category is written to an .aiml file that you may specify with the property learn-filename
but I'm not sure what is meant here by "property".
Should it be located in properties file? Or maybe a tag inside a learnf tag? Thanks

Yes, it's a bot property. here is a sample of my file:
It goes in the same file as the rest of your bot properties, name, age, location etc

Related

Changing default file upload input

I'd like to add the following attribute to the tag on the django file upload form as part of a progress bar implementation:
onchange="uploadFile()"
Do you know how I would be able to modify the default file upload input with this assignment?
You'll want to add the following to your form: field.widget.attrs["onchange"]="uploadFile()"
And include the javascript somewhere within the template being used.

how to access image property list and manipulate in MITK

I am developing a plugin for MITK, which is a tookit for medical imaging. I want to access the full path of image that is loaded in the data manager.
There are properties of images like name, opacity, path etc.
I searched MITK documentation but I could not find any proper information related to that.
Can you please help me?
If you want to see the 'path' in the UI, you can use the Properties plugin, available in the MITK Workbench and in your own app if you decided to include it.
If you want to access the content of the 'path' property in the code, then you need a mitk::DataNode in the current scope, because properties are usually related to node.
std::string path;
node->GetStringProperty("path", path);
Note that this won't give you the full path though. For some reason, MITK decided to remove the extension in this property, thus giving something like D://Data/brain instead of the D://Data/brain.nii.gz that I wanted.
AFAIK, there's currently no 100% safe way to get the real full path in MITK, but one could easily search on the file system using path + ".*" and hoping that it returns only one result :)
The property is not on the DataNode but in the BaseData in it. There is a 'path' property there. You can see its value when right-click the image and selecting 'details'

How to specify a relative in CFFile?

This is the path of my json file: https://devbox.mysite.com/search/KOGroups.json
But instead of using cfhttp, I like to use cfifle with read action. I don't know how to turn this path into a relative path for cffile. I've read about this ColdFusion Read File article and it looks like they use absolute path in their example. I've tried Ben Nadel's "Relative File Paths Work In A ColdFusion File System" article but the code that he provides for getting the parent directory is not working for me. All I need is to turn this path, https://devbox.mysite.com/search/, into cffile tag so I can read the .json file.
Use the function expandPath() for this.
expandPath('../path/to/file') returns the full server path to that file.
Looks like BKBK over in Adob coldfusion forum answered my question with the following:
<cfset koGroupsJSON = fileRead("https://devbox.mysite.com/search/KOGroups.json")>

Is it possible to edit tag of a file programatically using c++

I want to add/edit the tag of a file programatically using c++.But after seraching for almost 2 days I found nothing.Could you kindly help me whether we can add/edit the tag of a file using c++?
Thanks in advance.
Edit 1:
I want to edit the OS level tag on file/directory.Eg:Each file has its own properties like Title,Subject,Categories and one among this is tags.I want to edit/add the property "Tags".
Thanks tony for suggestion.
Regards,
Ravi
Here's a detailed example about how to access the property values of a file:
http://support.microsoft.com/kb/186898
Here's a shorter example that shows how to write property values:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa380387(v=vs.85).aspx
I don't know about the property Tags (I haven't seen it anywhere), but as you see, it basically is possible to manipulate properties of NTFS files.

How to combine the working directory with a user specified file (w or w/o path) to get the up-dir of the file

at the moment I'm writing a kind of lib, which gets from outside the file name 'sFilename'. With it data were written to a file it will be created, data were append to an existing file with data, data were updated in an existing file with data or the data were read from an existing data.
The user of the application with my lib should get as much as possible on information about errors of file handling.
For this purpose I code a method FileExists(...) which uses _stat() to determine if a file exists or not and a method "bool checkPermission(std::string sFilename, CFile::EOpenmode iOpenmode)" which gives back a bool if the specified file (sFilename) with the iOpenmode (Read, Write, Readwrite) have the permission to be read, written or read and written.
This method works with _stat(sFilename.c_str(), &buf) too and gives the desired information of the file back in buf.
Before checking any file I want to check if the directory containing the specified file has the desired permissions and for that I want to use the checkPermission method [works with _stat()] for the directory!
Now the problem: how can I determine easyly the containing directory? If the user just give a filename "test.txt" the file will be created or read in working directory. So its easy to get the up-directory. Its the same like the working directory. (And there its simple to use checkPermission to get detailed information about the directory).
But what about when the user not only give the file name? For exaample "....\test.txt" or "dir1\dir2\test.txt". How to combine the working directory with a specific path to gain the up-directory of the file and then to check the permissions?
Phew, I hope all is clear and it was'nt too long ;-)
Rumo
I'd suggest using the Boost FileSystem library at www.boost.org. In particular, check out the path class, which has methods such as make_absolute and parent_path.
This is Windows example code GetFileNameFromHandle to show you how to get the path from a HANDLE. I think it is what you are looking for.
http://msdn.microsoft.com/en-us/library/aa366789%28v=vs.85%29.aspx
I found out that _stat() and _access() doesn't really works for the permissions of the directories. See this stackoverflow page.
With _stat() you can't use ".\" to get information about the current directory. But _access() at least can check if a directory exists as well ".\" or "..\".
In conclusion I use _access() to check the existence of a directory and _stat() to check the permissions of an existing file. If a file should be created I'll check it by doing.
And by the way ;-) I don't need to combine working directory with the user specified file because I can use the specified file alone in _access() to determine if directory exists.
Rumo